Building Axiom — A Terminal Coding Agent with Multi-Provider LLM Support
After using Claude Code CLI extensively, I wanted to understand how it worked by building my own version. Axiom is the result — a terminal-based coding agent with a premium TUI that supports OpenCode, Anthropic, OpenAI, Google, Groq, xAI, and Cerebras.
The project is organized as a monorepo with five packages. The AI package provides a unified LLM abstraction. The agent-core package handles tool execution and event streaming. The TUI package provides the terminal UI framework. The coding-agent package ties everything together with the interactive experience.
Building a 60fps terminal UI was harder than I expected. Terminals are not designed for smooth rendering. I implemented a frame-based renderer with dirty region optimization — only changed parts of the screen are redrawn. This keeps rendering overhead minimal even during streaming responses.
Vim mode was a fun feature to implement. The terminal needs to intercept keystrokes and interpret them based on the current mode. Normal mode treats h, j, k, l as movement keys. Insert mode passes everything through. The mode switch happens instantaneously with clear visual feedback.
Security validation is built into every tool. The bash tool checks commands against a list of dangerous patterns before execution. Path validation prevents directory traversal. Read-only filesystem detection prevents accidental writes to system files.
Session management uses JSONL format with branching support. Each session is a sequence of turns that can fork into parallel exploration paths. This is useful when you want to try multiple approaches to a problem and compare results.