# farheenaiml/trace-backup architecture

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

- Interactive diagram: https://gitdiagram.com/farheenaiml/trace-backup
- Repository: https://github.com/farheenaiml/trace-backup

## Overview

TRACE ingests GitHub repository activity, extracts decision rationale, indexes it for retrieval, and presents maintainers with evidence-grounded investigations and repository insights. Its backend also performs issue triage, health analysis, forecasting, and weekly brief generation; the React console provides the user-facing workflow. The README describes the broader product, while sampled source excerpts confirm only parts of the implementation, so uncertain UI-to-API wiring is omitted.

Main entry points: [`backend/main.py`](https://github.com/farheenaiml/trace-backup/blob/main/backend/main.py) (REST API), [`backend/agent.py`](https://github.com/farheenaiml/trace-backup/blob/main/backend/agent.py) (Issue Triage Agent), [`backend/graph_store.py`](https://github.com/farheenaiml/trace-backup/blob/main/backend/graph_store.py) (Rationale Indexing), [`backend/ingest.py`](https://github.com/farheenaiml/trace-backup/blob/main/backend/ingest.py) (GitHub Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Maintainer Console"]
  node_console_app["TRACE Console<br/>[App.tsx]"]
  node_api_client["API Client<br/>[api.ts]"]
end

subgraph group_ingestion["Repository Ingestion"]
  node_api_gateway["REST API<br/>[main.py]"]
  node_ingest["GitHub Ingestion<br/>[ingest.py]"]
  node_extractor["Rationale Extraction<br/>[extractor.py]"]
end

subgraph group_intelligence["Decision Intelligence"]
  node_agent["Issue Triage Agent<br/>[agent.py]"]
  node_llm["LLM Client<br/>[llm.py]"]
end

subgraph group_insights["Health and Briefs"]
  node_health["Health and Forecasting<br/>[health.py]"]
  node_brief["Weekly Brief<br/>[brief.py]"]
end

subgraph group_storage["Index and Storage"]
  node_graph_store["Rationale Indexing<br/>[graph_store.py]"]
  node_neo4j[("Neo4j")]
  node_chroma[("Chroma Vector Store")]
  node_qdrant[("Qdrant")]
end

node_maintainer(("Maintainer"))
node_github["GitHub"]
node_llm_services["Groq / Ollama"]

node_maintainer -->|"connects repository"| node_console_app
node_console_app -.->|"uses API"| node_api_client
node_api_gateway -->|"runs ingestion"| node_ingest
node_github -->|"provides repository data"| node_ingest
node_ingest -->|"supplies records"| node_extractor
node_extractor -->|"supplies rationale"| node_graph_store
node_graph_store -->|"writes relations"| node_neo4j
node_graph_store -->|"writes embeddings"| node_chroma
node_api_gateway -->|"runs triage"| node_agent
node_agent -->|"searches duplicates"| node_qdrant
node_agent -->|"scores issues"| node_llm
node_brief -->|"generates summary"| node_llm
node_llm -->|"requests completion"| node_llm_services
node_api_gateway -.->|"serves health metrics"| node_health
node_api_gateway -.->|"serves weekly brief"| node_brief

click node_console_app "https://github.com/farheenaiml/trace-backup/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/farheenaiml/trace-backup/blob/main/frontend/src/api.ts"
click node_api_gateway "https://github.com/farheenaiml/trace-backup/blob/main/backend/main.py"
click node_ingest "https://github.com/farheenaiml/trace-backup/blob/main/backend/ingest.py"
click node_extractor "https://github.com/farheenaiml/trace-backup/blob/main/backend/extractor.py"
click node_graph_store "https://github.com/farheenaiml/trace-backup/blob/main/backend/graph_store.py"
click node_agent "https://github.com/farheenaiml/trace-backup/blob/main/backend/agent.py"
click node_llm "https://github.com/farheenaiml/trace-backup/blob/main/backend/llm.py"
click node_health "https://github.com/farheenaiml/trace-backup/blob/main/backend/health.py"
click node_brief "https://github.com/farheenaiml/trace-backup/blob/main/backend/brief.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_console_app,node_api_client toneBlue
class node_api_gateway,node_ingest,node_extractor toneAmber
class node_agent,node_llm toneMint
class node_health,node_brief toneRose
class node_graph_store,node_neo4j,node_chroma,node_qdrant,node_maintainer,node_github,node_llm_services toneIndigo
```

## Components

### Maintainer Console

- [TRACE Console](https://github.com/farheenaiml/trace-backup/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API Client](https://github.com/farheenaiml/trace-backup/blob/main/frontend/src/api.ts): `frontend/src/api.ts`

### Repository Ingestion

- [REST API](https://github.com/farheenaiml/trace-backup/blob/main/backend/main.py): `backend/main.py`
- [GitHub Ingestion](https://github.com/farheenaiml/trace-backup/blob/main/backend/ingest.py): `backend/ingest.py`
- [Rationale Extraction](https://github.com/farheenaiml/trace-backup/blob/main/backend/extractor.py): `backend/extractor.py`

### Decision Intelligence

- [Issue Triage Agent](https://github.com/farheenaiml/trace-backup/blob/main/backend/agent.py): `backend/agent.py`
- [LLM Client](https://github.com/farheenaiml/trace-backup/blob/main/backend/llm.py): `backend/llm.py`

### Health and Briefs

- [Health and Forecasting](https://github.com/farheenaiml/trace-backup/blob/main/backend/health.py): `backend/health.py`
- [Weekly Brief](https://github.com/farheenaiml/trace-backup/blob/main/backend/brief.py): `backend/brief.py`

### Index and Storage

- [Rationale Indexing](https://github.com/farheenaiml/trace-backup/blob/main/backend/graph_store.py): `backend/graph_store.py`
- **Neo4j**
- **Chroma Vector Store**
- **Qdrant**

### Other components

- **Maintainer**
- **GitHub**
- **Groq / Ollama**

## Connections

- Maintainer → TRACE Console: connects repository (evidence: `README.md`)
- TRACE Console → API Client: uses API (evidence: `frontend/src/App.tsx`)
- REST API → GitHub Ingestion: runs ingestion (evidence: `README.md`)
- GitHub → GitHub Ingestion: provides repository data (evidence: `README.md`)
- GitHub Ingestion → Rationale Extraction: supplies records (evidence: `README.md`)
- Rationale Extraction → Rationale Indexing: supplies rationale (evidence: `backend/graph_store.py`)
- Rationale Indexing → Neo4j: writes relations (evidence: `backend/graph_store.py`)
- Rationale Indexing → Chroma Vector Store: writes embeddings (evidence: `backend/graph_store.py`)
- REST API → Issue Triage Agent: runs triage (evidence: `README.md`)
- Issue Triage Agent → Qdrant: searches duplicates (evidence: `backend/agent.py`)
- Issue Triage Agent → LLM Client: scores issues (evidence: `backend/agent.py`)
- Weekly Brief → LLM Client: generates summary (evidence: `backend/brief.py`)
- LLM Client → Groq / Ollama: requests completion (evidence: `backend/llm.py`)
- REST API → Health and Forecasting: serves health metrics (evidence: `backend/main.py`)
- REST API → Weekly Brief: serves weekly brief (evidence: `backend/main.py`)
