OpenRadar

Project · JavaScript · Added June 10, 2026

smallcode

SmallCode is a terminal-native AI coding agent built for small local LLMs (8B-35B), achieving 87% benchmark scores with just a 4B model on consumer hardware.

1,816 stars 136 forks View on GitHub

SmallCode

Overview

SmallCode is a terminal-native AI coding agent that does something most developers assumed was impossible: it makes 8B-parameter local models genuinely useful for real coding work. With 1,800+ stars in under a month since its May 18, 2026 launch, it’s become the go-to tool for developers who want an AI coding assistant without sending their code to the cloud or paying for frontier model API calls.

The project comes from Doorman11991, a developer who clearly got frustrated watching small models fail at tasks that Claude and GPT-5 handle trivially. Rather than waiting for better models, SmallCode takes a different approach — it redesigns the entire agent architecture around the constraints of small language models. Context windows are budget-managed instead of dumped. Tool calls are parsed with a forgiving multi-format handler that accepts JSON, YAML, XML, Hermes format, and even plain text. Editing uses search-and-replace patches instead of full file writes because small models can’t reliably reproduce entire files without truncating or drifting.

The benchmark numbers are striking. On the Polyglot Mini suite — 19 tasks across Python, JavaScript, TypeScript, Bash, Markdown, and JSON — SmallCode achieves 87% pass rate with a 4B-active model. That’s not a typo. A model you can run on a laptop with 16GB of RAM is producing useful coding output at a rate that would have required GPT-4-class models a year ago. The trick is architectural: SmallCode compensates for what small models lack through intelligent scaffolding — TODO-driven planning, context budgeting, early-stop detection, and a forgiving tool call parser that handles the messy output small models produce.

Why it matters

The AI coding agent space is dominated by tools built for frontier models. Claude Code, Cursor, Copilot, and Codex all assume you’re either paying for expensive API calls or running models with 128k+ context windows and perfect tool calling. That’s fine for enterprise budgets, but it leaves out a massive population of developers: students, indie hackers, developers in regions with expensive API pricing, security-conscious teams that can’t send code to external services, and anyone who simply prefers to keep their work local.

SmallCode fills this gap completely. It’s the first coding agent I’ve seen that treats small models as first-class citizens rather than a degraded fallback. The architecture decisions are smart and specific: 2-stage tool routing halves schema context overhead by having the model pick a category first (read/write/search/run/plan), then only sending relevant tool schemas. The context budget engine never exceeds your model’s window — tool results are capped at 4k chars, and mid-turn eviction drops old results when context grows too large. These aren’t features you’ll find in Claude Code or Cursor because those tools don’t need them. SmallCode needs them, and it implements them well.

The privacy angle matters more than people think. A 2026 JetBrains developer survey found that 41% of developers cite data privacy as their top concern with AI coding tools. SmallCode runs entirely local by default — no network calls, no telemetry, no code leaving your machine. For teams working on proprietary codebases, regulated industries, or government contracts, this isn’t a nice-to-have. It’s a requirement.

Key Features

Context Budget Engine. SmallCode never exceeds your model’s context window, period. Tool results are capped at 4k characters, mid-turn eviction drops old results when context grows too large, and semantic compression summarizes history instead of just dropping it. This is the single most important feature for small models — context management is where most coding agents fail when running locally. A 16k context window is useless if you blow 14k of it on verbose tool outputs from the first three turns.

Forgiving Tool Call Parser. Small models produce messy output. SmallCode parses tool calls from JSON, YAML, XML, Hermes format, Liquid AI’s proprietary markers, or plain text. It auto-repairs common mistakes like wrong parameter names and type mismatches. When the model’s content field is empty (common with LM Studio reasoning models), it falls back to scanning reasoning_content. This parser alone probably accounts for a 15-20% improvement in tool call success rates compared to rigid JSON-only parsers.

2-Stage Tool Routing. Instead of dumping all 18+ tool schemas into every prompt — which burns precious context on a small model — SmallCode has the model pick a category first (read, write, search, run, plan, code_intel), then only sends the relevant tool definitions. For models with 8-16k context windows, this halves the schema overhead and leaves more room for actual task context. It’s an obvious optimization in hindsight, but nobody else does it because frontier models don’t need it.

TODO-Driven Planning. Complex tasks get decomposed into atomic steps written to a TODO file. The model reads this file each turn to know where it is in the plan. Each step is validated (lint/compile) before moving on. This compensates for the limited reasoning depth of small models — instead of hoping the model remembers it needs to update the import statement after changing the function signature, the plan explicitly lists it as a separate step. The Plan-Then-Execute mode makes this even stronger for multi-file refactors.

Patch-First Editing. Small models can’t reliably reproduce entire files. They truncate, hallucinate, or drift mid-write. SmallCode uses search-and-replace as the primary edit primitive — the model specifies what to find and what to replace, not the entire file contents. This is more context-efficient and dramatically more reliable. The semantic merge feature even recovers when a patch fails because the target string no longer exists, asking the model to merge the intended change into the current file content.

Model Escalation. When the local model hard fails after retries and decomposition, SmallCode can optionally escalate to a stronger cloud model — Claude Sonnet 4.6, GPT-5.4 Mini, DeepSeek V4 Pro, and others. This is fully opt-in and session-limited to prevent runaway costs. It’s a smart design: you run 90% of tasks locally for free, and only hit the API when you genuinely need frontier intelligence. The adaptive model routing even tracks per-model failure rates and auto-switches when a model’s error rate exceeds configurable thresholds.

BoneScript Integration. For Node.js and TypeScript backends, SmallCode uses BoneScript — write one .bone file and compile it to a complete project with routes, auth, database, events, migrations, SDK, admin panel, Docker, and CI configuration. This reduces 8-15 tool calls to 1-2, dramatically improving reliability with small models that struggle with multi-step tool sequences. If you’re building a NestJS or Express backend, this is a genuine productivity multiplier.

Use Cases

Pros and Cons

Pros:

Cons:

Getting Started

# Install globally via npm
npm install -g smallcode

# Configure your local model
cat > .env <<'EOF'
SMALLCODE_MODEL=qwen3:8b
SMALLCODE_BASE_URL=http://localhost:11434/v1
EOF

# Start in your project directory
cd my-project
smallcode

# Or use the fullscreen TUI
smallcode --classic

# Run benchmarks to verify your setup
npm run bench:smoke

Alternatives

OpenCode — The closest comparison. OpenCode is a terminal coding agent designed for frontier models (Claude, GPT-5) with 128k+ context and perfect tool calling. If you’re running frontier models through APIs and don’t care about local-first privacy, OpenCode is the better choice — it doesn’t need SmallCode’s architectural workarounds because the models it targets don’t have those limitations. Choose SmallCode when you want local models, privacy, or zero API costs.

Aider — A well-established terminal coding agent with strong Git integration and a mature ecosystem. Aider works with both frontier and smaller models, but its architecture assumes reasonable context windows and reliable tool calling. It’s more battle-tested than SmallCode and has better documentation. Choose Aider if you want a proven tool that works across model sizes and don’t need SmallCode’s aggressive small-model optimizations.

Continue — An open-source VS Code/JetBrains extension that connects to local models through Ollama or LM Studio. Continue is an IDE-integrated experience rather than a terminal agent — it’s autocomplete and chat, not autonomous multi-step coding. Choose Continue if you prefer staying in your editor and want a lighter-weight local AI integration without the full agent loop.

Verdict

SmallCode is the most interesting local-first coding agent I’ve seen in 2026. It doesn’t try to compete with Claude Code on raw capability — instead, it solves a different problem entirely: making small models useful for real coding work. The architectural decisions are smart, the benchmark numbers are real, and the MIT license means you can do whatever you want with it. If you have a decent GPU (or even just a Mac with 32GB of unified memory), you can run Qwen3:8b through SmallCode and get coding assistance that would have cost you API money six months ago. The 1,800+ stars in three weeks reflect genuine developer excitement, not marketing hype. For fullstack developers who work across React, NestJS, Django, and Go and want AI assistance without the privacy compromises or API bills, SmallCode is the tool to beat right now.

Related

Shared tags