A CLI-based AI coding agent with a terminal UI (TUI) that can read/write files, run shell commands, search the web, and delegate tasks to sub-agents — all from your terminal.
- Interactive TUI chat interface powered by Ink
- Supports multiple LLM providers: Gemini, OpenAI, and a local model
- Tool-calling loop: the LLM can invoke tools autonomously until a task is complete
- Streaming responses with real-time chunk display
- Conversation memory with automatic summarization when context grows too large
- Agent workspace at
.agent_workspace/projects/for all file operations
| Tool | Description |
|---|---|
WebSearch |
Searches Google via SerpAPI |
BashTool |
Executes shell commands |
ReadFileTool |
Reads a file from the workspace |
WriteFileTool |
Writes/creates a file (auto-creates directories) |
UpdateFileContentTool |
Replaces specific line ranges in a file |
runAgentTool |
Spawns a sub-agent with a given prompt |
- Bun or Node.js
- API keys for your chosen provider(s)
npm install
# or
bun installSet your provider and API keys using the CLI:
# Set provider (gemini | openai)
bun cli.ts providers set --provider gemini --model gemini-flash
# Log in with your API key
bun cli.ts providers login --provider gemini --key <your_api_key>
# For web search (optional)
# Add SERP_API_KEY to your .env fileOr edit store/data.json directly:
{
"defaultProvider": { "name": "gemini", "model": "gemini-flash" },
"setKeys": { "gemini": "<your_key>", "openai": "<your_key>" }
}bun cli.ts chatType your prompt, press Enter to send. Press Esc to exit.
bun cli.ts agent --prompt "Create a React todo app in the workspace"bun cli.ts modelsbun cli.ts providers list
bun cli.ts providers login --provider openai --key <key>
bun cli.ts providers logout --provider openai
bun cli.ts providers set --provider gemini --model gemini-flash.
├── cli.ts # Entry point, registers all commands
├── actions/
│ ├── llm.ts # LLM call logic (Gemini & OpenAI), tool loop, memory management
│ ├── tools.ts # Tool definitions and implementations
│ └── memory.ts # Message history and summary memory
├── commands/
│ ├── chat.tsx # `chat` command — launches TUI
│ ├── agent.ts # `agent` command — one-shot prompt
│ ├── models.ts # `models` command — list models
│ └── providers/ # `providers` subcommands (login/logout/set/list)
├── tui/
│ └── TUIChat.tsx # Ink-based interactive chat UI
├── store/
│ ├── data.json # Persisted provider/key config
│ ├── db.ts # Exports provider config
│ └── db1.ts # Reads/writes data.json
└── .agent_workspace/
└── projects/ # Agent's sandboxed file workspace
- User sends a message via TUI or CLI.
callLlmbuilds a system prompt with tool definitions and conversation history, then calls the active provider.- The LLM responds with either a
{ "tools": [...] }JSON to invoke tools, or a{ "answer": "..." }to finish. - Tools are executed (in parallel where
dependsOnallows), results are fed back to the LLM, and the loop continues until a final answer is produced. - Conversation summaries are compressed automatically when they exceed a token threshold.