Koda
A terminal coding assistant with local and remote model routing, tool use, and a focused command-line interface.
- Software
Koda is a terminal coding assistant I wrote in Go with Bubble Tea. Each turn, it decides whether a local model is enough or the request should go to a remote one, and the model works through a small set of tools with fixed limits.
- When
- April 2026
- Where
- Independent project
- Role
- Designer and developer
- Routing
- A scoring function picks a local or remote model each turn
- Tools
- Nine, with file tools confined to the project folder
- Tests
- Unit tests for the router, tools, and config
- Tools
- Go, Bubble Tea, Ollama, LM Studio, OpenAI-compatible APIs
Routing
Before each model call, Koda scores the request from three things: prompt length, a count of words that suggest hard tasks (refactor, debug, design) against easy ones (list, show, grep), and how many turns deep the conversation is. Low scores go to a local model through Ollama or LM Studio if a quick connection check reaches it. High scores, or an unreachable local server, go to a remote model. The interface shows which model was chosen and why.
Bounded tools
- File tools (view, write, edit, glob, grep) resolve every path, follow symlinks, and refuse anything that lands outside the project folder.
- Shell commands run without a shell, need my approval, and are killed after a timeout.
- Web fetches must use HTTPS, are refused for private and loopback addresses, need approval, and have size and time limits.
- Tool output goes back to the model labelled as data, not instructions.
- A subagent tool runs one level of child agent with the same tools, and its result is trimmed before it returns.
Decisions
The router is a small heuristic rather than a model call, so it runs on every turn at almost no cost and its reason fits in one line of the interface. The first version was in Python. I rewrote it in Go the next day, and the Go version ships as a single binary.