ctx-agent
A Rust CLI that turns a repository into queryable memory for AI coding agents.
Why it exists
An agent working in a large repository loses most of its time walking files to answer a single question: if I change this file, what breaks? Symbol indexes such as ctags return a list but are not shaped for an agent, and server-backed code intelligence needs infrastructure. ctx-agent scans the project once, writes it to SQLite, and answers the agent locally — no LLM, no cloud, no API key.
What it does
- Codebase map: directory tree, file and line counts, symbols per file
- Symbol extraction with signatures for Rust, TypeScript, JavaScript, Python and Go
- Dependency graph and blast radius for a given file
- Decision log extracted from conventional commits
- FTS5 full-text symbol search with partial matching
- Health warnings: fragile files, files over 500 lines, dead code
- File watcher that re-analyses on change
- MCP server exposing the toolset to any MCP client
Stack
- Rust
- SQLite FTS5
- tree-sitter
- Model Context Protocol
Usage
cd your-project && ctx init
ctx status
ctx map
ctx query "parse"
ctx blast-radius src/db/mod.rs
ctx decisions
ctx warnings
ctx watch
ctx status --json
Engineering notes
The stated non-goals carry as much weight as the features: it does not write code, does not guarantee that a build or lint passes, does not observe runtime behaviour and is not an LSP. What it does is static structural analysis, and saying so is what keeps the output trustworthy. Re-scans are incremental — only changed files are analysed again. A paranoid mode is on by default and reports BLOCK or PASS for changes that touch auth, session, token or crypto paths, and every MCP call is appended to a per-project activity log.
Limitations
- Swift and Kotlin are tracked as files and line counts only; symbol extraction for them is planned.
- In languages without symbol extraction, file tracking, line counts and git history analysis still work.