A small local code-agent lab. The idea is simple: most code agents either dump everything into the prompt or hand-wave about long context, and I wanted something where the context that survives is decided by what actually fails, not by what looks impressive in a diagram.
The loop works like this. The repo gets parsed into structural chunks (functions, classes, modules, docs), a retention policy picks which chunks are worth keeping under a token budget, a router picks the right kind of prompt for the task, a local model proposes a patch, and a verifier actually runs the tests. If the tests still fail, the failure output goes back into the retrieval step as context. That feedback is the whole point: once the verifier tells you what broke, the agent should look at the thing that broke, not at a wall of code.
Two influences, stated plainly. DeepSeek V4-style thinking about sparse and efficient long-context inference, which shows up here as a retention simulator rather than real sparse attention. And Mythos-style agentic verification, which is the verifier-guided loop above. This does not reproduce either system, and it does not claim to. It is a laptop-friendly lab for the surrounding ideas: structural ingestion, mixed retrieval, retention policy comparison, route-specific prompts, verifier-guided repair, and benchmark logging. I want the measurements to be reproducible on normal hardware, and the honest part is that the retention policy is hand-written. Learning it from verifier outcomes is the next real step, and that is not done yet.
What works today:
- structural parsing of Python repos, tree-sitter when available, AST fallback otherwise
- retention policies: full context, sliding window, RAG-only, verifier-relevant
- task routing for bug fixing, test generation, explanation, and refactoring
- model backends: Ollama, local transformers, and a deterministic scripted backend for CI
- verifier execution with structured failure extraction, JSONL run logging, telemetry
- a small benchmark suite of seeded bugs plus ablation tooling
One thing I ran into while getting this working on Windows: applying model-generated patches. git apply misbehaves with piped stdin and silently skips untracked files inside a work tree, so patch application is done with a small built-in unified-diff applier instead. No git plumbing involved, and it behaves the same everywhere. The four scripted benchmark bugs all fix in a single iteration on my machine.
Running it:
python -m pip install -e .
code-agent doctor
code-agent ingest benchmarks/tasks/bug_parser/repo --json
code-agent run "Fix CSV user parsing" --repo benchmarks/tasks/bug_parser/repo --dry-run-model scripted --json
code-agent benchmark --tasks benchmarks/tasks
code-agent ablate --tasks benchmarks/tasks --output benchmarks/output
make testThe scripted backend is the deterministic smoke path: it returns known patches for the tiny benchmark bugs so the full loop can be tested without installing Ollama. To try a real local model, install Ollama, pull qwen2.5-coder:7b, and drop the --dry-run-model flag.
More detail lives in docs/: architecture, benchmarks, model setup, scripted demo, research notes, future work. The ablation numbers are machine-specific; run make ablate to see yours.
The honest status: this is a working measurement harness, not a finished research claim. The interesting next step is learned retention, and the project is not there yet.