The backend has been migrated to Python in backend_py/.
Quickstart:
cd backend_py
PYTHONPATH=. python3 -m unittest discover -s tests -v
PYTHONPATH=. python3 -m cmd.server.mainThis system provides an AI-assisted code review and refactoring workflow for production repositories.
It allows a user to:
- 🧭 Start a proposal session manually
- 📦 Index a repository snapshot
- 🧠 Generate a refactor / bug-fix proposal
- 🌿 Apply it to a sandbox branch
- 🧪 Run validation checks (compile / tests / lint / perf)
- 📊 Score the proposal
- 👀 Review and approve / reject / regenerate
- 🗂 Preserve a full immutable audit trail
Human approval is mandatory. No auto-merge.
| Capability | Description | Milestone |
|---|---|---|
| 🧬 Session lifecycle | Create + track proposal session | M1 |
| 📥 Repo snapshot | Load repository state | M2 |
| 🗃 Indexing | Build per-request index | M3 |
| 🧠 Proposal generation | Generate patch + explanation | M4 |
| 🌿 Sandbox branch | Apply patch in isolation | M5 |
| 🧪 Validation | Trigger CI + store results | M6 |
| 📊 Scoring | Compute evaluation score | M7 |
| 📜 Audit | Immutable proposal versions | M8 |
| 👀 Review flow | Approve / reject / regenerate | M9 |
| ⚙️ Async execution | Background workers + concurrency | M10 |
Style: Modular monolith with strict boundaries.
- 🌐 api
- 🧭 session
- 📦 repository
- 🗃 indexing
- 🧠 proposal
- 🧪 validation
- 📊 scoring
- 📜 audit
- ⚙️ infrastructure
Session module = orchestration core. All other modules = pure services or adapters.
States:
Created
→ SnapshotLoaded
→ Indexed
→ Proposed
→ BranchApplied
→ Validated
→ Scored
→ Reviewed (Approved / Rejected)
- ⛔ Validation must complete before review
- 📝 Review decision is write-once
- 🔄 Regeneration creates a new proposal version
/api
/session
/repository
/indexing
/proposal
/validation
/scoring
/audit
/infrastructure
/tests
Each module:
- 🧱 Owns its models
- 🔌 Exposes interfaces
- 🚫 Does not mutate another module’s state
Codex must implement strictly milestone by milestone.
Never skip ahead.
Each milestone must:
- ✅ Compile
- ✅ Pass tests
- ✅ Be runnable
- ✅ Preserve modular boundaries
Replaceable without touching session logic:
BasicFileIndexStrategy (V0)
LLMBasedProposalEngine (V0)
ExternalCIAdapter (V0)
SimplePassFailPolicy (V0)
- Rate limiting
- Logging
- Metrics
All injected via constructor. Never hard-coded.
- Snapshot reference
- Proposal versions
- Branch reference
- Validation result
- Score
- Review decision
- Audit trail
No other module can modify session state.
- Snapshot
- CodeIndex
- Patch
- Proposal
- ValidationResult
- Score
No in-place mutation. Ever.
- Session state transitions
- Scoring logic
- Proposal engine contract
- Indexing strategy contract
- Session → repo → index → proposal
- Session → validation → scoring
- Regeneration flow
Full flow: Create → Propose → Branch → Validate → Score → Review
- Multiple sessions
- Idempotent execution
- Worker crash recovery
Minimum production baseline:
- 📈 Proposal success rate
- 🧪 Validation pass rate
- 🔄 Regeneration count
- 🧠 LLM token usage
- Per-session lifecycle tracking
Audit trail must be append-only.
- ❌ No auto-merge
- ❌ No background autonomous scanning
- ❌ No semantic / vector search
- ❌ No multi-agent orchestration
- ❌ No distributed microservices
When implementing:
- Never bypass interfaces
- Never allow direct cross-module mutation
- Never embed external system calls inside session logic
- Never introduce global shared state
- Every new feature must map to a scoped capability
Before closing a milestone:
- 🧪 Run tests
- 🔄 Validate replaceability (swap one adapter)
- 🔍 Confirm no tight coupling introduced
System is complete when:
- ✅ All milestones M1–M10 implemented
- ✅ All scoped features functional
- ✅ Session lifecycle stable
- ✅ Concurrency safe
- ✅ Replaceability validated
- ✅ Observability baseline active
- ✅ Full E2E flow reliable
No deviation from scope without explicit revision.