Skip to content
LOCAL RUST CONTEXT ENGINE · NATIVE VS CODE TOOLS & MCP

Code Context (cctx) for AI Coding Agents Find the signal.
Clamp the noise in 0.23 ms.

Stop feeding coding agents 200-line grep dumps. Code Context (cctx) pairs native VS Code Language Model Tools (#cctxNativeContext) and an MCP server over one shared Rust trigram index—cutting lookup tokens by 73.2–91.3%, accelerating warm retrieval 17.22× in the published retrieval fixture. Linux, native Windows (cctx.exe), WSL, and SSH are supported.

What is Code Context?
A local Rust source index shared by 7 native VS Code and MCP tools.
What does the 17.22× result mean?
A warm mixed-retrieval measurement on the published fixture, not a guarantee for other hardware, workloads, or bills. Methodology and limitations.
Can this website search my source code?

No. Install the local backend and follow the quickstart. The website only publishes documentation.

git clone https://github.com/dotnetpower/code-context.git && cd code-context && bash scripts/install.sh
SCENE 03 · AST CLAMP LOCKED
t = 06.80s
Comparison of traditional multi-turn ripgrep plus 200-line view windows (25,133 tokens, 20 tool calls, 3.996 ms mean retrieval) versus a single Code Context #cctxNativeContext call on plan_query in src/planner.rs:142-146 (4,031 tokens, -84.0% payload reduction, 6 calls, 0.232 ms warm retrieval, SHA-256 verified under 8 KiB).
Drag wipe · 10.0s
ONE SHARED RUST DAEMON · ZERO STARTUP STALLS

One resident index powers both VS Code Native Tools and MCP.

Scroll or toggle between Warm Hit and Cold CACHE_MISS. Code Context never blocks an agent on index warmup: cold workspaces return immediately so host tools proceed without delay while bounded background indexing finishes in ~19.7 ms.

PIPELINE CHOREOGRAPHY · CLICK ANY STAGE OR TOGGLE CACHE STATE
STAGE 01

Native & MCP Ingress

Foreground VS Code agents call #cctxNativeContext; CLI and subagents call code_context over cctx shared-mcp. Both hit the same socket/loopback RPC.

STAGE 02

Trigram + HIR Planner

ASCII/UTF-8 case-folded trigram postings narrow regex and literal candidates in microseconds before touching line buffers, prioritizing symbol definitions.

STAGE 03

Polyglot Block Clamper

Expands matches to clean Rust, Python, TS/React, Go, SQL, and Markdown/Office boundaries under a strict <8 KiB inline guard with SHA-256 verification.

STAGE 04

Watcher & Adaptive Memory

Incremental filesystem watchers reconcile edits live while the memory controller respects Linux cgroup v2 headroom, Windows physical RAM reports, and 15m TTL eviction.

BEYOND SOURCE GREP · FULL CONTEXT HYGIENE SUITE

Rich document anchors, zero-schema probes, and compaction journals.

Every high-volume token leak in real agent sessions—Office decks, 1 MB JSON responses, multi-command build logs, and context compactions—is handled natively in Rust with 0 standing MCP schema bloat.

01 · Virtual #toc & #slide-N-M

Rich Document Slicing (-86.3% to -98.9%)

Inspect .pptx, .docx, .xlsx, .pdf, .epub, Jupyter notebooks, and Markdown by virtual table-of-contents or slide/section anchors—backed by 5.4× faster 9-bit O(1) DEFLATE decoding.

#cctxNativeRead architecture.pptx#toc
→ architecture.pptx#slide-3-5
Full deck dump100.0%
#toc + #slide-3-51.1% – 13.7%
02 · pctx {http|json|table|image|log|batch}

Zero-Schema Probes & BM25+RRF Log Spools

Replace fragile ad-hoc python3 -c, jq, and sqlite3 one-liners. Filter 1 MB JSON payloads to 662 B in 7.82 ms and query spooled batch logs (@s1) without re-running commands.

$ pctx json api.json --where status=500 --count-by route
$ pctx log @latest "panic|deadlock" # 0 re-exec
Raw JSON (1,021,281 B)7.82 ms
Redacted digest (662 B)-99.94%
03 · cctx journal & cctx usage

<=2 KiB Continuity & Live Cost Telemetry

Preserve architectural decisions across compactions in strictly <= 2,048 B with fail-open hooks (0 PreToolUse denials), and track live AIC/USD savings in VS Code or cctx usage --hours 24.

$ cctx usage --hours 24
💰 $48.88 saved · 26.6% less (~$183.78 → $134.90)
⚡ Avoided ~1.58B tok · Warm hits 95.5%
40-step journal resume (1,829 B)-99.58%
8,960 CORRECTNESS-CHECKED PAIRS · REPRODUCIBLE EVIDENCE

Measured retrieval speedups, token reductions, and honest limits.

Evaluated across 8 daemon sessions × 40 rounds × 28 tasks on AKS Store Demo, 506-file Python and 6,000-file Rust suites, and controlled end-to-end Copilot CLI A/B trials.

Measured retrieval latency, paired-session speedup confidence intervals, Rust and Python lookup token savings, and Copilot A/B task completion speedup
Transparent engineering boundaries: Small known-file reads are 0.43× (2.4× slower: 0.081 ms → 0.190 ms) over daemon IPC than direct buffered reads because IPC adds socket and JSON framing overhead. A cold CACHE_MISS plus host fallback had a 4.409 ms median—no cold-cache speedup is claimed. See the full methodology, confidence intervals, and reproduction commands.
17.22× Mixed retrieval speedup (95% CI 17.04–17.40×, 3.996 → 0.232 ms)
-73% to -91% Rust & Python 6-symbol lookup payload token reduction
-24.7% Faster Copilot A/B task wall time (20.31 s → 15.30 s, 100% accuracy)
-25.4% Lower net session AIU billing cost (-61.9% tool calls)
Benchmark Workload Baseline With cctx Impact
Literal search (AKS Store Demo) 5.234 ms 0.230 ms 22.77× faster
Search + context 5.343 ms 0.250 ms 21.39× faster
Filename discovery 4.466 ms 0.254 ms 17.57× faster
Known small read + SHA-256 0.081 ms 0.190 ms 0.43× (IPC overhead)
Rust 6-symbol lookup tokens 15,028 – 25,133 tok 4,031 tok -73.2% to -84.0%
Python 6-symbol lookup tokens 13,997 – 24,609 tok 2,141 tok -84.7% to -91.3%
BPE formula instructions 2,048 tok 756 tok -63.1% per turn
FREQUENTLY ASKED QUESTIONS · TECHNICAL EVALUATION

Common questions from engineers & agent builders

How is Code Context (cctx) different from ripgrep or vector embeddings?

ripgrep spawns a fresh scan per call and returns raw lines without block boundaries, forcing agents into multi-turn rg + view loops. Vector RAG requires cloud or GPU embedding indexes that drift on edits and blur exact identifiers. cctx keeps an exact, deterministic in-memory trigram posting index in Rust with live file-watcher updates and polyglot AST block clamping—100% local and SHA-256 verified.

Does cctx upload source code or require an external API key?

Indexing, trigram queries, document extraction, and continuity journals run locally. Explicit pctx http probes contact the URLs you supply. AI clients receiving tool output follow their own data policies; review the privacy boundaries.

Should I use the VS Code Native Extension or the MCP server?

In VS Code 1.140+, install dotnetpower.code-context-native from the Marketplace for foreground native tool dispatch and automatic BPE-aligned agent instructions, and optionally configure cctx shared-mcp for background subagents or MCP-only clients (Claude Code, Cursor, CLI agents). Both surfaces share the exact same resident Rust daemon and cache.

Does it work on native Windows without WSL?

Yes. Build or copy cctx.exe to %USERPROFILE%\.local\bin\cctx.exe. The VS Code extension automatically starts cctx.exe daemon in the background on first use and falls back to VS Code’s bundled rg.exe if ripgrep is not on PATH. WSL and Windows Agent Sessions are also first-class supported.

Looking for broader LLM & Copilot token-cost playbooks and zero-code request profiling? Explore our companion guide agent-tokenomics & tokprof ↗ or browse the machine-readable llms.txt and llms-full.txt indexes.

Check your lookup payload reduction

Enter token counts from your own tool outputs. This arithmetic is not a forecast of billing or performance.

Example inputs only. Submit to calculate.