@rt-tools/agent-kit 0.23.0 → 0.26.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 (288) hide show
  1. package/README.md +8 -2
  2. package/assets/agents/business-analyst.md +51 -50
  3. package/assets/agents/conscience.md +37 -35
  4. package/assets/agents/project-manager.md +49 -48
  5. package/assets/agents/prose-editor.md +31 -29
  6. package/assets/agents/qa-engineer.md +50 -48
  7. package/assets/agents/rules-reviewer.md +63 -58
  8. package/assets/agents/skill-curator.md +83 -78
  9. package/assets/agents/spec-critic.md +34 -29
  10. package/assets/agents/spec-writer.md +35 -32
  11. package/assets/agents/strict-teacher.md +39 -37
  12. package/assets/checks/archive-age.mjs +48 -28
  13. package/assets/checks/archive-prune.mjs +16 -14
  14. package/assets/checks/board-epics.github.mjs +75 -41
  15. package/assets/checks/board-folders.mjs +61 -0
  16. package/assets/checks/board-gh.github.mjs +35 -26
  17. package/assets/checks/board-long-work.github.mjs +24 -24
  18. package/assets/checks/board-paths.github.mjs +21 -16
  19. package/assets/checks/board-runs.github.mjs +45 -43
  20. package/assets/checks/board-titles.github.mjs +19 -17
  21. package/assets/checks/board.github.mjs +150 -128
  22. package/assets/checks/check-archive-age.mjs +23 -19
  23. package/assets/checks/check-board.github.mjs +179 -157
  24. package/assets/checks/check-descriptions.mjs +30 -29
  25. package/assets/checks/check-doc-paths.mjs +104 -82
  26. package/assets/checks/check-dupes.mjs +84 -80
  27. package/assets/checks/check-file-size.mjs +79 -70
  28. package/assets/checks/check-glossary.mjs +47 -37
  29. package/assets/checks/check-hook-scope.mjs +30 -27
  30. package/assets/checks/check-lib-layers.mjs +22 -21
  31. package/assets/checks/check-profile-drift.mjs +48 -43
  32. package/assets/checks/check-prose-style.mjs +125 -33
  33. package/assets/checks/check-push-gate.mjs +53 -50
  34. package/assets/checks/check-reuse.mjs +50 -40
  35. package/assets/checks/check-schema-drift.mjs +87 -83
  36. package/assets/checks/check-specs.mjs +155 -134
  37. package/assets/checks/check-state-next.mjs +66 -52
  38. package/assets/checks/check-states.mjs +32 -30
  39. package/assets/checks/check-styles.mjs +52 -51
  40. package/assets/checks/check-turn-map.mjs +54 -46
  41. package/assets/checks/lib-boundaries.mjs +32 -30
  42. package/assets/checks/lib-common.mjs +30 -29
  43. package/assets/checks/lib-domains.mjs +34 -34
  44. package/assets/checks/lib-manifests.mjs +17 -15
  45. package/assets/checks/lib-reexports.mjs +18 -18
  46. package/assets/checks/rt-kit-checks.config.mjs +174 -142
  47. package/assets/checks/signals.mjs +43 -39
  48. package/assets/checks/spec-anchors.mjs +114 -87
  49. package/assets/checks/spec-common.mjs +128 -84
  50. package/assets/checks/spec-contract.mjs +30 -30
  51. package/assets/checks/spec-proposed.mjs +27 -24
  52. package/assets/checks/spec-scenarios.mjs +51 -28
  53. package/assets/checks/task-new.github.mjs +85 -56
  54. package/assets/commands/feedback.md +65 -59
  55. package/assets/commands/next-session.md +64 -57
  56. package/assets/commands/skill-curator.md +83 -79
  57. package/assets/defaults/gate-map.sh +115 -91
  58. package/assets/defaults/project.sh +228 -178
  59. package/assets/defaults/shell.sh +85 -65
  60. package/assets/defaults/turn-map.md +45 -44
  61. package/assets/docs/GLOSSARY.md +142 -65
  62. package/assets/hooks/browser-device-id.sh +12 -12
  63. package/assets/hooks/browser-guard-device-id.sh +46 -14
  64. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  65. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  66. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  67. package/assets/hooks/browser-guard-require-select.sh +34 -23
  68. package/assets/hooks/claim-guard.sh +62 -56
  69. package/assets/hooks/commit-msg.sh +11 -10
  70. package/assets/hooks/conscience-guard.sh +91 -45
  71. package/assets/hooks/constitution-index.sh +16 -16
  72. package/assets/hooks/deny-tail.sh +28 -26
  73. package/assets/hooks/dev-server-guard.sh +46 -43
  74. package/assets/hooks/dispatch.sh +84 -39
  75. package/assets/hooks/docs-guard.sh +105 -86
  76. package/assets/hooks/exam-guard.sh +146 -84
  77. package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
  78. package/assets/hooks/git-guard-delivery-draft.sh +85 -0
  79. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  80. package/assets/hooks/git-guard-delivery-signature.sh +88 -52
  81. package/assets/hooks/git-guard-delivery.sh +207 -253
  82. package/assets/hooks/git-guard-main.sh +65 -26
  83. package/assets/hooks/git-guard-push-tests.sh +133 -75
  84. package/assets/hooks/glossary-load.sh +23 -22
  85. package/assets/hooks/grill-gate-ask.sh +12 -11
  86. package/assets/hooks/grill-gate.sh +94 -87
  87. package/assets/hooks/guard-note.sh +20 -19
  88. package/assets/hooks/handoff-entry-guard.sh +26 -24
  89. package/assets/hooks/handoff-write.sh +74 -67
  90. package/assets/hooks/hook-input.sh +70 -50
  91. package/assets/hooks/lint-after-edit.sh +95 -61
  92. package/assets/hooks/observe.sh +28 -26
  93. package/assets/hooks/override-write-guard.sh +23 -21
  94. package/assets/hooks/postmortem-guard.sh +42 -39
  95. package/assets/hooks/profile-check.sh +22 -20
  96. package/assets/hooks/proposal-guard.sh +57 -49
  97. package/assets/hooks/prose-style-guard.sh +19 -17
  98. package/assets/hooks/qa-dataid-guard.sh +52 -49
  99. package/assets/hooks/rerun-guard.sh +31 -30
  100. package/assets/hooks/reuse-first-guard.sh +108 -87
  101. package/assets/hooks/roles.sh +14 -14
  102. package/assets/hooks/rule-article.sh +36 -34
  103. package/assets/hooks/rule-source-guard.sh +52 -36
  104. package/assets/hooks/skill-gate-layers.sh +59 -57
  105. package/assets/hooks/skill-gate-rearm.sh +15 -8
  106. package/assets/hooks/skill-gate.sh +89 -81
  107. package/assets/hooks/skill-loaded.sh +6 -6
  108. package/assets/hooks/sql-guard-parse.sh +68 -66
  109. package/assets/hooks/sql-guard-request.sh +48 -46
  110. package/assets/hooks/sql-guard-target.sh +57 -51
  111. package/assets/hooks/sql-guard-write.sh +84 -79
  112. package/assets/hooks/sql-guard.sh +52 -47
  113. package/assets/hooks/stand-login-guard.sh +104 -0
  114. package/assets/hooks/task-context-load.sh +60 -55
  115. package/assets/hooks/task-flow-context.sh +87 -69
  116. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  117. package/assets/hooks/task-flow-guard.sh +67 -64
  118. package/assets/hooks/turn-entry-load.sh +39 -32
  119. package/assets/hooks/turn-exit-guard.sh +256 -204
  120. package/assets/hooks/turn-exit-patterns.sh +53 -0
  121. package/assets/hooks/utf8.sh +11 -11
  122. package/assets/hooks/waiting-turn-guard.sh +94 -94
  123. package/assets/hooks/window-fill-guard.sh +70 -62
  124. package/assets/hooks/work-start-guard.sh +52 -49
  125. package/assets/hooks/write-targets.sh +115 -30
  126. package/assets/laws/autonomous-work.md +29 -27
  127. package/assets/laws/code-structure.md +31 -30
  128. package/assets/laws/delivery.md +148 -137
  129. package/assets/laws/entity-editing.md +52 -50
  130. package/assets/laws/entity-models.md +14 -13
  131. package/assets/laws/frontend-application.md +39 -38
  132. package/assets/laws/lib-imports.md +27 -27
  133. package/assets/laws/lists.md +31 -29
  134. package/assets/laws/navigation.md +37 -37
  135. package/assets/laws/observability.md +41 -40
  136. package/assets/laws/project-documentation.md +106 -99
  137. package/assets/laws/reuse-first.md +31 -29
  138. package/assets/laws/shared-code.md +27 -27
  139. package/assets/laws/verifiability.md +131 -114
  140. package/assets/laws/work-conduct.md +250 -250
  141. package/assets/patterns/admin-lists-screen.md +72 -69
  142. package/assets/patterns/admin-nav-item.md +51 -46
  143. package/assets/patterns/angular-patterns-state.md +32 -31
  144. package/assets/patterns/api-layer-pair.md +33 -31
  145. package/assets/patterns/autonomous-work-run.md +50 -49
  146. package/assets/patterns/browser-verification-measure.md +143 -67
  147. package/assets/patterns/browser-verification-stand.md +181 -128
  148. package/assets/patterns/component-structure-new.md +51 -42
  149. package/assets/patterns/dependencies-upgrade.md +55 -39
  150. package/assets/patterns/doc-style-human.md +93 -0
  151. package/assets/patterns/doc-style-sweep.md +82 -79
  152. package/assets/patterns/doc-style-trace.md +87 -81
  153. package/assets/patterns/doc-style-write.md +130 -122
  154. package/assets/patterns/entity-aside.md +77 -63
  155. package/assets/patterns/entity-models-new.md +37 -37
  156. package/assets/patterns/entity-store.md +33 -33
  157. package/assets/patterns/git-workflow-commit.azure.md +94 -75
  158. package/assets/patterns/git-workflow-commit.github.md +153 -129
  159. package/assets/patterns/git-workflow-commit.gitlab.md +96 -78
  160. package/assets/patterns/git-workflow-docker.md +165 -147
  161. package/assets/patterns/git-workflow-freshness.md +45 -45
  162. package/assets/patterns/git-workflow-merge.md +99 -86
  163. package/assets/patterns/git-workflow-migration.md +54 -52
  164. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  165. package/assets/patterns/git-workflow-pr.azure.md +126 -121
  166. package/assets/patterns/git-workflow-pr.github.md +179 -175
  167. package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
  168. package/assets/patterns/git-workflow-restart.md +35 -31
  169. package/assets/patterns/git-workflow-secrets.md +80 -73
  170. package/assets/patterns/git-workflow-stack.md +131 -106
  171. package/assets/patterns/lib-layers-move.md +62 -53
  172. package/assets/patterns/lib-layers-new.md +59 -45
  173. package/assets/patterns/observability-record.md +72 -67
  174. package/assets/patterns/platform-access-di.md +31 -29
  175. package/assets/patterns/reuse-first-extend.md +66 -61
  176. package/assets/patterns/shared-code-new.md +39 -38
  177. package/assets/patterns/spec-driven-domain.md +161 -151
  178. package/assets/patterns/spec-driven-rule.md +179 -168
  179. package/assets/patterns/spec-driven-sweep.md +41 -39
  180. package/assets/patterns/status-report-table.github.md +37 -36
  181. package/assets/patterns/styling-bem-component.md +42 -42
  182. package/assets/patterns/styling-bem-layout.md +39 -34
  183. package/assets/patterns/styling-bem-sheet.md +59 -58
  184. package/assets/patterns/task-flow-archive.md +222 -215
  185. package/assets/patterns/task-flow-close.md +215 -203
  186. package/assets/patterns/task-flow-handoff.md +154 -145
  187. package/assets/patterns/task-flow-resume.md +138 -133
  188. package/assets/patterns/task-flow-start.md +204 -192
  189. package/assets/patterns/testing-e2e.md +103 -92
  190. package/assets/patterns/testing-unit.md +77 -70
  191. package/assets/patterns/ts-procedure.md +32 -29
  192. package/assets/patterns/turn-entry-map.md +50 -48
  193. package/assets/pitfalls/agent-kit.md +152 -141
  194. package/assets/pitfalls/doc-style.md +96 -91
  195. package/assets/pitfalls/git-workflow.azure.md +49 -46
  196. package/assets/pitfalls/git-workflow.github.md +264 -234
  197. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  198. package/assets/pitfalls/spec-driven.md +73 -71
  199. package/assets/pitfalls/styling-bem.md +46 -40
  200. package/assets/pitfalls/task-flow.md +262 -246
  201. package/assets/pitfalls/testing.md +99 -92
  202. package/assets/pitfalls/turn-conduct.md +96 -81
  203. package/assets/rules/angular-patterns.md +81 -80
  204. package/assets/rules/api-layer.md +77 -74
  205. package/assets/rules/autonomous-work.md +75 -74
  206. package/assets/rules/browser-verification.md +223 -188
  207. package/assets/rules/component-structure.md +72 -69
  208. package/assets/rules/dependencies.md +74 -67
  209. package/assets/rules/deploy-flow.azure.md +118 -108
  210. package/assets/rules/deploy-flow.github.md +145 -135
  211. package/assets/rules/deploy-flow.gitlab.md +120 -110
  212. package/assets/rules/doc-style.md +209 -148
  213. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  214. package/assets/rules/entity-models.md +73 -70
  215. package/assets/rules/git-workflow.azure.md +224 -228
  216. package/assets/rules/git-workflow.github.md +250 -242
  217. package/assets/rules/git-workflow.gitlab.md +218 -217
  218. package/assets/rules/lib-layers.md +85 -86
  219. package/assets/rules/lists.md +101 -97
  220. package/assets/rules/navigation.md +78 -78
  221. package/assets/rules/observability.needs-app.md +165 -153
  222. package/assets/rules/platform-access.md +76 -75
  223. package/assets/rules/reuse-first.md +153 -137
  224. package/assets/rules/shared-code.md +82 -79
  225. package/assets/rules/spec-driven.md +272 -260
  226. package/assets/rules/status-report.md +55 -58
  227. package/assets/rules/styling-bem.md +83 -72
  228. package/assets/rules/task-flow.md +282 -270
  229. package/assets/rules/testing.md +224 -188
  230. package/assets/rules/turn-conduct.md +255 -258
  231. package/assets/rules/turn-entry.md +92 -87
  232. package/assets/rules/typescript-conventions.md +94 -88
  233. package/assets/samples/specs/_template/spec.md +47 -47
  234. package/assets/samples/tasks/_template/grill.md +20 -20
  235. package/assets/samples/tasks/_template/plan.md +32 -30
  236. package/assets/samples/tasks/_template/progress.md +16 -16
  237. package/assets/skills/agent-kit-extend.md +129 -113
  238. package/assets/skills/agent-kit.md +236 -222
  239. package/assets/skills/write-a-skill.md +76 -71
  240. package/assets/templates/findings.md +19 -19
  241. package/assets/templates/gate-map.sh +16 -14
  242. package/assets/templates/implementation.md +28 -27
  243. package/assets/templates/pattern.md +17 -17
  244. package/assets/templates/pitfalls.md +6 -6
  245. package/assets/templates/postmortem.md +24 -23
  246. package/assets/templates/project.sh +24 -24
  247. package/assets/templates/proposal.md +62 -60
  248. package/assets/templates/rule.md +38 -38
  249. package/assets/workflows/feature.js +46 -46
  250. package/assets/workflows/plan.js +54 -54
  251. package/lib/catalog.d.ts +2 -0
  252. package/lib/catalog.d.ts.map +1 -1
  253. package/lib/catalog.js +4 -3
  254. package/lib/catalog.js.map +1 -1
  255. package/lib/commands.d.ts.map +1 -1
  256. package/lib/commands.js +68 -4
  257. package/lib/commands.js.map +1 -1
  258. package/lib/companion.js +3 -2
  259. package/lib/companion.js.map +1 -1
  260. package/lib/enroll.d.ts +7 -1
  261. package/lib/enroll.d.ts.map +1 -1
  262. package/lib/enroll.js +13 -4
  263. package/lib/enroll.js.map +1 -1
  264. package/lib/observations.d.ts +10 -1
  265. package/lib/observations.d.ts.map +1 -1
  266. package/lib/observations.js +1 -0
  267. package/lib/observations.js.map +1 -1
  268. package/lib/override-marks.d.ts +24 -0
  269. package/lib/override-marks.d.ts.map +1 -0
  270. package/lib/override-marks.js +98 -0
  271. package/lib/override-marks.js.map +1 -0
  272. package/lib/plan.d.ts +11 -0
  273. package/lib/plan.d.ts.map +1 -1
  274. package/lib/plan.js +10 -1
  275. package/lib/plan.js.map +1 -1
  276. package/lib/ship.d.ts +0 -7
  277. package/lib/ship.d.ts.map +1 -1
  278. package/lib/ship.js +10 -2
  279. package/lib/ship.js.map +1 -1
  280. package/lib/shipment.d.ts.map +1 -1
  281. package/lib/shipment.js +7 -3
  282. package/lib/shipment.js.map +1 -1
  283. package/lib/sync.d.ts.map +1 -1
  284. package/lib/sync.js +45 -11
  285. package/lib/sync.js.map +1 -1
  286. package/package.json +1 -1
  287. package/rt-tools-agent-kit-0.26.0.tgz +0 -0
  288. package/rt-tools-agent-kit-0.23.0.tgz +0 -0
@@ -1,40 +1,42 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: Stop
3
- # Требует: hooks/deny-tail.sh
4
- # Страж выходов хода: ход, в котором по работе не сделано ничего, не заканчивается, пока работа
5
- # не отдана. Stop.
3
+ # Requires: hooks/deny-tail.sh, hooks/turn-exit-patterns.sh
4
+ # Turn exit guard: a turn in which nothing was done on the work does not end until the work is
5
+ # handed over. Stop.
6
6
  #
7
- # Зачем именно так. Правило перечисляет четыре законных выхода хода — вопрос без ответа в
8
- # правилах, отказ гарда, заполненное окно, отданная работа с начатой следующей, — и держится
9
- # это памятью исполнителя. Держится плохо: ход, кончившийся отчётом о сделанном, выглядит
10
- # работой лучше всякой другой — он полон, в нём названы номера и состояния, и пустоты за ним не
11
- # видно ни владельцу, ни самому заходу. Владелец назвал это прямо: прерываться посреди работы
12
- # нельзя, и запрет должна держать машина.
7
+ # Why exactly this way. The rule lists four lawful exits of a turn — a question the rules do not
8
+ # answer, a guard refusal, a filled window, work handed over with the next one started — and all
9
+ # of it is held by the executor's memory. Held badly: a turn that ended with a report of what was
10
+ # done looks more like work than any other — it is full, it names numbers and states, and the
11
+ # emptiness behind it is invisible both to the owner and to the session itself. The owner said it
12
+ # outright: stopping in the middle of work is not allowed, and the ban must be held by the machine.
13
13
  #
14
- # Что считается работой: правка файла и команда, меняющая дерево или его состояние. Чтение,
15
- # поиск и разговор работой не считаются — именно ими и заполняется ход, который встал. Читающая
16
- # подкоманда `git` и клиента хостинга работой не считается тоже, и судится это по частям
17
- # составной команды: чтение, соединённое с правкой через `&&`, работой остаётся.
14
+ # What counts as work: an edit of a file and a command that changes the tree or its state. Reading,
15
+ # searching and talking do not count as work — a turn that has stalled is filled with exactly
16
+ # these. A reading subcommand of `git` and of the hosting client does not count as work either, and
17
+ # this is judged by the parts of a compound command: reading joined to an edit through `&&` stays
18
+ # work.
18
19
  #
19
- # Что отпускает ход:
20
- # 1. Работа отдана либо влита — состояние работы говорит об этом само.
21
- # 2. За ход была работа: правка файла или команда, меняющая дерево.
22
- # 3. Вопрос владельцу инструментом опроса.
23
- # 4. Отказ гарда — он кончает ход по правилу.
24
- # 5. Передача захода написана — окно кончилось.
25
- # 6. Владелец сказал остановиться.
20
+ # What releases a turn:
21
+ # 1. The work is handed over or merged — the work state says so itself.
22
+ # 2. There was work in the turn: an edit of a file or a command that changes the tree.
23
+ # 3. A question to the owner through the question tool.
24
+ # 4. A guard refusal — it ends the turn by the rule.
25
+ # 5. The session handover is written — the window has run out.
26
+ # 6. The owner said to stop.
26
27
  #
27
- # Работа без ветки и без папки задачи судится вторым признаком. Состояния у неё нет, и первый
28
- # признак взять неоткуда, — но ход, в котором не было ни одной правки дерева, не кончается и
29
- # здесь: просьба владельца «разложи», «обнови», «посмотри» живёт без задачи и без ветки, и
30
- # защищена она была меньше всего. Отпускают такой ход те же четыре вещи: вопрос, отказ гарда,
31
- # написанная передача и слово владельца об остановке.
28
+ # Work without a branch and without a task folder is judged by the second sign. It has no state,
29
+ # and there is nowhere to take the first sign from — but a turn without a single edit of the tree
30
+ # does not end here either: the owner's request "lay it out", "update it", "take a look" lives
31
+ # without a task and without a branch, and it was protected least of all. Such a turn is released
32
+ # by the same four things: a question, a guard refusal, a written handover and the owner's word
33
+ # about stopping.
32
34
  #
33
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: при любой ошибке, нехватке `jq`, отсутствии записи хода, папки задачи
34
- # или строки состояния ход РАЗРЕШАЕТСЯ (exit 0). Сломанный страж не имеет права заклинить
35
- # разговор.
35
+ # FAIL-OPEN: on any error, a missing `jq`, a missing turn record, task folder or state line the
36
+ # turn is ALLOWED (exit 0). A broken guard has no right to jam the conversation.
36
37
 
37
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
38
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the
39
+ # guard itself.
38
40
  RT_GUARD_NAME=turn-exit-guard
39
41
 
40
42
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -42,9 +44,9 @@ RT_GUARD_NAME=turn-exit-guard
42
44
 
43
45
  rt_hook_read
44
46
 
45
- # Отказ печатается одной формой: причина, общий хвост о двух законных ходах и запасная строка
46
- # на случай, если разборщика нет. Прежде эти двенадцать строк стояли восемью копиями — файл рос
47
- # на каждом новом ярусе быстрее, чем на самом требовании.
47
+ # The refusal is printed in one form: the reason, the shared tail about the two lawful moves and a
48
+ # fallback line in case there is no parser. These twelve lines used to stand as eight copies — the
49
+ # file grew faster on every new tier than on the requirement itself.
48
50
  rt_te_deny() {
49
51
  rt_te_reason="$1"
50
52
  rt_te_short="$2"
@@ -66,7 +68,7 @@ input="$RT_HOOK_INPUT"
66
68
  [ -z "$input" ] && exit 0
67
69
  command -v jq >/dev/null 2>&1 || exit 0
68
70
 
69
- # Повторный заход по тому же ходу не судится: страж сказал своё один раз и отпускает.
71
+ # A second pass over the same turn is not judged: the guard has said its piece once and lets go.
70
72
  active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
71
73
  [ "$active" = "true" ] && exit 0
72
74
 
@@ -82,58 +84,58 @@ git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
82
84
  root="$(git rev-parse --show-toplevel 2>/dev/null)"
83
85
  [ -z "$root" ] && exit 0
84
86
 
85
- # Ветка, папка задачи и строка состояния берутся, пока они есть. Пусто — ход судится вторым
86
- # признаком, а не отпускается: отсюда раньше уходили нулём, и работа по слову владельца
87
- # кончалась объявлением намерения молча.
87
+ # The branch, the task folder and the state line are taken while they are there. Empty — the turn
88
+ # is judged by the second sign, not released: this is where it used to leave with zero, and work by
89
+ # the owner's word ended with an announcement of intent, silently.
88
90
  branch="$(git branch --show-current 2>/dev/null)"
89
91
  tasks_dir="${RT_TASKS_DIR:-docs/tasks}"
90
92
  progress=""
91
93
  state=""
92
94
  if [ -n "$branch" ] && [ -f "$root/$tasks_dir/$branch/progress.md" ]; then
93
95
  progress="$root/$tasks_dir/$branch/progress.md"
94
- state="$(sed -n 's/^[[:space:]]*[-*][[:space:]]*\*\*Состояние:\*\*[[:space:]]*`\([^`]*\)`.*/\1/p' "$progress" 2>/dev/null | head -1)"
96
+ state="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(State|Состояние):\*\*[[:space:]]*`([^`]*)`.*/\2/p' "$progress" 2>/dev/null | head -1)"
95
97
  fi
96
98
 
97
- # Работа, дошедшая до этих двух состояний, чужого шага уже дождалась: дальше её двигает
98
- # владелец, и ход, закрытый здесь, ничего не роняет.
99
+ # Work that has reached these two states has already waited out someone else's step: from here on
100
+ # the owner moves it, and a turn closed here drops nothing.
99
101
  case "$state" in
100
102
  работа-отдана | влито) exit 0 ;;
101
103
  esac
102
104
 
103
- # Записанный замысел концом хода не бывает вовсе. Обязательное действие этого состояния — делать
104
- # первый этап, а начавший его переводит состояние той же правкой: ход, оставшийся в прежнем
105
- # состоянии, первого этапа не начал по определению. Второй признак сюда не годится — заведение
106
- # задачи, ветки, колонки и папки он считает работой, и ход, где сделана одна подготовка,
107
- # проходит его насквозь. За один заход так вышло трижды; дважды это поймал соседний гард по
108
- # открытой заявке, третий раз не поймало ничто, а владельцу отчёт о взятой задаче неотличим от
109
- # остановки.
105
+ # A written plan is never the end of a turn at all. The mandatory action of this state is to do the
106
+ # first stage, and whoever starts it moves the state by the same edit: a turn left in the previous
107
+ # state has not started the first stage by definition. The second sign is no good here — it counts
108
+ # creating the task, the branch, the column and the folder as work, and a turn with only the
109
+ # preparation done passes straight through it. In one session this happened three times; twice the
110
+ # neighbouring guard over the open PR caught it, the third time nothing caught it, and for the
111
+ # owner a report about a taken task is indistinguishable from a stop.
110
112
  if [ "$state" = "замысел-записан" ]; then
111
113
  plan="$root/$tasks_dir/$branch/plan.md"
112
114
  first_stage="$(grep -m1 '^### ' "$plan" 2>/dev/null | sed 's/^### //')"
113
- [ -z "$first_stage" ] && first_stage="первый этап замысла"
114
- reason="BLOCKED by turn-exit-guard: работа стоит в состоянии 'замысел-записан', а обязательное действие этого состояния — делать первый этап — за ход не начато.
115
+ [ -z "$first_stage" ] && first_stage="the first stage of the plan"
116
+ reason="BLOCKED by turn-exit-guard: the work stands in the state 'замысел-записан', and the mandatory action of this state — do the first stage — was not begun in the turn.
115
117
 
116
- Заведение задачи, ветки, колонки и папки этим шагом не считается: всё это подготовка к работе, а не работа. Владельцу отчёт о взятой задаче неотличим от остановки — он видит исполнителя стоящим.
118
+ Creating the task, the branch, the column and the folder does not count as that step: all of it is preparation for work, not work. To the owner a report about a taken task is indistinguishable from a stop — they see the executor standing still.
117
119
 
118
- Первый этап замысла: ${first_stage}
120
+ The first stage of the plan: ${first_stage}
119
121
 
120
- Начни его этим же ходом и перепиши состояние на '- **Состояние:** \`этап-идёт\`'. Владелец сказал остановиться — так и напиши: страж читает его слово, а не пересказ.
122
+ Begin it in this same turn and rewrite the state to '- **State:** \`этап-идёт\`'. The owner said to stop — then write so: the guard reads their word, not a retelling.
121
123
 
122
- Страж судит один ход: следующий заход не отбивается."
124
+ The guard judges one turn: the next session is not refused."
123
125
 
124
- rt_te_deny "$reason" "замысел записан, а первый этап не начат."
126
+ rt_te_deny "$reason" "the plan is written and the first stage is not begun."
125
127
  fi
126
128
 
127
- # То же самое, но объявить это на диске уже нечем: папка задачи разбирается до открытия заявки,
128
- # и ход работы уезжает вместе с ней. Признак берётся из истории ветки — папка, снятая её
129
- # коммитом.
129
+ # The same thing, but there is nothing left on disk to declare it with: the task folder is taken
130
+ # apart before the PR opens, and the progress goes away with it. The sign is taken from the branch
131
+ # history — the folder removed by its commit.
130
132
  #
131
- # Отпускать по нему ход нельзя: папка снимается ДО заявки, и между этими двумя движениями работа
132
- # не отдана никому. Ход, попавший в зазор, прежде выходил отсюда нулём — а до отдачи ему
133
- # оставался ровно один шаг, и он его не сделал. Признак поэтому только снимает требование
134
- # состояния: дальше ход судится вторым признаком, как всякий другой. Ход, в котором заявку
135
- # открыли или прочитали, второй признак пропускает сам — вызов клиента хостинга он считает
136
- # работой.
133
+ # A turn must not be released by that sign: the folder is removed BEFORE the PR, and between these
134
+ # two movements the work is handed over to nobody. A turn caught in that gap used to leave here
135
+ # with zero — and it was exactly one step short of the handover, and it did not make it. The sign
136
+ # therefore only lifts the state requirement: from there the turn is judged by the second sign,
137
+ # like any other. A turn in which the PR was opened or read passes the second sign by itself — it
138
+ # counts a call of the hosting client as work.
137
139
  folder_archived() {
138
140
  [ -n "$branch" ] || return 1
139
141
  [ -n "$(git ls-tree -d --name-only HEAD -- "$tasks_dir/$branch" 2>/dev/null | head -1)" ] && return 1
@@ -148,51 +150,17 @@ folder_archived() {
148
150
  archived=false
149
151
  [ -z "$progress" ] && folder_archived && archived=true
150
152
 
151
- # Следующий шаг из хода работы — его страж и называет в отказе: исполнитель, которому сказано
152
- # только «работа не кончена», перечитывает ту же строку сам.
153
+ # The next step out of the progress is what the guard names in the refusal: an executor told only
154
+ # "the work is not finished" re-reads the same line himself.
153
155
  next_step=""
154
- [ -n "$progress" ] && next_step="$(sed -n 's/^[[:space:]]*[-*][[:space:]]*\*\*Следующий шаг:\*\*[[:space:]]*\(.*\)/\1/p' "$progress" 2>/dev/null | head -1)"
155
- [ -z "$next_step" ] && next_step="что стоит в разделе «Где стоим» хода работы"
156
+ [ -n "$progress" ] && next_step="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Next step|Следующий шаг):\*\*[[:space:]]*(.*)/\2/p' "$progress" 2>/dev/null | head -1)"
157
+ [ -z "$next_step" ] && next_step="what stands in the section «Where we stand» of the progress"
156
158
 
157
- # Команда, меняющая дерево или его состояние. Чтение и поиск сюда не входят намеренно: ими и
158
- # заполняется ход, который встал.
159
- #
160
- # Перенаправления вывода здесь нет, и снято оно по разбору: страж отбил два хода из семи,
161
- # простоявших без работы, а пять засчитал работой ровно по нему. Тело будущей заявки писалось во
162
- # временный каталог захода — вне рабочего дерева, — а одно из ожиданий несло только отвод потока
163
- # ошибок в устройство пустоты. Ни то ни другое дерева не меняет, а образцу они были неотличимы
164
- # от записи в рабочий файл: он видел саму стрелку и не спрашивал, куда она ведёт. Признаком
165
- # остаются правка файла инструментом правки и перечисленные здесь команды.
166
- work_re='git (add|commit|push|checkout|merge|rm)|npm run|pnpm (run|exec)|nx (build|test|run)|gh (pr|issue|api|run)|task:(new|move)|mkdir|cp |mv |rm |sed -i|tee '
167
-
168
- # Разведка. Те же слова, что и в образце работы, но подкоманда читающая: переключение ветки,
169
- # подтягивание, просмотр истории, чтение заявок и прогонов. Образец работы называет их работой,
170
- # потому что знает только первое слово — `git` и `gh` стоят в нём целиком, — и ход, в котором
171
- # исполнитель перешёл на главную ветку, прочитал историю и написал владельцу отчёт, выходил
172
- # отсюда нулём. Разбор — запись «2026-08-25-read-only-turn-counted-as-work» в приёме.
173
- #
174
- # Разведка выглядит работой лучше всего остального: в ней команды, числа и точные ответы. Тем
175
- # она и опасна — ход, набитый ею, читается как полный и владельцем, и самим заходом.
176
- read_re='^[[:space:]]*(([^[:space:]]*/)?git[[:space:]]+(show|log|ls-tree|ls-files|ls-remote|diff|status|branch|tag|rev-parse|remote|describe|blame|fetch|pull|(checkout|switch)(?![[:space:]]+-[bc][[:space:]]))|([^[:space:]]*/)?gh[[:space:]]+(pr|issue|run|repo)[[:space:]]+(list|view|status|checks|diff|download|logs))([[:space:]]|$)'
177
-
178
- # Части составной команды судятся по одной: ход собирает чтение и работу в одну строку через
179
- # `&&`, и суждение целиком отпускало бы разведку по первой же меняющей части.
180
- part_re='&&|\|\||;|\n'
181
-
182
- # Ожидание чужого шага. Прогон, разбор владельцем и слияние идут без исполнителя и от взгляда
183
- # быстрее не становятся — правило прямо говорит, что состоянием работы это не бывает. Судится
184
- # только ПОСЛЕДНЕЕ действие хода: ожидание в середине законно, а запуск работы в фоне работой
185
- # остаётся. Разбор — запись «2026-08-25-turn-ended-on-waiting» в приёме.
186
- #
187
- # Прежний признак спрашивал одно: была ли за ход работа. Ход, где разобран конфликт, сделаны
188
- # коммит и пуш, а последним действием стал цикл до готовности прогона, проходил его целиком —
189
- # работа была, и много. Именно эта полнота и обманывает: пустоты за таким ходом не видно.
190
- wait_re='gh[[:space:]]+(run[[:space:]]+watch|pr[[:space:]]+checks[^|]*--watch)|until[[:space:]].*sleep|while[[:space:]].*sleep|^[[:space:]]*sleep[[:space:]]'
191
-
192
- # Отдача работы и начало следующей. Правило зовёт законным концом хода отданную работу — но с
193
- # условием: следующая начата, и по ней сделано ДЕЙСТВИЕ, а не сказано.
194
- handover_re='gh[[:space:]]+pr[[:space:]]+create'
195
- started_re='task:new|task:move|board\.mjs[[:space:]]+move|git[[:space:]]+checkout[[:space:]]+-b|git[[:space:]]+switch[[:space:]]+-c'
159
+ # The patterns of work, of exploration, of waiting and of the handover lie in a neighbouring file:
160
+ # the guard outgrew the length limit, and patterns with their reasons read apart from the tiers.
161
+ # Without the patterns file the guard stays silent — fail-open, as on any breakage of its own.
162
+ . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/turn-exit-patterns.sh" 2>/dev/null || exit 0
163
+ [ -n "${work_re:-}" ] || exit 0
196
164
 
197
165
  verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg work "$work_re" --arg read "$read_re" --arg part "$part_re" --arg wait "$wait_re" --arg handover "$handover_re" --arg started "$started_re" '
198
166
  def is_input:
@@ -205,47 +173,60 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r --arg work "$work_re
205
173
  (map(is_input) | rindex(true)) as $i
206
174
  | (if $i == null then [] else .[$i:] end) as $turn
207
175
  | [$turn[] | select(.type == "assistant") | (.message.content // [])[] | select(.type == "tool_use")] as $uses
208
- # Правка файла — работа по определению, каким бы инструментом она ни шла.
176
+ # An edit of a file is work by definition, whatever tool it goes through.
209
177
  | ($uses | map(.name // "") | any(test("^(Edit|Write|MultiEdit|NotebookEdit)$"))) as $edited
210
178
  | ($uses | map(.name // "") | any(test("AskUserQuestion"))) as $asked
211
179
  | ($uses | map((.input.command // "")) | join("\n")) as $ran
212
- # Работой считается часть команды, совпавшая с образцом работы и не совпавшая с образцом
213
- # разведки: переключение ветки и чтение истории тем же ходом работой не становятся.
180
+ # Work is a part of the command that matched the work pattern and did not match the exploration
181
+ # pattern: switching a branch and reading history in the same turn do not become work.
214
182
  | ([$ran | splits($part)] | map(test($work) and (test($read) | not)) | any) as $ran_work
215
- # Последнее действие хода. Ожидание чужого шага концом хода не бывает, сколько бы работы ни
216
- # было раньше: работа остаётся ровно там, где стояла.
183
+ # The last action of the turn. Waiting for a step by anyone else is never the end of a turn,
184
+ # however much work there was before: the work stays exactly where it stood.
217
185
  | ([$uses[] | select((.name // "") == "Bash") | (.input.command // "")] | last // "") as $last
218
186
  | ($last | test($wait)) as $waited
219
- # Отдача работы: хвост хода после открытия заявки. Всё, что было до неё, сделано по сданной
220
- # задаче и о следующей не говорит ничего.
187
+ # Handing the work over: the tail of the turn after the PR was opened. Everything before it was
188
+ # done on the task handed in and says nothing about the next one.
221
189
  | ([$uses[] | select((.name // "") == "Bash") | (.input.command // "")]) as $cmds
222
190
  | (($cmds | map(test($handover)) | index(true))) as $handover_at
223
191
  | ($handover_at != null) as $handed_over
224
192
  | (if $handover_at == null then [] else $cmds[$handover_at:] end) as $tail
225
193
  | (($tail | map(test($started)) | any)
226
194
  or ($uses | map(.name // "") | any(test("^(Edit|Write|MultiEdit|NotebookEdit)$")))) as $started_next
227
- # ПОСЛЕДНЕЕ ДЕЙСТВИЕ ХОДА — общий признак, из которого частные ярусы ниже только выводят
228
- # понятный отказ. Девять разборов происшествий за сутки описывают девять разных остановок, и
229
- # во всех девяти последним действием хода был текст владельцу: отчёт, сводка, объявление
230
- # намерения. Ярус на каждый вид остановки — гонка без конца: видов столько, сколько бывает
231
- # поводов заговорить. Признак поэтому один — работой должно быть ПОСЛЕДНЕЕ действие.
195
+ # THE LAST ACTION OF THE TURN is the shared sign, and the particular tiers below only derive an
196
+ # understandable refusal from it. Nine incident analyses in a day describe nine different stops,
197
+ # and in all nine the last action of the turn was a text to the owner: a report, a summary, an
198
+ # announcement of intent. A tier for every kind of stop is an endless race: there are as many
199
+ # kinds as there are reasons to start talking. Hence one sign — the LAST action must be work.
232
200
  | ([$uses[] | (.name // "")] | last // "") as $last_tool
233
201
  | (($last_tool | test("^(Edit|Write|MultiEdit|NotebookEdit)$"))
234
202
  or ([$last | splits($part)] | map(test($work) and (test($read) | not)) | any)) as $ended_working
235
- # Отказ гарда и передача захода — оба кончают ход по правилу.
203
+ # A guard refusal and a session handover — both end the turn by the rule.
236
204
  | ([$turn[] | select(.type == "user") | .message.content // [] | select(type == "array") | .[]
237
205
  | select(.type == "tool_result") | .content
238
206
  | if type == "string" then .
239
207
  elif type == "array" then (map(if type == "object" then (.text // "") else tostring end) | join("\n"))
240
208
  else tostring end] | join("\n")) as $out
241
- | (($out | test("BLOCKED by|Отбито гейтом")) or ($ran | test("BLOCKED by"))) as $denied
209
+ | (($out | test("BLOCKED by|Refused by the rules gate|Отбито гейтом")) or ($ran | test("BLOCKED by"))) as $denied
242
210
  | ($ran | test("handoff")) as $handed
243
- # Слово владельца об остановке: судится его собственная реплика, а не пересказ исполнителя.
211
+ # The word of the owner about stopping: the reply itself is judged, not its retelling.
244
212
  | ([$turn[] | select(.type == "user") | .message.content
245
213
  | if type == "string" then . elif type == "array"
246
214
  then (map(if type == "object" then (.text // "") else "" end) | join("\n")) else "" end] | join("\n")) as $said
247
215
  | ($said | test("останов|стоп|хватит|подожди|не надо|прерв|отложи")) as $told_stop
248
- | { worked: ($edited or $ran_work), released: ($asked or $denied or $handed or $told_stop), waited: $waited, handed_over: $handed_over, started_next: $started_next, ended_working: $ended_working, ran: $ran }
216
+ # A question refused by the conversation guard, and a question appended as prose at the end of
217
+ # the reply. The conversation guard judges the call of the question tool and does not see prose
218
+ # at all: a refused question came back in the same wording one turn later and passed freely.
219
+ | ($out | test("BLOCKED by grill-gate")) as $ask_denied
220
+ | ([$turn[] | select(.type == "assistant") | (.message.content // [])[]
221
+ | select(.type == "text") | (.text // "")] | last // "") as $last_say
222
+ | (($last_say | test("\\?[[:space:]]*$")) and $ask_denied) as $asked_in_prose
223
+ # Waiting for the word of the owner, announced by the executor. That word is read from
224
+ # the owner: without his word in the turn and without a question to him through the tool, the
225
+ # phrase "waiting for your word" is a stop announced by the one it suits. The set of patterns is
226
+ # named and closed.
227
+ | (($last_say | test("[Жж]ду (твоего|вашего|его|её) (слова|указани|решени|ответа|команды|отмашки)|[Жж]ду слова владельца|[Жж]ду, что скаж|[Оо]стаюсь ждать|[Бб]уду ждать (твоего|вашего)"))
228
+ and (($asked or $told_stop or $handed) | not)) as $awaits_word
229
+ | { worked: ($edited or $ran_work), released: ($asked or $denied or $handed or $told_stop), waited: $waited, handed_over: $handed_over, started_next: $started_next, ended_working: $ended_working, asked_in_prose: $asked_in_prose, awaits_word: $awaits_word, ran: $ran }
249
230
  ' 2>/dev/null)"
250
231
 
251
232
  [ -z "$verdict" ] && exit 0
@@ -258,20 +239,87 @@ ended_working="$(printf '%s' "$verdict" | jq -r '.ended_working // false' 2>/dev
258
239
  released="$(printf '%s' "$verdict" | jq -r '.released // false' 2>/dev/null)"
259
240
  commands="$(printf '%s' "$verdict" | jq -r '.ran // ""' 2>/dev/null)"
260
241
 
242
+ # A question refused by the conversation guard and asked as prose in the same turn. A guard refusal
243
+ # releases the turn — it is the lawful end itself — but there is nothing to release here: the same
244
+ # question came back a line later, and the work stalled on what the tree had already answered. The
245
+ # tier stands before the lawful exits on purpose: a guard refusal covers exactly this case.
246
+ asked_in_prose="$(printf '%s' "$verdict" | jq -r '.asked_in_prose // false' 2>/dev/null)"
247
+ if [ "$asked_in_prose" = "true" ]; then
248
+ rt_te_deny "BLOCKED by turn-exit-guard: in this turn the conversation guard refused a question to the owner, and the reply ends with a question in prose — the same question, asked in another form.
249
+
250
+ The refusal of the guard named the reason: the answer lies in the tree or the owner has already given it. Read the place it named and work on; what is asked is what the tree does not hold.
251
+
252
+ The guard judges one turn: the next session is not refused." "the question returned in prose after the refusal of the conversation guard."
253
+ fi
254
+
255
+ # The turn ended with waiting for the owner's word. The guard reads the word about stopping from
256
+ # the owner, and here the executor announced it: in this turn the owner said nothing about stopping
257
+ # and was asked no question through the tool. The shared tiers refuse such a turn without a name,
258
+ # and after one step it ended with the same phrase again — three turns in a row in a consuming
259
+ # tree. The tier stands before the lawful exits: a neighbouring guard's refusal releases a turn that
260
+ # named a refusal to the owner, not a turn that said "waiting".
261
+ # Incident analysis — the record
262
+ # "2026-09-04-hod-konchalsya-ozhidaniem-pri-deystvuyushchem-ukazanii" in the intake.
263
+ awaits_word="$(printf '%s' "$verdict" | jq -r '.awaits_word // false' 2>/dev/null)"
264
+ if [ "$awaits_word" = "true" ]; then
265
+ rt_te_deny "BLOCKED by turn-exit-guard: the turn ended with words about waiting for the word of the owner, and the word about stopping the guard reads from the owner: in this turn they announced no stop, and no question was put to them by the tool.
266
+
267
+ The phrase «жду твоего слова» is a stop announced by the executor. The instruction of the owner to work holds until they cancel it, and a new fact against it is a line about the price in the reply, not waiting. A decision the tree does not hold is needed — then ask the question by the tool; otherwise do the next step in this same turn.
268
+
269
+ The next step is written in the progress: ${next_step}
270
+
271
+ The guard judges one turn: the next session is not refused." "the turn ended with waiting for the word of the owner."
272
+ fi
273
+
261
274
  [ "$released" = "true" ] && exit 0
262
275
 
263
- # Взятая, но не начатая работа. Ветка по номеру задачи заведена, а каталога задачи при ней нет
264
- # вовсе — значит работа объявлена взятой и не начата ни одной строкой. Ход здесь не кончается, сколько бы
265
- # работы в нём ни было: заведение ветки, перевод колонки и уборка соседних веток — всё это
266
- # команды, меняющие дерево, и второй признак отпускает такой ход целиком.
276
+ # Work that has reached the handover and has not been handed over. The two states in the `case`
277
+ # below declare that the code is written and what remains is to bring the work to a PR: run the
278
+ # suite, take the folder apart, open the PR. The second sign does not ask about this — such a turn
279
+ # is full of edits and commands, and it releases it whole; between taking the folder apart and
280
+ # opening the PR nobody sees the work, and the owner reads the previous state as "nothing was done".
281
+ #
282
+ # The tier stands after the lawful exits: a question to the owner, a guard refusal, a session
283
+ # handover and the owner's word about stopping end the turn by the rule, and locking them behind a
284
+ # state is not allowed.
285
+ case "$state" in
286
+ этапы-кончились | разбор-кончился)
287
+ if ! printf '%s' "$commands" | grep -qE 'gh[[:space:]]+pr[[:space:]]+create'; then
288
+ if [ "$state" = "этапы-кончились" ]; then
289
+ action="merge the agreement, bring the texts up to what was done and run the suite"
290
+ else
291
+ action="take the task folder apart by the last commit"
292
+ fi
293
+ reason="BLOCKED by turn-exit-guard: the work stands in the state '${state}', and no request was opened in the turn.
294
+
295
+ The mandatory action of this state is ${action}, and after it the work is brought to a request in the same turn. A report about what was done is never the end of a turn: the edit lies in a branch the owner does not see, and the former state they read as «nothing was done».
296
+
297
+ The next step from the progress: ${next_step}
298
+
299
+ Bring the work to a request in this same turn and rewrite the state. The owner said to stop — then write so: the guard reads their word, not a retelling.
300
+
301
+ The guard judges one turn: the next session is not refused."
302
+
303
+ rt_te_deny "$reason" "the work reached handing over and there is no request in the turn."
304
+ fi
305
+ ;;
306
+ esac
307
+
308
+ # Work taken but not started. A branch by the task number is created, and there is no task
309
+ # directory next to it at all — which means the work is declared taken and not started by a single
310
+ # line. The turn does not end here, however much work there was in it: creating the branch, moving
311
+ # the column and cleaning up neighbouring branches are all commands that change the tree, and the
312
+ # second sign releases such a turn whole.
267
313
  #
268
- # Ровно так ход и вставал: задача взята, номер назван владельцу, отчёт написан — и следующее
269
- # действие состояния «задача-взята», написать замысел, не сделано. Отчёт выглядит работой лучше
270
- # всякой другой, а страж, знающий только «была ли за ход работа», подтверждает это: работа была.
271
- # Разбор — запись «2026-08-25-task-taken-and-turn-ended» в приёме.
314
+ # This is exactly how a turn used to stall: the task is taken, the number is named to the owner,
315
+ # the report is written — and the next action of the state that means the task is taken, to write
316
+ # the plan, is not done. A report looks more like work than any other, and a guard that knows only
317
+ # "was there work in the turn" confirms it: there was work.
318
+ # Incident analysis — the record "2026-08-25-task-taken-and-turn-ended" in the intake.
272
319
  #
273
- # Папка, разобранная коммитом ветки, сюда не попадает: `archived` означает отданную работу, и её
274
- # судит прежний ярус. Ветка без номера задачи не судится вовсе — под пробу заводят и такие.
320
+ # A folder taken apart by a branch commit does not get here: `archived` means handed-over work, and
321
+ # the previous tier judges it. A branch without a task number is not judged at all — such ones are
322
+ # created for a trial too.
275
323
  if [ "$archived" != "true" ] && [ -z "$progress" ] && [ -n "$branch" ] && [ ! -d "$root/$tasks_dir/$branch" ]; then
276
324
  task_key="${RT_TASK_KEY:-}"
277
325
  if [ -z "$task_key" ] && [ -f "$root/.claude/rt-kit/checks.json" ]; then
@@ -279,39 +327,40 @@ if [ "$archived" != "true" ] && [ -z "$progress" ] && [ -n "$branch" ] && [ ! -d
279
327
  fi
280
328
  [ -z "$task_key" ] && task_key='[A-Za-z][A-Za-z0-9]*'
281
329
  if printf '%s' "$branch" | grep -qE "^${task_key}-[0-9]+-" 2>/dev/null; then
282
- reason="BLOCKED by turn-exit-guard: работа взята и не начата — ветка \`$branch\` заведена, а папки задачи при ней нет.
330
+ reason="BLOCKED by turn-exit-guard: the work is taken and not begun — the branch \`$branch\` is created, and there is no task folder next to it.
283
331
 
284
- Заведённая ветка означает состояние «задача-взята», и обязательное действие у него одно — написать замысел. Ход, кончившийся здесь, оставляет работу объявленной и не начатой: номер назван, колонка сдвинута, а на диске нет ни разбора просьбы, ни этапов. Команды заведения ветки и перевода колонки этого не заменяют — ими такой ход и заполняется.
332
+ A created branch means the state «задача-взята», and it has one mandatory action — write the plan. A turn ending here leaves the work announced and not begun: the number is named, the column is moved, and on disk there is neither the analysis of the request nor the stages. The commands creating the branch and moving the column do not replace it — such a turn is filled with exactly those.
285
333
 
286
- npm run task:new -- <номер> # если папки нет вовсе
334
+ npm run task:new -- <number> # if there is no folder at all
287
335
 
288
- Собери \`$tasks_dir/$branch/\` и напиши замысел этим же ходом.
336
+ Assemble \`$tasks_dir/$branch/\` and write the plan in this same turn.
289
337
 
290
- Страж судит один ход: следующий заход не отбивается."
338
+ The guard judges one turn: the next session is not refused."
291
339
 
292
- rt_te_deny "$reason" "работа взята и не начата — напиши замысел."
340
+ rt_te_deny "$reason" "the work is taken and not begun — write the plan."
293
341
  fi
294
342
  fi
295
343
 
296
- # Контракт этапа. Отметка «этап сделан» — утверждение о дереве, и подтверждается оно выводом
297
- # команды, а не словами: этап, отмеченный по памяти, через заход неотличим от проверенного.
298
- # Страж сравнивает номер этапа с тем, что лежит в истории ветки, и на выросшем номере требует
299
- # команды из строки «Чем проверяется» — она стоит в замысле обратными кавычками. Приём, записанный
300
- # прозой, страж не читает: подтвердить его выводом нечем, и это его известная граница.
344
+ # The stage contract. The mark "the stage is done" is a statement about the tree, and it is backed
345
+ # by the output of a command, not by words: a stage marked from memory is, a session later,
346
+ # indistinguishable from a checked one. The guard compares the stage number with what lies in the
347
+ # branch history, and on a grown number it demands the commands from the verification line — it
348
+ # stands in the plan in backticks. A technique written as prose the guard does not read: there is
349
+ # nothing to back it with output, and this is its known limit.
301
350
  stage_now=""
302
351
  stage_was=""
303
352
  if [ -n "$progress" ]; then
304
- stage_now="$(sed -n 's/^[[:space:]]*[-*][[:space:]]*\*\*Этап:\*\*[[:space:]]*\([0-9][0-9]*\).*/\1/p' "$progress" 2>/dev/null | head -1)"
305
- stage_was="$(git -C "$root" show "HEAD:$tasks_dir/$branch/progress.md" 2>/dev/null | sed -n 's/^[[:space:]]*[-*][[:space:]]*\*\*Этап:\*\*[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -1)"
353
+ stage_now="$(sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Stage|Этап):\*\*[[:space:]]*([0-9][0-9]*).*/\2/p' "$progress" 2>/dev/null | head -1)"
354
+ stage_was="$(git -C "$root" show "HEAD:$tasks_dir/$branch/progress.md" 2>/dev/null | sed -nE 's/^[[:space:]]*[-*][[:space:]]*\*\*(Stage|Этап):\*\*[[:space:]]*([0-9][0-9]*).*/\2/p' | head -1)"
306
355
  fi
307
356
 
308
357
  if [ -n "$progress" ] && [ -n "$stage_now" ] && [ -n "$stage_was" ] && [ "$stage_now" -gt "$stage_was" ] 2>/dev/null; then
309
358
  plan="$root/$tasks_dir/$branch/plan.md"
310
- # Контракт закрытого этапа, а не начатого: подтверждается то, что объявлено сделанным.
359
+ # The contract of the closed stage, not of the started one: what is declared done is what is backed.
311
360
  contract="$(awk -v n="$stage_was" '
312
361
  $0 ~ "^### " n "\\." { inside = 1; next }
313
362
  /^### / { inside = 0 }
314
- inside && /\*\*Чем проверяется:\*\*/ { print }
363
+ inside && /\*\*(Verified by|Чем проверяется):\*\*/ { print }
315
364
  ' "$plan" 2>/dev/null)"
316
365
  missing=""
317
366
  while IFS= read -r cmd; do
@@ -321,122 +370,125 @@ if [ -n "$progress" ] && [ -n "$stage_now" ] && [ -n "$stage_was" ] && [ "$stage
321
370
  $(printf '%s' "$contract" | grep -o '`[^`]*`' | tr -d '`')
322
371
  EOF
323
372
  if [ -n "$missing" ]; then
324
- reason="BLOCKED by turn-exit-guard: этап ${stage_was} объявлен закрытым, а команды, которыми он проверяется, за этот ход не запускались:$(printf '%b' "$missing")
373
+ reason="BLOCKED by turn-exit-guard: the stage ${stage_was} is declared closed, and the commands it is verified by were not run in this turn:$(printf '%b' "$missing")
325
374
 
326
- Отметка «этап сделан» — утверждение о дереве, и подтверждается оно выводом команды, а не словами: через заход отмеченное по памяти неотличимо от проверенного.
375
+ The mark «этап сделан» is a statement about the tree, and it is backed by the output of a command, not by words: a session later what was marked from memory is indistinguishable from what was checked.
327
376
 
328
- Запусти их этим же ходом либо верни прежний номер этапа в ход работы.
377
+ Run them in this same turn or return the former stage number to the progress.
329
378
 
330
- Страж судит один ход: следующий заход не отбивается."
331
- rt_te_deny "$reason" "закрытый этап не подтверждён выводом команды."
379
+ The guard judges one turn: the next session is not refused."
380
+ rt_te_deny "$reason" "a closed stage is not backed by the output of a command."
332
381
  fi
333
382
  fi
334
383
 
335
- # Работа отдана, а следующая только названа. Работы в таком ходе больше, чем в любом другом, — и
336
- # вся она по сданной задаче: отдача завершает прошлую работу, а не ход. Девять разборов
337
- # происшествий за сутки описывают девять разных остановок, и во всех девяти последним действием
338
- # хода был текст владельцу: отчёт, сводка, объявление намерения.
339
- # Разбор — запись «2026-08-25-handover-turn-ends-on-intent» в приёме.
384
+ # The work is handed over and the next one is only named. There is more work in such a turn than in
385
+ # any other — and all of it is on the task handed in: the handover finishes the previous work, not
386
+ # the turn. Nine incident analyses in a day describe nine different stops, and in all nine the last
387
+ # action of the turn was a text to the owner: a report, a summary, an announcement of intent.
388
+ # Incident analysis — the record "2026-08-25-handover-turn-ends-on-intent" in the intake.
340
389
  if [ "$handed_over" = "true" ] && [ "$started_next" != "true" ]; then
341
- reason="BLOCKED by turn-exit-guard: заявка открыта, а по следующей работе за этот ход не сделано ничего.
390
+ reason="BLOCKED by turn-exit-guard: a request is open, and nothing was done about the next work in this turn.
342
391
 
343
- Отданная работа кончает ход только вместе с начатой следующей — по ней должно быть сделано действие, а не сказано. «Беру такую-то» выходом не является: правило зовёт это объявлением намерения.
392
+ Handed-over work ends a turn only together with the next one begun — an action about it must be done, not said. «Беру такую-то» is not an exit: the rule calls that an announcement of intent.
344
393
 
345
- Всё, что было до открытия заявки, сделано по сданной задаче и о следующей не говорит ничего.
394
+ Everything that happened before the request was opened was done on the handed-over task and says nothing about the next one.
346
395
 
347
- npm run task:new -- <заголовок> # завести следующую
348
- git checkout -b <КЛЮЧ>-<номер>-<slug> # взять её в работу
396
+ npm run task:new -- <title> # create the next one
397
+ git checkout -b <KEY>-<number>-<slug> # take it into work
349
398
 
350
- Сделай первый шаг по следующей работе этим же ходом. Владелец сказал остановиться — так и напиши: страж читает его слово, а не пересказ.
399
+ Do the first step of the next work in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
351
400
 
352
- Страж судит один ход: следующий заход не отбивается."
401
+ The guard judges one turn: the next session is not refused."
353
402
 
354
- rt_te_deny "$reason" "работа отдана, а следующая не начата."
403
+ rt_te_deny "$reason" "the work is handed over and the next one is not begun."
355
404
  fi
356
405
 
357
- # Ход кончился ожиданием чужого шага. Работа в нём была — тем он и обманчив: полон, и пустоты за
358
- # ним не видно. Судится последнее действие, а не наличие работы.
406
+ # The turn ended with waiting for someone else's step. There was work in it — that is what makes it
407
+ # deceptive: it is full, and the emptiness behind it is invisible. The last action is judged, not
408
+ # the presence of work.
359
409
  if [ "$waited" = "true" ]; then
360
- reason="BLOCKED by turn-exit-guard: последним действием хода стало ожидание чужого шага, а оно состоянием работы не бывает.
410
+ reason="BLOCKED by turn-exit-guard: the last action of the turn was waiting for a step by someone else, and that is never a state of the work.
361
411
 
362
- Прогон, разбор владельцем и слияние идут без исполнителя и от взгляда быстрее не становятся. Работы за ход могло быть много — она остаётся ровно там, где стояла, и владелец видит исполнителя стоящим.
412
+ The run, the review by the owner and the merge go on without the executor and do not get faster from being watched. There may have been much work in the turn — it stays exactly where it stood, and the owner sees the executor standing still.
363
413
 
364
- Следующий шаг записан в ходе работы: ${next_step}
414
+ The next step is written in the progress: ${next_step}
365
415
 
366
- Сделай его этим же ходом либо возьми следующую задачу. Ожидание в середине хода законно — отбит именно конец.
416
+ Do it in this same turn or take the next task. Waiting in the middle of a turn is lawful — what is refused is the end.
367
417
 
368
- Страж судит один ход: следующий заход не отбивается."
418
+ The guard judges one turn: the next session is not refused."
369
419
 
370
- rt_te_deny "$reason" "ход кончился ожиданием чужого шага."
420
+ rt_te_deny "$reason" "the turn ended with waiting for a step by someone else."
371
421
  fi
372
422
 
373
- # Общий рубеж. Работа за ход была — но последним действием стал не она, а текст владельцу.
374
- # Частные ярусы выше называют вид остановки точнее; сюда доходит то, чего они не знают по имени.
423
+ # The shared line. There was work in the turn — but the last action was not it, it was a text to the
424
+ # owner. The particular tiers above name the kind of stop more precisely; what reaches here is what
425
+ # they do not know by name.
375
426
  if [ "$worked" = "true" ] && [ "$ended_working" != "true" ]; then
376
- reason="BLOCKED by turn-exit-guard: работа за ход была, но последним действием хода стала не она.
427
+ reason="BLOCKED by turn-exit-guard: there was work in the turn, but the last action of the turn was not it.
377
428
 
378
- Ход кончается работой, а не рассказом о ней. Отчёт, сводка и объявление намерения выходом не являются: они выглядят завершением тем убедительнее, чем больше сделано, — и ровно на это место встаёт следующее действие.
429
+ A turn ends with work, not with an account of it. A report, a summary and an announcement of intent are not an exit: the more was done, the more convincingly they look like completion — and the next action takes exactly that place.
379
430
 
380
- Следующий шаг записан в ходе работы: ${next_step}
431
+ The next step is written in the progress: ${next_step}
381
432
 
382
- Сделай его этим же ходом, а сказать о сделанном можно после. Владелец сказал остановиться — так и напиши: страж читает его слово, а не пересказ.
433
+ Do it in this same turn, and telling about what was done can come after. The owner said to stop — then write so: the guard reads their word, not a retelling.
383
434
 
384
- Страж судит один ход: следующий заход не отбивается."
435
+ The guard judges one turn: the next session is not refused."
385
436
 
386
- rt_te_deny "$reason" "последним действием хода стала не работа."
437
+ rt_te_deny "$reason" "the last action of the turn was not work."
387
438
  fi
388
439
 
389
- # Работа, оставшаяся в рабочем дереве. Ветка ушла вперёд своей удалённой ссылки, а заявки при
390
- # ней в этом ходе не открывали: сделанное лежит там, где его не видит никто, кроме сделавшего.
391
- # Признак читается без сети и молчит там, где ссылки нет вовсе — под пробу заводят и такие ветки.
392
- # Разбор — запись «2026-08-25-fifteen-branches-over-one-index» в приёме.
440
+ # Work left in the working tree. The branch has gone ahead of its remote reference, and no PR was
441
+ # opened on it in this turn: what was done lies where nobody sees it except the one who did it. The
442
+ # sign is read without the network and stays silent where there is no reference at all — such
443
+ # branches are created for a trial too.
444
+ # Incident analysis — the record "2026-08-25-fifteen-branches-over-one-index" in the intake.
393
445
  if [ "$worked" = "true" ] && [ "$handed_over" != "true" ]; then
394
446
  unpushed="$(git -C "$root" rev-list --count '@{u}..HEAD' 2>/dev/null)"
395
447
  if [ -n "$unpushed" ] && [ "$unpushed" -gt 0 ] 2>/dev/null; then
396
- reason="BLOCKED by turn-exit-guard: за ход была работа, но она осталась в рабочем дереве — неотданных коммитов ${unpushed}.
448
+ reason="BLOCKED by turn-exit-guard: there was work in the turn, but it stayed in the working tree — commits not handed over: ${unpushed}.
397
449
 
398
- Владелец видит прежнее состояние и читает его как «не сделано ничего». Ходов отсюда два: довести работу до хостинга — запушить ветку и открыть заявку — либо снять сделанное, если оно не нужно.
450
+ The owner sees the former state and reads it as «nothing was done». Two moves from here: bring the work to the hosting — push the branch and open a request — or remove what was done if it is not needed.
399
451
 
400
- Оставшееся в дереве называется причиной — словом владельца, а не списком остатков.
452
+ What is left in the tree is named with a reason — in the words of the owner, not as a list of leftovers.
401
453
 
402
- Страж судит один ход: следующий заход не отбивается."
454
+ The guard judges one turn: the next session is not refused."
403
455
 
404
- rt_te_deny "$reason" "работа осталась в рабочем дереве."
456
+ rt_te_deny "$reason" "the work stayed in the working tree."
405
457
  fi
406
458
  fi
407
459
 
408
460
  [ "$worked" = "true" ] && exit 0
409
461
 
410
462
  if [ "$archived" = "true" ]; then
411
- reason="BLOCKED by turn-exit-guard: папка задачи снята коммитом ветки, а за этот ход не сделано ничего — ни правки, ни команды, меняющей дерево.
463
+ reason="BLOCKED by turn-exit-guard: the task folder was removed by a commit of the branch, and nothing was done in this turn — neither an edit nor a command changing the tree.
412
464
 
413
- Снятая папка означает середину отдачи, а не её конец: убирают её ДО того, как открыта заявка, и между этими двумя движениями работу не видит никто, кроме того, кто её сделал. Состояние работы с этой минуты объявить нечем, поэтому ход судится по второму признаку — была ли за него работа.
465
+ A removed folder means the middle of handing over, not its end: it is taken away BEFORE the request is opened, and between these two motions nobody but the one who did the work sees it. From this minute there is nothing to declare the state of the work by, so the turn is judged by the second sign — whether there was work in it.
414
466
 
415
- Оставшийся шаг один: открыть заявку черновиком. Заявка уже открыта — возьми следующую задачу: ожидание чужого прогона работой не является и ходом не кончается.
467
+ One step is left: open the request as a draft. The request is already open — then take the next task: waiting for a run by someone else is not work and does not end a turn.
416
468
 
417
- Страж судит один ход: следующий заход не отбивается."
469
+ The guard judges one turn: the next session is not refused."
418
470
  elif [ -z "$state" ]; then
419
- reason="BLOCKED by turn-exit-guard: за этот ход не сделано ничего — ни правки, ни команды, меняющей дерево. Папки задачи у этой работы нет, и состояние взять неоткуда, но ход это не кончает.
471
+ reason="BLOCKED by turn-exit-guard: nothing was done in this turn — neither an edit nor a command changing the tree. This work has no task folder, and there is nowhere to take the state from, but that does not end the turn.
420
472
 
421
- Ход кончается четырьмя способами, и других нет: вопрос владельцу, ответа на который в правилах нет; отказ гарда; заполненное окно захода; отданная работа с начатой следующей. Названная и не запущенная команда выходом не является: строка «сейчас запущу» — объявление намерения, а оно прямо названо ложным концом хода.
473
+ A turn ends in four ways and there are no others: a question to the owner the rules do not answer; a refusal of a guard; a filled session window; work handed over with the next one begun. A command named and not run is not an exit: the line «сейчас запущу» is an announcement of intent, and that is named outright as a false end of a turn.
422
474
 
423
- Работа по слову владельца — «разложи», «обнови», «посмотри» — идёт без задачи и без ветки, и остановить её нечем, кроме этого признака.
475
+ Work by the word of the owner — «разложи», «обнови», «посмотри» — goes without a task and without a branch, and there is nothing to stop it by except this sign.
424
476
 
425
- Запусти названное этим же ходом. Владелец сказал остановиться — так и напиши: страж читает его слово, а не пересказ.
477
+ Run what is named in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
426
478
 
427
- Страж судит один ход: следующий заход не отбивается."
479
+ The guard judges one turn: the next session is not refused."
428
480
  else
429
- reason="BLOCKED by turn-exit-guard: работа в состоянии '${state}', а за этот ход по ней не сделано ничего — ни правки, ни команды, меняющей дерево.
481
+ reason="BLOCKED by turn-exit-guard: the work is in the state '${state}', and nothing was done about it in this turn — neither an edit nor a command changing the tree.
430
482
 
431
- Ход кончается четырьмя способами, и других нет: вопрос владельцу, ответа на который в правилах нет; отказ гарда; заполненное окно захода; отданная работа с начатой следующей. Отчёт о сделанном выходом не является — он выглядит работой лучше всякой другой, и пустоты за ним не видно.
483
+ A turn ends in four ways and there are no others: a question to the owner the rules do not answer; a refusal of a guard; a filled session window; work handed over with the next one begun. A report about what was done is not an exit — it looks more like work than any other, and the emptiness behind it is invisible.
432
484
 
433
- Следующий шаг записан в ходе работы: ${next_step}
485
+ The next step is written in the progress: ${next_step}
434
486
 
435
- Сделай его этим же ходом. Владелец сказал остановиться — так и напиши: страж читает его слово, а не пересказ.
487
+ Do it in this same turn. The owner said to stop — then write so: the guard reads their word, not a retelling.
436
488
 
437
- Страж судит один ход: следующий заход не отбивается."
489
+ The guard judges one turn: the next session is not refused."
438
490
  fi
439
491
 
440
- rt_te_deny "$reason" "работа не кончена — следующий шаг стоит в ходе работы."
492
+ rt_te_deny "$reason" "the work is not finished — the next step stands in the progress."
441
493
 
442
494
  exit 0