System architecture
Status: Current
GitHub Backup copies a person's GitHub repositories to storage they choose and shows them what happened. A worker on the user's machine does the backups; a dashboard, a Go API, an AI assistant (the Observatory) and an MCP server serve one deployment's many accounts.
The architecture documents in architecture/ describe it part by part, each in one place:
| Topic | Document |
|---|---|
| Who uses it and what it touches | 01 system context |
| The services, how they talk, where they run, the Go layout | 02 containers and deployment |
| Which service owns which table, retention, migrations | 03 data ownership |
| Backups, linking, dashboard reads, live logs, chat, step by step | 04 runtime flows |
| Deploying, migrating, restoring, rotating secrets, incidents | 06 operations |
| Principals, secrets, exposure | 07 security |
| Logs, metrics, alerts | 08 observability |
| Where it is going | Target architecture |
Each service's README has its details: dashboard, API, Observatory, MCP server, worker. Accounts and isolation: MULTI_USER_ARCHITECTURE.md. Every route: API_REFERENCE.md.
Search and the assistant
The tool-calling chat
sequenceDiagram
autonumber
actor User as User / Admin
participant UI as Frontend (Next.js)
participant Agent as Python Observatory
participant DB as PostgreSQL + pgvector
participant LLM as OpenRouter AI
User->>UI: Submit inquiry ("Analyze clone failures")
UI->>Agent: POST /chat/stream (SSE)
rect rgb(240, 245, 255)
Note over Agent,DB: Pre-Turn Context Enrichment
Agent->>DB: Query top relevance chunks (pgvector + FTS)
DB-->>Agent: Ingest initial context
end
Agent->>LLM: Turn 1: System prompt + User question + Injected context
LLM-->>Agent: Emit tool call: hybrid_search_knowledge_base("clone timeout")
rect rgb(240, 255, 240)
Note over Agent,DB: Dynamic Tool-Calling RAG
Agent->>DB: Execute FTS + pgvector Cosine Search + RRF over the index
DB-->>Agent: Ranked source chunks
end
Agent->>LLM: Turn 2: Feed tool results back to LLM
LLM-->>Agent: Emit final response tokens
Agent-->>UI: Stream SSE tokens to UI
UI-->>User: Display markdown-formatted answer
Hybrid search
The search engine searches the index (run failures, failed results, fixes and investigations; ADR 0008) in three stages:
- Full-Text Search (FTS) & Trigram Matching:
- Utilizes PostgreSQL
tsvector(content_tsv) withts_rank_cdscoring for keyword accuracy. - Includes
ILIKEsubstring fallback for technical symbols and error codes.
- Utilizes PostgreSQL
- pgvector Semantic Similarity:
- Uses cosine distance operator
<=>against generation-specific embedding vectors.
- Uses cosine distance operator
- Reciprocal Rank Fusion (RRF):
- Merges FTS and semantic results using reciprocal rank scoring: $$\text{Score}(d) = \frac{w_{\text{fts}}}{k + r_{\text{fts}}(d) + 1} + \frac{w_{\text{sem}}}{k + r_{\text{sem}}(d) + 1}$$
- Smooths ranking discrepancies and eliminates threshold tuning dependencies.
When no chunk matches, nothing else is searched: since B7a there is no fallback over the runs tables. The index is filled by background jobs (ADR 0013): a failed run is indexed from its run.failed event through the insights API.