Search Claude history
search_historyFull-text search across local Claude Code and Cowork conversation history. Returns matching message snippets with session IDs for full context retrieval.
Instructions
Full-text search across local Claude Code and Claude Cowork conversation history stored on this machine. Returns matching message snippets with session IDs (use get_session to read the full conversation). Searches newest sessions first — good for questions like "what did I work on today" or "when did I last touch X".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | Only match messages from this role | any |
| after | No | Only sessions active after this ISO date (e.g. "2026-06-01") | |
| limit | No | Max total matches to return | |
| query | Yes | Text to search for (case-insensitive substring, or a regex when regex=true) | |
| regex | No | Treat query as a JavaScript regular expression | |
| before | No | Only messages before this ISO date | |
| source | No | History source: "code" = Claude Code (~/.claude/projects), "cowork" = Claude Cowork local desktop sessions, "all" = both | all |
| project | No | Case-insensitive substring filter on project path/name or session title | |
| maxPerSession | No | Max matches returned per session |