Search and analyze your OpenClaw conversation history across session JSONL files using jq and ripgrep.
npx clawhub@latest install session-logsRequirements
The session-logs skill gives your AI agent the ability to search, filter, and analyze its own historical conversation logs stored as JSONL files in ~/.openclaw/agents/<agentId>/sessions/. When a user references something said in a prior chat or asks about past context that isn't in memory files, this skill provides the queries needed to retrieve it. It leverages jq for structured JSON processing and rg (ripgrep) for fast full-text search across potentially large session archives.
npx clawhub@latest install session-logsClick the Install button at the top of this page for one-click setup
sessions.json index.~/.openclaw/agents/ session storage does not exist or is not accessible.Use rg (ripgrep) to search every session JSONL file for a phrase or keyword in a single command. Quickly locate which sessions contain relevant content without reading each file manually.
Extract user messages, assistant responses, tool calls, or thinking blocks independently using jq selectors on the .message.role and .message.content[].type fields. Filters out noise like tool results automatically.
Aggregate message.usage.cost.total across a session or across all sessions by day to produce cost summaries. Also supports counting messages, calculating session duration, and breaking down tool usage by frequency.
List all sessions sorted by date and file size, find sessions from a specific day, or consult sessions.json to map chat providers (Discord, WhatsApp, etc.) to session IDs.
Sessions are append-only JSONL files that can grow to several MB. The skill's query patterns include head/tail sampling tips and streaming jq usage to avoid loading entire files into memory unnecessarily.
When a user says "remember when we discussed X last month?", the agent uses this skill to search session files by date or keyword and surface the relevant exchange, even if it's no longer in the active context window.
A developer wants to understand how much each conversation is costing. This skill aggregates cost.total per session and groups results by day, producing a readable cost breakdown across the entire agent history.
An operator wants to know which tools the agent calls most frequently. This skill extracts toolCall entries from session logs, counts them, and ranks them — useful for debugging or optimizing agent behavior.
A user asks whether a particular topic (e.g. a project name, a decision) was ever discussed. The agent runs a ripgrep search across all JSONL files and returns matching session paths for follow-up exploration.
npx clawhub@latest install session-logsRequirements
Log in to write a review
No reviews yet. Be the first to share your experience!