How garthdb/ferrograph works
Ferrograph indexes Rust projects into a queryable code knowledge graph, exposed through CLI commands and an MCP server. The main workflow discovers source files, extracts AST entities, resolves module and code relationships, and stores the resulting graph; users then query, search, inspect impact, or review changes against a base revision. The graph also supports watch-driven reindexing and optional git coupling and trait mapping. The sampled pipeline shows phase ordering, but not every phase implementation; those links are limited to relationships documented by the README or pipeline entry point.
Main entry points: mod.rs Index Pipeline · config.rs CLI Dispatch · ops.rs Shared Operations · store.rs CozoDB Store
Components 20
Interfaces
- CLI Dispatch
src/config.rs - MCP Server
src/mcp/mod.rs - Watch Reindexing
src/watch.rs - Claude Skill
src/claude.rs
Indexing
- File Discovery
src/pipeline/discovery.rs - AST Extraction
src/pipeline/ast.rs - Index Pipeline
src/pipeline/mod.rs
Graph Analysis
- Module Resolution
src/pipeline/modules.rs - Call Graph
src/pipeline/calls.rs - Type And Macro Edges
src/pipeline - Ownership And Borrows
src/pipeline/borrows.rs - Git Coupling
src/pipeline/git_coupling.rs
Graph Storage
- Graph Schema
src/graph/schema.rs - CozoDB Store
src/graph/store.rs
Queries And Review
- Graph Queries
src/graph/query.rs - Text Search
src/search/mod.rs - Shared Operations
src/ops.rs - Change Review
src/pr.rs - Output Formats
src/format.rs
Other components
- Engineer / Agent
Connections 28
- Engineer / Agent → CLI Dispatch: runs commands
README.md - Engineer / Agent → MCP Server: uses tools
README.md - Engineer / Agent → Watch Reindexing: watches project
README.md - CLI Dispatch → Index Pipeline: requests indexing
src/config.rs - Watch Reindexing → Index Pipeline: reindexes changes
src/watch.rs - Index Pipeline → File Discovery: discovers files
src/pipeline/mod.rs - Index Pipeline → AST Extraction: extracts syntax
src/pipeline/mod.rs - Index Pipeline → Module Resolution: resolves modules
src/pipeline/mod.rs - Index Pipeline → Call Graph: builds calls
src/pipeline/mod.rs - Index Pipeline → Type And Macro Edges: resolves edges
src/pipeline/mod.rs - Index Pipeline → Ownership And Borrows: resolves borrows
src/pipeline/mod.rs - Index Pipeline → Git Coupling: optionally analyzes
src/pipeline/mod.rs - Index Pipeline → CozoDB Store: builds graph
src/pipeline/mod.rs - Index Pipeline → Graph Schema: uses node types
- CLI Dispatch → Shared Operations: runs queries
src/config.rs - MCP Server → Shared Operations: serves operations
src/mcp/mod.rs - MCP Server → Text Search: searches payloads
src/mcp/mod.rs - Shared Operations → Text Search: runs text search
src/ops.rs - Shared Operations → Graph Queries: requests graph data
src/ops.rs - Graph Queries → CozoDB Store: runs queries
src/graph/query.rs - Text Search → CozoDB Store: searches nodes
src/search/mod.rs - CozoDB Store → Graph Schema: uses graph types
src/graph/store.rs - Change Review → CozoDB Store: opens graph
src/pr.rs - Change Review → Shared Operations: computes impact
src/pr.rs - CLI Dispatch → Change Review: reviews changes
src/config.rs - CLI Dispatch → Claude Skill: manages skill
src/config.rs - CLI Dispatch → Output Formats: selects output
src/config.rs - Change Review → Output Formats: formats reports
src/pr.rs