[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70SJ3216A0Y2NXYJJ2MVER0":3,"skill-same:01M70SJ3216A0Y2NXYJJ2MVER0":67},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M70SJ3216A0Y2NXYJJ2MVER0","verify-session-flow",null,"Formally verify the interactive session flow before or after changing it. Use when editing internal\u002Ftui\u002Ftui.go's handleKey, handleInterruptKey, handleInputSubmit, ctrlCCount or quitting, internal\u002Ftui\u002Fagent_loop.go's enqueuePrompt, submit, steerPrompt, cancelAgent or handleAgentDone, or the deferred-init splash — or when a user reports that Ctrl+C quit on the first press, that Esc did not stop a turn or a goal loop, that a queued prompt was lost when they canceled, or that the TUI hung on a spinner nothing could clear.","dimetron\u002Fpi-go","dimetron","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F877433?v=4","01M6E34QX9HKYKMWJVZQEPR2Q3","Dmytro Rashko","01M6E34R2A6563XM0PTZE8KPGG",224,"MIT","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"verify session flow","verify","flow","session","tui","spinner","go","clear","CTRL","goal","first","reports","interactive","when","prompt","loop","use","init","editing","submit","2026-11-10 10:12:30",false,"---\nname: verify-session-flow\ndescription: Formally verify the interactive session flow before or after changing it. Use when editing internal\u002Ftui\u002Ftui.go's handleKey, handleInterruptKey, handleInputSubmit, ctrlCCount or quitting, internal\u002Ftui\u002Fagent_loop.go's enqueuePrompt, submit, steerPrompt, cancelAgent or handleAgentDone, or the deferred-init splash — or when a user reports that Ctrl+C quit on the first press, that Esc did not stop a turn or a goal loop, that a queued prompt was lost when they canceled, or that the TUI hung on a spinner nothing could clear.\n---\n\n# Verify the session flow\n\nThis is the model of what a person sees: launch, type, wait, cancel, quit. It\nexists because the two failures a user actually notices are structural — a session\nthat cannot be interrupted, and a quit that discards work — and both span several\nhandlers, so neither is visible in a unit test of any one of them.\n\nThe properties: **the Ctrl+C quit needs two presses**, **Esc stops an armed goal\nloop**, **a canceled turn hands its queued prompt to the next turn rather than\ndropping it**, and **no TUI state is a dead end**.\n\n## Does my change touch the verified code\n\n```bash\ngit diff --stat \u003Csync-commit>..HEAD -- \\\n  internal\u002Ftui\u002Ftui.go internal\u002Ftui\u002Fagent_loop.go internal\u002Ftui\u002Fcommands.go \\\n  internal\u002Ftui\u002Fgoal.go internal\u002Fautocompact\u002Fhook.go\n```\n\n**Model covers** (each model step names the handler it stands for):\n\n| Model action | Code |\n|---|---|\n| `InitProgress` \u002F `InitDone` \u002F `InitFailed` | the deferred-init splash, `tui.go:563-565, 2391-2417` |\n| `SubmitIdle` | `handleInputSubmit` → `enqueuePrompt` → `submit`, `tui.go:783`, `agent_loop.go:985-1049` |\n| `SubmitSteers` | while busy, a prompt steers instead of queueing, `tui.go:785-787`, `agent_loop.go:961-975` |\n| `GoalCycleQueues` | a goal cycle's own prompt occupies the queue, `goal.go:284-296` |\n| `TurnEndQueued` \u002F `TurnEndIdle` \u002F `TurnEndGoalCycle` | `handleAgentDone`, `agent_loop.go:2013-2075` |\n| `EscBusy` \u002F `EscIdle` | `handleInterruptKey`, `tui.go:1273-1281` |\n| `CtrlCBusyFirst` \u002F `CtrlCBusyAgain` \u002F `CtrlCIdleFirst` \u002F `CtrlCIdleSecond` | `tui.go:1283-1297` |\n| `CtrlCTimerFires` | `resetCtrlCCount`, `tui.go:2353-2359` |\n| `CancelSettlesToIdle` \u002F `CancelSettlesToQueued` | `cancelAgent`, `agent_loop.go:830-874` |\n| `GoalSetIdle` \u002F `GoalStop` | `handleGoalCommand`, `goal.go:361-400` |\n| `Quit` \u002F `QuitIdle` | `tea.Quit`, `\u002Fquit` |\n\n**Not modelled, and why:** the modal overlays (commit, login, skill-create,\nbranch and search popups). Each is a pointer that either swallows or forwards a\nkey; none can strand a running turn, and the ordering claim they make is the\nfive-line handler list in `handleKey` (`tui.go:1144-1151`), which a reader checks\nby eye. Also out of scope: rendering, scrolling, the diff sidebar, `\u002Frun` and\n`\u002Fpr-autofix` (separate machines), and the pre-turn compaction hook, whose\nguarantee is only that it never aborts a turn.\n\n## Run it\n\n```bash\nhack\u002Fformal\u002Fcheck.sh session           # all rules hold, or the first that breaks\nhack\u002Fformal\u002Fcheck.sh session --chart   # draw the session flow\n```\n\nCost: 34 distinct states, under a second. Deadlock checking is **on** and must\nstay on: with it off, a lost-prompt regression passes, which is how an earlier\nversion of this check was green while proving nothing.\n\n## Read a result\n\n**A rule broke** — the shortest step sequence names the presses in order. Replay\nit as a Bubble Tea test in `internal\u002Ftui` (the `goal_loop_e2e_test.go` pattern\ndrives the real `Update` loop) before calling it a bug. **`Deadlock` reported** —\na state with no step out. Every state except `closed` should have one; a dead end\nin `canceling` means the user is watching a spinner nothing will clear.\n\n## Rules, and the harm each one names\n\n| Rule | The promise | What breaking it means for a user |\n|---|---|---|\n| `TwoPressesToQuit` | the Ctrl+C quit path needs two presses | one tap ends the session; the \"again to quit\" warning is a lie |\n| `CtrlCBounded` | the counter never exceeds 2 | \"again to quit\" would need a third press |\n| `IdleHasNoArmedGoal` | Esc\u002FCtrl+C disarm a goal loop, so an idle session never self-restarts | a stopped goal spends another billed turn |\n| `CancelDoesNotStrandTheQueue` | a settled cancel has handed its queued prompt on | a prompt you typed vanishes |\n| `NoLostPrompt` | a queued prompt only exists while a turn runs or cancels | a prompt sits in the queue with nothing to start it |\n| `SteerOnlyWhileBusy` | a steer belongs to a running or canceling turn | a stale steer hijacks the next prompt |\n| `ClosedOnlyFromQuitting` | the terminal closes only via the quit path | the UI is torn down under a live turn |\n| `NoDeadlock` (implicit) | every state but `closed` has a step out | a hung TUI |\n\n## What this model has already caught\n\n- **Esc had to disarm the goal loop.** An early version left `goalArmed` set\n  across `EscBusy`, and `IdleHasNoArmedGoal` failed with a 5-step path. That is\n  the `agent_loop.go:838-841` behaviour, independently rediscovered.\n- **A dead model passes.** After adding `quitVia`, a mechanical edit put it in\n  every `UNCHANGED` tuple *and* assigned it, so every quitting action was\n  unsatisfiable and the model explored 2 states. `go run .\u002Fhack\u002Fformal\u002Flint\u002Fmain` found it;\n  the check itself did not. Always confirm the state count is in the tens and a\n  deliberate break reproduces.\n- **A rule scoped by `ctrlC > 0` was still wrong**, because `\u002Fquit` and a single\n  Ctrl+C both left the counter at 1. The rule now reads `quitVia`, an explicit\n  record of what asked to quit — the same lesson as `verify-agent-lifecycle`'s\n  `cancelAsked`.\n\n## After confirming the model is still true\n\n- **Sync commit:** `cc79aceb43df31012e9e5c1f69a7ba1231c32470` (moved when the\n  session model was added; update on the next confirmed change).\n- **Constants:** none.\n- **Chart budget:** 34 states, so the full chart always draws.\n\n## Draw the chart\n\n`hack\u002Fformal\u002Fcheck.sh session --chart` writes `hack\u002Fformal\u002Fsession\u002Fout\u002Freport.md`\nand `chart.mmd` via the pstack `\u002Fstatechart` skill. This is the chart to show a\nperson asking \"what does pi actually do while I wait?\".\n","# Verify the session flow\n\nThis is the model of what a person sees: launch, type, wait, cancel, quit. It\nexists because the two failures a user actually notices are structural — a session\nthat cannot be interrupted, and a quit that discards work — and both span several\nhandlers, so neither is visible in a unit test of any one of them.\n\nThe properties: **the Ctrl+C quit needs two presses**, **Esc stops an armed goal\nloop**, **a canceled turn hands its queued prompt to the next turn rather than\ndropping it**, and **no TUI state is a dead end**.\n\n## Does my change touch the verified code\n\n```bash\ngit diff --stat \u003Csync-commit>..HEAD -- \\\n  internal\u002Ftui\u002Ftui.go internal\u002Ftui\u002Fagent_loop.go internal\u002Ftui\u002Fcommands.go \\\n  internal\u002Ftui\u002Fgoal.go internal\u002Fautocompact\u002Fhook.go\n```\n\n**Model covers** (each model step names the handler it stands for):\n\n| Model action | Code |\n|---|---|\n| `InitProgress` \u002F `InitDone` \u002F `InitFailed` | the deferred-init splash, `tui.go:563-565, 2391-2417` |\n| `SubmitIdle` | `handleInputSubmit` → `enqueuePrompt` → `submit`, `tui.go:783`, `agent_loop.go:985-1049` |\n| `SubmitSteers` | while busy, a prompt steers instead of queueing, `tui.go:785-787`, `agent_loop.go:961-975` |\n| `GoalCycleQueues` | a goal cycle's own prompt occupies the queue, `goal.go:284-296` |\n| `TurnEndQueued` \u002F `TurnEndIdle` \u002F `TurnEndGoalCycle` | `handleAgentDone`, `agent_loop.go:2013-2075` |\n| `EscBusy` \u002F `EscIdle` | `handleInterruptKey`, `tui.go:1273-1281` |\n| `CtrlCBusyFirst` \u002F `CtrlCBusyAgain` \u002F `CtrlCIdleFirst` \u002F `CtrlCIdleSecond` | `tui.go:1283-1297` |\n| `CtrlCTimerFires` | `resetCtrlCCount`, `tui.go:2353-2359` |\n| `CancelSettlesToIdle` \u002F `CancelSettlesToQueued` | `cancelAgent`, `agent_loop.go:830-874` |\n| `GoalSetIdle` \u002F `GoalStop` | `handleGoalCommand`, `goal.go:361-400` |\n| `Quit` \u002F `QuitIdle` | `tea.Quit`, `\u002Fquit` |\n\n**Not modelled, and why:** the modal overlays (commit, login, skill-create,\nbranch and search popups). Each is a pointer that either swallows or forwards a\nkey; none can strand a running turn, and the ordering claim they make is the\nfive-line handler list in `handleKey` (`tui.go:1144-1151`), which a reader checks\nby eye. Also out of scope: rendering, scrolling, the diff sidebar, `\u002Frun` and\n`\u002Fpr-autofix` (separate machines), and the pre-turn compaction hook, whose\nguarantee is only that it never aborts a turn.\n\n## Run it\n\n```bash\nhack\u002Fformal\u002Fcheck.sh session           # all rules hold, or the first that breaks\nhack\u002Fformal\u002Fcheck.sh session --chart   # draw the session flow\n```\n\nCost: 34 distinct states, under a second. Deadlock checking is **on** and must\nstay on: with it off, a lost-prompt regression passes, which is how an earlier\nversion of this check was green while proving nothing.\n\n## Read a result\n\n**A rule broke** — the shortest step sequence names the presses in order. Replay\nit as a Bubble Tea test in `internal\u002Ftui` (the `goal_loop_e2e_test.go` pattern\ndrives the real `Update` loop) before calling it a bug. **`Deadlock` reported** —\na state with no step out. Every state except `closed` should have one; a dead end\nin `canceling` means the user is watching a spinner nothing will clear.\n\n## Rules, and the harm each one names\n\n| Rule | The promise | What breaking it means for a user |\n|---|---|---|\n| `TwoPressesToQuit` | the Ctrl+C quit path needs two presses | one tap ends the session; the \"again to quit\" warning is a lie |\n| `CtrlCBounded` | the counter never exceeds 2 | \"again to quit\" would need a third press |\n| `IdleHasNoArmedGoal` | Esc\u002FCtrl+C disarm a goal loop, so an idle session never self-restarts | a stopped goal spends another billed turn |\n| `CancelDoesNotStrandTheQueue` | a settled cancel has handed its queued prompt on | a prompt you typed vanishes |\n| `NoLostPrompt` | a queued prompt only exists while a turn runs or cancels | a prompt sits in the queue with nothing to start it |\n| `SteerOnlyWhileBusy` | a steer belongs to a running or canceling turn | a stale steer hijacks the next prompt |\n| `ClosedOnlyFromQuitting` | the terminal closes only via the quit path | the UI is torn down under a live turn |\n| `NoDeadlock` (implicit) | every state but `closed` has a step out | a hung TUI |\n\n## What this model has already caught\n\n- **Esc had to disarm the goal loop.** An early version left `goalArmed` set\n  across `EscBusy`, and `IdleHasNoArmedGoal` failed with a 5-step path. That is\n  the `agent_loop.go:838-841` behaviour, independently rediscovered.\n- **A dead model passes.** After adding `quitVia`, a mechanical edit put it in\n  every `UNCHANGED` tuple *and* assigned it, so every quitting action was\n  unsatisfiable and the model explored 2 states. `go run .\u002Fhack\u002Fformal\u002Flint\u002Fmain` found it;\n  the check itself did not. Always confirm the state count is in the tens and a\n  deliberate break reproduces.\n- **A rule scoped by `ctrlC > 0` was still wrong**, because `\u002Fquit` and a single\n  Ctrl+C both left the counter at 1. The rule now reads `quitVia`, an explicit\n  record of what asked to quit — the same lesson as `verify-agent-lifecycle`'s\n  `cancelAsked`.\n\n## After confirming the model is still true\n\n- **Sync commit:** `cc79aceb43df31012e9e5c1f69a7ba1231c32470` (moved when the\n  session model was added; update on the next confirmed change).\n- **Constants:** none.\n- **Chart budget:** 34 states, so the full chart always draws.\n\n## Draw the chart\n\n`hack\u002Fformal\u002Fcheck.sh session --chart` writes `hack\u002Fformal\u002Fsession\u002Fout\u002Freport.md`\nand `chart.mmd` via the pstack `\u002Fstatechart` skill. This is the chart to show a\nperson asking \"what does pi actually do while I wait?\".\n",{"name":5,"description":7},"main","29fdab7a38eef7b4e1ef4101155eb2708f86fa5d","internal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow",34,"https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go","https:\u002F\u002Fpi-go.sh","https:\u002F\u002Fgithub.com\u002Fdimetron","🎸💻 🚧🦞","2026-11-15 03:48:24",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add dimetron\u002Fpi-go --skill verify-session-flow",{"tool":59,"command":60},"bunx","bunx skills add dimetron\u002Fpi-go --skill verify-session-flow",{"tool":62,"command":63},"pnpm","pnpm dlx skills add dimetron\u002Fpi-go --skill verify-session-flow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-session-flow\u002FSKILL.md",true,[],[68,91,109,124,144,154],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":39},"01M70SJ02CTB40V2VFGAF80SBG","verify-run-pipeline","Formally verify the \u002Frun phase machine before or after changing it. Use when editing internal\u002Ftui\u002Frun.go's phase transitions (handleRunAgentDone, runGates result handling, verifyRunComplete, retryRun, reportGateHang, merge), internal\u002Fsop\u002Fverdict.go's Passed, or the checklist refresh — or when a run merged work it should not have, retried a hung gate, lost a cycle at the retry budget, or merged on a stale PASS.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-run-pipeline\u002FSKILL.md",[],[75,76,20,77,78,79,80,81,82,83,84,85,86,87,37,88,89,90,35,32],"pipeline","verify run pipeline","run","run pipeline","sop","phase","merge","result","transitions","verdict","work","refresh","retry","cycle","run phase","machine",{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":39},"01M70SHWJV9N3PQWRAMCQE9C2E","verify-history-rewrite","Formally verify the session-history rewrite path before or after changing it. Use when editing internal\u002Fsession\u002Fautocompact.go, internal\u002Fsession\u002Fcompaction*.go, internal\u002Fsession\u002Fstore.go's Compact\u002FClearEvents\u002FrewriteEvents, internal\u002Fagent\u002Fagent.go's Run\u002FRunStreaming\u002FrunPreTurn, or internal\u002Ftui\u002Fcommands.go's clearConversation\u002FclearSessionContext and the context gauge — or when a turn is canceled mid-flight, a tool call and its result get separated, a session's history disappears while the agent is still working, or the model is sent a tool result whose call was compacted away.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-history-rewrite\u002FSKILL.md",[],[20,98,99,100,101,25,102,77,82,103,104,32,105,35,23,106,107,108,37,22],"verify history rewrite","rewrite","history","gauge","commands","call","store","compact","tool","get","model",{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":39},"01M70SHSJ5A2XV5SXBXM96RH7P","verify-goal-loop","Formally verify the \u002Fgoal automatic loop before or after changing it. Use when editing internal\u002Ftui\u002Fgoal.go, internal\u002Ftui\u002Fagent_loop.go's handleAgentDone\u002FcancelAgent\u002FsteerPrompt, or internal\u002Ftools\u002Fgoal.go's GoalController — or when a goal loop will not stop, stops one cycle early, closes a goal that is not met, or restarts a goal you finished.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-goal-loop\u002FSKILL.md",[],[116,28,20,117,118,34,37,88,35,32,119,120,25,23,121,122,123],"goal loop","verify goal","verify goal loop","you","automatic","Tools","it","stop",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":39},"01M70SHPYN1AS6D6RJ8HN270RZ","verify-agent-lifecycle","Formally verify the subagent lifecycle before or after changing it. Use when editing internal\u002Fsubagent\u002Forchestrator.go's Spawn, trackAgent, forwardAgentEvents, terminalStatus, Cancel, ShutdownWithTimeout or evictCompletedAgentsLocked, or internal\u002Fsubagent\u002Fpool.go — or when a canceled agent is reported as failed, an agent vanishes from the list with no verdict, the orchestrator panics on a pool release, or an agent can be canceled twice.","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fverify-agent-lifecycle\u002FSKILL.md",[],[131,132,133,20,134,135,37,35,32,136,137,138,139,84,140,141,142,143,25,122],"lifecycle","verify agent lifecycle","agent lifecycle","pool","as","cancel","subagent","can","with","orchestrator","spawn","release","list",{"skillNo":145,"name":146,"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":147,"categories":148,"keywords":149,"publishedAt":39},"01M6E37WZM8ZF36DRYQGZDGP7M","test-new-skill","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Ftui\u002F.pi-go\u002Fskills\u002Ftest-new-skill\u002FSKILL.md",[],[150,151,152,153],"test","new skill","test new skill","new",{"skillNo":155,"name":156,"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":157,"categories":158,"keywords":159,"publishedAt":39},"01M6E37T9PQ6Q8NGVGFHR7QDFN","ponytail","https:\u002F\u002Fgithub.com\u002Fdimetron\u002Fpi-go\u002Fblob\u002Fmain\u002Finternal\u002Fextension\u002Fbundled_skills\u002Fponytail\u002FSKILL.md",[],[156]]