← Back to Skills Marketplace
1yihui

Dalong Session Logs

by 辉哥 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
45
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install dalong-session-logs
Description
Search and analyze your own session logs (older/parent conversations) using jq.
README (SKILL.md)

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/\x3CagentId>/sessions/ (default: ~/.openclaw/agents/\x3CagentId>/sessions/). Use the agent=\x3Cid> value from the system prompt Runtime line.

  • sessions.json - Index mapping session keys to session IDs
  • \x3Csession-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="\x3CagentId>"
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="\x3CagentId>"
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' \x3Csession>.jsonl

Search for keyword in assistant responses

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

Get total cost for a session

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

Daily cost summary

AGENT_ID="\x3CagentId>"
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
}' \x3Csession>.jsonl

Tool usage breakdown

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

Search across ALL sessions for a phrase

AGENT_ID="\x3CagentId>"
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.\x3Ctimestamp> suffix

Fast text-only hint (low noise)

AGENT_ID="\x3CagentId>"
SESSION_DIR="${OPENCLAW_STATE_DIR:-$HOME/.openclaw}/agents/$AGENT_ID/sessions"
jq -r 'select(.type=="message") | .message.content[]? | select(.type=="text") | .text' "$SESSION_DIR"/\x3Cid>.jsonl | rg 'keyword'
Usage Guidance
This skill appears benign and purpose-aligned. Before installing, make sure you are comfortable allowing the agent to search your local OpenClaw conversation logs, and prefer specific requests such as a date, session ID, or keyword to avoid unnecessarily broad history review.
Capability Analysis
Type: OpenClaw Skill Name: dalong-session-logs Version: 1.0.0 The session-logs skill is designed to allow the agent to search and analyze its own conversation history stored locally in the OpenClaw state directory. It uses standard command-line utilities like jq and ripgrep to process JSONL files and does not contain any indicators of data exfiltration, unauthorized network access, or malicious intent.
Capability Assessment
Purpose & Capability
The purpose and capabilities align: the skill documents jq/rg searches over OpenClaw session JSONL files. The noteworthy point is that its stated scope is the user's complete prior conversation history.
Instruction Scope
The trigger is reasonably scoped to user requests about prior chats or parent conversations, but examples include searching across all sessions, so users should make narrow requests when they do not want broad history review.
Install Mechanism
Installation only requires standard Homebrew packages for jq and ripgrep; no remote scripts, helper code, or hidden installers are shown.
Credentials
The local file access is proportionate to the purpose and bounded to the active OpenClaw state directory, but that directory contains private session transcripts.
Persistence & Privilege
The skill reads existing persistent session logs and does not create new persistence, background workers, elevated privileges, or account access.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install dalong-session-logs
  3. After installation, invoke the skill by name or use /dalong-session-logs
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
- Initial release of the session-logs skill. - Enables searching and analyzing your session logs using jq and ripgrep. - Provides detailed usage instructions and example queries for listing, searching, and summarizing conversation histories. - Documents session log storage location and file structure. - Includes tips for efficient usage and handling large or deleted session files.
Metadata
Slug dalong-session-logs
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Dalong Session Logs?

Search and analyze your own session logs (older/parent conversations) using jq. It is an AI Agent Skill for Claude Code / OpenClaw, with 45 downloads so far.

How do I install Dalong Session Logs?

Run "/install dalong-session-logs" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Dalong Session Logs free?

Yes, Dalong Session Logs is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Dalong Session Logs support?

Dalong Session Logs is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Dalong Session Logs?

It is built and maintained by 辉哥 (@1yihui); the current version is v1.0.0.

💬 Comments