Skip to main content

Search your Claude Code sessions by content

Project description

ccsearch

ccsearch searches your Claude Code sessions by content — so you can find which of your many long-running chats discussed a ticket, PR, file, or idea, even weeks later and even after the conversation drifted across topics.

Claude Code stores every session as a transcript under ~/.claude/projects/. ccsearch indexes the actual conversation (your messages + the AI's responses, plus each session's title) — never the JSON metadata (uuids, timestamps, token counts, tool input/output) — and gives you a fast fuzzy browser with a live preview and one-key resume.

Quick start

Prerequisites: python3 (3.9+), ripgrep (rg), and fzf (only for the interactive browser — ccsearch <keyword> works without it).

# macOS / Linux — Homebrew pulls in ripgrep + fzf for you
brew install alex-yanchenko/tap/ccsearch

# or, if you use uv / pipx (install ripgrep + fzf separately)
uvx ccsearch            # run without installing
pipx install ccsearch   # install for repeated use

Then run:

ccsearch

The first run builds a small text cache of your sessions (a few seconds); after that it only re-indexes sessions that changed.

Usage

ccsearch                  # interactive browser — type to search, Enter resumes the session
ccsearch <keyword>        # list sessions mentioning <keyword>, ranked
ccsearch --index [N]      # fingerprint the N most-recent sessions (title + tickets touched)

In the browser:

  • type to live-search conversation text; the right pane previews the matched message in full with the surrounding context collapsed.
  • Enter runs claude --resume <id> for the highlighted session.
  • Ctrl-T cycles the search mode; Ctrl-S toggles the sort (date ⇄ matches).
  • Ctrl-D / Ctrl-U (or the mouse) scroll the preview; Esc quits.

The current mode and sort show in the prompt, e.g. anywhere · ⇅date ▸.

Search modes (Ctrl-T)

Multi-word queries are split on spaces; the mode controls how the words must match:

  • anywhere — every word appears somewhere in the session (words may be in different messages).
  • one-msg — every word appears together in a single message. The default.
  • exact — the whole query matches as one literal phrase.

Each mode is a strict subset of the one before it. A single-word query behaves the same in all three.

How it works

Each session is indexed into a small structured cache (~/.cache/ccsearch/<id>.txt, one message per line, plus a parallel .meta with role + timestamp). Both the result ranking and the preview read this cache, so search is fast and accurate even on very large transcripts. The cache excludes tool I/O, metadata, and <channel>/<command> automation lines, so you only ever match real conversation.

The cache stores your conversation text in plaintext under ~/.cache/ccsearch/. It's derived from your existing Claude Code transcripts, makes no network calls, and can be deleted at any time with rm -rf ~/.cache/ccsearch (your transcripts are untouched).

AI thinking text is not searchable — Claude Code persists only a signature for thinking blocks, not the text.

Environment variables

  • CLAUDE_CONFIG_DIR — read sessions from $CLAUDE_CONFIG_DIR/projects if you relocated your Claude config.
  • CC_JIRA_PREFIXES — ticket-key prefixes detected for the --index fingerprint. Default matches any Jira-style key ([A-Z]{2,}-123); set your own to restrict and keep lookalikes out, e.g. export CC_JIRA_PREFIXES="ABC|XYZ".
  • CC_PROJ_STRIP — pipe-separated workspace-dir prefixes trimmed from project labels (default code-|src-|repos-|dev-|projects-). Extend for your own layout.
  • NO_COLOR — disable all color.

Troubleshooting

Symptom Fix
command not found: ccsearch Brew install: run brew link ccsearch. pipx install: confirm ~/.local/bin is on PATH (pipx ensurepath).
No results / browser falls back to a plain list Install ripgrep and fzf.
"No sessions" No Claude Code sessions yet, or config relocated — set CLAUDE_CONFIG_DIR to the dir containing projects/.
Stale or odd results Delete the cache and let it rebuild: rm -rf ~/.cache/ccsearch.
Colors look wrong Run NO_COLOR=1 ccsearch, or use a 256-color terminal.

License

PolyForm Noncommercial 1.0.0 — free for noncommercial use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ccsearch-0.2.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ccsearch-0.2.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file ccsearch-0.2.0.tar.gz.

File metadata

  • Download URL: ccsearch-0.2.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccsearch-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d4ae2222893adc2db226d49d072d952807df16662aa3e81ff5ced53541030615
MD5 ce9fed386152b1b86b8f920c187d85b2
BLAKE2b-256 a9122495b24b8ca5f65416a17af886e72dbff952f4add0ff59f2db7ad50e1a2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccsearch-0.2.0.tar.gz:

Publisher: publish.yml on alex-yanchenko/ccsearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ccsearch-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: ccsearch-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ccsearch-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ab3e5861eb758975e49edda6b4430ef2cb3edd34b784510c9f3e4b60ececf0d
MD5 450a2ccc38088654714aac0ce9a43a16
BLAKE2b-256 efa9b0ecb2423e60935a34203e926f8d507dc9941888fb22d978b7674869e93b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccsearch-0.2.0-py3-none-any.whl:

Publisher: publish.yml on alex-yanchenko/ccsearch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page