Rust Code Knowledge Graph for AI Navigation
π¨π³ δΈζζζ‘£
Ferrimind builds a durable, queryable knowledge graph of any Rust project. Give it to an AI agent β it understands the entire codebase without reading files one by one.
Think of it as a satellite map of your Rust codebase, while LSP (rust-analyzer) gives you a microscope for individual symbols.
| LSP / rust-analyzer | Ferrimind |
|---|---|
| One symbol at a time | Whole-project graph in one shot |
| Needs an open IDE | Offline, portable JSON file |
| No "project overview" | nav map β 8000-token architecture summary |
| Find references (flat list) | query impact β full dependency propagation chains |
| No structural health checks | analyze health β cycles, god modules, dead code |
| Human-first (hover, click) | AI-first β designed for LLM context windows |
# Install
cargo install ferrimind
# Index a project
ferrimind index /path/to/rust/project
# β indexed 9089 nodes, 14355 edges in 168 files
# Get an AI-ready architecture map
ferrimind nav map
# Search for anything
ferrimind query search "handle_connection"
# Explore interactively in the browser
ferrimind serveferrimind index . # Index current project
ferrimind index --all . # Discover & index all Cargo projects
ferrimind index --no-tests # Skip test files
ferrimind index --output custom.json.gz # Custom output path (gzipped)ferrimind query stats # Node/edge counts
ferrimind query search "config" # Fuzzy text search
ferrimind query symbol main # Inspect a symbol
ferrimind query callees main --depth 3 # What does main call?
ferrimind query callers load_config # Who calls this?
ferrimind query impact Runtime --depth 2 # Full dependency impact
ferrimind query path main load_config # Shortest call pathferrimind nav map # Token-budgeted project overview (for LLMs)
ferrimind nav guide # Entry points + call chains
ferrimind nav clusters # Feature clusters by file
ferrimind nav quality # Graph confidence score
ferrimind nav health # Cycles, god modules, dead codeferrimind analyze deps # Module dependency matrix
ferrimind analyze fanout # File-level fan-in / fan-out
ferrimind analyze tests # Test impact candidates
ferrimind analyze hotspots # Git churn hotspots
ferrimind analyze diff # Graph diff vs git baseferrimind serve # Index + serve
ferrimind serve --graph graph.json.gz # Serve a pre-built graph
ferrimind serve --watch # Auto-reindex on file changesferrimind config --api-key sk-... --model gpt-4Launch ferrimind serve and open http://127.0.0.1:7878:
- Graph visualization β force-directed layout, color-coded by node/edge kind
- Interactive exploration β click nodes to expand, drag to rearrange
- Edge filtering β toggle relationship types (calls, declares, uses_type, β¦)
- Detail drawer β inspect symbols, files, edges
- Chinese UI β full zh-CN interface
| Project | Nodes | Edges | Warnings | Quality |
|---|---|---|---|---|
| ferrimind (self) | 899 | 1,676 | 0 | 99 |
| ripgrep | 9,089 | 14,355 | 0 | 96 |
| tokio | 14,176 | 28,831 | 0 | 98 |
All three projects indexed with zero warnings.
cargo metadataβ discovers packages, targets, source filessynAST walk β extracts structs, enums, functions, methods, impls, macrosβ¦- Call resolution β same-module priority, method-to-trait-impl matching
- rust-analyzer enrichment (optional) β LSP call hierarchy for confirmed edges
- MIR lowering (optional) β rustc MIR for dispatch sites
- Graph persistence β gzip-compressed JSON (14Γ smaller than raw)
The output is a single JSON file (gzipped by default):
{
"schema_version": 2,
"project": { "root": ".", "packages": [β¦] },
"nodes": [
{ "id": "function:ferrimind::run", "kind": "function", "name": "run", β¦ }
],
"edges": [
{ "from": "function:ferrimind::main", "to": "function:ferrimind::run",
"kind": "calls", "source": "ast", "certainty": "definite" }
]
}| Edge Kind | Meaning |
|---|---|
calls |
Function/method call |
declares |
Module declares a symbol |
uses_type |
Type reference |
contains |
File contains a module |
imports |
use statement |
has_method |
Impl block owns a method |
implements |
Trait implementation |
returns |
Return type |
module_file |
File β module mapping |
git clone https://github.com/yourname/ferrimind.git
cd ferrimind
cargo build --release
./target/release/ferrimind --version
# ferrimind 0.1.0 (abc1234 2026-05-09)Requires Rust β₯ 1.85 (edition 2024).
src/
βββ main.rs # CLI entry & command dispatch
βββ cli.rs # clap argument definitions
βββ analyzer.rs # AST indexer (syn walk)
βββ query.rs # Graph traversal & search
βββ model.rs # Core data model
βββ store.rs # Gzip JSON load/save
βββ web.rs # Embedded HTTP server
βββ semantic.rs # rust-analyzer enrichment
βββ mir.rs # MIR lowering
βββ ai.rs # AI nav commands
βββ config.rs # Global config (~/.config/ferrimind/)
βββ term.rs # ANSI terminal colors
βββ health.rs # Architecture risk detection
βββ β¦
web/
βββ index.html
βββ styles/ # CSS (dark theme)
βββ src/ # JS (microkernel architecture)
MIT
Built for AI. Made with π¦ in Rust.