All commands accept the same global flags. Paths can be project-relative or absolute. Run ctx <command> --help for details on any command.
| Command | What it does |
|---|---|
| -R, --root DIR | Project root (defaults to the nearest directory containing .ctx) |
| -j, --json | Emit machine-readable JSON instead of human text |
| -q, --quiet | Suppress non-essential output |
| -v, --verbose | Verbose diagnostics on stderr |
| --no-color | Disable ANSI colors |
Create .ctx, write a default config, and index the project.
ctx init # index the current directory ctx init src/ # index a specific directory ctx init --force # rebuild index + config even if they exist
Search the graph for symbols or files.
ctx search "rate limit" # symbols whose name matches ctx search --files "auth" # file paths instead of symbols ctx search --kind struct "user" # restrict to a symbol kind ctx search "token" --limit 20 # cap the number of results
Details about a symbol: definition, references, and dependencies.
ctx symbol UserService.updateUser
Show what a file imports and what imports it.
ctx deps src/models/user.py # both directions ctx deps --outgoing src/main.rs # imports only ctx deps --incoming src/api.rs # dependents only
Analyze the impact of changing a symbol or file.
ctx impact UserService.updateUser --depth 5 ctx impact src/worker.rs
Traversal is a cycle-safe breadth-first search over the inverted graph, grouped into direct, indirect, test-file, and unknown buckets. Depth is clamped to 1–20.
Build a relevance-ranked context package for a task.
ctx context "add Google OAuth" ctx context "fix the payment retry bug" --include-bodies ctx context "add rate limiting" --max-tokens 12000 ctx context "refactor the CLI" --no-git
Show symbols changed in the working tree or between refs.
ctx changed # working tree vs HEAD ctx changed --ref main # diff against main ctx changed --sync # update the graph before comparing
Semantic diff of symbols between two git refs.
ctx diff HEAD~3 HEAD ctx diff main
The base defaults to the merge-base with HEAD, so ctx diff main shows everything your branch changed, not everything main did since the fork.
Run the Model Context Protocol server over stdio.
ctx mcp -R /path/to/project
Inspect the project and report the health of the index.
ctx doctor ctx doctor --json
Show a body-less structural skeleton of a source file.
ctx skeleton src/models.py ctx skeleton src/models.py --stats
Print the SQLite graph schema.
ctx schema
Re-run an index pass and print incremental timing.
ctx benchmark
Watch the project and keep the graph in sync.
ctx watch