Goodhart-proof AI coding pipeline with architectural isolation.
Autonomous AI development pipeline that generates code from specifications with architectural guarantees against metric gaming. Built on LangGraph, runs locally on consumer hardware.
TL;DR: AI agents that can't cheat the tests because they never see them.
- β±οΈ 110 seconds per feature (planning β execution β verification)
- π° $0.00 per feature (local Ollama + OpenRouter free tier)
- π Zero metric leakage between layers (TypedDict enforced isolation)
- π Runs locally on GTX 1050 Ti (4GB VRAM) + 16GB RAM
"When a measure becomes a target, it ceases to be a good measure."
When AI agents see tests and acceptance criteria, they inevitably optimize code for passing tests rather than solving the problem. Commercial tools try to fight this with prompts and post-review, but prompts are disciplinary measures, not architectural guarantees. Agents are often smarter than their prompts.
Developer Farm makes metric gaming physically impossible through strict 4-layer isolation:
PLANNING β TaskInput (NO criteria)
β
EXECUTION β CodeArtifact (NO author info)
β
VERIFICATION β Verdict (score + reason)
β
RETRY LOOP β Abstract Feedback (NO rubric revealed)
| Layer | Input | π« Restricted From |
|---|---|---|
| Planning | User spec, codebase | Execution results, verdicts |
| Execution | Task description | Acceptance criteria, tests, rubrics |
| Verification | Git diff, rubric | Worker ID, task description, author |
Pipeline execution: Planning β Execution β Verification in 110 seconds
- LangGraph: State machine with SQLite persistence and streaming.
- Model Router: 10-tier routing (local_small β cloud_ollama β openrouter) with deterministic scoring + LLM-assisted provider chain.
- Ollama + Qwen2.5-Coder-7B (Q4_K_M): Local execution layer. Fits on 4GB VRAM (~3503 MiB used).
- OpenRouter API: Planning (gpt-oss-120b:free) and Verification (gpt-oss-120b:free).
- Git Worktrees: Isolated branches per worker (
agent/{task_id}-{id}). - Reconciler: Kubernetes-style control loop for auto-recovery.
When verification fails, the system generates abstract guidance without revealing the rubric:
β Leaking: "Add docstring to
is_palindrome()β the rubric requires it."β Abstract: "Code quality needs improvement. Consider adding documentation for public APIs."
Results comparing isolated vs non-isolated execution:
| Metric | Non-Isolated | Isolated |
|---|---|---|
| Verification Score (Standard) | 0.698 | 0.563 |
| Verification Score (Adversarial) | 0.533 | 0.720 |
| Fixture Pass Rate | 0.667 | 0.875 |
| Functional Correctness | 0.667 | 0.833 |
| Generalization (Held-Out) | 0.229 | 0.390 |
| Mean Latency | 90.6s | 130.2s |
| Cost per task | $0.00 | $0.00 |
Isolation improves adversarial scores (+0.186) and reduces verification gaps, but reduces standard-tier scores (-0.135). No specification gaming observed in either condition.
Spec: add, subtract, multiply, divide, division by zero handling, type hints.
| Metric | Developer Farm | SaaS Competitors |
|---|---|---|
| Total Time | 26.4s | 1β3 mins |
| Total Cost | $0.000 | $0.40 β $10+ |
| Iterations | 1 (Pass) | 2β4 (Avg) |
| Verification Score | 0.97 / 1.0 | N/A (Opaque) |
Run the ablation benchmark to compare isolated vs non-isolated verification:
source .env
python -m benchmark.run_ablationResults saved to benchmark/results/ablation_report.json.
- Ubuntu 22.04 (Linux recommended)
- Python 3.11+
- NVIDIA GPU with 4GB+ VRAM (GTX 1050 Ti tested)
- 16GB RAM
- OpenRouter API Key
# 1. Clone
git clone https://github.com/YOUR_USERNAME/developer-farm.git
cd developer-farm
# 2. Bootstrap (installs venv, Ollama, models, deps)
chmod +x bootstrap.sh
./bootstrap.sh
# 3. Setup Env
source venv/bin/activate
cp .env.example .env
nano .env # Add your OPENROUTER_API_KEY1. Write a spec:
mkdir -p work/my-feature
cat > work/my-feature/user-spec.md << 'SPEC'
# Feature: JWT Auth
Implement login and token refresh with FastAPI.
Constraints: Python 3.11+, RS256, rate limiting.
SPEC2. Run the pipeline:
source .env
python -m graph.graph work/my-feature/user-spec.md3. View results:
cat work/mvp/results/00_final_report.jsondeveloper-farm/
βββ bootstrap.sh # One-click setup
βββ contracts.py # TypedDict layer boundaries (Core Security)
βββ AGENTS.md # LangGraph code generation rules
βββ graph/
β βββ graph.py # StateGraph orchestration
β βββ nodes.py # Layer wrappers
β βββ state.py # GraphState TypedDict
β βββ reconciler.py # Auto-recovery loop
βββ nodes/
β βββ planning.py # Spec β Task (OpenRouter)
β βββ context_router.py # Budget allocation & compression
β βββ execution.py # Task β Code (Ollama, framework-aware)
β βββ verification.py # Code β Verdict (OpenRouter)
β βββ verification_consensus.py # Multi-model consensus verifier
β βββ confidence_router.py # Pre/post-execution confidence routing
β βββ self_reflection.py # Code flaw detection & fix
β βββ static_gate.py # Lint gate before LLM verification
βββ utils/
β βββ model_router.py # 10-tier deterministic model registry
β βββ model_router_llm.py # LLM-assisted routing with provider chain
β βββ git_worktree.py # Git isolation manager
β βββ context_compressor.py # Token budget enforcement
β βββ farm_config.py # Repo path resolution
β βββ feedback_sanitizer.py # Abstract feedback (no rubric leak)
β βββ token_tracker.py # Token budget tracking
β βββ output.py # Rich console output
β βββ code_graph.py # Neo4j code graph integration
β βββ brightdata_scraper.py # External docs fallback
β βββ optimization_analyzer.py # Metrics aggregation
β βββ proposal_manager.py # HITL proposal workflow
βββ benchmark/
β βββ run_ablation.py # Goodhart-proof ablation (isolated vs non-isolated)
β βββ results/ # Ablation report output
β βββ tasks/ # Benchmark task definitions
βββ dashboard/ # Real-time monitoring UI
- Architecture Deep Dive β How isolation works
- Goodhart's Law β Why this matters
- Contributing β How to help
Contributions are welcome! We are looking for:
- Support for more LLM providers (Anthropic, OpenAI)
- Enhanced dashboard metrics
- Kubernetes deployment manifests
MIT License β Open Source & Free for Commercial Use.
Built by engineers who refuse to delegate understanding.
