Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Dependencies

This page documents all dependencies, their versions, and why each is needed. Update this page when upgrading any crate.

Verified May 2026.

MSRV Policy

Minimum Supported Rust Version: 1.85 (Rust edition 2024).

The MSRV is set in Cargo.toml. It’s tested in CI on every commit. Don’t use language features or standard library APIs introduced after 1.85 without bumping the MSRV and updating this page.

Core Dependencies

CrateVersionPurpose
clap4.6CLI framework with derive macros and multicall support
tree-sitter0.25AST parsing for chunking, outline, snap, structural search
ast-grep-core0.42Structural pattern search (the --structural mode)
safetensors0.7Load embedding model weights (zero-copy mmap)
ndarray0.17Dense matrix operations for embedding inference
sprs0.11Sparse matrices for BM25 scoring (CSC format)
tokenizers0.23cl100k_base token counting for --budget enforcement
similar3.1Diff computation for prx diff
bloomfilter3.0Bloom filter for prx exists O(1) checks
serde1.0Serialization framework
serde_json1.0JSON output
xxhash-rust0.8Content hashing (xxh3 feature)
ignore0.4.gitignore-aware file walking (from ripgrep)
regex1.0Literal search and identifier extraction
thiserror2.0Typed library errors
anyhow1.0CLI error handling

Optional Dependencies

These are only linked when the corresponding feature is enabled.

CrateVersionFeaturePurpose
rmcp1.xmcpMCP server (official Anthropic Rust SDK)
tokio1.xmcp, watchAsync runtime (only linked for MCP and file watching)
notify9.0-rcwatchFile watching for prx index --watch

The core binary without mcp or watch is fully synchronous. No async runtime is linked.

Dev Dependencies

CrateVersionPurpose
assert_cmd2.2CLI integration testing
predicates3.xAssertion helpers for assert_cmd
tempfile3.xTemp directories for tests
criterion0.8Benchmarking

Tree-sitter Grammar Crates

All grammar crates must be compatible with tree-sitter 0.25.x. This version was chosen because it has the broadest grammar crate compatibility — only 1 of 15 grammar crates supports 0.26.x.

CrateVersionLanguageNotes
tree-sitter-rust0.24RustLANGUAGE const
tree-sitter-python0.25PythonLANGUAGE const
tree-sitter-javascript0.25JavaScriptLANGUAGE const
tree-sitter-typescript0.23TypeScript, TSXTwo separate Language objects: LANGUAGE_TYPESCRIPT, LANGUAGE_TSX
tree-sitter-go0.25GoLANGUAGE const
tree-sitter-java0.23JavaLANGUAGE const
tree-sitter-c0.24CLANGUAGE const
tree-sitter-cpp0.23C++LANGUAGE const. Also compatible with 0.26.
tree-sitter-ruby0.23RubyLANGUAGE const
tree-sitter-bash0.25BashLANGUAGE const
tree-sitter-json0.24JSONLANGUAGE const
tree-sitter-toml0.20TOMLlanguage() function (not a const)
tree-sitter-yaml0.7YAMLCheck source for access pattern
tree-sitter-html0.23HTMLLANGUAGE const
tree-sitter-css0.25CSSLANGUAGE const

Standard access pattern (14 crates):

#![allow(unused)]
fn main() {
use tree_sitter_rust::LANGUAGE;
let lang: tree_sitter::Language = LANGUAGE.into();
parser.set_language(&lang)?;
}

TypeScript (special — two languages):

#![allow(unused)]
fn main() {
use tree_sitter_typescript::{LANGUAGE_TYPESCRIPT, LANGUAGE_TSX};
// Use LANGUAGE_TYPESCRIPT for .ts files
// Use LANGUAGE_TSX for .tsx files
}

TOML (special — function, not const):

#![allow(unused)]
fn main() {
let lang = tree_sitter_toml::language();
parser.set_language(&lang)?;
}

Why These Choices

clap over structopt: clap 4.x includes derive macros natively. structopt is deprecated.

tree-sitter 0.25 over 0.26: Grammar crate compatibility. Only 1 of 15 grammar crates supports 0.26.x.

safetensors over manual deserialization: Zero-copy mmap, standard format, maintained by HuggingFace.

ndarray over nalgebra: ndarray is the standard for numerical computing in Rust. nalgebra is better for linear algebra but ndarray’s array slicing is more natural for embedding operations.

sprs over manual sparse matrix: sprs is the standard Rust sparse matrix crate. CSC format is optimal for column-wise BM25 queries.

ignore over walkdir: ignore is from ripgrep and handles .gitignore correctly. walkdir doesn’t understand .gitignore.

similar over diff: similar is pure Rust and handles both line-level and character-level diffs. The diff crate is older and less maintained.

xxhash-rust over blake3: xxh3 is faster for content hashing where cryptographic security isn’t needed. blake3 is better for security-sensitive hashing.

thiserror + anyhow over custom error types: thiserror generates boilerplate for typed errors. anyhow is ergonomic for CLI error propagation. Using both is the standard Rust pattern.

Evaluating New Dependencies

Before adding a dependency:

  1. Check if an existing dependency already provides the functionality.
  2. Check the crate’s maintenance status (last commit, open issues, downloads).
  3. Check the MSRV — it must be <= 1.85.
  4. Check for security advisories via cargo audit.
  5. Check license compatibility (Apache 2.0 or MIT preferred).
  6. Add a comment in Cargo.toml explaining why the crate is needed.

Run cargo deny check after adding any dependency. This checks for license compliance, duplicate dependencies, and security advisories.