repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | name: session-logs |
| #3 | description: Search and analyze your own session logs (older/parent conversations) using jq. |
| #4 | metadata: {"clawdbot":{"emoji":"📜","requires":{"bins":["jq","rg"]}}} |
| #5 | --- |
| #6 | |
| #7 | # session-logs |
| #8 | |
| #9 | 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. |
| #10 | |
| #11 | ## Trigger |
| #12 | |
| #13 | Use this skill when the user asks about prior chats, parent conversations, or historical context that isn’t in memory files. |
| #14 | |
| #15 | ## Location |
| #16 | |
| #17 | Session logs live at: `~/.clawdbot/agents/<agentId>/sessions/` (use the `agent=<id>` value from the system prompt Runtime line). |
| #18 | |
| #19 | - **`sessions.json`** - Index mapping session keys to session IDs |
| #20 | - **`<session-id>.jsonl`** - Full conversation transcript per session |
| #21 | |
| #22 | ## Structure |
| #23 | |
| #24 | Each `.jsonl` file contains messages with: |
| #25 | - `type`: "session" (metadata) or "message" |
| #26 | - `timestamp`: ISO timestamp |
| #27 | - `message.role`: "user", "assistant", or "toolResult" |
| #28 | - `message.content[]`: Text, thinking, or tool calls (filter `type=="text"` for human-readable content) |
| #29 | - `message.usage.cost.total`: Cost per response |
| #30 | |
| #31 | ## Common Queries |
| #32 | |
| #33 | ### List all sessions by date and size |
| #34 | ```bash |
| #35 | for f in ~/.clawdbot/agents/<agentId>/sessions/*.jsonl; do |
| #36 | date=$(head -1 "$f" | jq -r '.timestamp' | cut -dT -f1) |
| #37 | size=$(ls -lh "$f" | awk '{print $5}') |
| #38 | echo "$date $size $(basename $f)" |
| #39 | done | sort -r |
| #40 | ``` |
| #41 | |
| #42 | ### Find sessions from a specific day |
| #43 | ```bash |
| #44 | for f in ~/.clawdbot/agents/<agentId>/sessions/*.jsonl; do |
| #45 | head -1 "$f" | jq -r '.timestamp' | grep -q "2026-01-06" && echo "$f" |
| #46 | done |
| #47 | ``` |
| #48 | |
| #49 | ### Extract user messages from a session |
| #50 | ```bash |
| #51 | jq -r 'select(.message.role == "user") | .message.content[]? | select(.type == "text") | .text' <session>.jsonl |
| #52 | ``` |
| #53 | |
| #54 | ### Search for keyword in assistant responses |
| #55 | ```bash |
| #56 | jq -r 'select(.message.role == "assistant") | .message.content[]? | select(.type == "text") | .text' <session>.jsonl | rg -i "keyword" |
| #57 | ``` |
| #58 | |
| #59 | ### Get total cost for a session |
| #60 | ```bash |
| #61 | jq -s '[.[] | .message.usage.cost.total // 0] | add' <session>.jsonl |
| #62 | ``` |
| #63 | |
| #64 | ### Daily cost summary |
| #65 | ```bash |
| #66 | for f in ~/.clawdbot/agents/<agentId>/sessions/*.jsonl; do |
| #67 | date=$(head -1 "$f" | jq -r '.timestamp' | cut -dT -f1) |
| #68 | cost=$(jq -s '[.[] | .message.usage.cost.total // 0] | add' "$f") |
| #69 | echo "$date $cost" |
| #70 | done | awk '{a[$1]+=$2} END {for(d in a) print d, "$"a[d]}' | sort -r |
| #71 | ``` |
| #72 | |
| #73 | ### Count messages and tokens in a session |
| #74 | ```bash |
| #75 | jq -s '{ |
| #76 | messages: length, |
| #77 | user: [.[] | select(.message.role == "user")] | length, |
| #78 | assistant: [.[] | select(.message.role == "assistant")] | length, |
| #79 | first: .[0].timestamp, |
| #80 | last: .[-1].timestamp |
| #81 | }' <session>.jsonl |
| #82 | ``` |
| #83 | |
| #84 | ### Tool usage breakdown |
| #85 | ```bash |
| #86 | jq -r '.message.content[]? | select(.type == "toolCall") | .name' <session>.jsonl | sort | uniq -c | sort -rn |
| #87 | ``` |
| #88 | |
| #89 | ### Search across ALL sessions for a phrase |
| #90 | ```bash |
| #91 | rg -l "phrase" ~/.clawdbot/agents/<agentId>/sessions/*.jsonl |
| #92 | ``` |
| #93 | |
| #94 | ## Tips |
| #95 | |
| #96 | - Sessions are append-only JSONL (one JSON object per line) |
| #97 | - Large sessions can be several MB - use `head`/`tail` for sampling |
| #98 | - The `sessions.json` index maps chat providers (discord, whatsapp, etc.) to session IDs |
| #99 | - Deleted sessions have `.deleted.<timestamp>` suffix |
| #100 | |
| #101 | ## Fast text-only hint (low noise) |
| #102 | |
| #103 | ```bash |
| #104 | jq -r 'select(.type=="message") | .message.content[]? | select(.type=="text") | .text' ~/.clawdbot/agents/<agentId>/sessions/<id>.jsonl | rg 'keyword' |
| #105 | ``` |
| #106 |