@rt-tools/agent-kit 0.24.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/assets/agents/business-analyst.md +51 -50
  2. package/assets/agents/cargo-writer.md +54 -0
  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-epic-link.github.mjs +29 -0
  15. package/assets/checks/board-epics.github.mjs +286 -49
  16. package/assets/checks/board-folders.mjs +61 -0
  17. package/assets/checks/board-gh.github.mjs +35 -26
  18. package/assets/checks/board-long-work.github.mjs +29 -25
  19. package/assets/checks/board-paths.github.mjs +21 -16
  20. package/assets/checks/board-pull-state.github.mjs +168 -0
  21. package/assets/checks/board-runs.github.mjs +45 -43
  22. package/assets/checks/board-task-dirs.github.mjs +98 -0
  23. package/assets/checks/board-titles.github.mjs +19 -17
  24. package/assets/checks/board.github.mjs +133 -194
  25. package/assets/checks/check-archive-age.mjs +23 -19
  26. package/assets/checks/check-board.github.mjs +131 -263
  27. package/assets/checks/check-descriptions.mjs +30 -29
  28. package/assets/checks/check-doc-paths.mjs +91 -88
  29. package/assets/checks/check-dupes.mjs +84 -80
  30. package/assets/checks/check-file-size.mjs +74 -71
  31. package/assets/checks/check-glossary.mjs +47 -37
  32. package/assets/checks/check-hook-scope.mjs +30 -27
  33. package/assets/checks/check-lib-layers.mjs +22 -21
  34. package/assets/checks/check-profile-drift.mjs +48 -43
  35. package/assets/checks/check-prose-style.mjs +138 -39
  36. package/assets/checks/check-push-gate.mjs +53 -50
  37. package/assets/checks/check-reuse.mjs +50 -40
  38. package/assets/checks/check-schema-drift.mjs +104 -84
  39. package/assets/checks/check-specs.mjs +155 -134
  40. package/assets/checks/check-state-next.mjs +66 -52
  41. package/assets/checks/check-states.mjs +32 -30
  42. package/assets/checks/check-styles.mjs +52 -51
  43. package/assets/checks/check-turn-map.mjs +54 -46
  44. package/assets/checks/epic-table.github.mjs +268 -0
  45. package/assets/checks/lib-boundaries.mjs +32 -30
  46. package/assets/checks/lib-common.mjs +30 -29
  47. package/assets/checks/lib-domains.mjs +34 -34
  48. package/assets/checks/lib-manifests.mjs +17 -15
  49. package/assets/checks/lib-reexports.mjs +18 -18
  50. package/assets/checks/rt-kit-checks.config.mjs +187 -142
  51. package/assets/checks/signals.mjs +43 -39
  52. package/assets/checks/spec-anchors.mjs +114 -87
  53. package/assets/checks/spec-common.mjs +128 -84
  54. package/assets/checks/spec-contract.mjs +30 -30
  55. package/assets/checks/spec-proposed.mjs +27 -24
  56. package/assets/checks/spec-scenarios.mjs +51 -28
  57. package/assets/checks/specs-for.mjs +214 -0
  58. package/assets/checks/task-new.github.mjs +315 -61
  59. package/assets/commands/feedback.md +65 -59
  60. package/assets/commands/next-session.md +64 -57
  61. package/assets/commands/night.md +115 -0
  62. package/assets/commands/skill-curator.md +83 -79
  63. package/assets/defaults/gate-map.sh +108 -97
  64. package/assets/defaults/project.sh +232 -185
  65. package/assets/defaults/shell.sh +73 -68
  66. package/assets/defaults/turn-map.md +47 -44
  67. package/assets/docs/GLOSSARY.md +142 -65
  68. package/assets/hooks/browser-device-id.sh +16 -12
  69. package/assets/hooks/browser-guard-device-id.sh +34 -28
  70. package/assets/hooks/browser-guard-no-asking.sh +5 -4
  71. package/assets/hooks/browser-guard-no-listing.sh +12 -11
  72. package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
  73. package/assets/hooks/browser-guard-require-select.sh +34 -23
  74. package/assets/hooks/claim-guard.sh +62 -56
  75. package/assets/hooks/commit-msg.sh +14 -10
  76. package/assets/hooks/conscience-guard.sh +91 -45
  77. package/assets/hooks/constitution-index.sh +16 -16
  78. package/assets/hooks/deny-tail.sh +28 -26
  79. package/assets/hooks/dev-server-guard.sh +50 -43
  80. package/assets/hooks/dispatch.sh +60 -46
  81. package/assets/hooks/docs-guard.sh +100 -91
  82. package/assets/hooks/epic-over.sh +49 -0
  83. package/assets/hooks/epic-stop-guard.sh +108 -0
  84. package/assets/hooks/exam-guard.sh +105 -93
  85. package/assets/hooks/git-guard-delivery-conflict.sh +41 -36
  86. package/assets/hooks/git-guard-delivery-draft.sh +48 -38
  87. package/assets/hooks/git-guard-delivery-epic.sh +167 -0
  88. package/assets/hooks/git-guard-delivery-folder.sh +50 -43
  89. package/assets/hooks/git-guard-delivery-signature.sh +119 -53
  90. package/assets/hooks/git-guard-delivery.sh +223 -183
  91. package/assets/hooks/git-guard-main.sh +38 -34
  92. package/assets/hooks/git-guard-push-tests.sh +99 -87
  93. package/assets/hooks/glossary-load.sh +23 -22
  94. package/assets/hooks/grill-gate-ask.sh +12 -11
  95. package/assets/hooks/grill-gate.sh +94 -87
  96. package/assets/hooks/guard-note.sh +20 -19
  97. package/assets/hooks/handoff-entry-guard.sh +45 -25
  98. package/assets/hooks/handoff-write.sh +74 -67
  99. package/assets/hooks/hook-input.sh +67 -58
  100. package/assets/hooks/lint-after-edit.sh +95 -61
  101. package/assets/hooks/observe.sh +28 -26
  102. package/assets/hooks/override-write-guard.sh +23 -21
  103. package/assets/hooks/postmortem-guard.sh +42 -39
  104. package/assets/hooks/profile-check.sh +22 -20
  105. package/assets/hooks/proposal-guard.sh +57 -49
  106. package/assets/hooks/prose-style-guard.sh +49 -24
  107. package/assets/hooks/qa-dataid-guard.sh +83 -58
  108. package/assets/hooks/rerun-guard.sh +31 -30
  109. package/assets/hooks/reuse-first-guard.sh +108 -87
  110. package/assets/hooks/roles.sh +14 -14
  111. package/assets/hooks/rule-article.sh +39 -34
  112. package/assets/hooks/rule-source-guard.sh +47 -42
  113. package/assets/hooks/skill-gate-layers.sh +63 -57
  114. package/assets/hooks/skill-gate-rearm.sh +15 -8
  115. package/assets/hooks/skill-gate.sh +89 -81
  116. package/assets/hooks/skill-loaded.sh +10 -6
  117. package/assets/hooks/sql-guard-parse.sh +71 -66
  118. package/assets/hooks/sql-guard-request.sh +51 -46
  119. package/assets/hooks/sql-guard-target.sh +60 -51
  120. package/assets/hooks/sql-guard-write.sh +87 -79
  121. package/assets/hooks/sql-guard.sh +52 -47
  122. package/assets/hooks/stand-login-guard.sh +43 -37
  123. package/assets/hooks/task-context-load.sh +60 -55
  124. package/assets/hooks/task-flow-context.sh +87 -69
  125. package/assets/hooks/task-flow-draft-guard.sh +55 -48
  126. package/assets/hooks/task-flow-guard.sh +67 -64
  127. package/assets/hooks/turn-entry-load.sh +39 -32
  128. package/assets/hooks/turn-exit-guard.sh +260 -204
  129. package/assets/hooks/turn-exit-patterns.sh +63 -0
  130. package/assets/hooks/utf8.sh +14 -11
  131. package/assets/hooks/waiting-turn-guard.sh +104 -94
  132. package/assets/hooks/window-fill-guard.sh +70 -62
  133. package/assets/hooks/work-start-guard.sh +52 -49
  134. package/assets/hooks/write-targets.sh +99 -44
  135. package/assets/laws/autonomous-work.md +29 -27
  136. package/assets/laws/code-structure.md +31 -30
  137. package/assets/laws/delivery.md +170 -137
  138. package/assets/laws/entity-editing.md +52 -50
  139. package/assets/laws/entity-models.md +14 -13
  140. package/assets/laws/frontend-application.md +39 -38
  141. package/assets/laws/lib-imports.md +27 -27
  142. package/assets/laws/lists.md +31 -29
  143. package/assets/laws/navigation.md +37 -37
  144. package/assets/laws/observability.md +41 -40
  145. package/assets/laws/project-documentation.md +106 -99
  146. package/assets/laws/reuse-first.md +31 -29
  147. package/assets/laws/shared-code.md +27 -27
  148. package/assets/laws/verifiability.md +131 -124
  149. package/assets/laws/work-conduct.md +250 -244
  150. package/assets/patterns/admin-lists-screen.md +72 -69
  151. package/assets/patterns/admin-nav-item.md +51 -46
  152. package/assets/patterns/angular-patterns-state.md +32 -31
  153. package/assets/patterns/api-layer-pair.md +33 -31
  154. package/assets/patterns/autonomous-work-run.md +50 -49
  155. package/assets/patterns/browser-verification-measure.md +124 -88
  156. package/assets/patterns/browser-verification-stand.md +169 -157
  157. package/assets/patterns/component-structure-new.md +51 -42
  158. package/assets/patterns/dependencies-upgrade.md +55 -39
  159. package/assets/patterns/doc-style-human.md +55 -37
  160. package/assets/patterns/doc-style-sweep.md +82 -79
  161. package/assets/patterns/doc-style-trace.md +87 -81
  162. package/assets/patterns/doc-style-write.md +130 -122
  163. package/assets/patterns/entity-aside.md +77 -63
  164. package/assets/patterns/entity-models-new.md +37 -37
  165. package/assets/patterns/entity-store.md +33 -33
  166. package/assets/patterns/git-workflow-commit.azure.md +94 -87
  167. package/assets/patterns/git-workflow-commit.github.md +160 -142
  168. package/assets/patterns/git-workflow-commit.gitlab.md +96 -90
  169. package/assets/patterns/git-workflow-docker.md +165 -147
  170. package/assets/patterns/git-workflow-freshness.md +45 -45
  171. package/assets/patterns/git-workflow-merge.md +102 -94
  172. package/assets/patterns/git-workflow-migration.md +54 -52
  173. package/assets/patterns/git-workflow-pr-ready.md +57 -56
  174. package/assets/patterns/git-workflow-pr.azure.md +127 -122
  175. package/assets/patterns/git-workflow-pr.github.md +186 -177
  176. package/assets/patterns/git-workflow-pr.gitlab.md +139 -132
  177. package/assets/patterns/git-workflow-restart.md +35 -31
  178. package/assets/patterns/git-workflow-secrets.md +80 -73
  179. package/assets/patterns/git-workflow-stack.md +136 -107
  180. package/assets/patterns/lib-layers-move.md +62 -53
  181. package/assets/patterns/lib-layers-new.md +59 -45
  182. package/assets/patterns/observability-record.md +72 -67
  183. package/assets/patterns/platform-access-di.md +31 -29
  184. package/assets/patterns/reuse-first-extend.md +66 -61
  185. package/assets/patterns/shared-code-new.md +39 -38
  186. package/assets/patterns/spec-driven-domain.md +161 -151
  187. package/assets/patterns/spec-driven-rule.md +179 -168
  188. package/assets/patterns/spec-driven-sweep.md +41 -39
  189. package/assets/patterns/status-report-table.github.md +48 -36
  190. package/assets/patterns/styling-bem-component.md +42 -42
  191. package/assets/patterns/styling-bem-layout.md +39 -34
  192. package/assets/patterns/styling-bem-sheet.md +59 -58
  193. package/assets/patterns/task-flow-archive.md +222 -215
  194. package/assets/patterns/task-flow-close.md +234 -203
  195. package/assets/patterns/task-flow-handoff.md +154 -145
  196. package/assets/patterns/task-flow-resume.md +138 -133
  197. package/assets/patterns/task-flow-start.md +228 -202
  198. package/assets/patterns/testing-e2e.md +102 -101
  199. package/assets/patterns/testing-unit.md +77 -70
  200. package/assets/patterns/ts-procedure.md +32 -29
  201. package/assets/patterns/turn-entry-map.md +50 -48
  202. package/assets/pitfalls/agent-kit.md +172 -142
  203. package/assets/pitfalls/doc-style.md +96 -91
  204. package/assets/pitfalls/git-workflow.azure.md +49 -46
  205. package/assets/pitfalls/git-workflow.github.md +270 -234
  206. package/assets/pitfalls/git-workflow.gitlab.md +49 -45
  207. package/assets/pitfalls/spec-driven.md +73 -71
  208. package/assets/pitfalls/styling-bem.md +46 -40
  209. package/assets/pitfalls/task-flow.md +262 -246
  210. package/assets/pitfalls/testing.md +99 -92
  211. package/assets/pitfalls/turn-conduct.md +96 -81
  212. package/assets/rules/angular-patterns.md +81 -80
  213. package/assets/rules/api-layer.md +77 -74
  214. package/assets/rules/autonomous-work.md +87 -74
  215. package/assets/rules/browser-verification.md +223 -214
  216. package/assets/rules/component-structure.md +72 -69
  217. package/assets/rules/dependencies.md +74 -67
  218. package/assets/rules/deploy-flow.azure.md +118 -108
  219. package/assets/rules/deploy-flow.github.md +145 -135
  220. package/assets/rules/deploy-flow.gitlab.md +120 -110
  221. package/assets/rules/doc-style.md +201 -173
  222. package/assets/rules/entity-conventions.needs-admin.md +81 -79
  223. package/assets/rules/entity-models.md +73 -70
  224. package/assets/rules/git-workflow.azure.md +224 -228
  225. package/assets/rules/git-workflow.github.md +268 -239
  226. package/assets/rules/git-workflow.gitlab.md +218 -217
  227. package/assets/rules/lib-layers.md +85 -86
  228. package/assets/rules/lists.md +101 -97
  229. package/assets/rules/navigation.md +78 -78
  230. package/assets/rules/observability.needs-app.md +165 -153
  231. package/assets/rules/platform-access.md +76 -75
  232. package/assets/rules/reuse-first.md +153 -143
  233. package/assets/rules/shared-code.md +82 -79
  234. package/assets/rules/spec-driven.md +279 -260
  235. package/assets/rules/status-report.md +62 -58
  236. package/assets/rules/styling-bem.md +81 -77
  237. package/assets/rules/task-flow.md +303 -270
  238. package/assets/rules/testing.md +224 -209
  239. package/assets/rules/turn-conduct.md +262 -258
  240. package/assets/rules/turn-entry.md +92 -87
  241. package/assets/rules/typescript-conventions.md +94 -88
  242. package/assets/samples/specs/_template/spec.md +47 -47
  243. package/assets/samples/tasks/_template/grill.md +20 -20
  244. package/assets/samples/tasks/_template/plan.md +32 -30
  245. package/assets/samples/tasks/_template/progress.md +16 -16
  246. package/assets/skills/agent-kit-extend.md +129 -113
  247. package/assets/skills/agent-kit.md +259 -233
  248. package/assets/skills/write-a-skill.md +76 -71
  249. package/assets/templates/findings.md +19 -19
  250. package/assets/templates/gate-map.sh +16 -14
  251. package/assets/templates/implementation.md +28 -27
  252. package/assets/templates/pattern.md +17 -17
  253. package/assets/templates/pitfalls.md +6 -6
  254. package/assets/templates/postmortem.md +24 -23
  255. package/assets/templates/project.sh +24 -24
  256. package/assets/templates/proposal.md +62 -60
  257. package/assets/templates/rule.md +38 -38
  258. package/assets/workflows/feature.js +46 -46
  259. package/assets/workflows/plan.js +54 -54
  260. package/bin/agent-kit.d.ts.map +1 -1
  261. package/bin/agent-kit.js +8 -1
  262. package/bin/agent-kit.js.map +1 -1
  263. package/lib/cargo-prose.d.ts +41 -0
  264. package/lib/cargo-prose.d.ts.map +1 -0
  265. package/lib/cargo-prose.js +88 -0
  266. package/lib/cargo-prose.js.map +1 -0
  267. package/lib/cargo.d.ts +12 -1
  268. package/lib/cargo.d.ts.map +1 -1
  269. package/lib/cargo.js +8 -2
  270. package/lib/cargo.js.map +1 -1
  271. package/lib/catalog.d.ts +2 -0
  272. package/lib/catalog.d.ts.map +1 -1
  273. package/lib/catalog.js +4 -3
  274. package/lib/catalog.js.map +1 -1
  275. package/lib/commands.d.ts.map +1 -1
  276. package/lib/commands.js +5 -2
  277. package/lib/commands.js.map +1 -1
  278. package/lib/companion.js +3 -2
  279. package/lib/companion.js.map +1 -1
  280. package/lib/enroll.d.ts +7 -1
  281. package/lib/enroll.d.ts.map +1 -1
  282. package/lib/enroll.js +12 -3
  283. package/lib/enroll.js.map +1 -1
  284. package/lib/fate.d.ts +29 -0
  285. package/lib/fate.d.ts.map +1 -0
  286. package/lib/fate.js +147 -0
  287. package/lib/fate.js.map +1 -0
  288. package/lib/override-marks.d.ts +7 -0
  289. package/lib/override-marks.d.ts.map +1 -1
  290. package/lib/override-marks.js +14 -0
  291. package/lib/override-marks.js.map +1 -1
  292. package/lib/plan.d.ts +11 -0
  293. package/lib/plan.d.ts.map +1 -1
  294. package/lib/plan.js +10 -1
  295. package/lib/plan.js.map +1 -1
  296. package/lib/ship.d.ts +29 -9
  297. package/lib/ship.d.ts.map +1 -1
  298. package/lib/ship.js +44 -2
  299. package/lib/ship.js.map +1 -1
  300. package/lib/shipment.d.ts.map +1 -1
  301. package/lib/shipment.fixture.d.ts +8 -1
  302. package/lib/shipment.fixture.d.ts.map +1 -1
  303. package/lib/shipment.fixture.js +9 -0
  304. package/lib/shipment.fixture.js.map +1 -1
  305. package/lib/shipment.js +38 -5
  306. package/lib/shipment.js.map +1 -1
  307. package/lib/sync.d.ts.map +1 -1
  308. package/lib/sync.js +45 -11
  309. package/lib/sync.js.map +1 -1
  310. package/package.json +1 -1
  311. package/rt-tools-agent-kit-0.27.0.tgz +0 -0
  312. package/rt-tools-agent-kit-0.24.0.tgz +0 -0
@@ -1,37 +1,39 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: Stop
3
- # Гард утверждения: сказанное владельцу о состоянии дерева несёт команду, показавшую это. Stop.
3
+ # The claim guard: what is said to the owner about the state of the tree carries the command that
4
+ # showed it. Stop.
4
5
  #
5
- # Зачем именно так. Правило текстов само говорит, что ответ владельцу не читает ни одна
6
- # проверка: за файл отвечает гейт, за ответ — автор, и цену ошибки в ответе платит владелец.
7
- # Восемь разборов подряд про одно и то же — готовым названо лежащее на диске, снятыми названы
8
- # только локальные ветки, проверенным назван набор уже конвейерного, состоянием дерева названа
9
- # отставшая локальная ссылка. Каждый раз в правило дописывалась статья, и каждый раз промах
10
- # повторялся: текст читают в начале захода, а утверждение говорят в конце.
6
+ # Why exactly this way. The rule of texts itself says that no check reads the reply to the owner:
7
+ # a file is answered for by the gate, a reply by its author, and the price of a mistake in a reply
8
+ # is paid by the owner. Eight analyses in a row about one and the same thing — what lay on the disk
9
+ # was called ready, only local branches were called removed, a set narrower than the pipeline was
10
+ # called checked, a local reference that had fallen behind was called the state of the tree. Each
11
+ # time an article was added to the rule, and each time the miss repeated: the text is read at the
12
+ # start of the session, and the claim is said at its end.
11
13
  #
12
- # Что судится: текст, сказанный владельцу за этот ход. Вывод инструмента и записанное в файл
13
- # сюда не входят — их читают гейт и сверки.
14
+ # What is judged: the text said to the owner within this turn. Tool output and what was written
15
+ # into a file do not go here — those are read by the gate and by the checks.
14
16
  #
15
- # Как судится: у каждого слова-утверждения назван свой род команды. Утверждение о зелёном
16
- # наборе подтверждает прогон набора, о запушенном — вызов пуша, о снятом — вызов удаления.
17
- # Команда ищется в этом же ходе: состояние дерева меняется, и вывод прошлого хода о нынешнем
18
- # уже не говорит.
17
+ # How it is judged: each claim word has a command kind of its own named for it. A claim about a
18
+ # green set is confirmed by a run of the set, about a pushed branch by a push call, about a removed
19
+ # one by a delete call. The command is looked for within this same turn: the state of the tree
20
+ # changes, and the output of a past turn no longer speaks about the present one.
19
21
  #
20
- # Чего гард не судит. Неверный вывод: об образце, судимом по одному его файлу, и о пути, которым
21
- # человек не пойдёт, машине судить нечем — там нет ни слова-утверждения, ни команды, с которой
22
- # сверять. Эти случаи держит правило ведения работы, и это известная граница гарда, а не
23
- # обещание.
22
+ # What the guard does not judge. A wrong conclusion: about a pattern judged by one of its files,
23
+ # and about a path a person will not take, a machine has nothing to judge by — there is neither a
24
+ # claim word there nor a command to check against. Those cases are held by the work-conduct rule,
25
+ # and that is a known boundary of the guard, not a promise.
24
26
  #
25
- # Не судится и чужое слово: цитата в кавычках, вопрос экзаменатора, пересказ чужого текста,
26
- # строка кода и предложение в условном наклонении утверждением о дереве не являются. Отбитые
27
- # за них ходы обходятся дороже пропущенных: гард, отбивающий цитату, учит не проверять дерево,
28
- # а не писать кавычек. Поэтому перед разбором из сказанного вынимаются кавычки, код, строки
29
- # цитирования и предложения со словом условия.
27
+ # Someone else's word is not judged either: a quotation in quotes, an examiner's question, a
28
+ # retelling of someone else's text, a line of code and a sentence in the conditional are not claims
29
+ # about the tree. Turns refused for them cost more than the ones let through: a guard that refuses
30
+ # a quotation teaches not to check the tree but not to write quotes. So before the parse, quotes,
31
+ # code, quoting lines and sentences with a word of condition are taken out of what was said.
30
32
  #
31
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: при любой ошибке, нехватке `jq`, отсутствии записи хода или пустом
32
- # тексте ход РАЗРЕШАЕТСЯ (exit 0). Сломанный гард не имеет права заклинить разговор.
33
+ # FAIL-OPEN: on any error, a missing `jq`, no turn record or empty text the turn is ALLOWED
34
+ # (exit 0). A broken guard has no right to jam the conversation.
33
35
 
34
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
36
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the guard.
35
37
  RT_GUARD_NAME=claim-guard
36
38
 
37
39
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -42,7 +44,7 @@ input="$RT_HOOK_INPUT"
42
44
  [ -z "$input" ] && exit 0
43
45
  command -v jq >/dev/null 2>&1 || exit 0
44
46
 
45
- # Повторный заход по тому же ходу не судится: гард сказал своё один раз и отпускает.
47
+ # A repeat pass over the same turn is not judged: the guard said its piece once and lets go.
46
48
  active="$(printf '%s' "$input" | jq -r '.stop_hook_active // false' 2>/dev/null)"
47
49
  [ "$active" = "true" ] && exit 0
48
50
 
@@ -50,21 +52,23 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
50
52
  [ -z "$transcript" ] && exit 0
51
53
  [ -f "$transcript" ] || exit 0
52
54
 
53
- # Текст ответа ложится в запись хода не раньше, чем хост позовёт хук: гард, прочитавший файл
54
- # первым, судит ход, у которого сказанного нет вовсе, — и молчит, будучи неотличим от гарда,
55
- # который посмотрел и пропустил. Ждём его появления, и не дождавшись — возвращаем ход: пустая
56
- # запись означает не «владельцу ничего не сказано», а «прочитать нечего».
55
+ # The text of the reply lands in the turn record no earlier than the host calls the hook: a guard
56
+ # that read the file first judges a turn that has nothing said in it at all — and stays silent,
57
+ # indistinguishable from a guard that looked and let it through. We wait for it to appear, and
58
+ # failing to see it, we return the turn: an empty record means not "nothing was said to the owner"
59
+ # but "there is nothing to read".
57
60
  #
58
- # Отказ этот принадлежит одному гарду нарочно. Текст судят трое, и печатай они свои объекты
59
- # подряд, вывод перестал бы разбираться целиком — то есть отбой пропал бы весь.
61
+ # This refusal belongs to one guard on purpose. Three of them judge the text, and were they to
62
+ # print their objects one after another, the output would stop being parsed whole — that is, the
63
+ # refusal would be lost entirely.
60
64
  if ! rt_turn_has_text "$transcript"; then
61
- reason="BLOCKED by claim-guard: запись хода не отдала ни одного текста ответа, и судить сказанное владельцу нечем.
65
+ reason="BLOCKED by claim-guard: the record of the turn gave back no reply text at all, and there is nothing to judge what was said to the owner by.
62
66
 
63
- Текст ложится в запись не раньше, чем хост зовёт хук. Прочитанная слишком рано запись выглядит ходом, в котором владельцу ничего не сказано, — и все гарды, судящие сказанное, проходят мимо молча.
67
+ The text lands in the record no earlier than the host calls the hook. A record read too early looks like a turn in which nothing was said to the owner — and every guard that judges what was said passes by in silence.
64
68
 
65
- Повтори завершение хода: к этой минуте текст в записи уже есть. Ход при этом ничего не теряет — сказанное владельцу остаётся тем же.
69
+ Repeat the ending of the turn: by this minute the text is already in the record. The turn loses nothing by it — what was said to the owner stays the same.
66
70
 
67
- Гард судит один ход: следующий заход не отбивается."
71
+ The guard judges one turn: the next session is not refused."
68
72
 
69
73
  # shellcheck disable=SC1090
70
74
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
@@ -76,12 +80,12 @@ if ! rt_turn_has_text "$transcript"; then
76
80
  ${deny_tail_text}"
77
81
 
78
82
  jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
79
- || printf '{"decision":"block","reason":"claim-guard: запись хода не отдала текста ответа — повтори завершение хода."}\n'
83
+ || printf '{"decision":"block","reason":"claim-guard: the record of the turn gave back no reply text — repeat the ending of the turn."}\n'
80
84
  exit 0
81
85
  fi
82
86
 
83
- # Ход — всё, что записано после последней настоящей реплики владельца: ответ инструмента
84
- # приходит той же ролью и репликой не считается.
87
+ # A turn is everything recorded after the owner's last real reply: a tool answer comes in under
88
+ # the same role and does not count as a reply.
85
89
  turn="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r '
86
90
  def is_input:
87
91
  .type == "user"
@@ -105,9 +109,9 @@ said="$(printf '%s' "$turn" | jq -r '.said // ""' 2>/dev/null)"
105
109
  ran="$(printf '%s' "$turn" | jq -r '.ran // ""' 2>/dev/null)"
106
110
  [ -z "$said" ] && exit 0
107
111
 
108
- # Чужое слово вынимается до разбора. Строка цитирования и блок кода уходят целиком, кавычки и
109
- # код в строке гасятся пробелом, а предложения со словом условия отбрасываются: «прогнал бы» и
110
- # «если бы линт был зелёным» о состоянии дерева не говорят ничего.
112
+ # Someone else's word is taken out before the parse. A quoting line and a code block go whole,
113
+ # quotes and inline code are blanked with a space, and sentences with a word of condition are
114
+ # dropped: "would have run" and "if the lint were green" say nothing about the state of the tree.
111
115
  judged="$(printf '%s\n' "$said" \
112
116
  | awk 'BEGIN { code = 0 }
113
117
  /^[[:space:]]*```/ { code = !code; next }
@@ -118,10 +122,11 @@ judged="$(printf '%s\n' "$said" \
118
122
  [ -z "$judged" ] && exit 0
119
123
  said="$judged"
120
124
 
121
- # Карта утверждений: что сказано о дереве | чем это показывают | что назвать в отказе.
125
+ # The claims map: what is said about the tree | what shows it | what to name in the refusal.
122
126
  #
123
- # Слово берётся в той форме, в какой его говорят владельцу. Будущее время сюда не идёт:
124
- # «проверю» и «запущу» утверждениями не являются — они обещание, и врать им нечем.
127
+ # The word is taken in the form it is said to the owner in. The future tense does not go here:
128
+ # "I will check" and "I will start" are not claims — they are a promise, and there is nothing in
129
+ # them to lie with.
125
130
  claims=(
126
131
  'проверено|прогнал[а]?|тесты (зелёные|прошли)|линт(ер)? (зелёный|прошёл|чистый)|сборка (зелёная|прошла)|набор зелёный|проверки зелёные|спеки зелёные|всё зелен(о|ое)§nx (test|lint|build|run|affected|run-many)|npm (run|test)|pnpm (run|exec|test)|jest|vitest|playwright|check:|run\.sh§команду набора — прогон тестов, линта или сборки'
127
132
  'запушен[аоы]?|запушил[а]?|пуш прошёл|ветка уехала§git push§`git push`'
@@ -129,9 +134,10 @@ claims=(
129
134
  '(ветки|ветка|файлы|файл|папка|каталог)[^.]{0,40}(снят|удал|почищ|вычищ)|снят[оыа] с§git branch|git push .*--delete|git rm|gh api|rm §команду удаления — `git branch -d`, `git push --delete` или `git rm`'
130
135
  'прогон (зелёный|прошёл|кончился)|конвейер зелёный|проверки на PR зелёные§gh run§`gh run list` или `gh run view`'
131
136
  '(работа|правка|задача) готова|можно вливать|PR открыт|черновик снят§gh pr §`gh pr create`, `gh pr view` или `gh pr ready`'
132
- # Ожидание чужого шага — тоже утверждение о состоянии, и врать ему есть чем: прогон бывает
133
- # зелёным час, бывает не встав вовсе. Сказанное без команды оставляет готовую работу
134
- # черновиком, и владелец узнаёт об этом последним — дважды за сутки так и вышло.
137
+ # Waiting for someone else's step is a claim about the state too, and there is something in it
138
+ # to lie with: a run is green for an hour, and sometimes never starts at all. Said without a
139
+ # command, it leaves finished work a draft, and the owner learns of it last — that is exactly
140
+ # how it went twice in one day.
135
141
  'жд[уёя][^.]{0,20}прогон|дожида[ею][^.]{0,20}прогон|прогон[^.]{0,20}(ещё идёт|не встал|не кончился|не дошёл)|черновик[^.]{0,30}(не снимаю|сниму|снимется)§gh run|gh pr checks|check-runs|check:board|board\.mjs§команду о прогоне — `gh run list`, `gh pr checks` или сверку очереди работ'
136
142
  'задача заведена|задача (в|переведена в) колонк|колонка переведена§gh issue|gh api|task:new|task:move|board\.mjs§команду очереди работ — заведение задачи или перевод колонки'
137
143
  '(в дереве|в репозитории|здесь|такого файла|такой команды)[^.]{0,30}(нет|не бывает)|не заводили|нигде не встречается§grep|rg |ls |find |git ls-files|git grep|git log|cat §команду поиска — `grep`, `git ls-files` или обход каталога'
@@ -147,18 +153,18 @@ for row in "${claims[@]}"; do
147
153
  [ -z "$found" ] && continue
148
154
  printf '%s' "$ran" | grep -qiE "$proof" 2>/dev/null && continue
149
155
 
150
- reason="BLOCKED by claim-guard: владельцу сказано «${found}» — это утверждение о состоянии дерева, а команды, которая его показывает, за этот ход не было.
156
+ reason="BLOCKED by claim-guard: the owner was told «${found}» — that is a statement about the state of the tree, and there was no command showing it in this turn.
151
157
 
152
- Утверждение о дереве стоит ровно столько, сколько команда, его показавшая: сказанное без команды владелец читает как проверенный факт и узнаёт о расхождении последним.
158
+ A statement about the tree is worth exactly as much as the command that showed it: what is said without a command the owner reads as a verified fact and learns of the divergence last.
153
159
 
154
- Первый выход — убрать утверждение из ответа и сказать о сделанном без него. Он же и верный там, где владелец команды не просил: запуск ради снятия отказа бывает опаснее того, что гард стережёт, — так ход, которому нечего было поставлять, дошёл до пуша.
160
+ The first way out is to remove the statement from the reply and speak of what was done without it. It is the right one wherever the owner asked for no command: a run made to lift a refusal is sometimes more dangerous than what the guard watches — that is how a turn with nothing to deliver reached a push.
155
161
 
156
- Второй — запустить ${name} этим же ходом и назвать её вывод.
162
+ The second is to run ${name} in this same turn and name its output.
157
163
 
158
- Гард судит один ход: следующий заход не отбивается."
164
+ The guard judges one turn: the next session is not refused."
159
165
 
160
- # Общий хвост отказа: два законных хода. Файл может быть не разложен — тогда хвоста нет,
161
- # а причина отказа остаётся прежней.
166
+ # The shared deny tail: the two lawful moves. The file may not be laid out — then there is no
167
+ # tail, and the reason for the refusal stays as it was.
162
168
  # shellcheck disable=SC1090
163
169
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
164
170
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -169,7 +175,7 @@ for row in "${claims[@]}"; do
169
175
  ${deny_tail_text}"
170
176
 
171
177
  jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
172
- || printf '{"decision":"block","reason":"claim-guard: утверждение о дереве не подтверждено командой."}\n'
178
+ || printf '{"decision":"block","reason":"claim-guard: a statement about the tree is not backed by a command."}\n'
173
179
  exit 0
174
180
  done
175
181
 
@@ -1,19 +1,23 @@
1
1
  #!/usr/bin/env bash
2
- # Проверка сообщения коммита. Хук самого гита, а не агента.
2
+ # Commit message check. A hook of git itself, not of the agent.
3
3
  #
4
- # Версионируемый шаблон: рабочая копия хуков гита не версионируется, поэтому файл ставится в
5
- # неё отдельно — скриптом подготовки при установке зависимостей. Переустановка руками, если
6
- # подготовка почему-то не отработала:
4
+ # NOT a guard: it has no `rt-hook:` declaration and hooks into no agent event. The version control
5
+ # calls it as its own hook, not the agent: it judges the message of a commit already written.
6
+ #
7
+ # A versioned template: the git hooks directory of the working copy is not versioned, so the file
8
+ # is put there separately — by the prepare script when dependencies are installed. Reinstall by
9
+ # hand if the prepare step did not run for some reason:
7
10
  # cp .claude/hooks/commit-msg.sh .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
8
11
  #
9
- # Намеренно НЕ через обёртку, подменяющую путь хуков: подмена уводит гит в свой каталог и рвёт
10
- # остальные хуки, уже лежащие в рабочей копии. Родной путь оставляет их нетронутыми.
12
+ # Deliberately NOT through a wrapper that replaces the hooks path: the replacement takes git into
13
+ # its own directory and breaks the other hooks already lying in the working copy. The native path
14
+ # leaves them untouched.
11
15
  #
12
- # Разобранный по типу и области заголовок читается списком, а свободный текст — только
13
- # целиком; поэтому формат и проверяется здесь, на месте, а не глазами на разборе.
16
+ # A title parsed by type and scope reads as a list, while free text reads only as a whole; that is
17
+ # why the format is checked here, on the spot, and not by eye at review.
14
18
  #
15
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: проверяльщика нет (свежий клон без установленных зависимостей) —
16
- # пропуск. Формат тогда не проверяется, и это лучше, чем заклинивший коммит.
19
+ # FAIL-OPEN: no checker (a fresh clone without installed dependencies) — pass. The format is not
20
+ # checked then, and that is better than a jammed commit.
17
21
 
18
22
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
19
23
 
@@ -1,25 +1,27 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: Stop
3
- # Требует: agents/conscience.md, hooks/roles.sh, hooks/deny-tail.sh
4
- # Гард совести: ход, в котором роль совести нашла повтор разобранного промаха, не заканчивается,
5
- # пока повтор не разобран или не назван владельцу.
3
+ # Requires: agents/conscience.md, hooks/roles.sh, hooks/deny-tail.sh
4
+ # Guard of conscience: a turn in which the conscience role found a repeat of an analysed miss does
5
+ # not end until the repeat has been dealt with or named to the owner.
6
6
  #
7
- # Зачем именно так. Разбор происшествия объясняет механизм промаха, но читает его только тот, кто
8
- # открывает каталог сам. Промах, о котором надо напомнить, — ровно тот, о котором исполнитель в
9
- # эту минуту не помнит, поэтому вызов роли не оставляют на его усмотрение: он не случится там,
10
- # где нужнее всего.
7
+ # Why exactly so. An incident analysis explains the mechanism of a miss, but it is read only by
8
+ # whoever opens the directory himself. The miss that has to be recalled is exactly the one the
9
+ # executor does not remember at this minute, so calling the role is not left to his discretion: it
10
+ # would not happen where it is needed most.
11
11
  #
12
- # Роль отвечает первой строкой: «СОВЕСТЬ: повтор» либо «СОВЕСТЬ: чисто». Гард судит последний
13
- # ответ за ход и ничего не знает о том, верна ли находка: это решает исполнитель, и его решение
14
- # — работа следующего хода, а не молчание этого.
12
+ # The role answers with its first line: «СОВЕСТЬ: повтор» or «СОВЕСТЬ: чисто». The guard judges the
13
+ # last answer of the turn and knows nothing about whether the finding is right: that is decided by
14
+ # the executor, and his decision is the work of the next turn, not the silence of this one.
15
15
  #
16
- # Ход отпускается, когда после находки исполнитель сделал хоть что-то по ней: завёл разбор
17
- # происшествия, поправил работу или назвал повтор владельцу. Проверяется это по тому же ходу.
16
+ # The turn is released when, after the finding, the executor did at least something about it:
17
+ # started an incident analysis, corrected the work or named the repeat to the owner. This is checked
18
+ # on the same turn.
18
19
  #
19
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: нет `jq`, нет записи хода, роль молчит или отвечает не по форме — ход
20
- # разрешается. Сломанная совесть не имеет права заклинить разговор.
20
+ # FAIL-OPEN: no `jq`, no turn record, the role stays silent or answers out of form — the turn is
21
+ # ALLOWED. A broken conscience has no right to jam the conversation.
21
22
 
22
- # Своё имя в наблюдениях: отбой пишет общий хвост отказа, а не сам гард.
23
+ # Its own name in the observations: the refusal is written by the shared deny tail, not by the
24
+ # guard itself.
23
25
  RT_GUARD_NAME=conscience-guard
24
26
 
25
27
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
@@ -30,9 +32,9 @@ input="$RT_HOOK_INPUT"
30
32
  [ -z "$input" ] && exit 0
31
33
  command -v jq >/dev/null 2>&1 || exit 0
32
34
 
33
- # Роль, выключенная деревом, гарда не держит: список выключенных лежит в настройке дерева, а
34
- # читает его помощник рядом. Нечитаемая настройка выключением не считается — гард работает как
35
- # прежде.
35
+ # A role switched off by the tree does not hold the guard: the list of the switched-off ones lies in
36
+ # the tree setting, and a helper next to it reads that list. An unreadable setting does not count as
37
+ # switching off — the guard works as before.
36
38
  rt_hooks_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
37
39
  # shellcheck disable=SC1090
38
40
  [ -f "$rt_hooks_dir/roles.sh" ] && . "$rt_hooks_dir/roles.sh" 2>/dev/null
@@ -45,9 +47,21 @@ transcript="$(printf '%s' "$input" | jq -r '.transcript_path // empty' 2>/dev/nu
45
47
  [ -z "$transcript" ] && exit 0
46
48
  [ -f "$transcript" ] || exit 0
47
49
 
48
- # Ход — всё, что записано после последней настоящей реплики владельца. Ответ инструмента
49
- # приходит той же ролью, поэтому строки с `tool_result` репликой не считаются.
50
- verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r '
50
+ # The turn is everything recorded after the owner's last real remark. A tool answer arrives under
51
+ # the same role, so lines with `tool_result` do not count as a remark.
52
+ #
53
+ # The verdict of the role and the deed by the finding are read from different halves of the same
54
+ # record. The verdict is looked for only where the role can answer: a marker printed by a tool
55
+ # that reads and writes files, and a marker in the executor's own text, are not a verdict —
56
+ # otherwise reading a file with that line stands for the role having found a repeat. The deed is
57
+ # looked for over the whole record: the analysis is created by a command, and the word to the
58
+ # owner lies in the reply text.
59
+ found="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r '
60
+ def textof:
61
+ if type == "string" then .
62
+ elif type == "array" then (map(if type == "object" then (.text // "") else tostring end) | join("\n"))
63
+ else tostring end;
64
+
51
65
  def is_input:
52
66
  .type == "user"
53
67
  and ((.isCompactSummary // false) | not)
@@ -57,40 +71,72 @@ verdict="$(tail -n 400 "$transcript" 2>/dev/null | jq -s -r '
57
71
 
58
72
  (map(is_input) | rindex(true)) as $i
59
73
  | (if $i == null then [] else .[$i:] end) as $turn
60
- | [ $turn[]
61
- | if .type == "assistant"
62
- then ([(.message.content // [])[]
63
- | if .type == "tool_use" then (.input.command // "") else (.text // "") end] | join("\n"))
64
- elif .type == "user"
65
- then ([(.message.content // []) | select(type == "array") | .[]
66
- | select(.type == "tool_result") | .content
67
- | if type == "string" then . elif type == "array"
68
- then (map(if type == "object" then (.text // "") else tostring end) | join("\n"))
69
- else tostring end] | join("\n"))
70
- else "" end ] as $flow
71
- | ($flow | map(test("СОВЕСТЬ:[[:space:]]*повтор")) | index(true)) as $found
72
- | if $found == null then "нет-находки"
73
- else ($flow[($found + 1):] | join("\n")
74
- | if test("postmortems|разбор происшествия|СОВЕСТЬ: разобрано") then "разобрано" else "висит" end)
74
+
75
+ # Tools that read and write files: their answer is not a verdict of the role. The same set the
76
+ # exam guard mutes — there the marker was forged by an echo, here it arrives by an honest
77
+ # reading of an archive record that names the marker in its list.
78
+ | ["Bash", "Read", "Grep", "Glob", "Edit", "Write", "MultiEdit", "NotebookEdit"] as $mute
79
+ | [ $turn[] | select(.type == "assistant") | (.message.content // [])[]
80
+ | select(.type == "tool_use") | select(.name as $n | $mute | index($n) != null) | (.id // "") ] as $muted
81
+
82
+ | [ $turn[] | {
83
+ say: (if .type == "assistant" then ""
84
+ elif .type == "user" then
85
+ ([ ((.message.content // []) | if type == "array" then .[] else empty end
86
+ | select(.type == "tool_result")
87
+ | select(((.tool_use_id // "") | if . == "" then null else . end) as $id
88
+ | $id == null or ($muted | index($id)) == null)
89
+ | .content | textof),
90
+ (. as $rec
91
+ | if ($rec.toolUseResult // null) == null then ""
92
+ elif ([($rec.message.content // []) | if type == "array" then .[] else empty end
93
+ | select(.type == "tool_result") | (.tool_use_id // "")]
94
+ | map(. as $id | $muted | index($id)) | any(. != null)) then ""
95
+ else ($rec.toolUseResult | textof) end)
96
+ ] | join("\n"))
97
+ # Host records — the role completion notice and the attachment: the host chooses
98
+ # their form, and they count whole.
99
+ else tostring end),
100
+ act: (if .type == "assistant"
101
+ then ([(.message.content // [])[]
102
+ | if .type == "tool_use" then (.input.command // "") else (.text // "") end] | join("\n"))
103
+ elif .type == "user"
104
+ then ([(.message.content // []) | if type == "array" then .[] else empty end
105
+ | select(.type == "tool_result") | .content | textof] | join("\n"))
106
+ else "" end)
107
+ } ] as $flow
108
+
109
+ | ($flow | map(.say | test("(СОВЕСТЬ|CONSCIENCE):[[:space:]]*(повтор|repeat)")) | index(true)) as $at
110
+ | if $at == null then "no-finding"
111
+ else (($flow[($at + 1):] | map(.act + "\n" + .say) | join("\n"))
112
+ | if test("postmortems|разбор происшествия|analysis of the incident|(СОВЕСТЬ|CONSCIENCE): (разобрано|analysed)")
113
+ then "analysed" else "standing" end)
114
+ # The refusal names the finding, and it is taken from the very answer that was judged:
115
+ # taken by a search over the record it would quote the file that was read.
116
+ + "\n"
117
+ + (($flow[$at].say | split("\n")) as $lines
118
+ | ($lines | map(test("(СОВЕСТЬ|CONSCIENCE):[[:space:]]*(повтор|repeat)")) | index(true)) as $line
119
+ | $lines[$line:($line + 4)] | join("\n"))
75
120
  end
76
121
  ' 2>/dev/null)"
77
122
 
78
- [ "$verdict" = "висит" ] || exit 0
123
+ verdict="$(printf '%s\n' "$found" | head -1)"
124
+ [ "$verdict" = "standing" ] || exit 0
79
125
 
80
- detail="$(tail -n 400 "$transcript" 2>/dev/null | grep -m1 -A3 'СОВЕСТЬ:[[:space:]]*повтор' | tr -d '\\"' | head -4)"
126
+ detail="$(printf '%s\n' "$found" | tail -n +2)"
81
127
 
82
- reason="BLOCKED by conscience-guard: совесть нашла в этом ходе повтор разобранного промаха, и по нему не сделано ничего.
128
+ reason="BLOCKED by conscience-guard: the conscience found in this turn a repeat of a miss already analysed, and nothing was done about it.
83
129
 
84
130
  ${detail}
85
131
 
86
- Ход не кончается на находке. Сделай одно из трёх этим же ходом: поправь работу, заведи разбор происшествия, если механизм новый, или назови повтор владельцу словами — что повторяется и чем это кончилось в прошлый раз.
132
+ A turn does not end at the finding. Do one of three things in this same turn: fix the work, create an analysis of the incident if the mechanism is new, or name the repeat to the owner in words — what repeats and how it ended last time.
87
133
 
88
- Находка неверна — так и скажи владельцу: ложная находка тоже стоит хода, и молчанием она не чинится.
134
+ The finding is wrong — then say so to the owner: a false finding also costs a turn, and silence does not fix it.
89
135
 
90
- Гард судит один ход: следующий заход не отбивается."
136
+ The guard judges one turn: the next session is not refused."
91
137
 
92
- # Общий хвост отказа: два законных хода. Файл может быть не разложен — тогда хвоста нет,
93
- # а причина отказа остаётся прежней.
138
+ # The shared deny tail: two lawful moves. The file may not be laid out — then there is no tail, and
139
+ # the refusal reason stays as it is.
94
140
  # shellcheck disable=SC1090
95
141
  [ -f "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" ] \
96
142
  && . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/deny-tail.sh" 2>/dev/null
@@ -101,6 +147,6 @@ deny_tail_text="$(rt_deny_tail "")"
101
147
  ${deny_tail_text}"
102
148
 
103
149
  jq -n --arg r "$reason" '{decision:"block",reason:$r}' 2>/dev/null \
104
- || printf '{"decision":"block","reason":"conscience-guard: найден повтор разобранного промаха — разбери его или назови владельцу."}\n'
150
+ || printf '{"decision":"block","reason":"conscience-guard: a repeat of an analysed miss is found — analyse it or name it to the owner."}\n'
105
151
 
106
152
  exit 0
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env bash
2
2
  # rt-hook: SessionStart startup|resume|compact|clear
3
- # Вход в слой законов. SessionStart.
3
+ # Entry into the laws layer. SessionStart.
4
4
  #
5
- # Файл закона сам по себе не приносит в контекст ничего — его читают, только когда за ним
6
- # пошли. Хук печатает указатель (имя файла и его заголовок) один раз за сессию: слой известен,
7
- # что существует, и открывается, когда решение его задевает.
5
+ # A law file by itself brings nothing into the context — it is read only when someone went for it.
6
+ # The hook prints an index (file name and its title) once per session: the layer is known to exist,
7
+ # and it is opened when a decision touches it.
8
8
  #
9
- # Указатель ЧИТАЕТСЯ ИЗ КАТАЛОГА, а не выписан руками: выписанный разошёлся бы с тем, что
10
- # разложено на самом деле, и сказать об этом было бы нечем.
9
+ # The index is READ FROM THE DIRECTORY, not written out by hand: a hand-written one would drift from
10
+ # what is actually laid out, and there would be nothing to say so with.
11
11
  #
12
- # ОТКАЗ В ПОЛЬЗУ РАБОТЫ: любая ошибка начинает сессию без добавленного контекста (exit 0).
13
- # Сломанный вход не имеет права остановить сессию.
12
+ # FAIL-OPEN: any error starts the session without the added context (exit 0). A broken entry has no
13
+ # right to stop the session.
14
14
 
15
15
  . "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/utf8.sh" 2>/dev/null || true
16
16
 
@@ -27,17 +27,17 @@ done
27
27
  [ -z "$index" ] && exit 0
28
28
 
29
29
  read -r -d '' context <<EOF
30
- ЗАКОНЫ ПРОЕКТА (слой @rt-tools/agent-kit, разложен в docs/constitution/).
30
+ PROJECT LAWS (the @rt-tools/agent-kit layer, laid out in docs/constitution/).
31
31
 
32
- Закон говорит, ЧТО должно быть верно, и не знает ни путей, ни имён файлов. Правило — каким
33
- приёмом это делается — живёт в .claude/skills/, а имена этого дерева при нём — в
34
- implementation.md рядом. Закон не отменяет правила и не заменяется им: перед решением, которое
35
- закон задевает, читается закон целиком, правило — как обычно.
32
+ A law says WHAT must be true and knows neither paths nor file names. A rule — by which
33
+ technique it is done — lives in .claude/skills/, and the names of this tree next to it are in
34
+ implementation.md alongside. A law does not cancel a rule and is not replaced by it: before a
35
+ decision the law touches, the law is read in full, the rule as usual.
36
36
 
37
37
  ${index}
38
- Разложенные файлы правятся не руками, а надстройкой в .claude/rt-kit/overrides/<ресурс>:
39
- правка на месте теряется на следующем \`agent-kit sync\`, и он на неё отказывает. Сверить
40
- разложенное с пакетом: \`agent-kit sync --check\`.
38
+ Laid-out files are edited not by hand but through the override in .claude/rt-kit/overrides/<resource>:
39
+ an in-place edit is lost on the next \`agent-kit sync\`, and sync refuses it. Check the laid-out
40
+ files against the package: \`agent-kit sync --check\`.
41
41
  EOF
42
42
 
43
43
  jq -n --arg c "$context" '{hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:$c}}' 2>/dev/null || exit 0