search-past-chats
1
总安装量
1
周安装量
#53030
全站排名
安装命令
npx skills add https://github.com/mlshv/cc-history-search --skill search-past-chats
Agent 安装分布
claude-code
1
Skill 文档
Search Past Chats Skill
Search through past Claude Code sessions for this project using keyword or regex patterns, and retrieve full context from specific sessions.
When to Use This Skill
Activate when the user:
- Asks about previous conversations or sessions
- Wants to find something discussed before
- References past work without specifics (“that thing we did”)
- Asks “did we talk about X before?” or “what was that about Y?”
- Mentions searching chat history or past chats
- Asks for more context from a session found in search results
- Wants to see the full conversation around a specific topic
Tool 1: Search Sessions
Find sessions matching a keyword or pattern.
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" "<query>" [options]
Search Options
| Option | Description | Example |
|---|---|---|
--regex |
Use regex pattern | --regex "error.*handler" |
--limit N |
Max results (default: 10) | --limit 5 |
--after YYYY-MM-DD |
Sessions after date | --after 2026-01-01 |
--before YYYY-MM-DD |
Sessions before date | --before 2026-01-15 |
--include-assistant |
Search Claude’s responses too | --include-assistant |
--context N |
Show N messages around match | --context 2 |
Search Examples
# Basic search
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" "authentication"
# Search with date filter
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" --after 2026-01-01 "mcp"
# Search including Claude's responses
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" --include-assistant "error handling"
# Show context around matches
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" --context 2 "database schema"
# Regex search
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" --regex "api.*token"
Search Output
Returns matching sessions with:
- Session date and title
- Session ID (use with get-session for more context)
- Matching excerpts (marked [A] for assistant responses)
- Match count
Tool 2: Get Session Context
Retrieve full messages from a specific session by ID.
node "${CLAUDE_PLUGIN_ROOT}/scripts/get-session.js" <session-id> [options]
Get-Session Options
| Option | Description | Default |
|---|---|---|
--around "text" |
Center on message containing text | – |
--context N |
Messages before/after with –around | 10 |
--offset N |
Start from message N | 0 |
--limit N |
Max messages to return | 20 |
Get-Session Examples
# Get first 20 messages from session
node "${CLAUDE_PLUGIN_ROOT}/scripts/get-session.js" abc123-def456
# Get context around specific content
node "${CLAUDE_PLUGIN_ROOT}/scripts/get-session.js" abc123 --around "authentication" --context 5
# Paginate through session
node "${CLAUDE_PLUGIN_ROOT}/scripts/get-session.js" abc123 --offset 20 --limit 20
Workflow
- Search first: Use search-history.js to find relevant sessions
- Note the session ID: Search results include session IDs
- Get more context: Use get-session.js with the ID to see full conversation
Example:
# 1. Search finds session "abc123..." discussing authentication
node "${CLAUDE_PLUGIN_ROOT}/scripts/search-history.js" "authentication"
# 2. Get full context from that session
node "${CLAUDE_PLUGIN_ROOT}/scripts/get-session.js" abc123 --around "authentication" --context 10
Best Practices
- Start with broad keywords, then narrow down
- Use
--include-assistantwhen you need Claude’s explanations too - Use
--contextto see conversation flow around matches - Use get-session with
--aroundto jump directly to relevant content - Present findings concisely – offer to show more if needed