session-logs

Search and analyze JSONL session logs of past conversations using jq and ripgrep.

Updated Mar 30, 2026
One-click install
npx skills add https://github.com/srgaba/open-claw --skill session-logs-srgaba
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: session-logs
Source: https://github.com/srgaba/open-claw/tree/main/project/skills/session-logs
Command: npx skills add https://github.com/srgaba/open-claw --skill session-logs-srgaba

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, ripgrep.

What problem does it solve? When a user references older or parent conversations that are no longer in context, there is no built-in way to recall what was said. This Skill provides ready-to-use jq and ripgrep commands to search, filter, and analyze complete conversation history stored in session JSONL files. ## Core Features & Use Cases - Session Discovery: List all sessions by date and size, find sessions from a specific day, and map chat providers to session IDs via sessions.json. - Content Search: Extract user or assistant messages from a session and search for keywords across one or all session transcripts. - Usage Analytics: Compute per-session and daily cost totals, message counts, token statistics, and tool usage breakdowns. - Use Case: A user asks "what did we decide about the database migration last week?" You locate the relevant session file by date, extract the text messages, and search for the migration discussion. ## Quick Start Search my past session logs for any conversation where we discussed the database migration plan.

Frequently Asked Questions about session-logs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search past conversation history stored in JSONL files?

Use ripgrep to search across all session files with rg -l "phrase" on the sessions directory, then use jq to extract readable text from matching files. Filter for message entries with type "text" to get human-readable content only.

How to extract only user messages from a session transcript with jq?

Run jq with a filter selecting entries where message.role equals "user", then iterate over message.content items where type is "text" and print the text field. This skips tool calls and thinking blocks.

How do I calculate total API cost from session logs?

Use jq -s to slurp the JSONL file and sum the message.usage.cost.total field across all entries, defaulting missing values to zero. Loop over session files and aggregate by date for a daily cost summary.

What tools are required to analyze JSONL session logs?

You need jq for parsing and filtering JSON lines and ripgrep (rg) for fast keyword search across files. Both can be installed via Homebrew with brew install jq and brew install ripgrep.

Why does my jq query return no output on a session file?

Session files contain mixed entry types, including session metadata and tool results, so filters must match message entries with the right role and content type. Also check that the file is not a deleted session with a .deleted timestamp suffix.