Skip to content

CLI Overview ​

ctxo is both a Model Context Protocol (MCP) server and a CLI. Running ctxo with no arguments starts the stdio MCP server; any other argument dispatches to a subcommand.

Calling ctxo ​

@ctxo/cli ships as a scoped npm package; the binary name inside the package is ctxo. Three equivalent invocation forms:

FormWhen to use
ctxo <subcommand> (Recommended)After npm install -g @ctxo/cli. Works from any directory
pnpm ctxo <subcommand> / npx ctxo <subcommand>When @ctxo/cli is in the project's devDependencies (for example after ctxo init). Resolves via node_modules/.bin/ctxo
npx -y @ctxo/cli <subcommand>Ad-hoc / CI / one-off, no install needed

All three forms run the same binary. State always lives in <project>/.ctxo/ regardless of how ctxo is invoked - there is no user-level or system-level config.

Examples below assume ctxo is on your PATH from a global install (or a local node_modules/.bin/ctxo).

Command summary ​

CommandPurpose
ctxo installInstall language plugins (auto-detects if omitted)
ctxo updateCheck the npm registry for newer ctxo releases and apply them
ctxo initInteractive setup: AI tool rules, git hooks, plugin install
ctxo indexBuild the codebase index (symbols, edges, history)
ctxo watchFile watcher for incremental re-indexing
ctxo syncRebuild the SQLite cache from committed JSON
ctxo statusShow index manifest, symbol counts, per-file freshness
ctxo doctorHealth check every subsystem (with optional --fix)
ctxo visualizeGenerate an interactive dependency graph HTML
ctxo blast-radiusBlast radius for one symbol, JSON to stdout
ctxo gate --previewPreview which symbols the safe-edit guard would block
ctxo verify-indexCI gate: fail if index drifts from source
ctxo statsShow MCP usage statistics (--json, --days N, --clear)
ctxo versionVerbose version report (--json, --short)
ctxo --helpPrint compact help

Global flags ​

FlagMeaning
--version, -v, -VPrint core version. Combine with --verbose or --json
--help, -hPrint the bundled help block

Debug output

Every subcommand honors DEBUG=ctxo:*. Narrow the namespace (for example DEBUG=ctxo:git,ctxo:storage) when you only want to see one subsystem.

Exit codes ​

Most commands exit 0 on success and 1 on failure. Two commands have richer semantics:

CommandExitMeaning
ctxo index --check0Index up to date
ctxo index --check1Stale or missing files - run ctxo index
ctxo doctor0All checks passed
ctxo doctor1One or more checks failed
ctxo doctor --fix2Remediation halted before completing

Released under the MIT License.