Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
steipete avatar

Session Logs

  • 3.3k installs
  • 385k repo stars
  • Updated August 3, 2026
  • steipete/clawdis

session-logs is an OpenClaw skill that searches agent session JSONL files with jq and ripgrep to recover prior conversations, costs, and tool usage.

About

session-logs is an OpenClaw agent skill for searching and analyzing complete conversation history stored as session JSONL files using jq and ripgrep. Session logs live under OPENCLAW_STATE_DIR agents agentId sessions with sessions.json mapping chat providers to session ids and per-session jsonl transcript files. Each line records type session or message, ISO timestamps, message roles user assistant or toolResult, message content text thinking or tool calls, and message usage cost totals for billing summaries. Documented queries list sessions by date and size, filter sessions by day, extract user or assistant text, search assistant responses for keywords, sum per-session and daily costs, count messages and roles, rank tool call frequency, and ripgrep across all sessions for phrases. Tips note append-only large files where head and tail help sampling and deleted sessions carry a deleted timestamp suffix. Developers reach for it when users reference parent conversations, prior chat context missing from memory files, or historical cost and tool usage analysis across OpenClaw agent sessions.

  • Locates transcripts under OPENCLAW_STATE_DIR agents agentId sessions with sessions.json index.
  • jq recipes extract user text, assistant replies, per-session costs, and tool call counts.
  • ripgrep searches keywords across all session jsonl files for cross-conversation recall.
  • Documents message.usage.cost.total fields for per-session and daily spend summaries.
  • Requires jq and ripgrep with brew install metadata for OpenClaw environments.

Session Logs by the numbers

  • 3,345 all-time installs (skills.sh)
  • +161 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #61 of 550 CLI & Terminal skills by installs in the Skillselion catalog
  • Security screen: HIGH risk (skills.sh audit)
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
At a glance

session-logs capabilities & compatibility

Capabilities
session index and transcript location · jq message and cost extraction · cross session ripgrep search · tool usage frequency breakdown · daily and per session cost summaries
Use cases
orchestration · debugging
From the docs

What session-logs says it does

Search your complete conversation history stored in session JSONL files.
SKILL.md
Session logs live under the active state directory: `$OPENCLAW_STATE_DIR/agents/<agentId>/sessions/`
SKILL.md
Sessions are append-only JSONL (one JSON object per line)
SKILL.md
npx skills add https://github.com/steipete/clawdis --skill session-logs

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs3.3k
repo stars385k
Security audit2 / 3 scanners passed
Last updatedAugust 3, 2026
Repositorysteipete/clawdis

How do I find what was said in an older OpenClaw conversation or summarize session costs and tool calls?

Search OpenClaw session JSONL transcripts with jq and ripgrep for prior conversations, costs, and tool usage.

Who is it for?

OpenClaw users tracing parent chats, auditing assistant responses, or summarizing token spend across session history.

Skip if: Skip when conversation context already lives in memory files or when jq and ripgrep are unavailable on the host.

When should I use this skill?

User asks about prior chats, parent conversations, session costs, or historical tool usage in OpenClaw logs.

What you get

Targeted jq and ripgrep queries over session JSONL files revealing messages, costs, tool frequency, and cross-session keyword hits.

  • Filtered log excerpts
  • jq query output

By the numbers

  • Requires 2 binaries: jq and ripgrep
  • Includes 2 Homebrew install recipes in manifest

Files

SKILL.mdMarkdownGitHub ↗

session-logs

Search your complete conversation history stored in session JSONL files. Use this when a user references older/parent conversations or asks what was said before.

Trigger

Use this skill when the user asks about prior chats, parent conversations, or historical context that isn't in memory files.

Location

Session logs live under the active state directory: $OPENCLAW_STATE_DIR/agents/<agentId>/sessions/ (default: ~/.openclaw/agents/<agentId>/sessions/). Use the agent=<id> value from the system prompt Runtime line.

  • `sessions.json` - Index mapping session keys to session IDs
  • `<session-id>.jsonl` - Full conversation transcript per session

Structure

Each .jsonl file contains messages with:

  • type: "session" (metadata) or "message"
  • timestamp: ISO timestamp
  • message.role: "user", "assistant", or "toolResult"
  • message.content[]: Text, thinking, or tool calls (filter type=="text" for human-readable content)
  • message.usage.cost.total: Cost per response

Common Queries

List all sessions by date and size

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
for f in "$SESSION_DIR"/*.jsonl; do
  date=$(head -1 "$f" | jq -r '.timestamp' | cut -dT -f1)
  size=$(ls -lh "$f" | awk '{print $5}')
  echo "$date $size $(basename $f)"
done | sort -r

Find sessions from a specific day

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
for f in "$SESSION_DIR"/*.jsonl; do
  head -1 "$f" | jq -r '.timestamp' | grep -q "2026-01-06" && echo "$f"
done

Extract user messages from a session

jq -r 'select(.message.role == "user") | .message.content[]? | select(.type == "text") | .text' <session>.jsonl

Search for keyword in assistant responses

jq -r 'select(.message.role == "assistant") | .message.content[]? | select(.type == "text") | .text' <session>.jsonl | rg -i "keyword"

Get total cost for a session

jq -s '[.[] | .message.usage.cost.total // 0] | add' <session>.jsonl

Daily cost summary

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
for f in "$SESSION_DIR"/*.jsonl; do
  date=$(head -1 "$f" | jq -r '.timestamp' | cut -dT -f1)
  cost=$(jq -s '[.[] | .message.usage.cost.total // 0] | add' "$f")
  echo "$date $cost"
done | awk '{a[$1]+=$2} END {for(d in a) print d, "$"a[d]}' | sort -r

Count messages and tokens in a session

jq -s '{
  messages: length,
  user: [.[] | select(.message.role == "user")] | length,
  assistant: [.[] | select(.message.role == "assistant")] | length,
  first: .[0].timestamp,
  last: .[-1].timestamp
}' <session>.jsonl

Tool usage breakdown

jq -r '.message.content[]? | select(.type == "toolCall") | .name' <session>.jsonl | sort | uniq -c | sort -rn

Search across ALL sessions for a phrase

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
rg -l "phrase" "$SESSION_DIR"/*.jsonl

Tips

  • Sessions are append-only JSONL (one JSON object per line)
  • Large sessions can be several MB - use head/tail for sampling
  • The sessions.json index maps chat providers (discord, whatsapp, etc.) to session IDs
  • Deleted sessions have .deleted.<timestamp> suffix

Fast text-only hint (low noise)

AGENT_ID="<agentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
jq -r 'select(.type=="message") | .message.content[]? | select(.type=="text") | .text' "$SESSION_DIR"/<id>.jsonl | rg 'keyword'

Related skills

Forks & variants (1)

Session Logs has 1 known copy in the catalog totaling 6 installs. They canonicalize to this original listing.

How it compares

Use session-logs over generic grep skills when agent conversation JSON logs need jq structured queries plus ripgrep text search.

FAQ

Where are OpenClaw session logs stored?

Under $OPENCLAW_STATE_DIR/agents/<agentId>/sessions/ with sessions.json indexing provider keys to session ids.

How do I get total cost for one session?

Run jq -s '[.[] | .message.usage.cost.total // 0] | add' on the session jsonl file.

Is Session Logs safe to install?

skills.sh reports 2 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

CLI & Terminalmonitoring

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.