Skip to main content

Search across Claude Code session history

Project description

search-claude-history

Search across all your Claude Code session history for keywords or patterns.

$ sch "git-log-list"
── 2026-02-17 05:35 | -code-rb | session:720d82ef ──
  [assistant] There it is — 114 commits, numbered and dated. Usage: `./scripts/git-log-list.sh`...

── 2026-02-23 20:15 | -code-scripts | session:379bb145 ──
  [user] do you remember the motivation behind git-log-list.sh? search our session history

2 match(es)

Works out of the box, but fastest with ripgrep installed.

Install

# Run directly (no install needed)
uvx search-claude-history "pattern"

# Or install globally
uv tool install search-claude-history

# With hyperscan for faster searches (matches ripgrep speed)
uv tool install "search-claude-history[hyperscan]"

Requires uv. No system Python needed.

Usage

sch <pattern> [options]
Flag Description
-p, --project Filter to a project (substring match on dir name)
-t, --type Filter by role: user or assistant
-A N Show N messages after each match
-B N Show N messages before each match
-C, --context Chars of text context around match (default 200)
--since TIME Only messages at/after TIME (ISO 8601 or relative: 30m, 2h, 1d, 1w)
--until TIME Only messages at/before TIME (same formats as --since)
--tools Include tool_use/tool_result messages (hidden by default)
--no-color Disable colored output

Examples

sch "database migration"                  # search everything
sch "TypeError" --type assistant          # only assistant messages
sch "deployment" -p myproject             # filter to a project
sch "refactor" -B 1 -A 1                 # show surrounding messages
sch "SELECT.*FROM" --tools               # search tool calls too
sch "deploy" --since 1w                   # only the last week
sch "error" --since 2026-04-01 --until 2026-04-10

Performance

Searches ~/.claude/projects/ using the fastest available engine:

Engine 0.45 GB Requires
ripgrep 0.13s rg on PATH
hyperscan 0.15s install with [hyperscan] extra
stdlib (mmap + multiprocessing) 0.64s nothing

The tool uses whichever engine is available, in the order above.

Respects CLAUDE_CONFIG_DIR if set, otherwise defaults to ~/.claude/.

Claude Code Skill

This tool can also be installed as a Claude Code skill to help Claude automatically search conversation history when you reference past work.

Install as Skill

mkdir -p ~/.claude/skills/search-history
curl -o ~/.claude/skills/search-history/SKILL.md https://raw.githubusercontent.com/wakamex/search-claude-history/main/skill/SKILL.md

Or manually download SKILL.md into ~/.claude/skills/search-history/.

Note: The skill works with or without installing the tool. If sch is not installed, Claude will use uvx search-claude-history (requires uv).

How It Works

Once installed, Claude will automatically use the skill when you:

  • Reference past work ("a few days ago", "last week", "previously")
  • Ask about prior conversations or decisions
  • Want to find when something was discussed
  • Need to recall specific commands or errors from earlier sessions

The skill teaches Claude how to construct effective sch queries with appropriate patterns, context flags, and filtering options.

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

search_claude_history-0.1.3.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

search_claude_history-0.1.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file search_claude_history-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for search_claude_history-0.1.3.tar.gz
Algorithm Hash digest
SHA256 bfea2241c39d30fbd5df5cc396c2642ca6023cb79f6aacb62379d8eb078c8ccb
MD5 3951870932d9a4d1aa4f9422477f044f
BLAKE2b-256 42a38e90f66af8de68b76d945c598a20b9e652c2a5842dcd037e60de0f842296

See more details on using hashes here.

Provenance

The following attestation bundles were made for search_claude_history-0.1.3.tar.gz:

Publisher: publish.yml on wakamex/search-claude-history

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

File details

Details for the file search_claude_history-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for search_claude_history-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 be6e3c1af93954e0c48f50effe5c47c8d97cfb2b2b56782bc2331af9aa230758
MD5 b34bf7e44a40490fdeecad59c09c513e
BLAKE2b-256 5f4270f1ef2487f0508075d7a5260423b3f9e193419f2038ab36777be20a9512

See more details on using hashes here.

Provenance

The following attestation bundles were made for search_claude_history-0.1.3-py3-none-any.whl:

Publisher: publish.yml on wakamex/search-claude-history

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