claude-scripts
CLI to search Claude Code conversation history by tool, pattern, or time, and export results.
When & Why to Use This Skill
claude-scripts is a powerful CLI utility designed to search, filter, and export Claude Code conversation history stored locally. It provides developers and teams with deep visibility into agent interactions, allowing for precise auditing of tool usage, thinking processes, and command execution through advanced pattern matching and time-based queries.
Use Cases
- Security Auditing: Search for specific Bash or MCP tool commands executed by the agent to ensure compliance and security within local environments.
- Debugging Agent Logic: Filter by 'thinking' blocks and specific patterns to analyze the agent's reasoning process and troubleshoot unexpected behaviors.
- Project History Retrieval: Quickly locate specific code changes, deployment commands, or architectural discussions across multiple projects using time-range filters.
- Data Export for Analysis: Export conversation logs into JSON or JSONL formats to integrate with external reporting tools or for fine-tuning custom models.
- Workflow Optimization: Use the --summary flag to identify frequently used tools and patterns, helping to optimize agent prompts and tool configurations.
| name | claude-scripts |
|---|---|
| description | CLI to search Claude Code conversation history by tool, pattern, or time, and export results. |
claude-scripts
Search conversation history stored in ~/.claude/projects/.
Quick Start
claude-scripts search --tool Bash
claude-scripts search --type thinking --pattern "architecture"
claude-scripts search --tool "mcp__*" --summary
claude-scripts search --pattern "deploy" --format json
Key Flags
--type/-t:thinking,text,tool_use,tool_result--tool/-T: filter tool names; supports wildcards ("mcp__*")--pattern/-P: substring; add--regexor--case-sensitive--after/--before: time range (YYYY-MM-DDor ISO datetime)--format/-F:text(default),table,json,jsonl--short-path: abbreviate file paths (full paths shown by default)-C/--context N: N entries before/after each match (text format only)--summary: show match counts per conversation instead of individual results
Common Workflows
# Yesterday's tool usage
claude-scripts search --type tool_use --after "2025-12-10" --format table
# All git Bash commands
claude-scripts search --tool Bash --pattern "git "
# Export one project to JSON
claude-scripts search --project myproject --format json > conv.json
# Search specific conversation file
claude-scripts search --file ~/.claude/projects/-Users-me-project/session.jsonl --tool Read
# Audit MCP tool usage
claude-scripts search --tool "mcp__*" --summary