ctx is an open-source CLI for fast local search across your past coding agent sessions. You can search messages and tool calls across agents and sessions, then jump straight to the exact event or full transcript for any result.
ctx pro is a paid add-on for “git blame, but for agent sessions.” Take any line, file, commit, or PR and surface the original transcript of the agent session that produced it. Your agents can use that transcript to recover why the code was written that way, including the decisions, assumptions, and tool calls from the original session.
Coding agents have git history, but their own session transcripts and tool call records remain sequestered away in verbose log files. Those log files are a treasure trove of useful data, but they aren't accessible in a legible format for agents.
If you give your agents fast, easy access to search and retrieve these transcripts, your agents can:
- surface decisions, constraints, and assumptions from earlier work
- find investigations, solutions, and failed approaches already explored in previous sessions
- audit previous sessions in detail
- pick up where previous work left off, even across multiple threads
That means less repeated agent work, lower token spend, and better task outcomes because each new session can use the history already on your machine.
ctx also understands how parent sessions, subagents, and forks relate to one another, so agents can recover the whole chain of work no matter how aggressively you orchestrate.
This is different from “agent memory,” which usually compacts what happened into facts or summaries that can become stale. ctx gives agents instant recall of the real record without a lossy memory step.
Install and set up ctx
macOS and Linux:
curl -fsSL https://ctx.rs/install | shWindows PowerShell:
irm https://ctx.rs/install.ps1 | iexor prompt your agent:
Please install and set up ctx CLI (see github.com/ctxrs/ctx)50x more token-efficient than raw transcript search
By structuring agent history into sessions, events, metadata, and indexed fields, then returning ranked cited matches, agents can access meaningful history with far fewer tokens than raw search. Results vary by query and corpus, but raw search is often so token-heavy that it can be effectively the same as not having usable history.
ctx pro: git blame, but for agent sessions
git blame tells you which commit last changed a line. ctx blame tells you which agent session produced that commit, with exact citations back to the original transcript and recorded tool calls.
Agents use ctx blame to recover context that no longer exists anywhere near the current session. Starting from a file, line range, commit, or PR, they can find the relevant historical agent sessions and recover the decisions, constraints, failed approaches, and assumptions recorded there.
This helps agents:
- recover constraints and decisions no longer visible in the code
- uncover assumptions embedded in earlier changes
- avoid retrying approaches that already failed
- resume work without relying on lossy compaction summaries
- audit past agent work to improve instructions, tools, and workflows
Every attribution includes citations back to the original transcript and tool calls. If the session is not on your machine (for example, because a teammate’s agent produced the code), ctx says it cannot prove the attribution.
# Your agent is investigating why customized cart items
# are disappearing from your e-commerce app.
$ ctx blame file src/checkout.ts --lines 118:146
# ctx blame finds the agent session that produced those lines:
# Lines 118–146
# commit 8f3c2a1
# Produced by
# session c0297b8a-2ad7-4f73-a826-8ee9387cd1f4
# evidence [1] [2]
# Your agent opens the transcript of the session that produced the offending commit
$ ctx show session c0297b8a-2ad7-4f73-a826-8ee9387cd1f4
# Previous agent — transcript excerpt
"Some responses contain multiple cart lines with the same product_id.
I'm treating those as duplicates and merging them before calculating the total."
# Your agent finds the mistake
"FOUND IT: The previous agent treated matching product_ids as duplicate cart lines.
Customized items can share a product ID, so that merge drops valid items."ctx blame can also start from a commit or PR:
ctx blame commit <sha>
ctx blame pr https://github.com/your-org/your-repo/pull/42Like ctx indexing and search capabilities, blame runs locally, so your code and history never leave your machine.
ctx pro is $20 USD per month, but you can try it for free for two weeks with no account or credit card required.
New to ctx? Install ctx. Eligible fresh interactive installs start the free ctx pro trial automatically.
Already use ctx? Set up pro:
ctx proLearn more about ctx pro, including supported inputs, local privacy, pricing, and the free trial.
How it works
Your past coding agent sessions already live on your machine, usually in JSONL files or SQLite databases under directories such as ~/.claude and ~/.codex.
ctx setup discovers those sources and reads them without modifying them. It converts each provider's format into consistent local records for sessions, messages, tool calls, relationships, and repository activity, then stores and indexes those records locally.
ctx does not require hooks or any code running inside the agent process. After setup, a local background daemon watches the history sources your agents already write and keeps the index current as they change. Each update is completed before it becomes visible, so commands never read a partially built index.
Every session and event receives a stable ctx ID and retains its complete transcript content and source information. ctx search finds the relevant history, ctx show retrieves the exact event or full transcript, and ctx locate identifies where it came from. Semantic search and ctx pro use those same records.
# Index all of your existing local agent sessions
ctx setup
# Your agent can search prior work with normal language
ctx search "failed migration"
# Search sessions and events that touched a file
ctx search --file crates/foo/src/lib.rs
# Or search multiple terms
ctx search --term "failed migration" --term rollback --term "cursor rename"
# Results include matching sessions, snippets, and ctx IDs
# evt_01h... ses_01h... codex "migration expected the old cursor name" ...
# Print the matching part of the old transcript
ctx show event <ctx-event-id> --window 3
# Or print a compact transcript of the original session
ctx show session <ctx-session-id>ctx does not send your prompts, transcripts, or indexed history to a cloud service, call model APIs, require API keys, or write into your source repositories. Transcript text is preserved rather than automatically redacted, so review copied output before sharing it outside your machine.
For the full pipeline, see How ctx works. For a quick first run, see Quickstart.
Why is ctx so fast?
ctx is written in Rust, but that's not the main reason why it's fast. Instead of ingesting your history into a local relational database like SQLite, ctx scans it with parallel workers and writes searchable records directly to Tantivy. That removes an entire database ingest step while still supporting structured filtering and complete record retrieval.
Tantivy builds the index in parallel. It creates a compact map from each term to the records containing it, searches memory-mapped segments without loading your entire history into memory, and ranks the results with BM25. The same index stores the complete record for every result, so ctx search, ctx show, and ctx locate can read it without a second database or reopening and reparsing the original agent logs.
In our benchmark, this was 16x faster than ctx's previous optimized SQLite implementation.
Semantic search takes a similarly direct approach. ctx embeds your history locally with multilingual-e5-small and stores the vectors in memory-mapped flat-F32 segments. At the scale of personal agent history, scanning those vectors exactly is fast, so there is no vector database or approximate HNSW graph to build, tune, or maintain.
How ctx differs from agent memory and codebase intelligence
| Category | Starts from | Answers |
|---|---|---|
| Agent memory (Mem0, Zep) | Extracted facts, summaries, conversation-derived memories, or graph nodes | “What should the agent remember?” |
| Codebase intelligence (Graphify, Sourcegraph) | The current repository's code, symbols, documents, and relationships | “What is in this codebase, and how does it fit together?” |
| Coding-agent history and provenance (ctx) | Original sessions, messages, tool calls, and local Git history | “What actually happened, and which session produced this code?” |
ctx gives coding agents exact recall of prior work. They can search the original history, retrieve the cited transcript or tool call, and use ctx pro to map a line, file, commit, or PR back to the session that produced it.
An agent might use all three in one investigation: memory for a durable rule, codebase intelligence to find the relevant subsystem, and ctx to recover the historical work that explains the change.
Read more about agent memory, codebase graphs, and grep or log search.
Supported agent histories
| Agent harness | Support |
|---|---|
| Claude Code | Supported |
| Codex | Supported |
| Grok Build | Supported |
| DeepSeek Harness | Supported |
| Cursor | Supported |
| Pi | Supported |
| GitHub Copilot CLI | Supported |
| OpenCode | Supported |
| Gemini CLI / Antigravity | Supported |
| Factory AI Droid | Supported |
| OpenClaw | Supported |
| Hermes Agent | Supported |
| AstrBot | Supported |
| NanoClaw | Supported |
| Shelley | Supported |
| Auggie / Augment | Supported |
| Cline / Roo Code | Supported |
| CodeBuddy | Supported |
| Continue | Supported |
| Crush | Supported |
| Deep Agents | Supported |
| Firebender | Supported |
| ForgeCode | Supported |
| Goose | Supported |
| Junie | Supported |
| Kilo Code | Supported |
| Kimi Code CLI | Supported |
| Kiro CLI | Supported |
| Lingma | Supported |
| MiMo Code | Supported |
| Mistral Vibe | Supported |
| Mux | Supported |
| OpenHands | Supported |
| Qoder | Supported |
| Qwen Code | Supported |
| Rovo Dev | Supported |
| Tabnine CLI | Supported |
| Trae / Trae CN | Supported |
| Warp | Supported |
| Windsurf | Supported |
| Zed | Supported |
Refer a dev to ctx pro and we'll buy you $120 in LLM tokens
Coding agents aren't cheap. For each developer you refer who becomes a ctx pro subscriber, you earn $10 cash per month for each of their first 12 paid months.
Two active referrals earn you $20 per month; ten earn you $100 per month.
The dev you refer gets a 30-day pro trial instead of the standard 14 days.
# Claim your referral codename
ctx referral create <codename>
# Share this command with another developer
ctx pro --referral <codename>See referral details for eligibility, payouts, and terms.
Explore the docs
Install ctx, initialize local storage, and index discovered local history.
Search local history, inspect an event, open the session, and use JSON output.
Use git blame for agent sessions, start the free trial, and review pricing and local privacy.
Review referral eligibility, commissions, payouts, and terms.
Install the agent-history search skill with the open skills installer.
Understand discovery, import, local search storage, search refresh, and cited retrieval.
See which agent histories ctx can discover, import, and search today.
Review setup, status, sources, import, show, locate, search, MCP, and doctor.