Magellan
Version: 4.6.0
Magellan is a deterministic codebase indexing tool. It watches or scans source trees, extracts symbols, references, calls, AST nodes, code chunks, CFG data, and coverage metadata, then stores those facts in a local SQLite database for fast CLI and downstream-tool queries.
Magellan is intentionally fact-oriented: it records what is present in source code and leaves higher-level reasoning to tools such as llmgrep, Mirage, and Splice.
Current Storage Model
The supported user-facing database is SQLite:
code.db
Use .db files for normal operation.
Schema version: 17 (telemetry events, cfg-aware CFG blocks, project metadata, FTS5 full-text search, graph memory tables)
Features
- Multi-language symbol extraction with tree-sitter: Rust, Python, C, C++, Java, JavaScript, TypeScript, Go, and CUDA
- Stable symbol IDs, canonical FQNs, display FQNs, and byte/line spans
- File watching and one-shot indexing
- References and call graph queries
- AST node storage and AST queries
- Code chunks for source retrieval and editor context
- CFG blocks and CFG edges for control-flow analysis
#[cfg]attribute extraction: CFG blocks inherit cfg conditions from function attributes- Cargo.toml manifest parsing: features, dependencies, and test/bench/example targets
.magellan.tomlproject configuration with include/exclude filters- Auto-detect project layout from
Cargo.toml,pyproject.toml,go.mod,package.json,tsconfig.json,pom.xml,CMakeLists.txt - Coverage ingestion from LCOV into CFG coverage side tables
- Graph algorithms: reachability, dead code, cycles, condensation, paths, slice
- HopGraph v2: embedding-based semantic symbol search with HNSW, name resolution, and
--hops Ngraph expansion via BFS on REFERENCES edges - Source inventory: index wiki pages, specs, and other non-code documents
- Candidate facts: structured knowledge triples linked to source documents
- JSON, pretty JSON, human output, and graph exports
- LSIF import/export and SCIP export
doctorchecks for schema and database health
Quick Start
# Initialize project configuration
# Build an index
# Check database contents
# Query symbols in a file
# Find symbols
# Show incoming or outgoing references/calls
# Index or delete one file
# Refresh from git working tree changes
# Recompute derived metrics
# Semantic symbol search (requires embed + configured embeddings)
Coverage
Magellan can ingest LCOV data and attach it to CFG blocks and edges:
Status JSON always includes a stable coverage object:
When coverage exists, source, revision, and ingested_at are included.
Service Daemon
Magellan can run as a background daemon with per-project filesystem watchers and a JSON-RPC control socket for integration with downstream tools.
The daemon uses notify::RecommendedWatcher directly with custom debouncing
that filters out read-only filesystem events (ACCESS/OPEN/CLOSE_NOWRITE).
Only write-side mutations (CREATE/MODIFY/REMOVE) are tracked. This prevents
the feedback loop where reading a file for reconciliation would trigger
re-indexing.
The daemon stores databases at ~/.magellan/<name>/<name>.db. The JSON-RPC
socket (at $XDG_RUNTIME_DIR/magellan.sock) supports project management,
cross-project queries, and an evolution loop for automated refactoring
candidates. See docs/API_INTEGRATION.md for the full method reference.
Useful Commands
# Natural language query routing (callers, CFG, cycles, impact, semantic search, find)
# Grounded investigation packet (term extraction → symbol find → callers/callees/impact/context)
External CFG Tools
The optional external-tools-cfg feature enables extra CFG extraction paths for
C/C++ and Java using installed external tools:
The default build does not require clang, javac, LLVM libraries, or Java bytecode libraries.
Documentation
- MANUAL.md: command reference and workflows
- CHANGELOG.md: release notes
- docs/MAGELLAN_ARCHITECTURE.md: architecture
- docs/SCHEMA_SQLITE.md: SQLite schema
- docs/SCHEMA_REFERENCE.md: stable IDs and data model
- docs/API_INTEGRATION.md: Rust/API integration notes
- docs/JSON_EXPORT_FORMAT.md: JSON response shape
- docs/CONTEXT_API_CONTRACT.md: context API contract
- docs/TESTING.md: verification commands
License
GPL-3.0