jahala/tilth
Smart(er) code reading for humans and AI agents. Reduces cost per correct answer by ~40% on average. Install: cargo install tilth -or- npx tilth
What it solves
AI agents often struggle with large codebases, wasting tokens and time by making multiple tool calls (like globbing, grepping, and reading files) just to find a single function. tilth provides structural awareness of a codebase, allowing agents and humans to locate definitions, trace call chains, and understand file contents without redundant reads.
How it works
tilth combines the power of ripgrep for fast text search, tree-sitter for AST parsing across 16 languages, and memory-mapped file reads for speed. It processes files based on their size: small files are returned in full, while large files are replaced by a structural outline of their contents.
Key capabilities include:
- Structural Search: Finds where symbols are defined rather than just where the text appears.
- Call Chain Tracing: Automatically resolves callees and callers using tree-sitter queries.
- Dependency Analysis: Identifies what a file imports and what other files depend on it.
- Structural Diff: Provides function-level change detection instead of line-based diffs.
- MCP Integration: Acts as a Model Context Protocol (MCP) server to integrate directly with AI agents like Claude Code, Cursor, and Windsurf.
Who it’s for
Developers and AI agent creators who want to reduce the token cost and increase the accuracy of AI-driven code navigation and editing.
Highlights
- Cost Reduction: Benchmarks show up to a 44% reduction in cost per correct answer for models like Claude 3.5 Sonnet.
- Language Support: Supports 16 languages including Rust, TypeScript, Python, Go, and Java.
- High Performance: Built in Rust with no runtime dependencies, utilizing concurrent caching and SIMD pre-filtering.
- Hash-Anchored Editing: An optional "Edit mode" that uses hashes to ensure edits are applied to the correct lines, preventing errors when files change.
- Broad MCP Support: Easy installation for a wide variety of AI IDEs and agents.