Benzi Indexes Code with Tree-Sitter for O(1) AST-Gated Agent Edits
Benzi replaces repository-wide context dumping with a tree-sitter compiler pass that maps symbols, call chains, and inheritance in O(1) lookups. On SWE-bench Verified, running it alongside DeepSeek v4-flash resolved issues at approximately one cent per bug while enforcing syntax gates.

Impact: Medium
Why it matters
You can eliminate bloated prompt contexts and syntax regression loops by letting agents query a deterministic static index before altering your code.
TL;DR
- 01Replaces blind file-reading loops with a queryable compiler index across 10 programming languages.
- 02Auto-reverts any LLM code modification that fails syntactic and AST-level validation gates.
- 03Drops bug-fixing costs to approximately $0.01 per task on DeepSeek v4-flash via SWE-bench Verified data.
Key facts
- DeepSeek bug resolution cost
- ~$0.01 per bug (self-reported)
- Claude Code step cost comparison
- Up to $0.18 per step (self-reported)
- Language grammars supported
- 10 languages + HTML/CSS/DOM-JS
- Evaluation benchmark
- 500 SWE-bench Verified issues
Tree-Sitter Graph Resolution Over Context Dumping
Unlike workflows that grep through files or compute cosine similarity across vector chunks, Benzi parses the entire project prior to answering questions. Using language-specific tree-sitter grammars across ten languages (including Python, TypeScript, Go, and Rust) alongside a dedicated HTML/CSS engine, it constructs a complete map of symbols, inheritance chains, and call sites. Identified data flows link directly to call locations, enabling lookups like backflow or trace_path in $O(1)$ tool execution steps.
Blast Radius Analysis and Syntax Gating
Benzi executes modifications through guarded writes:
- Pre-write blast radius evaluation: The agent examines caller dependencies and references before applying diffs.
- Parser-level syntax checks: Every write is validated against the live AST; broken AST parses trigger an immediate automated revert.
- Runtime trace capture: For Python codebases, an internal execution tracer observes runtime argument values and dynamic dispatch to reconcile ambiguous static edges.
SWE-bench Verified Benchmarks and Token Costs
Evaluating the full 500-instance SWE-bench Verified benchmark on DeepSeek v4-flash showed marked efficiency gains over file-dumping approaches. Benzi resolved issues at roughly $0.01 per bug, while harnesses like Claude Code scaled upward to $0.18 per step as problem complexity increased. The index resolves navigation demands early, keeping line-read volumes low regardless of repository scale.
✓ When to use
- Refactoring large, unfamiliar codebases without spending millions of context tokens on raw file dumps.
- Enforcing automated rollbacks for LLM-generated code that breaks parser grammar.
✕ When NOT to use
- Headless terminal scripts and CLI-only pipelines where no browser or VS Code host exists.
- Languages outside the ten core grammars that require deep dynamic call-graph tracing.
What to do today
- Test repository indexing by pasting a public GitHub repository URL into the benzi.fly.dev web interface.
- Install the Benzi extension from the VS Code Marketplace to test AST-gated modifications in local projects.
- Inspect high-complexity call hierarchies using the `trace_path` and `backflow` agent tools.
Sources