# krey-yon/pra architecture

> Architecture diagram of the GitHub repository krey-yon/pra, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krey-yon/pra
- Repository: https://github.com/krey-yon/pra

## Overview

Strivon is a self-hosted GitHub pull-request review agent. Its main workflow verifies and normalizes GitHub webhooks, durably queues accepted work, runs a fenced review using repository context and AI, verifies findings, then publishes results to GitHub while retaining repository memory. A separate admin-console workflow configures GitHub, model providers, and enabled repositories. The README documents the major review capabilities; the sampled source confirms intake, dispatch, persistence, worker, and console wiring, but several internal runtime links are documented rather than inspected directly.

Main entry points: [`src/execution/orchestrator.ts`](https://github.com/krey-yon/pra/blob/main/src/execution/orchestrator.ts) (Run Orchestrator), [`src/execution/worker.ts`](https://github.com/krey-yon/pra/blob/main/src/execution/worker.ts) (Execution Worker), [`src/console/server.ts`](https://github.com/krey-yon/pra/blob/main/src/console/server.ts) (Console API), [`src/app/index.ts`](https://github.com/krey-yon/pra/blob/main/src/app/index.ts) (HTTP App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Webhook Intake"]
  node_webapp["HTTP App<br/>[index.ts]"]
  node_dispatch["Webhook Dispatch"]
  node_inbox["Webhook Inbox<br/>[webhook-inbox.ts]"]
end

subgraph group_execution["Durable Execution"]
  node_workerprocess["Worker Process<br/>[worker.ts]"]
  node_queueworker["Execution Worker<br/>[worker.ts]"]
  node_admission["Run Admission<br/>[admission.ts]"]
  node_orchestrator["Run Orchestrator<br/>[orchestrator.ts]"]
end

subgraph group_review["Review Runtime"]
  node_diff["Diff Context<br/>[diff-context.ts]"]
  node_policy["Repository Policy<br/>[repo-policy.ts]"]
  node_impact["Symbol Impact<br/>[symbol-impact.ts]"]
  node_agent["ReAct Review<br/>[agent-loop.ts]"]
  node_verify["Finding Verification<br/>[verifier.ts]"]
  node_scm["GitHub Gateway<br/>[github.ts]"]
end

subgraph group_console["Admin Console"]
  node_consoleapi["Console API<br/>[server.ts]"]
  node_consoleui["Console UI<br/>[App.tsx]"]
  node_consoledata[("Console Settings<br/>[store.ts]")]
  node_connections["Provider Connections<br/>[connections.ts]"]
end

subgraph group_state["Persistent State"]
  node_execstore[("Execution Store<br/>[store.ts]")]
  node_memory[("Repository Memory<br/>[memory.ts]")]
end

node_github(("GitHub"))
node_provider{{"AI Providers"}}
node_postgres[("PostgreSQL")]

node_github -->|"sends webhooks"| node_webapp
node_webapp -->|"dispatches"| node_dispatch
node_dispatch -->|"persists accepted events"| node_inbox
node_inbox -->|"writes outbox"| node_postgres
node_webapp -->|"starts"| node_consoleapi
node_workerprocess -->|"starts"| node_queueworker
node_queueworker -->|"plans runs"| node_admission
node_queueworker -->|"executes runs"| node_orchestrator
node_queueworker -->|"dispatches work"| node_execstore
node_execstore -.->|"stores run state"| node_postgres
node_orchestrator -.->|"builds review context"| node_diff
node_diff -->|"applies ignore policy"| node_policy
node_orchestrator -.->|"analyzes changed symbols"| node_impact
node_orchestrator -.->|"runs review"| node_agent
node_agent -.->|"requests generation"| node_provider
node_agent -.->|"checks findings"| node_verify
node_orchestrator -.->|"loads and records memory"| node_memory
node_orchestrator -.->|"reads and publishes"| node_scm
node_scm -.->|"publishes review"| node_github
node_consoleui -->|"calls API"| node_consoleapi
node_consoleapi -->|"reads settings"| node_consoledata
node_consoledata -.->|"persists settings"| node_postgres
node_consoleapi -->|"configures providers"| node_connections
node_connections -.->|"routes generation"| node_provider

click node_webapp "https://github.com/krey-yon/pra/blob/main/src/app/index.ts"
click node_dispatch "https://github.com/krey-yon/pra/blob/main/src/github/webhook/dispatch-webhook.ts"
click node_inbox "https://github.com/krey-yon/pra/blob/main/src/db/webhook-inbox.ts"
click node_workerprocess "https://github.com/krey-yon/pra/blob/main/src/app/worker.ts"
click node_queueworker "https://github.com/krey-yon/pra/blob/main/src/execution/worker.ts"
click node_admission "https://github.com/krey-yon/pra/blob/main/src/execution/admission.ts"
click node_orchestrator "https://github.com/krey-yon/pra/blob/main/src/execution/orchestrator.ts"
click node_execstore "https://github.com/krey-yon/pra/blob/main/src/execution/store.ts"
click node_diff "https://github.com/krey-yon/pra/blob/main/src/runtime/diff-context.ts"
click node_policy "https://github.com/krey-yon/pra/blob/main/src/runtime/repo-policy.ts"
click node_impact "https://github.com/krey-yon/pra/blob/main/src/runtime/symbol-impact.ts"
click node_agent "https://github.com/krey-yon/pra/blob/main/src/runtime/agent-loop.ts"
click node_verify "https://github.com/krey-yon/pra/blob/main/src/runtime/verifier.ts"
click node_memory "https://github.com/krey-yon/pra/blob/main/src/runtime/memory.ts"
click node_scm "https://github.com/krey-yon/pra/blob/main/src/runtime/github.ts"
click node_consoleapi "https://github.com/krey-yon/pra/blob/main/src/console/server.ts"
click node_consoleui "https://github.com/krey-yon/pra/blob/main/src/console/ui/App.tsx"
click node_consoledata "https://github.com/krey-yon/pra/blob/main/src/console/store.ts"
click node_connections "https://github.com/krey-yon/pra/blob/main/src/console/connections.ts"

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_webapp,node_dispatch,node_inbox toneBlue
class node_workerprocess,node_queueworker,node_admission,node_orchestrator,node_postgres toneAmber
class node_diff,node_policy,node_impact,node_agent,node_verify,node_scm toneMint
class node_consoleapi,node_consoleui,node_consoledata,node_connections toneRose
class node_execstore,node_memory,node_github,node_provider toneIndigo
```

## Components

### Webhook Intake

- [HTTP App](https://github.com/krey-yon/pra/blob/main/src/app/index.ts): `src/app/index.ts`
- [Webhook Dispatch](https://github.com/krey-yon/pra/blob/main/src/github/webhook/dispatch-webhook.ts): `src/github/webhook/dispatch-webhook.ts`
- [Webhook Inbox](https://github.com/krey-yon/pra/blob/main/src/db/webhook-inbox.ts): `src/db/webhook-inbox.ts`

### Durable Execution

- [Worker Process](https://github.com/krey-yon/pra/blob/main/src/app/worker.ts): `src/app/worker.ts`
- [Execution Worker](https://github.com/krey-yon/pra/blob/main/src/execution/worker.ts): `src/execution/worker.ts`
- [Run Admission](https://github.com/krey-yon/pra/blob/main/src/execution/admission.ts): `src/execution/admission.ts`
- [Run Orchestrator](https://github.com/krey-yon/pra/blob/main/src/execution/orchestrator.ts): `src/execution/orchestrator.ts`

### Review Runtime

- [Diff Context](https://github.com/krey-yon/pra/blob/main/src/runtime/diff-context.ts): `src/runtime/diff-context.ts`
- [Repository Policy](https://github.com/krey-yon/pra/blob/main/src/runtime/repo-policy.ts): `src/runtime/repo-policy.ts`
- [Symbol Impact](https://github.com/krey-yon/pra/blob/main/src/runtime/symbol-impact.ts): `src/runtime/symbol-impact.ts`
- [ReAct Review](https://github.com/krey-yon/pra/blob/main/src/runtime/agent-loop.ts): `src/runtime/agent-loop.ts`
- [Finding Verification](https://github.com/krey-yon/pra/blob/main/src/runtime/verifier.ts): `src/runtime/verifier.ts`
- [GitHub Gateway](https://github.com/krey-yon/pra/blob/main/src/runtime/github.ts): `src/runtime/github.ts`

### Admin Console

- [Console API](https://github.com/krey-yon/pra/blob/main/src/console/server.ts): `src/console/server.ts`
- [Console UI](https://github.com/krey-yon/pra/blob/main/src/console/ui/App.tsx): `src/console/ui/App.tsx`
- [Console Settings](https://github.com/krey-yon/pra/blob/main/src/console/store.ts): `src/console/store.ts`
- [Provider Connections](https://github.com/krey-yon/pra/blob/main/src/console/connections.ts): `src/console/connections.ts`

### Persistent State

- [Execution Store](https://github.com/krey-yon/pra/blob/main/src/execution/store.ts): `src/execution/store.ts`
- [Repository Memory](https://github.com/krey-yon/pra/blob/main/src/runtime/memory.ts): `src/runtime/memory.ts`

### Other components

- **GitHub**
- **AI Providers**
- **PostgreSQL**

## Connections

- GitHub → HTTP App: sends webhooks
- HTTP App → Webhook Dispatch: dispatches (evidence: `src/app/index.ts`)
- Webhook Dispatch → Webhook Inbox: persists accepted events (evidence: `src/app/index.ts`)
- Webhook Inbox → PostgreSQL: writes outbox (evidence: `src/db/webhook-inbox.ts`)
- HTTP App → Console API: starts (evidence: `src/app/index.ts`)
- Worker Process → Execution Worker: starts (evidence: `src/app/worker.ts`)
- Execution Worker → Run Admission: plans runs (evidence: `src/execution/worker.ts`)
- Execution Worker → Run Orchestrator: executes runs (evidence: `src/execution/worker.ts`)
- Execution Worker → Execution Store: dispatches work (evidence: `src/execution/worker.ts`)
- Execution Store → PostgreSQL: stores run state
- Run Orchestrator → Diff Context: builds review context
- Diff Context → Repository Policy: applies ignore policy (evidence: `src/runtime/diff-context.ts`)
- Run Orchestrator → Symbol Impact: analyzes changed symbols
- Run Orchestrator → ReAct Review: runs review
- ReAct Review → AI Providers: requests generation
- ReAct Review → Finding Verification: checks findings
- Run Orchestrator → Repository Memory: loads and records memory
- Run Orchestrator → GitHub Gateway: reads and publishes
- GitHub Gateway → GitHub: publishes review
- Console UI → Console API: calls API (evidence: `src/console/ui/App.tsx`)
- Console API → Console Settings: reads settings (evidence: `src/console/server.ts`)
- Console Settings → PostgreSQL: persists settings
- Console API → Provider Connections: configures providers (evidence: `src/console/server.ts`)
- Provider Connections → AI Providers: routes generation
