Terraphim AI is a modular 52-crate Rust workspace for privacy-first knowledge graph search. Aho-Corasick automata match thousands of patterns in O(n) time. Sub-millisecond latency. Zero cloud dependency. Your data never leaves your machine.
Multiple installation methods for every workflow
# Single command, platform detection curl -fsSL https://raw.githubusercontent.com/terraphim/terraphim-ai/main/scripts/install.sh | bash # With CLI tools curl -fsSL https://raw.githubusercontent.com/terraphim/terraphim-ai/main/scripts/install.sh | bash --with-cli
# Add Terraphim tap brew tap terraphim/terraphim # Install server + agent brew install terraphim-server brew install terraphim-agent
# Interactive agent (REPL + session search) cargo install terraphim_agent # With full features cargo install terraphim_agent --features repl-full # Automation CLI (JSON output) cargo install terraphim-cli
What makes Terraphim different from traditional search
All indexing, searching, and graph traversal happens entirely on your device. No cloud dependency, no telemetry, no account required. Privacy by architecture, not by policy.
Aho-Corasick finite state automata match thousands of patterns simultaneously in O(n) time. Lexical extraction, graph traversal, pluggable scorers (BM25, TF-IDF, Jaccard), and similarity re-ranking.
Native Model Context Protocol server connects AI assistants like Claude Code to your local knowledge graphs. Paragraph extraction, semantic search, and token tracking without data leaving your machine.
Written in Rust, compiles to WebAssembly. KG inference in 5-10 nanoseconds. Pipeline processing in hundreds of milliseconds. 15 MB RAM. No GPU required.
Two-stage runtime validation for AI-assisted development. Guard stage blocks dangerous operations. Replacement stage enhances text with KG patterns. Failed commands auto-captured for learning.
Find files by semantic relationship to domain concepts, not just keywords. Multi-source search across local filesystem, Obsidian vaults, Atomic Server, and code repositories. Role-specific relevance.
Each role has its own knowledge graph with domain-specific concepts and synonyms. Engineers, project managers, and analysts see the same documents ranked differently based on their role.
OTP-inspired agent orchestration for running autonomous AI coding agents. Supervision trees, message passing, reconciliation loops, and fault-tolerant lifecycle management.
52 crates organised in a clean dependency graph
Each crate has a single responsibility and can be used independently
| Crate | Description |
|---|---|
| terraphim_automata | Aho-Corasick automata for searching and processing knowledge graphs. The core matching engine. |
| terraphim_rolegraph | Role-based knowledge graph module. Maps search roles to domain-specific graph views. |
| terraphim_types | Core types crate shared across the entire workspace. |
| terraphim_config | Configuration loading and management for all Terraphim components. |
| terraphim_settings | Settings handling library for runtime preferences and defaults. |
| terraphim_service | Service layer handling user requests and responses for the Terraphim core. |
| terraphim_middleware | Middleware for searching haystacks (pluggable data source backends). |
| terraphim-markdown-parser | Markdown parser for extracting structured content from knowledge base files. |
| terraphim_persistence | Persistence layer with Persistable trait and DeviceStorage backends (memory, SQLite, redb). |
| terraphim_build_args | Build argument management for compile-time feature configuration. |
| terraphim_test_utils | Shared test utilities and fixtures for all Terraphim crates. |
| Crate | Description |
|---|---|
| terraphim_agent | AI Agent CLI with interactive REPL, session search, learning capture, and ASCII graph visualisation. |
| terraphim-cli | CLI tool for semantic knowledge graph search with JSON output for automation and scripting. |
| terraphim_server | HTTP server handling the core logic. Provides REST API and knowledge graph backend. |
| terraphim_update | Shared auto-update functionality for all Terraphim AI binaries. |
| terraphim_validation | Release validation system ensuring binary and asset integrity before publishing. |
| Crate | Description |
|---|---|
| terraphim_orchestrator | AI Dark Factory orchestrator wiring spawner, router, and supervisor into a reconciliation loop. |
| terraphim_spawner | Agent spawner with health checking, output capture, and lifecycle management. |
| terraphim_router | Unified routing engine for LLM and agent providers (keyword routing, tier selection). |
| terraphim_agent_supervisor | OTP-inspired supervision trees for fault-tolerant AI agent management. |
| terraphim_agent_application | OTP-style application behaviour for the Terraphim agent system. |
| terraphim_agent_messaging | Erlang-style asynchronous message passing system for AI agents. |
| terraphim_agent_registry | Knowledge graph-based agent registry for intelligent agent discovery and capability matching. |
| terraphim_agent_evolution | Agent evolution and self-improvement tracking. |
| terraphim_workspace | Workspace management for agent execution including lifecycle, hooks, and isolation. |
| terraphim_multi_agent | Multi-agent system built on roles with rust-genai integration. |
| Crate | Description |
|---|---|
| terraphim_kg_orchestration | Knowledge graph-based agent orchestration engine for coordinating multi-agent workflows. |
| terraphim_kg_agents | Specialised knowledge graph-based agent implementations. |
| terraphim_kg_linter | Linter for markdown-based Terraphim KG schemas (commands, types, permissions). |
| terraphim_goal_alignment | Knowledge graph-based goal alignment system for multi-level goal management and conflict resolution. |
| terraphim_task_decomposition | Knowledge graph-based task decomposition for intelligent task analysis and execution planning. |
| terraphim_rlm | Recursive Language Model (RLM) orchestration for structured reasoning chains. |
| terraphim_hooks | Unified hooks infrastructure for knowledge graph-based text replacement and validation. |
| terraphim_file_search | Knowledge-graph scored file search integration. |
| Crate | Description |
|---|---|
| haystack_core | Core traits and types for all Terraphim haystack integrations. |
| haystack_atlassian | Atlassian (Confluence, Jira) integration for searching enterprise knowledge bases. |
| haystack_discourse | Discourse forum integration for fetching posts and messages. |
| haystack_grepapp | Grep.app integration for searching code across GitHub repositories. |
| haystack_jmap | JMAP email protocol integration for searching email (Fastmail, etc.). |
| Crate | Description |
|---|---|
| terraphim_sessions | Session management for AI coding assistant history. Search across Claude Code, Cursor, and Aider sessions. |
| terraphim-session-analyzer | Analyse AI coding assistant session logs to identify agent usage patterns. |
| terraphim_ccusage | Claude Code usage tracking and cost analysis. |
| terraphim_usage | General usage telemetry and analytics. |
| Crate | Description |
|---|---|
| terraphim_symphony | Symphony orchestration service. Reads issues from trackers and dispatches coding agent sessions. |
| terraphim_tracker | Issue tracker abstraction for Gitea and Linear with PageRank-based prioritisation. |
| terraphim_github_runner | GitHub Actions runner with Firecracker sandbox integration. |
| terraphim_github_runner_server | HTTP server for the GitHub Actions runner service. |
| terraphim-firecracker | Sub-2-second VM boot optimisation system for sandboxed agent execution. |
| terraphim_mcp_server | Model Context Protocol (MCP) server exposing Terraphim tools to AI assistants. |
| terraphim_onepassword_cli | 1Password CLI integration for secret management. |
| Crate | Description |
|---|---|
| terraphim_tinyclaw | Multi-channel AI assistant for Telegram, Discord, and CLI. |
| Crate | Description |
|---|---|
| terraphim_automata_py | Python (PyO3) bindings for terraphim_automata. Fast autocomplete and text processing. |
| terraphim_rolegraph_py | Python bindings for terraphim_rolegraph. Knowledge graph operations for AI agents. |
| terraphim-automata-node-rs | Node.js (NAPI) bindings for Terraphim's Aho-Corasick matcher. |
| terraphim-automata-wasm | WebAssembly bindings for terraphim_automata. Runs in the browser. |
Use Terraphim from Rust, Python, Node.js, or the browser
Full access to all 52 crates. Interactive REPL, CLI automation, HTTP server, and agent orchestration.
cargo install terraphim_agent
High-performance text processing and autocomplete. Native bindings via PyO3.
pip install terraphim-automata
Autocomplete and knowledge graph operations with native NAPI bindings.
npm install @terraphim/autocomplete
Same Rust codebase compiled to WASM. Runs in any modern browser with no installation.
# Browser extension available # terraphim-automata-wasm on npm
From ML pipeline to nanosecond inference
| Metric | Traditional ML | The Pattern | Terraphim AI |
|---|---|---|---|
| Data processing | 6 days | 6 hours | Hundreds of ms |
| Inference latency | Seconds | < 2 ms | 5-10 ns |
| RAM footprint | Gigabytes | Hundreds of MB | 15-20 MB |
| GPU required | Yes | No | No |
docs.terraphim.ai -- Full technical documentation (mdBook)
Crate Reference -- All 52 crates with descriptions
Installation Guide -- Platform-specific instructions
Quickstart -- Get running in 5 minutes
Teaching AI Agents with Knowledge Graph Hooks
Teaching AI Agents to Learn from Their Mistakes
Graph Embeddings Documentation
Discord -- Chat with the team
Discourse -- Long-form discussion
GitHub Issues -- Bug reports and features
Source Code -- MIT + Apache 2.0