CLASSEVE
RoutePublic
Public / Context Zero Engine

Context Zero Engine.

A local code-intelligence engine for AI agents. It indexes a repository into a code graph, then answers targeted questions — symbols, dependencies, effects, contracts, similar code, and blast radius — over MCP and HTTP.

Built natively into REX, ClassEve’s desktop AI — so REX understands large codebases by meaning, not just text.

Open source under Apache-2.0 — clone it or browse the repo:

git clone https://github.com/Classevelabs/context-zero-engine.git
Open repository on GitHub
One ordinary job

Your AI reads 1,318 lines to answer one question.
It needs 199.

You pay for all 1,318 — every single time it asks.

The job is always the same three things: the function, the code it uses from other files, and the code that calls it. We measured what that costs 1,000 times on a real 375,000-line codebase of 2,944 files, picking the functions at random. Not an estimate. On an ordinary job your agent searches for the name, opens the 2 files that come back, and reads every line in them.

What your agent reads todayThe orange squares are the part it actually needed. You paid for all of it.
What it reads with ContextZeroJust the part it needed. Nothing else is sent.
Your agent todayWith ContextZero
Times it stops to askthree pauses, or one31
Files it has to openit asks the index it already built2None
Lines of code it readsto answer the same question00
Tokens you are billed for77% fewer00
What that costs youat $3.00 per million tokens3.84¢0.88¢
Did the answer contain the function you asked about?same token budget on both sides, checked against the code on disk1 time in 4Every time

Both sides were given the same number of tokens to spend, so this is not a trade of cheaper for worse. It is a measurement of what your assistant is handed — not a claim about how it thinks.

The same measurement on seven public repositoriesClone any of them and run it yourself. The saving tracks how far a codebase is spread across files — a big one with the answer scattered saves the most, a small tight library saves the least.
  • DjangoPython · 2,955 files87.5%7.99× fewer
  • PrometheusGo · 967 files96.4%27.97× fewer
  • TokioRust · 775 files96.3%27.09× fewer
  • OkHttpKotlin · 644 files29.9%1.43× fewer
  • Commons LangJava · 606 files95.6%22.57× fewer
  • SerilogC# · 215 files78.9%4.74× fewer
  • AlamofireSwift · 108 files20.0%1.25× fewer

It runs on your machine. Your code never leaves it.

There is no service to sign up for and no API key to paste in. The index is a database on your own computer, so nothing gets uploaded and nothing charges you per search. Pull the network cable and try it — the switch does exactly that.

what breaks if Ichange this?YOUR AGENT · LOCAL MCPSOURCE///GRAPHYOUR MACHINECODE GRAPH · LOCAL POSTGRESNEVER CONNECTEDSOMEBODY ELSE’S SERVERVENDOR INDEX · PER-CALL BILLING
Bytes leaving your machine
0
External API calls
None
Capsule compiled in
62 ms
Blast radius, depth 2
102 ms
With the network pulled
Unchanged
Similarity is TF-IDF plus MinHash LSH computed locally — there is no embeddings service to call and no per-token bill for search. The graph is a PostgreSQL database on your own machine, and context is served over local MCP or HTTP.
Now multiply it

That was one job. You run hundreds.

Set how many jobs your agent runs in a day and what you pay per million tokens. The saving per job is measured; the price is yours, because we are not going to quote a rate that changes next month.

$89saved a month
$1,064saved a year
0ktokens not sent
0API calls not made
Computed from the median job only — 9,854 tokens saved on each, over 30 days. Half of all jobs measured cost more than the median, so a real bill saves more than this, not less.
Bigger repo, bigger saving

The bigger the codebase, the more it saves.

In a big repository, most of any file has nothing to do with your question — and that is the part that never gets sent. Measured on four different codebases.

  1. This engine, indexing itself105 files · 7,753 symbols
    2.71× less
    63.1% fewer tokens
  2. A production monorepo375k lines · 1,000 jobs
    8.30× less
    87.9% fewer tokens
  3. VS Codepublic — re-runnable10,386 files · 125,777 symbol versions
    12.44× less
    91.96% fewer tokens
  4. Seven public repositoriespublic — re-runnableDjango, Tokio, OkHttp and four more
    12.86× less
    92.2% fewer tokens
And on a second repository

2,443 files of scripts, release tooling, a website and this engine’s own source: 18,682 tokens a job down to 766 — 96% fewer, and 25× less across the whole run. The function you asked about came back every time, against 1 time in 21 by searching.

What it still does badly
  • It finds seven helpers in ten, not ten in ten. The rest are missed.
  • Typical figures are medians — half of all jobs cost more than the number shown, and half cost less.
  • Answers were checked against the source on disk, not against the engine’s own database. A helper counts only if the code genuinely uses it.
  • An earlier release quoted 33.9×. That measurement counted duplicate copies, and we corrected it downward.
  • Two independent 1,000-job runs agreed within a point on cost and within two points on helper coverage.
Using it

How you use it

Index once, connect an agent, then ask questions instead of reading files.

  1. Clone the engine, point it at a codebase, and let it build the graph. Everything runs and stays on your machine — no code leaves it.

Why it exists

Stop reading the repository one file at a time.

WITHOUT CONTEXT ZEROIt opens one file, then the next, then the next0 of 19 files read5 NEVER GOT OPENEDWITH CONTEXT ZEROIt reads the whole thing once, then you ask1 question askedREADING IT ONCE
  • The code
  • What calls it
  • What it calls
  • What it touches
  • Tests for it
  • Rules it keeps
  • What it breaks
Both sides are the same codebase, started at the same moment. There is no stopwatch on this — it counts how many times you have to ask.

Developer tools — and the agents built on top of them — inspect source one file at a time. For any non-trivial change that means opening many files, tracing transitive effects by hand, and still missing contract assumptions or behaviourally similar code.

Context Zero indexes the repository once into a PostgreSQL-backed code graph, then exposes the same investigation as structured queries: source, callers, callees, effects, tests, invariants, and impact. The goal is practical — make repository context easier to verify, audit, and reuse.

Measured

What it costs to understand a codebase.

Measured on a 375,000-line production monorepo

One real job: change a function. To do it safely an assistant must see the function, the code it uses from other files, and the code that calls it. Collecting those three things was measured 1,000 times — searching and reading files, against one Context Zero request. Engine 2.13.0, live, on the current build.

0%Fewer tokens12,800 → 2,946 on a typical job
0.0×Fewer, across the whole run29.1M → 3.5M tokens
0Lines of code, not 1,318What one request pulls in
0Functions measuredChosen at random

The same 1,000 answers, side by side

Both bars answer identical questions. The baseline is deliberately conservative: capped at the 25 files an agent would plausibly open before giving up, and limited to distinctive symbol names where searching by name is a fair proxy for what an agent would actually do.

File-reading baseline0 tokens
Context Zero0 tokens
0×fewer tokens across the whole run — and the search itself, plus deciding which files to open, is charged to the other side for free.

Spending less is only half the question

Cheap is easy — an empty answer costs nothing. So both sides were given the same tokens to spend, and what came back was checked against the real source code on disk. Searching for a name finds the places that mention it, not the things it needs, which is why the cheaper answer is also the more complete one.

The function you asked to change
Every time
1 time in 4
The code that calls it
85%
36%
The helpers it uses from other files
7 in 10
Almost none
A test that covers it
3 jobs in 10
One Context Zero request Searching and reading files

The bigger the repository, the bigger the gap

Four separate runs, each against the exact-symbol baseline. On a small repository a capsule saves a little; on a large one it replaces work that no longer fits in a context window. The first three are historical runs from the versions named in the benchmark file; the production rung is the 1,000-task run above, with both sides drawing on the same indexed set of files.

Engine self-ingest105 files · 7,753 symbols
2.71×
VS Code10,386 files · 125,777 symbol versions
12.44×
Seven public reposDjango, Tokio, OkHttp, +4
12.86×
Production monorepo375k LOC · 1,000 jobs · 2.13.0
8.3×

Savings shown are token reduction against the exact-symbol baseline: Engine self-ingest 63.1% · VS Code 91.96% · Seven public repos 92.2% · Production monorepo 87.9%.

Eight real symbols, reproducible on this repository

Context Zero indexing its own codebase — 105 files, 7,753 symbols. Every pair is one symbol: what an agent would read to understand it, against the capsule that answers the same question. This is the run you can reproduce yourself.

SemanticEngine
SemanticEngine: baseline 53,543 tokens, Context Zero 12,907 tokens, 4.15× fewer.
4.15×
EffectEngine
EffectEngine: baseline 52,151 tokens, Context Zero 14,154 tokens, 3.68× fewer.
3.68×
ConceptFamilyEngine
ConceptFamilyEngine: baseline 49,666 tokens, Context Zero 15,827 tokens, 3.14× fewer.
3.14×
DispatchResolver
DispatchResolver: baseline 53,214 tokens, Context Zero 19,081 tokens, 2.79× fewer.
2.79×
DeepContractSynthesizer
DeepContractSynthesizer: baseline 65,793 tokens, Context Zero 24,711 tokens, 2.66× fewer.
2.66×
RuntimeEvidenceEngine
RuntimeEvidenceEngine: baseline 36,376 tokens, Context Zero 16,545 tokens, 2.2× fewer.
2.2×
Ingestor
Ingestor: baseline 44,945 tokens, Context Zero 21,430 tokens, 2.1× fewer.
2.1×
CapsuleCompiler
CapsuleCompiler: baseline 17,758 tokens, Context Zero 13,298 tokens, 1.34× fewer.
1.34×
Files an agent reads One Context Zero capsuleTotal 373,446 → 137,953 · 2.71× · 63.1% saved

Query latency on the indexed snapshot

Measured against the self-ingest snapshot on consumer-grade hardware — no server hardware, no clustering. Against the 125k-symbol VS Code snapshot the same queries stayed in the same range: blast radius 164 ms, strict capsule 49 ms.

0ms
Health check
0ms
Strict context capsule
0ms
Blast radius, depth 2

One full index, end to end

The engine indexing its own source, measured 2026-08-26 at a named commit: symbol extraction, relation resolution, dispatch resolution, lineage, effect signatures, contract mining and concept families — 4 minutes 40 seconds, no failures. It ran against a database that already held other work, so the counts are what to compare; a clean database is faster. Clone the repository and run it yourself.

0Files indexed
0Symbols extracted
0Structural relations
0Files failed
7.4 files / second, end to end

Fifteen languages, thirteen engines, sixty-one tools

TypeScript and JavaScript use full AST analysis through the TypeScript compiler; Python uses LibCST; the rest use tree-sitter with language-specific walkers.

TypeScriptJavaScriptPythonCC++CUDAGoRustJavaC#RubyKotlinSwiftPHPBash13 analysis engines61 MCP tools

Tokens are estimated as ceil(bytes / 4) — a deterministic approximation chosen so runs are repeatable; exact counts differ by model, but the ratios hold. The production monorepo is private, so that run is not reproducible outside ClassEve; the self-ingest figures are, on this repository. Absolute timings vary with corpus, hardware, database configuration and engine version.

Reproduce the head-to-head on your own indexed repository with node scripts/bench-head-to-head.ts 40 /path/to/your/repo, and the ingest figures with npx ts-node scripts/bench-ingest.ts. The full method, the historical runs, and the cases where a capsule is larger than the file it replaces are in BENCHMARKS.md.

What it computes

Context in one call

Token-budgeted

Context packages — source, dependencies, contracts, and effects in one call, with a five-level degradation ladder.

Blast radius

Five dimensions

Structural, behavioural, contract, homolog, and historical impact analysis, with severity and confidence scoring.

Effects & behaviour

Nine typed effects

Every function classified pure / read-only / read-write / side-effecting, with the effects propagated transitively.

Contracts

Derived invariants

Input and output types, error and security contracts, guard clauses, and invariants extracted from the source.

Semantic search

No embeddings service

Find code by what it does — TF-IDF plus MinHash LSH similarity. No external APIs.

Smart context

One call, 8+ lookups

One call returns source, blast radius, callers, tests, and contracts — replacing eight or more separate lookups.

Self-maintaining index

No re-ingest

The graph follows the code. Edits are folded into the snapshot seconds after they hit disk — no scheduled job, no editor plugin.

Coverage

Fifteen languages: TypeScript, JavaScript, Python, C, C++, CUDA, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, and Bash. TypeScript and JavaScript use full AST analysis through the TypeScript compiler; Python uses LibCST; the rest use tree-sitter with language-specific walkers. Thirteen analysis engines are exposed through sixty-one MCP tools.

FAQ

Common questions

What is Context Zero Engine?
Context Zero Engine is a free, self-hosted code-intelligence engine for AI agents. It indexes a repository into a PostgreSQL-backed code graph and serves targeted context — symbols, callers, effects, contracts, similar code, and blast radius — over the Model Context Protocol (MCP) and HTTP, so an agent stops reading files one at a time.
How does it reduce token usage for AI coding agents?
An AI assistant asked to change a function has to see three things: the function, the code it uses from other files, and the code that calls it. Without ContextZero it searches for the name and opens whatever comes back — on a typical job that is 2 files, 1,318 lines of code and 12,800 tokens. With ContextZero it asks once: 199 lines and 2,946 tokens. That is 77% fewer tokens for the same job; pooled across all 1,000 measured jobs on a 375,000-line codebase, 29.1 million tokens fall to 3.5 million — 8.3× less. And it costs less without knowing less: given the same tokens to spend, searching contains the function you asked about only 1 time in 4, while one request has it every time; it finds the code that calls it 85% of the time against 36%, seven in ten of the helpers from other files against almost none, and a test that covers it for 3 jobs in 10. The benchmark ships in the repository, so you can reproduce every number on your own codebase rather than take it on faith.
What is MCP, and how does Context Zero use it?
MCP (the Model Context Protocol) is an open standard for connecting AI assistants to tools and data. Context Zero exposes thirteen analysis engines through sixty-one MCP tools, so any MCP-capable agent — including Claude Code — can query the code graph directly.
Which programming languages does it support?
Fifteen: TypeScript, JavaScript, Python, C, C++, CUDA, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, and Bash. TypeScript and JavaScript use full AST analysis, Python uses LibCST, and the rest use tree-sitter.
How is it different from grep or embedding-based code search?
Grep matches text and embeddings match surface similarity; neither understands structure. Context Zero builds a real graph of symbols, calls, effects, and contracts, so it can answer questions like what breaks if I change this and which functions have side effects — not just where a string appears.
Is Context Zero Engine free and open source?
Yes. It is released under the Apache-2.0 license and runs entirely on your own machine. The source is on GitHub at github.com/Classevelabs/context-zero-engine.
What is context saving, and how much does Context Zero save?
Context saving is keeping an agent's context window for the actual change by answering structural questions — definitions, callers, dependencies, blast radius — from a persistent code graph instead of having the agent re-read files. ClassEve's five-task measurement on a 91-file codebase: 115,852 tokens and 65 tool calls file by file, 22,056 tokens and 6 calls through Context Zero Engine — about a fifth of the tokens. Method and limits are on the research page.