[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6994739SR792Y7E30ZSTS9H":3,"skill-same:01M6994739SR792Y7E30ZSTS9H":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":32,"linkOnly":33,"markdownContent":34,"markdownBody":35,"frontMatter":36,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":17,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M6994739SR792Y7E30ZSTS9H","dev-session-debug","会话与遥测管道调试","Debugging session.db and the telemetry pipeline. Use when inspecting a session ledger, diagnosing missing telemetry, or correlating events across tables.","用于调试 session.db 和遥测管道。在检查会话账本、诊断遥测数据缺失，或跨表关联事件时使用。","google\u002Fcapsem","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M69939YZJTP726NQK4NZNB48",186,"Apache-2.0",null,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fdev-session-debug\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRSRYQ3M8N5063NNQPF2B1","调试与故障排查","SCENARIO","使用场景",[31],"dev session debug","2026-11-10 10:12:30",false,"---\nname: dev-session-debug\ndescription: Debugging session.db and the telemetry pipeline. Use when inspecting a session ledger, diagnosing missing telemetry, or correlating events across tables.\n---\n\n# Session Database Debugging\n\nEvery Capsem VM session produces a ledger in its session directory:\n`~\u002F.capsem\u002Frun\u002Fsessions\u002F\u003Cid>\u002F` for an ephemeral VM, `~\u002F.capsem\u002Frun\u002Fpersistent\u002F\u003Cname>\u002F`\nfor a named one. The ledger is two files that only make sense together:\n\n- `session.db` -- SQLite, every telemetry table plus the index of captured bodies.\n- `session.bodies` -- the append-only body archive: HTTP, model, tool, exec and\n  security payloads, written as streaming zstd level 3 blocks of about 1 MiB.\n  Readers retain raw-deflate support for older blocks. SQLite never holds body\n  bytes, and native codec execution stays inside `capsem-ledger`.\n\nCopy, fork or delete them as a pair; either one alone is useless. The host\nledger `~\u002F.capsem\u002Fsessions\u002Fhost.db` records what happened to every session\n(created, stopped, with its final counters) as a hash-chained event log.\n\nThe session ledger has no migrations. A `session.db` written by an older build\nfails to open, loudly and by name, rather than being upgraded in place.\n\n## Session identity invariant\n\n`\u003Cid>` is the opaque VM\u002Fsession id used for route paths, DB-handle keys,\nsession-directory names, `CAPSEM_VM_ID`, and UI tab routing. Human names such\nas `co-work1` or `code-vm1` are display aliases only and must live in `name`\nfields. User surfaces may accept a name (`capsem resume co-work1`), but they\nmust translate it to the VM id before calling `\u002Fvms\u002F{id}\u002F...`. Never use a\npersistent registry name as `SandboxInfo.id`, never look up telemetry routes\nwith `registry.get(&id)` unless the id has first been resolved to the registry\nkey, and never key `session_db_handles` by display name.\n\nIf a UI shows telemetry for the wrong provider\u002Fmodel, check this boundary\nfirst: `\u002Fvms\u002Flist` and `\u002Fvms\u002F{id}\u002Finfo` must expose `id = session id` and\n`name = display name`, and `\u002Fvms\u002F{id}\u002Fstats\u002Fdetail` must open the DB under the\nresolved session directory for that id. A session named `co-work1` showing\nanother session's `ollama` rows while its own DB has AGY\u002FGoogle rows is a route\nidentity bug until proven otherwise.\n\n## Quick inspection\n\n### Listing sessions\n\nPython here means the build-system environment:\n`uv run --project build_system --frozen python ...` (a bare `python3` may be a\nsystem interpreter without the packages these need).\n\n```bash\nuv run --project build_system --frozen python -m capsem_builder.gate.tools.doctor.check_session --list   # Recent sessions\n```\n\nSessions come from the host ledger, so they're listed after the session directory is gone. `GET \u002Fstats` folds every finished session's counters with the live counters of running ones.\n\n### Deep inspection\n\nThe commands below open ledger files directly. Use them only on preserved test\nevidence or a coherent copy after its ledger worker has stopped. Live and\nstopped product-session reads go through the service's typed ledger routes;\ndebug tooling must not become a second product reader outside `capsem-ledger`.\n\n```bash\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db --verify-bodies\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db -n 10\n```\n\nChecks: SQLite page integrity (`PRAGMA quick_check`, first -- a damaged file\nends the report), table existence, row counts, body archive integrity (below),\nfile-monitor overflow windows, tool lifecycle integrity (orphaned\ntool_calls\u002Ftool_responses), AI provider correlation (net_events vs\nmodel_calls), and NULL detection in critical fields. It exits 1 when the\nledger is damaged.\n\nRoute readiness (`DbHandle::ready`) checks the schema's shape only, once per\n`schema_version`, and never scans pages: that scan cost 1.8 s per failed poll\non a million-row ledger (google\u002Fcapsem#230). Page damage surfaces as a\n`malformed` error on the query that reads it, at the ledger copy's\n`quick_check`, and here.\n\nThe body archive check compares the index with the file without trusting\neither: every `event_body_blobs.block_offset` exists in `body_blocks`; every\n`body_offset + body_len` fits in its block's `raw_len`; `session.bodies` is at\nleast as long as the largest `block_offset + disk_len` (a block's committed\nextent, headers included) and starts with the archive's file header.\n`--verify-bodies` then reads every body, inflating each segment once, and\nchecks it against `body_hash`.\n\n## Session database tables (session.db)\n\nThe model\u002Ftool contract is intentionally one ledger:\n\n- `model_calls` is one row per model exchange: request sent to the provider and response received from it.\n- `model_items` is the ordered item ledger for request, reasoning\u002Fthinking, response, tool_call, and tool_response content inside those exchanges.\n- `tool_calls` is the canonical user\u002Fsecurity tool-call ledger for all origins (`native`, `mcp`, `builtin`, `local`). User-facing tool counts and CEL tool evidence come from this table.\n- `tool_responses` records tool result content sent back to a model. A response row must match a `tool_calls.call_id` in the same trace.\n- MCP protocol facts are typed security events. MCP-origin `tools\u002Fcall` activity must appear in `tool_calls` with `origin = 'mcp'`.\n- One `model_calls.id` can emit many `tool_calls.call_id` values. The tool response must reuse the same `call_id`; MCP can enrich that same logical call, but it does not create a second product ledger.\n\n### Identity Graph\n\nUse this graph when correlating model, tool, and security rows:\n\n```mermaid\nflowchart TD\n    Session[\"session_id\u003Cbr\u002F>one Capsem session database\"]\n    Trace[\"trace_id\u003Cbr\u002F>causal runtime chain\"]\n    Turn[\"turn_id\u003Cbr\u002F>one user-visible agent turn\u003Cbr\u002F>user input + all resulting work\"]\n\n    ModelA[\"model_call_id A = model_calls.id\u003Cbr\u002F>one provider exchange\u003Cbr\u002F>one request + one response\"]\n    ModelB[\"model_call_id B = model_calls.id\u003Cbr\u002F>later provider exchange\u003Cbr\u002F>same user-visible turn\"]\n    ModelAItems[\"model_items for model_call_id A\u003Cbr\u002F>request, reasoning, response, tool_call\"]\n    ModelBItems[\"model_items for model_call_id B\u003Cbr\u002F>tool_response input, request, reasoning, response\"]\n\n    ToolA1[\"tool_call_id A1 = tool_calls.call_id\u003Cbr\u002F>logical tool invocation\"]\n    ToolA2[\"tool_call_id A2 = tool_calls.call_id\u003Cbr\u002F>logical tool invocation\"]\n    ToolA1Response[\"tool_responses.call_id = A1\u003Cbr\u002F>same tool_call_id\"]\n    ToolA2Response[\"tool_responses.call_id = A2\u003Cbr\u002F>same tool_call_id\"]\n    McpFacts[\"MCP transport facts\u003Cbr\u002F>origin\u002Ftype enrichment\u003Cbr\u002F>same tool_call_id, no duplicate ledger\"]\n\n    EventRows[\"event_id rows\u003Cbr\u002F>http, dns, model, tool, file, process, credential, security\"]\n    BodyBlobs[\"event_body_blobs\u003Cbr\u002F>index by event_id into session.bodies\"]\n    SecurityRows[\"security_rule_events\u003Cbr\u002F>rule matches by event_id\"]\n    ProviderIds[\"provider response_id \u002F message_id \u002F transport ids\u003Cbr\u002F>metadata only\"]\n\n    Session --> Trace\n    Trace --> Turn\n    Turn -->|\"contains 1..N\"| ModelA\n    Turn -->|\"contains 1..N\"| ModelB\n\n    ModelA -->|\"owns ordered rows\"| ModelAItems\n    ModelB -->|\"owns ordered rows\"| ModelBItems\n    ModelA -->|\"emits 0..N\"| ToolA1\n    ModelA -->|\"emits 0..N\"| ToolA2\n\n    ToolA1 -->|\"response reuses id\"| ToolA1Response\n    ToolA2 -->|\"response reuses id\"| ToolA2Response\n    McpFacts -.->|\"enriches\"| ToolA1\n    McpFacts -.->|\"enriches\"| ToolA2\n    ToolA1Response -->|\"can feed later exchange\"| ModelB\n    ToolA2Response -->|\"can feed later exchange\"| ModelB\n\n    Trace --> EventRows\n    Turn --> EventRows\n    ModelA --> EventRows\n    ModelB --> EventRows\n    ToolA1 --> EventRows\n    ToolA2 --> EventRows\n    EventRows --> BodyBlobs\n    EventRows --> SecurityRows\n    ModelA -.-> ProviderIds\n    ModelB -.-> ProviderIds\n```\n\nDefinitions:\n\n- `event_id` identifies one emitted ledger event row. Security rows, body blobs,\n  and event detail routes join back through this id.\n- `trace_id` groups runtime work caused by one causal operation across tables:\n  HTTP, DNS, model, tool, file, process, credentials, and security.\n- `turn_id` groups all work caused by one user-visible agent turn: the user's\n  input, every provider exchange needed to answer it, every tool request and\n  response, and every emitted HTTP\u002FDNS\u002Ffile\u002Fprocess\u002Fsecurity row caused by it.\n- `model_call_id` is the `model_calls.id` value for exactly one provider\n  request\u002Fresponse exchange inside a turn. It owns that exchange's request,\n  reasoning\u002Fthinking, response, model-emitted tool-call items, token counts, and\n  provider metadata. It is not the whole user turn; a single `turn_id` can\n  contain multiple `model_call_id` values.\n- `tool_call_id` identifies one logical tool invocation across model-native\n  tools, MCP transport, Capsem built-ins, and local tools. In SQLite it is stored\n  as `tool_calls.call_id` and `tool_responses.call_id`.\n\nProvider response ids, message ids, and transport request ids are provider or\ntransport metadata. They are not Capsem's join contract.\n\nOne `turn_id` is the user-input scope. It can contain multiple\n`model_call_id` values when an agent calls the model, executes tools, then calls\nthe model again with tool results. One `model_call_id` is one provider-exchange\nscope and carries that exchange's request, reasoning\u002Fthinking, response, token\ncounts, and ordered `model_items`. It can emit zero or more `tool_call_id`\nvalues; this is the canonical one-to-many relationship for model-visible tools.\nStated as the debugging invariant: one `model_call_id` can emit N\n`tool_call_id` values, and each emitted tool response must reuse that\n`tool_call_id`.\nA tool response must carry the same `tool_call_id` as the tool request.\n\nMCP is not a second user-facing tool ledger. MCP-origin `tools\u002Fcall` activity\nmust resolve to a `tool_calls` row with `origin = 'mcp'` or enrich an existing\nlogical `tool_call_id`. An MCP call observed without a corresponding logical\ntool call is an integrity\u002Fsecurity finding, not a separate product counter.\n\nKey cardinalities:\n\n- One session has many `trace_id` values.\n- One `trace_id` has one or more `turn_id` values.\n- One `turn_id` has one or more `model_call_id` values.\n- One `model_call_id` has one provider request and one provider response.\n- One `model_call_id` has many `model_items` rows: request, reasoning,\n  response, tool_call, and tool_response items in observed order.\n- One `model_call_id` can emit many `tool_call_id` values.\n- One `tool_call_id` has one tool request and zero or more observed response\n  rows, all with the same `tool_call_id`.\n- One `event_id` identifies one emitted row and joins its security, body, and\n  display details.\n\n### net_events -- one row per HTTP request through MITM proxy\n\n```sql\nCREATE TABLE net_events (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,          -- RFC 3339\n    domain TEXT NOT NULL,             -- \"api.anthropic.com\"\n    port INTEGER DEFAULT 443,\n    decision TEXT NOT NULL,           -- \"allowed\" or \"denied\"\n    process_name TEXT,                -- \"claude\", \"node\", \"python3\"\n    pid INTEGER,\n    method TEXT,                      -- \"POST\", \"GET\"\n    path TEXT,                        -- \"\u002Fv1\u002Fmessages\"\n    query TEXT,                       -- URL query string\n    status_code INTEGER,              -- 200, 403, etc.\n    bytes_sent INTEGER DEFAULT 0,\n    bytes_received INTEGER DEFAULT 0,\n    duration_ms INTEGER DEFAULT 0,\n    matched_rule TEXT,                -- which policy rule matched\n    request_headers TEXT,             -- JSON (allowlisted verbatim, others hashed)\n    response_headers TEXT,\n    request_body_preview TEXT,        -- compact display field only\n    response_body_preview TEXT,\n    conn_type TEXT DEFAULT 'https'\n);\n```\n\n### model_calls -- one row per AI API request+response cycle\n\n```sql\nCREATE TABLE model_calls (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,\n    provider TEXT NOT NULL,           -- \"anthropic\", \"openai\", \"google\"\n    model TEXT,                       -- \"claude-sonnet-4-20250514\", \"gpt-4o\"\n    process_name TEXT,\n    pid INTEGER,\n    method TEXT NOT NULL,             -- \"POST\"\n    path TEXT NOT NULL,               -- \"\u002Fv1\u002Fmessages\"\n    stream INTEGER DEFAULT 0,         -- 1 if SSE streaming\n    system_prompt_preview TEXT,\n    messages_count INTEGER DEFAULT 0,\n    tools_count INTEGER DEFAULT 0,\n    request_bytes INTEGER DEFAULT 0,\n    request_body_preview TEXT,        -- compact display field only\n    message_id TEXT,                  -- \"msg_...\" (Anthropic), \"chatcmpl-...\" (OpenAI)\n    status_code INTEGER,\n    text_content TEXT,                -- full response text\n    thinking_content TEXT,            -- thinking\u002Freasoning text\n    stop_reason TEXT,                 -- \"end_turn\", \"tool_use\", \"stop\", \"STOP\"\n    input_tokens INTEGER,\n    output_tokens INTEGER,\n    duration_ms INTEGER DEFAULT 0,\n    response_bytes INTEGER DEFAULT 0,\n    estimated_cost_usd REAL DEFAULT 0,\n    trace_id TEXT,                    -- groups tool call chains across turns\n    usage_details TEXT                -- JSON: {\"cache_read\": N, \"thinking\": N}\n);\n```\n\nOnly emitted for actual LLM API paths (`\u002Fv1\u002Fmessages`, `\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1beta\u002Fmodels\u002F*\u002F`). Health checks, auth endpoints don't create rows.\n\n### tool_calls -- canonical tool invocation ledger\n\n```sql\nCREATE TABLE tool_calls (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    event_id TEXT NOT NULL,           -- 12 hex chars\n    timestamp TEXT NOT NULL,\n    model_call_id INTEGER,            -- model_calls.id that emitted the tool call when model-visible\n    provider TEXT NOT NULL,\n    status TEXT NOT NULL,             -- \"requested\", \"observed\", \"responded\", \"error\"\n    call_index INTEGER NOT NULL,      -- position in response\n    call_id TEXT NOT NULL,            -- \"toolu_...\" (Anthropic), \"call_...\" (OpenAI)\n    tool_name TEXT NOT NULL,\n    arguments TEXT,                   -- JSON string\n    response_preview TEXT,\n    origin TEXT NOT NULL DEFAULT 'native',  -- \"native\", \"mcp\", \"builtin\", or \"local\"\n    server_name TEXT,\n    method TEXT,\n    request_id TEXT,\n    decision TEXT NOT NULL,\n    duration_ms INTEGER DEFAULT 0,\n    error_message TEXT,\n    process_name TEXT,\n    bytes_sent INTEGER DEFAULT 0,\n    bytes_received INTEGER DEFAULT 0,\n    policy_mode TEXT,\n    policy_action TEXT,\n    policy_rule TEXT,\n    policy_reason TEXT,\n    trace_id TEXT,\n    credential_ref TEXT\n);\n```\n\nFor model-emitted tool calls, `model_call_id` points to the model exchange\nwhose response emitted that tool call. It is not a trace-level guess.\n\n### tool_responses -- results sent back for tool calls\n\n```sql\nCREATE TABLE tool_responses (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    model_call_id INTEGER NOT NULL,   -- model_calls.id whose request consumed the tool result\n    call_id TEXT NOT NULL,            -- matches tool_calls.call_id\n    content_preview TEXT,\n    is_error INTEGER DEFAULT 0,\n    trace_id TEXT,\n    credential_ref TEXT\n);\n```\n\n`tool_responses.model_call_id` points to the later model exchange that carried\nthe tool result back to the model. The same `call_id` must match a\n`tool_calls.call_id` in the same trace.\n\nMCP initialize\u002Flist\u002Fresource protocol evidence is in the forensic payload of\nthe matching `security_rule_events` row. That payload is archive-backed, not a\ncolumn: read it with\n`DbHandle::read_body(event_id, \"security_rule_events\", BodyDirection::Payload)`,\nor join `event_body_blobs` on `source_table = 'security_rule_events'` and\n`direction = 'payload'` to see what is stored. Decisions and asks archive the\nsame way under `security_decision_events` and `security_ask_events`, and all\nthree name the same event, so a payload read always names its table. Use\n`tool_calls` for product\u002Fuser\u002Fsecurity tool activity.\n\n### Bodies: event_body_blobs, body_blocks and session.bodies\n\nFull bodies -- HTTP and model requests and responses, tool results, exec\nstdout\u002Fstderr, security rule payloads -- live in `session.bodies`, not in\nSQLite. `session.db` holds the index:\n\n```sql\nCREATE TABLE body_blocks (             -- one row per archive block, upserted per segment\n    block_offset INTEGER PRIMARY KEY,  -- byte offset of the block header in session.bodies\n    raw_len INTEGER NOT NULL,          -- inflated size of the committed segments\n    disk_len INTEGER NOT NULL,         -- committed extent in the file, headers included\n    sealed_at TEXT NOT NULL            -- when the last segment was written; retention cuts by this\n);\n\nCREATE TABLE event_body_blobs (        -- one row per archived body; no bytes\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    event_id TEXT NOT NULL,            -- 12 hex, the row in source_table\n    event_type TEXT NOT NULL,\n    source_table TEXT NOT NULL,        -- net_events, model_calls, tool_calls, tool_responses,\n                                       -- exec_events, security_rule_events\n    direction TEXT NOT NULL,           -- request, response, payload, stdout, stderr\n    content_type TEXT,\n    original_bytes INTEGER NOT NULL,   -- what the boundary saw\n    stored_bytes INTEGER NOT NULL,     -- what was archived (10 MiB cap per direction)\n    truncated INTEGER NOT NULL,        -- 1 when stored_bytes \u003C original_bytes\n    body_hash TEXT NOT NULL,           -- blake3 of the ARCHIVED bytes\n    block_offset INTEGER NOT NULL REFERENCES body_blocks(block_offset),\n    body_offset INTEGER NOT NULL,      -- start inside the block's inflated bytes\n    body_len INTEGER NOT NULL,         -- always = stored_bytes\n    trace_id TEXT, turn_id TEXT, created_at TEXT NOT NULL,\n    UNIQUE(event_id, source_table, direction)\n);\n```\n\nA body is found by one index lookup, one seek, one inflate of its block and a\nslice. Every read verifies the block's own blake3 and then the body's\n`body_hash`; bytes that do not match the row that named them are refused, never\nserved. There is no `body` column any more: SQL tells you *what* was captured\nand how big it was, not the bytes.\n\nTo get the bytes:\n\n- In Rust, `DbHandle::read_body(event_id, source_table, direction)` for one\n  body and `DbHandle::read_bodies(event_id)` for every body of an event\n  (`read_bodies_for_events` for a page, with a byte budget). Route and helper\n  code never opens the archive itself.\n- Over HTTP, `GET \u002Fvms\u002F{id}\u002Fbodies\u002F{event_id}` returns every body of one event,\n  1 MiB each by default (`?max_bytes=` up to 16 MiB). `truncated` says the\n  capture was cut; `truncated_for_transport` says this response was.\n- The whole session as a WARC 1.1 file: `GET \u002Fvms\u002F{id}\u002Fbodies\u002Fexport.warc.gz`.\n  One `resource` record per body, id `urn:capsem:{session}:{source_table}:{event_id}:{direction}`,\n  bracketed by two `warcinfo` records; the closing one counts skipped bodies by\n  reason, and a file without it is an export that did not finish. Readable by\n  `warcio`\u002F`pywb` with no Capsem code.\n- Offline, from a copy of a session: `tests\u002Fhelpers\u002Fbody_archive.py` (the one\n  allowlisted Python reader of the format).\n\nPreview columns (`*_preview`) are compact display copies for list views. They\nare not the forensic source of truth: when a preview and the archive disagree,\nthe archive is the ledger.\n\nRetention (`vm.resources.retention_days`, default 30): at service start,\nfailed-session directories older than the period are deleted; when a\npersistent VM stops, blocks sealed before the cutoff are dropped, the archive\nis compacted and the index rows are rewritten. Ephemeral sessions are deleted\nwhole and never trimmed.\n\nGuest exec output is archived exactly, per lane, up to 10 MiB each, for\nbuffered and streamed execs; `stdout_bytes`\u002F`stderr_bytes` are the true totals\nand a body shorter than them is marked `truncated` (google\u002Fcapsem#230). Before\n#230 the ledger archived the 1 KiB preview, so an older ledger's exec bodies\nare 1 KiB excerpts.\n\n### fs_events -- filesystem changes in guest workspace\n\n```sql\nCREATE TABLE fs_events (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,\n    action TEXT NOT NULL,              -- \"created\", \"modified\", \"deleted\", \"overflow\"\n    path TEXT NOT NULL,                -- relative to workspace root\n    size INTEGER,                      -- bytes (NULL for deletes and dirs)\n    kind TEXT NOT NULL DEFAULT 'file'  -- \"file\", \"dir\", \"symlink\", \"other\"\n);\n```\n\n`kind` says what the path is. Security rules read it as `file.kind`, and a\ndirectory event reports no size (the directory inode's size is not a file\nsize). A symlink is recorded as a symlink and never followed or descended.\n\nAn `overflow` row names no path: it is the marker the monitor writes when one\nscan produced more changes than it emits in a single window. The events it\nstands for are not lost -- the baseline is rewound so the next scan derives\nthem again -- and `size` carries how many were held back. A gap in the record\nis evidence, so it is a row rather than a log line.\n\nEvery path under the workspace is recorded, directories included. There is no\nexclusion list: `.git\u002Fhooks`, `.git\u002Fconfig`, `node_modules`, `.venv` and\n`target` are where a compromise persists, so a ledger that omitted them read as\na clean session for a backdoored workspace. Cost is paid by the monitor's\nadaptive poll interval (`poll_interval_for_scan` in\n`crates\u002Fcapsem-core\u002Fsrc\u002Ffs_monitor.rs`: ten scan-durations, floored at 500ms and\ncapped at 10s), never by dropping events. `tests\u002Fcitadel\u002Ftest_fs_monitor_has_no_exclusions.py`\nholds the rule.\n\n## Host ledger (host.db)\n\n`~\u002F.capsem\u002Fsessions\u002Fhost.db` is a v4 ledger whose `host_events` table records\nwhat the service did: `session_created`, `session_stopped` (its MessagePack\n`detail` carries the final `LedgerCounters`), `service_started`,\n`service_stopped`, and policy edits in `policy_mutation_events`. Each\nevent's `hash` chains from the previous one's; `DbReader::verify_host_chain`\nin Rust and `host_ledger.verify_chain` in the doctor tools recompute it. The\nold `main.db` beside it is never opened.\n\n## Common debugging scenarios\n\n### Missing net_events\n- Guest didn't make HTTPS requests, or VM shut down before proxy flushed\n- Check: `just exec 'curl -s https:\u002F\u002Fapi.anthropic.com\u002F && sleep 1'` then inspect\n\n### model_calls has NULL model or NULL tokens\n- **Gzip bug**: response was gzip-compressed and proxy didn't decompress before SSE parsing. Check if `Accept-Encoding: gzip` was sent and `Content-Encoding: gzip` was in response.\n- **Non-streaming**: for non-streaming responses, tokens come from response JSON, not SSE. Check if `stream=0`.\n- **Provider mismatch**: check if the URL path was detected as the right provider. Model resolution: request body > SSE stream > response JSON > URL path.\n\n### tool_calls without matching tool_responses\n- The model invoked a tool but the next turn's tool results weren't captured\n- Check if the VM session ended before the tool result was sent back\n- `check_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db` reports orphaned\n  `tool_calls` automatically on a quiesced evidence copy\n\n### Empty fs_events\n- The host file monitor (`crates\u002Fcapsem-core\u002Fsrc\u002Ffs_monitor.rs`) polls the\n  VirtioFS workspace; there is no guest watcher. Check the process log for the\n  monitor starting on the session's workspace directory.\n- The VM stopped before the next scan. The interval adapts to scan cost\n  (500ms to 10s), so a write in the last second before shutdown may not have\n  been seen.\n\n### A file event seems late or missing\n- Look for `action = 'overflow'` rows: one scan saw more changes than a window\n  emits and held the rest for the next scan. `size` is how many were held.\n  `check_session.py` reports them.\n- Nothing under the workspace is excluded. If `.git\u002F`, `node_modules\u002F` or\n  `target` paths are absent, the monitor did not see them; it did not filter\n  them.\n\n### Bodies missing\n- Check `body_blocks` first. No rows means no block was ever sealed: the\n  session stored no bodies, or the archive writer was disabled at open.\n- An index row that names a block past the end of `session.bodies` is refused\n  at open by design: the writer stores no further bodies for that session and\n  logs `session body index names bytes past the end of the archive`, and the\n  stale rows fail their hash check rather than answer with another block's\n  bytes. It means the index and the file no longer describe the same archive,\n  most likely a crash during retention compaction, or `session.db` copied\n  without its `session.bodies`.\n- `check_session.py --verify-bodies` names every row that does not read back.\n- A persistent VM trims bodies older than `vm.resources.retention_days` when it\n  stops; a body older than that is gone by design, and its index row with it.\n- Exec output past 10 MiB per lane is cut before the ledger sees it; a body\n  with `truncated = 1` and a larger `stdout_bytes` is that, not archive damage.\n  Ledgers written before google\u002Fcapsem#230 hold 1 KiB exec excerpts.\n\n### Empty tool_calls\n- No AI agent invoked tools during the session, or model\u002FMCP tool evidence failed to parse.\n- User-facing tool activity must be in `tool_calls` regardless of whether the origin is native model output, MCP, builtin, or local.\n\n### Empty MCP-origin tool_calls\n- No visible MCP `tools\u002Fcall` activity was observed, or the guest MCP endpoint was not started.\n- This can be valid for direct model-native tool calls. Check native `tool_calls` before assuming no user tool activity happened.\n\n### Cost is zero\n- Model not found in pricing table (`config\u002Fdata\u002Fgenai-prices.json`)\n- Download the reviewed upstream pricing JSON and invoke\n  `python3 build_system\u002Fscripts\u002Fbuild\u002Fupdate_genai_prices.py \u003Csource.json> config\u002Fdata\u002Fgenai-prices.json`.\n\n## When to inspect sessions\n\n**Always** run `check_session.py` on preserved or copied evidence after changes to:\n- Guest MCP endpoint (tool routing, policy, response format)\n- MITM proxy (SSE parsing, body preview, Content-Encoding)\n- File monitor (VirtioFS poll loop, kinds, overflow windows)\n- Body archive or its index (`session.bodies`, `event_body_blobs`, `body_blocks`, retention) -- add `--verify-bodies`\n- Telemetry pipeline (model_calls extraction, tool_calls, cost)\n\nThe inspect output now includes a tool usage breakdown from `tool_calls` plus MCP transport evidence when present. Check it after MCP changes to verify user tools return `allowed` with reasonable latency and that MCP-origin rows link back to protocol evidence when available.\n\n## Ad-hoc SQL queries on offline evidence\n\nRun SQL only against a coherent, quiesced evidence copy. `capsem-ledger` is the\nsole process that opens a product session's `session.db`; VM owners, proxy\nworkers, and service readers use typed ledger channels. SQL answers what the\ncopy captured and where; body bytes remain in the matching `session.bodies`\ncopy (see Bodies above).\n\n```bash\nledger_db=\u002Fpath\u002Fto\u002Fevidence\u002Fsession.db\n\n# Decisions breakdown\nsqlite3 -readonly \"$ledger_db\" \"SELECT decision, COUNT(*) FROM net_events GROUP BY decision\"\n\n# Token totals by provider\nsqlite3 -readonly \"$ledger_db\" \"SELECT provider, SUM(input_tokens) as in_tok, SUM(output_tokens) as out_tok, SUM(estimated_cost_usd) as cost FROM model_calls GROUP BY provider\"\n\n# Find orphaned tool calls\nsqlite3 -readonly \"$ledger_db\" \"SELECT tc.call_id, tc.tool_name FROM tool_calls tc LEFT JOIN tool_responses tr ON tc.call_id = tr.call_id WHERE tr.id IS NULL\"\n\n# MCP-origin user tool usage breakdown (http, external servers, etc.)\nsqlite3 -readonly \"$ledger_db\" \"SELECT tool_name, decision, COUNT(*) as cnt, ROUND(AVG(duration_ms),1) as avg_ms FROM tool_calls WHERE origin = 'mcp' AND tool_name IS NOT NULL GROUP BY tool_name, decision ORDER BY cnt DESC\"\n\n# MCP-origin tool usage breakdown\nsqlite3 -readonly \"$ledger_db\" \"SELECT method, tool_name, decision, COUNT(*) as cnt FROM tool_calls WHERE origin = 'mcp' GROUP BY method, tool_name, decision ORDER BY cnt DESC\"\n\n# Check fs_events actions\nsqlite3 -readonly \"$ledger_db\" \"SELECT action, COUNT(*) FROM fs_events GROUP BY action\"\n\n# Trace a tool call chain\nsqlite3 -readonly \"$ledger_db\" \"SELECT id, model, stop_reason, trace_id FROM model_calls WHERE trace_id = '\u003Ctrace_id>' ORDER BY timestamp\"\n\n# What bodies an event has, and how big they were\nsqlite3 -readonly \"$ledger_db\" \"SELECT source_table, direction, content_type, original_bytes, stored_bytes, truncated FROM event_body_blobs WHERE event_id = '\u003Cevent_id>'\"\n\n# Archive health at a glance: blocks, bytes, and any body pointing at an unrecorded block\nsqlite3 -readonly \"$ledger_db\" \"SELECT COUNT(*), SUM(raw_len), SUM(disk_len), MIN(sealed_at) FROM body_blocks; SELECT COUNT(*) FROM event_body_blobs b LEFT JOIN body_blocks k USING (block_offset) WHERE k.block_offset IS NULL\"\n\n# File-monitor overflow windows and what kinds of paths changed\nsqlite3 -readonly \"$ledger_db\" \"SELECT kind, action, COUNT(*) FROM fs_events GROUP BY kind, action\"\n```\n\nTip: `check_session --list` shows recent sessions from the host ledger. Use\nservice routes for a live or retained product session and direct inspection\nonly for quiesced evidence copies.\n","# Session Database Debugging\n\nEvery Capsem VM session produces a ledger in its session directory:\n`~\u002F.capsem\u002Frun\u002Fsessions\u002F\u003Cid>\u002F` for an ephemeral VM, `~\u002F.capsem\u002Frun\u002Fpersistent\u002F\u003Cname>\u002F`\nfor a named one. The ledger is two files that only make sense together:\n\n- `session.db` -- SQLite, every telemetry table plus the index of captured bodies.\n- `session.bodies` -- the append-only body archive: HTTP, model, tool, exec and\n  security payloads, written as streaming zstd level 3 blocks of about 1 MiB.\n  Readers retain raw-deflate support for older blocks. SQLite never holds body\n  bytes, and native codec execution stays inside `capsem-ledger`.\n\nCopy, fork or delete them as a pair; either one alone is useless. The host\nledger `~\u002F.capsem\u002Fsessions\u002Fhost.db` records what happened to every session\n(created, stopped, with its final counters) as a hash-chained event log.\n\nThe session ledger has no migrations. A `session.db` written by an older build\nfails to open, loudly and by name, rather than being upgraded in place.\n\n## Session identity invariant\n\n`\u003Cid>` is the opaque VM\u002Fsession id used for route paths, DB-handle keys,\nsession-directory names, `CAPSEM_VM_ID`, and UI tab routing. Human names such\nas `co-work1` or `code-vm1` are display aliases only and must live in `name`\nfields. User surfaces may accept a name (`capsem resume co-work1`), but they\nmust translate it to the VM id before calling `\u002Fvms\u002F{id}\u002F...`. Never use a\npersistent registry name as `SandboxInfo.id`, never look up telemetry routes\nwith `registry.get(&id)` unless the id has first been resolved to the registry\nkey, and never key `session_db_handles` by display name.\n\nIf a UI shows telemetry for the wrong provider\u002Fmodel, check this boundary\nfirst: `\u002Fvms\u002Flist` and `\u002Fvms\u002F{id}\u002Finfo` must expose `id = session id` and\n`name = display name`, and `\u002Fvms\u002F{id}\u002Fstats\u002Fdetail` must open the DB under the\nresolved session directory for that id. A session named `co-work1` showing\nanother session's `ollama` rows while its own DB has AGY\u002FGoogle rows is a route\nidentity bug until proven otherwise.\n\n## Quick inspection\n\n### Listing sessions\n\nPython here means the build-system environment:\n`uv run --project build_system --frozen python ...` (a bare `python3` may be a\nsystem interpreter without the packages these need).\n\n```bash\nuv run --project build_system --frozen python -m capsem_builder.gate.tools.doctor.check_session --list   # Recent sessions\n```\n\nSessions come from the host ledger, so they're listed after the session directory is gone. `GET \u002Fstats` folds every finished session's counters with the live counters of running ones.\n\n### Deep inspection\n\nThe commands below open ledger files directly. Use them only on preserved test\nevidence or a coherent copy after its ledger worker has stopped. Live and\nstopped product-session reads go through the service's typed ledger routes;\ndebug tooling must not become a second product reader outside `capsem-ledger`.\n\n```bash\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db --verify-bodies\nuv run --project build_system --frozen python build_system\u002Fscripts\u002Fdoctor\u002Fcheck_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db -n 10\n```\n\nChecks: SQLite page integrity (`PRAGMA quick_check`, first -- a damaged file\nends the report), table existence, row counts, body archive integrity (below),\nfile-monitor overflow windows, tool lifecycle integrity (orphaned\ntool_calls\u002Ftool_responses), AI provider correlation (net_events vs\nmodel_calls), and NULL detection in critical fields. It exits 1 when the\nledger is damaged.\n\nRoute readiness (`DbHandle::ready`) checks the schema's shape only, once per\n`schema_version`, and never scans pages: that scan cost 1.8 s per failed poll\non a million-row ledger (google\u002Fcapsem#230). Page damage surfaces as a\n`malformed` error on the query that reads it, at the ledger copy's\n`quick_check`, and here.\n\nThe body archive check compares the index with the file without trusting\neither: every `event_body_blobs.block_offset` exists in `body_blocks`; every\n`body_offset + body_len` fits in its block's `raw_len`; `session.bodies` is at\nleast as long as the largest `block_offset + disk_len` (a block's committed\nextent, headers included) and starts with the archive's file header.\n`--verify-bodies` then reads every body, inflating each segment once, and\nchecks it against `body_hash`.\n\n## Session database tables (session.db)\n\nThe model\u002Ftool contract is intentionally one ledger:\n\n- `model_calls` is one row per model exchange: request sent to the provider and response received from it.\n- `model_items` is the ordered item ledger for request, reasoning\u002Fthinking, response, tool_call, and tool_response content inside those exchanges.\n- `tool_calls` is the canonical user\u002Fsecurity tool-call ledger for all origins (`native`, `mcp`, `builtin`, `local`). User-facing tool counts and CEL tool evidence come from this table.\n- `tool_responses` records tool result content sent back to a model. A response row must match a `tool_calls.call_id` in the same trace.\n- MCP protocol facts are typed security events. MCP-origin `tools\u002Fcall` activity must appear in `tool_calls` with `origin = 'mcp'`.\n- One `model_calls.id` can emit many `tool_calls.call_id` values. The tool response must reuse the same `call_id`; MCP can enrich that same logical call, but it does not create a second product ledger.\n\n### Identity Graph\n\nUse this graph when correlating model, tool, and security rows:\n\n```mermaid\nflowchart TD\n    Session[\"session_id\u003Cbr\u002F>one Capsem session database\"]\n    Trace[\"trace_id\u003Cbr\u002F>causal runtime chain\"]\n    Turn[\"turn_id\u003Cbr\u002F>one user-visible agent turn\u003Cbr\u002F>user input + all resulting work\"]\n\n    ModelA[\"model_call_id A = model_calls.id\u003Cbr\u002F>one provider exchange\u003Cbr\u002F>one request + one response\"]\n    ModelB[\"model_call_id B = model_calls.id\u003Cbr\u002F>later provider exchange\u003Cbr\u002F>same user-visible turn\"]\n    ModelAItems[\"model_items for model_call_id A\u003Cbr\u002F>request, reasoning, response, tool_call\"]\n    ModelBItems[\"model_items for model_call_id B\u003Cbr\u002F>tool_response input, request, reasoning, response\"]\n\n    ToolA1[\"tool_call_id A1 = tool_calls.call_id\u003Cbr\u002F>logical tool invocation\"]\n    ToolA2[\"tool_call_id A2 = tool_calls.call_id\u003Cbr\u002F>logical tool invocation\"]\n    ToolA1Response[\"tool_responses.call_id = A1\u003Cbr\u002F>same tool_call_id\"]\n    ToolA2Response[\"tool_responses.call_id = A2\u003Cbr\u002F>same tool_call_id\"]\n    McpFacts[\"MCP transport facts\u003Cbr\u002F>origin\u002Ftype enrichment\u003Cbr\u002F>same tool_call_id, no duplicate ledger\"]\n\n    EventRows[\"event_id rows\u003Cbr\u002F>http, dns, model, tool, file, process, credential, security\"]\n    BodyBlobs[\"event_body_blobs\u003Cbr\u002F>index by event_id into session.bodies\"]\n    SecurityRows[\"security_rule_events\u003Cbr\u002F>rule matches by event_id\"]\n    ProviderIds[\"provider response_id \u002F message_id \u002F transport ids\u003Cbr\u002F>metadata only\"]\n\n    Session --> Trace\n    Trace --> Turn\n    Turn -->|\"contains 1..N\"| ModelA\n    Turn -->|\"contains 1..N\"| ModelB\n\n    ModelA -->|\"owns ordered rows\"| ModelAItems\n    ModelB -->|\"owns ordered rows\"| ModelBItems\n    ModelA -->|\"emits 0..N\"| ToolA1\n    ModelA -->|\"emits 0..N\"| ToolA2\n\n    ToolA1 -->|\"response reuses id\"| ToolA1Response\n    ToolA2 -->|\"response reuses id\"| ToolA2Response\n    McpFacts -.->|\"enriches\"| ToolA1\n    McpFacts -.->|\"enriches\"| ToolA2\n    ToolA1Response -->|\"can feed later exchange\"| ModelB\n    ToolA2Response -->|\"can feed later exchange\"| ModelB\n\n    Trace --> EventRows\n    Turn --> EventRows\n    ModelA --> EventRows\n    ModelB --> EventRows\n    ToolA1 --> EventRows\n    ToolA2 --> EventRows\n    EventRows --> BodyBlobs\n    EventRows --> SecurityRows\n    ModelA -.-> ProviderIds\n    ModelB -.-> ProviderIds\n```\n\nDefinitions:\n\n- `event_id` identifies one emitted ledger event row. Security rows, body blobs,\n  and event detail routes join back through this id.\n- `trace_id` groups runtime work caused by one causal operation across tables:\n  HTTP, DNS, model, tool, file, process, credentials, and security.\n- `turn_id` groups all work caused by one user-visible agent turn: the user's\n  input, every provider exchange needed to answer it, every tool request and\n  response, and every emitted HTTP\u002FDNS\u002Ffile\u002Fprocess\u002Fsecurity row caused by it.\n- `model_call_id` is the `model_calls.id` value for exactly one provider\n  request\u002Fresponse exchange inside a turn. It owns that exchange's request,\n  reasoning\u002Fthinking, response, model-emitted tool-call items, token counts, and\n  provider metadata. It is not the whole user turn; a single `turn_id` can\n  contain multiple `model_call_id` values.\n- `tool_call_id` identifies one logical tool invocation across model-native\n  tools, MCP transport, Capsem built-ins, and local tools. In SQLite it is stored\n  as `tool_calls.call_id` and `tool_responses.call_id`.\n\nProvider response ids, message ids, and transport request ids are provider or\ntransport metadata. They are not Capsem's join contract.\n\nOne `turn_id` is the user-input scope. It can contain multiple\n`model_call_id` values when an agent calls the model, executes tools, then calls\nthe model again with tool results. One `model_call_id` is one provider-exchange\nscope and carries that exchange's request, reasoning\u002Fthinking, response, token\ncounts, and ordered `model_items`. It can emit zero or more `tool_call_id`\nvalues; this is the canonical one-to-many relationship for model-visible tools.\nStated as the debugging invariant: one `model_call_id` can emit N\n`tool_call_id` values, and each emitted tool response must reuse that\n`tool_call_id`.\nA tool response must carry the same `tool_call_id` as the tool request.\n\nMCP is not a second user-facing tool ledger. MCP-origin `tools\u002Fcall` activity\nmust resolve to a `tool_calls` row with `origin = 'mcp'` or enrich an existing\nlogical `tool_call_id`. An MCP call observed without a corresponding logical\ntool call is an integrity\u002Fsecurity finding, not a separate product counter.\n\nKey cardinalities:\n\n- One session has many `trace_id` values.\n- One `trace_id` has one or more `turn_id` values.\n- One `turn_id` has one or more `model_call_id` values.\n- One `model_call_id` has one provider request and one provider response.\n- One `model_call_id` has many `model_items` rows: request, reasoning,\n  response, tool_call, and tool_response items in observed order.\n- One `model_call_id` can emit many `tool_call_id` values.\n- One `tool_call_id` has one tool request and zero or more observed response\n  rows, all with the same `tool_call_id`.\n- One `event_id` identifies one emitted row and joins its security, body, and\n  display details.\n\n### net_events -- one row per HTTP request through MITM proxy\n\n```sql\nCREATE TABLE net_events (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,          -- RFC 3339\n    domain TEXT NOT NULL,             -- \"api.anthropic.com\"\n    port INTEGER DEFAULT 443,\n    decision TEXT NOT NULL,           -- \"allowed\" or \"denied\"\n    process_name TEXT,                -- \"claude\", \"node\", \"python3\"\n    pid INTEGER,\n    method TEXT,                      -- \"POST\", \"GET\"\n    path TEXT,                        -- \"\u002Fv1\u002Fmessages\"\n    query TEXT,                       -- URL query string\n    status_code INTEGER,              -- 200, 403, etc.\n    bytes_sent INTEGER DEFAULT 0,\n    bytes_received INTEGER DEFAULT 0,\n    duration_ms INTEGER DEFAULT 0,\n    matched_rule TEXT,                -- which policy rule matched\n    request_headers TEXT,             -- JSON (allowlisted verbatim, others hashed)\n    response_headers TEXT,\n    request_body_preview TEXT,        -- compact display field only\n    response_body_preview TEXT,\n    conn_type TEXT DEFAULT 'https'\n);\n```\n\n### model_calls -- one row per AI API request+response cycle\n\n```sql\nCREATE TABLE model_calls (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,\n    provider TEXT NOT NULL,           -- \"anthropic\", \"openai\", \"google\"\n    model TEXT,                       -- \"claude-sonnet-4-20250514\", \"gpt-4o\"\n    process_name TEXT,\n    pid INTEGER,\n    method TEXT NOT NULL,             -- \"POST\"\n    path TEXT NOT NULL,               -- \"\u002Fv1\u002Fmessages\"\n    stream INTEGER DEFAULT 0,         -- 1 if SSE streaming\n    system_prompt_preview TEXT,\n    messages_count INTEGER DEFAULT 0,\n    tools_count INTEGER DEFAULT 0,\n    request_bytes INTEGER DEFAULT 0,\n    request_body_preview TEXT,        -- compact display field only\n    message_id TEXT,                  -- \"msg_...\" (Anthropic), \"chatcmpl-...\" (OpenAI)\n    status_code INTEGER,\n    text_content TEXT,                -- full response text\n    thinking_content TEXT,            -- thinking\u002Freasoning text\n    stop_reason TEXT,                 -- \"end_turn\", \"tool_use\", \"stop\", \"STOP\"\n    input_tokens INTEGER,\n    output_tokens INTEGER,\n    duration_ms INTEGER DEFAULT 0,\n    response_bytes INTEGER DEFAULT 0,\n    estimated_cost_usd REAL DEFAULT 0,\n    trace_id TEXT,                    -- groups tool call chains across turns\n    usage_details TEXT                -- JSON: {\"cache_read\": N, \"thinking\": N}\n);\n```\n\nOnly emitted for actual LLM API paths (`\u002Fv1\u002Fmessages`, `\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1beta\u002Fmodels\u002F*\u002F`). Health checks, auth endpoints don't create rows.\n\n### tool_calls -- canonical tool invocation ledger\n\n```sql\nCREATE TABLE tool_calls (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    event_id TEXT NOT NULL,           -- 12 hex chars\n    timestamp TEXT NOT NULL,\n    model_call_id INTEGER,            -- model_calls.id that emitted the tool call when model-visible\n    provider TEXT NOT NULL,\n    status TEXT NOT NULL,             -- \"requested\", \"observed\", \"responded\", \"error\"\n    call_index INTEGER NOT NULL,      -- position in response\n    call_id TEXT NOT NULL,            -- \"toolu_...\" (Anthropic), \"call_...\" (OpenAI)\n    tool_name TEXT NOT NULL,\n    arguments TEXT,                   -- JSON string\n    response_preview TEXT,\n    origin TEXT NOT NULL DEFAULT 'native',  -- \"native\", \"mcp\", \"builtin\", or \"local\"\n    server_name TEXT,\n    method TEXT,\n    request_id TEXT,\n    decision TEXT NOT NULL,\n    duration_ms INTEGER DEFAULT 0,\n    error_message TEXT,\n    process_name TEXT,\n    bytes_sent INTEGER DEFAULT 0,\n    bytes_received INTEGER DEFAULT 0,\n    policy_mode TEXT,\n    policy_action TEXT,\n    policy_rule TEXT,\n    policy_reason TEXT,\n    trace_id TEXT,\n    credential_ref TEXT\n);\n```\n\nFor model-emitted tool calls, `model_call_id` points to the model exchange\nwhose response emitted that tool call. It is not a trace-level guess.\n\n### tool_responses -- results sent back for tool calls\n\n```sql\nCREATE TABLE tool_responses (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    model_call_id INTEGER NOT NULL,   -- model_calls.id whose request consumed the tool result\n    call_id TEXT NOT NULL,            -- matches tool_calls.call_id\n    content_preview TEXT,\n    is_error INTEGER DEFAULT 0,\n    trace_id TEXT,\n    credential_ref TEXT\n);\n```\n\n`tool_responses.model_call_id` points to the later model exchange that carried\nthe tool result back to the model. The same `call_id` must match a\n`tool_calls.call_id` in the same trace.\n\nMCP initialize\u002Flist\u002Fresource protocol evidence is in the forensic payload of\nthe matching `security_rule_events` row. That payload is archive-backed, not a\ncolumn: read it with\n`DbHandle::read_body(event_id, \"security_rule_events\", BodyDirection::Payload)`,\nor join `event_body_blobs` on `source_table = 'security_rule_events'` and\n`direction = 'payload'` to see what is stored. Decisions and asks archive the\nsame way under `security_decision_events` and `security_ask_events`, and all\nthree name the same event, so a payload read always names its table. Use\n`tool_calls` for product\u002Fuser\u002Fsecurity tool activity.\n\n### Bodies: event_body_blobs, body_blocks and session.bodies\n\nFull bodies -- HTTP and model requests and responses, tool results, exec\nstdout\u002Fstderr, security rule payloads -- live in `session.bodies`, not in\nSQLite. `session.db` holds the index:\n\n```sql\nCREATE TABLE body_blocks (             -- one row per archive block, upserted per segment\n    block_offset INTEGER PRIMARY KEY,  -- byte offset of the block header in session.bodies\n    raw_len INTEGER NOT NULL,          -- inflated size of the committed segments\n    disk_len INTEGER NOT NULL,         -- committed extent in the file, headers included\n    sealed_at TEXT NOT NULL            -- when the last segment was written; retention cuts by this\n);\n\nCREATE TABLE event_body_blobs (        -- one row per archived body; no bytes\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    event_id TEXT NOT NULL,            -- 12 hex, the row in source_table\n    event_type TEXT NOT NULL,\n    source_table TEXT NOT NULL,        -- net_events, model_calls, tool_calls, tool_responses,\n                                       -- exec_events, security_rule_events\n    direction TEXT NOT NULL,           -- request, response, payload, stdout, stderr\n    content_type TEXT,\n    original_bytes INTEGER NOT NULL,   -- what the boundary saw\n    stored_bytes INTEGER NOT NULL,     -- what was archived (10 MiB cap per direction)\n    truncated INTEGER NOT NULL,        -- 1 when stored_bytes \u003C original_bytes\n    body_hash TEXT NOT NULL,           -- blake3 of the ARCHIVED bytes\n    block_offset INTEGER NOT NULL REFERENCES body_blocks(block_offset),\n    body_offset INTEGER NOT NULL,      -- start inside the block's inflated bytes\n    body_len INTEGER NOT NULL,         -- always = stored_bytes\n    trace_id TEXT, turn_id TEXT, created_at TEXT NOT NULL,\n    UNIQUE(event_id, source_table, direction)\n);\n```\n\nA body is found by one index lookup, one seek, one inflate of its block and a\nslice. Every read verifies the block's own blake3 and then the body's\n`body_hash`; bytes that do not match the row that named them are refused, never\nserved. There is no `body` column any more: SQL tells you *what* was captured\nand how big it was, not the bytes.\n\nTo get the bytes:\n\n- In Rust, `DbHandle::read_body(event_id, source_table, direction)` for one\n  body and `DbHandle::read_bodies(event_id)` for every body of an event\n  (`read_bodies_for_events` for a page, with a byte budget). Route and helper\n  code never opens the archive itself.\n- Over HTTP, `GET \u002Fvms\u002F{id}\u002Fbodies\u002F{event_id}` returns every body of one event,\n  1 MiB each by default (`?max_bytes=` up to 16 MiB). `truncated` says the\n  capture was cut; `truncated_for_transport` says this response was.\n- The whole session as a WARC 1.1 file: `GET \u002Fvms\u002F{id}\u002Fbodies\u002Fexport.warc.gz`.\n  One `resource` record per body, id `urn:capsem:{session}:{source_table}:{event_id}:{direction}`,\n  bracketed by two `warcinfo` records; the closing one counts skipped bodies by\n  reason, and a file without it is an export that did not finish. Readable by\n  `warcio`\u002F`pywb` with no Capsem code.\n- Offline, from a copy of a session: `tests\u002Fhelpers\u002Fbody_archive.py` (the one\n  allowlisted Python reader of the format).\n\nPreview columns (`*_preview`) are compact display copies for list views. They\nare not the forensic source of truth: when a preview and the archive disagree,\nthe archive is the ledger.\n\nRetention (`vm.resources.retention_days`, default 30): at service start,\nfailed-session directories older than the period are deleted; when a\npersistent VM stops, blocks sealed before the cutoff are dropped, the archive\nis compacted and the index rows are rewritten. Ephemeral sessions are deleted\nwhole and never trimmed.\n\nGuest exec output is archived exactly, per lane, up to 10 MiB each, for\nbuffered and streamed execs; `stdout_bytes`\u002F`stderr_bytes` are the true totals\nand a body shorter than them is marked `truncated` (google\u002Fcapsem#230). Before\n#230 the ledger archived the 1 KiB preview, so an older ledger's exec bodies\nare 1 KiB excerpts.\n\n### fs_events -- filesystem changes in guest workspace\n\n```sql\nCREATE TABLE fs_events (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp TEXT NOT NULL,\n    action TEXT NOT NULL,              -- \"created\", \"modified\", \"deleted\", \"overflow\"\n    path TEXT NOT NULL,                -- relative to workspace root\n    size INTEGER,                      -- bytes (NULL for deletes and dirs)\n    kind TEXT NOT NULL DEFAULT 'file'  -- \"file\", \"dir\", \"symlink\", \"other\"\n);\n```\n\n`kind` says what the path is. Security rules read it as `file.kind`, and a\ndirectory event reports no size (the directory inode's size is not a file\nsize). A symlink is recorded as a symlink and never followed or descended.\n\nAn `overflow` row names no path: it is the marker the monitor writes when one\nscan produced more changes than it emits in a single window. The events it\nstands for are not lost -- the baseline is rewound so the next scan derives\nthem again -- and `size` carries how many were held back. A gap in the record\nis evidence, so it is a row rather than a log line.\n\nEvery path under the workspace is recorded, directories included. There is no\nexclusion list: `.git\u002Fhooks`, `.git\u002Fconfig`, `node_modules`, `.venv` and\n`target` are where a compromise persists, so a ledger that omitted them read as\na clean session for a backdoored workspace. Cost is paid by the monitor's\nadaptive poll interval (`poll_interval_for_scan` in\n`crates\u002Fcapsem-core\u002Fsrc\u002Ffs_monitor.rs`: ten scan-durations, floored at 500ms and\ncapped at 10s), never by dropping events. `tests\u002Fcitadel\u002Ftest_fs_monitor_has_no_exclusions.py`\nholds the rule.\n\n## Host ledger (host.db)\n\n`~\u002F.capsem\u002Fsessions\u002Fhost.db` is a v4 ledger whose `host_events` table records\nwhat the service did: `session_created`, `session_stopped` (its MessagePack\n`detail` carries the final `LedgerCounters`), `service_started`,\n`service_stopped`, and policy edits in `policy_mutation_events`. Each\nevent's `hash` chains from the previous one's; `DbReader::verify_host_chain`\nin Rust and `host_ledger.verify_chain` in the doctor tools recompute it. The\nold `main.db` beside it is never opened.\n\n## Common debugging scenarios\n\n### Missing net_events\n- Guest didn't make HTTPS requests, or VM shut down before proxy flushed\n- Check: `just exec 'curl -s https:\u002F\u002Fapi.anthropic.com\u002F && sleep 1'` then inspect\n\n### model_calls has NULL model or NULL tokens\n- **Gzip bug**: response was gzip-compressed and proxy didn't decompress before SSE parsing. Check if `Accept-Encoding: gzip` was sent and `Content-Encoding: gzip` was in response.\n- **Non-streaming**: for non-streaming responses, tokens come from response JSON, not SSE. Check if `stream=0`.\n- **Provider mismatch**: check if the URL path was detected as the right provider. Model resolution: request body > SSE stream > response JSON > URL path.\n\n### tool_calls without matching tool_responses\n- The model invoked a tool but the next turn's tool results weren't captured\n- Check if the VM session ended before the tool result was sent back\n- `check_session.py --db \u002Fpath\u002Fto\u002Fevidence\u002Fsession.db` reports orphaned\n  `tool_calls` automatically on a quiesced evidence copy\n\n### Empty fs_events\n- The host file monitor (`crates\u002Fcapsem-core\u002Fsrc\u002Ffs_monitor.rs`) polls the\n  VirtioFS workspace; there is no guest watcher. Check the process log for the\n  monitor starting on the session's workspace directory.\n- The VM stopped before the next scan. The interval adapts to scan cost\n  (500ms to 10s), so a write in the last second before shutdown may not have\n  been seen.\n\n### A file event seems late or missing\n- Look for `action = 'overflow'` rows: one scan saw more changes than a window\n  emits and held the rest for the next scan. `size` is how many were held.\n  `check_session.py` reports them.\n- Nothing under the workspace is excluded. If `.git\u002F`, `node_modules\u002F` or\n  `target` paths are absent, the monitor did not see them; it did not filter\n  them.\n\n### Bodies missing\n- Check `body_blocks` first. No rows means no block was ever sealed: the\n  session stored no bodies, or the archive writer was disabled at open.\n- An index row that names a block past the end of `session.bodies` is refused\n  at open by design: the writer stores no further bodies for that session and\n  logs `session body index names bytes past the end of the archive`, and the\n  stale rows fail their hash check rather than answer with another block's\n  bytes. It means the index and the file no longer describe the same archive,\n  most likely a crash during retention compaction, or `session.db` copied\n  without its `session.bodies`.\n- `check_session.py --verify-bodies` names every row that does not read back.\n- A persistent VM trims bodies older than `vm.resources.retention_days` when it\n  stops; a body older than that is gone by design, and its index row with it.\n- Exec output past 10 MiB per lane is cut before the ledger sees it; a body\n  with `truncated = 1` and a larger `stdout_bytes` is that, not archive damage.\n  Ledgers written before google\u002Fcapsem#230 hold 1 KiB exec excerpts.\n\n### Empty tool_calls\n- No AI agent invoked tools during the session, or model\u002FMCP tool evidence failed to parse.\n- User-facing tool activity must be in `tool_calls` regardless of whether the origin is native model output, MCP, builtin, or local.\n\n### Empty MCP-origin tool_calls\n- No visible MCP `tools\u002Fcall` activity was observed, or the guest MCP endpoint was not started.\n- This can be valid for direct model-native tool calls. Check native `tool_calls` before assuming no user tool activity happened.\n\n### Cost is zero\n- Model not found in pricing table (`config\u002Fdata\u002Fgenai-prices.json`)\n- Download the reviewed upstream pricing JSON and invoke\n  `python3 build_system\u002Fscripts\u002Fbuild\u002Fupdate_genai_prices.py \u003Csource.json> config\u002Fdata\u002Fgenai-prices.json`.\n\n## When to inspect sessions\n\n**Always** run `check_session.py` on preserved or copied evidence after changes to:\n- Guest MCP endpoint (tool routing, policy, response format)\n- MITM proxy (SSE parsing, body preview, Content-Encoding)\n- File monitor (VirtioFS poll loop, kinds, overflow windows)\n- Body archive or its index (`session.bodies`, `event_body_blobs`, `body_blocks`, retention) -- add `--verify-bodies`\n- Telemetry pipeline (model_calls extraction, tool_calls, cost)\n\nThe inspect output now includes a tool usage breakdown from `tool_calls` plus MCP transport evidence when present. Check it after MCP changes to verify user tools return `allowed` with reasonable latency and that MCP-origin rows link back to protocol evidence when available.\n\n## Ad-hoc SQL queries on offline evidence\n\nRun SQL only against a coherent, quiesced evidence copy. `capsem-ledger` is the\nsole process that opens a product session's `session.db`; VM owners, proxy\nworkers, and service readers use typed ledger channels. SQL answers what the\ncopy captured and where; body bytes remain in the matching `session.bodies`\ncopy (see Bodies above).\n\n```bash\nledger_db=\u002Fpath\u002Fto\u002Fevidence\u002Fsession.db\n\n# Decisions breakdown\nsqlite3 -readonly \"$ledger_db\" \"SELECT decision, COUNT(*) FROM net_events GROUP BY decision\"\n\n# Token totals by provider\nsqlite3 -readonly \"$ledger_db\" \"SELECT provider, SUM(input_tokens) as in_tok, SUM(output_tokens) as out_tok, SUM(estimated_cost_usd) as cost FROM model_calls GROUP BY provider\"\n\n# Find orphaned tool calls\nsqlite3 -readonly \"$ledger_db\" \"SELECT tc.call_id, tc.tool_name FROM tool_calls tc LEFT JOIN tool_responses tr ON tc.call_id = tr.call_id WHERE tr.id IS NULL\"\n\n# MCP-origin user tool usage breakdown (http, external servers, etc.)\nsqlite3 -readonly \"$ledger_db\" \"SELECT tool_name, decision, COUNT(*) as cnt, ROUND(AVG(duration_ms),1) as avg_ms FROM tool_calls WHERE origin = 'mcp' AND tool_name IS NOT NULL GROUP BY tool_name, decision ORDER BY cnt DESC\"\n\n# MCP-origin tool usage breakdown\nsqlite3 -readonly \"$ledger_db\" \"SELECT method, tool_name, decision, COUNT(*) as cnt FROM tool_calls WHERE origin = 'mcp' GROUP BY method, tool_name, decision ORDER BY cnt DESC\"\n\n# Check fs_events actions\nsqlite3 -readonly \"$ledger_db\" \"SELECT action, COUNT(*) FROM fs_events GROUP BY action\"\n\n# Trace a tool call chain\nsqlite3 -readonly \"$ledger_db\" \"SELECT id, model, stop_reason, trace_id FROM model_calls WHERE trace_id = '\u003Ctrace_id>' ORDER BY timestamp\"\n\n# What bodies an event has, and how big they were\nsqlite3 -readonly \"$ledger_db\" \"SELECT source_table, direction, content_type, original_bytes, stored_bytes, truncated FROM event_body_blobs WHERE event_id = '\u003Cevent_id>'\"\n\n# Archive health at a glance: blocks, bytes, and any body pointing at an unrecorded block\nsqlite3 -readonly \"$ledger_db\" \"SELECT COUNT(*), SUM(raw_len), SUM(disk_len), MIN(sealed_at) FROM body_blocks; SELECT COUNT(*) FROM event_body_blobs b LEFT JOIN body_blocks k USING (block_offset) WHERE k.block_offset IS NULL\"\n\n# File-monitor overflow windows and what kinds of paths changed\nsqlite3 -readonly \"$ledger_db\" \"SELECT kind, action, COUNT(*) FROM fs_events GROUP BY kind, action\"\n```\n\nTip: `check_session --list` shows recent sessions from the host ledger. Use\nservice routes for a live or retained product session and direct inspection\nonly for quiesced evidence copies.\n",{"name":5,"description":7},"main","d357170bb677125c80cebed720e62bf47bf083ad","skills\u002Fdev-session-debug",26,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 00:49:59",{"source":9,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add google\u002Fcapsem --skill dev-session-debug",{"tool":52,"command":53},"bunx","bunx skills add google\u002Fcapsem --skill dev-session-debug",{"tool":55,"command":56},"pnpm","pnpm dlx skills add google\u002Fcapsem --skill dev-session-debug","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fdev-session-debug\u002FSKILL.md",true,[],[61,78,94,109,122,134],{"skillNo":62,"name":63,"nameZh":64,"description":65,"descriptionZh":66,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":67,"categories":68,"keywords":75,"publishedAt":32},"01M699558T2T4DJMBN08ZCQ79K","use-capsem","Capsem 虚拟机任务执行","Run tasks in Capsem VMs through MCP. Use when an agent needs isolated execution, file analysis, or reports returned to the host.","通过 MCP 在 Capsem 虚拟机中运行任务。在智能体需要隔离执行、文件分析，或将报告返回到主机时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fuse-capsem\u002FSKILL.md",[69,72],{"categoryNo":70,"categoryName":71,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0DBCRG4XGJMB6QQEP11","编码任务委派",{"categoryNo":73,"categoryName":74,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[76,77],"use capsem","MCP",{"skillNo":79,"name":80,"nameZh":81,"description":82,"descriptionZh":83,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":84,"categories":85,"keywords":92,"publishedAt":32},"01M69953Z1CSVQ4N07QX529CZY","site-marketing","营销网站内容维护","The marketing website, capsem.org. Use when editing copy, adding sections, or changing the site theme.","营销网站 capsem.org。在编辑文案、添加板块或更改网站主题时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-marketing\u002FSKILL.md",[86,89],{"categoryNo":87,"categoryName":88,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD6C0J544QTJ9R38Z7ZG","营销专员",{"categoryNo":90,"categoryName":91,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQV98WRP4APE9VKKKKJ6FV","社交媒体与内容平台管理",[93],"site marketing",{"skillNo":95,"name":96,"nameZh":97,"description":98,"descriptionZh":99,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":100,"categories":101,"keywords":106,"publishedAt":32},"01M69952B33KBBV37N8QTC4191","site-infra","文档站基础设施维护","The documentation site, docs.capsem.org. Use for user-directed Diátaxis documentation and Astro Starlight changes.","文档站点 docs.capsem.org。用于面向用户的 Diátaxis 文档和 Astro Starlight 相关更改。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-infra\u002FSKILL.md",[102,105],{"categoryNo":103,"categoryName":104,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[107,108],"site infra","docs",{"skillNo":110,"name":111,"nameZh":112,"description":17,"descriptionZh":113,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":114,"categories":115,"keywords":120,"publishedAt":32},"01M69950YKCZKCDB98JDQNBBRJ","site-architecture","站点架构设计","","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fsite-architecture\u002FSKILL.md",[116,119],{"categoryNo":117,"categoryName":118,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQ6TKQDF2K4KQS863Q79P4","开发参考",{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},[121],"site architecture",{"skillNo":123,"name":124,"nameZh":125,"description":17,"descriptionZh":113,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":126,"categories":127,"keywords":132,"publishedAt":32},"01M6994Z61JWZ0G2YRJTWFH933","release-process","版本发布流程","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Frelease-process\u002FSKILL.md",[128,129],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":130,"categoryName":131,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQNXPY1AV6BSR5VKHDMWRH","部署与发布管理",[133],"release process",{"skillNo":135,"name":136,"nameZh":137,"description":138,"descriptionZh":139,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":140,"categories":141,"keywords":146,"publishedAt":32},"01M6994XKHADM6FBTYTAPG7FYC","meta-skill-creation","智能体技能创建与优化","Create, improve, and evaluate skills. Use when writing a new skill, editing an existing one, or tuning a description for better triggering.","创建、改进和评估技能。在编写新技能、编辑现有技能或调整 description 以优化触发效果时使用。","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fcapsem\u002Fblob\u002Fmain\u002Fskills\u002Fmeta-skill-creation\u002FSKILL.md",[142,145],{"categoryNo":143,"categoryName":144,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":73,"categoryName":74,"taxonomyType":23,"taxonomyTypeDesc":24},[147,148],"meta skill creation","writing"]