[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78HR0HPWZ1GZKY68A2SCA0G":3,"skill-same:01M78HR0HPWZ1GZKY68A2SCA0G":44},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M78HR0HPWZ1GZKY68A2SCA0G","troubleshoot",null,"Investigate unexpected behavior in the current Copilot CLI agent session by analyzing its event log. Use when the user asks why something happened, why a request was slow, why a tool was or was not used, or why instructions\u002Fskills\u002Fagents did not load.","Qtrick\u002Fprebasecode","Qtrick","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F141445503?v=4","01M78HD7H7KZCCZK56G86RHXHG","David Fan","01M78HD7J9D6W89KHEGD4BWBVN",0,"MIT","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Fsrc\u002Fvs\u002Fsessions\u002Fskills\u002Ftroubleshoot\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: troubleshoot\ndescription: Investigate unexpected behavior in the current Copilot CLI agent session by analyzing its event log. Use when the user asks why something happened, why a request was slow, why a tool was or was not used, or why instructions\u002Fskills\u002Fagents did not load.\n---\n\u003C!-- Customize this skill and select save to override its behavior. Delete that copy to restore the built-in behavior. -->\n\n# Troubleshoot\n\n## Purpose\n\nThis skill investigates and explains unexpected agent behavior in the **current Copilot CLI agent session** using its on-disk event log.\n\nUse this skill for questions like:\n- Why did this request take so long?\n- Why was a tool called (or not called)?\n- Why did an instruction\u002Fskill\u002Fagent file not load?\n- Why did a tool call fail?\n- Why did the model not follow expectations?\n\nBase every conclusion on evidence from the event log. Do not guess.\n\n## Locating the Session Log\n\nThe skill runs **inside** the session's agent, so the log is on the same machine. It lives outside the workspace — read it via the terminal (`run_in_terminal`), never `grep_search`.\n\n1. **If a `Session log:` path is provided with this message, use it.** It may point to a session **other than** the current one (via `#session`) and may be **comma-separated paths** — investigate all of them and compare.\n2. **Sticky reference:** if no path is on the *current* message but an earlier turn in **this conversation** already established a target (a `Session log:` path, or a `#session:` reference), keep analyzing **that same session** for the follow-up. Do **not** fall back to self-discovery here — the newest log is the *current* session, which is the wrong one. Switch only if the user references a new session.\n3. **Otherwise, self-discover it:** pick the **most recently modified** `events.jsonl` under `${XDG_STATE_HOME:-$HOME}\u002F.copilot\u002Fsession-state\u002F\u003CsessionId>\u002F` — this skill is appending to the current session's log, so it's reliably newest. Honor `XDG_STATE_HOME`, else `$HOME`.\n4. **If none exists** there, this isn't a Copilot CLI session — tell the user the skill supports Copilot CLI sessions only, and stop.\n\n## Data Source — `events.jsonl`\n\nEach line is a JSON object sharing one envelope:\n\n```json\n{ \"type\": \"...\", \"id\": \"...\", \"parentId\": \"...\", \"agentId\": \"...\", \"timestamp\": \"ISO-8601\", \"data\": { } }\n```\n\n- `type` — the event kind (see below).\n- `id` — unique event id.\n- `parentId` — the **chronologically preceding** event, not a logical parent. It is a flat back-pointer over every event, *not* the user → turn → tool-call hierarchy. Do not treat it as a logical parent.\n- `agentId` — present for sub-agent events; absent for the main agent and session-level events.\n- `timestamp` — ISO-8601 time. Compute durations by differencing timestamps (e.g. a tool's start vs. its completion, a turn's `assistant.turn_start` vs. the `assistant.message`).\n- `data` — type-specific payload.\n\n### Event types (`data.*` fields)\n\n- **`session.start`** (once) — `selectedModel`, `reasoningEffort`.\n- **`user.message`** — `content`; `transformedContent` (expanded prompt, when it differs).\n- **`assistant.turn_start` \u002F `assistant.turn_end`** — `turnId`; measure a turn's duration vs the following `assistant.message`.\n- **`assistant.message`** — `model`, `outputTokens`, `content`, `reasoningText` (thinking, when present), `turnId`, `parentToolCallId` (set ⇒ sub-agent turn spawned by that tool call).\n- **`tool.execution_start`** — `toolName`, `toolCallId`, `arguments`, `parentToolCallId` (set ⇒ nested\u002Fsub-agent).\n- **`tool.execution_complete`** — `toolCallId` (matches start), `success`, `result`. Pair with its start by `toolCallId` for the full call + duration.\n- **`session.shutdown`** (once, at end) — `modelMetrics[*].usage`, `totalNanoAiu`. Absent mid-session.\n- Other (`hook.*`, `permission.*`, `system.message`) — inspect `data` as needed.\n\n### Reconstructing the flow\n\nIterate records in order and rebuild the logical tree from context:\n- `session.start` is the root.\n- a `user.message` begins a turn.\n- an `assistant.message` answers the current `user.message` — unless it has `data.parentToolCallId`, in which case it belongs to the sub-agent spawned by that tool call.\n- a `tool.execution_start` belongs to the current `assistant.message` — unless it has `data.parentToolCallId`, in which case it is nested under that parent tool call.\n- pair each `tool.execution_start` with its `tool.execution_complete` by `toolCallId`.\n\n## Secondary Source — Agent Host Wire Log (protocol communication)\n\n`events.jsonl` is the **primary** source and answers almost every question on its own. A *separate* log captures the **transport\u002Fprotocol** between VS Code and the agent host process — the JSON-RPC-style frames that drive sessions.\n\n**Use the wire log only when the symptom points at the agent host \u002F transport itself, not the model or a tool.** Reach for it when:\n- the agent host won't start, or the session never begins;\n- requests **hang or time out**, or the agent appears stuck \"connecting\" \u002F unresponsive;\n- `createSession` \u002F `subscribe` fails, or expected updates\u002Fnotifications never arrive;\n- you see RPC \u002F protocol \u002F connection errors.\n\n**Do not** open it for ordinary \"why did the model\u002Ftool do X\" questions — `events.jsonl` already answers those. If `events.jsonl` fully explains the behavior, stop there and don't read the wire log.\n\n**It is written by VS Code on the _client_ machine, so it is only reachable for a _local_ agent host** (VS Code and the agent on the same machine). For a remote agent host it lives on the client, not the host this skill runs on — skip it there.\n\n### Location\n\n```\n\u003CVS Code user-data dir>\u002Flogs\u002F\u003Csession-timestamp>\u002Fahp\u002Fahp-\u003Ctimestamp>-\u003CconnectionId>.jsonl\n```\n\nThe VS Code user-data dir depends on the build:\n- Windows: `%APPDATA%\\Code` (Insiders: `Code - Insiders`; OSS\u002Fdev may use `Code - OSS` or a custom `--user-data-dir`)\n- macOS: `~\u002FLibrary\u002FApplication Support\u002FCode`\n- Linux: `~\u002F.config\u002FCode`\n\nA new `logs\u002F\u003Ctimestamp>\u002F` folder is created per VS Code session — pick the **most recently modified** `ahp\u002Fahp-*.jsonl`.\n\n**Named by _connection_ id, not session id** — one log **multiplexes all sessions on that connection** (no per-session file). Long connections rotate into `ahp-….1.jsonl`, `.2.jsonl`, … (max 5); the active one is the **most recently modified** (the locate commands pick it). Read the newest log for connection-level health; to isolate one session, filter by its id (the `session-state\u002F\u003CsessionId>\u002F` folder name, which appears in frames' `params`\u002F`result`).\n\n**If no `ahp\u002F` folder exists, the wire log is disabled** (it is off by default). Tell the user to set `\"chat.agentHost.ahpJsonlLoggingEnabled\": true`, restart VS Code, reproduce the issue, then re-run.\n\n### Format\n\nEach line is a JSON-RPC frame plus an `_ahpLog` envelope:\n\n```json\n{ \"jsonrpc\": \"2.0\", \"id\": 12, \"method\": \"createSession\", \"params\": {}, \"_ahpLog\": { \"ts\": \"ISO-8601\", \"dir\": \"c2s\", \"connectionId\": \"…\", \"transport\": \"local\" } }\n```\n\n- `_ahpLog.dir` — direction: `c2s` = VS Code → host (requests\u002Fnotifications), `s2c` = host → VS Code (results\u002Ferrors\u002Factions\u002Fnotifications).\n- `_ahpLog.transport` — `local` \u002F `websocket` \u002F `ssh` \u002F `wsl`.\n- Requests\u002Fnotifications carry `method` + `params`; responses carry `result` or `error` — pair a response to its request by `id`.\n- `_ahpLog.truncated: true` marks frames whose large payloads were elided.\n\nTriage: look for `error` frames, requests (`c2s` with an `id`) that have **no matching `s2c` response** (hangs\u002Ftimeouts), or a missing `s2c` after `createSession` \u002F `subscribe`. Apply the same streaming \u002F `jq` \u002F `node` rules as for `events.jsonl`.\n\n### Locating it (terminal)\n- macOS\u002FLinux: `ls -t ~\u002FLibrary\u002FApplication\\ Support\u002FCode*\u002Flogs\u002F*\u002Fahp\u002Fahp-*.jsonl ~\u002F.config\u002FCode*\u002Flogs\u002F*\u002Fahp\u002Fahp-*.jsonl 2>\u002Fdev\u002Fnull | head -n 1`\n- Windows (PowerShell): `Get-ChildItem \"$env:APPDATA\\Code*\\logs\\*\\ahp\\ahp-*.jsonl\" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1`\n\n## Tooling Strategy (important)\n\nThe event log is outside the workspace, so `grep_search` cannot read it. **Use `run_in_terminal`.**\n\n### Do a single triage pass first (important for efficiency)\n\nEach terminal command is a separate round-trip, so **don't run one command per question.** Do **one streaming pass** (constant memory — `events.jsonl` can be hundreds of MB, so never load it whole) that prints, in a single read:\n- the event counts by type,\n- every tool call with success\u002Ffailure and duration (pair each `tool.execution_start` with its `tool.execution_complete` by `toolCallId`),\n- the user messages.\n\nUse a streaming `jq` program (macOS\u002FLinux) or a streaming Node `readline` pass (Windows) — the per-query examples below are the building blocks. Then run targeted follow-ups only to drill in.\n\n### macOS \u002F Linux \u002F WSL \u002F Git Bash (`grep` \u002F `jq`)\n- Locate the newest log: `ls -t \"${XDG_STATE_HOME:-$HOME}\"\u002F.copilot\u002Fsession-state\u002F*\u002Fevents.jsonl | head -n 1`\n- Check size first: `ls -lh \u003ClogPath>`\n- Errors: `grep '\"success\":false' \u003ClogPath>` (tool failures) and `grep '\"type\":\"tool.execution_complete\"' \u003ClogPath>`\n- Count events by type (streaming): `jq -nr 'reduce inputs as $i ({}; .[$i.type] += 1) | to_entries | sort_by(-.value)[] | \"\\(.value) \\(.key)\"' \u003ClogPath>`\n- Tool calls: `jq -c 'select(.type==\"tool.execution_start\") | {tool:.data.toolName, id:.data.toolCallId}' \u003ClogPath>`\n- User messages: `jq -c 'select(.type==\"user.message\") | .data.content' \u003ClogPath>`\n- Assistant turns: `jq -c 'select(.type==\"assistant.message\") | {model:.data.model, out:.data.outputTokens}' \u003ClogPath>`\n\n### Windows (PowerShell + Node.js)\n**Do not parse the log with PowerShell JSON.** `Get-Content … | ForEach-Object { ConvertFrom-Json }` (or any per-line `ConvertFrom-Json`) deserializes one object at a time and is slow even on small logs. Use `Select-String` for plain-text matches and a **streaming** `node` pass for anything that needs JSON. Use `jq` instead if it is available.\n\n- Locate the newest log:\n  ```powershell\n  $stateHome = if ($env:XDG_STATE_HOME) { $env:XDG_STATE_HOME } else { $HOME }\n  Get-ChildItem (Join-Path $stateHome '.copilot\\session-state\\*\\events.jsonl') | Sort-Object LastWriteTime -Descending | Select-Object -First 1\n  ```\n- Check size first: `(Get-Item \u003ClogPath>).Length`\n- Plain-text matches (fast, streaming, no parsing): `Select-String '\"success\":false' \u003ClogPath>`\n- JSON queries — a **streaming** `node` pass (constant memory, safe for hundreds-of-MB logs; pass the log path as an argument so it stays quote-safe). Use this shape and change only the per-line `if (…)` to select what you need (tool failures, tool calls, assistant turns, …):\n    `node -e \"const rl=require('readline').createInterface({input:require('fs').createReadStream(process.argv[1])});rl.on('line',l=>{if(!l)return;let x;try{x=JSON.parse(l)}catch{return}if(x.type==='tool.execution_complete'&&x.data.success===false)console.log(x.data.toolCallId,JSON.stringify(x.data.result))})\" \"\u003ClogPath>\"`\n  For aggregates (e.g. counts by type), accumulate into an object as you go and print it on `rl.on('close', …)`.\n- For a very large log, narrow with `Select-String` first to find the line, then read that small slice with `read_file`.\n\n### General rules\n- **One streaming pass, not many.** Each command is a round-trip; prefer the single triage pass, then targeted follow-ups. Never load a whole (hundreds-of-MB) log into memory (`readFileSync` \u002F `Get-Content`) — stream (`jq` \u002F the readline pass) or narrow with `grep` \u002F `Select-String` first. Check size first if unsure (`ls -lh` \u002F `(Get-Item).Length`).\n- **Never deserialize JSON line-by-line in the shell** (PowerShell `ConvertFrom-Json` in a loop) — slow. Use one `jq` filter or one `node` pass.\n- Use `read_file` only for small targeted ranges, never an entire log.\n\n## Investigation Workflow\n\n1. Locate `events.jsonl` and run the single triage pass.\n2. Match the symptom: **errors** → `success:false`; **latency** → gaps between `assistant.turn_start` and its `assistant.message`, or a tool's start↔complete; **tool \u002F model \u002F input** → the relevant event type; **agent-host \u002F transport** failure (local) → also the Wire Log.\n3. Read only the relevant slices, then determine the most likely root cause (order contributing factors by impact) and give concrete next steps.\n\n## Response Guidelines\n\nCover **what happened and why** (root cause), **key evidence** (paraphrased — quote only a telling detail like an error message, never raw dumps), and **how to fix it**. A short combined explanation is fine; add structure (headers, bullets, tables) only for complex, multi-factor issues. Keep paragraphs short.\n\n**Abstraction:** don't narrate your investigation or use internal terms (`events.jsonl`, `tool.execution_start`, `parentId`, \"envelope\"). Refer to \"the session log\" abstractly. Focus on what happened and why, not how you found it.\n\n**Example** — instead of \"I read events.jsonl and saw a `tool.execution_complete` with `success:false`…\", say:\n\n> The \"testing\" skill was found but not loaded because the folder name and the name in the skill file differ (`testing` vs `testing2`). **Fix:** make them match (rename the folder or change the name), then start a new session.\n\n## Important Rules\n\n- Base every claim on log evidence — never assume causality.\n- Search via `run_in_terminal`; never `grep_search`, and never `read_file` a whole (possibly huge) log — narrow first, then read small ranges.\n- If no Copilot CLI session log exists, say so and stop.\n","\u003C!-- Customize this skill and select save to override its behavior. Delete that copy to restore the built-in behavior. -->\n\n# Troubleshoot\n\n## Purpose\n\nThis skill investigates and explains unexpected agent behavior in the **current Copilot CLI agent session** using its on-disk event log.\n\nUse this skill for questions like:\n- Why did this request take so long?\n- Why was a tool called (or not called)?\n- Why did an instruction\u002Fskill\u002Fagent file not load?\n- Why did a tool call fail?\n- Why did the model not follow expectations?\n\nBase every conclusion on evidence from the event log. Do not guess.\n\n## Locating the Session Log\n\nThe skill runs **inside** the session's agent, so the log is on the same machine. It lives outside the workspace — read it via the terminal (`run_in_terminal`), never `grep_search`.\n\n1. **If a `Session log:` path is provided with this message, use it.** It may point to a session **other than** the current one (via `#session`) and may be **comma-separated paths** — investigate all of them and compare.\n2. **Sticky reference:** if no path is on the *current* message but an earlier turn in **this conversation** already established a target (a `Session log:` path, or a `#session:` reference), keep analyzing **that same session** for the follow-up. Do **not** fall back to self-discovery here — the newest log is the *current* session, which is the wrong one. Switch only if the user references a new session.\n3. **Otherwise, self-discover it:** pick the **most recently modified** `events.jsonl` under `${XDG_STATE_HOME:-$HOME}\u002F.copilot\u002Fsession-state\u002F\u003CsessionId>\u002F` — this skill is appending to the current session's log, so it's reliably newest. Honor `XDG_STATE_HOME`, else `$HOME`.\n4. **If none exists** there, this isn't a Copilot CLI session — tell the user the skill supports Copilot CLI sessions only, and stop.\n\n## Data Source — `events.jsonl`\n\nEach line is a JSON object sharing one envelope:\n\n```json\n{ \"type\": \"...\", \"id\": \"...\", \"parentId\": \"...\", \"agentId\": \"...\", \"timestamp\": \"ISO-8601\", \"data\": { } }\n```\n\n- `type` — the event kind (see below).\n- `id` — unique event id.\n- `parentId` — the **chronologically preceding** event, not a logical parent. It is a flat back-pointer over every event, *not* the user → turn → tool-call hierarchy. Do not treat it as a logical parent.\n- `agentId` — present for sub-agent events; absent for the main agent and session-level events.\n- `timestamp` — ISO-8601 time. Compute durations by differencing timestamps (e.g. a tool's start vs. its completion, a turn's `assistant.turn_start` vs. the `assistant.message`).\n- `data` — type-specific payload.\n\n### Event types (`data.*` fields)\n\n- **`session.start`** (once) — `selectedModel`, `reasoningEffort`.\n- **`user.message`** — `content`; `transformedContent` (expanded prompt, when it differs).\n- **`assistant.turn_start` \u002F `assistant.turn_end`** — `turnId`; measure a turn's duration vs the following `assistant.message`.\n- **`assistant.message`** — `model`, `outputTokens`, `content`, `reasoningText` (thinking, when present), `turnId`, `parentToolCallId` (set ⇒ sub-agent turn spawned by that tool call).\n- **`tool.execution_start`** — `toolName`, `toolCallId`, `arguments`, `parentToolCallId` (set ⇒ nested\u002Fsub-agent).\n- **`tool.execution_complete`** — `toolCallId` (matches start), `success`, `result`. Pair with its start by `toolCallId` for the full call + duration.\n- **`session.shutdown`** (once, at end) — `modelMetrics[*].usage`, `totalNanoAiu`. Absent mid-session.\n- Other (`hook.*`, `permission.*`, `system.message`) — inspect `data` as needed.\n\n### Reconstructing the flow\n\nIterate records in order and rebuild the logical tree from context:\n- `session.start` is the root.\n- a `user.message` begins a turn.\n- an `assistant.message` answers the current `user.message` — unless it has `data.parentToolCallId`, in which case it belongs to the sub-agent spawned by that tool call.\n- a `tool.execution_start` belongs to the current `assistant.message` — unless it has `data.parentToolCallId`, in which case it is nested under that parent tool call.\n- pair each `tool.execution_start` with its `tool.execution_complete` by `toolCallId`.\n\n## Secondary Source — Agent Host Wire Log (protocol communication)\n\n`events.jsonl` is the **primary** source and answers almost every question on its own. A *separate* log captures the **transport\u002Fprotocol** between VS Code and the agent host process — the JSON-RPC-style frames that drive sessions.\n\n**Use the wire log only when the symptom points at the agent host \u002F transport itself, not the model or a tool.** Reach for it when:\n- the agent host won't start, or the session never begins;\n- requests **hang or time out**, or the agent appears stuck \"connecting\" \u002F unresponsive;\n- `createSession` \u002F `subscribe` fails, or expected updates\u002Fnotifications never arrive;\n- you see RPC \u002F protocol \u002F connection errors.\n\n**Do not** open it for ordinary \"why did the model\u002Ftool do X\" questions — `events.jsonl` already answers those. If `events.jsonl` fully explains the behavior, stop there and don't read the wire log.\n\n**It is written by VS Code on the _client_ machine, so it is only reachable for a _local_ agent host** (VS Code and the agent on the same machine). For a remote agent host it lives on the client, not the host this skill runs on — skip it there.\n\n### Location\n\n```\n\u003CVS Code user-data dir>\u002Flogs\u002F\u003Csession-timestamp>\u002Fahp\u002Fahp-\u003Ctimestamp>-\u003CconnectionId>.jsonl\n```\n\nThe VS Code user-data dir depends on the build:\n- Windows: `%APPDATA%\\Code` (Insiders: `Code - Insiders`; OSS\u002Fdev may use `Code - OSS` or a custom `--user-data-dir`)\n- macOS: `~\u002FLibrary\u002FApplication Support\u002FCode`\n- Linux: `~\u002F.config\u002FCode`\n\nA new `logs\u002F\u003Ctimestamp>\u002F` folder is created per VS Code session — pick the **most recently modified** `ahp\u002Fahp-*.jsonl`.\n\n**Named by _connection_ id, not session id** — one log **multiplexes all sessions on that connection** (no per-session file). Long connections rotate into `ahp-….1.jsonl`, `.2.jsonl`, … (max 5); the active one is the **most recently modified** (the locate commands pick it). Read the newest log for connection-level health; to isolate one session, filter by its id (the `session-state\u002F\u003CsessionId>\u002F` folder name, which appears in frames' `params`\u002F`result`).\n\n**If no `ahp\u002F` folder exists, the wire log is disabled** (it is off by default). Tell the user to set `\"chat.agentHost.ahpJsonlLoggingEnabled\": true`, restart VS Code, reproduce the issue, then re-run.\n\n### Format\n\nEach line is a JSON-RPC frame plus an `_ahpLog` envelope:\n\n```json\n{ \"jsonrpc\": \"2.0\", \"id\": 12, \"method\": \"createSession\", \"params\": {}, \"_ahpLog\": { \"ts\": \"ISO-8601\", \"dir\": \"c2s\", \"connectionId\": \"…\", \"transport\": \"local\" } }\n```\n\n- `_ahpLog.dir` — direction: `c2s` = VS Code → host (requests\u002Fnotifications), `s2c` = host → VS Code (results\u002Ferrors\u002Factions\u002Fnotifications).\n- `_ahpLog.transport` — `local` \u002F `websocket` \u002F `ssh` \u002F `wsl`.\n- Requests\u002Fnotifications carry `method` + `params`; responses carry `result` or `error` — pair a response to its request by `id`.\n- `_ahpLog.truncated: true` marks frames whose large payloads were elided.\n\nTriage: look for `error` frames, requests (`c2s` with an `id`) that have **no matching `s2c` response** (hangs\u002Ftimeouts), or a missing `s2c` after `createSession` \u002F `subscribe`. Apply the same streaming \u002F `jq` \u002F `node` rules as for `events.jsonl`.\n\n### Locating it (terminal)\n- macOS\u002FLinux: `ls -t ~\u002FLibrary\u002FApplication\\ Support\u002FCode*\u002Flogs\u002F*\u002Fahp\u002Fahp-*.jsonl ~\u002F.config\u002FCode*\u002Flogs\u002F*\u002Fahp\u002Fahp-*.jsonl 2>\u002Fdev\u002Fnull | head -n 1`\n- Windows (PowerShell): `Get-ChildItem \"$env:APPDATA\\Code*\\logs\\*\\ahp\\ahp-*.jsonl\" -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1`\n\n## Tooling Strategy (important)\n\nThe event log is outside the workspace, so `grep_search` cannot read it. **Use `run_in_terminal`.**\n\n### Do a single triage pass first (important for efficiency)\n\nEach terminal command is a separate round-trip, so **don't run one command per question.** Do **one streaming pass** (constant memory — `events.jsonl` can be hundreds of MB, so never load it whole) that prints, in a single read:\n- the event counts by type,\n- every tool call with success\u002Ffailure and duration (pair each `tool.execution_start` with its `tool.execution_complete` by `toolCallId`),\n- the user messages.\n\nUse a streaming `jq` program (macOS\u002FLinux) or a streaming Node `readline` pass (Windows) — the per-query examples below are the building blocks. Then run targeted follow-ups only to drill in.\n\n### macOS \u002F Linux \u002F WSL \u002F Git Bash (`grep` \u002F `jq`)\n- Locate the newest log: `ls -t \"${XDG_STATE_HOME:-$HOME}\"\u002F.copilot\u002Fsession-state\u002F*\u002Fevents.jsonl | head -n 1`\n- Check size first: `ls -lh \u003ClogPath>`\n- Errors: `grep '\"success\":false' \u003ClogPath>` (tool failures) and `grep '\"type\":\"tool.execution_complete\"' \u003ClogPath>`\n- Count events by type (streaming): `jq -nr 'reduce inputs as $i ({}; .[$i.type] += 1) | to_entries | sort_by(-.value)[] | \"\\(.value) \\(.key)\"' \u003ClogPath>`\n- Tool calls: `jq -c 'select(.type==\"tool.execution_start\") | {tool:.data.toolName, id:.data.toolCallId}' \u003ClogPath>`\n- User messages: `jq -c 'select(.type==\"user.message\") | .data.content' \u003ClogPath>`\n- Assistant turns: `jq -c 'select(.type==\"assistant.message\") | {model:.data.model, out:.data.outputTokens}' \u003ClogPath>`\n\n### Windows (PowerShell + Node.js)\n**Do not parse the log with PowerShell JSON.** `Get-Content … | ForEach-Object { ConvertFrom-Json }` (or any per-line `ConvertFrom-Json`) deserializes one object at a time and is slow even on small logs. Use `Select-String` for plain-text matches and a **streaming** `node` pass for anything that needs JSON. Use `jq` instead if it is available.\n\n- Locate the newest log:\n  ```powershell\n  $stateHome = if ($env:XDG_STATE_HOME) { $env:XDG_STATE_HOME } else { $HOME }\n  Get-ChildItem (Join-Path $stateHome '.copilot\\session-state\\*\\events.jsonl') | Sort-Object LastWriteTime -Descending | Select-Object -First 1\n  ```\n- Check size first: `(Get-Item \u003ClogPath>).Length`\n- Plain-text matches (fast, streaming, no parsing): `Select-String '\"success\":false' \u003ClogPath>`\n- JSON queries — a **streaming** `node` pass (constant memory, safe for hundreds-of-MB logs; pass the log path as an argument so it stays quote-safe). Use this shape and change only the per-line `if (…)` to select what you need (tool failures, tool calls, assistant turns, …):\n    `node -e \"const rl=require('readline').createInterface({input:require('fs').createReadStream(process.argv[1])});rl.on('line',l=>{if(!l)return;let x;try{x=JSON.parse(l)}catch{return}if(x.type==='tool.execution_complete'&&x.data.success===false)console.log(x.data.toolCallId,JSON.stringify(x.data.result))})\" \"\u003ClogPath>\"`\n  For aggregates (e.g. counts by type), accumulate into an object as you go and print it on `rl.on('close', …)`.\n- For a very large log, narrow with `Select-String` first to find the line, then read that small slice with `read_file`.\n\n### General rules\n- **One streaming pass, not many.** Each command is a round-trip; prefer the single triage pass, then targeted follow-ups. Never load a whole (hundreds-of-MB) log into memory (`readFileSync` \u002F `Get-Content`) — stream (`jq` \u002F the readline pass) or narrow with `grep` \u002F `Select-String` first. Check size first if unsure (`ls -lh` \u002F `(Get-Item).Length`).\n- **Never deserialize JSON line-by-line in the shell** (PowerShell `ConvertFrom-Json` in a loop) — slow. Use one `jq` filter or one `node` pass.\n- Use `read_file` only for small targeted ranges, never an entire log.\n\n## Investigation Workflow\n\n1. Locate `events.jsonl` and run the single triage pass.\n2. Match the symptom: **errors** → `success:false`; **latency** → gaps between `assistant.turn_start` and its `assistant.message`, or a tool's start↔complete; **tool \u002F model \u002F input** → the relevant event type; **agent-host \u002F transport** failure (local) → also the Wire Log.\n3. Read only the relevant slices, then determine the most likely root cause (order contributing factors by impact) and give concrete next steps.\n\n## Response Guidelines\n\nCover **what happened and why** (root cause), **key evidence** (paraphrased — quote only a telling detail like an error message, never raw dumps), and **how to fix it**. A short combined explanation is fine; add structure (headers, bullets, tables) only for complex, multi-factor issues. Keep paragraphs short.\n\n**Abstraction:** don't narrate your investigation or use internal terms (`events.jsonl`, `tool.execution_start`, `parentId`, \"envelope\"). Refer to \"the session log\" abstractly. Focus on what happened and why, not how you found it.\n\n**Example** — instead of \"I read events.jsonl and saw a `tool.execution_complete` with `success:false`…\", say:\n\n> The \"testing\" skill was found but not loaded because the folder name and the name in the skill file differ (`testing` vs `testing2`). **Fix:** make them match (rename the folder or change the name), then start a new session.\n\n## Important Rules\n\n- Base every claim on log evidence — never assume causality.\n- Search via `run_in_terminal`; never `grep_search`, and never `read_file` a whole (possibly huge) log — narrow first, then read small ranges.\n- If no Copilot CLI session log exists, say so and stop.\n",{"name":5,"description":7},"main","a87007e75a0e5632a49ac593bd7df9f4e8d57d38","src\u002Fvs\u002Fsessions\u002Fskills\u002Ftroubleshoot","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode","https:\u002F\u002Fgithub.com\u002FQtrick","2026-09-18 02:39:35",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add Qtrick\u002Fprebasecode --skill troubleshoot",{"tool":36,"command":37},"bunx","bunx skills add Qtrick\u002Fprebasecode --skill troubleshoot",{"tool":39,"command":40},"pnpm","pnpm dlx skills add Qtrick\u002Fprebasecode --skill troubleshoot","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Fsrc\u002Fvs\u002Fsessions\u002Fskills\u002Ftroubleshoot\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M78HRHDZJD3512KSR0GZPJ57","review","Review skill with nested metadata","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-skill-meta\u002F.agents\u002Fskills\u002Freview\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M78HRG98D7PY73KG63XAK5H6","ui-ux-pro-max","UI UX Pro Max design guidance","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-monorepo\u002F.opencode\u002Fskills\u002Fui-ux-pro-max\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M78HRFBCY0MBYVQ0HRXSV5GX","deploy","Deploy skill","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-monorepo\u002F.codex\u002Fskills\u002Fdeploy\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M78HRE6JKXTMJN9DHCF487YD","interop","Interoperable Agent Skill for live smoke","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-monorepo\u002F.agents\u002Fskills\u002Finterop\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M78HRCTZENSGRPZX2N148VDD","ship","Devin ship skill","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-extra-skills\u002F.devin\u002Fskills\u002Fship\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M78HRBVY4KCF8ZRJ2M8RYFRD","lint","Codeium lint skill","https:\u002F\u002Fgithub.com\u002FQtrick\u002Fprebasecode\u002Fblob\u002Fmain\u002Ftest\u002Fprebase\u002Ffixtures\u002Fproject-guidance-extra-skills\u002F.codeium\u002Fskills\u002Flint\u002FSKILL.md",[],[]]