npx skills add ...
npx skills add bitwarden/ai-plugins --skill extracting-session-data
Locates, lists, filters, and extracts structured data from Claude Code native session logs. Supports both single and multiple session analysis.
npx skills add bitwarden/ai-plugins --skill extracting-session-data
Provide raw access to Claude Code session logs stored in ~/.claude/projects/{project-dir}/{session-id}.jsonl.
Key Principle: This skill extracts data only - return raw data to calling skills for analysis. Do not analyze or interpret within this skill.
All scripts located in scripts/ subdirectory relative to this skill.
Find log directory or specific session file path.
Use when: Building dynamic paths, verifying logs exist before processing.
Enumerate all sessions with metadata (ID, size, lines, date, branch).
Output formats: table, json, csv
Sort options: date, size, lines
Use when: Starting retrospective, showing available sessions to user, checking for recent sessions.
Parse JSONL logs and extract specific data types.
Available extraction types:
metadata - Session info (ID, timestamps, branch, working dir)user-prompts - All user messagestool-usage - Tool call statisticserrors - Failed tool calls with timestampsthinking - Thinking blocks (if extended thinking enabled)text-responses - Assistant text responses onlystatistics - Session metrics (message counts, tool calls, errors)all - Combined extractionUse when: Need specific data without loading entire log, generating metrics, identifying errors.
Find sessions matching criteria.
Filter options:
--since DATE - Sessions modified since date ("2 days ago", "2025-10-20")--until DATE - Sessions modified until date--branch NAME - Sessions on specific git branch--min-size SIZE - Minimum file size ("1M", "500K")--max-size SIZE - Maximum file size--min-lines N - Minimum line count--max-lines N - Maximum line count--has-errors - Only sessions with failed tool calls--keyword WORD - Sessions containing keywordOutput formats: list, paths, json
Use when: User requests analysis of recent sessions, finding sessions for specific feature/branch, identifying problematic sessions.
When another skill (like retrospecting) needs session data:
list-sessions.sh or filter-sessions.sh to find relevant sessionsextract-data.sh --type statistics to determine session complexityextract-data.sh with specific types for needed dataExample:
CRITICAL: This skill is designed for context efficiency
Never load full session logs into context without checking size first.
This skill should:
Return raw extracted data with minimal formatting:
No analysis, no interpretation - just data extraction.
All scripts exit with non-zero status on errors and output to stderr.
Check exit status before processing:
Common error messages:
Error: Logs directory not found: ~/.claude/projects/-pathError: Session file not found: ~/.claude/projects/-path/session-id.jsonlError: --type is requiredError: jq is required but not installed. Install with: brew install jqClaude Code stores sessions using this pattern:
Where {project-identifier} is calculated by replacing all / with - in the absolute working directory path:
All scripts use locate-logs.sh internally for consistent path calculation.
Don't:
extract-data.shlocate-logs.shDo:
--type statistics before processingEffective use of this skill means:
Required:
bash (v4.0+)jq (JSON parser)Scripts check for jq and provide installation instructions if missing: