@rt-tools/agent-kit 0.24.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.
- package/assets/agents/business-analyst.md +51 -50
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epics.github.mjs +75 -41
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +149 -127
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +172 -164
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +120 -37
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +174 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +108 -97
- package/assets/defaults/project.sh +225 -185
- package/assets/defaults/shell.sh +73 -68
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +30 -28
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +11 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +46 -43
- package/assets/hooks/dispatch.sh +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +45 -38
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +196 -180
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +67 -58
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +36 -34
- package/assets/hooks/rule-source-guard.sh +47 -42
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +40 -37
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +96 -44
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -124
- package/assets/laws/work-conduct.md +250 -244
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +93 -86
- package/assets/patterns/git-workflow-commit.github.md +152 -141
- package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +98 -93
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +131 -106
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +37 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +215 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +204 -192
- package/assets/patterns/testing-e2e.md +102 -101
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +75 -74
- package/assets/rules/browser-verification.md +223 -214
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +198 -173
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +250 -239
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -143
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -209
- package/assets/rules/turn-conduct.md +255 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +235 -211
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +12 -3
- package/lib/enroll.js.map +1 -1
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +6 -2
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.24.0.tgz +0 -0
|
@@ -1,40 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# rt-hook: Stop
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
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
|
-
#
|
|
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
|
-
#
|
|
34
|
-
#
|
|
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 -
|
|
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
|
-
|
|
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 -
|
|
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
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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:
|
|
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
|
-
|
|
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 -
|
|
305
|
-
stage_was="$(git -C "$root" show "HEAD:$tasks_dir/$branch/progress.md" 2>/dev/null | sed -
|
|
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 &&
|
|
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:
|
|
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
|
-
#
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|