Command reference

All commands accept the same global flags. Paths can be project-relative or absolute. Run ctx <command> --help for details on any command.

Global flags

CommandWhat it does
-R, --root DIRProject root (defaults to the nearest directory containing .ctx)
-j, --jsonEmit machine-readable JSON instead of human text
-q, --quietSuppress non-essential output
-v, --verboseVerbose diagnostics on stderr
--no-colorDisable ANSI colors

ctx init

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

ctx search

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

ctx symbol

Details about a symbol: definition, references, and dependencies.

ctx symbol UserService.updateUser

ctx deps

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

ctx impact

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.

ctx context

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

ctx changed

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

ctx diff

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.

ctx mcp

Run the Model Context Protocol server over stdio.

ctx mcp -R /path/to/project

ctx doctor

Inspect the project and report the health of the index.

ctx doctor
ctx doctor --json

ctx skeleton

Show a body-less structural skeleton of a source file.

ctx skeleton src/models.py
ctx skeleton src/models.py --stats

ctx schema

Print the SQLite graph schema.

ctx schema

ctx benchmark

Re-run an index pass and print incremental timing.

ctx benchmark

ctx watch

Watch the project and keep the graph in sync.

ctx watch
Running ctx with no arguments prints a quick overview of the tool.