Code Reviewer Architecture

update: code reviewer architectural diagram

af643902 · 2026-08-16 00:24:25 -0700

← Architecture History
graph TD
    subgraph User["User Layer"]
        Browser["Browser"]
    end

    subgraph OCR["Code Reviewer"]
        FastAPI["FastAPI Server"]
        Auth["Google OAuth + Session"]
        Upload["File Upload Handler"]
        GitHub["GitHub Service"]
        OllamaSvc["Ollama Service"]
        AgentSelect["Agent Selection Triage
scans file inventory, picks N files"] Scrubber["Regurgitation Scrubber
2-pass server-side pipeline"] Truncate["File Truncator
200-line cap"] Encrypt["Fernet Encryption
AES-256 at rest for PATs"] Prefs["User Preferences
model + review mode per user"] Findings["Finding Cards
Raw/Cards toggle, filter chips, copy, post to PR"] SoftDel["Soft Delete
status=deleted, nullify content, keep row"] AuditMW["Audit Middleware
wraps every request"] Resume["Stale-Pending Sweeper
marks orphaned reviews stopped on restart"] Agentic["Agentic Review Engine
tool-calling loop: search + read files,
explores repo, emits structured findings"] Verifier["Re-grounding Verifier
checks the cited line exists AND that the quoted
evidence matches it; verified / misgrounded / unverified"] Gates["Finding Gates
trust boundary, CWE fit, precondition-bound severity
applied before a finding may be reported"] RepoMemory["Convention Memory
distills repeatedly-dismissed findings per repo,
injected as a prompt preamble"] end subgraph ReviewModes["Review Modes"] ModeUpload["Upload Review
drag-and-drop files"] ModeBranch["Branch Review
two-phase: select, then review"] ModeFolder["Folder Review
two-phase: select, then review"] ModePR["PR Review
diff + optional GitHub comment"] end subgraph Intelligence["Local Intelligence"] Ollama["Ollama
Local LLM Server"] end subgraph Data["Data Layer"] SQLite[("SQLite
users, sessions, reviews,
github_credentials, ownlifeos_links,
signup_invites, findings, finding_verdicts,
repo_memory")] Audit[("PostgreSQL Audit
cross-app aggregator
codereviewer writes here")] end subgraph External["External APIs"] GitHubAPI["GitHub REST API
repos / PRs / branches"] end subgraph Infra["Infrastructure"] CF["Cloudflare Tunnel"] Docker["Docker Compose"] OwnOS["OwnLifeOS JWT
suite-shared signing key"] end Browser -->|HTTPS| CF CF -->|HTTP| Docker Docker --> FastAPI FastAPI --> AuditMW AuditMW --> Auth Auth --> SQLite Docker -.->|on startup| Resume Resume -->|status=stopped| SQLite FastAPI --> ModeUpload FastAPI --> ModeBranch FastAPI --> ModeFolder FastAPI --> ModePR ModeUpload --> Truncate ModeBranch -->|phase 1: file inventory| AgentSelect ModeFolder -->|phase 1: file inventory| AgentSelect AgentSelect -->|selection event| Browser Browser -->|user-edited selection| AgentSelect AgentSelect -->|phase 2: confirmed files| Truncate Truncate --> OllamaSvc ModePR --> OllamaSvc ModeBranch -->|keepalive byte| Browser ModeFolder -->|keepalive byte| Browser Gates -->|prompt discipline| OllamaSvc Gates -->|prompt discipline| Agentic OllamaSvc -->|generate| Ollama Ollama -->|stream chunks| OllamaSvc OllamaSvc --> Scrubber Scrubber -->|strip code blocks + regurgitated text| FastAPI FastAPI -->|SSE stream| Browser ModeBranch -.->|agentic option| Agentic Agentic -->|search + read files| GitHub Agentic -->|tool-calling generate| Ollama Agentic -->|structured findings| Verifier Findings -.->|findings to verify| Verifier Verifier -->|verdicts + evidence| SQLite Findings -.->|repeated dismissals| RepoMemory RepoMemory -->|memory preamble| OllamaSvc RepoMemory --> SQLite FastAPI -->|save PAT| Encrypt Encrypt --> SQLite FastAPI --> Prefs Prefs --> SQLite FastAPI --> Findings FastAPI --> SoftDel SoftDel --> SQLite FastAPI -->|repo/PR calls| GitHub GitHub -->|REST| GitHubAPI Auth -->|server-to-server| OwnOS FastAPI -->|audit log| Audit classDef user fill:#1a1a2e,stroke:#e85555,stroke-width:2px,color:#fff classDef app fill:#16213e,stroke:#e8a020,stroke-width:2px,color:#e0e0e0 classDef mode fill:#16213e,stroke:#64b5f6,stroke-width:2px,color:#e0e0e0 classDef data fill:#16213e,stroke:#64b5f6,stroke-width:2px,color:#e0e0e0 classDef llm fill:#16213e,stroke:#3ecf6e,stroke-width:2px,color:#e0e0e0 classDef audit fill:#16213e,stroke:#ff6b9d,stroke-width:2px,color:#e0e0e0 classDef infra fill:#0f0f0f,stroke:#8888a8,stroke-width:1px,color:#8888a8 classDef external fill:#0f0f0f,stroke:#e85555,stroke-width:1px,color:#8888a8 classDef crypto fill:#1a1a2e,stroke:#c880ff,stroke-width:2px,color:#e0e0e0 classDef defense fill:#1a1a2e,stroke:#ff9900,stroke-width:2px,color:#e0e0e0 class Browser user class FastAPI,Auth,Upload,GitHub,OllamaSvc,AuditMW app class ModeUpload,ModeBranch,ModeFolder,ModePR mode class Prefs,Findings,SoftDel,Resume,RepoMemory app class Agentic,Verifier defense class SQLite data class Ollama llm class Audit audit class CF,Docker,OwnOS infra class GitHubAPI external class Encrypt crypto class Scrubber,Truncate,AgentSelect,Gates defense

Scroll to zoom · drag to pan · double-click to fit