Install and index local history

Install ctx, create local storage, discover sources, import history, and run a first search.

Install and index local history

Install the CLI

curl -fsSL https://ctx.rs/install | sh

The canonical installer for the standalone search CLI is https://ctx.rs/install. It installs the binary and runs ctx setup by default so discovered local history is indexed before the installer exits. Use sh -s -- --no-setup for install-only CI or packaging flows.

The installer downloads release metadata and the ctx binary. Setup and search do not send transcript text, prompts, or indexed search content to a model API.

When working from source:

cargo build -p ctx
cargo install --path crates/ctx-cli

Create local storage

ctx setup
ctx status

Setup creates the configured ctx data root, initializes SQLite, writes config.toml when missing, discovers known provider history paths, catalogs Codex sessions, imports discovered sources, optimizes the local search index, and prints next steps. The default data root is ~/.ctx.

Use a different root for tests:

ctx --data-root /tmp/ctx-demo setup
CTX_DATA_ROOT=/tmp/ctx-demo ctx status

Setup is local with respect to provider history and storage. It does not write to source repositories, call model APIs, require API keys, or start a background process.

CLI analytics

The CLI has default-on product analytics for command invocation metadata; set CTX_ANALYTICS_OFF=1 or CTX_DISABLE_ANALYTICS=1 before install or setup to disable it.

Set up your agent

After the CLI is installed, teach your agent to use it:

ctx sources
ctx import --all
ctx search "failed migration"
ctx show session <ctx-session-id>
ctx show event <ctx-event-id> --window 3

Use JSON output for agent workflows:

ctx sources --json
ctx import --resume --json
ctx search "sqlite migration failed" --repo ctx --json
ctx show session <ctx-session-id> --format json
ctx show event <ctx-event-id> --format json