Terraphim
v1.16.0
Terraphim

Crate Reference

Terraphim AI is a modular Rust workspace comprising 52 crates. Each crate has a single responsibility and can be used independently or composed into larger systems. All crates are available in the terraphim-ai monorepo.

Core Engine

The foundational crates that power Terraphim's deterministic knowledge graph search.

CrateDescription
terraphim_automataAho-Corasick automata for searching and processing knowledge graphs. The core matching engine.
terraphim_rolegraphRole-based knowledge graph module. Maps search roles to domain-specific graph views.
terraphim_typesCore types crate shared across the entire workspace.
terraphim_configConfiguration loading and management for all Terraphim components.
terraphim_settingsSettings handling library for runtime preferences and defaults.
terraphim_serviceService layer handling user requests and responses for the Terraphim core.
terraphim_middlewareMiddleware for searching haystacks (pluggable data source backends).
terraphim-markdown-parserMarkdown parser for extracting structured content from knowledge base files.
terraphim_persistencePersistence layer with Persistable trait and DeviceStorage backends (memory, SQLite, redb).
terraphim_build_argsBuild argument management for compile-time feature configuration.
terraphim_test_utilsShared test utilities and fixtures for all Terraphim crates.

Binaries and CLIs

User-facing executables and command-line tools.

CrateDescription
terraphim_agentTerraphim AI Agent CLI with interactive REPL, session search, learning capture, and ASCII graph visualisation.
terraphim-cliCLI tool for semantic knowledge graph search with JSON output for automation and scripting.
terraphim_serverHTTP server handling the core logic of Terraphim AI. Provides REST API and knowledge graph backend.
terraphim_updateShared auto-update functionality for all Terraphim AI binaries.
terraphim_validationRelease validation system ensuring binary and asset integrity before publishing.

Agent Orchestration (AI Dark Factory)

OTP-inspired agent management system for running autonomous AI coding agents.

CrateDescription
terraphim_orchestratorAI Dark Factory orchestrator wiring spawner, router, and supervisor into a reconciliation loop.
terraphim_spawnerAgent spawner with health checking, output capture, and lifecycle management.
terraphim_routerUnified routing engine for LLM and agent providers (keyword routing, tier selection).
terraphim_agent_supervisorOTP-inspired supervision trees for fault-tolerant AI agent management.
terraphim_agent_applicationOTP-style application behaviour for the Terraphim agent system.
terraphim_agent_messagingErlang-style asynchronous message passing system for AI agents.
terraphim_agent_registryKnowledge graph-based agent registry for intelligent agent discovery and capability matching.
terraphim_agent_evolutionAgent evolution and self-improvement tracking.
terraphim_workspaceWorkspace management for agent execution including lifecycle, hooks, and isolation.
terraphim_multi_agentMulti-agent system built on roles with rust-genai integration.

Knowledge Graph Intelligence

Advanced crates for KG-powered reasoning, task planning, and goal management.

CrateDescription
terraphim_kg_orchestrationKnowledge graph-based agent orchestration engine for coordinating multi-agent workflows.
terraphim_kg_agentsSpecialised knowledge graph-based agent implementations.
terraphim_kg_linterLinter for markdown-based Terraphim KG schemas (commands, types, permissions).
terraphim_goal_alignmentKnowledge graph-based goal alignment system for multi-level goal management and conflict resolution.
terraphim_task_decompositionKnowledge graph-based task decomposition for intelligent task analysis and execution planning.
terraphim_rlmRecursive Language Model (RLM) orchestration for structured reasoning chains.
terraphim_hooksUnified hooks infrastructure for knowledge graph-based text replacement and validation.
terraphim_file_searchKnowledge-graph scored file search integration.

Haystack Integrations

Pluggable data source connectors for searching external systems.

CrateDescription
haystack_coreCore traits and types for all Terraphim haystack integrations.
haystack_atlassianAtlassian (Confluence, Jira) integration for searching enterprise knowledge bases.
haystack_discourseDiscourse forum integration for fetching posts and messages.
haystack_grepappGrep.app integration for searching code across GitHub repositories.
haystack_jmapJMAP email protocol integration for searching email (Fastmail, etc.).

Session and Usage Analytics

Tools for analysing AI coding assistant sessions and tracking usage.

CrateDescription
terraphim_sessionsSession management for AI coding assistant history. Search across Claude Code, Cursor, and Aider sessions.
terraphim-session-analyzerAnalyse AI coding assistant session logs to identify agent usage patterns.
terraphim_ccusageClaude Code usage tracking and cost analysis.
terraphim_usageGeneral usage telemetry and analytics.

DevOps and Infrastructure

Deployment, CI/CD, and infrastructure management.

CrateDescription
terraphim_symphonySymphony orchestration service. Reads issues from trackers and dispatches coding agent sessions.
terraphim_trackerIssue tracker abstraction for Gitea and Linear with PageRank-based prioritisation.
terraphim_github_runnerGitHub Actions runner with Firecracker sandbox integration.
terraphim_github_runner_serverHTTP server for the GitHub Actions runner service.
terraphim-firecrackerSub-2-second VM boot optimisation system for sandboxed agent execution.
terraphim_mcp_serverModel Context Protocol (MCP) server exposing Terraphim tools to AI assistants.
terraphim_onepassword_cli1Password CLI integration for secret management.

Chat and Assistants

Multi-channel AI assistant interfaces.

CrateDescription
terraphim_tinyclawMulti-channel AI assistant for Telegram, Discord, and CLI.

Language Bindings

Cross-language bindings for using Terraphim from Python, Node.js, and WebAssembly.

CrateDescription
terraphim_automata_pyPython (PyO3) bindings for terraphim_automata. Fast autocomplete and text processing for knowledge graphs.
terraphim_rolegraph_pyPython bindings for terraphim_rolegraph. Knowledge graph operations for AI agents.
terraphim-automata-node-rsNode.js (NAPI) bindings for Terraphim's Aho-Corasick matcher.
terraphim-automata-wasmWebAssembly bindings for terraphim_automata. Runs in the browser.

Browser Extensions

CrateDescription
terrraphim-automata-wasm (extension)WASM core for the Terraphim browser extensions (Sidebar and Autocomplete).

Quick Install

# Install the agent (interactive REPL + session search)
cargo install terraphim-agent

# Install the CLI (JSON output for automation)
cargo install terraphim-cli

Or use the universal installer:

curl -fsSL https://raw.githubusercontent.com/terraphim/terraphim-ai/main/scripts/install.sh | bash

Architecture

The crate dependency graph follows a layered architecture:

  1. Types and Config (bottom): terraphim_types, terraphim_config, terraphim_settings
  2. Core Engine: terraphim_automata, terraphim_rolegraph, terraphim_persistence
  3. Service Layer: terraphim_service, terraphim_middleware, haystack integrations
  4. Agent System: terraphim_spawner, terraphim_router, terraphim_agent_supervisor
  5. Orchestration: terraphim_orchestrator, terraphim_kg_orchestration, terraphim_symphony
  6. User Interfaces (top): terraphim_agent, terraphim-cli, terraphim_server, terraphim_tinyclaw

Contributing

Each crate has its own README.md with specific build instructions and examples. See the Contribution Guide for the overall workflow.

Source: github.com/terraphim/terraphim-ai