Backend Stack
- Framework: FastAPI 0.129.0
- ASGI Server: Uvicorn 0.41.0
- Language: Python 3.14
- ORM: SQLAlchemy 2.0.46 (async)
- Database Driver: asyncpg 0.31.0
- AI SDK: Anthropic 0.83.0
- Graph Database: neo4j 5.0+
- Memory Layer: mem0ai 0.1.98+
- MCP: mcp 1.0.0+
Project Structure
Application Entry Point
app/main.py is the FastAPI application entry point.
Lifespan Management
app/main.py:88-131.
CORS Configuration
app/main.py:143-157.
Request Logging Middleware
app/main.py:180-188.
Core Services
PR Review Service
File:app/services/pr_review_service.py
Orchestrates the entire PR review workflow:
- Fetch PR data from GitHub
- Build review context (Neo4j + Mem0 + MCP)
- Run AI analysis (Claude with agentic tools)
- Post review comment on GitHub
- Index PR in Neo4j
- Extract memories to Mem0
process_pr_review(payload, event, db)
See app/services/pr_review_service.py:464-809.
AI Service
File:app/services/ai_service.py
Claude integration with two review modes:
Standard mode (default):
- Single agentic loop
- Claude uses 8 MCP-style tools on demand:
read_file— Read full source filesearch_project_memory— Query Mem0 project patternssearch_developer_memory— Query Mem0 developer habitsget_file_history— File experts + related PRs (Neo4j)get_issue_details— Fetch GitHub issue detailssearch_open_issues— Find semantic issue matchesget_linked_issues— Fetch Linear/GitHub issues (MCP)get_related_errors— Fetch Sentry errors (MCP)
PARALLEL_REVIEW_AGENTS=true):
- 3 specialized agents run concurrently:
- Security agent — Injection, auth, secrets, crypto
- Performance agent — N+1 queries, algorithms, memory leaks
- Style agent — Tests, complexity, naming, error handling
- Synthesis agent combines all three into final review
Context Service
File:app/services/context_service.py
Builds rich context for PR reviews by querying:
- Mem0 — Project patterns, developer habits
- Neo4j — File experts, related PRs
- MCP integrations — Linear issues, Sentry errors, Slack messages
Graph Builder
File:app/services/graph_builder.py
Neo4j operations:
build_repo_graph(owner, repo, token)— Initial file tree scanindex_pr(repo, pr_number, title, author, files, verdict, issues)— Index PR after reviewget_file_experts(repo, file_paths, top_k)— Developers who most touch these filesget_related_prs(repo, file_paths, top_k)— Past PRs with file overlap
Memory Adapter
File:app/services/memory_adapter.py
Async wrapper for Mem0 API:
add(memory, repo, developer, metadata)— Store memorysearch_relevant(repo, query, developer, top_k)— Semantic searchdelete(memory_id)— Delete memory
Memory Extractor
File:app/services/memory_extractor.py
Post-review memory extraction:
- Claude analyzes PR + review summary
- Extracts structured memories:
project_pattern— Architectural patternsdecision— Design decisionsdeveloper_pattern— Developer habitsdeveloper_strength— Developer expertiserisk_module— High-risk code areascontributor_profile— Contributor traits
- Stores in Mem0 with metadata
GitHub Integration
GitHub Client
File:app/integrations/github/client.py
Webhook Manager
File:app/integrations/github/webhook_manager.py
MCP Integration
Nectr as MCP Server
File:app/mcp/server.py
Exposes Nectr data to external agents (e.g., Claude Desktop):
app/main.py:164-169.
Nectr as MCP Client
File:app/mcp/client.py
Pulls live context from third-party MCP servers during reviews:
Authentication
GitHub OAuth Flow
File:app/auth/router.py
JWT Utils
File:app/auth/jwt_utils.py
Token Encryption
File:app/auth/token_encryption.py
GitHub access tokens are encrypted at rest using Fernet (AES-128-CBC):
Current User Dependency
File:app/auth/dependencies.py
API Endpoints
Webhooks
File:app/api/v1/webhooks.py
Repos
File:app/api/v1/repos.py
Reviews
File:app/api/v1/reviews.py
Analytics
File:app/api/v1/analytics.py
Memory
File:app/api/v1/memory.py
Database Models
User Model
File:app/models/user.py
Installation Model
File:app/models/installation.py
Event Model
File:app/models/event.py
WorkflowRun Model
File:app/models/workflow.py
Async Patterns
Database Sessions
Neo4j Sessions
Parallel Operations
Error Handling
Graceful Fallbacks
All optional integrations fail gracefully:Webhook Processing
Webhook failures are logged but don’t block:Next Steps
Frontend Architecture
Next.js frontend structure
Review Flow
Complete PR review workflow
Parallel Agents
3 specialized agents mode
Local Development
Set up locally