terraphim_agent
Terraphim AI Agent CLI — semantic search, knowledge-graph exploration, and an interactive REPL for AI coding workflows.
Overview
terraphim_agent is the primary command-line interface for Terraphim. It combines offline-capable local search with optional server-backed fullscreen TUI mode, knowledge-graph validation, hook integration for AI coding assistants, and operational learning capture.
Install the binary as terraphim-agent.
Features
- Semantic search across configured haystacks with KG-aware ranking
- Interactive REPL with markdown-defined commands and autocomplete
- Knowledge graph tools — validate, replace, extract, and visualize concepts
- Session search — import and query AI coding assistant session history
- Operational learning — capture corrections, query learnings, replay procedures
- Safety guards — block destructive git/filesystem commands before execution
- Robot mode — structured JSON output for automation and agent orchestration
Installation
From crates.io
From source
The release binary is at target/release/terraphim-agent.
Feature Flags
| Feature | Default | Description |
|---|---|---|
repl-interactive |
Yes | Interactive REPL with rustyline |
llm |
Yes | Ollama and LLM router integration |
repl-sessions |
Yes | Session import and search |
server |
No | HTTP client for server-backed TUI |
repl-full |
No | All REPL sub-features (chat, MCP, web, file) |
shared-learning |
No | Cross-agent learning store and wiki sync |
enrichment |
No | Concept enrichment for session search |
Build with extra features:
Quick Start
# Show available commands
# Semantic search (offline)
# List and select roles
# Validate text against the knowledge graph
# Start the REPL
# First-time setup wizard
Server-backed TUI
When a Terraphim server is running:
Robot / automation output
Configuration
On first run, the agent reads settings.toml from the platform config directory
(~/.config/terraphim/ on Linux). Point role_config at a JSON role definition
to bootstrap roles and haystacks:
= "/path/to/terraphim_engineer_config.json"
= "~/.local/share/terraphim"
Use terraphim-agent config show to inspect the active configuration and
terraphim-agent config validate to check role definitions.
Key Commands
| Command | Purpose |
|---|---|
search |
Semantic document search |
graph |
ASCII knowledge-graph visualization |
validate |
KG connectivity and checklist validation |
replace |
Thesaurus-based text replacement |
hook |
Pre/post-tool-use hook handler for AI assistants |
guard |
Safety pattern check for shell commands |
learn |
Operational learning capture and query |
sessions |
Import and search AI coding sessions |
Testing
# Unit tests
# Integration tests (hermetic, no server required)
Related Crates
terraphim-cli— lightweight CLI for scripted searchterraphim_grep— hybrid grep with KG boost and LLM fallbackterraphim_mcp_server— MCP tools for editor integration
License
Apache-2.0