@rt-tools/agent-kit 0.28.0 → 0.29.1

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 (81) hide show
  1. package/assets/checks/board-epic-link.github.mjs +13 -1
  2. package/assets/checks/board-epic-plan.github.mjs +128 -9
  3. package/assets/checks/board-epics.github.mjs +6 -10
  4. package/assets/checks/board-folders.mjs +50 -0
  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-lib-layers.mjs +4 -2
  8. package/assets/checks/check-spec-coverage.mjs +65 -0
  9. package/assets/checks/check-work-steps.mjs +238 -0
  10. package/assets/checks/epic-table.github.mjs +15 -6
  11. package/assets/checks/lib-common.mjs +9 -4
  12. package/assets/checks/lib-domains.mjs +7 -4
  13. package/assets/checks/main-run.github.mjs +69 -0
  14. package/assets/checks/rt-kit-checks.config.mjs +16 -1
  15. package/assets/checks/task-new.github.mjs +6 -6
  16. package/assets/checks/tree-assignment.mjs +169 -0
  17. package/assets/defaults/project.sh +15 -1
  18. package/assets/hooks/end-conversation-guard.sh +59 -0
  19. package/assets/hooks/epic-over.sh +11 -2
  20. package/assets/hooks/git-guard-delivery-epic.sh +15 -1
  21. package/assets/hooks/git-guard-delivery.sh +4 -2
  22. package/assets/hooks/git-guard-push-tests.sh +31 -8
  23. package/assets/hooks/git-guard-tree-assignment.sh +77 -0
  24. package/assets/hooks/grill-gate.sh +63 -2
  25. package/assets/hooks/hook-input.sh +8 -1
  26. package/assets/hooks/main-run-context.sh +45 -0
  27. package/assets/hooks/prose-style-guard.sh +49 -3
  28. package/assets/hooks/tree-assignment-guard.sh +101 -0
  29. package/assets/hooks/turn-exit-epic.sh +149 -0
  30. package/assets/hooks/turn-exit-guard.sh +40 -24
  31. package/assets/hooks/turn-exit-patterns.sh +50 -8
  32. package/assets/hooks/turn-exit-verdict.sh +39 -8
  33. package/assets/hooks/waiting-turn-guard.sh +56 -1
  34. package/assets/hooks/write-targets.sh +23 -1
  35. package/assets/laws/delivery.md +6 -0
  36. package/assets/laws/work-conduct.md +26 -0
  37. package/assets/patterns/doc-style-human.md +6 -0
  38. package/assets/patterns/git-workflow-merge.md +14 -0
  39. package/assets/patterns/git-workflow-pr-body.github.md +161 -0
  40. package/assets/patterns/git-workflow-pr.github.md +6 -104
  41. package/assets/patterns/git-workflow-stack.md +19 -2
  42. package/assets/patterns/spec-driven-domain.md +4 -0
  43. package/assets/patterns/status-report-table.github.md +6 -0
  44. package/assets/patterns/task-flow-close.md +1 -1
  45. package/assets/patterns/task-flow-resume.md +8 -0
  46. package/assets/patterns/task-flow-start.md +26 -22
  47. package/assets/patterns/testing-e2e.md +14 -0
  48. package/assets/pitfalls/git-workflow.github.md +6 -0
  49. package/assets/pitfalls/turn-conduct.md +46 -0
  50. package/assets/rules/doc-style.md +3 -2
  51. package/assets/rules/git-workflow.github.md +37 -38
  52. package/assets/rules/observability.needs-app.md +5 -0
  53. package/assets/rules/reuse-first.md +33 -11
  54. package/assets/rules/task-flow.md +57 -56
  55. package/assets/rules/testing.md +15 -0
  56. package/assets/rules/turn-conduct.md +70 -73
  57. package/assets/rules/typescript-conventions.md +8 -0
  58. package/assets/samples/tasks/_template/plan.md +7 -1
  59. package/assets/samples/tasks/_template/progress.md +14 -1
  60. package/bin/agent-kit.d.ts.map +1 -1
  61. package/bin/agent-kit.js +2 -1
  62. package/bin/agent-kit.js.map +1 -1
  63. package/lib/cargo.d.ts +49 -1
  64. package/lib/cargo.d.ts.map +1 -1
  65. package/lib/cargo.js +9 -2
  66. package/lib/cargo.js.map +1 -1
  67. package/lib/observations-cargo.d.ts +32 -0
  68. package/lib/observations-cargo.d.ts.map +1 -0
  69. package/lib/observations-cargo.js +105 -0
  70. package/lib/observations-cargo.js.map +1 -0
  71. package/lib/shipment.d.ts +8 -20
  72. package/lib/shipment.d.ts.map +1 -1
  73. package/lib/shipment.js +22 -39
  74. package/lib/shipment.js.map +1 -1
  75. package/lib/tree-mark.d.ts +17 -0
  76. package/lib/tree-mark.d.ts.map +1 -0
  77. package/lib/tree-mark.js +41 -0
  78. package/lib/tree-mark.js.map +1 -0
  79. package/package.json +1 -1
  80. package/rt-tools-agent-kit-0.29.1.tgz +0 -0
  81. package/rt-tools-agent-kit-0.28.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` |
@@ -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}
@@ -123,8 +122,8 @@ flowchart TD
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
124
  declared state. The agreement has a guard of its own on the same events.
126
- - **The guard judges the declared transition, not the presence of files.** An empty plan lies the
127
- same as a written one, so the refusal is lifted by the declared state — `этап-идёт`,
125
+ - **The guard judges the declared transition, not the presence of files.** The refusal is lifted
126
+ by the declared state — `этап-идёт`,
128
127
  `этапы-кончились`, `разбор-кончился`. The fourth road is the branch history: a folder taken apart
129
128
  means handed-in work.
130
129
  - **A state line moved forward is the same declaration of intent, only machine-readable.** It is
@@ -147,13 +146,15 @@ flowchart TD
147
146
  - **A reply to the owner's order begins with the result, not with intent or its justification.** A
148
147
  justification under someone else's accepted decision reads as its appraisal. One exception:
149
148
  execution stopped by an obstacle — then the obstacle is named.
150
- - **A session does not start work by itself.** A start needs the owner's word in the same session:
151
- the handover, the state from the startup hook and an assigned epic say what to do, not whether to
152
- work. The form of the message is judged: an empty message, one word or one path order no work.
153
- - **A refusal by an external limiter removes the way, not the task.** It is not the tree's guard and
154
- names no exit: read as the end of the road, it stops the work whole. The way is taken from the
155
- guard that already described this fix — a bypass with the reason in the commit body, a mark in the
156
- observations, a word to the owner — and the task stays the same.
149
+ - **The last run of the main branch is read first thing in a session and after every known
150
+ merge.** A red main branch after a merge lives until the owner notices. The start hook prints it; after a merge the command is called by hand, and a red
151
+ or pushed-out run is fixed before new work is taken.
152
+ - **A session does not start work by itself.** The handover, the state from the startup hook and an
153
+ assigned epic say what to do, not whether to work: a start needs the owner's word in the same
154
+ session. An empty message, one word or one path order no work.
155
+ - **A refusal by an external limiter removes the way, not the task.** It names no exit: the way is
156
+ taken from the guard that already described this fix — a bypass with the reason in the commit
157
+ body, a word to the owner — and the task stays the same.
157
158
  - **An instruction to work by the progress covers all its steps, including those that change
158
159
  history.** Questions are asked about what the progress lacks.
159
160
  - **A question written by a past session does not become a question to the owner.** It is addressed
@@ -164,26 +165,24 @@ flowchart TD
164
165
  - **An answer in the owner's message counts the same as an answer in a document.** A question
165
166
  already answered in the conversation is not asked again.
166
167
  - **The owner's word about the design is a task setting, not a decision.** What they named is
167
- usually already in the tree under that word — a name on a screen, a spec section, a model field —
168
- and is checked against them before the edit. Diverged — the owner is asked.
168
+ usually in the tree under that word — a name on a screen, a spec section, a model field — and is
169
+ checked against it before the edit. Diverged — the owner is asked.
169
170
  - **A task folder is created for any work, no exceptions.** An exception with even one lawful form
170
171
  is executed as permission. It goes in before the first edit.
171
172
  - **The task folder goes into the branch by a commit, not lives in one working tree.** Uncommitted,
172
- it passes edits without refusal, and the refusal comes at the end, when the plan is already gone.
173
- Outside history one draft without a number is lawful.
173
+ it passes edits without refusal until the plan is already gone. Outside history one draft without
174
+ a number is lawful.
174
175
  - **The task folder is taken apart by the last commit before the PR opens, not after approval.** A
175
176
  person merges as soon as they see green, and no room is left for a closing commit.
176
177
  - **After opening the PR, the executor tells the owner the number, what it waits for and what comes
177
- next.** A draft waits for the run, and next it is lifted: a green run says nothing is broken and
178
- nothing about the locked merge button. A PR opened ready waits for the owner's hand, and that is
179
- said in the same words.
178
+ next.** A draft waits for the run and is lifted after it; a PR opened ready waits for the owner's
179
+ hand, and that is said in the same words.
180
180
  - **A request to merge never comes before the work is checked.** Where the pipeline wakes for this
181
181
  base: folder taken apart and pushed → PR as a draft → run green → draft lifted → the request to
182
182
  merge, naming the number. Where it does not wake, the green push gate is the check, and opening
183
183
  the PR and asking to merge are one turn.
184
- - **A PR that waits for a run opens as a draft, and one that waits for nothing opens ready.** Before
185
- it opens the owner sees no edits, and an open PR reads as an invitation to merge. Which of the two
186
- applies is decided by the bases the pipeline wakes for, and that is read from its file.
184
+ - **A PR that waits for a run opens as a draft, and one that waits for nothing opens ready.** An
185
+ open PR reads as an invitation to merge. Which of the two applies is decided by the bases the pipeline wakes for, and that is read from its file.
187
186
  - **The plan guard is the lower bound of the requirement, not its limit.** It demands a folder only
188
187
  for an edit of application code; the article above — for any work.
189
188
  - **An instruction to work by a rule is an instruction to do its steps, including those that change
@@ -191,42 +190,49 @@ flowchart TD
191
190
  - **A taken task does not end a turn.** Creating the task, the branch, the column and the folder is
192
191
  preparation: the work moves to the written-plan state, where the action is different. The
193
192
  turn-exit guard names the first stage in its refusal.
194
- - **The stages of a plan cover its done-sign whole.** A sign written wider than the sum of the
195
- stages means a part of the order is given to no step at all: every stage closes, the run is
193
+ - **The stages of a plan cover its done-sign whole.** Otherwise every stage closes, the run is
196
194
  green, and half the order is not done. Either the stages are written up to the sign, or the sign
197
195
  is narrowed to what the stages give.
198
196
  - **A stage's readiness sign is taken from the output of a command run while the plan is written.**
199
197
  Written by a guess, it is checked at the stage itself — latest of everything that depended on it.
200
- Some lines come not from the work but from an unconfigured tree, and no stage puts them out.
201
198
  - **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 the sample is built; what of it is needed here is said by a
203
- count over one's own files.
199
+ code.** Reading the sample says how it is built; what is needed here is said by a count over
200
+ one's own files.
204
201
  - **Waiting for one part of a stage is never a stop of the stage.** The parts independent of what is
205
202
  awaited are done in the same turn; the owner is told what is done and what is left for their step.
206
- A refused command reads the same: everything else is done first.
207
203
  - **A finding made mid-stage is checked against the plan's exit conditions before the first edit.**
208
- Nearness of subject proves no belonging. A finding named by no exit condition goes to the section
209
- on what the work does not do, and is filed as a task.
204
+ A finding named by no exit condition goes to the section on what the work does not do, and is
205
+ filed as a task.
210
206
  - **Done work is marked only in the progress.** "Where we stand" is rewritten by every session, not
211
207
  appended: it is the first thing the next session reads.
212
- - **A word for a new notion is looked up in the tree's glossary.** The package carries the common
213
- part, the tree appends the subject part by an override; the glossary goes into the context whole
208
+ - **The plan names the steps of every stage, and the progress mirrors them with a mark each.** The
209
+ plan is not edited after it is written, the marks change every turn; a line nobody can call done
210
+ is not a step.
211
+ - **The numbers and the names of the steps are copied from the plan, not reworded.** A check matches
212
+ the two lists: a reworded name reads as a different step.
213
+ - **Exactly one step carries the mark of going on right now, while any step is not done.** Marked on
214
+ none, the progress says the work stands; marked on two, it says nothing at all.
215
+ - **A word for a new notion is looked up in the tree's glossary.** It goes into the context whole
214
216
  at session start, so "did not read it" is never a ground.
215
217
  - **The task folder is created as a draft and gets its number by a command.** Until the grill ends,
216
- how many tasks come out is unknown, so the number never comes first. The command renames the
217
- draft, fills the plan header and strips the layout header from the copies.
218
+ how many tasks come out is unknown, so the number never comes first.
218
219
  - **An abandoned grill is visible.** A draft older than a week is listed by the work queue audit.
219
220
  - **Work ordered in words becomes a task in the queue in the same turn.** Even if it will not be
220
- done now. A draft folder is not the queue: it has no number, and one session knows of it.
221
- Postponed work names a date; postponed silently, it reads as done.
222
- - **Work begins with the epic, and a task outside one is not taken.** The epic names what the whole
223
- is, and the main branch takes that whole or does not take it. Work outside an epic exists only by
221
+ done now: a draft folder has no number, and one session knows of it. Postponed work names a
222
+ date; postponed silently, it reads as done.
223
+ - **Work begins with the epic, and a task outside one is not taken.** The main branch takes the
224
+ whole or does not take it. Work outside an epic exists only by
224
225
  the owner's word about that work, said about that work.
225
226
  - **The epic branch is taken before the first task of the epic, not with it.** Taken later, it
226
- leaves the first task standing on the main branch, and the epic starts as half of itself already
227
- merged.
227
+ leaves the first task standing on the main branch.
228
+ - **The epic card moves to in progress by the same turn that takes its first task.** The owner
229
+ follows the epic by one card: left where it was declared, the card reads as never started.
230
+ Nothing checks this yet: the rule `git-workflow` holds the move command and names the gap.
228
231
  - **The next task is taken from the epic plan, and the queue list is asked only where there is no
229
232
  epic.** By a list of numbers someone else's epic cannot be told from one's own.
233
+ - **Which epic this working copy leads is read from the table of assignments, and the owner writes
234
+ it.** A card of the queue is not an order; a guard refuses every call that takes work until
235
+ their word.
230
236
  - **An epic is not closed by a sign confirmed by reading alone.** What is checkable by eye is
231
237
  called checked only with a command and its output.
232
238
  - **The tasks of an epic are created all at once, by the same turn as the epic itself.** Creating
@@ -239,32 +245,27 @@ flowchart TD
239
245
  arrangements: each branch from the epic branch, or a stack — each from the previous. The
240
246
  arrangement written in the plan is the epic's decision, not that of whoever creates the branch.
241
247
  - **The PR of the epic opens when its last folder is taken apart, and not a task earlier.** A folder
242
- left in the epic branch reaches the main branch with it: what one branch needed becomes the tree's
243
- for good. Until then the epic branch is not offered to a person at all — the merge button on it
244
- means the whole epic.
248
+ left in the epic branch reaches the main branch with it. Until then the epic branch is not
249
+ offered to a person at all — the merge button on it means the whole epic.
245
250
  - **The epic plan lies where it is found without the network and after the merge.** The card does
246
- not hold the task order, and the task folder would hold it only until the first merge; the
247
- directory — in the rule's companion. What the owner names along the way is appended there by the
248
- turn that accepted it.
249
- - **Building by a sample begins with reading the sample itself.** The repeated part is opened whole,
250
- by walking the directories.
251
+ not hold the task order, and the task folder dies with the merge; the directory — in the rule's
252
+ companion. What the owner names along the way is appended there by the turn that accepted it.
253
+ - **Building by a sample begins with reading the sample itself, whole, by walking the directories.**
251
254
  - **What acts on the tree, not on the edit, lies outside the index.** The path to the sample and the
252
255
  permission to work outside the epic do not belong to the branch and live next to the handover. A
253
256
  number in the permitted list repeats the owner's word, not replaces it.
254
257
  - **Closed work is reviewed by the rules as a closing step, not as a separate request.** What was
255
258
  loaded and what was missing is seen only by the session that led the work.
256
259
  - **The review of closed work goes to the background, and the executor takes the next task.** The
257
- role works in a turn of its own; the digest is gathered before the launch, the findings are
258
- accepted in one turn.
260
+ digest is gathered before the launch, the findings are accepted in one turn.
259
261
  - **The review's findings wait for the owner, and only the digest of observations leaves for the
260
262
  package.** A proposal sent unreviewed becomes the work of someone who did not order it. The digest
261
263
  is always sent: it says what was used and is never an opinion.
262
- - **The cheap closing step goes before the costly one, and the run — after the merge.** Merging the
263
- agreement and bringing the texts up to date cost minutes, the run costs the session window; a run
264
+ - **The cheap closing step goes before the costly one, and the run — after the merge.** A run
264
265
  before the merge checks what will not reach main.
265
266
  - **The agreement merges into the domain spec by one of the last commits of the branch, before the
266
- PR opens.** By then the code is written, the bindings are known, and the `proposed/` directory
267
- never appears in main. What is ready to merge is listed by `npm run check:specs`.
267
+ PR opens.** By then the bindings are known, and `proposed/` never appears in main. What is ready
268
+ to merge is listed by `npm run check:specs`.
268
269
  - **The folder of a closed task is taken apart, not moved whole.** What explains a decision goes to
269
270
  `docs/archive/`; the rest is deleted. One not taken apart is caught by the work queue audit.
270
271
  - **Opening the PR and lifting the draft are refused while the branch carries its task folder.** A
@@ -156,6 +156,11 @@ flowchart TD
156
156
  silently allows what the tree does not have, and the next reader takes it for a current
157
157
  explanation. Not every list has a dead-entry check, so it is removed by the same change that
158
158
  removes the place that caused it.
159
+ - **A new check's list is written together with the check for a dead entry in it.** The article
160
+ above leaves the removal to whoever removes the place, and it is kept by memory: an entry whose
161
+ place is gone silently allows what the tree no longer has. A check that reads its own list also
162
+ compares it with what it found and refuses on an entry nothing answers to — then a dead line
163
+ costs the same as a new violation and does not wait for a reader.
159
164
  - **Red has an assigned action, and a second rerun is not part of it.** Red comes in two kinds,
160
165
  and in the list of runs they look the same: a hosting refusal on the preparation step is cured
161
166
  by a rerun, a defect of the branch is not cured by it at all. The assigned action is one: first
@@ -176,11 +181,21 @@ flowchart TD
176
181
  them drifts from the original silently, and both sides stay green: one writes under its value,
177
182
  the other looks under its own. This is checked by a scenario that computes the value both ways
178
183
  and compares them, not by one scenario on each side.
184
+ - **A field of an answer the whole application shares is checked at the place of assembly, not
185
+ beside one operation.** A test next to an operation sees what that operation returned, while the
186
+ answer is built elsewhere: every such test stays green when the field reaches no answer at all.
187
+ The check goes where the body is assembled, or walks the whole set of operations at once.
179
188
  - **A test asserting absence is green even when it looks for the wrong thing.** There is no match
180
189
  for the right text, nor for a typo in the sample, nor for a renamed key — nothing tells them
181
190
  apart by the run's colour. So a negative assertion goes paired with a positive one: first it is
182
191
  checked that the place sought is found at all, and only then that it lacks what must not be
183
192
  there.
193
+ - **A test about a value's absence is built on a value that cannot exist, not on one that is
194
+ merely not filled in yet.** A test that took a real dictionary key as "the untranslated one" is
195
+ green only while nobody translates it: filling the dictionary turns the fallback assertion red,
196
+ and the red points at the fill, not at the test. The value for such a test is made up on the
197
+ spot and by shape cannot enter the set. It is cast into the key type at the call site: a full
198
+ record stays full, and the case keeps its meaning after any fill.
184
199
  - **A count taken over a run's output says nothing until the run is known to have reached the step
185
200
  counted.** A build, an install and a suite refuse at preparation steps of their own —
186
201
  configuration parsing, dependency resolution, path resolution — and such a refusal carries the
@@ -30,21 +30,18 @@ demand, not with the rule.
30
30
  A turn ends in four ways and no others: a question to the owner the rules do not answer **and no
31
31
  task in the work queue that can be taken without waiting for the answer**; a guard's refusal; a
32
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.
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.
34
35
 
35
- The queue is asked by a command in the same turn, and its output stands in the turn itself: "there
36
- are no tasks" is a statement about the tree, and the executor's memory does not confirm it. A turn
37
- where the owner's answer holds one piece of work while an independent one lies next to it ends
38
- with the work taken, and the question goes in a line beside it. The price is measured not in turns
39
- but in days: a session stood a night and a morning naming the owner one and the same step while
40
- three independent tasks lay untaken.
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.
41
40
 
42
41
  Everything else is the turn going on, not its end. A milestone does not end a turn: not a commit,
43
42
  not a read agreement, not the boundary "read — now editing", not a green check.
44
- A transition from state to state — least of all: the mandatory action is done, and the next is
45
- done in the same turn; a state boundary looks like a finished piece better than any milestone, and
46
- the report lands exactly
47
- 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.
48
45
 
49
46
  Four ways to end a turn look like work and are not: a summary of someone else's step, a menu under
50
47
  an assigned order, a declaration of intent, and a command named but not run.
@@ -96,27 +93,24 @@ flowchart TD
96
93
  line about the price in the reply, not waiting; a decision the tree does not hold is asked as a
97
94
  question by the tool.
98
95
  - **A summary of someone else's step.** A run, the owner's review and a merge go on without the
99
- executor and are not sped up by watching. Such a summary the owner reads as work: full, with
100
- numbers and states, the emptiness behind it unseen. Someone else's step is named with one's own
101
- begun step, not instead of it.
96
+ executor and are not sped up by watching; the owner reads such a summary as work. Someone else's
97
+ step is named with one's own begun step, not instead of it.
102
98
  - **Someone else's step is of two kinds, and the second never ends by itself.** A run and a review
103
99
  end without the executor; a refused permission never ends — it is waited for. Work that hit a
104
100
  permission is finished without the part it opens; what was not passed is named in the PR body,
105
101
  where the reviewer reads it: a message lives until the next one, the PR body until the merge.
106
102
  - **One's own unclosed step is not handed to the owner.** A neat list of leftovers reads as an
107
- account of work, and the owner sorts out what the executor could have finished. A question's form
108
- does not fix this: a question is lawful only where neither the rules nor the tree answer it. The
109
- list is written after everything the executor could close is struck out.
103
+ account of work, and the owner sorts out what the executor could have finished. A question is
104
+ lawful only where neither the rules nor the tree answer it; the list is written after all the
105
+ executor could close is struck out.
110
106
  - **A menu under an assigned order.** A choice offered to the owner before the epic is over asks to
111
107
  assign the order anew. No work left in the epic — say so: the epic is over — not "what next".
112
108
  - **A declaration of intent.** "Taking the next task" is not taking it: the phrase lives to the end
113
109
  of the turn, and the work does not move. Only the done is named: the created task's number, the
114
110
  branch's name, the moved column.
115
111
  - **Work named as a command is run in the turn that names it.** The line "running it now" does not
116
- end a turn: either the run happened, or the turn is not over. A named command looks like begun
117
- work better than any promise — exact, visible, and done cannot be told from composed. The reply is
118
- written after the call, not instead of it: a message mid-turn is answered along with the begun
119
- action.
112
+ end a turn: either the run happened, or the turn is not over. The reply is written after the
113
+ call, not instead of it: a message mid-turn is answered along with the begun action.
120
114
  - **A word about one's own work is judged by what the same turn did.** "Not stopping — going on" is
121
115
  confirmed by the turn's end with work, not intent: otherwise the owner reads "promised — did not"
122
116
  as a lie. It is the requirement on a word about the tree, turned on oneself.
@@ -139,57 +133,66 @@ flowchart TD
139
133
  - **A stop is named in a message of its own.** Not in a line at the end of a report: there it drowns
140
134
  — the owner reads a report as an account of the done. Three things are named: what stands, what it
141
135
  waits for and what the owner can decide.
142
- - **Turn exits are watched by a guard, not by the executor's memory.** It reads the declared work
143
- state and what the turn did on it: a file edit or a tree-changing command. A turn with neither
144
- returns to the executor with the next step from the progress. Handed-in and merged work the guard
145
- does not judge: it has already waited out someone else's step.
136
+ - **Turn exits are watched by a guard, not by the executor's memory.** It reads the declared work state and what
137
+ the turn did on it: a file edit or a tree-changing command. A turn with neither returns to the
138
+ executor with the next step from the progress.
146
139
  - **A removed task folder lifts the state requirement and does not end the turn.** The progress
147
- leaves with the folder, taken apart before the PR opens: from then to the merge there is no state
148
- line. A turn is not released by this sign — a removed folder means the middle of handing in, not
149
- its end. From there the turn is judged by the second sign; a turn that opened the PR passes it by
150
- itself.
140
+ leaves with the folder, taken apart before the PR opens; a removed folder means the middle of
141
+ handing in, not its end. From there the turn is judged by the second sign.
151
142
  - **Work without a branch and without a task folder is judged by the same guard by the second
152
143
  sign.** It has no state, and the first sign has nowhere to come from — but a turn with no edit of
153
144
  the tree does not end here either.
154
145
  - **A taken task is not yet begun work, and the turn does not end on it.** Creating the branch,
155
146
  moving the column and naming the number are preparation: the mandatory action of `задача-взята` is
156
- not done by a single line, yet the turn holds much work, and the sign "was there work" releases
157
- it. The guard has a tier for this; a branch without a task number is not under it, an assembled
158
- folder template lifts it.
147
+ not done by a single line. An epic branch, named by the header of its plan, carries no folder by
148
+ the rule and is not judged so.
159
149
  - **Exploration does not end a turn, however much of it there is.** Switching branch, pulling,
160
- browsing history and reading PRs are preparation, not work; a turn of these alone leaves the work
161
- where it stood. It looks like work better than anything else: commands, exact numbers, checkable
162
- answers. Parts of a compound command are judged one by one: a read joined to an edit remains work.
150
+ browsing history and reading PRs are preparation, not work. Parts of a compound command are
151
+ judged one by one: a read joined to an edit remains work.
163
152
  - **A reply to the owner is not an action and does not stand last in a turn.** The order inside a
164
- turn is one: work, the first step of the next, then text. The reverse — work, report, end — stands
165
- behind every analysed stop: a report is a form of completeness, and an appended summary reads as
166
- the turn's end the more convincingly the more was done. Saying what was done is always allowed;
167
- its place is after the next action, not instead.
153
+ turn is one: work, the first step of the next, then text; what was done is said after the next
154
+ action, not instead of it.
168
155
  - **The last action of a turn is only ever work.** One sign for every kind of stop: a file edit or a
169
156
  changing command — last among what the turn did. The guard's tiers — exploration, waiting, handing
170
157
  in without starting the next — only derive a readable refusal from it.
171
158
  - **Waiting for someone else's step is never the last action of a turn.** While they are waited for,
172
- the work stays where it stood. The last action is judged: waiting mid-turn is lawful, background
173
- work remains work, and a turn ended by a loop until the run is ready, or by watching it, is not
174
- released.
159
+ the work stays where it stood. The last action is judged: waiting mid-turn is lawful, and so is a
160
+ launch in the background mid-turn. Standing last, it is an announcement of intent: what does not depend on it is done while it runs.
175
161
  - **The handover is written even where the branch has no name.** All of it lies in the tree and is
176
162
  reachable on a detached head; one file needs a name, and a short snapshot of the head gives it.
177
- The hook's silence costs more here than elsewhere: compaction comes without a handover, and the
178
- next session starts from a blank.
163
+ Otherwise compaction comes without a handover, and the next session starts from a blank.
164
+ - **A next step written into the progress is begun by the same turn.** The guard reads the order
165
+ of actions: after the last edit of the progress it wants work other than the commit and the push
166
+ of it. A full report and a moved stage number do not replace the step.
179
167
  - **A plan stage is declared closed only after its check command has passed.** The "Checked by"
180
168
  (`Чем проверяется`) line carries the command in backticks and what in its output means "matches".
181
169
  The guard reads the previous stage number from the branch history and holds a turn where the
182
170
  number grew and the command did not run: a session later, marked from memory cannot be told from
183
171
  checked.
184
172
  - **The end of an epic is a stop, and it is the one lawful waiting for a word.** Every task of the
185
- epic is merged or handed over, so there is no next task to take: a guard refuses taking one, and
186
- the two guards that judge the end of a turn let the stop through by the same reading. The turn
187
- shows the table of the epic's tasks, says what was done on each and what confirms it, and says
188
- outright that the session waits for orders.
173
+ epic is merged or handed over, so there is no next task to take, and both guards of the turn end
174
+ let the stop through. The turn shows
175
+ the table of the epic's tasks, what was done on each and what confirms it, and says that the
176
+ session waits for orders. On the main branch the epic is not read, and the turn is judged as before.
189
177
  <!-- rt-when: ответ владельцу о состоянии работы -->
190
178
 
179
+ - **A step of the plan that is not done forbids a stop, and a report about the done is not an
180
+ exception.** The tier about the epic judges the whole and says nothing about a turn inside one
181
+ task. The count is read from the progress; lawful exits stay as they were.
191
182
  - **The word about a stop the guard reads from the owner, not from the executor.** Otherwise the
192
183
  stop is declared by whoever finds it convenient, and the ban holds until the first inconvenience.
184
+ - **Until the epic is closed a turn ends only by one of the four exits.** A turn that ended with
185
+ work is a stop all the same, and so is a second pass over the same turn: the exit guard judges
186
+ both by the epic and returns the turn with the next step named. The end of the epic is the fifth.
187
+ - **The owner's standing word about a stop is quoted in the progress, in « », in the line «Waiting
188
+ for the owner».** The guard reads their word, not a retelling: a line without a quote releases
189
+ nothing, and a quote holds until the owner cancels it. A word said in this turn releases by itself.
190
+ - **The session is ended by the owner and by nobody else.** The tool that closes the conversation is
191
+ refused by a guard always, with no lawful form of bypass: an assignment stands until the owner
192
+ cancels it, and a session that must close is closed by them.
193
+ - **A refusal of a guard ends the turn only as its last action, and only a refusal of work.** A
194
+ refusal answered by the next call is the middle of the turn. A refused stop — the closing tool —
195
+ is no exit: the refused call was itself the stop, and the exit guard leaves it out.
193
196
  - **The phrase "waiting for your word" is a stop declared by the executor, and the guard refuses it
194
197
  by name.** Without the owner's word about a stop in the turn and without a question put to them by
195
198
  the tool, waiting for their word is a report, not work; the instruction holds until they cancel
@@ -197,15 +200,13 @@ flowchart TD
197
200
  - **A statement about the tree's state is watched by the statement guard, not by the executor's
198
201
  memory.** Everything the reply says about the tree carries a command and its output; said without
199
202
  one, it is no statement — not "checked", not "cleared", not "done". The guard reads the turn's
200
- text to the owner and looks for a command of the same turn; each word has its own kind of command,
201
- since a general sign "there was a command" would confirm one thing by another. The previous turn
202
- does not count: the tree's state changes, and yesterday's output says nothing of today's.
203
+ text to the owner and looks for a command of the same turn; each word has its own kind of
204
+ command. The previous turn does not count: yesterday's output says nothing of today's.
203
205
  - **The statement guard waits for the reply text rather than judging the record as it found it.**
204
206
  The text lands in the turn record no earlier than the host calls the hook. Not having waited, the
205
207
  guard returns the turn: an empty record means not "nothing to say" but "nothing to read".
206
- - **The guard catches a statement word, not a wrong conclusion.** About a sample judged by one file,
207
- or a path a person will not take, there is nothing to judge by: no word and no command to compare
208
- with. This is the guard's known boundary; the articles below hold it, not the guard.
208
+ - **The guard catches a statement word, not a wrong conclusion.** About a sample judged by one file
209
+ there is nothing to judge by: no word and no command to compare with. This is the guard's known boundary; the articles below hold it, not the guard.
209
210
  - **A turn about someone else's step is watched by the waiting guard, not by the executor's
210
211
  memory.** It refuses a turn's end where someone else's step was spoken of and nothing was done on
211
212
  the next task — no task created, no branch, no folder, no column moved. Someone else's step it
@@ -213,8 +214,8 @@ flowchart TD
213
214
  are not an action: they are said instead of one.
214
215
  - **A turn that handed work in carries it to a lifted draft.** A draft's merge button is locked by
215
216
  the host, and in the PR list ready cannot be told from unfinished. The next task is taken on top
216
- of that, not instead. The waiting guard watches this: a turn that opened a PR does not end until a
217
- command of the same turn asked the state of the handed-in work.
217
+ of that, not instead. The waiting guard demands a command of the same turn about the state of the
218
+ handed-in work.
218
219
  - **The waiting guard's refusal is lifted by both actions at once.** The taken next task carries the
219
220
  open-PR sign away, and the demand to ask the handed-in work's state never sounds after it.
220
221
  - **Work left in the working tree does not end the turn.** A branch ahead of the remote ref with no
@@ -226,14 +227,18 @@ flowchart TD
226
227
  - **The end of a run is learned from the return of a background command, not from a look at the
227
228
  page.** A background wait brings the executor back to the PR by itself; a look at the page is
228
229
  repeated idly or not at all — the work does not move.
230
+ - **A run nobody started by hand is watched the same as a rerun, and the opened PR starts it.** The
231
+ pipeline wakes by itself: the turn holds no starting command, and one read of the state closes
232
+ nothing. Read as going, the run goes under a wait in the same turn — the waiting guard watches
233
+ the pair "the request opened here, its run read as going".
234
+ - **A green run is carried to a lifted draft by the one who handed the work over, a red one is
235
+ fixed in the same branch.** The owner sees a locked button and reads it as work still going. The
236
+ wait runs in the background, next to the next work.
229
237
  - **Waiting for one's own measurement is done with one wait, not a notification on every step.** A
230
238
  notification is for where every event is acted on; where the outcome matters — one wait.
231
239
  - **A guard's refusal ends the turn.** No other road to the refused edit is sought: not a shell
232
240
  command, not a neighbouring tool, not an edit of the guard itself. The edit is done once the
233
- refusal's condition is met, or not at all — then the owner is told the refusal, not a result. A
234
- bypass costs more than a refusal: a guard refuses one file, a bypassed guard lifts the requirement
235
- from the whole tree and says nothing. Not memory alone holds this — the guards also judge the
236
- shell command that writes the file.
241
+ refusal's condition is met, or not at all — then the owner is told the refusal, not a result.
237
242
  - **A command refused by a gate is repeated whole, not by its tail.** A gate refuses the call before
238
243
  it runs, so none of its links worked — those before the refused one included. A repeated tail does
239
244
  work where it was not expected:
@@ -247,10 +252,7 @@ flowchart TD
247
252
  "What the rules already say".
248
253
  - **The owner's answer is sought in their own messages before the rules.** The law says a question
249
254
  with a written answer is not put to the owner, and the most reachable record lies not in the tree
250
- but in the conversation: the owner's first message and their answers to past rounds. The
251
- conversation guard does not see this: it counts loading a rule and searching it as reading, and a
252
- message leaves no trace. A question that answers itself in the owner's words devalues those asked
253
- next to it.
255
+ but in the conversation: the owner's first message and their answers to past rounds.
254
256
  - **The size of work is never a reason to cut its boundaries.** The owner who named the result did
255
257
  not dispute the size: an offer to drop a part is a request to reassign the goal, served as a
256
258
  clarification. What is costly is done at cost, or called costly outright, with the price named.
@@ -261,17 +263,14 @@ flowchart TD
261
263
  list: whoever finds it convenient this minute assigns it, and it drifts.
262
264
  - **A refusal of an irreversible action has a safe part, and it is done.** The demand to ask the
263
265
  owner applies to the action, not the turn: work with a separable harmless part is split, not
264
- postponed whole. A list of options instead of work reads as work — the more neatly drawn up, the
265
- more fully: numbered, with figures, the emptiness of the turn behind it unseen. The owner is told
266
- what is done and what remained for their word.
266
+ postponed whole. The owner is told what is done and what remained for their word.
267
267
  - **The sign of irreversibility is taken from the list, not derived by argument.** The list was
268
268
  drawn up by someone who already weighed reversibility. The argument "it goes outside and cannot be
269
269
  rolled back" always comes, the list only when read, and an argument on top of the list cancels it
270
270
  silently: from outside it looks like caution, not a skipped step. Actions outside the list the
271
271
  executor does not gate.
272
272
  - **A turn in which the executor admitted a miss does not end until the incident record exists.**
273
- The incident guard refuses at the turn's end: by the time of admission the miss has already
274
- happened. The records directory is named by the rule's companion, the file name is the date and
273
+ The incident guard refuses at the turn's end. The records directory is named by the rule's companion, the file name is the date and
275
274
  the miss, the form — the layout template. The admission is caught by a set of samples: a miss
276
275
  admitted in words outside the set the guard lets through.
277
276
  - **A session begun from a handover enters the work by the same rule as any other.** The handover
@@ -283,16 +282,14 @@ flowchart TD
283
282
  with a ready command but does not break the session.
284
283
  - **A filled window ends a turn only where there is no compaction.** Where it is declared, the
285
284
  window is the turn going on: the session compacts and works on, and the stop threshold fires only
286
- when compaction did not come. A turn closed below the threshold loses the rest of the window the
287
- tree paid for, and only the owner catches this.
285
+ when compaction did not come. A turn closed below the threshold loses the rest of the window.
288
286
  - **The session's window fill is watched by a guard, not by the executor's memory.** At the first
289
287
  threshold it reminds to pick a stopping point, at the second it refuses everything but the
290
288
  handover, delivery commands and the task folder — the folder whole: at closing, both the decision
291
289
  along the way and the stage revision are edited. The window size and both thresholds the tree sets
292
290
  itself; a tree that set no size gets no guard.
293
291
  - **The context compaction threshold the tree sets itself, and it stands BELOW the stop threshold.**
294
- Equal thresholds are a race, and the guard wins it: it stands on the call, and compaction comes
295
- between turns. The distance is declared as a number, not derived as a difference; whether the
292
+ Equal thresholds are a race, and the guard wins it. The distance is declared as a number, not derived as a difference; whether the
296
293
  thresholds stand apart the layout audit tells.
297
294
  - **A session closes with a handover, and it lies as a section of the progress.** It is committed
298
295
  and goes into the branch, so the handover survives a move to another machine, and no second record
@@ -76,6 +76,14 @@ flowchart TD
76
76
  have no closed set, and they are declared as a file constant with a telling name.
77
77
  <!-- rt-when: *.ts -->
78
78
 
79
+ - **A set that must be complete is declared as a full record over the key type, not a partial
80
+ one.** A partial declaration makes a missing key lawful, and the shortage shows on the screen
81
+ rather than at the build. The set that must answer for every key of another one is declared by
82
+ that key type whole, and an unfilled key stops compiling. The type is silent about the value —
83
+ an empty string and a copy of the key pass it — so the completeness of values is held by a test
84
+ that walks the whole set, written by the same change as the declaration.
85
+ <!-- rt-when: *.ts -->
86
+
79
87
  - **A type is taken from the package where it is declared.** An own copy of a foreign type
80
88
  diverges from the original silently, and only one of them compiles.
81
89
  <!-- rt-when: *.ts -->
@@ -34,10 +34,16 @@ what is named here is read twice — before the work and after it.>
34
34
 
35
35
  ### 1. <name>
36
36
 
37
- - **What is done:** <in one phrase>
37
+ - **Steps:**
38
+ 1. <what is done first>
39
+ 2. <what is done after it>
38
40
  - **Readiness sign:** <what must become true>
39
41
  - **Verified by:** `<command>` — <what in its output means "it matched">
40
42
 
43
+ The steps are the smallest unit of the work, and they are written here in full: the progress
44
+ mirrors this list with its marks, and a check matches the two by number and by name. A step is
45
+ named by what is done, not by what is thought over — a line nobody can call done is not a step.
46
+
41
47
  The command is written in backticks: the turn exit guard reads it and does not let out a turn in
42
48
  which the stage is declared closed and the command was not run. An acceptance written in prose
43
49
  cannot be confirmed by anything. The command is run right here, while the plan is written, not at
@@ -9,9 +9,22 @@ 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
+ ## Steps
16
+
17
+ The steps of the plan, all of them, with a mark each. Rewritten by every turn that moves the work.
18
+
19
+ - `[x]` done · `[>]` going on right now · `[ ]` not begun
20
+
21
+ Exactly one step carries `[>]`. The numbers and the names are copied from the plan and not
22
+ reworded: a check matches the two lists, and the turn exit guard counts what is not done yet.
23
+
24
+ - [x] 1.1 <name of the first step of the first stage>
25
+ - [>] 1.2 <name of the second step of the first stage>
26
+ - [ ] 2.1 <name of the first step of the second stage>
27
+
15
28
  ## Decisions along the way
16
29
 
17
30
  - **<decision>** — <reason>. Affected stage of the plan: <number>.
@@ -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';