← 返回 Skills 市场
1yihui

Dalong Session Logs

作者 辉哥 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
45
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install dalong-session-logs
功能描述
Search and analyze your own session logs (older/parent conversations) using jq.
使用说明 (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'
安全使用建议
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.
功能分析
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.
能力评估
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.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install dalong-session-logs
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /dalong-session-logs 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
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.
元数据
Slug dalong-session-logs
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Dalong Session Logs 是什么?

Search and analyze your own session logs (older/parent conversations) using jq. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 45 次。

如何安装 Dalong Session Logs?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install dalong-session-logs」即可一键安装,无需额外配置。

Dalong Session Logs 是免费的吗?

是的,Dalong Session Logs 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Dalong Session Logs 支持哪些平台?

Dalong Session Logs 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Dalong Session Logs?

由 辉哥(@1yihui)开发并维护,当前版本 v1.0.0。

💬 留言讨论