I built a coding agent that gets 87 on benchmarks
Deploy SmallCode locally and use its compound tool and improvement loop to run coding tasks with a 4B Gemma model.
Install SmallCode via npm, point it at your local LM Studio or Ollama endpoint, and test it with a Gemma 4B model to validate the compound tool and improvement loop.
Summary
The author created SmallCode, a coding agent designed for small local models, to address the limitations of existing agents that assume large GPT‑5.4 or Claude Opus. SmallCode achieves 87/100 benchmark pass rate with a Gemma 4 model that activates only 4 B parameters per token, while OpenCode scores ~75% with 14 B models. The agent employs several tricks: compound tools combine four sequential calls into one, reducing failures; an improvement loop compiles and lints code, feeding errors back automatically; decompose on failure splits tasks into smaller pieces after repeated errors; escalation automatically falls back to a Claude/OpenAI key for 5 % of tasks; token budgeting keeps context within 32k‑256k, summarizing and truncating; and a code graph indexes the codebase into a symbol graph for efficient lookup. The UI is a full‑screen terminal with scrollable chat, command palette, plugin system, and persistent memory. SmallCode is MIT‑licensed and available on GitHub. The author invites questions about its architecture or benchmark methodology.
Key changes
- Compound tools combine four sequential calls into one, reducing failures
- Improvement loop compiles and lints code, feeding errors back automatically
- Decompose on failure splits tasks into smaller pieces after repeated errors
- Escalation auto-falls back to Claude/OpenAI for 5 % of tasks
- Token budgeting keeps context within 32k‑256k, summarizing and truncating
- Code graph indexes codebase into a symbol graph for efficient lookup
- Benchmarks: 87/100 with Gemma 4B, 75% with 14B models
- UI: full‑screen terminal, scrollable chat, command palette, plugin system, persistent memory