Skip to main content

Documentation

Quickstart

Get up and running in under a minute.

1

Install

curl -fsSL https://toporic.com/code/tui/install.sh | sh
2

Set your API key

toporic set-key --provider anthropic --key sk-ant-...
3

Start coding

cd my-project
toporic

Installation

Toporic is distributed as a single static binary. The only runtime dependency is rg (ripgrep) for the search_files tool.

macOS / Linux

chmod +x toporic
sudo cp toporic /usr/local/bin/
# Or user-local
mkdir -p ~/.local/bin && cp toporic ~/.local/bin/
toporic --help

Windows

The TUI requires a terminal that supports raw mode — use Windows Terminal or WSL.

Prerequisite — The search_files tool requires rg (ripgrep). Install via apt install ripgrep, brew install ripgrep, or pacman -S ripgrep.

Setting API keys

Two options — config file (recommended) or environment variables:

# Option A — Save to config (recommended)
toporic set-key --provider anthropic --key sk-ant-...
toporic set-key --provider openai --key sk-...

# Option B — Environment variable (takes priority)
export ANTHROPIC_API_KEY="sk-ant-..."
Key resolution order: 1) Provider-specific env var, 2) AGENT_API_KEY env var, 3) config file. Keys in config are stored with 600 permissions.

Supported Providers

21+ LLM providers are supported out of the box. Choose one with --provider or set it in config.

Anthropic
Native SDK anthropic ANTHROPIC_API_KEY
OpenAI
OpenAI-compat openai OPENAI_API_KEY
DeepSeek
OpenAI-compat deepseek DEEPSEEK_API_KEY
OpenRouter
OpenAI-compat openrouter OPENROUTER_API_KEY
Ollama
Local ollama — no key needed —
MiniMax
OpenAI-compat minimax MINIMAX_API_KEY
Groq
OpenAI-compat groq GROQ_API_KEY
Together AI
OpenAI-compat together TOGETHER_API_KEY
Perplexity
OpenAI-compat perplexity PERPLEXITY_API_KEY
Mistral
OpenAI-compat mistral MISTRAL_API_KEY
Cerebras
OpenAI-compat cerebras CEREBRAS_API_KEY
Fireworks
OpenAI-compat fireworks FIREWORKS_API_KEY
Google
Gemini google GOOGLE_API_KEY
Cohere
OpenAI-compat cohere COHERE_API_KEY
Nvidia
OpenAI-compat nvidia NVIDIA_API_KEY
xAI
OpenAI-compat xai XAI_API_KEY
Zhipu AI
OpenAI-compat zhipuai ZHIPU_API_KEY
Tencent Code Plan
OpenAI-compat tencent-coding-plan TENCENT_CODING_PLAN_API_KEY
Tencent TokenHub
OpenAI-compat tencent-tokenhub TENCENT_TOKENHUB_API_KEY
Alibaba
OpenAI-compat alibaba DASHSCOPE_API_KEY
Kimi
OpenAI-compat kimi KIMI_API_KEY

Ollama (local models)

No API key needed. Run Ollama alongside Toporic:

ollama serve &
toporic --provider ollama --model llama3

Default endpoint: http://localhost:11434. Override via providers.ollama.base_url in config.

Tip — You can change provider, model, or API key at any time without restarting. Use --provider CLI flag, the Ctrl+, config overlay, or edit ~/.toporic/providers.json.

CLI Reference

toporic                                         # Coding mode (default)
toporic --mode assistant                        # Conversational
toporic --mode research                         # Web research
toporic --provider openai --model gpt-4o-mini   # Different backend
toporic --resume                                # Resume latest session
toporic --no-persist                            # Don't save session

All flags

FlagShortValuesDescription
--mode-mcoding / assistant / researchAgent mode
--provider-pProvider nameLLM backend
--modelStringModel override
--no-persistFlagSkip writing session
--resumeOptional UUIDResume session
--autoFlagSkip permission prompts
--themeamber / purple / greenTheme preset

Subcommands

CommandOptionsDescription
set-key--provider <name> --key <value>Save API key to config

Override priority

CLI flags → config file → built-in defaults. Environment variables override config file API keys.

Agent Modes

Three modes for different workflows. Switch with --mode flag, config, or Ctrl+, overlay.

Coding --mode coding

Full filesystem, shell, and web access. Reads, writes, edits files; runs commands; searches code; fetches URLs. Sandboxed to Git workspace root. 40-turn memory with compaction.

Assistant --mode assistant

Pure conversation with no tool access. 30-turn memory. Great for questions, explanations, and discussion.

Research --mode research

Web tools only — DuckDuckGo search, URL fetching (SSRF-protected), and REST API calls. No filesystem or shell access. 30-turn memory.

TUI Reference

Layout

The TUI has five zones:

  1. Title bar — app name, mode badge, spinner, token gauge, cost, git branch
  2. Sidebar — toggle with Ctrl+B (≥100 columns, appears to the right). Shows tasks, modified files
  3. Chat area — messages, reasoning blocks, collapsible tool calls
  4. Input box — multiline entry (up to 5 visible lines)
  5. Footer — keyboard hints, workspace path, git branch

Tool calls

Tool calls appear as collapsible units: ▸ command_name ✓ (green) or (red). Press Enter or Space in message focus to expand and see full arguments and results.

Confirm dialog

Before mutating tools (run_command, write_file, etc.), a confirmation popup appears. Y to accept, N / Enter / Esc to reject.

Tip — Use --auto to skip all permission prompts for unattended runs.

Command palette

Press Ctrl+P for a fuzzy-searchable list of actions: change provider, model, theme, language, start new session, and more.

Auto-scroll

Enabled by default. Pause with PageUp, resume with End. The [END] indicator shows when active.

Keybindings

Global

TabCycle focus (input ↔ messages)
Ctrl+POpen command palette
?Open help overlay
PageUpScroll up 10 lines (pauses auto-scroll)
PageDownScroll down 10 lines

Input focus

EnterSubmit input
Shift+EnterInsert newline
Alt+EnterInsert newline (fallback)
Ctrl+BToggle sidebar
↑ ↓Navigate input lines

Message focus (press Tab)

↑ kScroll up / prev message
↓ jScroll down / next message
Enter SpaceExpand/collapse tool call
End GJump to bottom (resume auto-scroll)
Home gJump to top
EscReturn to input

Sessions

Every interaction is saved automatically under ~/.toporic/sessions/. Sessions persist across restarts and can be resumed with --resume.

toporic --resum                                    # Latest session
toporic --resume 550e8400-e29b-41d4-a716-446655440000  # By UUID
toporic --no-persist                                # No disk write
# Start a fresh session from within the TUI
/session new

Tools Reference

20+ tools across seven categories. All sandboxed to the Git workspace root.

Filesystem 5 tools

read_fileRead file (max 100KB, sandboxed)
write_fileWrite/create file (auto-creates dirs)
edit_fileExact string replace (returns diff)
list_dirList directory (flat or recursive)
delete_fileDelete file (shows contents first)

Shell 3 tools

run_commandExecute command (30s timeout, 100KB)
run_command_streamStreaming variant (stderr: ! prefix)
search_filesRipgrep search (needs rg)

Allowed: cargo git python3 node npm make pytest rg ls cat mkdir rm cp mv grep find curl wget jq tar ...

Web 3 tools

fetch_urlFetch URL (15s timeout, SSRF-protected)
web_searchDuckDuckGo search (1–25 results)
api_callREST API (1–120s timeout, JSON pretty-print)
Security — All tools are sandboxed. Filesystem operations are restricted to the workspace root. Shell commands run against an allowlist. Web tools include SSRF protection (private/loopback IPs are rejected).

Configuration

Config file: ~/.toporic/config.json

{
  "defaults": {
    "mode": "coding",
    "provider": "anthropic",
    "model": "claude-sonnet-4-20250514",
    "theme": "amber",
    "language": "English",
    "models": { "anthropic": "...", "openai": "gpt-4o" }
  },
  "providers": {
    "anthropic": "sk-ant-...",
    "openai": "sk-...",
    "ollama": { "base_url": "http://localhost:11434", "model": "llama3" }
  },
  "provider_urls": { "deepseek": "http://localhost:7897" },
  "embedding": { "provider": "voyage" }
}

CLI flags override config values. Environment variables override API keys. Changes via Ctrl+P command palette are saved to config automatically.

Skills

Skills are reusable instruction bundles (Markdown with YAML frontmatter) that give the agent project-specific context. The agent sees a compact index of all skills every turn.

Discovery paths (priority order)

  1. {workspace_root}/.toporic/skills/ — project-local
  2. ~/.toporic/skills/ — user-wide
  3. /etc/toporic/skills/ — system-wide

Using skills

Invoke a skill explicitly from the TUI input:

/skill my-rules
Skill files live in a directory named after the skill and contain a SKILL.md file with optional frontmatter (description, tags, version).

Workspace Initialization

Run /init in the TUI to bootstrap a project workspace. Creates .toporic/skills/ and AGENTS.md. Runs git init if needed. Idempotent — safe to run multiple times.

.toporic/
└── skills/       ← project-local skills
AGENTS.md         ← project instructions (read every turn)

Use AGENTS.md to give the agent project-specific instructions, conventions, and context — it's read on every turn.

Troubleshooting

Terminal too small

Requires ≥20 columns × 6 rows. Resize and the TUI re-renders on next keystroke.

Shift+Enter not inserting newline

Use Alt+Enter as an alternative.

Ollama not responding

Verify curl http://localhost:11434 and ensure the model is pulled: ollama pull llama3.

Rate limit errors (429)

Auto-retries with exponential backoff (500ms → 1s → 2s, up to 3 attempts). Respects Retry-After header.

Debug logging

RUST_LOG=debug toporic
tail -f ~/.toporic/toporic.log

Context limit warning

Footer shows ⚠ Context at 91% — consider /session new. Start a new session or let the agent compact automatically.