How yogeshwargopi/reviewer-agent works
Locus is a self-hosted GitHub App that reviews enabled pull requests and publishes findings and a check. The main flow is GitHub webhook → event handling and queued work → policy-aware review → GitHub publication, with a separate worker for review and installation-sync jobs. The dashboard manages installations, repositories, policies, model keys, and review results. Relationships are based on the README and SOURCE INDEX references; excerpts confirm important worker and pipeline calls, but several implementation details were not sampled.
Main entry points: pipeline.ts Review pipeline · schema.ts Postgres data · events.ts Event handling · actions.ts Dashboard actions
Components 22
Web app
- Dashboard
src/app/(dashboard)/overview/page.tsx - Review views
src/app/(dashboard)/reviews/[id]/page.tsx - Dashboard actions
src/server/actions.ts
GitHub integration
- Webhook endpoint
src/app/api/github/webhook/route.ts - Event handling
src/server/github/events.ts - Installation setup
src/server/github/sync.ts - GitHub App client
src/server/github/app.ts - Review publishing
src/server/github/publish.ts - Installation sync
src/server/github/sync.ts
Review processing
- Review pipeline
src/server/review/pipeline.ts - Policy resolution
src/server/review/policy.ts - Diff selection
src/server/review/diff.ts - Prompt building
src/server/review/prompt.ts - Model review
src/server/review/model.ts - Finding validation
src/server/review/findings.ts
Data and operations
- Authentication
src/server/auth.ts - Job queue
src/server/review/queue.ts - Worker
src/worker.ts - Postgres data
src/server/db/schema.ts
Other components
- GitHub user
- GitHub
- OpenAI / Anthropic
Connections 30
- GitHub user → Dashboard: manages setup
- Dashboard → Dashboard actions: submits changes
src/app/(dashboard)/overview/page.tsx - Dashboard → Authentication: loads session
src/app/(dashboard)/overview/page.tsx - Review views → Authentication: checks session
src/app/(dashboard)/reviews/[id]/page.tsx - Review views → Postgres data: loads results
- Dashboard actions → Postgres data: updates settings
src/server/actions.ts - Dashboard actions → Job queue: queues dry run
src/server/actions.ts - Dashboard actions → GitHub App client: gets installation client
src/server/actions.ts - Webhook endpoint → Event handling: dispatches delivery
src/app/api/github/webhook/route.ts - Webhook endpoint → Postgres data: records delivery
src/app/api/github/webhook/route.ts - Event handling → Job queue: queues reviews
src/server/github/events.ts - Event handling → Postgres data: reads and writes state
src/server/github/events.ts - Event handling → GitHub App client: gets installation client
src/server/github/events.ts - Event handling → Installation sync: requests sync
src/server/github/events.ts - Job queue → Worker: provides jobs
- Worker → Review pipeline: processes review jobs
src/worker.ts - Worker → Installation sync: processes sync jobs
src/worker.ts - Review pipeline → Postgres data: reads and writes runs
src/server/review/pipeline.ts - Review pipeline → Policy resolution: resolves policy
src/server/review/pipeline.ts - Review pipeline → GitHub App client: gets installation client
src/server/review/pipeline.ts - Review pipeline → Review publishing: fetches and publishes
src/server/review/pipeline.ts - Review pipeline → Diff selection: selects changed files
src/server/review/pipeline.ts - Review pipeline → Prompt building: builds model prompt
src/server/review/pipeline.ts - Review pipeline → Model review: generates findings
src/server/review/pipeline.ts - Review pipeline → Finding validation: prepares findings
src/server/review/pipeline.ts - Review pipeline → OpenAI / Anthropic: requests review
- Review publishing → GitHub: posts review and check
- Installation sync → GitHub App client: gets installation client
src/server/github/sync.ts - Installation sync → Postgres data: updates installation data
src/server/github/sync.ts - Authentication → Postgres data: persists accounts
src/server/auth.ts