[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X1SEN3N2GPF1ERTWXG98CC":3,"skill-same:01M6X1SEN3N2GPF1ERTWXG98CC":84},{"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":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":60,"commitSha":61,"skillDirectory":62,"forksCount":63,"repositoryHtmlUrl":64,"repositoryHomepageUrl":65,"ownerHtmlUrl":66,"ownerBlogUrl":67,"ownerDescription":68,"updatedAt":69,"install":70,"resources":83},"01M6X1SEN3N2GPF1ERTWXG98CC","session-recovery",null,"Find and resume interrupted Copilot CLI sessions using session_store queries","github\u002Fsquad","github","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F9919?v=4","01M6AC83DS133TPXFSP1DHNCC6","GitHub","01M6X0MZ6B0WYMMDPK3Q61KER6",3377,"MIT","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Fpackages\u002Fsquad-sdk\u002Ftemplates\u002Fskills\u002Fsession-recovery\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000038","人力资源","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"session recovery","recovery","session","source","cli","for","high","past","store","session history","query","queries","resume","find","history","database","sql","copilot","sessions","workflow","2026-11-10 10:12:30",false,"---\nname: \"session-recovery\"\ndescription: \"Find and resume interrupted Copilot CLI sessions using session_store queries\"\ndomain: \"workflow-recovery\"\nconfidence: \"high\"\nsource: \"earned\"\ntools:\n  - name: \"sql\"\n    description: \"Query session_store database for past session history\"\n    when: \"Always — session_store is the source of truth for session history\"\n---\n\n## Context\n\nSquad agents run in Copilot CLI sessions that can be interrupted — terminal crashes, network drops, machine restarts, or accidental window closes. When this happens, in-progress work may be left in a partially-completed state: branches with uncommitted changes, issues marked in-progress with no active agent, or checkpoints that were never finalized.\n\nCopilot CLI stores session history in a SQLite database called `session_store` (read-only, accessed via the `sql` tool with `database: \"session_store\"`). This skill teaches agents how to query that store to detect interrupted sessions and resume work.\n\n## Patterns\n\n### 1. Find Recent Sessions\n\nQuery the `sessions` table filtered by time window. Include the last checkpoint to understand where the session stopped:\n\n```sql\nSELECT\n  s.id,\n  s.summary,\n  s.cwd,\n  s.branch,\n  s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.updated_at >= datetime('now', '-24 hours')\nORDER BY s.updated_at DESC;\n```\n\n### 2. Filter Out Automated Sessions\n\nAutomated agents (monitors, keep-alive, heartbeat) create high-volume sessions that obscure human-initiated work. Exclude them:\n\n```sql\nSELECT s.id, s.summary, s.cwd, s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.updated_at >= datetime('now', '-24 hours')\n  AND s.id NOT IN (\n    SELECT DISTINCT t.session_id FROM turns t\n    WHERE t.turn_index = 0\n      AND (LOWER(t.user_message) LIKE '%keep-alive%'\n           OR LOWER(t.user_message) LIKE '%heartbeat%')\n  )\nORDER BY s.updated_at DESC;\n```\n\n### 3. Search by Topic (FTS5)\n\nUse the `search_index` FTS5 table for keyword search. Expand queries with synonyms since this is keyword-based, not semantic:\n\n```sql\nSELECT DISTINCT s.id, s.summary, s.cwd, s.updated_at\nFROM search_index si\nJOIN sessions s ON si.session_id = s.id\nWHERE search_index MATCH 'auth OR login OR token OR JWT'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC\nLIMIT 10;\n```\n\n### 4. Search by Working Directory\n\n```sql\nSELECT s.id, s.summary, s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.cwd LIKE '%my-project%'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC;\n```\n\n### 5. Get Full Session Context Before Resuming\n\nBefore resuming, inspect what the session was doing:\n\n```sql\n-- Conversation turns\nSELECT turn_index, substr(user_message, 1, 200) AS ask, timestamp\nFROM turns WHERE session_id = 'SESSION_ID' ORDER BY turn_index;\n\n-- Checkpoint progress\nSELECT checkpoint_number, title, overview\nFROM checkpoints WHERE session_id = 'SESSION_ID' ORDER BY checkpoint_number;\n\n-- Files touched\nSELECT file_path, tool_name\nFROM session_files WHERE session_id = 'SESSION_ID';\n\n-- Linked PRs\u002Fissues\u002Fcommits\nSELECT ref_type, ref_value\nFROM session_refs WHERE session_id = 'SESSION_ID';\n```\n\n### 6. Detect Orphaned Issue Work\n\nFind sessions that were working on issues but may not have completed:\n\n```sql\nSELECT DISTINCT s.id, s.branch, s.summary, s.updated_at,\n  sr.ref_type, sr.ref_value\nFROM sessions s\nJOIN session_refs sr ON s.id = sr.session_id\nWHERE sr.ref_type = 'issue'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC;\n```\n\nCross-reference with `gh issue list --label \"status:in-progress\"` to find issues that are marked in-progress but have no active session.\n\n### 7. Resume a Session\n\nOnce you have the session ID:\n\n```bash\n# Resume directly\ncopilot --resume SESSION_ID\n```\n\n## Examples\n\n**Recovering from a crash during PR creation:**\n1. Query recent sessions filtered by branch name\n2. Find the session that was working on the PR\n3. Check its last checkpoint — was the code committed? Was the PR created?\n4. Resume or manually complete the remaining steps\n\n**Finding yesterday's work on a feature:**\n1. Use FTS5 search with feature keywords\n2. Filter to the relevant working directory\n3. Review checkpoint progress to see how far the session got\n4. Resume if work remains, or start fresh with the context\n\n## Anti-Patterns\n\n- ❌ Searching by partial session IDs — always use full UUIDs\n- ❌ Resuming sessions that completed successfully — they have no pending work\n- ❌ Using `MATCH` with special characters without escaping — wrap paths in double quotes\n- ❌ Skipping the automated-session filter — high-volume automated sessions will flood results\n- ❌ Assuming FTS5 is semantic search — it's keyword-based; always expand queries with synonyms\n- ❌ Ignoring checkpoint data — checkpoints show exactly where the session stopped\n","## Context\n\nSquad agents run in Copilot CLI sessions that can be interrupted — terminal crashes, network drops, machine restarts, or accidental window closes. When this happens, in-progress work may be left in a partially-completed state: branches with uncommitted changes, issues marked in-progress with no active agent, or checkpoints that were never finalized.\n\nCopilot CLI stores session history in a SQLite database called `session_store` (read-only, accessed via the `sql` tool with `database: \"session_store\"`). This skill teaches agents how to query that store to detect interrupted sessions and resume work.\n\n## Patterns\n\n### 1. Find Recent Sessions\n\nQuery the `sessions` table filtered by time window. Include the last checkpoint to understand where the session stopped:\n\n```sql\nSELECT\n  s.id,\n  s.summary,\n  s.cwd,\n  s.branch,\n  s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.updated_at >= datetime('now', '-24 hours')\nORDER BY s.updated_at DESC;\n```\n\n### 2. Filter Out Automated Sessions\n\nAutomated agents (monitors, keep-alive, heartbeat) create high-volume sessions that obscure human-initiated work. Exclude them:\n\n```sql\nSELECT s.id, s.summary, s.cwd, s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.updated_at >= datetime('now', '-24 hours')\n  AND s.id NOT IN (\n    SELECT DISTINCT t.session_id FROM turns t\n    WHERE t.turn_index = 0\n      AND (LOWER(t.user_message) LIKE '%keep-alive%'\n           OR LOWER(t.user_message) LIKE '%heartbeat%')\n  )\nORDER BY s.updated_at DESC;\n```\n\n### 3. Search by Topic (FTS5)\n\nUse the `search_index` FTS5 table for keyword search. Expand queries with synonyms since this is keyword-based, not semantic:\n\n```sql\nSELECT DISTINCT s.id, s.summary, s.cwd, s.updated_at\nFROM search_index si\nJOIN sessions s ON si.session_id = s.id\nWHERE search_index MATCH 'auth OR login OR token OR JWT'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC\nLIMIT 10;\n```\n\n### 4. Search by Working Directory\n\n```sql\nSELECT s.id, s.summary, s.updated_at,\n  (SELECT title FROM checkpoints\n   WHERE session_id = s.id\n   ORDER BY checkpoint_number DESC LIMIT 1) AS last_checkpoint\nFROM sessions s\nWHERE s.cwd LIKE '%my-project%'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC;\n```\n\n### 5. Get Full Session Context Before Resuming\n\nBefore resuming, inspect what the session was doing:\n\n```sql\n-- Conversation turns\nSELECT turn_index, substr(user_message, 1, 200) AS ask, timestamp\nFROM turns WHERE session_id = 'SESSION_ID' ORDER BY turn_index;\n\n-- Checkpoint progress\nSELECT checkpoint_number, title, overview\nFROM checkpoints WHERE session_id = 'SESSION_ID' ORDER BY checkpoint_number;\n\n-- Files touched\nSELECT file_path, tool_name\nFROM session_files WHERE session_id = 'SESSION_ID';\n\n-- Linked PRs\u002Fissues\u002Fcommits\nSELECT ref_type, ref_value\nFROM session_refs WHERE session_id = 'SESSION_ID';\n```\n\n### 6. Detect Orphaned Issue Work\n\nFind sessions that were working on issues but may not have completed:\n\n```sql\nSELECT DISTINCT s.id, s.branch, s.summary, s.updated_at,\n  sr.ref_type, sr.ref_value\nFROM sessions s\nJOIN session_refs sr ON s.id = sr.session_id\nWHERE sr.ref_type = 'issue'\n  AND s.updated_at >= datetime('now', '-48 hours')\nORDER BY s.updated_at DESC;\n```\n\nCross-reference with `gh issue list --label \"status:in-progress\"` to find issues that are marked in-progress but have no active session.\n\n### 7. Resume a Session\n\nOnce you have the session ID:\n\n```bash\n# Resume directly\ncopilot --resume SESSION_ID\n```\n\n## Examples\n\n**Recovering from a crash during PR creation:**\n1. Query recent sessions filtered by branch name\n2. Find the session that was working on the PR\n3. Check its last checkpoint — was the code committed? Was the PR created?\n4. Resume or manually complete the remaining steps\n\n**Finding yesterday's work on a feature:**\n1. Use FTS5 search with feature keywords\n2. Filter to the relevant working directory\n3. Review checkpoint progress to see how far the session got\n4. Resume if work remains, or start fresh with the context\n\n## Anti-Patterns\n\n- ❌ Searching by partial session IDs — always use full UUIDs\n- ❌ Resuming sessions that completed successfully — they have no pending work\n- ❌ Using `MATCH` with special characters without escaping — wrap paths in double quotes\n- ❌ Skipping the automated-session filter — high-volume automated sessions will flood results\n- ❌ Assuming FTS5 is semantic search — it's keyword-based; always expand queries with synonyms\n- ❌ Ignoring checkpoint data — checkpoints show exactly where the session stopped\n",{"name":5,"tools":54,"domain":58,"source":59,"confidence":35,"description":7},[55],{"name":45,"when":56,"description":57},"Always — session_store is the source of truth for session history","Query session_store database for past session history","workflow-recovery","earned","dev","7b731ec97f35346bdc4fa87c3edaf16b808fc0ae","packages\u002Fsquad-sdk\u002Ftemplates\u002Fskills\u002Fsession-recovery",516,"https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad","https:\u002F\u002Fgithub.github.io\u002Fsquad\u002F","https:\u002F\u002Fgithub.com\u002Fgithub","https:\u002F\u002Fgithub.com\u002Fabout","How people build software.","2026-11-12 02:20:49",{"source":8,"skillName":5,"commands":71,"prompt":81,"zipAvailable":82},[72,75,78],{"tool":73,"command":74},"npx","npx skills add github\u002Fsquad --skill session-recovery",{"tool":76,"command":77},"bunx","bunx skills add github\u002Fsquad --skill session-recovery",{"tool":79,"command":80},"pnpm","pnpm dlx skills add github\u002Fsquad --skill session-recovery","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Fpackages\u002Fsquad-sdk\u002Ftemplates\u002Fskills\u002Fsession-recovery\u002FSKILL.md",true,[],[85,115,127,136,153,176],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":94,"publishedAt":49},"01M6X287DVJK1S91END9DSHETN","gh-aw-enlistment","Enlist a repository into Squad by installing the supported GitHub Agentic Workflows (gh-aw) bootstrap — with strict compilation, an explicit safe-update allowlist, and a human-reviewed bootstrap PR. Never auto-merges.","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Fworkflows\u002Fskills\u002Fgh-aw-enlistment\u002FSKILL.md",[91],{"categoryNo":92,"categoryName":93,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114],"gh aw enlistment","gh","safe","workflows","agentic workflows","identity","squad","update","compiling","actions","ci","Safety","preflight","guide","auto","files","human","pr creation","github cli","lock",{"skillNo":116,"name":117,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":121,"publishedAt":49},"01M6X27Y5119CSRQFFJCV6432R","My Skill","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftest-fixtures\u002Fskills-test-abb30454\u002Fmy-skill\u002FSKILL.md",[120],{"categoryNo":92,"categoryName":93,"taxonomyType":21,"taxonomyTypeDesc":22},[122,123,124,125,126],"my","my skill","testing","vitest","tester",{"skillNo":128,"name":129,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":133,"publishedAt":49},"01M6X27RWAYB2X9ER0MVRRKXGA","bad-skill","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftest-fixtures\u002Fskills-test-abb30454\u002Fbad-skill\u002FSKILL.md",[132],{"categoryNo":92,"categoryName":93,"taxonomyType":21,"taxonomyTypeDesc":22},[134,135],"bad","bad skill",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":142,"publishedAt":49},"01M6X27HBWM6V81KXYW5XQSWFJ","windows-compatibility","Cross-platform path handling and command patterns","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Fwindows-compatibility\u002FSKILL.md",[],[143,144,145,35,146,147,148,149,150,151,152],"windows compatibility","compatibility","windows","platform","path","bugs","git","command","patterns","cross-platform",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":49},"01M6X278Z6PF2YQN406RHJJWHG","versioning-policy","SemVer rules for Squad's stable, preview, insider, and local package versions","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Fversioning-policy\u002FSKILL.md",[],[160,161,162,163,164,101,165,166,167,168,105,169,170,171,172,173,174,175,35,34],"versioning","versioning policy","policy","preview","pr","release","semver","npm","package","workspace","Rules","incident","local","resolution","channels","insider",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":186,"publishedAt":49},"01M6X26XS6T23E81XNP51HMQAT","tiered-memory","Three-tier agent memory model (hot\u002Fcold\u002Fwiki) for context reduction per spawn","https:\u002F\u002Fgithub.com\u002Fgithub\u002Fsquad\u002Fblob\u002Fdev\u002Ftemplates\u002Fskills\u002Ftiered-memory\u002FSKILL.md",[182,185],{"categoryNo":183,"categoryName":184,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":92,"categoryName":93,"taxonomyType":21,"taxonomyTypeDesc":22},[187,188,189,190,191,192,193,194,34,195,196,197,198,199,200,201],"memory","tiered memory","model","wiki","agent memory","performance","cold","memory-management","runtime","three","spawn","proposal","management","design","context"]