Hari Hara Prasad V

μ-code is a single-file Node.js CLI I built to turn a local LLM into a coding worker. Zero dependencies — only Node.js core modules (fs, path, readline, child_process) — and it talks to any OpenAI-compatible API running locally (Ollama, llama.cpp, mlx, vLLM).

The idea. "Frontier API tokens feel practically infinite today, but that won't last forever." I keep coming back to that line. As AI dev tools scale, "token budgets, strict rate limits, and shrinking free tiers are bound to become standard enterprise policy." Meanwhile, "local models are far more capable than their size suggests — especially with MLX acceleration on Apple Silicon."

So μ-code was built around a simple split: "top-tier frontier models should act as architects," using "their large context windows and strong reasoning to plan, break down feature requests, and map out changes," while "μ-code acts as the local worker," taking "small, single-file, atomic execution tasks and handling them using fast, open-weight local models." Zero API costs, zero rate limits, and no context bloat for small file edits.

The tools. The model gets exactly four: bash (mainly rg -n to locate lines), read a file optionally by line range, edit by line number, and write a whole file. No LSP, no symbol index — "the model never needs to reproduce whitespace from memory. rg finds the line, read_file shows it, edit_file replaces it by number." One file at a time.

Safety by default. "Every edit/write/bash call shows a diff and requires your approval." History is "aggressively trimmed to fit small context windows" — the whole thing is built for small models, one atomic action per turn.

Standalone or sub-agent. μ-code works both ways. Standalone, you run mu -f src/main.go and it does the job on its own. Or you use it as a sub-agent to a frontier model — it ships with two Agent Skills (mu-code-delegate and mu-code-config) for the architect + worker pattern, so a host tool like opencode, Claude Code or Codex keeps all the reasoning and only delegates execution to μ-code.

Validated, not just theorised. I ran the same MiniKV task three times, swapping the local code-generation model. "All three runs produced 0 lines written by the architect and passed 19/19 pytest tests." gemma4:12b "produced all 5 modules right the first time (0 bug-fix rounds) yet was ~2× slower than ornith. granite4.1:3b was fastest but dropped a method, misplaced files, and mangled an edit_file into a literal \n string." "The architect is the quality gate. Every bug was caught by the architect on read-back — μ-code has no self-correction loop." And "~50–65% of main-provider (billed) context is saved by moving codegen to the free local model." All of it ran 100% locally; nothing was uploaded.

Limitations. Single-file operations — no project-wide crawling, no multi-file orchestration. Linux/macOS only. "Not a Cursor / Copilot replacement."

It's live at hrhrprasath.github.io/mu-code. The whole thing is one ~1,900-line mu script. Apache 2.0.