[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7ECKBVC79ZV3EMWV26F8DYJ":3,"skill-same:01M7ECKBVC79ZV3EMWV26F8DYJ":49},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":13,"repositoryHtmlUrl":25,"repositoryHomepageUrl":6,"ownerHtmlUrl":26,"ownerBlogUrl":6,"ownerDescription":27,"updatedAt":28,"install":29,"resources":42},"01M7ECKBVC79ZV3EMWV26F8DYJ","resuming-interrupted-sessions",null,"jonahthan433\u002FCortexOS","jonahthan433","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F211465495?v=4","01M7ECH9HPHGA89DCXHHJBTS3C","jonah.ai","01M7ECH9JCEM45DZMWPT7148S1",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fresuming-interrupted-sessions\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"# resuming-interrupted-sessions\n\n# Resuming Interrupted Sessions\n\nThis user opens sessions with \"can we continue from where we stopped\" routinely — the\nskill exists because a plain `session_search` read truncates on big sessions and\ninterrupted commands need side-effect checks before re-running.\n\n## Flow\n1. `session_search()` (browse) → pick the newest session whose title\u002Fpreview matches.\n2. `session_search(session_id=...)` to read it — but **large sessions truncate** (~100K+\n   chars). Fall back to direct DB forensics (below) for the tail.\n3. Find what the LAST user message asked and what the last tool run was doing. If the\n   session ended with `[Command interrupted]` (exit 130), the work is usually NOT done —\n   resume there.\n\n## state.db forensics (when session_search output is truncated)\nsqlite3 CLI is often absent on this host — use python3's module:\n`~\u002F.hermes\u002Fstate.db`, table `messages` (columns: `id, session_id, role, content,\ntool_call_id, tool_calls, tool_name, timestamp, reasoning, ...`).\n\n- Tail of a session:\n  `SELECT role, content FROM messages WHERE session_id=? AND role IN ('user','assistant') AND content != '' ORDER BY id DESC LIMIT 8`\n- All user asks (thread of intent):\n  `... role='user' AND content != '' ORDER BY id ASC LIMIT 12`\n- Window by id: `... id BETWEEN ? AND ? ORDER BY id ASC` — reconstructs the exact\n  sequence around an interruption.\n\nKey facts learned the hard way:\n- **Tool rows store OUTPUT only, not the command\u002Fargs.** To reconstruct what was about\n  to run, read the assistant message's `reasoning` column (holds the plan + command\n  intent) and the assistant `content` before it.\n- **`[Command interrupted]` = user stop, not test failure.** Before re-running, verify\n  side effects: check for the expected output file, task\u002Frecord creation, etc. An\n  interrupted command may have never executed (missing output file = never ran) OR\n  executed before the kill (orphan) — the reasoning column usually notes which was\n  confirmed.\n- `exit_code 130` on a terminal tool = interrupted; `2` = file not found (e.g. the\n  output-file check ran on the wrong host — paths like `\u002Froot\u002Flive_qpu_out.txt` live\n  INSIDE the LXC, check via `pct exec`).\n\n## SSH reminder\nPlain `ssh root@192.168.1.11` fails — the ninyi key is `~\u002F.ssh\u002Fhermes_ninyi`:\n`ssh -i ~\u002F.ssh\u002Fhermes_ninyi -o BatchMode=yes root@192.168.1.11 \"pct exec 105 -- \u003Ccmd>\"`.\n\n## Pitfalls\n- Don't re-run an interrupted command blindly — check for orphan side effects first\n  (a QPU task \u002F payment \u002F deploy may have landed before the kill).\n- Interrupted background runs: `process(action='list'\u002F'poll')` before restarting; a\n  stale session may still be running.\n- **Never restart the gateway that hosts your session as a step you still need to\n  complete after.** `systemctl --user restart hermes-gateway` (or any service the\n  agent loop runs inside) kills the in-flight run mid-turn — the final message is\n  never delivered and the user sees a silent cut. If a gateway restart MUST happen\n  as part of the work (e.g. verifying a config change), detach it so it fires AFTER\n  your final response: `systemd-run --user --on-active=120s --unit=gw-verify \u002Fpath\u002Fverify.sh`\n  — the transient unit escapes the gateway's cgroup (KillMode=mixed only SIGTERMs\n  the main process), so it survives the restart and confirms via its own channel\n  (log file + Telegram `sendMessage` via bot token from `.env`, never a secret\n  printed). The final assistant message goes out immediately; the restart fires\n  later. If the run still gets cut, resume with this skill's normal flow (the\n  interruption marker + reasoning column will show the scheduled restart).\n",{},"main","38b32c99e7ed0b8e215d638e92cfa452c1ec3079","skills\u002Fimported\u002F.archive\u002Fresuming-interrupted-sessions","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS","https:\u002F\u002Fgithub.com\u002Fjonahthan433","AI Consultant","2026-10-24 05:13:39",{"source":7,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add jonahthan433\u002FCortexOS --skill resuming-interrupted-sessions",{"tool":35,"command":36},"bunx","bunx skills add jonahthan433\u002FCortexOS --skill resuming-interrupted-sessions",{"tool":38,"command":39},"pnpm","pnpm dlx skills add jonahthan433\u002FCortexOS --skill resuming-interrupted-sessions","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fresuming-interrupted-sessions\u002FSKILL.md",true,[43],{"path":44,"resourceType":45,"resourceTypeDesc":46,"sizeBytes":47,"sourceHtmlUrl":48},"skill.json","REFERENCE","参考文档",389,"https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fimported\u002F.archive\u002Fresuming-interrupted-sessions\u002Fskill.json",[50,56,62,68,74,80],{"skillNo":51,"name":52,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":18},"01M7EDQZDQX3Q8Y7GCQX6KN9V7","opportunity-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fsales\u002Fopportunity-brief\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":18},"01M7EDQYA0V9Y99VKBREJJ3MRT","morning-intel","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fmorning-intel\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7EDQVX1JVY0B6PDHKKGM19G","decision-brief","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fresearch\u002Fdecision-brief\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M7EDQV1GENZAC2SZSD8KZ3GM","weekly-review","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fweekly-review\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M7EDQT2KETJ1Y3CGVN9EKW2J","system-health","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fsystem-health\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M7EDQQN2JK3XPWMS1M4T0F3K","backup-restore","https:\u002F\u002Fgithub.com\u002Fjonahthan433\u002FCortexOS\u002Fblob\u002Fmain\u002Fskills\u002Fops\u002Fbackup-restore\u002FSKILL.md",[],[]]