@rt-tools/agent-kit 0.27.0 → 0.29.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 (112) hide show
  1. package/assets/checks/board-epic-link.github.mjs +13 -1
  2. package/assets/checks/board-epic-plan.github.mjs +86 -0
  3. package/assets/checks/board-epics.github.mjs +12 -67
  4. package/assets/checks/board-pull-state.github.mjs +6 -11
  5. package/assets/checks/board-runs.github.mjs +102 -2
  6. package/assets/checks/check-board.github.mjs +63 -3
  7. package/assets/checks/check-glossary.mjs +10 -2
  8. package/assets/checks/check-lib-layers.mjs +24 -1
  9. package/assets/checks/check-reuse.mjs +26 -2
  10. package/assets/checks/check-specs.mjs +8 -1
  11. package/assets/checks/lib-boundaries.mjs +2 -2
  12. package/assets/checks/lib-common.mjs +46 -0
  13. package/assets/checks/lib-manifests.mjs +18 -13
  14. package/assets/checks/main-run.github.mjs +69 -0
  15. package/assets/checks/rt-kit-checks.config.mjs +21 -0
  16. package/assets/checks/signals.mjs +39 -5
  17. package/assets/checks/spec-anchors.mjs +48 -4
  18. package/assets/checks/spec-common.mjs +40 -6
  19. package/assets/checks/spec-contract.mjs +33 -7
  20. package/assets/checks/spec-scenarios.mjs +24 -1
  21. package/assets/checks/task-new.github.mjs +9 -3
  22. package/assets/checks/tree-assignment.mjs +169 -0
  23. package/assets/defaults/gate-map.sh +20 -5
  24. package/assets/defaults/project.sh +6 -0
  25. package/assets/hooks/dev-server-guard.sh +61 -32
  26. package/assets/hooks/end-conversation-guard.sh +59 -0
  27. package/assets/hooks/epic-over.sh +11 -2
  28. package/assets/hooks/exam-guard.sh +10 -10
  29. package/assets/hooks/git-guard-delivery-conflict.sh +53 -1
  30. package/assets/hooks/git-guard-delivery-draft.sh +7 -6
  31. package/assets/hooks/git-guard-delivery-epic.sh +7 -0
  32. package/assets/hooks/git-guard-delivery-tree.sh +50 -0
  33. package/assets/hooks/git-guard-delivery.sh +45 -24
  34. package/assets/hooks/git-guard-discard.sh +144 -0
  35. package/assets/hooks/git-guard-push-tests.sh +36 -16
  36. package/assets/hooks/git-guard-tree-assignment.sh +77 -0
  37. package/assets/hooks/hook-input.sh +8 -1
  38. package/assets/hooks/main-run-context.sh +45 -0
  39. package/assets/hooks/reuse-first-guard.sh +29 -4
  40. package/assets/hooks/rule-source-guard.sh +17 -2
  41. package/assets/hooks/skill-gate.sh +7 -0
  42. package/assets/hooks/sql-guard-write.sh +18 -2
  43. package/assets/hooks/tree-assignment-guard.sh +101 -0
  44. package/assets/hooks/turn-exit-epic.sh +110 -0
  45. package/assets/hooks/turn-exit-guard.sh +80 -82
  46. package/assets/hooks/turn-exit-patterns.sh +18 -10
  47. package/assets/hooks/turn-exit-verdict.sh +96 -0
  48. package/assets/laws/delivery.md +20 -6
  49. package/assets/laws/verifiability.md +22 -4
  50. package/assets/laws/work-conduct.md +4 -0
  51. package/assets/patterns/git-workflow-merge.md +13 -0
  52. package/assets/patterns/git-workflow-pr-body.github.md +156 -0
  53. package/assets/patterns/git-workflow-pr.github.md +42 -119
  54. package/assets/patterns/git-workflow-stack.md +38 -2
  55. package/assets/patterns/task-flow-close.md +66 -79
  56. package/assets/patterns/task-flow-resume.md +8 -0
  57. package/assets/patterns/ts-procedure.md +6 -0
  58. package/assets/pitfalls/git-workflow.github.md +44 -0
  59. package/assets/pitfalls/task-flow.md +25 -23
  60. package/assets/pitfalls/turn-conduct.md +18 -0
  61. package/assets/rules/browser-verification.md +8 -0
  62. package/assets/rules/deploy-flow.github.md +6 -0
  63. package/assets/rules/doc-style.md +9 -2
  64. package/assets/rules/git-workflow.azure.md +10 -0
  65. package/assets/rules/git-workflow.github.md +128 -130
  66. package/assets/rules/git-workflow.gitlab.md +10 -0
  67. package/assets/rules/lib-layers.md +11 -0
  68. package/assets/rules/spec-driven.md +10 -1
  69. package/assets/rules/task-flow.md +82 -79
  70. package/assets/rules/testing.md +7 -0
  71. package/assets/rules/turn-conduct.md +47 -28
  72. package/assets/samples/tasks/_template/plan.md +4 -1
  73. package/assets/samples/tasks/_template/progress.md +1 -1
  74. package/assets/skills/agent-kit.md +17 -4
  75. package/bin/agent-kit.d.ts.map +1 -1
  76. package/bin/agent-kit.js +3 -2
  77. package/bin/agent-kit.js.map +1 -1
  78. package/lib/cargo.d.ts +49 -1
  79. package/lib/cargo.d.ts.map +1 -1
  80. package/lib/cargo.js +9 -2
  81. package/lib/cargo.js.map +1 -1
  82. package/lib/commands.d.ts +1 -1
  83. package/lib/commands.d.ts.map +1 -1
  84. package/lib/commands.js +59 -2
  85. package/lib/commands.js.map +1 -1
  86. package/lib/hooks-map.d.ts +5 -0
  87. package/lib/hooks-map.d.ts.map +1 -1
  88. package/lib/hooks-map.js +9 -3
  89. package/lib/hooks-map.js.map +1 -1
  90. package/lib/observations-cargo.d.ts +20 -0
  91. package/lib/observations-cargo.d.ts.map +1 -0
  92. package/lib/observations-cargo.js +88 -0
  93. package/lib/observations-cargo.js.map +1 -0
  94. package/lib/plan.d.ts +2 -0
  95. package/lib/plan.d.ts.map +1 -1
  96. package/lib/plan.js +8 -0
  97. package/lib/plan.js.map +1 -1
  98. package/lib/proposals.d.ts +25 -0
  99. package/lib/proposals.d.ts.map +1 -1
  100. package/lib/proposals.js +43 -1
  101. package/lib/proposals.js.map +1 -1
  102. package/lib/shipment.d.ts +8 -20
  103. package/lib/shipment.d.ts.map +1 -1
  104. package/lib/shipment.js +30 -50
  105. package/lib/shipment.js.map +1 -1
  106. package/lib/tree-mark.d.ts +17 -0
  107. package/lib/tree-mark.d.ts.map +1 -0
  108. package/lib/tree-mark.js +41 -0
  109. package/lib/tree-mark.js.map +1 -0
  110. package/package.json +1 -1
  111. package/rt-tools-agent-kit-0.29.0.tgz +0 -0
  112. package/rt-tools-agent-kit-0.27.0.tgz +0 -0
@@ -16,7 +16,7 @@ with a guard does.
16
16
 
17
17
  **Requires:** `hooks/task-flow-guard.sh`, `hooks/task-flow-draft-guard.sh`,
18
18
  `hooks/task-context-load.sh`, `hooks/grill-gate.sh`, `hooks/window-fill-guard.sh`,
19
- `hooks/turn-exit-guard.sh`, `hooks/work-start-guard.sh`
19
+ `hooks/turn-exit-guard.sh`, `hooks/work-start-guard.sh`, `hooks/main-run-context.sh`
20
20
 
21
21
  ## What it is called here
22
22
 
@@ -51,7 +51,7 @@ The state is declared in the "Where we stand" section of the progress by the mac
51
51
  | State | Entry | Mandatory action | Pattern |
52
52
  | --- | --- | --- | --- |
53
53
  | `просьба-не-разобрана` | the owner's message about new work | exploration over the tree, then questions | `task-flow-start` |
54
- | `эпик-заведён` | the epic card, all its tasks and its plan lie in the queue | take the epic branch from the main branch | `task-flow-start` |
54
+ | `эпик-заведён` | the epic card, all its tasks and its plan lie in the queue | take the epic branch from the main branch; with the first task the epic card moves to in progress | `task-flow-start` |
55
55
  | `разбор-закрыт` | the owner's answers lie on disk | a product agreement, or the reason there is none | `task-flow-start` |
56
56
  | `договорённость-записана` | the draft lies, or the reason is named | create the task, the branch from the epic branch, and the folder | `task-flow-start` |
57
57
  | `задача-взята` | task in the work column, branch by number, folder | write the plan | `task-flow-start` |
@@ -59,8 +59,8 @@ The state is declared in the "Where we stand" section of the progress by the mac
59
59
  | `этап-идёт` | a stage is begun | finish the stage and mark it in the progress | `task-flow-resume` |
60
60
  | `этапы-кончились` | all stages are marked | merge the agreement, bring texts up to date, run the suite | `task-flow-close` |
61
61
  | `разбор-кончился` | the suite is green, texts are up to date | take the folder apart by the last commit | `task-flow-archive` |
62
- | `папка-разобрана` | no folder in the branch, a record in the archive | open the PR as a draft | `task-flow-close` |
63
- | `работа-отдана` | the PR is open as a draft into the epic branch | take the next task of the epic | `task-flow-resume` |
62
+ | `папка-разобрана` | no folder in the branch, a record in the archive | open the PR: a draft where a run is waited for, ready where the pipeline does not wake | `task-flow-close` |
63
+ | `работа-отдана` | the PR is open into the epic branch, with a reviewer | take the next task of the epic | `task-flow-resume` |
64
64
  | `влито` | the PR merged by a person | rules review of the work and the work queue audit | `task-flow-archive` |
65
65
  | `задачи-эпика-кончились` | every task of the epic is merged and its folder taken apart | open the PR of the epic into the main branch | `task-flow-close` |
66
66
 
@@ -72,8 +72,7 @@ output, not by the executor's memory. A filled session window is no state either
72
72
  with a handover, and the work stays where it stood. **An open card says nothing about whether the
73
73
  work is taken.** A card is closed by the merge, and in a session that opens no PRs the list of open
74
74
  ones does not shrink. A task is untaken when the tree holds no trace of it: open numbers are checked
75
- against the archive — closed work has a record there with its number. The audit costs one command
76
- and answers for both sides; the open list answers for neither.
75
+ against the archive — closed work has a record there with its number.
77
76
 
78
77
  What a turn ends with — rule `turn-conduct` under the same law.
79
78
 
@@ -98,7 +97,7 @@ flowchart TD
98
97
  E --> Z{The epic of this work exists}
99
98
  F --> Z
100
99
  Z -->|No| Y[The epic is declared: a card, all its tasks and a plan — then its branch from the main branch]
101
- Z -->|Yes| G[Task, branch from the epic branch, task folder by branch name]
100
+ Z -->|Yes| G[Task, branch from the epic branch, task folder by branch name; the epic card moves with its first task]
102
101
  Y --> G
103
102
  G --> H[A plan with stages; not edited after it is written]
104
103
  H --> I{Stage done}
@@ -107,13 +106,13 @@ flowchart TD
107
106
  I -->|Stages are over| T[The agreement merges into the domain spec, texts are brought up to what was done, then the suite runs]
108
107
  T --> N[The task folder is taken apart by the last commit: the grill — to the archive, findings — to the epic plan, the plan — away]
109
108
  N --> S[Work queue audit]
110
- S --> K[The PR opens as a draft; the executor names the number, what it waits for and what comes next]
109
+ S --> K[The PR opens; the executor names the number, what it waits for and what comes next]
111
110
  K --> W[The rules review of the closed work goes to the background, findings land on disk]
112
111
  W --> L[While the PR waits for review, the next task is taken]
113
112
  L --> M{Review and run are over}
114
113
  M -->|Red run or remarks| V[Fixed in the same branch: the plan is gone from disk, the guard takes the sign of work from the branch history]
115
114
  V --> M
116
- M -->|Green and no remarks| O[The draft is lifted, a person presses merge into the epic branch]
115
+ M -->|Green and no remarks| O[The draft, if there was one, is lifted; a person presses merge into the epic branch]
117
116
  O --> P{Tasks of the epic are left}
118
117
  P -->|Yes| G
119
118
  P -->|No| Q[The PR of the epic into the main branch opens: every folder is taken apart]
@@ -122,23 +121,22 @@ flowchart TD
122
121
  ## How the law applies here
123
122
  - **Editing application code is refused until the work has reached a state in which code is
124
123
  edited.** The guard demands three things: a task folder by branch name, a plan in it and a
125
- declared state. The product agreement has a guard of its own on the same events.
124
+ declared state. The agreement has a guard of its own on the same events.
126
125
  - **The guard judges the declared transition, not the presence of files.** An empty plan lies the
127
126
  same as a written one, so the refusal is lifted by the declared state — `этап-идёт`,
128
127
  `этапы-кончились`, `разбор-кончился`. The fourth road is the branch history: a folder taken apart
129
- by its commit means handed-in work.
130
- - **A state line moved forward is the same declaration of intent, only machine-readable.** A state
131
- is declared by the turn in which its mandatory action is begun by deed.
132
- - **A refusal by state names the mandatory action of the declared state.** Hearing only "wrong
133
- state", the executor rewrites the state line instead of the step.
128
+ means handed-in work.
129
+ - **A state line moved forward is the same declaration of intent, only machine-readable.** It is
130
+ declared by the turn in which its mandatory action is begun by deed.
131
+ - **A refusal by state names the mandatory action of that state.** Hearing only "wrong state", the
132
+ executor rewrites the state line instead of the step.
134
133
  - **Only a word from the list counts as a state name.** A word of one's own says nothing about the
135
134
  entry, the exit or the action.
136
- - **Two requirements — two guards, and one can be lifted without losing the other.** They judge
137
- apart: a line about unchanged behaviour lifts the agreement, not the requirement to reach the
138
- code-editing state.
135
+ - **Two requirements — two guards, and one can be lifted without losing the other.** A line about
136
+ unchanged behaviour lifts the agreement, not the requirement to reach the code-editing state.
139
137
  - **A merged agreement does not lock the branch.** After the merge the "proposed" directory is gone
140
- from disk, while the plan refers to it to the end: the guard tells merged from never-created by
141
- the branch history.
138
+ from disk while the plan refers to it to the end: the guard tells merged from never-created by the
139
+ branch history.
142
140
  - **The agreement is required by the edit paths, not by an appraisal of the task.** `apps/**` and
143
141
  `libs/**` are the sign; rules, texts, tooling and dependencies fall outside it. The bypass is the
144
142
  line `**Behaviour:** unchanged — <the reason of the owner>` in the plan; an empty reason is not
@@ -148,41 +146,45 @@ flowchart TD
148
146
  - **A reply to the owner's order begins with the result, not with intent or its justification.** A
149
147
  justification under someone else's accepted decision reads as its appraisal. One exception:
150
148
  execution stopped by an obstacle — then the obstacle is named.
149
+ - **The last run of the main branch is read first thing in a session and after every known
150
+ merge.** A merge reads as the end of the work, and a red main branch after it lives until the
151
+ owner notices. The start hook prints it; after a merge the command is called by hand, and a red
152
+ or pushed-out run is fixed before new work is taken.
151
153
  - **A session does not start work by itself.** A start needs the owner's word in the same session:
152
154
  the handover, the state from the startup hook and an assigned epic say what to do, not whether to
153
- work. The form of the message is judged: an empty message, one word or one path order no work.
155
+ work. An empty message, one word or one path order no work.
154
156
  - **A refusal by an external limiter removes the way, not the task.** It is not the tree's guard and
155
- names no exit: read as the end of the road, it stops the work whole. The way is taken from the
156
- guard that already described this fix — a bypass with the reason in the commit body, a mark in the
157
- observations, a word to the owner — and the task stays the same.
157
+ names no exit. The way is taken from the guard that already described this fix — a bypass with
158
+ the reason in the commit body, a word to the owner — and the task stays the same.
158
159
  - **An instruction to work by the progress covers all its steps, including those that change
159
160
  history.** Questions are asked about what the progress lacks.
160
161
  - **A question written by a past session does not become a question to the owner.** It is addressed
161
- to the handover's author, and some such questions are closed by a work step.
162
+ to the handover's author, and some are closed by a work step.
162
163
  - **The owner's instruction holds until they cancel it, and a new fact against it is a line in the
163
164
  reply about the cost, not a new question.** Re-asked is what the instruction does not cover. A
164
165
  menu where two options of three offer to cancel the owner's decision is that very cancellation.
165
166
  - **An answer in the owner's message counts the same as an answer in a document.** A question
166
- already answered in the conversation is not asked a second time.
167
+ already answered in the conversation is not asked again.
167
168
  - **The owner's word about the design is a task setting, not a decision.** What they named is
168
169
  usually already in the tree under that word — a name on a screen, a spec section, a model field —
169
170
  and is checked against them before the edit. Diverged — the owner is asked.
170
171
  - **A task folder is created for any work, no exceptions.** An exception with even one lawful form
171
- is executed as permission. It is created before the first edit.
172
+ is executed as permission. It goes in before the first edit.
172
173
  - **The task folder goes into the branch by a commit, not lives in one working tree.** Uncommitted,
173
- it passes edits without refusal, and the refusal comes at the end, when the plan is already gone.
174
- Outside history one draft without a number is lawful.
174
+ it passes edits without refusal until the plan is already gone. Outside history one draft without
175
+ a number is lawful.
175
176
  - **The task folder is taken apart by the last commit before the PR opens, not after approval.** A
176
177
  person merges as soon as they see green, and no room is left for a closing commit.
177
178
  - **After opening the PR, the executor tells the owner the number, what it waits for and what comes
178
- next.** It waits for the run; next the draft is lifted: a green run says nothing is broken and
179
- nothing about the locked merge button.
180
- - **A request to merge is a turn of its own, and it never comes before a green run.** One order:
181
- folder taken apart and pushed → PR open as a draft → run green → draft lifted → the executor asks
182
- to merge, naming the number.
183
- - **The PR opens as a draft, not at the end of the work.** Before it opens the owner sees no edits,
184
- and an open PR reads as an invitation to merge. The draft is lifted by the turn in which the
185
- executor says the solution is ready.
179
+ next.** A draft waits for the run and is lifted after it; a PR opened ready waits for the owner's
180
+ hand, and that is said in the same words.
181
+ - **A request to merge never comes before the work is checked.** Where the pipeline wakes for this
182
+ base: folder taken apart and pushed → PR as a draft → run green → draft lifted → the request to
183
+ merge, naming the number. Where it does not wake, the green push gate is the check, and opening
184
+ the PR and asking to merge are one turn.
185
+ - **A PR that waits for a run opens as a draft, and one that waits for nothing opens ready.** Before
186
+ it opens the owner sees no edits, and an open PR reads as an invitation to merge. Which of the two
187
+ applies is decided by the bases the pipeline wakes for, and that is read from its file.
186
188
  - **The plan guard is the lower bound of the requirement, not its limit.** It demands a folder only
187
189
  for an edit of application code; the article above — for any work.
188
190
  - **An instruction to work by a rule is an instruction to do its steps, including those that change
@@ -190,72 +192,73 @@ flowchart TD
190
192
  - **A taken task does not end a turn.** Creating the task, the branch, the column and the folder is
191
193
  preparation: the work moves to the written-plan state, where the action is different. The
192
194
  turn-exit guard names the first stage in its refusal.
195
+ - **The stages of a plan cover its done-sign whole.** A sign written wider than the sum of the
196
+ stages means a part of the order is given to no step at all: every stage closes, the run is
197
+ green, and half the order is not done. Either the stages are written up to the sign, or the sign
198
+ is narrowed to what the stages give.
199
+ - **A stage's readiness sign is taken from the output of a command run while the plan is written.**
200
+ Written by a guess, it is checked at the stage itself — latest of everything that depended on it.
201
+ - **A plan for work that ports a technique from outside is written by a measurement of one's own
202
+ code.** Reading the sample says how it is built; what is needed here is said by a count over
203
+ one's own files.
193
204
  - **Waiting for one part of a stage is never a stop of the stage.** The parts independent of what is
194
205
  awaited are done in the same turn; the owner is told what is done and what is left for their step.
195
- A refused command reads the same: everything else is done first.
196
206
  - **A finding made mid-stage is checked against the plan's exit conditions before the first edit.**
197
- Nearness of subject proves no belonging: work on the rules layer and work on the commands that
198
- call it roll back apart. A finding named by no exit condition goes to the section on what the work
199
- does not do, and is filed as a task.
207
+ A finding named by no exit condition goes to the section on what the work does not do, and is
208
+ filed as a task.
200
209
  - **Done work is marked only in the progress.** "Where we stand" is rewritten by every session, not
201
210
  appended: it is the first thing the next session reads.
202
- - **A word for a new notion is looked up in the tree's glossary.** The package carries the common
203
- part, the tree appends the subject part by an override; the glossary goes into the context whole
211
+ - **A word for a new notion is looked up in the tree's glossary.** It goes into the context whole
204
212
  at session start, so "did not read it" is never a ground.
205
213
  - **The task folder is created as a draft and gets its number by a command.** Until the grill ends,
206
- how many tasks come out is unknown, so the number never comes first. The command renames the
207
- draft, fills the plan header and strips the layout header from the copies.
214
+ how many tasks come out is unknown, so the number never comes first.
208
215
  - **An abandoned grill is visible.** A draft older than a week is listed by the work queue audit.
209
216
  - **Work ordered in words becomes a task in the queue in the same turn.** Even if it will not be
210
- done now. A draft folder is not the queue: it has no number, and one session knows of it.
211
- Postponed work names a date; postponed silently, it reads as done.
212
- - **Work begins with the epic, and a task outside one is not taken.** Every change belongs to an
213
- epic: the epic names what the whole is, and the main branch takes that whole or does not take it.
214
- Work outside an epic exists only by the owner's word about that work, said about that work.
217
+ done now: a draft folder has no number, and one session knows of it. Postponed work names a
218
+ date; postponed silently, it reads as done.
219
+ - **Work begins with the epic, and a task outside one is not taken.** The epic names what the whole
220
+ is, and the main branch takes that whole or does not take it. Work outside an epic exists only by
221
+ the owner's word about that work, said about that work.
215
222
  - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
216
223
  leaves the first task standing on the main branch, and the epic starts as half of itself already
217
224
  merged.
218
- - **The next task is taken from the epic plan, and the work queue list is asked only where there is
219
- no epic.** By a list of numbers the first task of someone else's epic cannot be told from one's
220
- own. A finished epic is named to the owner by the same turn that takes work outside it.
221
- - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is called
222
- checked only together with a command and its output.
225
+ - **The epic card moves to in progress by the same turn that takes its first task.** The owner
226
+ follows the epic by one card, and one left where the epic was declared reads as never started.
227
+ Nothing checks this yet: the rule `git-workflow` holds the move command and names the gap.
228
+ - **The next task is taken from the epic plan, and the queue list is asked only where there is no
229
+ epic.** By a list of numbers someone else's epic cannot be told from one's own.
230
+ - **Which epic this working copy leads is read from the table of assignments, and the owner writes
231
+ it.** A card of the queue is not an order; a guard refuses every call that takes work until
232
+ their word.
233
+ - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
234
+ called checked only with a command and its output.
223
235
  - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
224
- them one at a time hides the volume. The numbers return to the order section by the same edit.
236
+ them one at a time hides the volume.
225
237
  - **A task of an epic is linked to the epic card as a sub-issue, not only named in the plan.** The
226
- plan and the task body are text, and the board reads neither: on the board a task of an epic looks
227
- exactly like a task outside one, and the makeup and the share of what is done are assembled by
228
- hand from the list of open cards. Closed tasks are linked too — the share counts them.
238
+ board reads no text: without the link a task of an epic looks exactly like a task outside one.
239
+ Closed tasks are linked too — the share of what is done counts them.
229
240
 
230
241
  - **The epic plan names how the branches of its tasks stand, on a par with their order.** Two
231
- arrangements, and both live inside the epic: each branch from the epic branch, or a stack — each
232
- from the previous. The task order says nothing about this. The stack costs more, its price is
233
- listed in the cold part; the arrangement written in the plan is the epic's decision, not that of
234
- whoever creates the branch.
242
+ arrangements: each branch from the epic branch, or a stack — each from the previous. The
243
+ arrangement written in the plan is the epic's decision, not that of whoever creates the branch.
235
244
  - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
236
245
  left in the epic branch reaches the main branch with it: what one branch needed becomes the tree's
237
246
  for good. Until then the epic branch is not offered to a person at all — the merge button on it
238
247
  means the whole epic.
239
248
  - **The epic plan lies where it is found without the network and after the merge.** The card does
240
- not hold the task order, and the task folder would hold it only until the first merge; the
241
- directory — in the rule's companion. What the owner names along the way is appended there by the
242
- turn that accepted it.
243
- - **Building by a sample begins with reading the sample itself, not a retelling of it.** A retelling
244
- in the grill and in the epic plan is not the sample. The repeated part is opened whole, by walking
245
- the directories.
249
+ not hold the task order, and the task folder dies with the merge; the directory — in the rule's
250
+ companion. What the owner names along the way is appended there by the turn that accepted it.
251
+ - **Building by a sample begins with reading the sample itself, whole, by walking the directories.**
246
252
  - **What acts on the tree, not on the edit, lies outside the index.** The path to the sample and the
247
253
  permission to work outside the epic do not belong to the branch and live next to the handover. A
248
254
  number in the permitted list repeats the owner's word, not replaces it.
249
- - **Closed work is reviewed by the rules, and this is a closing step, not a separate request.** What
250
- was loaded and what was missing is seen only by the session that led the work. The review ends
251
- with an edit of the rules layer or a proposal outward.
255
+ - **Closed work is reviewed by the rules as a closing step, not as a separate request.** What was
256
+ loaded and what was missing is seen only by the session that led the work.
252
257
  - **The review of closed work goes to the background, and the executor takes the next task.** The
253
- role works in a turn of its own; the digest is gathered before the launch, the findings are
254
- accepted in one turn.
258
+ digest is gathered before the launch, the findings are accepted in one turn.
255
259
  - **The review's findings wait for the owner, and only the digest of observations leaves for the
256
- package.** A proposal is a draft of an edit to someone else's tree; sent unreviewed, it becomes
257
- the work of someone who did not order it. The digest is always sent: it says what was used and is
258
- never an opinion.
260
+ package.** A proposal sent unreviewed becomes the work of someone who did not order it. The digest
261
+ is always sent: it says what was used and is never an opinion.
259
262
  - **The cheap closing step goes before the costly one, and the run — after the merge.** Merging the
260
263
  agreement and bringing the texts up to date cost minutes, the run costs the session window; a run
261
264
  before the merge checks what will not reach main.
@@ -267,8 +270,8 @@ flowchart TD
267
270
  - **Opening the PR and lifting the draft are refused while the branch carries its task folder.** A
268
271
  person presses merge on the host, where there are no guards: a lifted draft reads to them as an
269
272
  invitation. The branch content is judged, not the working tree.
270
- - **A branch that removed the folder must add a record to the archive.** Removing is cheaper than
271
- taking apart, and the grill leaves first — the only record of the owner's words.
273
+ - **A branch that removed the folder adds a record to the archive.** Removing is cheaper than taking
274
+ apart, and the grill leaves first — the only record of the owner's words.
272
275
  - **The bypass is the line `Task-folder-skip: <reason>` in the PR or in the command itself.** An
273
276
  empty reason is no bypass, and the bypass lifts the refusal but does not silence the work queue
274
277
  audit line.
@@ -181,6 +181,13 @@ flowchart TD
181
181
  apart by the run's colour. So a negative assertion goes paired with a positive one: first it is
182
182
  checked that the place sought is found at all, and only then that it lacks what must not be
183
183
  there.
184
+ - **A count taken over a run's output says nothing until the run is known to have reached the step
185
+ counted.** A build, an install and a suite refuse at preparation steps of their own —
186
+ configuration parsing, dependency resolution, path resolution — and such a refusal carries the
187
+ same exit code as a failure of the work itself. A pattern search for the failure's own marks comes
188
+ back empty there, and the emptiness reads as success of everything behind it. So the count goes
189
+ paired with a positive check, the same way a negative assertion does: first the output is read for
190
+ the sign that the counted step ran at all, and only then the marks in it are counted.
184
191
  - **A test title promises more than the body checks, and the audit does not see it.** The
185
192
  scenario number stands in the title — the scenario counts as covered, and nobody asks what
186
193
  exactly is asserted. The body is read together with the title: the promise in the title and the
@@ -27,16 +27,21 @@ demand, not with the rule.
27
27
 
28
28
  ## Turn exits
29
29
 
30
- A turn ends in four ways and no others: a question to the owner the rules do not answer; a guard's
31
- refusal; a filled window where there is no compaction; work handed in, with the next begun. What
32
- confirms each, the turn map lists where the tree laid it out.
30
+ A turn ends in four ways and no others: a question to the owner the rules do not answer **and no
31
+ task in the work queue that can be taken without waiting for the answer**; a guard's refusal; a
32
+ filled window where there is no compaction; work handed in, with the next begun. What confirms
33
+ each, the turn map lists where the tree laid it out. While an epic has an unfinished task, a turn
34
+ ends by these four alone.
35
+
36
+ The queue is asked by a command in the same turn: "there are no tasks" is a statement about the
37
+ tree, and the executor's memory does not confirm it. A turn where the owner's answer holds one
38
+ piece of work while an independent one lies next to it ends with the work taken, and the question
39
+ goes in a line beside it.
33
40
 
34
41
  Everything else is the turn going on, not its end. A milestone does not end a turn: not a commit,
35
42
  not a read agreement, not the boundary "read — now editing", not a green check.
36
- A transition from state to state — least of all: the mandatory action is done, and the next is
37
- done in the same turn; a state boundary looks like a finished piece better than any milestone, and
38
- the report lands exactly
39
- where the next action should have stood.
43
+ A transition from state to state — least of all: the next mandatory action is done in the same
44
+ turn, and a state boundary looks like a finished piece better than any milestone.
40
45
 
41
46
  Four ways to end a turn look like work and are not: a summary of someone else's step, a menu under
42
47
  an assigned order, a declaration of intent, and a command named but not run.
@@ -75,6 +80,18 @@ flowchart TD
75
80
 
76
81
  ## How the law applies here
77
82
 
83
+ - **A promise to do the work in the next turn is an announcement of intent.** It differs from a
84
+ command named and not run only in that it sounds politer and is therefore recognised as
85
+ a stop less often. An offer to the owner to object to the announced intent is part of the
86
+ promise, not a question: a turn ends with a question when the work does not go without the
87
+ answer, and here it went.
88
+ - **An order named by a number or by the word "all" is counted aloud before the turn ends.** The reply carries the count — how many out of how many. A turn where the count did
89
+ not add up does not end: it goes on with the next item of the order. How many items the order
90
+ holds is written nowhere in the tree — only whoever read the order knows it.
91
+ - **The owner's word to work without stops holds until they cancel it themselves.** A turn ending
92
+ with waiting for that same word invents the cancellation. A new fact against the instruction is a
93
+ line about the price in the reply, not waiting; a decision the tree does not hold is asked as a
94
+ question by the tool.
78
95
  - **A summary of someone else's step.** A run, the owner's review and a merge go on without the
79
96
  executor and are not sped up by watching. Such a summary the owner reads as work: full, with
80
97
  numbers and states, the emptiness behind it unseen. Someone else's step is named with one's own
@@ -133,17 +150,14 @@ flowchart TD
133
150
  the tree does not end here either.
134
151
  - **A taken task is not yet begun work, and the turn does not end on it.** Creating the branch,
135
152
  moving the column and naming the number are preparation: the mandatory action of `задача-взята` is
136
- not done by a single line, yet the turn holds much work, and the sign "was there work" releases
137
- it. The guard has a tier for this; a branch without a task number is not under it, an assembled
138
- folder template lifts it.
153
+ not done by a single line. An epic branch, named by the header of its plan, carries no folder by
154
+ the rule and is not judged so.
139
155
  - **Exploration does not end a turn, however much of it there is.** Switching branch, pulling,
140
156
  browsing history and reading PRs are preparation, not work; a turn of these alone leaves the work
141
- where it stood. It looks like work better than anything else: commands, exact numbers, checkable
142
- answers. Parts of a compound command are judged one by one: a read joined to an edit remains work.
157
+ where it stood. Parts of a compound command are judged one by one: a read joined to an edit
158
+ remains work.
143
159
  - **A reply to the owner is not an action and does not stand last in a turn.** The order inside a
144
- turn is one: work, the first step of the next, then text. The reverse — work, report, end — stands
145
- behind every analysed stop: a report is a form of completeness, and an appended summary reads as
146
- the turn's end the more convincingly the more was done. Saying what was done is always allowed;
160
+ turn is one: work, the first step of the next, then text. Saying what was done is always allowed;
147
161
  its place is after the next action, not instead.
148
162
  - **The last action of a turn is only ever work.** One sign for every kind of stop: a file edit or a
149
163
  changing command — last among what the turn did. The guard's tiers — exploration, waiting, handing
@@ -163,13 +177,25 @@ flowchart TD
163
177
  checked.
164
178
  - **The end of an epic is a stop, and it is the one lawful waiting for a word.** Every task of the
165
179
  epic is merged or handed over, so there is no next task to take: a guard refuses taking one, and
166
- the two guards that judge the end of a turn let the stop through by the same reading. The turn
167
- shows the table of the epic's tasks, says what was done on each and what confirms it, and says
168
- outright that the session waits for orders.
180
+ both guards of the turn end let the stop through by one reading of the epic table. The turn shows
181
+ the table of the epic's tasks, what was done on each and what confirms it, and says that the
182
+ session waits for orders. On the main branch the epic is not read, and the turn is judged as before.
169
183
  <!-- rt-when: ответ владельцу о состоянии работы -->
170
184
 
171
185
  - **The word about a stop the guard reads from the owner, not from the executor.** Otherwise the
172
186
  stop is declared by whoever finds it convenient, and the ban holds until the first inconvenience.
187
+ - **Until the epic is closed a turn ends only by one of the four exits.** A turn that ended with
188
+ work is a stop all the same, and so is a second pass over the same turn: the exit guard judges
189
+ both by the epic and returns the turn with the next step named. The end of the epic is the fifth.
190
+ - **The owner's standing word about a stop is quoted in the progress, in « », in the line «Waiting
191
+ for the owner».** The guard reads their word, not a retelling: a line without a quote releases
192
+ nothing, and a quote holds until the owner cancels it. A word said in this turn releases by itself.
193
+ - **The session is ended by the owner and by nobody else.** The tool that closes the conversation is
194
+ refused by a guard always, with no lawful form of bypass: an assignment stands until the owner
195
+ cancels it, and a session that must close is closed by them.
196
+ - **A refusal of a guard ends the turn only as its last action, and only a refusal of work.** A
197
+ refusal answered by the next call is the middle of the turn. A refused stop — the closing tool —
198
+ is no exit: the refused call was itself the stop, and the exit guard leaves it out.
173
199
  - **The phrase "waiting for your word" is a stop declared by the executor, and the guard refuses it
174
200
  by name.** Without the owner's word about a stop in the turn and without a question put to them by
175
201
  the tool, waiting for their word is a report, not work; the instruction holds until they cancel
@@ -177,8 +203,7 @@ flowchart TD
177
203
  - **A statement about the tree's state is watched by the statement guard, not by the executor's
178
204
  memory.** Everything the reply says about the tree carries a command and its output; said without
179
205
  one, it is no statement — not "checked", not "cleared", not "done". The guard reads the turn's
180
- text to the owner and looks for a command of the same turn; each word has its own kind of command,
181
- since a general sign "there was a command" would confirm one thing by another. The previous turn
206
+ text to the owner and looks for a command of the same turn; each word has its own kind of command. The previous turn
182
207
  does not count: the tree's state changes, and yesterday's output says nothing of today's.
183
208
  - **The statement guard waits for the reply text rather than judging the record as it found it.**
184
209
  The text lands in the turn record no earlier than the host calls the hook. Not having waited, the
@@ -210,10 +235,7 @@ flowchart TD
210
235
  notification is for where every event is acted on; where the outcome matters — one wait.
211
236
  - **A guard's refusal ends the turn.** No other road to the refused edit is sought: not a shell
212
237
  command, not a neighbouring tool, not an edit of the guard itself. The edit is done once the
213
- refusal's condition is met, or not at all — then the owner is told the refusal, not a result. A
214
- bypass costs more than a refusal: a guard refuses one file, a bypassed guard lifts the requirement
215
- from the whole tree and says nothing. Not memory alone holds this — the guards also judge the
216
- shell command that writes the file.
238
+ refusal's condition is met, or not at all — then the owner is told the refusal, not a result.
217
239
  - **A command refused by a gate is repeated whole, not by its tail.** A gate refuses the call before
218
240
  it runs, so none of its links worked — those before the refused one included. A repeated tail does
219
241
  work where it was not expected:
@@ -227,10 +249,7 @@ flowchart TD
227
249
  "What the rules already say".
228
250
  - **The owner's answer is sought in their own messages before the rules.** The law says a question
229
251
  with a written answer is not put to the owner, and the most reachable record lies not in the tree
230
- but in the conversation: the owner's first message and their answers to past rounds. The
231
- conversation guard does not see this: it counts loading a rule and searching it as reading, and a
232
- message leaves no trace. A question that answers itself in the owner's words devalues those asked
233
- next to it.
252
+ but in the conversation: the owner's first message and their answers to past rounds.
234
253
  - **The size of work is never a reason to cut its boundaries.** The owner who named the result did
235
254
  not dispute the size: an offer to drop a part is a request to reassign the goal, served as a
236
255
  clarification. What is costly is done at cost, or called costly outright, with the price named.
@@ -40,7 +40,10 @@ what is named here is read twice — before the work and after it.>
40
40
 
41
41
  The command is written in backticks: the turn exit guard reads it and does not let out a turn in
42
42
  which the stage is declared closed and the command was not run. An acceptance written in prose
43
- cannot be confirmed by anything.
43
+ cannot be confirmed by anything. The command is run right here, while the plan is written, not at
44
+ the end of the stage: its output is what names the readiness sign. A sign written by a guess is
45
+ sometimes impossible to meet — the line the stage must put out comes from an unconfigured tree
46
+ rather than from the work — and that is found out latest of everything that depended on it.
44
47
 
45
48
  ## What this work does not do
46
49
 
@@ -9,7 +9,7 @@ Rewritten by every session, not appended to.
9
9
  - **Done:** <briefly>
10
10
  - **Next step:** <what is done first in the new session>
11
11
  - **Uncommitted:** <what lies in the tree outside the index>
12
- - **Waiting for the owner:** <what exactly, or "no">
12
+ - **Waiting for the owner:** <what exactly, or "no"; the owner's standing word about a stop is quoted in « »>
13
13
  - **PR:** <number and state, or "not open yet">
14
14
 
15
15
  ## Decisions along the way
@@ -49,6 +49,10 @@ layout is worse than a whole one. Either the override here or the resource itsel
49
49
  and that is the work of the tree where the package lives as sources; nothing is said about it
50
50
  here.
51
51
 
52
+ **A file whose body matches the package is never a refusal.** The header alone diverged from the
53
+ body — the layout puts it again and says the header went stale. The word "edited by hand" stays
54
+ for a file whose body differs, and it sends the reader looking for an edit that is there.
55
+
52
56
  **A layout is an edit of the tree, not a service call:** it rewrites hundreds of tracked files at
53
57
  once, so the work is set up before `sync`, by the same rules as any other.
54
58
 
@@ -58,9 +62,14 @@ push gate: an edition bumped without a layout turns the main branch red and lock
58
62
  **The layout puts the hook declaration together with the hook itself.** A hook is called by an
59
63
  entry in the agent settings, and one laid out without it is indistinguishable from the outside
60
64
  from a working one. The layout appends an entry for every event missing from the settings and
61
- reports it. The edit only adds: entries are neither rewritten nor removed, what the tree removed
62
- does not come back, and settings that cannot be parsed as JSON the package does not touch — it
63
- prints a ready-made piece to enter by hand.
65
+ reports it. The edit only adds: entries are neither rewritten nor removed, and settings that
66
+ cannot be parsed as JSON the package does not touch — it prints a ready-made piece to enter by
67
+ hand.
68
+
69
+ **An entry is written only for the dispatcher that lies on disk.** A tree that did not take it
70
+ used to get settings calling a file that is not there — and such settings look working from the
71
+ outside. The layout holds no list of what the tree removed, so a hand-removed entry comes back on
72
+ the next layout: it is removed together with the dispatcher, not on its own.
64
73
 
65
74
  **This is held by the edit-location guard, not by memory.** It refuses an edit of a file with the
66
75
  layout header at the minute of the edit and names the address: the source, if the tree holds
@@ -77,6 +86,7 @@ the size of what would be wiped. Appending at the end and editing in place pass.
77
86
 
78
87
  ```bash
79
88
  npx agent-kit doctor # what is laid out, what lags, what lies from a dropped resource
89
+ npx agent-kit doctor --since <path> # the same, plus what a new edition added into a replaced section
80
90
  npx agent-kit sync # lay out
81
91
  npx agent-kit sync --check # write nothing, refuse on a divergence
82
92
  npx agent-kit stats # what was used, what never, what people stumbled on
@@ -122,7 +132,10 @@ So the bump takes three steps, and the first goes before the installation.
122
132
  "resource · heading". Each is read in the snapshot and in the new edition: what the package
123
133
  added is added to the override by hand.
124
134
 
125
- Neither `doctor` nor `sync --check` audits this itself: they have no former edition.
135
+ The snapshot is given to the state review as an argument — `agent-kit doctor --since <path to the
136
+ snapshot>` — and it names the articles the new edition added inside a replaced section: the
137
+ resource, the heading and the opening of the article. Without the argument the review is as
138
+ before.
126
139
 
127
140
  For every named section the articles are compared, not the headings: the heading is exactly
128
141
  what matched, that is what replaced the section. A ready-made pair of commands is in the cold
@@ -1 +1 @@
1
- {"version":3,"file":"agent-kit.d.ts","sourceRoot":"","sources":["../../../projects/agent-kit/src/bin/agent-kit.ts"],"names":[],"mappings":";AAeA,OAAO,EAAqC,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AA+W7G,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAU9E"}
1
+ {"version":3,"file":"agent-kit.d.ts","sourceRoot":"","sources":["../../../projects/agent-kit/src/bin/agent-kit.ts"],"names":[],"mappings":";AAeA,OAAO,EAAqC,iBAAiB,EAAqB,MAAM,oBAAoB,CAAC;AAgX7G,wBAAsB,IAAI,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAU9E"}
package/bin/agent-kit.js CHANGED
@@ -18,7 +18,8 @@ import { costLines, costOf, CostUnavailableError } from '../lib/cost.js';
18
18
  import { enroll, httpEnroll } from '../lib/enroll.js';
19
19
  import { httpReadOwn, httpShip } from '../lib/ship.js';
20
20
  import { fate } from '../lib/fate.js';
21
- import { propose, treeSlugOf } from '../lib/shipment.js';
21
+ import { propose } from '../lib/shipment.js';
22
+ import { treeSlugOf } from '../lib/tree-mark.js';
22
23
  import { DEFAULT_DAYS } from '../lib/observations.js';
23
24
  import { staleBuild } from '../lib/freshness.js';
24
25
  import { packageRootFrom } from '../lib/package-root.js';
@@ -317,7 +318,7 @@ const COMMANDS = {
317
318
  propose: runPropose,
318
319
  fate: runFate,
319
320
  enroll: runEnroll,
320
- doctor: (env) => doctor(env),
321
+ doctor: (env, argv) => doctor(env, optionOf(argv, '--since', '')),
321
322
  adopt: (env, argv) => adopt(env, argv.slice(1).filter((value) => !value.startsWith('--') && value !== optionOf(argv, '--root', ''))),
322
323
  };
323
324
  export async function main(argv) {