oh-my-copilot 5.26.0 → 5.27.0

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 (521) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/.claude-plugin/plugin.json +2 -1
  3. package/bridge/claude-md-coordinator.cjs +2 -2
  4. package/bridge/cli.cjs +20832 -15745
  5. package/bridge/mcp-server.cjs +165 -53
  6. package/bridge/runtime-cli.cjs +4707 -1925
  7. package/bridge/team-mcp.cjs +2917 -816
  8. package/bridge/team.js +5397 -2381
  9. package/copilot/hooks.json +3 -3
  10. package/dist/__tests__/arguments-literal-substitution.test.d.ts +2 -0
  11. package/dist/__tests__/arguments-literal-substitution.test.d.ts.map +1 -0
  12. package/dist/__tests__/arguments-literal-substitution.test.js +34 -0
  13. package/dist/__tests__/arguments-literal-substitution.test.js.map +1 -0
  14. package/dist/__tests__/bridge-self-contained.test.d.ts +2 -0
  15. package/dist/__tests__/bridge-self-contained.test.d.ts.map +1 -0
  16. package/dist/__tests__/bridge-self-contained.test.js +44 -0
  17. package/dist/__tests__/bridge-self-contained.test.js.map +1 -0
  18. package/dist/__tests__/context-safety.test.js +1 -1
  19. package/dist/__tests__/context-safety.test.js.map +1 -1
  20. package/dist/__tests__/copilot-hook-dispatch.test.js +5 -1
  21. package/dist/__tests__/copilot-hook-dispatch.test.js.map +1 -1
  22. package/dist/__tests__/copilot-hooks-manifest.test.js +15 -1
  23. package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
  24. package/dist/__tests__/directory-context-injector-registration.test.js +5 -2
  25. package/dist/__tests__/directory-context-injector-registration.test.js.map +1 -1
  26. package/dist/__tests__/doctor-conflicts.test.js +61 -0
  27. package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
  28. package/dist/__tests__/hook-command-normalizer.test.js +41 -49
  29. package/dist/__tests__/hook-command-normalizer.test.js.map +1 -1
  30. package/dist/__tests__/hooks/session-end-cleanup.test.js +87 -1
  31. package/dist/__tests__/hooks/session-end-cleanup.test.js.map +1 -1
  32. package/dist/__tests__/hooks-command-escaping.test.js +18 -16
  33. package/dist/__tests__/hooks-command-escaping.test.js.map +1 -1
  34. package/dist/__tests__/hud/omc-state.test.js +62 -1
  35. package/dist/__tests__/hud/omc-state.test.js.map +1 -1
  36. package/dist/__tests__/installer-mcp-config.test.js +39 -1
  37. package/dist/__tests__/installer-mcp-config.test.js.map +1 -1
  38. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js +1 -1
  39. package/dist/__tests__/issue-2652-runtime-wiring-and-output-contract.test.js.map +1 -1
  40. package/dist/__tests__/keyword-detector-echo-guard.test.js +13 -1
  41. package/dist/__tests__/keyword-detector-echo-guard.test.js.map +1 -1
  42. package/dist/__tests__/keyword-detector-script.test.js +201 -0
  43. package/dist/__tests__/keyword-detector-script.test.js.map +1 -1
  44. package/dist/__tests__/npm-package-surface-helpers.d.ts.map +1 -1
  45. package/dist/__tests__/npm-package-surface-helpers.js +8 -4
  46. package/dist/__tests__/npm-package-surface-helpers.js.map +1 -1
  47. package/dist/__tests__/plugin-setup-deps.test.js +103 -68
  48. package/dist/__tests__/plugin-setup-deps.test.js.map +1 -1
  49. package/dist/__tests__/preemptive-compaction-hook.test.js +62 -5
  50. package/dist/__tests__/preemptive-compaction-hook.test.js.map +1 -1
  51. package/dist/__tests__/ralph-prd-mandatory.test.js +3 -0
  52. package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -1
  53. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts +10 -0
  54. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.d.ts.map +1 -0
  55. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js +241 -0
  56. package/dist/__tests__/rate-limit-wait/herdr-daemon.test.js.map +1 -0
  57. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts +9 -0
  58. package/dist/__tests__/rate-limit-wait/herdr-detector.test.d.ts.map +1 -0
  59. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js +162 -0
  60. package/dist/__tests__/rate-limit-wait/herdr-detector.test.js.map +1 -0
  61. package/dist/__tests__/repair-plugin-cache-script.test.js +7 -1
  62. package/dist/__tests__/repair-plugin-cache-script.test.js.map +1 -1
  63. package/dist/__tests__/run-cjs-graceful-fallback.test.js +3 -2
  64. package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
  65. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js +4 -1
  66. package/dist/__tests__/run-cjs-windows-stdio-contract.test.js.map +1 -1
  67. package/dist/__tests__/setup-contracts-regression.test.js +13 -10
  68. package/dist/__tests__/setup-contracts-regression.test.js.map +1 -1
  69. package/dist/__tests__/skills.test.js +10 -9
  70. package/dist/__tests__/skills.test.js.map +1 -1
  71. package/dist/alias-retirement/__tests__/registry.test.js +2 -2
  72. package/dist/cli/__tests__/doctor-conflicts-json.test.js +2 -2
  73. package/dist/cli/__tests__/doctor-conflicts-json.test.js.map +1 -1
  74. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts +10 -0
  75. package/dist/cli/__tests__/herdr-no-raw-calls.test.d.ts.map +1 -0
  76. package/dist/cli/__tests__/herdr-no-raw-calls.test.js +54 -0
  77. package/dist/cli/__tests__/herdr-no-raw-calls.test.js.map +1 -0
  78. package/dist/cli/__tests__/interop-herdr.test.d.ts +9 -0
  79. package/dist/cli/__tests__/interop-herdr.test.d.ts.map +1 -0
  80. package/dist/cli/__tests__/interop-herdr.test.js +138 -0
  81. package/dist/cli/__tests__/interop-herdr.test.js.map +1 -0
  82. package/dist/cli/__tests__/launch-herdr.test.d.ts +10 -0
  83. package/dist/cli/__tests__/launch-herdr.test.d.ts.map +1 -0
  84. package/dist/cli/__tests__/launch-herdr.test.js +133 -0
  85. package/dist/cli/__tests__/launch-herdr.test.js.map +1 -0
  86. package/dist/cli/__tests__/launch.test.js +140 -10
  87. package/dist/cli/__tests__/launch.test.js.map +1 -1
  88. package/dist/cli/__tests__/plugin-dir-capture.test.js +2 -0
  89. package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
  90. package/dist/cli/__tests__/ralph-afk.test.js +392 -2
  91. package/dist/cli/__tests__/ralph-afk.test.js.map +1 -1
  92. package/dist/cli/__tests__/ralph-closeout.test.d.ts +2 -0
  93. package/dist/cli/__tests__/ralph-closeout.test.d.ts.map +1 -0
  94. package/dist/cli/__tests__/ralph-closeout.test.js +156 -0
  95. package/dist/cli/__tests__/ralph-closeout.test.js.map +1 -0
  96. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts +2 -0
  97. package/dist/cli/__tests__/subcommand-json-flag.test.d.ts.map +1 -0
  98. package/dist/cli/__tests__/subcommand-json-flag.test.js +86 -0
  99. package/dist/cli/__tests__/subcommand-json-flag.test.js.map +1 -0
  100. package/dist/cli/__tests__/team-resume-v2.test.js +46 -0
  101. package/dist/cli/__tests__/team-resume-v2.test.js.map +1 -1
  102. package/dist/cli/__tests__/team.test.js +24 -0
  103. package/dist/cli/__tests__/team.test.js.map +1 -1
  104. package/dist/cli/__tests__/wait-teleport-json.test.js +2 -2
  105. package/dist/cli/__tests__/wait-teleport-json.test.js.map +1 -1
  106. package/dist/cli/commands/__tests__/teleport.test.js +42 -0
  107. package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
  108. package/dist/cli/commands/__tests__/wait.test.js +33 -1
  109. package/dist/cli/commands/__tests__/wait.test.js.map +1 -1
  110. package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
  111. package/dist/cli/commands/doctor-conflicts.js +6 -2
  112. package/dist/cli/commands/doctor-conflicts.js.map +1 -1
  113. package/dist/cli/commands/ralph.d.ts +36 -1
  114. package/dist/cli/commands/ralph.d.ts.map +1 -1
  115. package/dist/cli/commands/ralph.js +298 -50
  116. package/dist/cli/commands/ralph.js.map +1 -1
  117. package/dist/cli/commands/team.d.ts.map +1 -1
  118. package/dist/cli/commands/team.js +2 -0
  119. package/dist/cli/commands/team.js.map +1 -1
  120. package/dist/cli/commands/teleport.d.ts.map +1 -1
  121. package/dist/cli/commands/teleport.js +6 -1
  122. package/dist/cli/commands/teleport.js.map +1 -1
  123. package/dist/cli/commands/wait.d.ts.map +1 -1
  124. package/dist/cli/commands/wait.js +3 -1
  125. package/dist/cli/commands/wait.js.map +1 -1
  126. package/dist/cli/index.js +8 -8
  127. package/dist/cli/index.js.map +1 -1
  128. package/dist/cli/interop.d.ts +4 -3
  129. package/dist/cli/interop.d.ts.map +1 -1
  130. package/dist/cli/interop.js +95 -4
  131. package/dist/cli/interop.js.map +1 -1
  132. package/dist/cli/launch.d.ts +17 -2
  133. package/dist/cli/launch.d.ts.map +1 -1
  134. package/dist/cli/launch.js +110 -12
  135. package/dist/cli/launch.js.map +1 -1
  136. package/dist/cli/team.d.ts.map +1 -1
  137. package/dist/cli/team.js +4 -1
  138. package/dist/cli/team.js.map +1 -1
  139. package/dist/commands/index.js +1 -1
  140. package/dist/commands/index.js.map +1 -1
  141. package/dist/config/loader.d.ts.map +1 -1
  142. package/dist/config/loader.js +17 -0
  143. package/dist/config/loader.js.map +1 -1
  144. package/dist/features/__tests__/checkpoint.test.js +118 -1
  145. package/dist/features/__tests__/checkpoint.test.js.map +1 -1
  146. package/dist/features/__tests__/jev-model-routing.test.js +20 -2
  147. package/dist/features/__tests__/jev-model-routing.test.js.map +1 -1
  148. package/dist/features/__tests__/jev-slop-warning.test.js +22 -2
  149. package/dist/features/__tests__/jev-slop-warning.test.js.map +1 -1
  150. package/dist/features/checkpoint/index.d.ts.map +1 -1
  151. package/dist/features/checkpoint/index.js +25 -8
  152. package/dist/features/checkpoint/index.js.map +1 -1
  153. package/dist/features/jev-slop-warning.d.ts +3 -2
  154. package/dist/features/jev-slop-warning.d.ts.map +1 -1
  155. package/dist/features/jev-slop-warning.js +5 -3
  156. package/dist/features/jev-slop-warning.js.map +1 -1
  157. package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
  158. package/dist/features/rate-limit-wait/daemon.js +55 -9
  159. package/dist/features/rate-limit-wait/daemon.js.map +1 -1
  160. package/dist/features/rate-limit-wait/tmux-detector.d.ts +33 -0
  161. package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
  162. package/dist/features/rate-limit-wait/tmux-detector.js +156 -0
  163. package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
  164. package/dist/hooks/__tests__/precompact-restore.test.js +38 -0
  165. package/dist/hooks/__tests__/precompact-restore.test.js.map +1 -1
  166. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +7 -2
  167. package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
  168. package/dist/hooks/auto-slash-command/executor.js +1 -1
  169. package/dist/hooks/auto-slash-command/executor.js.map +1 -1
  170. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js +24 -2
  171. package/dist/hooks/code-simplifier/__tests__/jev-trigger-shadow.test.js.map +1 -1
  172. package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
  173. package/dist/hooks/code-simplifier/jev-shadow.js +6 -4
  174. package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
  175. package/dist/hooks/jev/__tests__/client.test.js +20 -1
  176. package/dist/hooks/jev/__tests__/client.test.js.map +1 -1
  177. package/dist/hooks/jev/__tests__/log-context.test.d.ts +2 -0
  178. package/dist/hooks/jev/__tests__/log-context.test.d.ts.map +1 -0
  179. package/dist/hooks/jev/__tests__/log-context.test.js +97 -0
  180. package/dist/hooks/jev/__tests__/log-context.test.js.map +1 -0
  181. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts +2 -0
  182. package/dist/hooks/jev/__tests__/log-rotation.test.d.ts.map +1 -0
  183. package/dist/hooks/jev/__tests__/log-rotation.test.js +148 -0
  184. package/dist/hooks/jev/__tests__/log-rotation.test.js.map +1 -0
  185. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts +2 -0
  186. package/dist/hooks/jev/__tests__/resolver-request-count.test.d.ts.map +1 -0
  187. package/dist/hooks/jev/__tests__/resolver-request-count.test.js +117 -0
  188. package/dist/hooks/jev/__tests__/resolver-request-count.test.js.map +1 -0
  189. package/dist/hooks/jev/__tests__/resolver.test.js +63 -1
  190. package/dist/hooks/jev/__tests__/resolver.test.js.map +1 -1
  191. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts +2 -0
  192. package/dist/hooks/jev/__tests__/shared-breaker.test.d.ts.map +1 -0
  193. package/dist/hooks/jev/__tests__/shared-breaker.test.js +294 -0
  194. package/dist/hooks/jev/__tests__/shared-breaker.test.js.map +1 -0
  195. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts +2 -0
  196. package/dist/hooks/jev/__tests__/state-omit-ids.test.d.ts.map +1 -0
  197. package/dist/hooks/jev/__tests__/state-omit-ids.test.js +88 -0
  198. package/dist/hooks/jev/__tests__/state-omit-ids.test.js.map +1 -0
  199. package/dist/hooks/jev/client.d.ts +34 -2
  200. package/dist/hooks/jev/client.d.ts.map +1 -1
  201. package/dist/hooks/jev/client.js +80 -5
  202. package/dist/hooks/jev/client.js.map +1 -1
  203. package/dist/hooks/jev/config.d.ts +78 -4
  204. package/dist/hooks/jev/config.d.ts.map +1 -1
  205. package/dist/hooks/jev/config.js +123 -9
  206. package/dist/hooks/jev/config.js.map +1 -1
  207. package/dist/hooks/jev/points.d.ts +2 -0
  208. package/dist/hooks/jev/points.d.ts.map +1 -1
  209. package/dist/hooks/jev/points.js +41 -10
  210. package/dist/hooks/jev/points.js.map +1 -1
  211. package/dist/hooks/jev/resolver.d.ts +27 -2
  212. package/dist/hooks/jev/resolver.d.ts.map +1 -1
  213. package/dist/hooks/jev/resolver.js +176 -20
  214. package/dist/hooks/jev/resolver.js.map +1 -1
  215. package/dist/hooks/jev/types.d.ts +21 -4
  216. package/dist/hooks/jev/types.d.ts.map +1 -1
  217. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts +2 -0
  218. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.d.ts.map +1 -0
  219. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js +209 -0
  220. package/dist/hooks/keyword-detector/__tests__/autopilot-command-parity.test.js.map +1 -0
  221. package/dist/hooks/keyword-detector/__tests__/index.test.js +6 -1
  222. package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
  223. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +15 -0
  224. package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
  225. package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
  226. package/dist/hooks/keyword-detector/index.js +200 -2
  227. package/dist/hooks/keyword-detector/index.js.map +1 -1
  228. package/dist/hooks/keyword-detector/jev-shadow.js +3 -3
  229. package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
  230. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js +20 -1
  231. package/dist/hooks/learner/__tests__/jev-extraction-shadow.test.js.map +1 -1
  232. package/dist/hooks/learner/jev-shadow.js +3 -3
  233. package/dist/hooks/learner/jev-shadow.js.map +1 -1
  234. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts +2 -0
  235. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.d.ts.map +1 -0
  236. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js +280 -0
  237. package/dist/hooks/persistent-mode/__tests__/architect-approval-transcript.test.js.map +1 -0
  238. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js +2 -2
  239. package/dist/hooks/persistent-mode/__tests__/error-handling.test.js.map +1 -1
  240. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js +47 -1
  241. package/dist/hooks/persistent-mode/__tests__/jev-loop-continuation-shadow.test.js.map +1 -1
  242. package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
  243. package/dist/hooks/persistent-mode/index.js +136 -40
  244. package/dist/hooks/persistent-mode/index.js.map +1 -1
  245. package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
  246. package/dist/hooks/persistent-mode/jev-shadow.js +11 -7
  247. package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
  248. package/dist/hooks/pre-compact/index.d.ts.map +1 -1
  249. package/dist/hooks/pre-compact/index.js +8 -5
  250. package/dist/hooks/pre-compact/index.js.map +1 -1
  251. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts +11 -0
  252. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.d.ts.map +1 -0
  253. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js +227 -0
  254. package/dist/hooks/project-memory/__tests__/rescan-concurrency.test.js.map +1 -0
  255. package/dist/hooks/project-memory/index.d.ts.map +1 -1
  256. package/dist/hooks/project-memory/index.js +26 -6
  257. package/dist/hooks/project-memory/index.js.map +1 -1
  258. package/dist/hooks/ralph/__tests__/closeout.test.d.ts +2 -0
  259. package/dist/hooks/ralph/__tests__/closeout.test.d.ts.map +1 -0
  260. package/dist/hooks/ralph/__tests__/closeout.test.js +82 -0
  261. package/dist/hooks/ralph/__tests__/closeout.test.js.map +1 -0
  262. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +572 -4
  263. package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -1
  264. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js +23 -2
  265. package/dist/hooks/ralph/__tests__/jev-verdict-shadow.test.js.map +1 -1
  266. package/dist/hooks/ralph/closeout.d.ts +34 -0
  267. package/dist/hooks/ralph/closeout.d.ts.map +1 -0
  268. package/dist/hooks/ralph/closeout.js +66 -0
  269. package/dist/hooks/ralph/closeout.js.map +1 -0
  270. package/dist/hooks/ralph/feedback-baseline.d.ts +60 -6
  271. package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -1
  272. package/dist/hooks/ralph/feedback-baseline.js +302 -15
  273. package/dist/hooks/ralph/feedback-baseline.js.map +1 -1
  274. package/dist/hooks/ralph/index.d.ts +1 -1
  275. package/dist/hooks/ralph/index.d.ts.map +1 -1
  276. package/dist/hooks/ralph/index.js +1 -1
  277. package/dist/hooks/ralph/index.js.map +1 -1
  278. package/dist/hooks/ralph/jev-shadow.js +3 -3
  279. package/dist/hooks/ralph/jev-shadow.js.map +1 -1
  280. package/dist/hooks/ralph/verifier.d.ts +5 -0
  281. package/dist/hooks/ralph/verifier.d.ts.map +1 -1
  282. package/dist/hooks/ralph/verifier.js +21 -10
  283. package/dist/hooks/ralph/verifier.js.map +1 -1
  284. package/dist/hooks/registry/__tests__/registry.test.js +6 -0
  285. package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
  286. package/dist/hooks/registry/registry.d.ts +6 -2
  287. package/dist/hooks/registry/registry.d.ts.map +1 -1
  288. package/dist/hooks/registry/registry.js +21 -6
  289. package/dist/hooks/registry/registry.js.map +1 -1
  290. package/dist/hooks/registry/types.d.ts +2 -0
  291. package/dist/hooks/registry/types.d.ts.map +1 -1
  292. package/dist/hooks/session-end/__tests__/callbacks.test.js +10 -1
  293. package/dist/hooks/session-end/__tests__/callbacks.test.js.map +1 -1
  294. package/dist/hooks/session-end/__tests__/worker.test.js +111 -2
  295. package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
  296. package/dist/hooks/session-end/callbacks.js +1 -1
  297. package/dist/hooks/session-end/callbacks.js.map +1 -1
  298. package/dist/hooks/session-end/cleanup-manifest.d.ts +2 -0
  299. package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
  300. package/dist/hooks/session-end/cleanup-manifest.js +8 -0
  301. package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
  302. package/dist/hooks/session-end/index.d.ts.map +1 -1
  303. package/dist/hooks/session-end/index.js +21 -3
  304. package/dist/hooks/session-end/index.js.map +1 -1
  305. package/dist/hooks/session-end/worker.d.ts.map +1 -1
  306. package/dist/hooks/session-end/worker.js +32 -2
  307. package/dist/hooks/session-end/worker.js.map +1 -1
  308. package/dist/hooks/setup/__tests__/windows-patch.test.js +89 -17
  309. package/dist/hooks/setup/__tests__/windows-patch.test.js.map +1 -1
  310. package/dist/hooks/setup/index.d.ts +10 -21
  311. package/dist/hooks/setup/index.d.ts.map +1 -1
  312. package/dist/hooks/setup/index.js +14 -48
  313. package/dist/hooks/setup/index.js.map +1 -1
  314. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js +2 -1
  315. package/dist/hooks/task-size-detector/__tests__/jev-shadow.test.js.map +1 -1
  316. package/dist/hud/omc-state.d.ts +8 -0
  317. package/dist/hud/omc-state.d.ts.map +1 -1
  318. package/dist/hud/omc-state.js +23 -2
  319. package/dist/hud/omc-state.js.map +1 -1
  320. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts +2 -0
  321. package/dist/installer/__tests__/claude-mcp-config-path.test.d.ts.map +1 -0
  322. package/dist/installer/__tests__/claude-mcp-config-path.test.js +323 -0
  323. package/dist/installer/__tests__/claude-mcp-config-path.test.js.map +1 -0
  324. package/dist/installer/__tests__/mcp-registry.test.js +81 -3
  325. package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
  326. package/dist/installer/__tests__/standalone-hook-reconcile.test.js +36 -0
  327. package/dist/installer/__tests__/standalone-hook-reconcile.test.js.map +1 -1
  328. package/dist/installer/index.d.ts.map +1 -1
  329. package/dist/installer/index.js +16 -4
  330. package/dist/installer/index.js.map +1 -1
  331. package/dist/installer/mcp-registry.d.ts +21 -1
  332. package/dist/installer/mcp-registry.d.ts.map +1 -1
  333. package/dist/installer/mcp-registry.js +101 -20
  334. package/dist/installer/mcp-registry.js.map +1 -1
  335. package/dist/lib/atomic-write.d.ts.map +1 -1
  336. package/dist/lib/atomic-write.js +61 -2
  337. package/dist/lib/atomic-write.js.map +1 -1
  338. package/dist/mcp/__tests__/team-cleanup.test.js +13 -0
  339. package/dist/mcp/__tests__/team-cleanup.test.js.map +1 -1
  340. package/dist/mcp/team-job-convergence.d.ts.map +1 -1
  341. package/dist/mcp/team-job-convergence.js +4 -1
  342. package/dist/mcp/team-job-convergence.js.map +1 -1
  343. package/dist/mcp/team-server.js +2 -2
  344. package/dist/mcp/team-server.js.map +1 -1
  345. package/dist/notifications/__tests__/approval-reply.test.js +8 -0
  346. package/dist/notifications/__tests__/approval-reply.test.js.map +1 -1
  347. package/dist/notifications/__tests__/reply-herdr.test.d.ts +8 -0
  348. package/dist/notifications/__tests__/reply-herdr.test.d.ts.map +1 -0
  349. package/dist/notifications/__tests__/reply-herdr.test.js +125 -0
  350. package/dist/notifications/__tests__/reply-herdr.test.js.map +1 -0
  351. package/dist/notifications/__tests__/tmux.test.js +56 -1
  352. package/dist/notifications/__tests__/tmux.test.js.map +1 -1
  353. package/dist/notifications/index.d.ts +1 -1
  354. package/dist/notifications/index.d.ts.map +1 -1
  355. package/dist/notifications/index.js +22 -7
  356. package/dist/notifications/index.js.map +1 -1
  357. package/dist/notifications/reply-listener.d.ts +28 -12
  358. package/dist/notifications/reply-listener.d.ts.map +1 -1
  359. package/dist/notifications/reply-listener.js +326 -172
  360. package/dist/notifications/reply-listener.js.map +1 -1
  361. package/dist/notifications/tmux.d.ts +22 -2
  362. package/dist/notifications/tmux.d.ts.map +1 -1
  363. package/dist/notifications/tmux.js +57 -2
  364. package/dist/notifications/tmux.js.map +1 -1
  365. package/dist/shared/types.d.ts +5 -0
  366. package/dist/shared/types.d.ts.map +1 -1
  367. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts +9 -0
  368. package/dist/team/__tests__/herdr-session-realherdr.test.d.ts.map +1 -0
  369. package/dist/team/__tests__/herdr-session-realherdr.test.js +140 -0
  370. package/dist/team/__tests__/herdr-session-realherdr.test.js.map +1 -0
  371. package/dist/team/__tests__/herdr-session.test.d.ts +9 -0
  372. package/dist/team/__tests__/herdr-session.test.d.ts.map +1 -0
  373. package/dist/team/__tests__/herdr-session.test.js +270 -0
  374. package/dist/team/__tests__/herdr-session.test.js.map +1 -0
  375. package/dist/team/__tests__/idle-nudge.test.js +17 -0
  376. package/dist/team/__tests__/idle-nudge.test.js.map +1 -1
  377. package/dist/team/__tests__/mailbox-notification-guard.test.js +403 -181
  378. package/dist/team/__tests__/mailbox-notification-guard.test.js.map +1 -1
  379. package/dist/team/__tests__/scaling-launch-config.test.js +12 -0
  380. package/dist/team/__tests__/scaling-launch-config.test.js.map +1 -1
  381. package/dist/team/__tests__/scaling.test.js +12 -0
  382. package/dist/team/__tests__/scaling.test.js.map +1 -1
  383. package/dist/team/__tests__/task-claim-renewal.test.d.ts +2 -0
  384. package/dist/team/__tests__/task-claim-renewal.test.d.ts.map +1 -0
  385. package/dist/team/__tests__/task-claim-renewal.test.js +421 -0
  386. package/dist/team/__tests__/task-claim-renewal.test.js.map +1 -0
  387. package/dist/team/__tests__/task-storage-integrity.test.js +34 -0
  388. package/dist/team/__tests__/task-storage-integrity.test.js.map +1 -1
  389. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts +11 -0
  390. package/dist/team/__tests__/tmux-session.create-team-herdr.test.d.ts.map +1 -0
  391. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js +99 -0
  392. package/dist/team/__tests__/tmux-session.create-team-herdr.test.js.map +1 -0
  393. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts +10 -0
  394. package/dist/team/__tests__/tmux-session.herdr-arms.test.d.ts.map +1 -0
  395. package/dist/team/__tests__/tmux-session.herdr-arms.test.js +226 -0
  396. package/dist/team/__tests__/tmux-session.herdr-arms.test.js.map +1 -0
  397. package/dist/team/__tests__/tmux-session.test.js +888 -721
  398. package/dist/team/__tests__/tmux-session.test.js.map +1 -1
  399. package/dist/team/__tests__/worker-bootstrap.test.js +19 -0
  400. package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
  401. package/dist/team/api-interop.d.ts +1 -1
  402. package/dist/team/api-interop.d.ts.map +1 -1
  403. package/dist/team/api-interop.js +13 -1
  404. package/dist/team/api-interop.js.map +1 -1
  405. package/dist/team/herdr-session.d.ts +267 -0
  406. package/dist/team/herdr-session.d.ts.map +1 -0
  407. package/dist/team/herdr-session.js +508 -0
  408. package/dist/team/herdr-session.js.map +1 -0
  409. package/dist/team/idle-nudge.d.ts +1 -1
  410. package/dist/team/idle-nudge.d.ts.map +1 -1
  411. package/dist/team/idle-nudge.js +4 -4
  412. package/dist/team/idle-nudge.js.map +1 -1
  413. package/dist/team/mailbox-notification-guard.d.ts +24 -19
  414. package/dist/team/mailbox-notification-guard.d.ts.map +1 -1
  415. package/dist/team/mailbox-notification-guard.js +241 -148
  416. package/dist/team/mailbox-notification-guard.js.map +1 -1
  417. package/dist/team/model-contract.d.ts.map +1 -1
  418. package/dist/team/model-contract.js +1 -0
  419. package/dist/team/model-contract.js.map +1 -1
  420. package/dist/team/runtime-v2.d.ts +33 -33
  421. package/dist/team/runtime-v2.d.ts.map +1 -1
  422. package/dist/team/runtime-v2.js +2810 -1591
  423. package/dist/team/runtime-v2.js.map +1 -1
  424. package/dist/team/scaling.d.ts +3 -3
  425. package/dist/team/scaling.d.ts.map +1 -1
  426. package/dist/team/scaling.js +766 -402
  427. package/dist/team/scaling.js.map +1 -1
  428. package/dist/team/state/tasks.d.ts +15 -1
  429. package/dist/team/state/tasks.d.ts.map +1 -1
  430. package/dist/team/state/tasks.js +56 -2
  431. package/dist/team/state/tasks.js.map +1 -1
  432. package/dist/team/team-ops.d.ts +3 -2
  433. package/dist/team/team-ops.d.ts.map +1 -1
  434. package/dist/team/team-ops.js +32 -5
  435. package/dist/team/team-ops.js.map +1 -1
  436. package/dist/team/tmux-session.d.ts +66 -40
  437. package/dist/team/tmux-session.d.ts.map +1 -1
  438. package/dist/team/tmux-session.js +1733 -1096
  439. package/dist/team/tmux-session.js.map +1 -1
  440. package/dist/team/types.d.ts +8 -0
  441. package/dist/team/types.d.ts.map +1 -1
  442. package/dist/team/types.js.map +1 -1
  443. package/dist/team/worker-bootstrap.d.ts.map +1 -1
  444. package/dist/team/worker-bootstrap.js +3 -0
  445. package/dist/team/worker-bootstrap.js.map +1 -1
  446. package/dist/tools/lsp/__tests__/devcontainer.test.js +39 -5
  447. package/dist/tools/lsp/__tests__/devcontainer.test.js.map +1 -1
  448. package/dist/tools/lsp/devcontainer.d.ts.map +1 -1
  449. package/dist/tools/lsp/devcontainer.js +25 -8
  450. package/dist/tools/lsp/devcontainer.js.map +1 -1
  451. package/dist/utils/__tests__/windows-search.test.js +17 -3
  452. package/dist/utils/__tests__/windows-search.test.js.map +1 -1
  453. package/dist/utils/plugin-cache-validation.d.ts.map +1 -1
  454. package/dist/utils/plugin-cache-validation.js +27 -18
  455. package/dist/utils/plugin-cache-validation.js.map +1 -1
  456. package/dist/workflow/__tests__/projections.test.js +3 -3
  457. package/dist/workflow/__tests__/projections.test.js.map +1 -1
  458. package/dist/workflow/__tests__/registry.test.js +3 -3
  459. package/dist/workflow/__tests__/registry.test.js.map +1 -1
  460. package/dist/workflow/registry.d.ts.map +1 -1
  461. package/dist/workflow/registry.js +1 -0
  462. package/dist/workflow/registry.js.map +1 -1
  463. package/docs/ARCHITECTURE.md +1 -1
  464. package/docs/CLAUDE.md +1 -1
  465. package/docs/CREDITS.md +1 -0
  466. package/docs/FEATURES.md +18 -0
  467. package/docs/HOOKS.md +339 -36
  468. package/docs/REFERENCE.md +8 -6
  469. package/docs/TEAM-MULTIPLEXER.md +107 -0
  470. package/hooks/hooks.json +204 -66
  471. package/hooks/jev-compaction.mjs +2404 -0
  472. package/package.json +2 -2
  473. package/plugin.json +1 -1
  474. package/scripts/check-omc-playbooks.mjs +214 -124
  475. package/scripts/code-simplifier.mjs +26 -3
  476. package/scripts/copilot/build-hooks.mjs +24 -7
  477. package/scripts/generate-inventory-graph.mjs +77 -92
  478. package/scripts/jev-eval.mjs +123 -22
  479. package/scripts/jev-repair-transcript.mjs +331 -0
  480. package/scripts/jev-resolve.mjs +374 -22
  481. package/scripts/keyword-detector.mjs +427 -29
  482. package/scripts/lib/hook-command-normalizer.d.mts +18 -0
  483. package/scripts/lib/hook-command-normalizer.mjs +97 -60
  484. package/scripts/lib/jev-breaker.d.mts +73 -0
  485. package/scripts/lib/jev-breaker.mjs +830 -0
  486. package/scripts/lib/jev-compaction-state.mjs +320 -0
  487. package/scripts/lib/jev-delivery-guard.mjs +567 -0
  488. package/scripts/lib/jev-mask.mjs +36 -0
  489. package/scripts/lib/jev-shadow.mjs +363 -14
  490. package/scripts/lib/shell-checks.mjs +1121 -0
  491. package/scripts/lib/state-root.cjs +19 -8
  492. package/scripts/lib/state-root.mjs +19 -8
  493. package/scripts/persistent-mode.cjs +289 -1
  494. package/scripts/persistent-mode.mjs +540 -91
  495. package/scripts/plugin-setup.mjs +22 -22
  496. package/scripts/plugin-shipping-surface.mjs +4 -1
  497. package/scripts/post-tool-use-failure.mjs +18 -0
  498. package/scripts/post-tool-verifier.mjs +49 -3
  499. package/scripts/pre-tool-enforcer.mjs +658 -64
  500. package/scripts/run.cjs +4 -2
  501. package/scripts/session-start.mjs +54 -0
  502. package/skills/AGENTS.md +1 -0
  503. package/skills/ai-slop-cleaner/SKILL.md +14 -0
  504. package/skills/arena/SKILL.md +8 -1
  505. package/skills/create-formal-verification-skill/SKILL.md +6 -4
  506. package/skills/figure-it-out/SKILL.md +5 -0
  507. package/skills/how/references/explainer-prompt.md +7 -4
  508. package/skills/interrogate/SKILL.md +10 -6
  509. package/skills/ralph/SKILL.md +25 -2
  510. package/skills/sdd/SKILL.md +67 -0
  511. package/skills/sdd/phases/criteria.md +144 -0
  512. package/skills/sdd/phases/execute.md +226 -0
  513. package/skills/sdd/phases/review.md +216 -0
  514. package/skills/sdd/phases/rules.md +195 -0
  515. package/skills/sdd/phases/spec.md +75 -0
  516. package/skills/sdd/phases/tasks.md +162 -0
  517. package/skills/statechart/scripts/run.ts +6 -3
  518. package/skills/statechart/scripts/test/child-env.test.ts +53 -0
  519. package/templates/hooks/keyword-detector.mjs +172 -5
  520. package/templates/hooks/lib/state-root.mjs +19 -8
  521. package/templates/hooks/persistent-mode.mjs +296 -1
@@ -0,0 +1,75 @@
1
+
2
+ # Requirements Analyst Skill
3
+
4
+ Walk down the decision tree, surfacing ambiguities, missing info, implicit assumptions, and edge cases through one-at-a-time questioning until the spec is implementable.
5
+
6
+ Pipeline position: proposal → **spec** → criteria → rules → review → tasks
7
+
8
+ # Role
9
+
10
+ You prepare requirements for implementation by an AI coding agent.
11
+
12
+ # Input
13
+
14
+ Feature request: `spec/<slug>/proposal.md`
15
+
16
+ # Analysis Pass (internal)
17
+
18
+ Scan the proposal and identify ambiguities, missing info, implicit assumptions, edge cases, and decision dependencies.
19
+ Use this to plan interview order: root decisions first, then branch into details each answer reveals.
20
+ Draft candidate behaviors to verify.
21
+
22
+ If the `spec/<slug>/proposal.md` does not exist, ask for the input and save it into that file.
23
+
24
+ # Interview Rules
25
+
26
+ - **One question at a time.** Re-plan after every answer; each can collapse or create new branches.
27
+ - **AskUserQuestion with concrete options.** Mutually exclusive, covering the realistic answer space, with a recommended pick.
28
+ - **Explain why each question matters** in one short sentence.
29
+ - **Check the codebase before asking.** If existing code, conventions, or config answers it, read them and proceed.
30
+ - **Recommend, don't punt.** State which option you'd pick and the one-line reason for every question.
31
+
32
+ # Worth-Asking Bar
33
+
34
+ Only ask if the answer changes at least one of:
35
+ - Which behavior the system must exhibit
36
+ - Which edge case becomes in or out of scope
37
+ - Which assumption stops being safe to make
38
+
39
+ If none, decide it yourself and record under "Resolved ambiguities" or "Explicit assumptions" with the rationale. Trivial questions waste turns and erode trust in the interview.
40
+
41
+ # Behaviors to Verify
42
+
43
+ The criteria step depends on this section as its primary handoff. Treat it as a contract.
44
+
45
+ - Emit a numbered list: **B-1, B-2, ...** in document order
46
+ - One observable behavior per entry, phrased as "the system <verb> <object> <under condition>"
47
+ - Every resolved ambiguity, explicit assumption, and handled edge case that implies runtime behavior produces at least one B-N
48
+ - Pure scoping decisions (deferred features, items excluded) do not need a B-N
49
+
50
+ # Success Criteria
51
+
52
+ Complete only when ALL hold:
53
+
54
+ - Every ambiguity that passes the worth-asking bar has a concrete decision
55
+ - Every piece of missing information is filled in
56
+ - Every implicit assumption is explicit and confirmed
57
+ - Every edge case has defined behavior (handled, deferred, or out of scope)
58
+ - Every runtime behavior is captured as a B-N in "Behaviors to verify"
59
+ - No question remains that an implementing agent would need to ask
60
+
61
+ **A clean spec has ZERO open questions.** Before writing, do a final verification pass. If any item fails, return to the interview loop.
62
+
63
+ If a decision genuinely requires input the user cannot give now (another stakeholder, blocked review, vendor response), record it under "External dependencies" with the question, blocker, and a proposed default. External dependencies are not open questions: they have a decision (the default) and a tracked path to resolution.
64
+
65
+ # Output
66
+
67
+ Write to `spec/<slug>/spec.md`:
68
+
69
+ - Feature summary (one paragraph)
70
+ - Resolved ambiguities (decisions made, with rationale)
71
+ - Explicit assumptions
72
+ - Handled edge cases
73
+ - Behaviors to verify (B-1, B-2, ..., the handoff to criteria)
74
+ - Out of scope (product decisions deferred or excluded)
75
+ - External dependencies (if any)
@@ -0,0 +1,162 @@
1
+
2
+ # Taslk List Generator Skill
3
+
4
+ Translate a validated spec into an ordered, atomic, AC-traceable execution list an implementing agent can run task by task.
5
+
6
+ Pipeline position: proposal → spec → criteria → rules → review → **tasks** -> execute
7
+
8
+ # Role
9
+
10
+ You translate a validated spec into a task list written to disk. You do not write code, run tests, or modify project files outside `spec/<slug>/tasks.yaml`. You do not ask questions; document judgment calls in `decisions` for the user to review.
11
+
12
+ # Pipeline Contract
13
+
14
+ Read `spec/<slug>/review.md` (if exists) first. Locate the verdict line under `## Summary`.
15
+
16
+ - **FAIL**: refuse. Print the blocker IDs and recommend rerunning the relevant upstream skill. Do not write `spec/<slug>/tasks.yaml`.
17
+ - **PASS WITH CONDITIONS**: each major must be reflected in the task list, either as a dedicated task with `source: review/MAJOR-N` or a `risk` annotation on an existing task. Note in `assumptions`.
18
+ - **PASS**: proceed.
19
+
20
+ Risk Hotspots from the review surface as `risk` annotations on the relevant task, regardless of verdict.
21
+
22
+ # Inputs
23
+
24
+ - Proposal: `spec/<slug>/proposal.md`
25
+ - Spec: `spec/<slug>/spec.md`
26
+ - Rules: `spec/<slug>/rules.md` (optional)
27
+ - Review: `spec/<slug>/review.md` (optional, pipeline gate)
28
+ - Project conventions: `CLAUDE.md` / `AGENTS.md` / `GEMINI.md`, build files, source tree
29
+
30
+ Spec takes precedence over the proposal.
31
+
32
+ # Codebase Grounding (run first)
33
+
34
+ Read agent guidance files. Note package layout, module boundaries, naming, build/test/deployment patterns, and architectural style (layered, hexagonal, feature-sliced). Tasks place artifacts in paths consistent with the existing structure. Phases respect the existing architectural style unless `rules.md` mandates a deviation.
35
+
36
+ # Phase Organization
37
+
38
+ Pick an organizing principle and state it in `organizing_principle`:
39
+
40
+ - **walking_skeleton**: thin end-to-end slice first, then thicken. Default. Best when integration risk dominates.
41
+ - **layered**: data → domain → application → presentation. Best for layered architectures.
42
+ - **feature_slice**: one phase per AC cluster, each shippable. Best for feature-sliced or hexagonal projects.
43
+ - **risk_first**: highest-risk decisions first. Best when Risk Hotspots are non-trivial.
44
+
45
+ State the choice and one-line reason in `decisions`.
46
+
47
+ # Task Granularity
48
+
49
+ - Completable in a single focused effort (rule of thumb: under an hour)
50
+ - Produces a verifiable artifact (file, passing test, documented decision)
51
+ - Small enough to roll back cleanly
52
+ - References ACs and RULES it covers via `covers`
53
+
54
+ # Dependency Rules
55
+
56
+ - No circular dependencies
57
+ - Minimize cross-phase dependencies
58
+ - Infrastructure before business logic; interfaces before implementations; fixtures before tests
59
+
60
+ # Checkpoint Patterns
61
+
62
+ Place checkpoints where human review meaningfully reduces risk:
63
+ - After project structure or scaffolding
64
+ - After the first end-to-end slice runs
65
+ - After core domain logic is in place
66
+ - After each major integration boundary
67
+ - After test suite green for a phase's ACs
68
+ - Before any irreversible step (migrations, deletions, API contract changes)
69
+
70
+ Every phase ends with a checkpoint. Intermediate checkpoints allowed within a phase.
71
+
72
+ # Stable IDs
73
+
74
+ - Phases: `phase-1`, `phase-2`, ... in execution order
75
+ - Tasks: `task-N.M` (phase number, task number)
76
+ - Checkpoints: `cp-N` (terminal) or `cp-N.M` (intermediate)
77
+ - Decisions: `dec-1`, `dec-2`, ...
78
+
79
+ # Soft Limits
80
+
81
+ Aim for ≤ 5 phases, ≤ 7 tasks per phase. If you exceed:
82
+ - The feature is probably too large. Recommend a split in `decisions` rather than padding.
83
+ - If a split isn't sensible, exceed the limit and note the reason in `decisions`.
84
+
85
+ Don't pad or merge to fit the numbers.
86
+
87
+ # Coverage
88
+
89
+ Every AC in `criteria.md` appears in some task's `covers.acs`, OR in `coverage_deferrals` with a reason. No third option.
90
+
91
+ # Output Schema
92
+
93
+ ```yaml
94
+ tasks:
95
+ feature: "<name>"
96
+ review_verdict: "<PASS | PASS WITH CONDITIONS>"
97
+ organizing_principle: "walking_skeleton | layered | feature_slice | risk_first"
98
+ assumptions:
99
+ - "<assumption to verify>"
100
+ decisions:
101
+ - id: dec-1
102
+ decision: "<judgment call>"
103
+ reason: "<why>"
104
+ alternatives: ["<alt 1>", "<alt 2>"]
105
+ coverage_deferrals:
106
+ - ac: AC-12
107
+ reason: "<why not in a task>"
108
+ phases:
109
+ - id: phase-1
110
+ name: "<phase name>"
111
+ description: "<what this accomplishes>"
112
+ covers: [AC-1, AC-2]
113
+ entry_criteria: "<what must be true to start>"
114
+ tasks:
115
+ - id: task-1.1
116
+ name: "<task name>"
117
+ description: "<what to do>"
118
+ artifact: "<file path or outcome>"
119
+ covers:
120
+ acs: [AC-1]
121
+ rules: [RULE-3, RULE-7]
122
+ depends_on: []
123
+ complexity: "S | M | L"
124
+ validation: "<how to verify>"
125
+ risk: "<from Risk Hotspots, if applicable>"
126
+ source: "<review/MAJOR-N if addressing a review finding>"
127
+ checkpoint:
128
+ id: cp-1
129
+ description: "<what to review>"
130
+ criteria:
131
+ - "<criterion 1>"
132
+ ```
133
+
134
+ **Required**: top-level `feature`, `review_verdict`, `organizing_principle`, `phases`; phase `id`, `name`, `description`, `covers`, `tasks`, `checkpoint`; task `id`, `name`, `description`, `artifact`, `covers`, `depends_on`, `validation`; checkpoint `id`, `description`, `criteria`.
135
+
136
+ **Optional**: `assumptions`, `decisions`, `coverage_deferrals`, `entry_criteria`, `complexity`, `risk`, `source`.
137
+
138
+ # Success Criteria
139
+
140
+ Complete only when ALL hold:
141
+
142
+ - Pipeline contract honored: FAIL refused; PASS WITH CONDITIONS reflected in tasks or risks
143
+ - Every AC in `criteria.md` in some task's `covers.acs` or in `coverage_deferrals`
144
+ - Every task has required fields
145
+ - Every `depends_on` references an earlier task in execution order
146
+ - No circular dependencies
147
+ - Every phase ends with a checkpoint
148
+ - `organizing_principle` set and justified in `decisions`
149
+ - All Risk Hotspots reflected in task `risk` annotations
150
+ - Soft limits met, or deviation justified in `decisions`
151
+
152
+ Verification pass before writing:
153
+ - Walk phases in order; every `depends_on` points to a task that has appeared
154
+ - AC IDs in `covers.acs` (across all tasks) equals AC IDs in `criteria.md` minus `coverage_deferrals`
155
+ - Every RULE ID in `covers.rules` is real in `rules.md`
156
+ - `feature`, `review_verdict`, `organizing_principle`, every phase checkpoint present
157
+
158
+ Do not write a partial file.
159
+
160
+ # Output
161
+
162
+ Write to `spec/<slug>/tasks.yaml`.
@@ -199,15 +199,18 @@ const tsxLoaderUrl = (() => {
199
199
  }
200
200
  })();
201
201
 
202
- const shimRuntimeArgs = () => {
203
- const args = process.execArgv.filter((a) => a !== "--test");
202
+ export const shimRuntimeArgs = (
203
+ execArgv: string[] = process.execArgv,
204
+ features: { typescript?: unknown } = process.features,
205
+ ) => {
206
+ const args = execArgv.filter((a) => a !== "--test");
204
207
  if (!tsxLoaderUrl) return args;
205
208
  const bare = args.indexOf("tsx");
206
209
  if (bare >= 0) {
207
210
  args[bare] = tsxLoaderUrl;
208
211
  return args;
209
212
  }
210
- if (!args.includes(tsxLoaderUrl) && process.features.typescript === undefined)
213
+ if (!args.includes(tsxLoaderUrl) && features.typescript === undefined)
211
214
  return [...args, "--import", tsxLoaderUrl];
212
215
  return args;
213
216
  };
@@ -0,0 +1,53 @@
1
+ import assert from "node:assert/strict";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { test } from "node:test";
6
+ import { shimRuntimeArgs } from "../run.ts";
7
+
8
+ // The java.ts shim is a .ts file that the CLI spawns from a temp working
9
+ // directory. On a node without type stripping the spawn must carry the
10
+ // absolute tsx loader (a bare "tsx" specifier would resolve against the
11
+ // shim's temp cwd and fail); on a stripping-native node no loader is added.
12
+
13
+ test("a bare tsx import is replaced by the absolute loader url", () => {
14
+ const args = shimRuntimeArgs(["--disable-warning=ExperimentalWarning", "--import", "tsx"], {
15
+ typescript: undefined,
16
+ });
17
+ assert.ok(!args.includes("tsx"), `bare tsx survived: ${args}`);
18
+ const imported = args[args.indexOf("--import") + 1];
19
+ assert.match(imported, /^file:\/\//);
20
+ assert.match(imported, /tsx\/dist\/loader\.mjs$/);
21
+ });
22
+
23
+ test("a stripping-less node with no tsx flag gains the loader", () => {
24
+ const before = ["--disable-warning=ExperimentalWarning"];
25
+ const args = shimRuntimeArgs(before, { typescript: undefined });
26
+ const imported = args[args.indexOf("--import") + 1];
27
+ assert.match(imported, /^file:\/\//);
28
+ assert.match(imported, /tsx\/dist\/loader\.mjs$/);
29
+ assert.deepEqual(args.slice(0, before.length), before);
30
+ });
31
+
32
+ test("a stripping-native node still makes a bare tsx import absolute", () => {
33
+ // The bare specifier booted THIS process from the scripts directory; the
34
+ // shim's temp cwd cannot resolve it, stripping or not.
35
+ const args = shimRuntimeArgs(["--import", "tsx"], { typescript: "strip" });
36
+ assert.ok(!args.includes("tsx"), `bare tsx survived: ${args}`);
37
+ const imported = args[args.indexOf("--import") + 1];
38
+ assert.match(imported, /^file:\/\//);
39
+ });
40
+
41
+ test("an absolute loader already in execArgv is left alone", () => {
42
+ const loader = pathToFileURL(createRequire(import.meta.url).resolve("tsx")).href;
43
+ const before = ["--import", loader];
44
+ const args = shimRuntimeArgs(before, { typescript: "strip" });
45
+ assert.deepEqual(args, before);
46
+ });
47
+
48
+ test("the --test flag is filtered from the child's runtime args", () => {
49
+ const loader = pathToFileURL(createRequire(import.meta.url).resolve("tsx")).href;
50
+ const args = shimRuntimeArgs(["--test", "--import", loader], { typescript: "strip" });
51
+ assert.ok(!args.includes("--test"), `--test leaked: ${args}`);
52
+ assert.deepEqual(args, ["--import", loader]);
53
+ });
@@ -939,6 +939,162 @@ function hasActionableRalphKeyword(text, pattern) {
939
939
  return false;
940
940
  }
941
941
 
942
+ // The Latin autopilot aliases (autopilot, auto pilot, auto-pilot, full auto, fullsend) start the mode only as an
943
+ // explicit command, like ralph and ralplan. Without this, a foreign sentence pasted into a prompt
944
+ // ("Add tests (autopilot at cap; ...)") armed the mode, because the generic hasActionableKeyword treats every
945
+ // mention outside quotes and help questions as a command. The grammar is deliberately small. A sentence is a
946
+ // command when all of these hold:
947
+ // 1. It is not a question: it does not end in "?" and does not start with a question or auxiliary word
948
+ // (did, does, is, can, what, how, ...), except the request "can/could/would/will you ...".
949
+ // 2. It is not negated (don't, can't, never, without, ...) and not a reference label line ("Docs: ...").
950
+ // 3. The alias is the first word of the command, followed by a command verb from a closed list (also re-run,
951
+ // double-check), by ":" plus such a verb, or by nothing; at the very start of the prompt any continuation that is
952
+ // not a status line counts. Or an activation phrase stands directly before it: use, run, start, ...
953
+ // (also after please, let's, I want) with an optional the/a/my/our/your, or turn/switch autopilot on.
954
+ // "full auto" and "fullsend" are ordinary hardware phrases: only an activation phrase, a line-leading command verb
955
+ // or ":" plus a verb count. A line with a non-ASCII letter is not English and keeps the generic check.
956
+ // 4. Anything else that passes rules 1 and 2 and is not a status line keeps the generic activation-verb check (an
957
+ // activation verb elsewhere in the clause: "Run in autopilot mode", "fix issue with autopilot in parser module").
958
+ // Phrasings beyond this grammar (an open verb list, other languages) are out of scope.
959
+ const AUTOPILOT_COMMAND_VERBS = 'fix|debug|investigate|resolve|handle|patch|address|implement|build|create|make|run|start|enable|activate|invoke|trigger|launch|plan|add|write|refactor|update|remove|migrate|finish|continue|do|go|test|review|check|verify|audit|analy[sz]e|inspect|deploy|install|configure|document|explain|find|search|generate|convert|ship|release|merge|prepare|design|draft|upgrade|rename|clean|optimi[sz]e|rewrite|summari[sz]e|compare|bring|ping|seed';
960
+ const AUTOPILOT_HYPHENATED_VERB = '(?:re-(?:run|test|check|build|deploy|install|implement|review|verify|try|apply|start|launch|write|format|generate|create)|double-check|cross-check|un-install)';
961
+ const AUTOPILOT_COMMAND_WORD = `(?:(?:${AUTOPILOT_COMMAND_VERBS})|${AUTOPILOT_HYPHENATED_VERB})`;
962
+ const AUTOPILOT_STATUS_CONTINUATION = '\\s+(?:fails|was|were|is|are|has|had|looks|takes|keeps|hangs|hung|timed\\s+out|succeeds|passes|completes|finishes|works)(?![\\p{L}\\d])|\\s+(?:failed|crashed|errored|ok|okay|done|green|succeeded|passed|completed|finished|worked)(?![\\p{L}\\d])(?=[ \\t]*(?:[.,;:!?)]|\\r?\\n|$)|[ \\t]+(?:on|at|in|with|after|during|for|because|again|twice|and|but|so|before|when|while|since|until|due|once|yesterday|today|overnight|too|earlier|already)(?![\\p{L}\\d]))|\\s+(?:step|phase|exit|status|log|suite|mode|output|report|results?|summary)\\s+(?:\\d+|is|are|was|were|has|had|failed|fails|passed|passes|succeeded|looks|takes|keeps|crashed|errored|ok|okay|red|green)(?![\\p{L}\\d])';
963
+ const AUTOPILOT_NOT_A_COMMAND_AFTER = `(?!${AUTOPILOT_STATUS_CONTINUATION})`;
964
+ // Words that open a status line after a colon, not a command: articles, pronouns, auxiliaries, prepositions,
965
+ // conjunctions, adverbs and status words.
966
+ const AUTOPILOT_NON_COMMAND_WORDS = 'a|an|the|this|that|these|those|my|our|your|his|her|its|their|i|we|you|he|she|it|they|me|us|them|is|are|was|were|be|been|am|has|have|had|do|does|did|will|would|can|could|should|may|might|must|shall|not|no|nor|and|or|but|so|if|then|than|as|at|in|on|of|to|for|from|with|by|about|into|onto|over|under|after|before|during|until|while|when|where|which|who|whom|what|why|how|also|just|only|still|already|always|never|now|currently|ready|idle|off|none|nothing|active|inactive|enabled|disabled|available|unavailable|busy|pending|offline|online|yes|here|there|too|very|really|actually|maybe|perhaps|however|hung|hangs|stuck|ran|went|got|took|broke|broken|froze|frozen|became|seems|seemed|remains|lost|left|hit|began|saw|said|gave|found|kept|knew|thought|told|wrote|made|built|sent|spent|stood|held|fell|drew|drove|chose|came|won|threw|grew|met|paid|rose|sold|taught|understood|wore|sat|slept|spoke|swept|sank';
967
+ // A plain alias that opens the prompt counts as a command unless it reads as a status line:
968
+ // a command verb followed by a result ("autopilot run failed"), or a colon plus a status word or gerund.
969
+ const AUTOPILOT_LEADING_STATUS = new RegExp(`^(?:[ \\t]*[:\\uFF1A][ \\t]*(?:(?:${AUTOPILOT_NON_COMMAND_WORDS})|(?!(?:bring|ping|seed|feed|embed|proceed|succeed|speed|need|shred|string|swing|sing|ring|fling|sling|sting|wring|spring|cling)(?![\\p{L}\\d]))\\p{L}*(?:ing|ed))(?![\\p{L}\\d])|[ \\t]+(?:${AUTOPILOT_COMMAND_VERBS})(?![\\p{L}\\d])(?:${AUTOPILOT_STATUS_CONTINUATION}))`, 'iu');
970
+ const AUTOPILOT_COMMAND_AFTER = new RegExp(`^(?:[ \\t]*[,;!\\u2014\\u2013][ \\t]*|[ \\t]+-[ \\t]+|[ \\t]+)${AUTOPILOT_COMMAND_WORD}(?![\\p{L}\\d])${AUTOPILOT_NOT_A_COMMAND_AFTER}`, 'iu');
971
+ const AUTOPILOT_COLON_VERB = new RegExp(`^[ \\t]*[:\\uFF1A][ \\t]*${AUTOPILOT_COMMAND_WORD}(?![\\p{L}\\d])${AUTOPILOT_NOT_A_COMMAND_AFTER}`, 'iu');
972
+ const AUTOPILOT_ALONE_ON_LINE = /^[ \t]*[.!]?[ \t]*(?:\r?\n|$)/;
973
+ const AUTOPILOT_NEGATION_BEFORE = /(?<![\p{L}\d])(?:(?:don|doesn|didn|shouldn|couldn|wouldn|can|won|mustn|isn|aren|shan|needn)['’]?t|cannot|do\s+not|never|not|without)\s+(?!(?:just|only|simply|merely|also|solely|stop|quit|forget|fail|hesitat\w*|delay\w*|wait\w*|paus\w*|ask\w*)(?![\p{L}\d]))(?:(?!(?:so|but|and|then|instead|because|now|mind)(?![\p{L}]))[\p{L}'’]+\s+){0,4}$/iu;
974
+ // Quotes, emphasis marks and brackets right before the alias do not change what a negation governs.
975
+ const AUTOPILOT_OPENING_DELIMITERS_AT_END = /["'“”‘’`*_([{<]+$/;
976
+ // A sentence that starts with a question or auxiliary word asks; "can/could/would/will you ..." is a request.
977
+ const AUTOPILOT_QUESTION_START = /^[ \t]*(?:[-*+>#]+[ \t]+|\d+[.)][ \t]+|\[[ xX]\][ \t]+|["'“‘([*_`])*(?!(?:can|could|would|will)\s+you(?![\p{L}\d]))(?!do\s+not(?![\p{L}\d]))(?:did|does|do|is|are|was|were|has|have|had|can|could|should|would|will|may|might|must|shall|what|why|how|when|where|who|which)(?![\p{L}\d])/iu;
978
+ // The polite request "can/could/would/will you ..." keeps its question mark without being a question.
979
+ const AUTOPILOT_REQUEST_START = /^[ \t]*(?:[-*+>#]+[ \t]+|\d+[.)][ \t]+|\[[ xX]\][ \t]+|["'“‘([*_`])*(?:please[ ,]+)?(?:can|could|would|will)\s+you(?![\p{L}\d])/iu;
980
+ const AUTOPILOT_SENTENCE_END = /(?<=\S)[.!?][)\]}"'*_\u201D\u2019]*(?=\s|$)/g;
981
+ // Markdown emphasis and heading marks around a label ("**Docs:**") do not hide it.
982
+ const AUTOPILOT_MARKDOWN_MARKS = /[*_`#>]+/g;
983
+ const AUTOPILOT_LIST_PREFIX = /^[\s\-+]*(?:\d+[.)]\s+)?/;
984
+ const AUTOPILOT_REFERENCE_LABEL_LINE = /^[ \t]*(?:docs?|documentation|summary|status|logs?|release\s+notes|changelog|readme|examples?|output|result|results|description|title|commit|trigger|triggers|keywords?)[ \t]*:/i;
985
+ // A heading line that is only the label ("## Documentation") also marks what follows as reference text.
986
+ const AUTOPILOT_REFERENCE_HEADING = /^[ \t]*(?:docs?|documentation|summary|status|logs?|release\s+notes|changelog|readme|examples?|output|result|results|description|title|commit|trigger|triggers|keywords?)[ \t]*:?[ \t]*$/i;
987
+ const AUTOPILOT_NOUN_USE_BEFORE = /(?<![\p{L}\d])(?:the|a|an|this|that|these|those|last|previous|our|my|its|your|their)\s+$/iu;
988
+ const AUTOPILOT_COMMIT_LINE_BEFORE = /(?<![\p{L}\d])[0-9a-f]{7,40}\s+$/iu;
989
+ // A line with any non-ASCII letter (Hangul, kana, Han, Thai, Cyrillic, Arabic, Polish diacritics, ...) is not
990
+ // English prose, so the English command grammar cannot judge it and the generic check applies.
991
+ const AUTOPILOT_NON_ENGLISH_LINE = /[\p{Script=Hangul}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Han}\p{Script=Thai}]|(?![A-Za-z])\p{L}/u;
992
+ // Imperative "use / start" in the common ASCII-only languages (Spanish, French, German, Italian, Portuguese).
993
+ const AUTOPILOT_FOREIGN_VERB_BEFORE = /(?<![\p{L}\d])(?:usa|usar|utiliza|utilizar|activa|activar|ejecuta|ejecutar|inicia|iniciar|lanza|utilise|utiliser|active|lance|lancer|nutze|nutzen|benutze|verwende|starte|aktiviere|attiva|avvia|ative|inicie|execute)\s+(?:(?:el|la|le|il|der|die|das)\s+)?$/iu;
994
+ // The activation phrase directly before the alias: an activation verb, or please / let's / I want, optionally
995
+ // followed by a verb, then an optional the/a/my/our/your.
996
+ const AUTOPILOT_ACTIVATION_BEFORE = /(?<![\p{L}\d])(?:(?:please|let['’]?s|i\s+(?:want|need|would\s+like)(?:\s+to)?)\s+(?:(?:use|run|start|enable|activate|invoke|trigger|launch|engage|initiate|begin|kick\s+off|fire\s+up|spin\s+up|turn\s+on|switch\s+to|go(?:\s+with|\s+for)?|set)\s+)?|(?:use|run|start|enable|activate|invoke|trigger|launch|engage|initiate|begin|kick\s+off|fire\s+up|spin\s+up|turn\s+on|switch\s+to|go(?:\s+with|\s+for)?|set)\s+)(?:(?:the|a|my|our|your)\s+)?$/iu;
997
+ // "do not stop using autopilot" asks to keep it running, so the negation does not cancel it.
998
+ const AUTOPILOT_KEEP_USING_BEFORE = /(?<![\p{L}\d])(?:don['’]?t|do\s+not|never)\s+(?:ever\s+)?(?:stop|quit)\s+using\s+$/iu;
999
+ // The separable form "turn autopilot on" / "switch autopilot on": "turn" or "switch" before the alias and "on" right after it.
1000
+ const AUTOPILOT_TURN_BEFORE = /(?<![\p{L}\d])(?:turn|switch)\s+(?:the\s+|a\s+|my\s+|our\s+|your\s+)?$/iu;
1001
+ const AUTOPILOT_ON_AFTER = /^[ \t]+on(?![\p{L}\d])/iu;
1002
+ const AUTOPILOT_NAMESPACE_PREFIX = /^\s*\/?(?:oh-my-(?:claudecode|codex|copilot)|omc|omg):\s*$/i;
1003
+ const AUTOPILOT_MAX_MATCHES = 1000;
1004
+ // The costly informational check sees this many characters on each side of a mention, so its cost does not grow
1005
+ // with the prompt length.
1006
+ const AUTOPILOT_CONTEXT_WINDOW = 2000;
1007
+
1008
+ function hasExplicitAutopilotInvocationContext(text, position, keywordLength, keywordText) {
1009
+ if (AUTOPILOT_NAMESPACE_PREFIX.test(text.slice(getLineBounds(text, position).start, position))) return true;
1010
+ // $, !, / and force: are explicit invocation syntax.
1011
+ const leadingPrefix = hasDirectInvocationPrefix(text, position);
1012
+ if (leadingPrefix && /[$/!:]/.test(text.slice(0, position))) return true;
1013
+ const { start: lineStart, end: lineEnd } = getLineBounds(text, position);
1014
+ // $, ! and slash directly before the alias on its line is explicit invocation syntax, also on a later line.
1015
+ if (/^[ \t]*[$/!]$/.test(text.slice(lineStart, position))) return true;
1016
+ const headStart = Math.max(lineStart, position - 80);
1017
+ const tail = text.slice(headStart, position);
1018
+ const afterKeyword = text.slice(position + keywordLength, position + keywordLength + 60);
1019
+ const lineHead = text.slice(lineStart, Math.min(position, lineStart + 80));
1020
+ // A question never starts the mode: it starts with a question word, or the sentence ends in "?".
1021
+ const sentenceHead = /(?:^|[.!?;]\s+)([^.!?;]*)$/.exec(text.slice(Math.max(lineStart, position - 200), position));
1022
+ // The clause after a label or an introductory phrase ("Question: Must I ...", "Out of curiosity, should I ...") is what gets classified.
1023
+ const clauseHead = (sentenceHead ? sentenceHead[1] : tail).replace(/^.*[,:\u2014\u2013]\s*/, '');
1024
+ if (AUTOPILOT_QUESTION_START.test(sentenceHead ? sentenceHead[1] : tail) || AUTOPILOT_QUESTION_START.test(clauseHead)) return false;
1025
+ AUTOPILOT_SENTENCE_END.lastIndex = position + keywordLength;
1026
+ const sentenceEnd = AUTOPILOT_SENTENCE_END.exec(text);
1027
+ // "?" inside a quotation or parenthesis that the sentence continues after ("... from "Ready?" to "Go.") is not terminal.
1028
+ // A bare "?" followed by a lowercase word ("rename Ready? to Go.") is a literal, not the end of a question.
1029
+ const afterEnd = sentenceEnd === null ? '' : text.slice(sentenceEnd.index + sentenceEnd[0].length, lineEnd);
1030
+ const nestedQuestion = sentenceEnd !== null
1031
+ && ((sentenceEnd[0].length > 1 && !/^[ \t]*$/.test(afterEnd)) || /^[ \t]+\p{Ll}/u.test(afterEnd));
1032
+ if (sentenceEnd && sentenceEnd.index < lineEnd && sentenceEnd[0][0] === '?' && !nestedQuestion && !AUTOPILOT_REQUEST_START.test(clauseHead)) return false;
1033
+ if (AUTOPILOT_NEGATION_BEFORE.test(tail) || AUTOPILOT_NEGATION_BEFORE.test(tail.replace(AUTOPILOT_OPENING_DELIMITERS_AT_END, ''))) return false;
1034
+ if (AUTOPILOT_REFERENCE_LABEL_LINE.test(lineHead.replace(AUTOPILOT_MARKDOWN_MARKS, '').replace(AUTOPILOT_LIST_PREFIX, '').replace(/\s+$/, ''))) return false;
1035
+ if (AUTOPILOT_NON_ENGLISH_LINE.test(text.slice(lineStart, Math.min(lineEnd, lineStart + 400)))) return true;
1036
+ const isHardwareAlias = /^(?:full\s*auto|fullsend)$/i.test((keywordText || '').trim());
1037
+ if (leadingPrefix) {
1038
+ // A plain alias that opens the prompt counts unless it reads as a status line ("autopilot run failed").
1039
+ if (isHardwareAlias) {
1040
+ return AUTOPILOT_ALONE_ON_LINE.test(afterKeyword)
1041
+ || AUTOPILOT_COLON_VERB.test(afterKeyword)
1042
+ || AUTOPILOT_COMMAND_AFTER.test(afterKeyword)
1043
+ || /^[ \t]+(?:this|these|that|it|my|our|everything)(?![\p{L}\d])/iu.test(afterKeyword);
1044
+ }
1045
+ return !AUTOPILOT_LEADING_STATUS.test(afterKeyword);
1046
+ }
1047
+ if (AUTOPILOT_TURN_BEFORE.test(tail) && AUTOPILOT_ON_AFTER.test(afterKeyword)) return true;
1048
+ if (AUTOPILOT_KEEP_USING_BEFORE.test(tail)) return true;
1049
+ const atLineStart = /^[ \t]*(?:[$/!][ \t]*)?$/.test(lineHead);
1050
+ if (atLineStart && (/[$/!]/.test(lineHead) || AUTOPILOT_ALONE_ON_LINE.test(afterKeyword))) return true;
1051
+ if (AUTOPILOT_ACTIVATION_BEFORE.test(tail) || AUTOPILOT_FOREIGN_VERB_BEFORE.test(tail)) return true;
1052
+ if (AUTOPILOT_COLON_VERB.test(afterKeyword)) return true;
1053
+ if (isHardwareAlias) {
1054
+ return (atLineStart && AUTOPILOT_COMMAND_AFTER.test(afterKeyword))
1055
+ || hasConversationalInvocationNearKeyword(text, position, keywordLength, keywordText);
1056
+ }
1057
+ if (AUTOPILOT_NOUN_USE_BEFORE.test(tail) || AUTOPILOT_COMMIT_LINE_BEFORE.test(tail) || AUTOPILOT_LEADING_STATUS.test(afterKeyword)) return false;
1058
+ if (AUTOPILOT_COMMAND_AFTER.test(afterKeyword)) return true;
1059
+ if (hasConversationalInvocationNearKeyword(text, position, keywordLength, keywordText)) return true;
1060
+ return hasActivationIntentNearKeyword(text.slice(Math.max(lineStart, position - INFORMATIONAL_CONTEXT_WINDOW), Math.min(lineEnd, position + keywordLength + INFORMATIONAL_CONTEXT_WINDOW)), keywordText);
1061
+ }
1062
+
1063
+ function hasActionableAutopilotKeyword(text, pattern) {
1064
+ const searchText = looksLikeSystemEcho(text)
1065
+ ? stripSystemEchoes(text)
1066
+ : text;
1067
+ const flags = pattern.flags.includes('g') ? pattern.flags : `${pattern.flags}g`;
1068
+ const globalPattern = new RegExp(pattern.source, flags);
1069
+ let scanned = 0;
1070
+ for (const match of searchText.matchAll(globalPattern)) {
1071
+ if (match.index === undefined) continue;
1072
+ if (++scanned > AUTOPILOT_MAX_MATCHES) break;
1073
+ if (!hasExplicitAutopilotInvocationContext(searchText, match.index, match[0].length, match[0])) continue;
1074
+ // A namespaced or $ / ! / slash-prefixed command is unambiguous, whatever surrounds it.
1075
+ const linePrefix = searchText.slice(getLineBounds(searchText, match.index).start, match.index);
1076
+ if (AUTOPILOT_NAMESPACE_PREFIX.test(linePrefix) || /^[ \t]*[$/!]$/.test(linePrefix)) return true;
1077
+ // A command that opens its line with a command verb is judged on its own line, so a help question on an
1078
+ // earlier line does not veto it; every other mention is judged on a bounded window around it.
1079
+ const { start: lineStart, end: lineEnd } = getLineBounds(searchText, match.index);
1080
+ let previousLine = '';
1081
+ for (let end = lineStart - 1; end > 0 && !previousLine.trim();) {
1082
+ const start = searchText.lastIndexOf('\n', end - 1) + 1;
1083
+ previousLine = searchText.slice(start, end);
1084
+ end = start - 1;
1085
+ }
1086
+ const afterAlias = searchText.slice(match.index + match[0].length, match.index + match[0].length + 60);
1087
+ const ownLine = /^[ \t]*$/.test(linePrefix)
1088
+ && !AUTOPILOT_REFERENCE_HEADING.test(previousLine.replace(AUTOPILOT_MARKDOWN_MARKS, '').replace(AUTOPILOT_LIST_PREFIX, '').replace(/\s+$/, ''))
1089
+ && (AUTOPILOT_COMMAND_AFTER.test(afterAlias) || AUTOPILOT_COLON_VERB.test(afterAlias));
1090
+ const from = ownLine ? lineStart : Math.max(0, match.index - AUTOPILOT_CONTEXT_WINDOW);
1091
+ const to = ownLine ? lineEnd : match.index + match[0].length + AUTOPILOT_CONTEXT_WINDOW;
1092
+ if (isInformationalKeywordContext(searchText.slice(from, to), match.index - from, match[0].length, match[0])) continue;
1093
+ return true;
1094
+ }
1095
+ return false;
1096
+ }
1097
+
942
1098
  function hasActionableRalplanKeyword(text, pattern) {
943
1099
  // Same echo guard as hasActionableKeyword.
944
1100
  const searchText = looksLikeSystemEcho(text)
@@ -984,7 +1140,7 @@ function hasValidWorkflowDescriptor(state, sessionId) {
984
1140
  // Create state file for a mode
985
1141
  const SESSION_ID_ALLOWLIST = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,255}$/;
986
1142
 
987
- async function activateState(directory, prompt, stateName, sessionId) {
1143
+ async function activateState(directory, prompt, stateName, sessionId, options = {}) {
988
1144
  const now = new Date().toISOString();
989
1145
  // Sanitize prompt BEFORE writing to state: prevents pasted system echoes
990
1146
  // and oversized blobs from being persisted and re-emitted by Stop hook.
@@ -1002,10 +1158,18 @@ async function activateState(directory, prompt, stateName, sessionId) {
1002
1158
  session_id: sessionId || undefined,
1003
1159
  project_path: directory,
1004
1160
  reinforcement_count: 0,
1005
- awaiting_confirmation: true,
1006
- awaiting_confirmation_set_at: now,
1007
1161
  last_checked_at: now
1008
1162
  };
1163
+ // A typed `/oh-my-copilot:ralph` IS the confirmation. Arming the
1164
+ // awaiting_confirmation flag would suppress the Stop hook for the
1165
+ // confirmation TTL, and the only clearer (a Skill tool call) never runs on
1166
+ // the slash path. Prose activation keeps the flag.
1167
+ if (options.confirmedBySlash === true) {
1168
+ state.invocation_source = 'slash';
1169
+ } else {
1170
+ state.awaiting_confirmation = true;
1171
+ state.awaiting_confirmation_set_at = now;
1172
+ }
1009
1173
  } else {
1010
1174
  state = {
1011
1175
  active: true,
@@ -1721,7 +1885,8 @@ async function main() {
1721
1885
  }
1722
1886
 
1723
1887
  // Autopilot keywords
1724
- if (hasActionableKeyword(cleanPrompt, /\b(autopilot|auto[\s-]?pilot|fullsend|full\s+auto)\b|(오토파일럿)|(オートパイロット)/i) ||
1888
+ if (hasActionableAutopilotKeyword(cleanPrompt, /\b(autopilot|auto[\s-]?pilot|fullsend|full\s+auto)\b/i) ||
1889
+ hasActionableKeyword(cleanPrompt, /(오토파일럿)|(オートパイロット)/i) ||
1725
1890
  hasActionableKeyword(cleanPrompt, /\b(build|create|make)\s+me\s+(an?\s+)?(app|feature|project|tool|plugin|website|api|server|cli|script|system|service|dashboard|bot|extension)\b/i) ||
1726
1891
  hasActionableKeyword(cleanPrompt, /\bi\s+want\s+a\s+(app|feature|project|tool|plugin|website|api|server|cli|script|system|service|dashboard|bot|extension)\b/i) ||
1727
1892
  hasActionableKeyword(cleanPrompt, /\bi\s+want\s+an\s+(app|feature|project|tool|plugin|website|api|server|cli|script|system|service|dashboard|bot|extension)\b/i)) {
@@ -1824,7 +1989,9 @@ async function main() {
1824
1989
  const sessionId = data.sessionId || data.session_id || data.sessionid || '';
1825
1990
  const stateModes = resolved.filter(m => ['ralph', 'autopilot'].includes(m.name));
1826
1991
  for (const mode of stateModes) {
1827
- const activationError = await activateState(directory, prompt, mode.name, sessionId);
1992
+ const activationError = await activateState(directory, prompt, mode.name, sessionId, {
1993
+ confirmedBySlash: mode.name === 'ralph' && /^\s*\/(?:oh-my-copilot:)?ralph(?:\s|$|:)/i.test(prompt),
1994
+ });
1828
1995
  if (activationError === 'workflow_descriptor_integrity_failed') {
1829
1996
  console.log(JSON.stringify(createHookOutput('workflow_descriptor_integrity_failed')));
1830
1997
  return;
@@ -163,17 +163,23 @@ export async function resolveOmcStateRoot(directory) {
163
163
  * @param {string} directory - Worktree root directory
164
164
  * @param {string} stateName - State name (e.g., "ralph", "ultrawork")
165
165
  * @param {string} [sessionId] - Optional session identifier
166
- * @returns {Promise<{readPath: string, writePath: string}>} Unbranded path pair
166
+ * @param {{fileName?: string}} [options] - Optional exact JSON filename.
167
+ * @returns {Promise<{readPath: string, writePath: string, sessionScopedPath: string|null, legacyPath: string}>} Unbranded paths
167
168
  */
168
- export async function resolveSessionStatePathsForHook(directory, stateName, sessionId) {
169
+ export async function resolveSessionStatePathsForHook(directory, stateName, sessionId, options = {}) {
169
170
  const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT;
170
171
  if (pluginRoot) {
171
172
  try {
172
173
  const { resolveSessionStatePaths } = await import(
173
174
  pathToFileURL(join(pluginRoot, 'dist', 'lib', 'worktree-paths.js')).href
174
175
  );
175
- const result = resolveSessionStatePaths(stateName, sessionId, directory);
176
- return { readPath: result.effectiveRead, writePath: result.effectiveWrite };
176
+ const result = resolveSessionStatePaths(stateName, sessionId, directory, options);
177
+ return {
178
+ readPath: result.effectiveRead,
179
+ writePath: result.effectiveWrite,
180
+ sessionScopedPath: result.sessionScoped || null,
181
+ legacyPath: result.legacy,
182
+ };
177
183
  } catch {
178
184
  // dist not built or unavailable — fall through to inline fallback
179
185
  }
@@ -181,14 +187,19 @@ export async function resolveSessionStatePathsForHook(directory, stateName, sess
181
187
 
182
188
  // Inline fallback: basic session-scoped path derivation (production always uses dist above)
183
189
  const omcRoot = await resolveOmcStateRoot(directory);
190
+ if (options.fileName !== undefined
191
+ && (options.fileName.trim() !== options.fileName || !/^[A-Za-z0-9][A-Za-z0-9_-]*\.json$/.test(options.fileName))) {
192
+ throw new Error(`Invalid session state filename: ${options.fileName}`);
193
+ }
184
194
  const normalizedName = stateName.endsWith('-state') ? stateName : `${stateName}-state`;
185
- const legacy = join(omcRoot, 'state', `${normalizedName}.json`);
195
+ const fileName = options.fileName ?? `${normalizedName}.json`;
196
+ const legacy = join(omcRoot, 'state', options.fileName ?? `${normalizedName}.json`);
186
197
  if (!sessionId) {
187
- return { readPath: legacy, writePath: legacy };
198
+ return { readPath: legacy, writePath: legacy, sessionScopedPath: null, legacyPath: legacy };
188
199
  }
189
- const sessionScoped = join(omcRoot, 'state', 'sessions', sessionId, `${normalizedName}.json`);
200
+ const sessionScoped = join(omcRoot, 'state', 'sessions', sessionId, fileName);
190
201
  // effectiveRead probes the session-scoped file first and falls back to the
191
202
  // legacy path when it does not exist yet (mirrors resolveSessionStatePaths).
192
203
  const readPath = existsSync(sessionScoped) ? sessionScoped : legacy;
193
- return { readPath, writePath: sessionScoped };
204
+ return { readPath, writePath: sessionScoped, sessionScopedPath: sessionScoped, legacyPath: legacy };
194
205
  }