Back to Skills

session-logs

Search and analyze your own session logs (older/parent conversations) using jq.

377,930stars79,036forksUpdated 6/10/2026

Security Assessment

Safe(100/100)
Security Score100/100

About session-logs

The session-logs skill enables users to search, extract, and analyze their complete conversation history stored in JSONL session files. It addresses the challenge of recalling past interactions that are not currently in memory by providing tools to inspect older or parent conversations. By leveraging command-line utilities like jq and ripgrep, users can efficiently parse and query structured session data, including user messages, assistant responses, and associated metadata, ensuring historical context is accessible on demand.

Key features of this skill include listing sessions by date and file size, filtering sessions from specific dates, extracting user messages, searching assistant responses for keywords, and calculating usage costs per session or per day. It also supports detailed message and token counts, tool usage breakdowns, and cross-session phrase searches. The skill relies on the append-only JSONL format of session files and a sessions.json index for mapping session keys to identifiers, providing both fine-grained and aggregated insights.

This skill is ideal for developers, AI trainers, and users who need to audit, review, or analyze historical chat interactions. It is especially useful for identifying trends, monitoring costs, debugging, or retrieving context from prior conversations. By combining structured queries with command-line processing, session-logs offers a robust framework for managing and interrogating conversational histories in a reproducible and programmatic way.

FAQ

How do I list all session files by date and size?

You can iterate over the session JSONL files in your agent's session directory and use jq to extract timestamps along with standard shell commands to get file sizes. Sorting the output will give a chronological list.

Which command-line tools are required to use this skill?

This skill requires 'jq' for parsing JSON and 'ripgrep' (rg) for searching text patterns within session files. Both can be installed via Homebrew if not already available.

Can I search for a specific keyword across all sessions?

Yes, by using ripgrep on the session JSONL files, you can locate all sessions containing a specific phrase. The skill provides example commands for performing such searches efficiently.

Are there any limitations regarding large session files?

Since session files can grow to several megabytes, it is recommended to use tools like head or tail for sampling and jq with selective filtering to avoid performance issues.

Where are session logs stored?

Session logs are stored under the active state directory: '$OPENCLAW_STATE_DIR/agents/<agentId>/sessions/' by default, which typically resolves to '~/.openclaw/agents/<agentId>/sessions/'.

Install session-logs

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill