← All Posts

Building Smol Agent: A Terminal Coding Assistant That Runs Anywhere

View on GitHub ↗

Why I Built Smol Agent

The rise of AI coding assistants has been incredible, but most of them require cloud subscriptions, send your code to remote servers, and lock you into a single provider. I wanted something different: a coding agent that runs entirely in your terminal, works with local models through Ollama, and respects your privacy by default.

That's why I built Smol Agent — a small but powerful coding agent that lives in your terminal.

What It Does

Smol Agent enables language models to read, write, and edit code, execute shell commands, search codebases, and ask clarifying questions — all through a colorful terminal UI with rich markdown rendering. It supports multiple LLM providers including Ollama (local), OpenAI, Anthropic, Gemini, Grok, and Groq.

You can use it interactively as a REPL or fire off one-shot commands. It manages sessions, remembers context across conversations, and can even spawn sub-agents to divide and conquer complex tasks.

The Key Innovation: Progressive Tool Discovery

One of the most interesting technical decisions was implementing progressive tool discovery. Instead of loading all 40+ tools into the context window at once (which wastes tokens and confuses smaller models), tools are organized into groups: explore, edit, execute, plan, memory, web, and multi_agent.

Only the starter tools are always available. Additional groups activate automatically based on context signals or explicit requests via discover_tools(). This reduces context window usage by approximately 60-70%, which is critical when running on local models with smaller context windows.

Safety First

Git operations block dangerous flags like --force and push by default. The agent respects a working directory jail and requires approval for write and command operations unless you explicitly opt out. This means you can hand it a coding task and trust it won't accidentally nuke your repository.

Persistent Memory

The memory system lets the agent retain facts and patterns across sessions. You can ask it to remember project conventions, architectural decisions, or debugging findings, and it will recall them next time you pick up where you left off. It turns the agent from a stateless tool into a collaborator with institutional knowledge.

Try It Out

Smol Agent is open source and ready to use. Install it with a single curl command and start coding with AI in your terminal today.