ccql
Claude Code Query Language - SQL query engine for Claude Code and Codex CLI data.
Installation
Homebrew (macOS/Linux)
Shell script (macOS/Linux)
|
PowerShell (Windows)
powershell -ExecutionPolicy ByPass -c "irm https://github.com/douglance/ccql/releases/latest/download/ccql-installer.ps1 | iex"
npm
Cargo
From source
Quick Start
# SQL is the default command - just pass a query
# Get help
Tables
| Table | Source | Description |
|---|---|---|
history |
history.jsonl |
User prompts |
jhistory |
~/.codex/history.jsonl |
Codex CLI prompt history (virtual) |
codex_history |
Alias of jhistory |
Codex CLI prompt history (virtual) |
transcripts |
transcripts/*.jsonl |
Conversation logs (virtual) |
todos |
todos/*.json |
Task items (virtual) |
history
| Column | Type | Description |
|---|---|---|
display |
TEXT | The prompt text |
timestamp |
INTEGER | Unix timestamp (ms) |
project |
TEXT | Project directory |
pastedContents |
OBJECT | Pasted content (JSON) |
jhistory
| Column | Type | Description |
|---|---|---|
session_id |
TEXT | Codex session ID |
ts |
INTEGER | Raw Unix timestamp (seconds) |
text |
TEXT | Raw prompt text |
display |
TEXT | Prompt text (normalized alias for text) |
timestamp |
INTEGER | Unix timestamp (milliseconds) |
codex_history exposes the exact same columns as jhistory.
transcripts
| Column | Type | Description |
|---|---|---|
_source_file |
TEXT | Source file (ses_xxx.jsonl) |
_session_id |
TEXT | Session ID |
type |
TEXT | user | tool_use | tool_result |
timestamp |
TEXT | ISO 8601 timestamp |
content |
TEXT | Message text (type='user') |
tool_name |
TEXT | Tool name (type='tool_*') |
tool_input |
OBJECT | Tool parameters |
tool_output |
OBJECT | Tool response (type='tool_result') |
todos
| Column | Type | Description |
|---|---|---|
_source_file |
TEXT | Source filename |
_workspace_id |
TEXT | Workspace ID |
_agent_id |
TEXT | Agent ID |
content |
TEXT | Todo description |
status |
TEXT | pending | in_progress | completed |
activeForm |
TEXT | Display text when active |
Examples
Filter by Current Project
Use the project column to limit queries to the folder you're working in:
# Only prompts from current project
# Transcripts from current project (via session join)
History Queries
# Recent prompts
# Search prompts
# Prompts by project
# Long prompts (likely pasted code)
# Recent Codex prompts
Transcript Queries
# Tool usage stats
# Most active sessions
# Find sessions mentioning a topic
Todo Queries
# Pending todos
# Todo counts by status
Output Formats
Write Operations
Write operations require explicit flags for safety:
# Preview changes (dry run)
# Execute with backup
Other Commands
Configuration
# Set data directory
# Or via flag
License
MIT