Skip to content

Commit 89b09a0

Browse files
Merge branch 'main' into fix/composer-typing-stable-model-picker
2 parents 35faa8f + 86bf768 commit 89b09a0

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

  • .agents/skills/openclaw-debugging

‎.agents/skills/openclaw-debugging/SKILL.md‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: openclaw-debugging
3-
description: Debug OpenClaw model, provider, tool-surface, code-mode, streaming, and live/Crabbox behavior by choosing the right logs, probes, and proof path before changing code.
3+
description: Debug OpenClaw model, provider, tool-surface, code-mode, streaming, and live/Crabbox behavior by choosing the right logs, probes, and proof path before changing code, including fetching stored sessions, transcripts, and attachments as evidence.
44
---
55

66
# OpenClaw Debugging
@@ -77,6 +77,56 @@ openclaw logs --follow
7777
before saying live proof is blocked. Env checks are presence-only; never print
7878
secrets.
7979

80+
## Fetching Sessions and Transcripts
81+
82+
Use these paths when a bug report references a chat session and you need the
83+
actual transcript, sender attribution, or attachments as evidence.
84+
85+
CLI first (needs a configured install; safe against a live gateway):
86+
87+
```bash
88+
openclaw sessions list --agent <agentId> --json
89+
openclaw sessions tail
90+
openclaw sessions export-trajectory
91+
```
92+
93+
Docs: `docs/reference/database-schemas.md` for the store layout,
94+
https://docs.openclaw.ai/cli/sessions for the CLI.
95+
96+
Raw store (when the CLI is unavailable, e.g. inspecting a remote host over
97+
SSH, or you need event-level detail):
98+
99+
- Per-agent data plane: `~/.openclaw/agents/<agentId>/agent/openclaw-agent.sqlite`.
100+
Canonical schema: `src/state/openclaw-agent-schema.sql`.
101+
- Web chat URLs end in a session-id fragment: `/chat/<agentId>/<slug>-<hex>`.
102+
Resolve it in `session_nodes`: `session_key LIKE '%<hex>%'` →
103+
`current_session_id`, `display_name`. Key shape is
104+
`agent:<agentId>:<surface>:<uuid>`; subagent sessions use surface `subagent`.
105+
- Transcript: `transcript_events` (`session_id`, `seq`, `event_json`).
106+
`event_json.message` has `role` (`user`/`assistant`/`toolResult`) and
107+
`content` (string, or parts of type `text`/`toolCall`/`image`).
108+
- Sender provenance: real user messages carry `message.__openclaw`
109+
(`senderId`, `senderName`, `senderIsOwner`); runtime-synthesized inputs do
110+
not. Use this to separate operator-authored text from injected prompts.
111+
- Full-text search across transcripts: `session_transcript_fts`.
112+
- Attachments: `media://inbound/<file>` URLs map to
113+
`~/.openclaw/media/inbound/<file>`.
114+
115+
Hosts without a `sqlite3` binary still have Node: `node:sqlite` needs no
116+
dependencies.
117+
118+
```bash
119+
node -e 'const {DatabaseSync}=require("node:sqlite");
120+
const db=new DatabaseSync(process.argv[1],{readOnly:true});
121+
console.log(JSON.stringify(db.prepare(
122+
"SELECT seq,event_json FROM transcript_events WHERE session_id=? ORDER BY seq"
123+
).all(process.argv[2])))' <db-path> <session-id>
124+
```
125+
126+
Always open live stores `readOnly: true`; never write a running gateway's
127+
state (see Validation rules in the root `AGENTS.md`). For realistic-data
128+
work, copy the DB into a dev state dir first.
129+
80130
## Code Pointers
81131

82132
- Model payload + Responses stream:

0 commit comments

Comments
 (0)