# sumukha-r/pr-rakshaka architecture

> Architecture diagram of the GitHub repository sumukha-r/pr-rakshaka, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sumukha-r/pr-rakshaka
- Repository: https://github.com/sumukha-r/pr-rakshaka

## Overview

pr-rakshaka reviews GitHub pull requests from a web UI or CLI: it fetches the PR, runs missing-test, code-reuse, and hot-path-smell checks, filters findings against added diff lines, and produces a deterministic report. The repository also contains an agent-based review implementation and a nightly indexing pipeline; these are shown as distinct branches. Edges follow README workflow statements and sampled source references; unsampled implementations are represented only where the tree supports their subsystem.

Main entry points: [`main.py`](https://github.com/sumukha-r/pr-rakshaka/blob/main/main.py) (CLI runner), [`src/llm/client.py`](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/llm/client.py) (LLM client), [`src/checks/reuse_detector.py`](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/reuse_detector.py) (Reuse detection), [`src/rag/indexer.py`](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/rag/indexer.py) (Repository indexer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Review entry points"]
  node_web["Streamlit UI<br/>[app.py]"]
  node_cli["CLI runner<br/>[main.py]"]
end

subgraph group_review["Review workflow"]
  node_pr_fetch["PR ingestion<br/>[pr_parser.py]"]
  node_test_check["Missing tests<br/>[missing_tests.py]"]
  node_reuse_check["Reuse detection<br/>[reuse_detector.py]"]
  node_smell_check["Hot-path smells<br/>[hot_path_smells.py]"]
  node_evidence["Evidence filter<br/>[aggregator.py]"]
  node_report["Review report<br/>[generator.py]"]
  node_llm["LLM client<br/>[client.py]"]
end

subgraph group_context["Code context"]
  node_indexer["Repository indexer<br/>[indexer.py]"]
  node_retriever["Code retriever<br/>[retriever.py]"]
  node_vector_store[("ChromaDB index")]
end

subgraph group_agent["Agent review"]
  node_agent_checks["Agent checks<br/>[checks.py]"]
  node_agent_loop["Agent loop<br/>[loop.py]"]
  node_agent_tools["Repository tools<br/>[tools.py]"]
  node_agent_github["GitHub reader<br/>[github.py]"]
end

subgraph group_ops["Nightly pipeline"]
  node_nightly_dag["Airflow schedule"]
  node_nightly["Nightly pipeline<br/>[nightly.py]"]
end

node_reviewer(("Reviewer"))
node_github["GitHub REST API"]
node_llm_providers["Groq / Ollama"]

node_reviewer -->|"submits PR"| node_web
node_reviewer -->|"provides URL"| node_cli
node_web -->|"calls shared runner"| node_cli
node_cli -->|"fetches PR"| node_pr_fetch
node_pr_fetch -->|"requests PR data"| node_github
node_cli -->|"runs check"| node_test_check
node_cli -->|"runs check"| node_reuse_check
node_cli -->|"runs check"| node_smell_check
node_cli -->|"optionally indexes"| node_indexer
node_reuse_check -->|"searches similar code"| node_retriever
node_test_check -->|"requests judgment"| node_llm
node_reuse_check -->|"requests judgment"| node_llm
node_smell_check -->|"requests judgment"| node_llm
node_llm -->|"calls configured backend"| node_llm_providers
node_cli -->|"filters findings"| node_evidence
node_cli -->|"generates report"| node_report
node_indexer -->|"persists embeddings"| node_vector_store
node_retriever -->|"searches index"| node_vector_store
node_agent_checks -->|"uses review loop"| node_agent_loop
node_agent_loop -->|"dispatches tools"| node_agent_tools
node_agent_tools -->|"reads repository"| node_agent_github
node_nightly_dag -->|"invokes pipeline"| node_nightly
node_nightly -->|"indexes repository"| node_indexer

click node_web "https://github.com/sumukha-r/pr-rakshaka/blob/main/app.py"
click node_cli "https://github.com/sumukha-r/pr-rakshaka/blob/main/main.py"
click node_pr_fetch "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/ingestion/pr_parser.py"
click node_test_check "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/missing_tests.py"
click node_reuse_check "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/reuse_detector.py"
click node_smell_check "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/hot_path_smells.py"
click node_evidence "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/llm/aggregator.py"
click node_report "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/report/generator.py"
click node_llm "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/llm/client.py"
click node_indexer "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/rag/indexer.py"
click node_retriever "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/rag/retriever.py"
click node_agent_checks "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/checks.py"
click node_agent_loop "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/loop.py"
click node_agent_tools "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/tools.py"
click node_agent_github "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/github.py"
click node_nightly_dag "https://github.com/sumukha-r/pr-rakshaka/blob/main/airflow/dags/pr_rakshaka_nightly.py"
click node_nightly "https://github.com/sumukha-r/pr-rakshaka/blob/main/src/pipeline/nightly.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_web,node_cli,node_reviewer toneBlue
class node_pr_fetch,node_test_check,node_reuse_check,node_smell_check,node_evidence,node_report,node_llm toneAmber
class node_indexer,node_retriever,node_vector_store,node_github toneMint
class node_agent_checks,node_agent_loop,node_agent_tools,node_agent_github toneRose
class node_nightly_dag,node_nightly,node_llm_providers toneIndigo
```

## Components

### Review entry points

- [Streamlit UI](https://github.com/sumukha-r/pr-rakshaka/blob/main/app.py): `app.py`
- [CLI runner](https://github.com/sumukha-r/pr-rakshaka/blob/main/main.py): `main.py`

### Review workflow

- [PR ingestion](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/ingestion/pr_parser.py): `src/ingestion/pr_parser.py`
- [Missing tests](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/missing_tests.py): `src/checks/missing_tests.py`
- [Reuse detection](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/reuse_detector.py): `src/checks/reuse_detector.py`
- [Hot-path smells](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/checks/hot_path_smells.py): `src/checks/hot_path_smells.py`
- [Evidence filter](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/llm/aggregator.py): `src/llm/aggregator.py`
- [Review report](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/report/generator.py): `src/report/generator.py`
- [LLM client](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/llm/client.py): `src/llm/client.py`

### Code context

- [Repository indexer](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/rag/indexer.py): `src/rag/indexer.py`
- [Code retriever](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/rag/retriever.py): `src/rag/retriever.py`
- **ChromaDB index**

### Agent review

- [Agent checks](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/checks.py): `src/agent/checks.py`
- [Agent loop](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/loop.py): `src/agent/loop.py`
- [Repository tools](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/tools.py): `src/agent/tools.py`
- [GitHub reader](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/agent/github.py): `src/agent/github.py`

### Nightly pipeline

- [Airflow schedule](https://github.com/sumukha-r/pr-rakshaka/blob/main/airflow/dags/pr_rakshaka_nightly.py): `airflow/dags/pr_rakshaka_nightly.py`
- [Nightly pipeline](https://github.com/sumukha-r/pr-rakshaka/blob/main/src/pipeline/nightly.py): `src/pipeline/nightly.py`

### Other components

- **Reviewer**
- **GitHub REST API**
- **Groq / Ollama**

## Connections

- Reviewer → Streamlit UI: submits PR (evidence: `README.md`)
- Reviewer → CLI runner: provides URL (evidence: `README.md`)
- Streamlit UI → CLI runner: calls shared runner (evidence: `README.md`)
- CLI runner → PR ingestion: fetches PR (evidence: `main.py`)
- PR ingestion → GitHub REST API: requests PR data (evidence: `README.md`)
- CLI runner → Missing tests: runs check (evidence: `main.py`)
- CLI runner → Reuse detection: runs check (evidence: `main.py`)
- CLI runner → Hot-path smells: runs check (evidence: `main.py`)
- CLI runner → Repository indexer: optionally indexes (evidence: `main.py`)
- Reuse detection → Code retriever: searches similar code (evidence: `src/checks/reuse_detector.py`)
- Missing tests → LLM client: requests judgment (evidence: `src/checks/missing_tests.py`)
- Reuse detection → LLM client: requests judgment (evidence: `src/checks/reuse_detector.py`)
- Hot-path smells → LLM client: requests judgment (evidence: `src/checks/hot_path_smells.py`)
- LLM client → Groq / Ollama: calls configured backend (evidence: `README.md`)
- CLI runner → Evidence filter: filters findings (evidence: `main.py`)
- CLI runner → Review report: generates report (evidence: `main.py`)
- Repository indexer → ChromaDB index: persists embeddings (evidence: `README.md`)
- Code retriever → ChromaDB index: searches index (evidence: `README.md`)
- Agent checks → Agent loop: uses review loop (evidence: `src/agent/checks.py`)
- Agent loop → Repository tools: dispatches tools (evidence: `src/agent/loop.py`)
- Repository tools → GitHub reader: reads repository (evidence: `src/agent/tools.py`)
- Airflow schedule → Nightly pipeline: invokes pipeline (evidence: `airflow/dags/pr_rakshaka_nightly.py`)
- Nightly pipeline → Repository indexer: indexes repository (evidence: `src/pipeline/nightly.py`)
