frizz-server 0.15.48 → 0.15.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/acp-daemon.js +39 -5
  2. package/dist/claude-agent-broker.js +55 -17
  3. package/dist/codex-app-server-daemon.js +43 -9
  4. package/dist/dev-child.js +11174 -3664
  5. package/package.json +15 -8
  6. package/runtime/board/agent-status.mjs +3 -3
  7. package/runtime/cc-worker/DECISIONS.md +19 -0
  8. package/runtime/cc-worker/bin/frizz-mcp.mjs +4 -2
  9. package/runtime/cc-worker/bin/frizzctl.mjs +26 -3
  10. package/runtime/cc-worker/hooks/deny-plan.mjs +4 -3
  11. package/runtime/cc-worker/hooks/hooks.json +18 -18
  12. package/runtime/cc-worker/hooks/scratchpad.mjs +10 -6
  13. package/runtime/cc-worker/lib/frizz-tools.mjs +156 -77
  14. package/web-dist/assets/{abnfDiagram-VRR7QNED-B13Nf5uG.js → abnfDiagram-VCTEODGH-CSl-iUaD.js} +1 -1
  15. package/web-dist/assets/{arc-tjQgP-a1.js → arc-BSyeo0Gb.js} +1 -1
  16. package/web-dist/assets/architecture-7GRP2DOG-jYpGgJVJ.js +1 -0
  17. package/web-dist/assets/architectureDiagram-5GKGNRK7-Bo_gyMVC.js +36 -0
  18. package/web-dist/assets/blockDiagram-I7D4REHJ-9EtOS1Y1.js +129 -0
  19. package/web-dist/assets/c4Diagram-7LVT6UL2-CE1hW3oj.js +38 -0
  20. package/web-dist/assets/channel-CC-n29cI.js +1 -0
  21. package/web-dist/assets/chunk-2E4U76K2-QqOdoNOR.js +2 -0
  22. package/web-dist/assets/chunk-4HAMMTFA-Df2uLm9r.js +62 -0
  23. package/web-dist/assets/{chunk-ICXQ74PX-CUDlgeXU.js → chunk-75Z2AOVW-DF1G6d8q.js} +1 -1
  24. package/web-dist/assets/{chunk-VAUOI2AC-DpbSQ-0T.js → chunk-CLGD4ZFX-CMAQm7EJ.js} +1 -1
  25. package/web-dist/assets/chunk-DU6HZSFF-UWY5hXXp.js +127 -0
  26. package/web-dist/assets/{chunk-32BRIVSS-DCVxFWaV.js → chunk-F27PBJKO-C59uYSbj.js} +1 -1
  27. package/web-dist/assets/{chunk-KEIR6QF5-BfrZ3jm6.js → chunk-FOHPRMQF-CyTuVbu3.js} +2 -2
  28. package/web-dist/assets/chunk-GMAD6QVW-BsJsQjY4.js +72 -0
  29. package/web-dist/assets/chunk-GVQU2GXP-BuITwr9r.js +1 -0
  30. package/web-dist/assets/{chunk-EX3LRPZG-C57JKsUG.js → chunk-IMKFNOWR-5Ui4f5l4.js} +2 -2
  31. package/web-dist/assets/chunk-L3NEJ4N5-BISBblwX.js +1 -0
  32. package/web-dist/assets/chunk-LNGE3PJU-DNNNwF8Y.js +34 -0
  33. package/web-dist/assets/chunk-OSK3NFVY-CZl3XlkY.js +10 -0
  34. package/web-dist/assets/chunk-P2QGCYS3-DoytbW1J.js +1 -0
  35. package/web-dist/assets/{chunk-VR4S4FIN-BW2QJzbp.js → chunk-POPQ4Y6H-D28hnSIy.js} +1 -1
  36. package/web-dist/assets/{chunk-HOUHSVGY-rlZvVAjI.js → chunk-PWAF6VOD-CbZvnkji.js} +1 -1
  37. package/web-dist/assets/chunk-SHT3W25Y-DM4ozJwj.js +168 -0
  38. package/web-dist/assets/{chunk-MOJQB5TN-BGaw_67a.js → chunk-SVP7TREG-m6oapxSg.js} +1 -1
  39. package/web-dist/assets/{chunk-V7JOEXUC-kdk1Kj1f.js → chunk-TICWLB2K-Ochfyos9.js} +1 -1
  40. package/web-dist/assets/chunk-TLUHSLCS-iM7uiuAo.js +2 -0
  41. package/web-dist/assets/{chunk-XXDRQBXY-DISoSt1F.js → chunk-XXDRQBXY-DYlTP5J-.js} +1 -1
  42. package/web-dist/assets/classDiagram-ZZMXUADV-CXJ9OBBD.js +1 -0
  43. package/web-dist/assets/classDiagram-v2-VYDZK3BY-CXJ9OBBD.js +1 -0
  44. package/web-dist/assets/cose-bilkent-JH36ORCC-BUIsLrGc.js +1 -0
  45. package/web-dist/assets/cynefin-OW5HDTMX-XtTYGcIH.js +1 -0
  46. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-D1KgH5Uh.js → cynefinDiagram-5FMLGOSQ--ClxINOZ.js} +1 -1
  47. package/web-dist/assets/dagre-BJJUWK_n.js +1 -0
  48. package/web-dist/assets/dagre-GXQ25YYZ-CupZ_9Gq.js +4 -0
  49. package/web-dist/assets/{diagram-OA4YK3LP-DQZYQQmQ.js → diagram-S7CK7UJ4-BlF7gkGi.js} +4 -4
  50. package/web-dist/assets/diagram-UQ7AKVKN-BMXRmU5D.js +41 -0
  51. package/web-dist/assets/{diagram-FQU43EPY-DJLjwc2E.js → diagram-VSXAHHWV-r5DJsSB3.js} +1 -1
  52. package/web-dist/assets/{diagram-G47NLZAW-R_nxXPm1.js → diagram-VX7I27RA-DxGq7Ln7.js} +1 -1
  53. package/web-dist/assets/{diagram-NH7WQ7WH-BgEKOFUU.js → diagram-Z3DM3KII-DqXtb_id.js} +1 -1
  54. package/web-dist/assets/dist-DoH_9pyS.js +1 -0
  55. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-DwgS-ruz.js → ebnfDiagram-PWID7BFC-BV_AT7TD.js} +1 -1
  56. package/web-dist/assets/erDiagram-RLTQ6QDP-BV70EqG9.js +99 -0
  57. package/web-dist/assets/eventmodeling-NTZA5JFV-Cw8GwV1a.js +1 -0
  58. package/web-dist/assets/flowDiagram-HODETNUW-B0Q6ZSg0.js +1 -0
  59. package/web-dist/assets/ganttDiagram-EL5Y4UJY-Cvkf14ib.js +292 -0
  60. package/web-dist/assets/gitGraph-4MIJSDKK-XBlZCz1U.js +1 -0
  61. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-CZd5jqgf.js → gitGraphDiagram-WWUBYQGX-vDyL82tj.js} +1 -1
  62. package/web-dist/assets/index-D-pcMA7P.js +242 -0
  63. package/web-dist/assets/index-DqckQXcp.css +2 -0
  64. package/web-dist/assets/info-A6RAGUB7-DfR7iRgc.js +1 -0
  65. package/web-dist/assets/{infoDiagram-FWYZ7A6U-C2fsvj8W.js → infoDiagram-27XIBGKW-BT4k6N6o.js} +1 -1
  66. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-DDputQI8.js → ishikawaDiagram-5VMMS53U-BJIdMG0T.js} +1 -1
  67. package/web-dist/assets/{journeyDiagram-5HDEW3XC-CiwOnh1u.js → journeyDiagram-3NMN7TZE-CUGzIF61.js} +2 -2
  68. package/web-dist/assets/{kanban-definition-HUTT4EX6-P8OTxob-.js → kanban-definition-UXKFOSKX-DIPC4kv7.js} +2 -2
  69. package/web-dist/assets/{line-Kk41edHq.js → line-CJKCWj73.js} +1 -1
  70. package/web-dist/assets/{linear-CCCAZbB0.js → linear-z2V0wJk9.js} +1 -1
  71. package/web-dist/assets/{mermaid-parser.core-BIyJ5CJF.js → mermaid-parser.core-BH-fcjsB.js} +3 -3
  72. package/web-dist/assets/mermaid.core-BSdNmJCs.js +11 -0
  73. package/web-dist/assets/{mindmap-definition-LN4V7U3C-CbKVoOZ5.js → mindmap-definition-YA3MSWOX-CJC3zMDF.js} +1 -1
  74. package/web-dist/assets/packet-AYTQ26CC-BET157L_.js +1 -0
  75. package/web-dist/assets/{pegDiagram-2B236MQR-DImDz479.js → pegDiagram-XKGWAZYB-Du8ALEoR.js} +1 -1
  76. package/web-dist/assets/pie-WAS4IAKB-CDs5cIGi.js +1 -0
  77. package/web-dist/assets/{pieDiagram-ENE6RG2P-C2e3M1_h.js → pieDiagram-E7YTZNPT-BX88bIIM.js} +1 -1
  78. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-Dt3f_lrO.js → quadrantDiagram-AXDQQJYC-BkGxldmI.js} +1 -1
  79. package/web-dist/assets/radar-RG4KPBEZ-FMcFyhAF.js +1 -0
  80. package/web-dist/assets/railroad-74A4TZTK-Du0SbLQI.js +1 -0
  81. package/web-dist/assets/railroad-abnf-HS5TGJTU-DRi4RhLb.js +1 -0
  82. package/web-dist/assets/railroad-ebnf-LZEXJU2U-BmBkdsnK.js +1 -0
  83. package/web-dist/assets/railroad-peg-WCYAUIDC-CydTrmQm.js +1 -0
  84. package/web-dist/assets/{railroadDiagram-RFXS5EU6-CBZHt0Mo.js → railroadDiagram-O6MQD6OU-CYqN0dL6.js} +1 -1
  85. package/web-dist/assets/{requirementDiagram-TGXJPOKE-BxSs_q3D.js → requirementDiagram-BXWQKSXE-ClpQ_sLR.js} +2 -2
  86. package/web-dist/assets/rolldown-runtime-Bh1tDfsg.js +1 -0
  87. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-DeJR64nI.js → sankeyDiagram-P5KCCOFB-CEJUF8o9.js} +1 -1
  88. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-oOI0fQW_.js → sequenceDiagram-WJ2MYXX4-BpJYUJhB.js} +1 -1
  89. package/web-dist/assets/src-C4XfhTaE.js +1 -0
  90. package/web-dist/assets/{stateDiagram-2N3HPSRC-C0geqCc2.js → stateDiagram-D77RDMKH-BmKLEj9Q.js} +1 -1
  91. package/web-dist/assets/stateDiagram-v2-MP3YSRHH-D_c6vvvW.js +1 -0
  92. package/web-dist/assets/swimlanes-42K2YHIH-CyJxVets.js +1 -0
  93. package/web-dist/assets/swimlanesDiagram-VR7AAH4N-BcVx8rdP.js +8 -0
  94. package/web-dist/assets/threadSurfaces-CYpFDk_e.js +143 -0
  95. package/web-dist/assets/{timeline-definition-FHXFAJF6-CCY_OuVM.js → timeline-definition-24CTP7MA-ChEqw_62.js} +1 -1
  96. package/web-dist/assets/treeView-Q6P3EWNA-l1PaAwLT.js +1 -0
  97. package/web-dist/assets/treemap-WGGIJYW6-CxvHcEiT.js +1 -0
  98. package/web-dist/assets/{vennDiagram-L72KCM5P-OGzW7d1w.js → vennDiagram-4TSXK5OY-DF-yXPNP.js} +1 -1
  99. package/web-dist/assets/wardley-WFR3VGLG-BqkX6NQy.js +1 -0
  100. package/web-dist/assets/{wardleyDiagram-EHGQE667-CJKRWMOx.js → wardleyDiagram-VM6X3IG4-B9LU1bxh.js} +1 -1
  101. package/web-dist/assets/{xychartDiagram-FW5EYKEG-biGPRYAN.js → xychartDiagram-S5SC5T6Z-Zt_ZqCWS.js} +3 -3
  102. package/web-dist/index.html +3 -2
  103. package/runtime/board/agent-liveness.mjs +0 -367
  104. package/runtime/board/notify-shared.mjs +0 -90
  105. package/runtime/board/notify.mjs +0 -81
  106. package/runtime/board/rest-detect.mjs +0 -213
  107. package/runtime/board/thread-excerpt.mjs +0 -162
  108. package/web-dist/assets/architecture-TIHT7OUA-cscbyVpp.js +0 -1
  109. package/web-dist/assets/architectureDiagram-ZJ3FMSHR-Bse2UXVn.js +0 -36
  110. package/web-dist/assets/blockDiagram-677ZJIJ3-BLJZnqTz.js +0 -132
  111. package/web-dist/assets/c4Diagram-LMCZKHZV-DO7oo4h9.js +0 -10
  112. package/web-dist/assets/channel-ChsreyIE.js +0 -1
  113. package/web-dist/assets/chunk-52WLFC77-Cg3jpJ_e.js +0 -10
  114. package/web-dist/assets/chunk-7BUUIJ7U-Bb538aSH.js +0 -1
  115. package/web-dist/assets/chunk-C7G6YPKG-Cb_zdGzQ.js +0 -1
  116. package/web-dist/assets/chunk-FWX5IMBZ-2PvmKNIs.js +0 -2
  117. package/web-dist/assets/chunk-OGEWGWER-CEeg8UMh.js +0 -1
  118. package/web-dist/assets/chunk-PUDLZKDR-xwNSwwyn.js +0 -156
  119. package/web-dist/assets/chunk-Q4XR5HBZ-msU0GK4L.js +0 -70
  120. package/web-dist/assets/chunk-RYQCIY6F-BBiFFmSH.js +0 -1
  121. package/web-dist/assets/chunk-WYO6CB5R-BouXl6Ea.js +0 -127
  122. package/web-dist/assets/chunk-ZGVPDNZ5-C7QT30bj.js +0 -62
  123. package/web-dist/assets/chunk-ZIRB5QZD-C6fEPe3t.js +0 -32
  124. package/web-dist/assets/classDiagram-OUVF2IWQ-DzRcM19r.js +0 -1
  125. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DzRcM19r.js +0 -1
  126. package/web-dist/assets/cose-bilkent-JH36ORCC-B4uC0Pku.js +0 -1
  127. package/web-dist/assets/cynefin-VYW2F7L2-KGwY_f6i.js +0 -1
  128. package/web-dist/assets/dagre-CXRCoUWR.js +0 -1
  129. package/web-dist/assets/dagre-VKFMJZFB-CpBkJUGX.js +0 -4
  130. package/web-dist/assets/diagram-WEI45ONY-BPJydYC6.js +0 -41
  131. package/web-dist/assets/dist-KklTF2b-.js +0 -1
  132. package/web-dist/assets/erDiagram-Q63AITRT-CpxSzpX_.js +0 -85
  133. package/web-dist/assets/eventmodeling-45OFAUF4-pAxX2kmp.js +0 -1
  134. package/web-dist/assets/flowDiagram-23GEKE2U-CNUJOYgE.js +0 -1
  135. package/web-dist/assets/ganttDiagram-NO4QXBWP-DKV9dDLx.js +0 -292
  136. package/web-dist/assets/gitGraph-TEB2WS4Q-Di3-VfYF.js +0 -1
  137. package/web-dist/assets/index-CnoKcjA-.css +0 -2
  138. package/web-dist/assets/index-dgMYbeEx.js +0 -378
  139. package/web-dist/assets/info-DKCQHKI2-zUEOPGRX.js +0 -1
  140. package/web-dist/assets/map-DsCK-0Cs.js +0 -1
  141. package/web-dist/assets/mermaid.core-CrqCm1sE.js +0 -11
  142. package/web-dist/assets/packet-7NZHBO7P-Dk5Sv2nR.js +0 -1
  143. package/web-dist/assets/pie-RZYD4A2V-D4HndtMy.js +0 -1
  144. package/web-dist/assets/radar-I7S5WNFK-Bgms7oi0.js +0 -1
  145. package/web-dist/assets/railroad-3IZDKUUU-BZvaJJq3.js +0 -1
  146. package/web-dist/assets/railroad-abnf-AHOZXSZD-BaE30t8x.js +0 -1
  147. package/web-dist/assets/railroad-ebnf-EBAXGLYW-Cuetb6tx.js +0 -1
  148. package/web-dist/assets/railroad-peg-LSFZ7HO6-DDs0AouG.js +0 -1
  149. package/web-dist/assets/src-DLhDEMjC.js +0 -1
  150. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-l7nncg_Z.js +0 -1
  151. package/web-dist/assets/swimlanes-5IMT3BWC-BABUQ-Hv.js +0 -2
  152. package/web-dist/assets/swimlanesDiagram-G3AALYLV-BAhikHjx.js +0 -8
  153. package/web-dist/assets/treeView-QDETBFTQ-CjszFvr3.js +0 -1
  154. package/web-dist/assets/treemap-6X3UGDF4-BbdOWC-4.js +0 -1
  155. package/web-dist/assets/wardley-OPB4EBWU-GgVEIZwC.js +0 -1
  156. /package/web-dist/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frizz-server",
3
- "version": "0.15.48",
3
+ "version": "0.15.50",
4
4
  "private": false,
5
5
  "description": "Replaceable Frizz server runtime",
6
6
  "license": "MIT",
@@ -21,12 +21,19 @@
21
21
  "protocol": 1,
22
22
  "dataEpoch": 1
23
23
  },
24
- "dependencies": {
25
- "@parcel/watcher": "2.5.6"
26
- },
27
- "pnpm": {
28
- "onlyBuiltDependencies": [
29
- "@parcel/watcher"
30
- ]
24
+ "optionalDependencies": {
25
+ "@parcel/watcher-darwin-x64": "2.5.6",
26
+ "@parcel/watcher-darwin-arm64": "2.5.6",
27
+ "@parcel/watcher-win32-x64": "2.5.6",
28
+ "@parcel/watcher-win32-arm64": "2.5.6",
29
+ "@parcel/watcher-win32-ia32": "2.5.6",
30
+ "@parcel/watcher-linux-x64-glibc": "2.5.6",
31
+ "@parcel/watcher-linux-x64-musl": "2.5.6",
32
+ "@parcel/watcher-linux-arm64-glibc": "2.5.6",
33
+ "@parcel/watcher-linux-arm64-musl": "2.5.6",
34
+ "@parcel/watcher-linux-arm-glibc": "2.5.6",
35
+ "@parcel/watcher-linux-arm-musl": "2.5.6",
36
+ "@parcel/watcher-android-arm64": "2.5.6",
37
+ "@parcel/watcher-freebsd-x64": "2.5.6"
31
38
  }
32
39
  }
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
2
  /**
3
- * frizz — DERIVED agent state. The single shared derivation used by BOTH the Stop-hook
4
- * liveness helper (`./agent-liveness.mjs`) and the board (`./index.mjs`), so an agent's
5
- * reported state can never drift between the two.
3
+ * frizz — DERIVED agent state. The single derivation the board (`./index.mjs`) reports an agent's
4
+ * state from. (It was shared with a Stop-hook liveness helper, `agent-liveness.mjs`, until that hook
5
+ * was retired; the helper was removed on 2026-11-10.)
6
6
  *
7
7
  * THE PRINCIPLE — compute, don't store (the same rule the board already follows for
8
8
  * thread status). The thread↔agent binding (`.frizz/.agent-bindings.jsonl`, written
@@ -1266,3 +1266,22 @@ Colin, on whether agents can read their own CI logs: *"Perhaps we should be prov
1266
1266
  - **`frizzGithubWorkerEnv` now asks whether the move costs a write.** Keyward on PATH: it doesn't. No Keyward and a sign-in of the operator's own: it would, so the worker keeps that sign-in, as before. No Keyward and no sign-in: there is no write to lose.
1267
1267
  - **Whether `gh` has a sign-in comes from its token variables and `hosts.yml`, never from running it.** This runs on every worker start. `hosts.yml` names a keychain-held sign-in as well, so nothing here can raise a keychain prompt. A sign-in to any host counts, because the move would hide it just the same, and an expired one counts, which leaves that machine as it was.
1268
1268
  - **The hook's read-only block has a second form for this machine.** It tells the worker to hand a write to the human as steps. The first form names a `keyward` that isn't there.
1269
+
1270
+ ## 2026-11-10: a Claude worker's system prompt names no session, so threads share its cache
1271
+
1272
+ Claude Code sends the appended system prompt as one cached block, and a block is read from the cache only when every byte matches. The scratch line (`SCRATCH DIRECTORY: .frizz/threads/<session id>/ …`) sat between the contract and `FRIZZ.md`, so one line of the block differed per thread and every thread's first call wrote the whole block again.
1273
+
1274
+ - **`claudeWorkerSystemPrompt` is the contract and `FRIZZ.md`, and takes no session id.** Measured with two real Haiku workers dispatched one after the other on a throwaway project: with the line, both read 12,807 tokens and wrote 53,237 on their first call; without it the second read 43,924 and wrote 21,928.
1275
+ - **The path reaches a Claude worker from three other places.** The first user message, and `session-seed.mjs` and `scratchpad.mjs` on every SessionStart: a startup, a resume, a clear and a compaction. On a cold resume of a real worker both hooks ran and named it. The contract's own sentence already sends the worker there ("exact path in your session-start context").
1276
+ - **Codex, ACP and OpenCode keep the line.** They have no hook that runs when a session starts.
1277
+ - **It reaches new threads only.** Claude Code keeps a thread's first system prompt across a resume.
1278
+
1279
+ ## 2026-11-10, later: a worker is not offered Claude Code's own schedulers
1280
+
1281
+ The contract told every worker that `CronCreate` and `ScheduleWakeup` "cannot fire in the runtime frizz runs you in" (their gate stays shut while any background task of the session is outstanding), and both help texts repeated it. A tool a worker has to be warned off is better not offered.
1282
+
1283
+ - **The broker passes `disallowedTools`: `ScheduleWakeup`, `CronCreate`, `CronDelete`, `CronList`** (`BROKER_DISALLOWED_TOOLS`). Measured on a real Haiku worker: 1,705 fewer tokens in every request, and the names are gone from the request's tools and from the deferred list.
1284
+ - **The warning is now two lines of the contract, and gone from `frizzctl goal --help` and `timer --help`.**
1285
+ - **`/loop` is built on those tools and its skill is still listed.** The contract says to arm one of Frizz's own (`frizzctl goal`, `frizzctl timer`) when the human asks for a loop. Sent `/loop 1m …`, a real worker armed `frizzctl goal start --heartbeat-seconds 60`.
1286
+ - **The tool list no longer matches the prefix Claude Code shares between all its users** (12,807 tokens here), so the first Frizz thread of an hour writes it and the rest read that copy.
1287
+ - **`AskUserQuestion`, `Workflow` and `ReportFindings` stay.** The first is drawn as a card, and a person can ask for the other two.
@@ -12,7 +12,7 @@
12
12
  * aesthetic. The server NEVER crashes on a bad tool call: failures come back as an isError tool
13
13
  * result so the worker sees a message instead of a dead tool.
14
14
  */
15
- import { HANDLERS, Refused, TOOLS } from "../lib/frizz-tools.mjs"
15
+ import { HANDLERS, Refused, ServerRefusal, TOOLS } from "../lib/frizz-tools.mjs"
16
16
 
17
17
  const PROTOCOL_FALLBACK = "2025-06-18"
18
18
 
@@ -70,7 +70,9 @@ async function handle(msg) {
70
70
  const answer = await handler(params?.arguments ?? {})
71
71
  replyTool(id, answer instanceof Refused ? answer.text : answer)
72
72
  } catch (err) {
73
- replyTool(id, `\`${name}\` failed: ${err instanceof Error ? err.message : String(err)}`, true)
73
+ // The server's own "no" (an unknown thread, a dead handle) is a gate that held as well.
74
+ if (err instanceof ServerRefusal) replyTool(id, `\`${name}\` was refused: ${err.message}`)
75
+ else replyTool(id, `\`${name}\` failed: ${err instanceof Error ? err.message : String(err)}`, true)
74
76
  }
75
77
  return
76
78
  }
@@ -36,7 +36,7 @@
36
36
  * lesson, and stdin is never read — and its `--help` is the same text. `frizzctl --help` does not list it.
37
37
  */
38
38
  import { readFileSync } from "node:fs"
39
- import { CLI, HANDLERS, Refused, TOOLS } from "../lib/frizz-tools.mjs"
39
+ import { CLI, HANDLERS, Refused, ServerRefusal, TOOLS } from "../lib/frizz-tools.mjs"
40
40
 
41
41
  const NAME = "frizzctl"
42
42
  const WIDTH = 100
@@ -230,8 +230,22 @@ function parseArgs(tool, argv) {
230
230
  /** @type {string[]} */
231
231
  const declared = spec.positional ?? []
232
232
  const slots = declared.filter((k) => !(k in given))
233
+ // An action's alias takes the slots of the action it stands for: `watch-pr remove prw_1` is `drop prw_1`.
233
234
  const extend = (/** @type {unknown} */ lead) => {
234
- for (const k of spec.then?.[String(lead)] ?? []) if (!(k in given) && !slots.includes(k)) slots.push(k)
235
+ const action = spec.alias?.[String(lead).toLowerCase()] ?? String(lead)
236
+ for (const k of spec.then?.[action] ?? []) if (!(k in given) && !slots.includes(k)) slots.push(k)
237
+ }
238
+ // The action said TWICE, as the leading word and as its flag (`goal start --action start …`). The help
239
+ // shows both spellings, and a worker that had just read it wrote both and was told the command "takes
240
+ // no bare argument here" (seen from a real worker, 2026-11-10). The same action twice is said once;
241
+ // two different ones is the mistake worth naming.
242
+ const lead = declared[0]
243
+ if (lead && lead in given && bare.length && Array.isArray(props[lead]?.enum)) {
244
+ const named = (/** @type {unknown} */ v) => spec.alias?.[String(v).toLowerCase()] ?? String(v)
245
+ if (named(bare[0]) === named(given[lead])) bare.shift()
246
+ else if (props[lead].enum.includes(named(bare[0]))) {
247
+ throw new UsageError(`\`${NAME} ${hyphen(tool.name)}\` was given two ${hyphen(lead)}s, \`${bare[0]}\` and --${hyphen(lead)} ${given[lead]}. Give one.`)
248
+ }
235
249
  }
236
250
  if (declared[0] && declared[0] in given) extend(given[declared[0]])
237
251
  /** @type {Record<string, unknown>} */
@@ -334,7 +348,14 @@ function commandHelp(tool) {
334
348
  const usage = [` ${command}${bare.length ? ` ${bare.join(" ")}` : ""}${Object.keys(props).length > bare.length ? " [--flags]" : ""}`]
335
349
  for (const [lead, more] of Object.entries(spec.then ?? {})) usage.push(` ${command} ${lead} ${more.map((k) => `<${hyphen(k)}>`).join(" ")}`)
336
350
  if (Object.keys(props).length) usage.push(` ${command} --input <file|-> the arguments below as one JSON object`)
337
- const args = Object.entries(props).map(([key, sub]) => describeArg(`--${hyphen(key)}`, sub, required.has(key), " ", []))
351
+ // A positional argument is listed under its flag, so say it is the bare word too: a reader of
352
+ // `--action <start | stop | get> (required)` under `Usage: … <action>` otherwise writes both.
353
+ const args = Object.entries(props).map(([key, sub]) => {
354
+ const described = describeArg(`--${hyphen(key)}`, sub, required.has(key), " ", [])
355
+ if (!(spec.positional ?? []).includes(key)) return described
356
+ const [label, ...rest] = described.split("\n")
357
+ return [label, ` The bare <${hyphen(key)}> in the usage above, or this flag.`, ...rest].join("\n")
358
+ })
338
359
  const textArgs = Object.entries(props).filter(([, sub]) => sub.type === "string" && !sub.enum).map(([key]) => `--${hyphen(key)}-file`)
339
360
  return [
340
361
  `${command} — ${spec.summary ?? ""}`,
@@ -408,6 +429,8 @@ async function main(argv) {
408
429
  try {
409
430
  answer = await HANDLERS[tool.name](args)
410
431
  } catch (err) {
432
+ // The server said no, in a sentence it wrote for the worker: a gate that held, like a `Refused` answer.
433
+ if (err instanceof ServerRefusal) return { code: 2, out: `\`${NAME} ${hyphen(tool.name)}\` was refused: ${err.message}` }
411
434
  throw new Error(`${NAME} ${hyphen(tool.name)} failed: ${err instanceof Error ? err.message : String(err)}`)
412
435
  }
413
436
  return answer instanceof Refused ? { code: 2, out: answer.text } : { code: 0, out: String(answer) }
@@ -2,8 +2,9 @@
2
2
  // @ts-check
3
3
  // PermissionRequest hook on ExitPlanMode (frizz) — a frizz worker runs under a dashboard, not a
4
4
  // live chat, so the plan-APPROVAL prompt (shown when the model calls ExitPlanMode to present a plan
5
- // and ask to proceed) would hang the session invisibly. Deny it and redirect the worker to encode
6
- // its plan/ask in the thread file instead.
5
+ // and ask to proceed) would hang the session invisibly. Deny it and redirect the worker: proceed if
6
+ // the plan is settled, write it to a durable plan file if the plan is the deliverable, and ask in a
7
+ // ```question fence if it needs a human call first (the `reason` below, word for word).
7
8
  //
8
9
  // WHY PermissionRequest, not PreToolUse: ExitPlanMode is a PERMISSION surface, not a plain tool —
9
10
  // it is denied via PermissionRequest (AskUserQuestion, a real tool, is denied via PreToolUse in the
@@ -14,7 +15,7 @@
14
15
  //
15
16
  // PLAN-MODE SOFTLOCK — why this denies UNCONDITIONALLY when gated: a session genuinely IN plan mode
16
17
  // is read-only until ExitPlanMode is approved, so denying ExitPlanMode there would SOFTLOCK it
17
- // (can't exit → can't edit → can't even follow the "write to the thread" redirect). This hook does not
18
+ // (can't exit → can't edit → can't even follow the redirect and write the plan file). This hook does not
18
19
  // branch on the session's mode. (An earlier note here claimed the PermissionRequest input carries no
19
20
  // permission-mode signal — that is FALSE and was corrected 2026-07-25: the payload carries
20
21
  // `permission_mode`, `tool_name`, and `tool_input`, which is exactly what the sibling perm-policy.mjs
@@ -4,19 +4,19 @@
4
4
  {
5
5
  "matcher": "Bash",
6
6
  "hooks": [
7
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/bash-background.mjs\"" }
7
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/bash-background.mjs\"", "timeout": 30 }
8
8
  ]
9
9
  },
10
10
  {
11
11
  "matcher": "Agent",
12
12
  "hooks": [
13
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/agent-dispatch.mjs\"" }
13
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/agent-dispatch.mjs\"", "timeout": 30 }
14
14
  ]
15
15
  },
16
16
  {
17
17
  "matcher": "AskUserQuestion",
18
18
  "hooks": [
19
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/deny-ask.mjs\"" }
19
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/deny-ask.mjs\"", "timeout": 30 }
20
20
  ]
21
21
  }
22
22
  ],
@@ -24,19 +24,19 @@
24
24
  {
25
25
  "matcher": "Agent",
26
26
  "hooks": [
27
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/agent-bind.mjs\"" }
27
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/agent-bind.mjs\"", "timeout": 30 }
28
28
  ]
29
29
  },
30
30
  {
31
31
  "hooks": [
32
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=nudge --event=PostToolUse" }
32
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=nudge --event=PostToolUse", "timeout": 30 }
33
33
  ]
34
34
  }
35
35
  ],
36
36
  "UserPromptSubmit": [
37
37
  {
38
38
  "hooks": [
39
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=nudge" }
39
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=nudge", "timeout": 30 }
40
40
  ]
41
41
  }
42
42
  ],
@@ -44,13 +44,13 @@
44
44
  {
45
45
  "matcher": "ExitPlanMode",
46
46
  "hooks": [
47
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/deny-plan.mjs\"" }
47
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/deny-plan.mjs\"", "timeout": 30 }
48
48
  ]
49
49
  },
50
50
  {
51
51
  "matcher": "*",
52
52
  "hooks": [
53
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/perm-policy.mjs\"" }
53
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/perm-policy.mjs\"", "timeout": 30 }
54
54
  ]
55
55
  }
56
56
  ],
@@ -58,13 +58,13 @@
58
58
  {
59
59
  "matcher": "auto",
60
60
  "hooks": [
61
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=precompact" }
61
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=precompact", "timeout": 30 }
62
62
  ]
63
63
  },
64
64
  {
65
65
  "matcher": "manual",
66
66
  "hooks": [
67
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=precompact" }
67
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=precompact", "timeout": 30 }
68
68
  ]
69
69
  }
70
70
  ],
@@ -72,29 +72,29 @@
72
72
  {
73
73
  "matcher": "startup",
74
74
  "hooks": [
75
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"" },
76
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start" }
75
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"", "timeout": 30 },
76
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start", "timeout": 30 }
77
77
  ]
78
78
  },
79
79
  {
80
80
  "matcher": "resume",
81
81
  "hooks": [
82
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"" },
83
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start" }
82
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"", "timeout": 30 },
83
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start", "timeout": 30 }
84
84
  ]
85
85
  },
86
86
  {
87
87
  "matcher": "clear",
88
88
  "hooks": [
89
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"" },
90
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start" }
89
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"", "timeout": 30 },
90
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start", "timeout": 30 }
91
91
  ]
92
92
  },
93
93
  {
94
94
  "matcher": "compact",
95
95
  "hooks": [
96
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"" },
97
- { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start" }
96
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/session-seed.mjs\"", "timeout": 30 },
97
+ { "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/scratchpad.mjs\" --mode=session-start", "timeout": 30 }
98
98
  ]
99
99
  }
100
100
  ]
@@ -65,8 +65,8 @@ const MAX_LISTED_FILES = intFromEnv('FRIZZ_SCRATCH_MAX_LISTED', 40);
65
65
  /** Context-token growth since the last scratch write that marks the directory stale. 60k is ~a third of
66
66
  * a 200k window and ~6% of a 1M one: frequent enough that a long effort is reminded while there is
67
67
  * still something to record, rare enough not to be chatter. Also the first-write trigger — an EMPTY
68
- * directory has no clock of its own, so the baseline is zero and the first nudge lands once a session
69
- * has accumulated 60k tokens actually worth persisting. */
68
+ * directory has no write to count from, so its baseline is the first reading this hook took, and the
69
+ * first nudge lands once the session has added 60k tokens of its own to what it opened on. */
70
70
  const STALE_TOKENS = intFromEnv('FRIZZ_SCRATCHPAD_STALE_TOKENS', 60000);
71
71
 
72
72
  /** @param {string} name @param {number} fallback */
@@ -396,9 +396,12 @@ if (mode === 'nudge') {
396
396
  writeState(state);
397
397
  }
398
398
 
399
- // An EMPTY directory measures growth from ZERO: the whole session is unrecorded, so the clock starts
400
- // at the beginning, not at whenever this first looked.
401
- const baseline = mtimeMs ? (state.tokensAtWrite ?? tokens) : 0;
399
+ // An EMPTY directory counts from the first reading too (`tokensAtWrite`, set above the first time this
400
+ // looked), never from zero. A session opens on a fixed context of its own, the system prompt, the tool
401
+ // schemas and the project's instructions, which is already more than the interval: counted from zero,
402
+ // the "empty" note went out after the first tool call of nearly every session, about nothing the
403
+ // worker had done.
404
+ const baseline = state.tokensAtWrite ?? tokens;
402
405
  const grown = tokens - baseline;
403
406
  if (grown < STALE_TOKENS) process.exit(0);
404
407
  // Space repeat nudges by the same interval. Both channels share this state, so firing on every tool
@@ -407,7 +410,8 @@ if (mode === 'nudge') {
407
410
 
408
411
  writeState({ ...state, tokensAtNudge: tokens });
409
412
 
410
- const k = Math.round(grown / 1000);
413
+ // The stale note reports the growth since the last write; the empty one, how deep the session is.
414
+ const k = Math.round((mtimeMs ? grown : tokens) / 1000);
411
415
  const event = /** @type {'UserPromptSubmit'|'PostToolUse'} */ (
412
416
  input.transcript_path && flagValue('--event') === 'PostToolUse' ? 'PostToolUse' : 'UserPromptSubmit'
413
417
  );