# lin327/sre-atlas-agent architecture

> Architecture diagram of the GitHub repository lin327/sre-atlas-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lin327/sre-atlas-agent
- Repository: https://github.com/lin327/sre-atlas-agent

## Overview

SRE Atlas Agent is a collection-to-draft pipeline: a person or manually triggered workflow starts a run, RSS and GitHub content is collected, deduplicated and budget-limited, then Claude generates and validates Chinese MDX drafts for human review. The runtime also supports periodic collection and SQLite recovery of generated results. The README documents later review and PR promotion into sre-wiki, but this repository does not automate that handoff. Edges reflect the sampled main pipeline, source-index references, or explicit README statements; unsampled implementation details are not inferred.

Main entry points: [`agent/main.py`](https://github.com/lin327/sre-atlas-agent/blob/main/agent/main.py) (CLI pipeline), [`agent/generator.py`](https://github.com/lin327/sre-atlas-agent/blob/main/agent/generator.py) (Claude generator), [`agent/collectors/github_collector.py`](https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/github_collector.py) (GitHub collector), [`agent/collectors/rss_collector.py`](https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/rss_collector.py) (RSS collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Run orchestration"]
  node_main["CLI pipeline<br/>[main.py]"]
  node_scheduler["Periodic scheduler<br/>[scheduler.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
end

subgraph group_collection["Content collection"]
  node_sources["Source configuration<br/>[sources.yaml]"]
  node_rss["RSS collector<br/>[rss_collector.py]"]
  node_github["GitHub collector"]
end

subgraph group_generation["Draft generation"]
  node_category["Category mapping<br/>[category_map.py]"]
  node_generator["Claude generator<br/>[generator.py]"]
  node_schema["Frontmatter contract<br/>[content_schema.py]"]
end

subgraph group_state["Deduplication state"]
  node_dedup[("URL and result store<br/>[dedup.py]")]
end

node_operator(("Operator / workflow"))
node_github_api["GitHub API"]
node_claude["Claude API"]
node_drafts["Reviewable MDX drafts"]
node_reviewer(("Human reviewer"))
node_wiki["sre-wiki"]

node_operator -->|"starts run"| node_main
node_main -->|"starts periodic mode"| node_scheduler
node_main -->|"collects from"| node_rss
node_main -->|"collects from"| node_github
node_rss -->|"reads feeds"| node_sources
node_github -->|"reads repositories"| node_sources
node_github -->|"fetches issues / PRs"| node_github_api
node_main -->|"checks and records URLs"| node_dedup
node_main -->|"generates selected items"| node_generator
node_generator -->|"requests generation"| node_claude
node_generator -->|"classifies content"| node_category
node_generator -->|"normalizes and validates"| node_schema
node_generator -->|"reads model settings"| node_settings
node_main -->|"writes drafts"| node_drafts
node_reviewer -->|"reviews drafts"| node_drafts
node_reviewer -->|"promotes via PR"| node_wiki

click node_main "https://github.com/lin327/sre-atlas-agent/blob/main/agent/main.py"
click node_scheduler "https://github.com/lin327/sre-atlas-agent/blob/main/agent/scheduler.py"
click node_sources "https://github.com/lin327/sre-atlas-agent/blob/main/config/sources.yaml"
click node_rss "https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/rss_collector.py"
click node_github "https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/github_collector.py"
click node_category "https://github.com/lin327/sre-atlas-agent/blob/main/agent/category_map.py"
click node_generator "https://github.com/lin327/sre-atlas-agent/blob/main/agent/generator.py"
click node_schema "https://github.com/lin327/sre-atlas-agent/blob/main/agent/content_schema.py"
click node_dedup "https://github.com/lin327/sre-atlas-agent/blob/main/agent/dedup.py"
click node_settings "https://github.com/lin327/sre-atlas-agent/blob/main/config/settings.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_scheduler,node_settings,node_drafts,node_reviewer toneBlue
class node_sources,node_rss,node_github toneAmber
class node_category,node_generator,node_schema,node_github_api,node_claude toneMint
class node_dedup toneRose
class node_operator,node_wiki toneIndigo
```

## Components

### Run orchestration

- [CLI pipeline](https://github.com/lin327/sre-atlas-agent/blob/main/agent/main.py): `agent/main.py`
- [Periodic scheduler](https://github.com/lin327/sre-atlas-agent/blob/main/agent/scheduler.py): `agent/scheduler.py`
- [Runtime settings](https://github.com/lin327/sre-atlas-agent/blob/main/config/settings.py): `config/settings.py`

### Content collection

- [Source configuration](https://github.com/lin327/sre-atlas-agent/blob/main/config/sources.yaml): `config/sources.yaml`
- [RSS collector](https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/rss_collector.py): `agent/collectors/rss_collector.py`
- [GitHub collector](https://github.com/lin327/sre-atlas-agent/blob/main/agent/collectors/github_collector.py): `agent/collectors/github_collector.py`

### Draft generation

- [Category mapping](https://github.com/lin327/sre-atlas-agent/blob/main/agent/category_map.py): `agent/category_map.py`
- [Claude generator](https://github.com/lin327/sre-atlas-agent/blob/main/agent/generator.py): `agent/generator.py`
- [Frontmatter contract](https://github.com/lin327/sre-atlas-agent/blob/main/agent/content_schema.py): `agent/content_schema.py`

### Deduplication state

- [URL and result store](https://github.com/lin327/sre-atlas-agent/blob/main/agent/dedup.py): `agent/dedup.py`

### Other components

- **Operator / workflow**
- **GitHub API**
- **Claude API**
- **Reviewable MDX drafts**
- **Human reviewer**
- **sre-wiki**

## Connections

- Operator / workflow → CLI pipeline: starts run (evidence: `README.md`)
- CLI pipeline → Periodic scheduler: starts periodic mode (evidence: `agent/main.py`)
- CLI pipeline → RSS collector: collects from (evidence: `agent/main.py`)
- CLI pipeline → GitHub collector: collects from (evidence: `agent/main.py`)
- RSS collector → Source configuration: reads feeds (evidence: `README.md`)
- GitHub collector → Source configuration: reads repositories (evidence: `README.md`)
- GitHub collector → GitHub API: fetches issues / PRs (evidence: `agent/collectors/github_collector.py`)
- CLI pipeline → URL and result store: checks and records URLs (evidence: `agent/main.py`)
- CLI pipeline → Claude generator: generates selected items (evidence: `agent/main.py`)
- Claude generator → Claude API: requests generation (evidence: `agent/generator.py`)
- Claude generator → Category mapping: classifies content (evidence: `agent/generator.py`)
- Claude generator → Frontmatter contract: normalizes and validates (evidence: `agent/generator.py`)
- Claude generator → Runtime settings: reads model settings (evidence: `agent/generator.py`)
- CLI pipeline → Reviewable MDX drafts: writes drafts (evidence: `README.md`)
- Human reviewer → Reviewable MDX drafts: reviews drafts (evidence: `README.md`)
- Human reviewer → sre-wiki: promotes via PR (evidence: `README.md`)
