$npx -y skills add langchain-ai/deepagents --skill deepagents-thread-inspectorInspect and explain conversations in the local Deep Agents Code SQLite session store. Use as a fallback when LangSmith trace tooling is unavailable, for offline or untraced sessions, or when asked to identify or summarize a local dcode thread, inspect checkpoint metadata, list re
| 1 | # Deep Agents Thread Inspector |
| 2 | |
| 3 | If LangSmith tooling is available for a traced thread, prefer it. Otherwise, use `scripts/inspect_sessions.py` instead of manually decoding database blobs. It opens the database read-only and deserializes the root message channel with LangGraph's strict MsgPack loader — reading the materialized messages from the latest checkpoint, or replaying writes in checkpoint order when that fast path is unavailable — and emits JSON. |
| 4 | |
| 5 | ## Inspect local state |
| 6 | |
| 7 | Resolve `SKILL_DIR` to the directory containing this `SKILL.md`; do not assume a user, project, or installation-specific location. Start with the smallest useful view: |
| 8 | |
| 9 | ```bash |
| 10 | python3 "$SKILL_DIR/scripts/inspect_sessions.py" THREAD_ID --mode latest-turn |
| 11 | ``` |
| 12 | |
| 13 | A unique thread-ID prefix is accepted. Select another view when needed: |
| 14 | |
| 15 | ```bash |
| 16 | python3 "$SKILL_DIR/scripts/inspect_sessions.py" THREAD_ID --mode summary |
| 17 | python3 "$SKILL_DIR/scripts/inspect_sessions.py" THREAD_ID --mode transcript |
| 18 | ``` |
| 19 | |
| 20 | Use `--include-metadata` only when run, repository, model, checkpoint, or LangGraph metadata matters. Use `--max-content N` to raise or lower the default 4,000-character limit per message, tool result, or tool-call argument. |
| 21 | |
| 22 | If the user does not know the ID, list recent threads first: |
| 23 | |
| 24 | ```bash |
| 25 | python3 "$SKILL_DIR/scripts/inspect_sessions.py" --list 20 |
| 26 | ``` |
| 27 | |
| 28 | Pass `--db PATH` only for a non-default session store. The default is `~/.deepagents/.state/sessions.db`; `DEEPAGENTS_SESSIONS_DB` can override it. |
| 29 | |
| 30 | ## Explain the result |
| 31 | |
| 32 | Synthesize the JSON rather than pasting it verbatim. |
| 33 | |
| 34 | - State the user's request, the assistant's conclusion, and significant tool actions or failures. |
| 35 | - Distinguish stored facts from your interpretation. |
| 36 | - For the latest turn, describe only the final user message and subsequent activity unless earlier context is required to make it understandable. |
| 37 | - Mention truncation when a relevant record has `content_truncated` or `args_truncated` set. |
| 38 | - Surface reconstruction problems when the result includes a top-level `warnings` array (for example, a corrupt checkpoint, a skipped write, or malformed metadata) so conclusions are appropriately hedged. |
| 39 | - Do not expose unrelated credentials, tokens, personal data, or hidden reasoning that may appear in local records. |
| 40 | |
| 41 | ## Safety |
| 42 | |
| 43 | Keep inspection read-only. Do not deserialize an untrusted database: checkpoint deserialization is intended for trusted local Deep Agents state. Do not mutate or delete session rows unless the user separately and explicitly requests it. |