Parse Trees · Weave Graphs

Code search for large codebases, built for LLMs and the humans working alongside them.

Treeweft indexes codebases into a structured representation that combines semantic embeddings with a graph of the code's actual relationships — calls, imports, inheritance, references. Ask "how does authentication work in this repo?" and get the right code, not a pile of grep matches and partial file reads.

Why this exists

Large codebases are hostile to LLMs.

Dumping the whole repo into context burns tokens and dilutes attention. Grep finds strings, not concepts. Standard RAG treats code like prose, which it isn't.

The problem
  • Repos are too big to fit in any usable context window.
  • Grep matches surface strings, not the concept you asked about.
  • Naive RAG cuts mid-function and loses structural meaning.
The Treeweft take

Code has structure worth preserving: an AST parsed by tree-sitter, a graph of how files and symbols relate, and semantic embeddings that capture meaning. Combine all three and retrieval becomes specific, structural, and faithful to how code actually works.

What it does

Retrieval that respects how code is written.

Parses, doesn't tokenize.

Tree-sitter produces real syntax trees for every supported language, so chunks respect function and class boundaries — never mid-statement cuts.

Builds a code graph.

Calls, imports, inheritance, and references become edges in Neo4j. Traverse from a symbol to its definition, callers, and dependencies — the way you'd actually navigate code.

Embeds with intent.

Code chunks embed for semantic search via a horizontally scalable fleet — Hugging Face TEI (CPU or CUDA), or your preferred hosted service via config.

Reranks for relevance.

A separate reranking stage refines initial retrieval, because the top embedding match isn't always the right answer.

Exposes itself to LLMs.

First-class MCP support means Claude and other MCP-capable assistants use Treeweft directly as a tool — no bespoke integration required.

Runs where you do.

Self-host the full stack with one docker compose, or scale embeddings and storage out across machines. Same codebase, both shapes.

Architecture

A small set of cooperating services.

Not a single binary. The indexer owns parsing, chunking and all retrieval; the MCP server is a thin proxy to it. A Postgres-backed job queue survives restarts mid-job. Vectors live in Milvus, LanceDB or Chroma, the code graph in Neo4j or SQLite, and embedding and reranking run on self-hosted CPU or GPU workers or through a hosted API.

CLIENTS SERVICES STORAGE LLM Agent (MCP) Claude, Cursor, custom Developer CLI / API curl, dashboard, scripts MCP Server search_code · find_callers thin proxy to the indexer's HTTP API Indexer Service index · search · rerank tree-sitter + chonkie chunks, hybrid search + graph context Embedding Fleet embed · rerank TEI workers, CPU or CUDA, or a hosted API Job Queue postgres-backed survives restarts, resumes mid-flight Vector Store Milvus · LanceDB · Chroma Code Graph Neo4j or SQLite · calls, imports Application State Postgres · jobs, sources, queue, embedding backends, caches

Scroll sideways to see the whole diagram →

Measured

The same answers, for less.

We gave a real LLM agent 200 questions about featbit — a ~1,900-file C#/TypeScript codebase pinned at v5.4.9 — once with Treeweft and once with a grep/glob/read loop, on DeepSeek, Claude Sonnet 5 and GPT-5.5, scored by an independent judge. Treeweft matched grep's answers for less in every configuration — most of all when you can describe what code does but don't know what it's called.

11–47%
cheaper than grep, in all 6 model × question-type configurations
−47%
cost vs grep on GPT-5.5, for questions that don't name the symbol
24 → 8
questions per 100 where the agent ran out of turns, grep vs Treeweft (GPT-5.5)
0.68
right file ranked first, vs 0.48 for vector RAG on the same embeddings

September 2026, n=100 per configuration. Cost differences are significant per query on every symbol-free configuration; answer-quality differences are not significant in any (best p = 0.061). One repository, one run per configuration. Full results, significance tests and caveats →

What it's been tested on

From overnight on a single host to a week on the same hardware.

100 mid-to-large open-source GitHub repos across several popular languages, roughly 650,000 files in total — of which 95 completed end-to-end. The 5 failures had two known causes, an I/O ReadError under high indexing concurrency and chunks exceeding the vector store's varchar ceiling; concurrency is now capped by a semaphore, and oversized chunks route to a CPU embedding backend instead of crashing the GPU one. Initial naive indexing took an estimated week-plus. After tuning Milvus topology, embedding batch sizes, fleet size, and request distribution, the same workload finishes overnight. The scaling axis is embedding-worker parallelism; everything else stays boring.

95/100
repositories indexed end-to-end in the harness
~650K
files across the fleet
7d → 1 night
same workload, same hardware, tuned
1
command to bring the stack up locally
Who it's for

Built for three audiences who keep running into the same wall.

Developers buried in a large repo

You want better code search than grep and ripgrep on codebases too big to hold in your head — without leaving your terminal or IDE.

Teams shipping coding assistants

You need to give LLMs faithful, token-efficient access to large internal codebases so the answers stop hallucinating file paths.

Anyone reverse-engineering a codebase

You want to understand how a project works without reading every file — and you'd rather start from the graph of how it's wired than a flat directory tree.

Treeweft is under active development.

Source code, documentation, and installation instructions live on GitHub. The project draws on prior work including repomix and conversations in the broader code-retrieval and repository-level-RAG community.

Read the source Installation guide