# home-operations/kritika architecture

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

- Interactive diagram: https://gitdiagram.com/home-operations/kritika
- Repository: https://github.com/home-operations/kritika

## Overview

kritika is a GitHub pull-request review service with repository indexing, agent-driven review and follow-up, forge write-back, and an operational dashboard. The principal flow starts at a forge webhook, schedules isolated jobs, reviews a pull request using indexed repository context and model access through a gateway, then publishes results. README-described capabilities are included where implementation excerpts were not available; the graph avoids asserting unshown internal calls beyond those documented relationships.

Main entry points: [`internal/worker/review.go`](https://github.com/home-operations/kritika/blob/main/internal/worker/review.go) (Review worker), [`internal/executor/executor.go`](https://github.com/home-operations/kritika/blob/main/internal/executor/executor.go) (Isolated runner), [`internal/jobs/jobs.go`](https://github.com/home-operations/kritika/blob/main/internal/jobs/jobs.go) (Job queue), [`internal/agent/loop.go`](https://github.com/home-operations/kritika/blob/main/internal/agent/loop.go) (Review agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Intake and scheduling"]
  node_webhook["Webhook intake<br/>[ingest.go]"]
  node_dispatcher["Event dispatcher<br/>[service.go]"]
  node_jobs["Job queue<br/>[jobs.go]"]
end

subgraph group_execution["Index and review execution"]
  node_indexer["Repository indexing<br/>[index.go]"]
  node_reviewer["Review worker<br/>[review.go]"]
  node_runner["Isolated runner<br/>[executor.go]"]
  node_agent["Review agent<br/>[loop.go]"]
  node_webhook_followups["Follow-up handling<br/>[followup.go]"]
  node_confidence["Confidence and approvals<br/>[review_decision.go]"]
  node_transcript["Agent transcripts<br/>[transcript.go]"]
end

subgraph group_context["Context and models"]
  node_repo_context["Context packing<br/>[pack.go]"]
  node_repository_index[("Vector index<br/>[index.go]")]
  node_model_gateway["Model gateway<br/>[gateway.go]"]
  node_model_providers["Model providers<br/>[model.go]"]
  node_egress["Egress gateway<br/>[egress.go]"]
  node_repo_config["Repository overrides<br/>[repoconfig.go]"]
end

subgraph group_forge["Forge integration"]
  node_forge_client["GitHub forge client<br/>[client.go]"]
  node_review_results["Review results<br/>[findings.go]"]
  node_store[("Postgres storage<br/>[store.go]")]
end

subgraph group_dashboard["Dashboard and API"]
  node_web_app["Dashboard UI<br/>[App.svelte]"]
  node_web_api["Dashboard API<br/>[server.go]"]
  node_review_api["Review endpoints<br/>[routes_reviews.go]"]
  node_auth["Sign-in and access<br/>[handler.go]"]
end

node_github(("GitHub"))
node_dashboard_user(("Dashboard user"))

node_github -->|"sends events"| node_webhook
node_webhook -->|"dispatches event"| node_dispatcher
node_dispatcher -->|"queues work"| node_jobs
node_jobs -.->|"runs index job"| node_indexer
node_jobs -.->|"runs review job"| node_reviewer
node_indexer -->|"writes chunks"| node_repository_index
node_reviewer -->|"starts runner"| node_runner
node_reviewer -->|"reads pull request"| node_forge_client
node_runner -.->|"builds review context"| node_repo_context
node_repo_context -.->|"retrieves similar chunks"| node_repository_index
node_runner -.->|"runs agent loop"| node_agent
node_agent -.->|"requests completion"| node_model_gateway
node_model_gateway -.->|"routes model calls"| node_model_providers
node_runner -.->|"routes outbound traffic"| node_egress
node_reviewer -.->|"records findings"| node_review_results
node_reviewer -.->|"publishes review"| node_forge_client
node_reviewer -.->|"persists review"| node_store
node_reviewer -.->|"scores review"| node_confidence
node_agent -.->|"records conversation"| node_transcript
node_github -.->|"mentions bot"| node_webhook_followups
node_webhook_followups -.->|"starts follow-up run"| node_runner
node_reviewer -.->|"applies overrides"| node_repo_config
node_dashboard_user -->|"uses dashboard"| node_web_app
node_web_app -.->|"requests API"| node_web_api
node_web_api -->|"routes review reads"| node_review_api
node_review_api -->|"reads review data"| node_store
node_web_app -.->|"signs in"| node_auth

click node_webhook "https://github.com/home-operations/kritika/blob/main/internal/ingest/ingest.go"
click node_dispatcher "https://github.com/home-operations/kritika/blob/main/internal/ingest/service.go"
click node_jobs "https://github.com/home-operations/kritika/blob/main/internal/jobs/jobs.go"
click node_indexer "https://github.com/home-operations/kritika/blob/main/internal/worker/index.go"
click node_reviewer "https://github.com/home-operations/kritika/blob/main/internal/worker/review.go"
click node_runner "https://github.com/home-operations/kritika/blob/main/internal/executor/executor.go"
click node_repo_context "https://github.com/home-operations/kritika/blob/main/internal/contextpack/pack.go"
click node_repository_index "https://github.com/home-operations/kritika/blob/main/internal/store/index.go"
click node_agent "https://github.com/home-operations/kritika/blob/main/internal/agent/loop.go"
click node_model_gateway "https://github.com/home-operations/kritika/blob/main/internal/gateway/gateway.go"
click node_model_providers "https://github.com/home-operations/kritika/blob/main/internal/model/model.go"
click node_egress "https://github.com/home-operations/kritika/blob/main/internal/egress/egress.go"
click node_forge_client "https://github.com/home-operations/kritika/blob/main/internal/forge/github/client.go"
click node_review_results "https://github.com/home-operations/kritika/blob/main/internal/review/findings.go"
click node_store "https://github.com/home-operations/kritika/blob/main/internal/store/store.go"
click node_web_app "https://github.com/home-operations/kritika/blob/main/internal/web/src/App.svelte"
click node_web_api "https://github.com/home-operations/kritika/blob/main/internal/webapi/server.go"
click node_review_api "https://github.com/home-operations/kritika/blob/main/internal/webapi/routes_reviews.go"
click node_webhook_followups "https://github.com/home-operations/kritika/blob/main/internal/worker/followup.go"
click node_repo_config "https://github.com/home-operations/kritika/blob/main/internal/repoconfig/repoconfig.go"
click node_confidence "https://github.com/home-operations/kritika/blob/main/internal/worker/review_decision.go"
click node_transcript "https://github.com/home-operations/kritika/blob/main/internal/transcript/transcript.go"
click node_auth "https://github.com/home-operations/kritika/blob/main/internal/auth/handler.go"

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_webhook,node_dispatcher,node_jobs,node_dashboard_user toneBlue
class node_indexer,node_reviewer,node_runner,node_agent,node_webhook_followups,node_confidence,node_transcript toneAmber
class node_repo_context,node_repository_index,node_model_gateway,node_model_providers,node_egress,node_repo_config toneMint
class node_forge_client,node_review_results,node_store toneRose
class node_web_app,node_web_api,node_review_api,node_auth,node_github toneIndigo
```

## Components

### Intake and scheduling

- [Webhook intake](https://github.com/home-operations/kritika/blob/main/internal/ingest/ingest.go): `internal/ingest/ingest.go`
- [Event dispatcher](https://github.com/home-operations/kritika/blob/main/internal/ingest/service.go): `internal/ingest/service.go`
- [Job queue](https://github.com/home-operations/kritika/blob/main/internal/jobs/jobs.go): `internal/jobs/jobs.go`

### Index and review execution

- [Repository indexing](https://github.com/home-operations/kritika/blob/main/internal/worker/index.go): `internal/worker/index.go`
- [Review worker](https://github.com/home-operations/kritika/blob/main/internal/worker/review.go): `internal/worker/review.go`
- [Isolated runner](https://github.com/home-operations/kritika/blob/main/internal/executor/executor.go): `internal/executor/executor.go`
- [Review agent](https://github.com/home-operations/kritika/blob/main/internal/agent/loop.go): `internal/agent/loop.go`
- [Follow-up handling](https://github.com/home-operations/kritika/blob/main/internal/worker/followup.go): `internal/worker/followup.go`
- [Confidence and approvals](https://github.com/home-operations/kritika/blob/main/internal/worker/review_decision.go): `internal/worker/review_decision.go`
- [Agent transcripts](https://github.com/home-operations/kritika/blob/main/internal/transcript/transcript.go): `internal/transcript/transcript.go`

### Context and models

- [Context packing](https://github.com/home-operations/kritika/blob/main/internal/contextpack/pack.go): `internal/contextpack/pack.go`
- [Vector index](https://github.com/home-operations/kritika/blob/main/internal/store/index.go): `internal/store/index.go`
- [Model gateway](https://github.com/home-operations/kritika/blob/main/internal/gateway/gateway.go): `internal/gateway/gateway.go`
- [Model providers](https://github.com/home-operations/kritika/blob/main/internal/model/model.go): `internal/model/model.go`
- [Egress gateway](https://github.com/home-operations/kritika/blob/main/internal/egress/egress.go): `internal/egress/egress.go`
- [Repository overrides](https://github.com/home-operations/kritika/blob/main/internal/repoconfig/repoconfig.go): `internal/repoconfig/repoconfig.go`

### Forge integration

- [GitHub forge client](https://github.com/home-operations/kritika/blob/main/internal/forge/github/client.go): `internal/forge/github/client.go`
- [Review results](https://github.com/home-operations/kritika/blob/main/internal/review/findings.go): `internal/review/findings.go`
- [Postgres storage](https://github.com/home-operations/kritika/blob/main/internal/store/store.go): `internal/store/store.go`

### Dashboard and API

- [Dashboard UI](https://github.com/home-operations/kritika/blob/main/internal/web/src/App.svelte): `internal/web/src/App.svelte`
- [Dashboard API](https://github.com/home-operations/kritika/blob/main/internal/webapi/server.go): `internal/webapi/server.go`
- [Review endpoints](https://github.com/home-operations/kritika/blob/main/internal/webapi/routes_reviews.go): `internal/webapi/routes_reviews.go`
- [Sign-in and access](https://github.com/home-operations/kritika/blob/main/internal/auth/handler.go): `internal/auth/handler.go`

### Other components

- **GitHub**
- **Dashboard user**

## Connections

- GitHub → Webhook intake: sends events
- Webhook intake → Event dispatcher: dispatches event (evidence: `internal/ingest/ingest.go`)
- Event dispatcher → Job queue: queues work (evidence: `internal/ingest/service.go`)
- Job queue → Repository indexing: runs index job
- Job queue → Review worker: runs review job
- Repository indexing → Vector index: writes chunks (evidence: `internal/worker/index.go`)
- Review worker → Isolated runner: starts runner (evidence: `internal/worker/review.go`)
- Review worker → GitHub forge client: reads pull request
- Isolated runner → Context packing: builds review context
- Context packing → Vector index: retrieves similar chunks
- Isolated runner → Review agent: runs agent loop
- Review agent → Model gateway: requests completion
- Model gateway → Model providers: routes model calls
- Isolated runner → Egress gateway: routes outbound traffic
- Review worker → Review results: records findings
- Review worker → GitHub forge client: publishes review
- Review worker → Postgres storage: persists review
- Review worker → Confidence and approvals: scores review
- Review agent → Agent transcripts: records conversation
- GitHub → Follow-up handling: mentions bot
- Follow-up handling → Isolated runner: starts follow-up run
- Review worker → Repository overrides: applies overrides
- Dashboard user → Dashboard UI: uses dashboard
- Dashboard UI → Dashboard API: requests API
- Dashboard API → Review endpoints: routes review reads (evidence: `internal/webapi/routes_reviews.go`)
- Review endpoints → Postgres storage: reads review data (evidence: `internal/webapi/routes_reviews.go`)
- Dashboard UI → Sign-in and access: signs in
