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.1.tar.gz (15.5 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.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ccsearch-0.2.1.tar.gz
  • Upload date:
  • Size: 15.5 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.1.tar.gz
Algorithm Hash digest
SHA256 4124afc3fdc84fd00bf25b64fbb31952b4b135d2ba18f1db48c82cf13848d883
MD5 10b8c0357cbe8a934060e8e60101aabc
BLAKE2b-256 fa590380a75109e32ccdd535d71d0a4468f39c856bff52422bff8fe23908d6c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccsearch-0.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: ccsearch-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd9f6bfdab20874ce1ae2f205bd086896e913affad69df9cd0595d6868f63b79
MD5 365920536c48caa5d7f296bea7057f33
BLAKE2b-256 090db04eb0a2df03134619ef607d5c956dede1ff366464ad0212b028ef0a368a

See more details on using hashes here.

Provenance

The following attestation bundles were made for ccsearch-0.2.1-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