terraphim-agent is a command-line AI agent that searches before it answers. It runs
local knowledge graph queries, imports session history from Claude Code and Cursor,
captures failed commands via post-tool-use hooks, and surfaces past corrections when
you encounter a recurring error.
Install it with one command:
cargo install terraphim-agent
What it does
- Session search: query across imported Claude Code and Cursor session logs.
- Knowledge-graph search: match queries against role-configured Aho-Corasick automata.
- Learning capture: the
learnsubcommand records failed commands and their corrections. - Command rewriting: pre-tool-use hooks rewrite
npm installtobun add,pip installtouv add, etc. via a thesaurus.
See the command rewriting how-to and the blog post Teaching AI Agents to Learn from Their Mistakes for worked examples.