cc-query
v0.4.2
Published
SQL REPL for querying Claude Code session data
Readme
cc-query
SQL REPL for querying Claude Code session data using DuckDB.
Installation
As a Claude Code Plugin
Add the marketplace:
/plugin marketplace add dannycoates/cc-queryInstall the plugin:
/plugin install cc-query@dannycoates-cc-query
The plugin automatically runs npm install on first session start.
Manual Installation
For use outside of Claude Code
npm install -g cc-queryRequires Node.js 24+.
Usage
# Query all projects
cc-query
# Query a specific project
cc-query ~/code/my-project
# Filter by session ID prefix
cc-query -s abc123 .
# Pipe queries (like psql)
echo "SELECT count(*) FROM messages;" | cc-query .Available Views
messages- All messages with parsed fieldsuser_messages- User messages onlyassistant_messages- Assistant responses onlyhuman_messages- Human-typed messages (no tool results)tool_uses- Tool invocations from assistant messagestool_results- Tool results with duration and error statustoken_usage- Token consumption per messagebash_commands- Bash command detailsfile_operations- File read/write/edit operationsraw_messages- Unparsed JSONL data
REPL Commands
.help- Show tables and example queries.schema- Show table schema.quit- Exit
Skills
The plugin includes two skills for session analysis:
/reflect
Query and analyze Claude Code session history. Use for:
- Token usage analysis
- Tool patterns across projects
- Finding user corrections/preferences
- Weekly summaries
See skills/reflect/SKILL.md for query reference.
/handoff
Create detailed handoff documents for work continuation. Produces:
- Task status and progress
- Files modified with change summaries
- Key conversation flow
- Actionable next steps
See skills/handoff/SKILL.md for output format.
Example Questions
- Across all projects what bash commands return the most errors?
- Let's analyze the last session and identify how we might improve the CLAUDE.md file
- Give me a summary of what we worked on this past week
- Create a handoff document for this session
License
MIT
