ctx: a local search CLI for recovering historical context and decisions from past coding agent sessions

ctx: a local search CLI for recovering historical context and decisions from past coding agent sessions

What it solves

Coding agents often start each session from scratch, losing the context of previous discussions, failed attempts, and technical decisions. ctx provides a way for current and future agents to search and recover this historical context from past sessions across various agent harnesseses.

How it works

ctx is a Rust-based CLI tool that discovers and imports local provider history files from supported agent harnesseses. It normalizes this data into a local SQLite database optimized for retrieval. Agents can then use the CLI to search for specific terms, files, or events using natural language, and retrieve cited matches and snippets from previous sessions.

Who it’s for

Developers using AI coding agents (such as Cursor, Claude Code, Windsurf, and others) who want their agents to have a long-term memory of the project's evolution and avoid repeating mistakes.

Highlights

  • Broad Support: Supports a wide array of agent histories including Cursor, Claude Code, Zed, and GitHub Copilot CLI.
  • Token Efficiency: Structured indexing allows agents to retrieve meaningful history with significantly fewer tokens than raw transcript search.
  • Local and Private: All indexing and search are performed locally on the machine via SQLite, without sending data to cloud services or requiring API keys.
  • Cited Retrieval: Returns ranked matches with IDs that allow agents to recover the exact source context from original transcripts.
  • Extensible: Provides SDKs for multiple languages and support for custom history plugins.

Sources