@rt-tools/agent-kit 0.37.1 → 0.39.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 (371) hide show
  1. package/README.md +5 -5
  2. package/assets/checks/action-of.mjs +154 -0
  3. package/assets/checks/board-runs.github.mjs +40 -5
  4. package/assets/checks/check-board.github.mjs +38 -7
  5. package/assets/checks/check-state-next.mjs +22 -10
  6. package/assets/checks/check-turn-map.mjs +26 -6
  7. package/assets/checks/check-work-steps.mjs +4 -173
  8. package/assets/checks/decide.mjs +285 -0
  9. package/assets/checks/decision-table.json +21432 -0
  10. package/assets/checks/decision-table.mjs +495 -0
  11. package/assets/checks/epic-window.mjs +98 -0
  12. package/assets/checks/flow-condition.mjs +64 -0
  13. package/assets/checks/flow-data.mjs +135 -0
  14. package/assets/checks/flow-forecast.mjs +334 -0
  15. package/assets/checks/flow-guard-run.mjs +90 -0
  16. package/assets/checks/flow-guard.mjs +496 -0
  17. package/assets/checks/flow-model.mjs +271 -0
  18. package/assets/checks/flow-override.mjs +130 -0
  19. package/assets/checks/flow-plan.mjs +206 -0
  20. package/assets/checks/flow-scaffold.mjs +224 -0
  21. package/assets/checks/flow-step.mjs +495 -0
  22. package/assets/checks/flow-sync.mjs +296 -0
  23. package/assets/checks/flow-syntax.mjs +292 -0
  24. package/assets/checks/flow-verdict.mjs +227 -0
  25. package/assets/checks/merge-read.mjs +239 -0
  26. package/assets/checks/owner-nudges.mjs +389 -0
  27. package/assets/checks/push-inputs.mjs +59 -16
  28. package/assets/checks/record-count.mjs +437 -0
  29. package/assets/checks/record-recount.mjs +187 -0
  30. package/assets/checks/record-turn.mjs +155 -0
  31. package/assets/checks/task-flow-script.mjs +318 -0
  32. package/assets/checks/tree-assignment.mjs +26 -7
  33. package/assets/checks/work-result.mjs +362 -0
  34. package/assets/checks/work-steps-lib.mjs +205 -0
  35. package/assets/commands/night.md +6 -6
  36. package/assets/defaults/gate-map.sh +39 -12
  37. package/assets/defaults/merges.sh +48 -0
  38. package/assets/defaults/project.sh +6 -5
  39. package/assets/defaults/turn-map.md +23 -22
  40. package/assets/docs/GLOSSARY.md +5 -1
  41. package/assets/hooks/ask-judge.md +67 -0
  42. package/assets/hooks/browser-guard-device-id.sh +11 -9
  43. package/assets/hooks/browser-guard-no-asking.sh +12 -6
  44. package/assets/hooks/browser-guard-no-listing.sh +13 -7
  45. package/assets/hooks/browser-guard-no-other-drivers.sh +25 -17
  46. package/assets/hooks/browser-guard-require-select.sh +15 -15
  47. package/assets/hooks/commit-msg.sh +13 -3
  48. package/assets/hooks/conscience-guard.sh +9 -25
  49. package/assets/hooks/decide.sh +141 -0
  50. package/assets/hooks/deny-tail.sh +16 -11
  51. package/assets/hooks/dev-server-guard.sh +27 -20
  52. package/assets/hooks/dispatch.sh +47 -4
  53. package/assets/hooks/docs-guard.sh +31 -200
  54. package/assets/hooks/end-conversation-guard.sh +12 -21
  55. package/assets/hooks/epic-stop-guard.sh +54 -152
  56. package/assets/hooks/exam-guard.sh +32 -65
  57. package/assets/hooks/facts-docs.sh +221 -0
  58. package/assets/hooks/facts-flow.sh +173 -0
  59. package/assets/hooks/facts.sh +374 -0
  60. package/assets/hooks/flow-step-guard.sh +93 -0
  61. package/assets/hooks/git-guard-delivery-body.sh +4 -4
  62. package/assets/hooks/git-guard-delivery-conflict.sh +16 -10
  63. package/assets/hooks/git-guard-delivery-draft.sh +3 -3
  64. package/assets/hooks/git-guard-delivery-epic.sh +18 -9
  65. package/assets/hooks/git-guard-delivery-folder.sh +32 -7
  66. package/assets/hooks/git-guard-delivery-merge.sh +2 -2
  67. package/assets/hooks/git-guard-delivery-merged.sh +12 -1
  68. package/assets/hooks/git-guard-delivery-pipeline.sh +1 -1
  69. package/assets/hooks/git-guard-delivery-rerun.sh +44 -0
  70. package/assets/hooks/git-guard-delivery-signature.sh +82 -45
  71. package/assets/hooks/git-guard-delivery-task.sh +47 -0
  72. package/assets/hooks/git-guard-delivery.sh +112 -101
  73. package/assets/hooks/git-guard-discard.sh +8 -18
  74. package/assets/hooks/git-guard-main.sh +13 -19
  75. package/assets/hooks/git-guard-no-verify.sh +56 -16
  76. package/assets/hooks/git-guard-push-ahead.sh +39 -6
  77. package/assets/hooks/git-guard-push-marks.sh +262 -13
  78. package/assets/hooks/git-guard-push-tests.sh +58 -52
  79. package/assets/hooks/git-guard-tree-assignment.sh +7 -4
  80. package/assets/hooks/guard-note.sh +8 -6
  81. package/assets/hooks/handoff-entry-guard.sh +19 -38
  82. package/assets/hooks/handoff-write.sh +3 -1
  83. package/assets/hooks/hook-input.sh +0 -41
  84. package/assets/hooks/metric-marks.sh +19 -7
  85. package/assets/hooks/observe.sh +1 -1
  86. package/assets/hooks/override-write-guard.sh +27 -9
  87. package/assets/hooks/pre-push.sh +40 -12
  88. package/assets/hooks/prose-style-guard.sh +6 -19
  89. package/assets/hooks/pull-merges.sh +76 -0
  90. package/assets/hooks/push-ahead-call-guard.sh +447 -0
  91. package/assets/hooks/push-set.sh +38 -8
  92. package/assets/hooks/qa-dataid-guard.sh +7 -17
  93. package/assets/hooks/record-turn.sh +52 -0
  94. package/assets/hooks/rerun-guard.sh +11 -16
  95. package/assets/hooks/reuse-first-guard.sh +7 -21
  96. package/assets/hooks/role-calls.sh +25 -3
  97. package/assets/hooks/rule-source-guard.sh +54 -21
  98. package/assets/hooks/skill-gate-rearm.sh +18 -5
  99. package/assets/hooks/skill-gate.sh +156 -20
  100. package/assets/hooks/skill-loaded.sh +18 -3
  101. package/assets/hooks/sql-guard-target.sh +2 -2
  102. package/assets/hooks/sql-guard-write.sh +12 -12
  103. package/assets/hooks/sql-guard.sh +58 -16
  104. package/assets/hooks/task-context-load.sh +3 -1
  105. package/assets/hooks/task-flow-context.sh +5 -18
  106. package/assets/hooks/task-flow-draft-guard.sh +25 -74
  107. package/assets/hooks/task-flow-guard.sh +28 -130
  108. package/assets/hooks/tree-assignment-guard.sh +25 -14
  109. package/assets/hooks/turn-entry-load.sh +3 -1
  110. package/assets/hooks/turn-exit-guard.sh +92 -452
  111. package/assets/hooks/turn-exit-role.sh +3 -1
  112. package/assets/hooks/turn-judge.md +113 -0
  113. package/assets/hooks/window-fill-guard.sh +22 -41
  114. package/assets/patterns/doc-style-human.md +36 -76
  115. package/assets/patterns/git-workflow-commit.azure.md +9 -155
  116. package/assets/patterns/git-workflow-commit.github.md +11 -269
  117. package/assets/patterns/git-workflow-commit.gitlab.md +9 -161
  118. package/assets/patterns/git-workflow-docker.md +8 -231
  119. package/assets/patterns/git-workflow-freshness.md +8 -56
  120. package/assets/patterns/git-workflow-merge.md +6 -176
  121. package/assets/patterns/git-workflow-migration.md +5 -75
  122. package/assets/patterns/git-workflow-pr-body.github.md +6 -159
  123. package/assets/patterns/git-workflow-pr-ready.md +9 -70
  124. package/assets/patterns/git-workflow-pr.azure.md +13 -285
  125. package/assets/patterns/git-workflow-pr.github.md +13 -251
  126. package/assets/patterns/git-workflow-pr.gitlab.md +13 -286
  127. package/assets/patterns/git-workflow-restart.md +5 -42
  128. package/assets/patterns/git-workflow-secrets.md +10 -76
  129. package/assets/patterns/git-workflow-stack.md +7 -207
  130. package/assets/patterns/status-report-table.github.md +1 -1
  131. package/assets/patterns/task-flow-archive.md +12 -233
  132. package/assets/patterns/task-flow-close.md +16 -292
  133. package/assets/patterns/task-flow-cycle.md +13 -39
  134. package/assets/patterns/task-flow-graph.needs-graph.md +8 -62
  135. package/assets/patterns/task-flow-handoff.md +13 -161
  136. package/assets/patterns/task-flow-resume.md +18 -218
  137. package/assets/patterns/task-flow-start.md +9 -247
  138. package/assets/patterns/turn-entry-map.md +2 -2
  139. package/assets/pitfalls/agent-kit-extend.md +200 -0
  140. package/assets/pitfalls/agent-kit.2.md +323 -0
  141. package/assets/pitfalls/angular-patterns.md +98 -0
  142. package/assets/pitfalls/browser-verification.md +265 -0
  143. package/assets/pitfalls/component-structure.md +98 -0
  144. package/assets/pitfalls/dependencies.md +92 -0
  145. package/assets/pitfalls/deploy-flow.azure.md +171 -0
  146. package/assets/pitfalls/deploy-flow.github.md +211 -0
  147. package/assets/pitfalls/deploy-flow.gitlab.md +173 -0
  148. package/assets/pitfalls/doc-style-human.md +112 -0
  149. package/assets/pitfalls/doc-style.2.md +286 -0
  150. package/assets/pitfalls/entity-conventions.needs-admin.md +96 -0
  151. package/assets/pitfalls/entity-models.md +89 -0
  152. package/assets/pitfalls/epic-flow.md +92 -0
  153. package/assets/pitfalls/git-workflow-commit.azure.md +190 -0
  154. package/assets/pitfalls/git-workflow-commit.github.md +307 -0
  155. package/assets/pitfalls/git-workflow-commit.gitlab.md +196 -0
  156. package/assets/pitfalls/git-workflow-docker.md +275 -0
  157. package/assets/pitfalls/git-workflow-freshness.md +88 -0
  158. package/assets/pitfalls/git-workflow-hosting.azure.md +31 -0
  159. package/assets/pitfalls/git-workflow-hosting.github.md +32 -0
  160. package/assets/pitfalls/git-workflow-hosting.gitlab.md +31 -0
  161. package/assets/pitfalls/git-workflow-merge.md +220 -0
  162. package/assets/pitfalls/git-workflow-migration.md +103 -0
  163. package/assets/pitfalls/git-workflow-pr-body.github.md +185 -0
  164. package/assets/pitfalls/git-workflow-pr-ready.md +104 -0
  165. package/assets/pitfalls/git-workflow-pr.2.azure.md +172 -0
  166. package/assets/pitfalls/git-workflow-pr.2.github.md +184 -0
  167. package/assets/pitfalls/git-workflow-pr.2.gitlab.md +180 -0
  168. package/assets/pitfalls/git-workflow-pr.azure.md +159 -0
  169. package/assets/pitfalls/git-workflow-pr.github.md +107 -0
  170. package/assets/pitfalls/git-workflow-pr.gitlab.md +151 -0
  171. package/assets/pitfalls/git-workflow-push.azure.md +30 -0
  172. package/assets/pitfalls/git-workflow-push.github.md +30 -0
  173. package/assets/pitfalls/git-workflow-push.gitlab.md +30 -0
  174. package/assets/pitfalls/git-workflow-queue.azure.md +30 -0
  175. package/assets/pitfalls/git-workflow-queue.github.md +30 -0
  176. package/assets/pitfalls/git-workflow-queue.gitlab.md +30 -0
  177. package/assets/pitfalls/git-workflow-restart.md +72 -0
  178. package/assets/pitfalls/git-workflow-secrets.md +114 -0
  179. package/assets/pitfalls/git-workflow-stack.md +254 -0
  180. package/assets/pitfalls/git-workflow.2.azure.md +291 -0
  181. package/assets/pitfalls/git-workflow.2.github.md +294 -0
  182. package/assets/pitfalls/git-workflow.2.gitlab.md +278 -0
  183. package/assets/pitfalls/lib-layers.md +114 -0
  184. package/assets/pitfalls/lists.md +117 -0
  185. package/assets/pitfalls/mockups.needs-mockups.md +87 -0
  186. package/assets/pitfalls/navigation.md +94 -0
  187. package/assets/pitfalls/observability.needs-app.md +186 -0
  188. package/assets/pitfalls/platform-access.md +94 -0
  189. package/assets/pitfalls/queue-audit.github.md +78 -0
  190. package/assets/pitfalls/reuse-first.md +201 -0
  191. package/assets/pitfalls/spec-driven.2.md +318 -0
  192. package/assets/pitfalls/styling-bem.2.md +125 -0
  193. package/assets/pitfalls/task-flow-archive.md +265 -0
  194. package/assets/pitfalls/task-flow-close.2.md +166 -0
  195. package/assets/pitfalls/task-flow-close.md +167 -0
  196. package/assets/pitfalls/task-flow-cycle.md +73 -0
  197. package/assets/pitfalls/task-flow-graph.needs-graph.md +98 -0
  198. package/assets/pitfalls/task-flow-handoff.md +200 -0
  199. package/assets/pitfalls/task-flow-handover.md +30 -0
  200. package/assets/pitfalls/task-flow-owner.md +58 -0
  201. package/assets/pitfalls/task-flow-plan.md +29 -0
  202. package/assets/pitfalls/task-flow-resume.md +257 -0
  203. package/assets/pitfalls/task-flow-start.md +287 -0
  204. package/assets/pitfalls/task-flow.2.md +303 -0
  205. package/assets/pitfalls/task-flow.md +4 -4
  206. package/assets/pitfalls/testing.2.md +279 -0
  207. package/assets/pitfalls/turn-conduct.md +16 -17
  208. package/assets/pitfalls/typescript-conventions.md +161 -0
  209. package/assets/pitfalls/write-a-skill.md +128 -0
  210. package/assets/rules/angular-patterns.md +21 -86
  211. package/assets/rules/autonomous-work.md +2 -2
  212. package/assets/rules/browser-verification.md +28 -256
  213. package/assets/rules/component-structure.md +25 -87
  214. package/assets/rules/dependencies.md +20 -78
  215. package/assets/rules/deploy-flow.azure.md +26 -156
  216. package/assets/rules/deploy-flow.github.md +34 -200
  217. package/assets/rules/deploy-flow.gitlab.md +27 -159
  218. package/assets/rules/doc-style.md +32 -286
  219. package/assets/rules/entity-conventions.needs-admin.md +26 -82
  220. package/assets/rules/entity-models.md +14 -63
  221. package/assets/rules/epic-flow.md +24 -63
  222. package/assets/rules/git-workflow-hosting.azure.md +26 -0
  223. package/assets/rules/git-workflow-hosting.github.md +38 -0
  224. package/assets/rules/git-workflow-hosting.gitlab.md +27 -0
  225. package/assets/rules/git-workflow-push.azure.md +28 -0
  226. package/assets/rules/git-workflow-push.github.md +28 -0
  227. package/assets/rules/git-workflow-push.gitlab.md +28 -0
  228. package/assets/rules/git-workflow-queue.azure.md +23 -0
  229. package/assets/rules/git-workflow-queue.github.md +30 -0
  230. package/assets/rules/git-workflow-queue.gitlab.md +23 -0
  231. package/assets/rules/git-workflow.azure.md +21 -282
  232. package/assets/rules/git-workflow.github.md +24 -284
  233. package/assets/rules/git-workflow.gitlab.md +21 -269
  234. package/assets/rules/lib-layers.md +30 -103
  235. package/assets/rules/lists.md +21 -105
  236. package/assets/rules/mockups.needs-mockups.md +25 -64
  237. package/assets/rules/navigation.md +10 -69
  238. package/assets/rules/observability.needs-app.md +43 -172
  239. package/assets/rules/platform-access.md +28 -75
  240. package/assets/rules/queue-audit.github.md +25 -52
  241. package/assets/rules/reuse-first.md +20 -195
  242. package/assets/rules/spec-driven.md +35 -308
  243. package/assets/rules/styling-bem.md +20 -117
  244. package/assets/rules/task-flow-handover.md +24 -0
  245. package/assets/rules/task-flow-owner.md +34 -0
  246. package/assets/rules/task-flow-plan.md +38 -0
  247. package/assets/rules/task-flow.md +22 -300
  248. package/assets/rules/testing.md +32 -273
  249. package/assets/rules/turn-conduct.md +105 -106
  250. package/assets/rules/turn-entry.md +2 -2
  251. package/assets/rules/typescript-conventions.md +41 -147
  252. package/assets/samples/tasks/_template/plan.md +30 -6
  253. package/assets/samples/tasks/_template/progress.md +0 -1
  254. package/assets/skills/agent-kit-extend.md +25 -168
  255. package/assets/skills/agent-kit.md +27 -299
  256. package/assets/skills/write-a-skill.md +20 -106
  257. package/assets/task-flow/flow.js +184 -0
  258. package/assets/task-flow/flow.md +101 -0
  259. package/assets/task-flow/measure/agreement.mjs +24 -0
  260. package/assets/task-flow/measure/ci.mjs +184 -0
  261. package/assets/task-flow/measure/copy.mjs +22 -0
  262. package/assets/task-flow/measure/epic-of.mjs +50 -0
  263. package/assets/task-flow/measure/epic-text.mjs +35 -0
  264. package/assets/task-flow/measure/epic.mjs +114 -0
  265. package/assets/task-flow/measure/folder.mjs +16 -0
  266. package/assets/task-flow/measure/footprint.mjs +28 -0
  267. package/assets/task-flow/measure/grill.mjs +21 -0
  268. package/assets/task-flow/measure/host.mjs +8 -0
  269. package/assets/task-flow/measure/owner.mjs +27 -0
  270. package/assets/task-flow/measure/plan.mjs +27 -0
  271. package/assets/task-flow/measure/pr.mjs +20 -0
  272. package/assets/task-flow/measure/progress.mjs +50 -0
  273. package/assets/task-flow/measure/session.mjs +252 -0
  274. package/assets/task-flow/measure/task.mjs +23 -0
  275. package/assets/task-flow/measure/text.mjs +77 -0
  276. package/assets/task-flow/source/git.mjs +254 -0
  277. package/assets/task-flow/source/host.mjs +277 -0
  278. package/assets/task-flow/source/marks.mjs +56 -0
  279. package/assets/task-flow/source/owner.mjs +94 -0
  280. package/assets/task-flow/source/records.mjs +116 -0
  281. package/assets/task-flow/source/session.mjs +269 -0
  282. package/assets/task-flow/source/steps.mjs +28 -0
  283. package/assets/task-flow/source/tree.mjs +42 -0
  284. package/bin/agent-kit.d.ts.map +1 -1
  285. package/bin/agent-kit.js +30 -0
  286. package/bin/agent-kit.js.map +1 -1
  287. package/lib/agent-checks.d.ts +55 -0
  288. package/lib/agent-checks.d.ts.map +1 -0
  289. package/lib/agent-checks.js +221 -0
  290. package/lib/agent-checks.js.map +1 -0
  291. package/lib/assets.d.ts.map +1 -1
  292. package/lib/assets.js +7 -2
  293. package/lib/assets.js.map +1 -1
  294. package/lib/cargo.d.ts +29 -0
  295. package/lib/cargo.d.ts.map +1 -1
  296. package/lib/cargo.js +27 -1
  297. package/lib/cargo.js.map +1 -1
  298. package/lib/cascade.d.ts.map +1 -1
  299. package/lib/cascade.js +3 -1
  300. package/lib/cascade.js.map +1 -1
  301. package/lib/commands.d.ts.map +1 -1
  302. package/lib/commands.js +78 -2
  303. package/lib/commands.js.map +1 -1
  304. package/lib/config.d.ts +18 -0
  305. package/lib/config.d.ts.map +1 -1
  306. package/lib/config.js +18 -1
  307. package/lib/config.js.map +1 -1
  308. package/lib/epic-window-send.d.ts +74 -0
  309. package/lib/epic-window-send.d.ts.map +1 -0
  310. package/lib/epic-window-send.js +166 -0
  311. package/lib/epic-window-send.js.map +1 -0
  312. package/lib/hooks-map.d.ts +4 -0
  313. package/lib/hooks-map.d.ts.map +1 -1
  314. package/lib/hooks-map.js +2 -2
  315. package/lib/hooks-map.js.map +1 -1
  316. package/lib/integrity.d.ts +3 -0
  317. package/lib/integrity.d.ts.map +1 -1
  318. package/lib/integrity.js +7 -0
  319. package/lib/integrity.js.map +1 -1
  320. package/lib/metric-lines.d.ts +2 -1
  321. package/lib/metric-lines.d.ts.map +1 -1
  322. package/lib/metric-lines.js +49 -1
  323. package/lib/metric-lines.js.map +1 -1
  324. package/lib/metric-send-mark.d.ts +6 -3
  325. package/lib/metric-send-mark.d.ts.map +1 -1
  326. package/lib/metric-send-mark.js +15 -5
  327. package/lib/metric-send-mark.js.map +1 -1
  328. package/lib/metric-send.d.ts +6 -2
  329. package/lib/metric-send.d.ts.map +1 -1
  330. package/lib/metric-send.js +47 -13
  331. package/lib/metric-send.js.map +1 -1
  332. package/lib/metrics.d.ts +17 -0
  333. package/lib/metrics.d.ts.map +1 -1
  334. package/lib/metrics.js +26 -15
  335. package/lib/metrics.js.map +1 -1
  336. package/lib/observations.js +3 -3
  337. package/lib/observations.js.map +1 -1
  338. package/lib/outcomes.d.ts +5 -2
  339. package/lib/outcomes.d.ts.map +1 -1
  340. package/lib/outcomes.js +5 -4
  341. package/lib/outcomes.js.map +1 -1
  342. package/lib/push-gate.d.ts +13 -0
  343. package/lib/push-gate.d.ts.map +1 -1
  344. package/lib/push-gate.js +11 -7
  345. package/lib/push-gate.js.map +1 -1
  346. package/lib/push-set-usefulness.d.ts +78 -0
  347. package/lib/push-set-usefulness.d.ts.map +1 -0
  348. package/lib/push-set-usefulness.js +225 -0
  349. package/lib/push-set-usefulness.js.map +1 -0
  350. package/lib/sync.d.ts +10 -0
  351. package/lib/sync.d.ts.map +1 -1
  352. package/lib/sync.js +14 -1
  353. package/lib/sync.js.map +1 -1
  354. package/lib/work-result.d.ts +43 -0
  355. package/lib/work-result.d.ts.map +1 -0
  356. package/lib/work-result.js +39 -0
  357. package/lib/work-result.js.map +1 -0
  358. package/package.json +1 -1
  359. package/assets/hooks/claim-guard.sh +0 -212
  360. package/assets/hooks/grill-gate-ask.sh +0 -26
  361. package/assets/hooks/grill-gate-bypass.sh +0 -61
  362. package/assets/hooks/grill-gate-options.sh +0 -50
  363. package/assets/hooks/grill-gate.sh +0 -482
  364. package/assets/hooks/postmortem-guard.sh +0 -124
  365. package/assets/hooks/proposal-guard.sh +0 -154
  366. package/assets/hooks/stand-login-guard.sh +0 -107
  367. package/assets/hooks/turn-exit-epic.sh +0 -173
  368. package/assets/hooks/turn-exit-patterns.sh +0 -123
  369. package/assets/hooks/turn-exit-verdict.sh +0 -149
  370. package/assets/hooks/waiting-turn-guard.sh +0 -320
  371. package/assets/hooks/work-start-guard.sh +0 -175
@@ -0,0 +1,389 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The measures of the guards of the end of a turn, read from the session records of this tree.
4
+ *
5
+ * node owner-nudges.mjs --days 7 --until 2026-11-15 nudges of the owner per 100 calls
6
+ * node owner-nudges.mjs --typed --since 2026-10-13 --until … typed messages of the owner
7
+ * node owner-nudges.mjs --refusals --days 1 --until 2026-11-14 refusals per 100 calls
8
+ * node owner-nudges.mjs --deadlocks --days 7 --until 2026-11-15 series of stop refusals
9
+ * node owner-nudges.mjs --missed --last 200 turns ended with open work
10
+ *
11
+ * The records are the jsonl files of Claude Code under `--root` (by default `~/.claude/projects`),
12
+ * in the directories of every copy of the tree: the main checkout named by `--tree` (by default the
13
+ * checkout that holds the common directory of git) and its worktrees under `.claude/worktrees/`.
14
+ * Only the session files are read, not the records of subagents: an owner message lives only there.
15
+ * An entry copied into a resumed session is counted once, by its id.
16
+ *
17
+ * The window is whole days of UTC: `--until <date>` includes that day, `--days N` goes N days back
18
+ * from its end, `--since <date>` starts at that day. A moment with a time is taken as it is. The
19
+ * moment is always a parameter: the decisions below never read the clock.
20
+ *
21
+ * A nudge is a typed owner message the pattern `words.nudge` of the task flow description matches;
22
+ * a call is a tool use of the agent. A refusal is a mark `BLOCKED by <guard>:` in the feedback of a
23
+ * stop hook or in the hook error a tool call got back. A deadlock is a series of 10 and more stop
24
+ * refusals in a row with one guard and one first line of the reason — the line that names the
25
+ * state and the step; a stop that passed or a refusal with another line ends the series.
26
+ *
27
+ * The missed stops are read in the last `--last` calls after the layout of the engine: the moment
28
+ * of the first commit that added it to the tree, or `--layout <moment>`. A turn that ended there,
29
+ * on a branch that carries the engine, while no release case of the description released it is
30
+ * missed.
31
+ */
32
+ import { spawnSync } from 'node:child_process';
33
+ import { existsSync, readdirSync, statSync } from 'node:fs';
34
+ import { homedir } from 'node:os';
35
+ import { dirname, join, resolve } from 'node:path';
36
+ import { fileURLToPath, pathToFileURL } from 'node:url';
37
+
38
+ import { buildModel } from './flow-model.mjs';
39
+ import { readRecord } from './flow-plan.mjs';
40
+ // The owner's words are read by the counter of the record, the same rule the engine reads them by.
41
+ import { typedOf } from './record-count.mjs';
42
+
43
+ const DAY = 24 * 60 * 60 * 1000;
44
+
45
+ /** The mark of a refusal: at the start of a line or right after the prefix of the harness. */
46
+ const MARK = /(?:^|\n|: )BLOCKED by ([a-z0-9][a-z0-9-]*):([^\n]*)/g;
47
+
48
+ /** The text the harness gives back to a tool call a hook refused. */
49
+ const HOOK_ERROR = /^\S+ hook error: /;
50
+
51
+ /** The text the harness hands the agent after a stop hook refused. */
52
+ const STOP_FEEDBACK = 'Stop hook feedback:';
53
+
54
+ /** The rewritten exit check. */
55
+ export const EXIT_GUARDS = ['turn-exit-guard'];
56
+
57
+ /** The checks of the executable scenario: the rewritten exit check and the guard of the course of work. */
58
+ export const NEW_GUARDS = ['turn-exit-guard', 'flow-step-guard'];
59
+
60
+ /**
61
+ * The seven checks of the base that judged the conversation, and the agent hooks that carry their
62
+ * requirements since they were removed.
63
+ */
64
+ export const BASE_GUARDS = [
65
+ 'grill-gate', 'grill-gate-ask', 'claim-guard', 'waiting-turn-guard', 'postmortem-guard', 'work-start-guard',
66
+ 'proposal-guard', 'stand-login-guard', 'turn-judge', 'ask-judge',
67
+ ];
68
+
69
+ /** The length from which a series of stop refusals is a deadlock. */
70
+ export const SERIES = 10;
71
+
72
+ /** The directory name Claude Code gives the records of a path. */
73
+ export const recordDirOf = (path) => path.replace(/[^A-Za-z0-9]/g, '-');
74
+
75
+ /** A directory of records belongs to a copy of the tree: the main checkout or one of its worktrees. */
76
+ export function isCopyDir(name, tree) {
77
+ const own = recordDirOf(tree);
78
+ return name === own || name.startsWith(`${own}--claude-worktrees-`);
79
+ }
80
+
81
+ const momentOf = (text, endOfDay) => {
82
+ const day = /^\d{4}-\d{2}-\d{2}$/.test(text);
83
+ const at = Date.parse(day ? `${text}T00:00:00Z` : text);
84
+ if (Number.isNaN(at)) throw new Error(`not a date: ${text}`);
85
+ return day && endOfDay ? at + DAY : at;
86
+ };
87
+
88
+ /** The window `{ from, to }` in ms, the end excluded. */
89
+ export function windowOf({ until, since, days }) {
90
+ if (!until) throw new Error('the window needs --until');
91
+ const to = momentOf(until, true);
92
+ if (since) return { from: momentOf(since, false), to };
93
+ if (!Number.isInteger(days) || days < 1) throw new Error('the window needs --days N or --since <date>');
94
+ return { from: to - days * DAY, to };
95
+ }
96
+
97
+ const inWindow = (entry, window) => {
98
+ const at = Date.parse(entry?.timestamp ?? '');
99
+ return at >= window.from && at < window.to;
100
+ };
101
+
102
+ const partsOf = (entry) => (Array.isArray(entry?.message?.content) ? entry.message.content : []);
103
+
104
+ /**
105
+ * The text the owner typed in an entry, before a turn or during one, or null: a tool result, a menu
106
+ * answer and a wrapper of the harness are none.
107
+ */
108
+ export function typedText(entry) {
109
+ if (entry?.isSidechain || entry?.toolUseResult) return null;
110
+ const word = typedOf(entry);
111
+ return word && word.text.trim() !== '' ? word.text : null;
112
+ }
113
+
114
+ /** The ids of the tool calls in an entry of the agent. */
115
+ export function callsOf(entry) {
116
+ if (entry?.type !== 'assistant' || entry.isSidechain) return [];
117
+ return partsOf(entry)
118
+ .map((part, index) => (part?.type === 'tool_use' ? (part.id ?? `${entry.uuid}:${index}`) : null))
119
+ .filter((id) => id !== null);
120
+ }
121
+
122
+ const textOf = (content) =>
123
+ typeof content === 'string'
124
+ ? content
125
+ : Array.isArray(content)
126
+ ? content.map((part) => (typeof part === 'string' ? part : (part?.text ?? ''))).join('\n')
127
+ : '';
128
+
129
+ const marksOf = (text, stop) => [...text.matchAll(MARK)].map((match) => ({ guard: match[1], line: match[2].trim(), stop }));
130
+
131
+ /** The refusals an entry carries: `[{ guard, line, stop }]`, `stop` for a refusal of the end of a turn. */
132
+ export function refusalsOf(entry) {
133
+ if (entry?.type !== 'user' || entry.isSidechain) return [];
134
+ const content = entry.message?.content;
135
+ const text = textOf(typeof content === 'string' ? content : partsOf(entry).filter((part) => part?.type === 'text'));
136
+ if (text.startsWith(STOP_FEEDBACK)) return marksOf(text, true);
137
+ return partsOf(entry)
138
+ .filter((part) => part?.type === 'tool_result' && part.is_error)
139
+ .map((part) => textOf(part.content))
140
+ .filter((result) => HOOK_ERROR.test(result))
141
+ .flatMap((result) => marksOf(result, false));
142
+ }
143
+
144
+ /** A stop the hooks let through: the summary of the stop hooks names no refusal. */
145
+ export const stopPassed = (entry) =>
146
+ entry?.type === 'system' && entry.subtype === 'stop_hook_summary' && !(entry.hookErrors ?? []).some((error) => String(error).includes('BLOCKED by'));
147
+
148
+ /**
149
+ * The entries of the copies in the window, each once: `{ copy, session, entry }`. An entry copied
150
+ * into a resumed session carries the same id and is skipped the second time.
151
+ */
152
+ export function* entriesOf(copies, window) {
153
+ const seen = new Set();
154
+ for (const copy of copies) {
155
+ for (const session of copy.sessions) {
156
+ for (const entry of session.entries) {
157
+ if (!inWindow(entry, window)) continue;
158
+ if (entry.uuid) {
159
+ if (seen.has(entry.uuid)) continue;
160
+ seen.add(entry.uuid);
161
+ }
162
+ yield { copy: copy.name, session: session.id, entry };
163
+ }
164
+ }
165
+ }
166
+ }
167
+
168
+ const countCalls = (copies, window) => {
169
+ const ids = new Set();
170
+ for (const { entry } of entriesOf(copies, window)) for (const id of callsOf(entry)) ids.add(id);
171
+ return ids.size;
172
+ };
173
+
174
+ /** Nudges and calls in the window: `{ nudges, calls }`. */
175
+ export function measureNudges(copies, window, nudge) {
176
+ const pattern = new RegExp(nudge, 'iu');
177
+ let nudges = 0;
178
+ for (const { entry } of entriesOf(copies, window)) {
179
+ const text = typedText(entry);
180
+ if (text !== null && pattern.test(text)) nudges += 1;
181
+ }
182
+ return { nudges, calls: countCalls(copies, window) };
183
+ }
184
+
185
+ /** Typed owner messages in the window and the copies that hold them: `{ messages, copies }`. */
186
+ export function measureTyped(copies, window) {
187
+ let messages = 0;
188
+ const holding = new Set();
189
+ for (const { copy, entry } of entriesOf(copies, window)) {
190
+ if (typedText(entry) === null) continue;
191
+ messages += 1;
192
+ holding.add(copy);
193
+ }
194
+ return { messages, copies: holding.size };
195
+ }
196
+
197
+ /** Refusals in the window by group and the calls: `{ calls, all, exit, base, fresh }`. */
198
+ export function measureRefusals(copies, window) {
199
+ const counts = { all: 0, exit: 0, base: 0, fresh: 0 };
200
+ for (const { entry } of entriesOf(copies, window)) {
201
+ for (const { guard } of refusalsOf(entry)) {
202
+ counts.all += 1;
203
+ if (EXIT_GUARDS.includes(guard)) counts.exit += 1;
204
+ if (BASE_GUARDS.includes(guard)) counts.base += 1;
205
+ if (NEW_GUARDS.includes(guard)) counts.fresh += 1;
206
+ }
207
+ }
208
+ return { calls: countCalls(copies, window), ...counts };
209
+ }
210
+
211
+ /**
212
+ * The deadlocks in the window: `[{ session, key, refusals }]`. A series runs over the stop refusals of
213
+ * one session with one key — the guard and the first line of its reason. Calls and owner messages
214
+ * between them do not end it: in a deadlock the agent keeps trying and the owner keeps writing. A
215
+ * stop that passed ends it, unless a refusal of an agent hook follows the summary of that stop.
216
+ */
217
+ export function findDeadlocks(copies, window) {
218
+ const found = [];
219
+ const sessions = new Map();
220
+ for (const { copy, session, entry } of entriesOf(copies, window)) {
221
+ const id = `${copy}/${session}`;
222
+ if (!sessions.has(id)) sessions.set(id, []);
223
+ sessions.get(id).push(entry);
224
+ }
225
+ for (const [session, entries] of sessions) {
226
+ let run = null;
227
+ let passed = false;
228
+ const close = () => {
229
+ if (run && run.refusals >= SERIES) found.push({ session, ...run });
230
+ run = null;
231
+ passed = false;
232
+ };
233
+ for (const entry of entries) {
234
+ const stops = refusalsOf(entry).filter((refusal) => refusal.stop);
235
+ if (stops.length > 0) {
236
+ passed = false;
237
+ for (const { guard, line } of stops) {
238
+ const key = `${guard}: ${line}`;
239
+ if (run?.key !== key) close();
240
+ run = run ?? { key, refusals: 0 };
241
+ run.refusals += 1;
242
+ }
243
+ } else if (stopPassed(entry)) {
244
+ passed = true;
245
+ } else if (passed && (entry.type === 'assistant' || typedText(entry) !== null)) {
246
+ close();
247
+ }
248
+ }
249
+ close();
250
+ }
251
+ return found;
252
+ }
253
+
254
+ /** A count per hundred calls with two decimals. */
255
+ export const per100 = (count, calls) => (calls > 0 ? (count * 100) / calls : 0).toFixed(2);
256
+
257
+ export const nudgesLine = ({ nudges, calls }) => `owner nudges per 100 calls: ${per100(nudges, calls)} (${nudges} nudges, ${calls} calls)`;
258
+
259
+ export const typedLine = ({ messages, copies }) => `owner typed messages: ${messages} in ${copies} copies`;
260
+
261
+ export const refusalsLine = ({ calls, all, exit, base, fresh }) =>
262
+ `refusals per 100 calls: all ${per100(all, calls)}, exit ${per100(exit, calls)}, base ${per100(base, calls)}, new ${per100(fresh, calls)}`;
263
+
264
+ export const deadlocksLine = (series) =>
265
+ `deadlocks: ${series.length} series of ${SERIES}+ stop refusals at one state and step, ${series.reduce((sum, s) => sum + s.refusals, 0)} refusals`;
266
+
267
+ const USAGE =
268
+ 'usage: node owner-nudges.mjs [--typed | --refusals | --deadlocks] (--days N | --since <date>) [--until <date>] [--root <dir>] [--tree <path>] [--flow <flow.js>]\n node owner-nudges.mjs --missed --last N [--layout <moment>] [--root <dir>] [--tree <path>] [--flow <flow.js>]';
269
+
270
+ /** The arguments of the command line, or a thrown error naming what is wrong. */
271
+ export function parseArgs(argv) {
272
+ const args = { mode: 'nudges' };
273
+ const modes = { '--typed': 'typed', '--refusals': 'refusals', '--deadlocks': 'deadlocks', '--missed': 'missed' };
274
+ const values = { '--days': 'days', '--since': 'since', '--until': 'until', '--root': 'root', '--tree': 'tree', '--flow': 'flow', '--last': 'last', '--layout': 'layout' };
275
+ for (let index = 0; index < argv.length; index += 1) {
276
+ const arg = argv[index];
277
+ if (arg in modes) {
278
+ if (args.mode !== 'nudges') throw new Error('one measure at a time');
279
+ args.mode = modes[arg];
280
+ } else if (arg in values) {
281
+ const value = argv[index + 1];
282
+ if (value === undefined || value.startsWith('--')) throw new Error(`${arg} needs a value`);
283
+ args[values[arg]] = values[arg] === 'days' || values[arg] === 'last' ? Number(value) : value;
284
+ index += 1;
285
+ } else {
286
+ throw new Error(`unknown argument: ${arg}`);
287
+ }
288
+ }
289
+ return args;
290
+ }
291
+
292
+ /** The moment of the first of the last `last` calls in the window, or the start of the window when there are fewer. */
293
+ export function lastCallsFrom(copies, window, last) {
294
+ const moments = [];
295
+ for (const { entry } of entriesOf(copies, window)) for (const _ of callsOf(entry)) moments.push(Date.parse(entry.timestamp));
296
+ moments.sort((a, b) => a - b);
297
+ return moments.length > last ? moments[moments.length - last] : window.from;
298
+ }
299
+
300
+ /** The moment the engine was laid out: the first commit of any branch that added it, or null. */
301
+ export function layoutMoment(tree) {
302
+ const run = spawnSync('git', ['-C', tree, 'log', '--all', '--diff-filter=A', '--reverse', '--format=%ct', '--', 'tools/task-flow-script.mjs'], { encoding: 'utf8' });
303
+ const first = run.status === 0 ? run.stdout.trim().split('\n')[0] : '';
304
+ return first ? Number(first) * 1000 : null;
305
+ }
306
+
307
+ /** Whether a branch carries the engine; a branch removed since is taken as one without it. */
308
+ export function branchLaid(tree) {
309
+ const known = new Map();
310
+ return (branch) => {
311
+ if (!branch) return false;
312
+ if (!known.has(branch)) {
313
+ const run = spawnSync('git', ['-C', tree, 'cat-file', '-e', `${branch}:tools/task-flow-script.mjs`], { encoding: 'utf8' });
314
+ known.set(branch, run.status === 0);
315
+ }
316
+ return known.get(branch);
317
+ };
318
+ }
319
+
320
+ /** The copies of the tree with their session records; a file last written before the window is skipped. */
321
+ export function readCopies(root, tree, window) {
322
+ if (!existsSync(root)) return [];
323
+ return readdirSync(root)
324
+ .filter((name) => isCopyDir(name, tree))
325
+ .sort()
326
+ .map((name) => {
327
+ const dir = join(root, name);
328
+ const sessions = readdirSync(dir)
329
+ .filter((file) => file.endsWith('.jsonl'))
330
+ .sort()
331
+ .filter((file) => statSync(join(dir, file)).mtimeMs >= window.from)
332
+ .map((file) => ({ id: file.replace(/\.jsonl$/, ''), entries: readRecord(join(dir, file)) }));
333
+ return { name, sessions };
334
+ });
335
+ }
336
+
337
+ /** The main checkout: the parent of the common directory of git, or the current directory outside git. */
338
+ function treeRoot() {
339
+ const run = spawnSync('git', ['rev-parse', '--path-format=absolute', '--git-common-dir'], { encoding: 'utf8' });
340
+ return run.status === 0 ? dirname(run.stdout.trim()) : process.cwd();
341
+ }
342
+
343
+ function flowPath(named) {
344
+ if (named) return resolve(named);
345
+ const here = dirname(fileURLToPath(import.meta.url));
346
+ const laid = join(here, 'task-flow', 'flow.js');
347
+ return existsSync(laid) ? laid : join(here, '..', 'task-flow', 'flow.js');
348
+ }
349
+
350
+ /** The command line; it runs after the module is evaluated, so the engine it imports can import this module. */
351
+ async function main() {
352
+ let args;
353
+ let window;
354
+ try {
355
+ args = parseArgs(process.argv.slice(2));
356
+ if (args.mode === 'missed') {
357
+ if (!Number.isInteger(args.last) || args.last < 1) throw new Error('--missed needs --last N');
358
+ } else window = windowOf({ ...args, until: args.until ?? new Date().toISOString().slice(0, 10) });
359
+ } catch (error) {
360
+ console.error(`owner-nudges: ${error.message}\n${USAGE}`);
361
+ process.exit(2);
362
+ }
363
+ const root = args.root ?? join(homedir(), '.claude', 'projects');
364
+ const tree = args.tree ?? treeRoot();
365
+ if (args.mode === 'missed') {
366
+ const laid = args.layout ? Date.parse(args.layout) : layoutMoment(tree);
367
+ if (laid === null || Number.isNaN(laid)) {
368
+ console.log(`missed stops with open work: 0 of 0 stops in the last ${args.last} calls`);
369
+ return;
370
+ }
371
+ const after = { from: laid, to: Number.POSITIVE_INFINITY };
372
+ const copies = readCopies(root, tree, after);
373
+ const path = flowPath(args.flow);
374
+ const model = buildModel(path);
375
+ const { GUARD_SETTINGS, openReaders } = await import(pathToFileURL(join(dirname(fileURLToPath(import.meta.url)), 'task-flow-script.mjs')).href);
376
+ const { missedLine, runMissed } = await import(pathToFileURL(join(dirname(fileURLToPath(import.meta.url)), 'flow-forecast.mjs')).href);
377
+ const from = lastCallsFrom(copies, after, args.last);
378
+ const result = await runMissed({ copies, from, model, base: dirname(path), openReaders, tree, settings: GUARD_SETTINGS, laid: branchLaid(tree) });
379
+ console.log(missedLine(result, args.last));
380
+ return;
381
+ }
382
+ const copies = readCopies(root, tree, window);
383
+ if (args.mode === 'typed') console.log(typedLine(measureTyped(copies, window)));
384
+ else if (args.mode === 'refusals') console.log(refusalsLine(measureRefusals(copies, window)));
385
+ else if (args.mode === 'deadlocks') console.log(deadlocksLine(findDeadlocks(copies, window)));
386
+ else console.log(nudgesLine(measureNudges(copies, window, buildModel(flowPath(args.flow)).words.nudge)));
387
+ }
388
+
389
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main();
@@ -6,6 +6,9 @@
6
6
  * node tools/push-inputs.mjs record the steps on stdin, or the profile set when stdin is
7
7
  * empty: each runs once under `push-trace.mjs`, and the
8
8
  * table of what it read is written
9
+ * node tools/push-inputs.mjs subject <base> the steps on stdin; a line per step on stdout —
10
+ * `touched|idle|unknown|not-run<TAB>step`; the paths
11
+ * the tree declares go by `--declared <file>`
9
12
  * node tools/push-inputs.mjs select <base> the steps on stdin; the ones to run go to stdout, a
10
13
  * line per step with its reason to stderr
11
14
  * node tools/push-inputs.mjs verify the table steps are recorded again; a read the table
@@ -289,6 +292,57 @@ function changesOf(base) {
289
292
  return changes;
290
293
  }
291
294
 
295
+ /** Why a change reaches a step, by the table; an empty answer — it does not. */
296
+ function reasonsOf(table, changes) {
297
+ const verifyInputs = new Set([rel(tablePath), rel(TRACER), rel(fileURLToPath(import.meta.url))]);
298
+ // A step with a recorded kind is not traced by the check, so an edit of its script starts no check.
299
+ for (const entry of Object.values(table.steps)) {
300
+ if (!runsAlways(entry)) for (const p of entry.self) verifyInputs.add(p);
301
+ }
302
+ return (step) => {
303
+ if (VERIFY.test(step)) {
304
+ const hit = changes.find((c) => verifyInputs.has(c.path));
305
+ return hit ? `${hit.path} is a step or the table` : '';
306
+ }
307
+ if (!table.steps[step]) return traceable(step) ? 'it is not in the table' : 'its reads are not recorded';
308
+ return reasonOf(table.steps[step], changes);
309
+ };
310
+ }
311
+
312
+ /**
313
+ * Whether a change touched the subject of each step: `touched`, `idle`, `unknown` or `not-run`.
314
+ * A step of the table is judged by the rule `select` uses, and one it drops is `not-run`: the set
315
+ * never starts it. A step the table does not record is judged by the paths the tree declares for
316
+ * it — `--declared <file>`, lines `<path>\t<step>`; with no paths declared it is `unknown`. A step
317
+ * that reads the history or starts what the recorder does not see is `unknown` too: its subject is
318
+ * not a list of paths.
319
+ */
320
+ function subject(base) {
321
+ const steps = stepsOf(readStdin());
322
+ const table = loadTable() ?? { steps: {} };
323
+ const changes = base ? changesOf(base) : null;
324
+ const declared = new Map();
325
+ const file = option('--declared');
326
+ for (const line of (file && existsSync(file) ? readFileSync(file, 'utf8') : '').split('\n').filter(Boolean)) {
327
+ const [path, ...rest] = line.split('\t');
328
+ const step = rest.join('\t');
329
+ declared.set(step, [...(declared.get(step) ?? []), path.replace(/\/+$/, '')]);
330
+ }
331
+ const reason = changes ? reasonsOf(table, changes) : () => 'no base';
332
+ for (const step of steps) {
333
+ let mark = 'unknown';
334
+ const entry = table.steps[step];
335
+ if (changes && declared.has(step)) {
336
+ mark = changes.some((c) => declared.get(step).some((p) => covers(p, c.path))) ? 'touched' : 'idle';
337
+ } else if (changes && (entry || VERIFY.test(step))) {
338
+ const why = reason(step);
339
+ mark = !why ? 'not-run' : entry && (entry.history.length || entry.untraced.length) ? 'unknown' : 'touched';
340
+ }
341
+ process.stdout.write(`${mark}\t${step}\n`);
342
+ }
343
+ return 0;
344
+ }
345
+
292
346
  function select(base) {
293
347
  const steps = stepsOf(readStdin());
294
348
  const table = loadTable();
@@ -297,21 +351,9 @@ function select(base) {
297
351
  process.stdout.write(steps.map((s) => `${s}\n`).join(''));
298
352
  return 0;
299
353
  }
300
- const verifyInputs = new Set([rel(tablePath), rel(TRACER), rel(fileURLToPath(import.meta.url))]);
301
- // A step with a recorded kind is not traced by the check, so an edit of its script starts no check.
302
- for (const entry of Object.values(table.steps)) {
303
- if (!runsAlways(entry)) for (const p of entry.self) verifyInputs.add(p);
304
- }
354
+ const reasonFor = reasonsOf(table, changes);
305
355
  for (const step of steps) {
306
- let reason;
307
- if (VERIFY.test(step)) {
308
- const hit = changes.find((c) => verifyInputs.has(c.path));
309
- reason = hit ? `${hit.path} is a step or the table` : '';
310
- } else if (!table.steps[step]) {
311
- reason = traceable(step) ? 'it is not in the table' : 'its reads are not recorded';
312
- } else {
313
- reason = reasonOf(table.steps[step], changes);
314
- }
356
+ const reason = reasonFor(step);
315
357
  if (reason) {
316
358
  process.stdout.write(`${step}\n`);
317
359
  process.stderr.write(`→ ${step}: ${reason}\n`);
@@ -396,6 +438,7 @@ function verify() {
396
438
  }
397
439
 
398
440
  const command = args[0];
399
- const code = command === 'record' ? record() : command === 'verify' ? verify() : command === 'select' ? select(args[1]) : 2;
400
- if (code === 2) process.stderr.write('usage: push-inputs.mjs record | select <base> | verify\n');
441
+ const code =
442
+ command === 'record' ? record() : command === 'verify' ? verify() : command === 'select' ? select(args[1]) : command === 'subject' ? subject(args[1]) : 2;
443
+ if (code === 2) process.stderr.write('usage: push-inputs.mjs record | select <base> | subject <base> | verify\n');
401
444
  process.exit(code);