Skip to main content
ctx · a queryable model of your codebase

The local quality authority for AI-written code

ctx is a queryable model of your codebase that grounds your agent and gates its output — every turn. It hands your agent a map before it starts, shows the blast radius of every edit, and enforces your rules as deterministic gates. Locally.

cargo install agentis-ctx
~27×
smaller context — 233k → ~8.7k tokens for a task with ctx smart
0.36s
to index 870 symbols and 5,463 call edges (measured on this repo)
100%
local — one SQLite file, offline embeddings, your code never leaves your machine

One model. Grounded input, governed output.

Precise retrieval and real code intelligence, from one fast local binary.

Right context, fewer tokens

ctx smart ranks files by meaning and call-graph relevance, then trims them to a token budget. Your agent gets the code that matters, not the whole repo.

Know what breaks first

Impact analysis answers "what depends on this?" before an edit lands — so agents check the blast radius instead of missing the caller three hops away.

Agent-native (MCP + JSON)

ctx serve --mcp exposes search, impact, and smart context as tools to Claude Desktop and other agents. Every command also speaks --output json.

Structural + semantic

Not just grep and not just embeddings. ctx combines tree-sitter call graphs with local vector search — it finds code by meaning and follows the relationships.

Local, private, offline

Written in Rust with local embeddings and a single portable SQLite file. No servers, no API keys required — your source never leaves your machine.

Multi-language, fast

Rust, TypeScript, JavaScript, JSX/TSX, Python, Go, Solidity, and YAML. Indexes thousands of files in seconds and only reindexes what changed.

Ground and govern every change

One world model, two jobs: feed the model the right context going in, and guardrail what it changes coming out.

Ground — the right context, in
# Build the world model once
ctx index

# Task-scoped, token-budgeted context
ctx smart "add rate limiting" --max-tokens 8000

# Or just the git changes, with call-graph context
ctx diff --summary
Govern — guardrails, on what changes
# Enforce your architecture rules on the change
ctx check --against origin/main

# One gate for the whole change (exit 1 = not done)
ctx score --fail-on "check_violations>0,new_duplication>0"

# Auto-gate every agent edit via Claude Code hooks
ctx harness init --target claude