@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,113 @@
1
+ # Turn judge
2
+ <!-- rt-hook-agent event=Stop limit=120 model=claude-sonnet-5-5 words=In the same message as that Read, make its round 1: Grep the file named by transcript_path for `^` and for `"operation":"enqueue".*"content":"[^<]|"content":"The user answered: |"type":"user","message":\{"role":"user","content":\[\{"type":"text","text":"\[Request interrupted by user` with output_mode count. -->
3
+
4
+ You decide whether the agent's turn may end. You are called by the Stop event as an agent hook of
5
+ Claude Code. The input JSON is given to you; its fields `transcript_path`, `last_assistant_message`,
6
+ `stop_hook_active` and `cwd` are what you work with. You have Read, Grep and Glob. You edit nothing.
7
+
8
+ ## What you are for
9
+
10
+ Open work is not yours to judge. The exit check measures it by a script: the steps of the plan, the
11
+ tasks of the epic, the request not opened. It holds the turn itself and names the next move. You
12
+ read neither the task folder nor the plans, and you never hold a turn because steps are left.
13
+
14
+ You judge what only the words of the conversation show: the owner's latest word, the work that word
15
+ ordered, a question whose answer is already given, a fact stated with no output behind it, a miss
16
+ admitted with no incident record, a proposal ordered and not sent.
17
+
18
+ Your second duty: never leave the agent without a lawful move. A refusal it cannot act on stops the
19
+ work as surely as the stop you exist against. The checks you replace refused turns by their words
20
+ and held answers the owner had asked for; do not repeat that.
21
+
22
+ ## What to read — two rounds, the calls of each round in one message
23
+
24
+ The owner's words lie in the transcript, a JSONL file with one record per line. One pattern finds
25
+ all of them; it is called `OWNER` below:
26
+
27
+ "operation":"enqueue".*"content":"[^<]|"content":"The user answered: |"type":"user","message":\{"role":"user","content":\[\{"type":"text","text":"\[Request interrupted by user
28
+
29
+ - `"operation":"enqueue"` with a text that does not start with `<` — a message the owner typed, at
30
+ the start of a turn or in the middle of one; its text is the field `content`. Queued texts that
31
+ start with `<` are notifications of tasks and agents, and the pattern leaves them out.
32
+ - `The user answered:` — the owner's answer to the question tool.
33
+ - `[Request interrupted by user` in a record `"type":"user"` — the owner pressed Esc. A record
34
+ `"type":"api-request-blob"` repeats an old mark next to a newer word, and the pattern leaves it
35
+ out.
36
+
37
+ A record `"type":"last-prompt"` repeats an old typed message: it is never the owner's latest word.
38
+
39
+ Round 1 — the declaration of the hook may order it in the same message as the `Read` of this text;
40
+ then it is done, and the next round is round 2:
41
+
42
+ 1. `Grep` the transcript for `^` with `output_mode: "count"` — the number of lines.
43
+ 2. `Grep` the transcript for `OWNER` with `output_mode: "count"`.
44
+
45
+ Round 2:
46
+
47
+ 3. `Grep` the transcript for `OWNER` with `output_mode: "content"`, `-n` and `offset` = the count of
48
+ step 2 minus 5: the owner's last messages and their line numbers. The highest line is the
49
+ owner's latest word.
50
+ 4. `Read` the transcript from `offset` = the count of step 1 minus 20 with `limit: 21`: the last
51
+ records of the turn, its tool calls (`"type":"tool_use"`) and their results. A `Read` of the
52
+ transcript always names `limit`: the whole file is too large for one, and the refusal costs a
53
+ round. A call older than these is found by `Grep`, not by a longer read.
54
+
55
+ Read nothing more unless a refusal needs a proof named below: every call costs the owner seconds at
56
+ the end of every turn.
57
+
58
+ ## Let the turn end — answer `{"ok": true}` — when one of these holds
59
+
60
+ - None of the cases below holds. Whether work is left is measured by the exit check, not by you.
61
+ - The owner's latest word is the Esc mark `[Request interrupted by user`: the owner stopped the
62
+ work, and a turn a notice woke after it ends without the work. An order typed before the mark
63
+ orders nothing until the owner writes again, one sent a second before the mark included.
64
+ - A background task the session started still runs, and the reply names the task and the step that
65
+ goes on by its notice. A task runs when its call ran in the background — `run_in_background` or
66
+ a background agent — and no `<task-notification>` with its id stands after it. The wait is the
67
+ move then: the notice wakes the session, and it reads the result and goes on with the step. A
68
+ word of the owner does not stop the work: the owner stops it by Esc.
69
+ - `stop_hook_active` is true and the reason of the previous refusal is addressed, or cannot be
70
+ addressed without the owner. Never refuse twice for the same reason: a second refusal for one
71
+ reason is a deadlock in the making.
72
+ - You are in doubt. A refusal with no case below behind it stops the work for nothing.
73
+
74
+ ## Keep the turn going — refuse — when one of these holds
75
+
76
+ - The turn ends while the owner's latest word orders work the turn has not done. The reply
77
+ answers the question or the swearing, reports, announces or promises — «следующим ходом»,
78
+ «сейчас запущу», «дальше возьму» — and the ordered work is not in the calls of the turn. An
79
+ announcement is not the action: a reply that announces or promises its next work is refused even
80
+ when the turn did part of the ordered work. A reply that waits for a running background task of
81
+ the session, as named above, announces no work. A turn whose calls did part of the ordered work and
82
+ whose reply announces nothing has the work in its calls. Swearing at an agent that stands means
83
+ «why did you stop»: it is never a word to stop. Swearing that follows no order and names no work orders nothing. A slash
84
+ command that writes a handover or closes the session is cleanup: the work it does not mention
85
+ stays ordered. The last records read may not hold the whole turn: before refusing because the
86
+ ordered work is not in the calls, `Grep` the transcript for `"type":"tool_use"` from the line of
87
+ the owner's latest word; a call there that does the work counts.
88
+ - The reply asks the owner something already answered in the conversation, or asks the owner to do a
89
+ step the agent can do itself: sign in to a stand, type a password, run a command, open a page.
90
+ - The reply states a fact about the repository or a service — merged, pushed, green, exists, closed,
91
+ published — and no tool result of this turn shows it. A command output that shows the state counts,
92
+ whatever the command was. Each fact the reply names needs its own output: an edit of one file
93
+ does not show a second thing the reply says the branch holds. Before refusing for this, `Grep`
94
+ the transcript for the command that would show it: a match after the line of the owner's latest
95
+ word counts.
96
+ - The reply admits a miss of the agent («я ошибся», «мой промах», «это моя вина») and the turn wrote
97
+ no incident record into the directory named by the key `postmortems` of `.claude/rt-kit.json`:
98
+ `Glob` the directory; a file named with today's date counts.
99
+ - The owner asked to send a proposal to the rules package and the turn did not run
100
+ `agent-kit propose`.
101
+
102
+ ## How to answer
103
+
104
+ Answer with JSON only, no other text.
105
+
106
+ - Allow: `{"ok": true}`
107
+ - Refuse: `{"ok": false, "reason": "BLOCKED by turn-judge: <what is wrong, one sentence>. <the next action, one sentence>."}`
108
+
109
+ The reason starts with `BLOCKED by turn-judge:` every time: refusals are counted by this mark in the
110
+ transcripts. Write it in English, quote in « » the owner's words you rely on, and name one action
111
+ the agent can take in this same turn: the work the owner's word ordered, the step it asked the owner
112
+ to take, the command that shows the fact, the incident record, the sending of the proposal. Waiting
113
+ is the action only for a background task of the session that still runs.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: PostToolUse .*
3
- # Requires: hooks/profile-check.sh, hooks/deny-tail.sh
3
+ # Requires: checks/decide.mjs, hooks/decide.sh, hooks/facts.sh, hooks/profile-check.sh, hooks/deny-tail.sh
4
4
  # rt-hook: PreToolUse .*
5
5
  # Window fill: the session is brought to a logical point in advance, not cut off in the middle.
6
6
  #
@@ -88,7 +88,9 @@ tasks_dir="${RT_TASKS_DIR:-docs/tasks}"
88
88
  handoff_dir="${RT_HANDOFF_DIR:-.claude/handoff}"
89
89
 
90
90
  event="$(printf '%s' "$input" | jq -r '.hook_event_name // empty' 2>/dev/null)"
91
- transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/null)"
91
+ # shellcheck disable=SC1091
92
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/facts.sh" 2>/dev/null
93
+ transcript="$(rt_fact_transcript "$input")"
92
94
  [ -n "$transcript" ] || exit 0
93
95
  [ -f "$transcript" ] || exit 0
94
96
 
@@ -98,14 +100,7 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
98
100
  #
99
101
  # A tail of 200 lines: the session record grows all session, and one last line of it is what is
100
102
  # needed.
101
- fill="$(tail -n 200 "$transcript" 2>/dev/null | jq -s -r '
102
- [.[] | select(.type == "assistant") | .message.usage | select(. != null)]
103
- | last
104
- | if . == null then empty
105
- else ((.input_tokens // 0) + (.cache_creation_input_tokens // 0)
106
- + (.cache_read_input_tokens // 0) + (.output_tokens // 0))
107
- end
108
- ' 2>/dev/null)"
103
+ fill="$(rt_fact_window_fill "$transcript")"
109
104
 
110
105
  case "$fill" in
111
106
  '' | *[!0-9]*) exit 0 ;;
@@ -156,14 +151,21 @@ fi
156
151
  [ "$event" = "PreToolUse" ] || exit 0
157
152
  [ "$pct" -ge "$stop_pct" ] || exit 0
158
153
 
154
+ # A mark for the turn exit guard: past this threshold the next step of work is refused here, so
155
+ # the exit guard must not name it — the session closes by the progress and the handover.
156
+ stop_sid="$(printf '%s' "$input" | jq -r '.session_id // "unknown"' 2>/dev/null)"
157
+ stop_file="$(rt_fact_window_stop_file "$stop_sid")"
158
+ mkdir -p "$(dirname "$stop_file")" 2>/dev/null && : >"$stop_file" 2>/dev/null
159
+
159
160
  tool="$(rt_hook_tool)"
160
161
  path="$(rt_hook_file)"
161
162
  cmd="$(rt_hook_cmd)"
162
163
 
163
164
  allowed=0
164
165
  case "$tool" in
165
- # The conversation with the owner and reading what is edited at the closing.
166
- AskUserQuestion | TodoWrite | Read | SendUserFile)
166
+ # The conversation with the owner and reading what is edited at the closing. Loading a rule is
167
+ # reading too: the closing edits need their rules, and the rules gate refuses them until then.
168
+ AskUserQuestion | TodoWrite | Read | SendUserFile | Skill)
167
169
  allowed=1
168
170
  ;;
169
171
  Edit | Write | MultiEdit | mcp__webstorm__create_new_file)
@@ -184,33 +186,12 @@ esac
184
186
 
185
187
  [ "$allowed" -eq 1 ] && exit 0
186
188
 
187
- reason="BLOCKED by window-fill-guard: window fill ${pct}% (${fill_k}k of ${window_k}k), the stop threshold is ${stop_pct}%. The session works no further — it closes.
188
-
189
- What is left to do in this session:
190
- 1. Rewrite the section «Where we stand» in the progress and add a session entry — what was done, what confirms it, what did not work out.
191
- 2. Commit what is checked: what is not committed does not survive the break.
192
- 3. Write the handover into ${handoff_dir}/ and give the owner the path to it — what goes into it is said by the pattern task-flow-handoff.
193
-
194
- What passes after the threshold:
195
- - an edit of ${tasks_dir}/** and ${handoff_dir}/**, a read of any file, a question to the owner;
196
- - a command starting with a word of delivery or verification: git, the client of the hosting, moving a column, npm run check:*.
197
-
198
- A command is judged by the start of the line: entering a directory before it removes the match, and the very commit that would have passed without it is refused. Start the command with the word of delivery itself."
199
-
200
- # The shared deny tail: the two lawful moves and the lawful form of bypass, if the refusal has one.
201
- # The file may not be laid out — then there is no tail, and the reason for the refusal stays as it
202
- # was.
203
- # shellcheck disable=SC1090
204
- [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
205
- && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
206
- command -v rt_deny_tail >/dev/null 2>&1 || rt_deny_tail() { :; }
207
- deny_tail_text="$(rt_deny_tail "")"
208
- [ -n "$deny_tail_text" ] && reason="${reason}
209
-
210
- ${deny_tail_text}"
211
-
212
- jq -n --arg r "$reason" \
213
- '{hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:$r}}' 2>/dev/null \
214
- || printf '{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny","permissionDecisionReason":"window-fill-guard: the window is full, the session closes with a handover."}}\n'
215
-
189
+ # The decision, the move and the text come from the decision table; the action is the class of
190
+ # this call. The first named move is the progress edit, and the rules gate refuses it while the rule
191
+ # of the course of work is not loaded: that is the fact the table tells the two texts apart by.
192
+ facts="$(jq -cn --arg r "$(rt_fact_rule_loaded "${RT_TASK_FLOW_RULE:-task-flow}" "$stop_sid")" \
193
+ '{window_over_stop:"yes", rule_loaded:$r}')"
194
+ # shellcheck disable=SC1091
195
+ . "$rt_hooks_dir/decide.sh" 2>/dev/null
196
+ command -v rt_decide >/dev/null 2>&1 && rt_decide window-fill-guard.sh "?work_call" "$facts" '{}' PreToolUse "$input"
216
197
  exit 0
@@ -2,113 +2,73 @@
2
2
  name: doc-style-human
3
3
  kind: pattern
4
4
  rule: doc-style
5
- description: Pattern of rule doc-style. Load when writing a task in the work queue, a PR description and a chat reply to the owner. Samples of "so" and "not so" for each of the three texts and the words that get replaced in them. The shape of a status reply is named by rule status-report.
5
+ description: Pattern of rule doc-style. Load when writing a task in the work queue, a PR description and a chat reply to the owner. Samples and the words to replace; a status reply — rule status-report.
6
6
  ---
7
7
 
8
8
  # A task, a PR description and a reply to the owner
9
9
 
10
- Pattern of the rule `doc-style`. Three texts are read by a person from outside: they remember
11
- the product and have not read a single rule of the layer. Here — how they are written; what must
12
- be true is said by the "Texts for a person" section of the rule itself.
10
+ Pattern of rule `doc-style`, section "Texts for a person": the reader knows the product, not
11
+ the rules. Cold part: `pitfalls.md`.
13
12
 
14
13
  ## When to use
15
14
 
16
- - A task is created in the work queue.
17
- - A PR description is written.
18
- - A chat reply to the owner is written — except a reply about the work state: its shape is
19
- named by the rule `status-report`.
15
+ - A task, a PR description, a chat reply; a status reply — rule `status-report`.
20
16
 
21
17
  ## Words that get replaced
22
18
 
23
- The left column holds the words of the rules layer. They are right inside the layer and empty to
24
- whoever does not look into it.
25
-
26
- | Layer word | What to say to the owner |
27
- | ----------------- | ---------------------------------------------------------- |
28
- | PR | the change that waits for your word |
29
- | run, suite | checks; "the checks passed", "the checks are red" |
30
- | guard, gate | what exactly did not let it through, and why |
31
- | agreement | what was agreed about this screen |
32
- | change size | what changes on the screen and where |
33
- | resource layout | updating the rules on the machine |
19
+ | Layer word | What to say to the owner |
20
+ | --- | --- |
21
+ | PR | the change that waits for your word |
22
+ | run, suite | checks; "the checks passed", "the checks are red" |
23
+ | guard, gate | what exactly did not let it through, and why |
24
+ | agreement | what was agreed about this screen |
25
+ | change size | what changes on the screen and where |
26
+ | resource layout | updating the rules on the machine |
34
27
 
35
28
  ## Task
36
29
 
37
- The title names the subject, the body — what the person cannot do. The red check stands in the
38
- body as the last line: it says where to look and does not say why to fix it.
30
+ The title names the subject, the body — what the person cannot do. The red check is the last line:
31
+ where to look, not why.
39
32
 
40
- ```text
41
- ✗ Сквозная спека берёт пункт заглушкой, а прогон на вершине не доходит до выкатки
42
- ✓ Раздел «Отчёты» не открывается у пользователя, и из-за этого не идёт выкатка.
43
- Красная проверка — сквозной набор, шаг «отчёты».
44
- ```
33
+ > ✓ Раздел «Отчёты» не открывается у пользователя, и из-за этого не идёт выкатка.
34
+ > Красная проверка — сквозной набор, шаг «отчёты».
45
35
 
46
36
  ## PR description
47
37
 
48
- The first paragraph — what changes for the person. Then — what confirms it. File names belong at
49
- the end, not in place of the first paragraph.
38
+ First what changes for the person, then what confirms it; file names last.
50
39
 
51
- ```text
52
- ✗ Ярус личности вызова получил второй признак, набор гейта зелёный
53
- ✓ Заявки от машинной записи больше не открываются от имени владельца: теперь перед открытием
54
- спрашивается, кто приходит по токену. Проверки прошли, 26 сценариев.
55
- ```
40
+ > ✗ Ярус личности вызова получил второй признак
56
41
 
57
42
  ## Chat reply
58
43
 
59
- Answers the question asked in the first sentence. A statement about the tree goes together with
60
- the command and its output — the rule `status-report` requires it, and in chat it holds the same.
44
+ The first sentence answers the question; a claim about the tree comes with its command and output.
61
45
 
62
- ```text
63
- ✗ Работа отдана, красное въехало в главную, откат прикрыт гардом
64
- ✓ Правку я отправил, она ждёт вашего слова. В главной ветке сейчас красный шаг «сборка витрины»
65
- — упал не на этой правке, вывод: 76 из 76 сценариев не поднялись, витрина лежит.
66
- ```
46
+ > ✗ Работа отдана, красное въехало в главную
67
47
 
68
48
  ## The language of the text
69
49
 
70
- The rules layer is written in English, and the three texts for a person in the owner's language.
71
- A session that has just read a rule writes the task in the rule's words and language; the
72
- addressee is checked before the first line — together with the register.
73
-
74
- ```text
75
- ✗ [RT-1849] Prose, glossary and description checks only count Cyrillic
76
- ✓ [RT-1849] Проверки слога, словаря и описаний считают только кириллицу
77
-
78
- ✗ - **A path named in a document exists.** (a rule article written into the task body)
79
- ✓ Пути, названные в задаче, проверяет команда `npm run check:docs`; она красная на двух.
80
- ```
50
+ The texts are in the language of the owner's chat and cards, English included. Addressee and
51
+ register are checked before the first line; the usual miss is a task in the words and language of
52
+ a rule just read, or with a rule article copied in.
81
53
 
82
- The owner's language is the one they write in chat and on cards. An owner writing in English
83
- gets an English task, and that is no miss: the miss is a text in a language the addressee did
84
- not choose.
54
+ > ✓ [RT-1849] Проверки слога, словаря и описаний считают только кириллицу
85
55
 
86
56
  ## A guide for an executor in another tree
87
57
 
88
- Its reader has neither the author's memory nor the author's conversation, so the guide is checked
89
- step by step before it is handed over: each step is done from the text alone. Addresses, access
90
- and the state of name records are written in. A solution already found and verified goes in as a
91
- recipe; "decide later" stands only where no way was verified. The ban on naming another tree covers
92
- its name, not the infrastructure its reader needs.
58
+ Each step is done from the text alone before hand-over. Addresses, access and name-record state are
59
+ written in; a verified solution goes in as a recipe, "decide later" only where no way was
60
+ verified. Not naming another tree bans its name, not the infrastructure its reader needs.
93
61
 
94
- ```text
95
- ✗ Шаг 1. Подготовьте узел. Адрес и доступ решим позже.
96
- ✓ Шаг 1. Узел — таблица «Где узел»: адрес, порт почты, вход по ключу. Запись DNS ставит владелец
97
- домена, и в задаче она названа его действием.
98
- ```
62
+ > ✗ Адрес и доступ решим позже.
99
63
 
100
64
  ## Pitfalls
101
65
 
102
- - **A promise about the behaviour of an outside service names what backs it.** A host or a bot is
103
- promised to do something only with a quote of its documentation or a run that did it; where it
104
- cannot be checked before the merge, the text says exactly that.
66
+ - **A promise about the behaviour of an outside service names what backs it.** A quote of its docs
67
+ or a run; unchecked before the merge — said so.
105
68
  - **What a text says about another record is read from that record in the same turn.** A release
106
- note names a task by the title read in the tracker at that minute, and a commit without a task
107
- number does not go into it: a number taken from memory lands on someone else's task.
108
-
109
- - **Shorter does not mean clearer.** A text in the layer's words comes out a third shorter and
110
- is useless to whoever decides whether the work is urgent.
111
- - **"Not X but Y" looks like an explanation and explains nothing.** The owner learns what was
112
- not there and does not learn what is.
113
- - **The word "done" without a number reads as a verified fact.** The number is the run id, how
114
- many scenarios out of how many, the time of the check.
69
+ note: task titles from the tracker that minute, no commit without a task number.
70
+ - **Shorter does not mean clearer.** Layer words make a text shorter and useless to whoever judges
71
+ urgency.
72
+ - **"Not X but Y" looks like an explanation and explains nothing.**
73
+ - **The word "done" without a number reads as a verified fact.** The number: run id,
74
+ scenarios out of how many, time of the check.
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: git-workflow-commit
3
3
  kind: pattern
4
- rule: git-workflow
5
- description: Pattern of rule git-workflow. Load for creating a work item and a branch, commit and push — an item with area and iteration, state transition, merging two tasks into one, working as the machine account, skipping the document requirement. Opening a PR — pattern git-workflow-pr.
4
+ rule: git-workflow-push
5
+ description: Pattern of rule git-workflow-push. Load for creating a work item and a branch, commit and push — an item with area and iteration, state transition, merging two tasks into one, working as the machine account, skipping the document requirement. Opening a PR — pattern git-workflow-pr.
6
6
  ---
7
7
 
8
8
  # Task, branch and commit
9
9
 
10
10
  Pattern of the rule `git-workflow`. What must be true meanwhile — the law
11
- `docs/constitution/delivery.md`.
11
+ `docs/constitution/delivery.md`. Cold part: `pitfalls.md` — every section below whole, with its code and reasons.
12
12
 
13
13
  ## When to use
14
14
 
@@ -19,172 +19,26 @@ Pattern of the rule `git-workflow`. What must be true meanwhile — the law
19
19
 
20
20
  ## First the work item, then the branch
21
21
 
22
- Creation is four steps: the item, the number in its title, the assignee, the state `New`. Area and
23
- iteration are set right there: an item without them lies in the project root and does not reach
24
- the team board — created, but not in the work queue.
25
-
26
- All four are done by one tree command, not by hand: splitting them means forgetting the last.
27
-
28
- **A command that does not exist is not replaced by client calls in the pattern.** A tree that
29
- takes the package for the first time gets the check files, but not the entries about them in its
30
- manifest: the layout edits resources, and the consumer's manifest does not belong to it. Two ways
31
- from here: create the command in the same turn, or repeat all its steps by name from the list
32
- above. A bypass by client calls looks like execution up to the last step of the list: it is
33
- forgotten first, because the previous ones have already given a visible result.
34
-
35
- ```bash
36
- npm run task:new -- --title 'Письма владельцу не уходят молча' \
37
- --type Bug --area '<проект>\<команда>' --slug mail-owner-silence < описание.md
38
- ```
39
-
40
- The script under this command is created by the project — the package does not ship it. What it
41
- does by `az` calls:
42
-
43
- ```bash
44
- az boards work-item create --type Bug --title '[<номер>] …' \
45
- --org https://dev.azure.com/<организация> --project <проект> \
46
- --assigned-to <бот> --area '<проект>\<команда>' --iteration '<проект>\<итерация>'
47
- az boards work-item update --id <номер> --title '[<номер>] …' # the number is known after creation
48
- ```
49
-
50
- The number is not written into the title by hand — it is known only after creation, and the
51
- command appends it itself.
52
-
53
- Creation ends not with the command's output but with the work queue's answer. The command asks
54
- it itself and prints what it read — presence on the board, the state, the assignee; absence ends
55
- it with a non-zero code. That answer goes into the comment, the PR body and the plan, not the
56
- printed number: the number says "the call went through", not "the work is visible to whoever
57
- comes for it".
58
-
59
- Creations that go one after another are checked not by the last one but by an audit of the whole
60
- queue: their miss is shared, and by one item it is invisible.
61
-
62
- What to check the work queue with:
63
-
64
- ```bash
65
- npm run check:board
66
- ```
67
-
68
- It looks only at what is open: the state, the area and the assignee of every open item, and for
69
- every open PR — the number in the title, the attached item and that there is no second PR with
70
- the same number. It does not judge the branch name: an open PR cannot have it renamed.
22
+ Creation is four steps: the item, the number in its title, the assignee, the state `New`. Area and iteration are set right there: an item without them lies in the project root and does not reach the team board — created, but not in the work queue.
71
23
 
72
24
  ## Two tasks fixed by one edit
73
25
 
74
- If it turned out along the way that the edit closes the neighbouring item too — that is one task,
75
- not two. They can be merged while the edit has not reached the main branch:
76
-
77
- ```bash
78
- # what the absorbing item lacked is appended to its description
79
- az boards work-item update --id <поглотивший> --description "$(cat тело.md)"
80
- # the absorbed one is linked to it as a duplicate and closed
81
- az boards work-item relation add --id <поглощённый> --relation-type duplicate-of \
82
- --target-id <поглотивший>
83
- az boards work-item update --id <поглощённый> --state 'Removed'
84
- ```
85
-
86
- The link is set before closing: an item closed without it reads as done, and it was not done. The
87
- state of a removed item depends on the project process — `Removed` exists in Agile and Scrum, and
88
- Basic does not have it; which one is here, `implementation.md` says.
89
-
90
- After the branch is merged there is no absorbing: it went in, and it is reverted whole.
26
+ If it turned out along the way that the edit closes the neighbouring item too — that is one task, not two.
91
27
 
92
28
  ## The branch is created by a separate call
93
29
 
94
- The main branch guard parses the command text and looks at the branch at launch, so a compound
95
- command is rejected whole — the branch does not exist in it yet:
96
-
97
- ```bash
98
- ✗ git checkout -b 85-guest-token && git commit -m 'feat(admin): …'
99
- ✓ git checkout -b 85-guest-token <ветка эпика>
100
- ✓ git commit -F -
101
- ```
102
-
103
- The name carries the item number, the slug in lowercase Latin letters joined by hyphens; the exact
104
- form — in `implementation.md`. The delivery guard parses it on the spot and refuses a miss before
105
- the first commit, and by the number it asks the board: the item must exist, be open and have an
106
- assignee.
107
-
108
- A name without a number (`feat/…`, `fix/…`) is legitimate while the branch lives locally — for a
109
- trial and an analysis. No PR opens from it: an edit that reaches the main branch starts with a
110
- task.
111
-
112
30
  ## The item state moves together with the work
113
31
 
114
- Branch created — the item is no longer `New` but `Active`. PR opened — it awaits review. Both
115
- moves are done by one command, as a second call right after the one that caused it:
116
-
117
- ```bash
118
- npm run task:move -- 86 in-progress # right after git checkout -b 86-…
119
- npm run task:move -- 86 in-review # right after az repos pr create
120
- ```
121
-
122
- Under it — an edit of the state field:
123
-
124
- ```bash
125
- az boards work-item update --id 86 --state 'Active'
126
- ```
127
-
128
- State names are taken from the project process, not assigned by the rule: Agile, Scrum and Basic
129
- call the same three steps differently, and a move to a state the process does not have answers
130
- with a refusal on every task in a row.
131
-
132
- The move is not put off for later: the work queue is read between steps, not after them.
32
+ Branch created — the item is no longer `New` but `Active`. PR opened — it awaits review.
133
33
 
134
34
  ## The commit is signed by the machine account
135
35
 
136
- The token is read into a variable and not printed; author and committer are set by variables
137
- prefixed to `git commit` itself. `git config` will not do — the config is shared with the main tree
138
- and would rewrite the signature to the owner. `export` will not do either: it reaches every later
139
- command of the call, and a set before a push started by the same call runs the hook scenarios under
140
- the bot's mail — the ones comparing a mail fall on a sound tree:
141
-
142
- ```bash
143
- TOKEN=$(tr -d '\n' < ~/.config/<дерево>-bot-token)
144
-
145
- GIT_AUTHOR_NAME="<бот>" GIT_AUTHOR_EMAIL="<почта бота>" \
146
- GIT_COMMITTER_NAME="<бот>" GIT_COMMITTER_EMAIL="<почта бота>" \
147
- git commit -F -
148
- ```
149
-
150
- The subject — `type(scope): description`. Types: `feat`, `fix`, `refactor`, `docs`, `style`,
151
- `test`, `chore`, `perf`. Scopes are the tree's own, listed in `implementation.md`. A full stop
152
- at the end of the subject is not accepted. The letter case is checked as well, by the `subject-case` rule of the commit check: a word in capitals, such as a file name, can trip it, so the allowed case is read in the commit check settings before the subject is written.
153
-
154
- The line `AB#<номер>` in the commit body attaches it to the work item. It does not replace the
155
- attachment of the PR itself: the commit is linked to the item, and the work queue reads the PR's
156
- link.
36
+ The token is read into a variable and not printed; author and committer are set by variables prefixed to `git commit` itself. `git config` will not do — the config is shared with the main tree and would rewrite the signature to the owner.
157
37
 
158
38
  ## The document goes in the same commit
159
39
 
160
- `docs-guard` demands the pair and names it itself. The bypass — a line in the body, the reason
161
- is mandatory:
162
-
163
- ```
164
- Docs-skip: правка только в тестах хука, зеркала у него нет
165
- ```
166
-
167
- The guard looks for the `Docs-skip` line in the command text only. A message read from a file by
168
- `git commit -F <file>` is invisible to it and the commit is refused; the body goes inside the command,
169
- as in `git commit -F -` with the text after it.
40
+ `docs-guard` demands the pair and names it itself. The bypass — a line in the body, the reason is mandatory: The guard looks for the `Docs-skip` line in the command text only.
170
41
 
171
42
  ## Common misses
172
43
 
173
- - **An audit right after adding answers "no" when the card already stands.** The work queue gives
174
- out a new item not in the same second it was created, and the last step reads it by the next
175
- call. The answer to this is to reread the whole queue, not to create the card a second time: two
176
- records about one task are removed only by an administrator. The creation command itself needs
177
- an edit here: the state is read right after the mutation, without a retry, and a false refusal
178
- here costs more than a delay.
179
- - Area and iteration are not set: the item is created, but it did not reach the team board.
180
- - The state is not taken from the project process: the move answers with a refusal on every task,
181
- and this reads as a broken command, not as a wrong state name.
182
- - `git add` with several paths adds nothing if even one path does not exist: the command breaks
183
- off whole at the first miss. The next `git commit --amend` then carries into the commit
184
- everything left in the index. The commit contents are read by `git show --stat` right after it,
185
- not at PR review.
186
- - Two commits chained in one call: a commit refused by the message check leaves its files in the
187
- index, and the next `git commit` takes them under its own subject. One commit is one call, and
188
- its outcome is read before the next; a swallowed one is split by `git reset --soft HEAD~1` and two
189
- commits anew.
190
- - The owner's edit takes neither the token nor the variables — they are only for machine work.
44
+ - **An audit right after adding answers "no" when the card already stands.**