@sjawhar/claude-envoy 4.11.0 → 4.11.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 (66) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/AGENTS.md +43 -497
  4. package/dist/envoy-channel.js +1 -1
  5. package/legion/skills/legion-architect/SKILL.md +88 -66
  6. package/legion/skills/legion-architect/references/acceptance.md +89 -258
  7. package/legion/skills/legion-architect/references/decomposition.md +94 -213
  8. package/legion/skills/legion-architect/references/design-gate.md +88 -353
  9. package/legion/skills/legion-architect/references/wake-routing.md +51 -43
  10. package/legion/skills/legion-controller/SKILL.md +50 -181
  11. package/legion/skills/legion-controller/references/admission.md +25 -54
  12. package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
  13. package/legion/skills/legion-controller/references/consolidation.md +9 -93
  14. package/legion/skills/legion-controller/references/daily-report.md +21 -99
  15. package/legion/skills/legion-controller/references/escalation.md +16 -118
  16. package/legion/skills/legion-controller/references/finding-asks.md +31 -162
  17. package/legion/skills/legion-controller/references/park-asks.md +33 -0
  18. package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
  19. package/legion/skills/legion-controller/references/session.md +26 -84
  20. package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
  21. package/legion/skills/legion-controller/references/triage.md +18 -89
  22. package/legion/skills/legion-controller/references/wakes.md +22 -549
  23. package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
  24. package/legion/skills/legion-oracle/SKILL.md +19 -28
  25. package/legion/skills/legion-retro/SKILL.md +54 -93
  26. package/legion/skills/legion-retro/references/learnings.md +21 -33
  27. package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
  28. package/legion/skills/legion-worker/SKILL.md +50 -64
  29. package/legion/skills/legion-worker/references/ci-checks.md +16 -84
  30. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
  31. package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
  32. package/legion/skills/legion-worker/references/findings.md +25 -180
  33. package/legion/skills/legion-worker/references/foreign-path.md +14 -22
  34. package/legion/skills/legion-worker/references/gvisor.md +20 -0
  35. package/legion/skills/legion-worker/references/merge-gate.md +43 -419
  36. package/legion/skills/legion-worker/references/plan-tests.md +8 -28
  37. package/legion/skills/legion-worker/references/pr-body.md +19 -218
  38. package/legion/skills/legion-worker/references/review-threads.md +16 -70
  39. package/legion/skills/legion-worker/references/tools.md +31 -578
  40. package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
  41. package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
  42. package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
  43. package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
  44. package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
  45. package/package.json +1 -1
  46. package/skills/agent-secrets/SKILL.md +46 -312
  47. package/skills/agent-secrets/references/store-a-secret.md +9 -0
  48. package/skills/approval-review/SKILL.md +20 -76
  49. package/skills/asd-ste100/SKILL.md +43 -85
  50. package/skills/asd-ste100/examples/before-after.md +18 -53
  51. package/skills/dispatch/SKILL.md +1 -1
  52. package/skills/dispatch-writing-specs/SKILL.md +1 -1
  53. package/skills/envoy/SKILL.md +56 -126
  54. package/skills/envoy/references/check-settlement.md +26 -43
  55. package/skills/envoy/references/deliveries.md +26 -144
  56. package/skills/envoy/references/legion.md +12 -45
  57. package/skills/envoy/references/roles.md +11 -9
  58. package/skills/envoy/references/sources.md +13 -25
  59. package/skills/outside-message/SKILL.md +24 -81
  60. package/skills/plain-words/SKILL.md +24 -55
  61. package/skills/thermonuclear-code-quality/SKILL.md +16 -26
  62. package/skills/thermonuclear-deep-review/SKILL.md +22 -31
  63. package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
  64. package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
  65. package/skills/asd-ste100/references/writing-rules.md +0 -59
  66. package/skills/plain-words/references/mechanics.md +0 -49
@@ -1,111 +1,52 @@
1
1
  # The root spec and the design gate
2
2
 
3
- Part of `skill://legion-architect`, section 1. Read it before you write the root spec, before any
4
- edit to an approved root spec, and on `design-approved` or `design-changes-requested`.
3
+ Read this before you write a root spec, before any edit to an approved one, and on
4
+ `design-approved` or `design-changes-requested`. A child's own architect runs no gate.
5
5
 
6
6
  ## Writing the root spec
7
7
 
8
- Specifications written into Dispatch follow
9
- [`dispatch-writing-specs`](skill://dispatch-writing-specs/SKILL.md#the-outline). Wave releases, child closures and your
10
- own status are visible from the issue tree and the handoffs; do not narrate them into the spec or a
11
- `dispatch message`.
12
-
13
- Extend the primary document in place: a new version adds only the evidence each decision needs and
14
- what the human decides, each as a [decision block](skill://dispatch/SKILL.md#asks-and-ask-blocks).
15
- Never post a second "spec" artifact beside it: `dispatch artifact` with the primary document's name
16
- replaces the human's document. The command refuses an upload under the name of a document the
17
- issue already holds and names `--force`, so that flag is what writes over such a document: pass it
18
- only where you mean to replace the whole text, and edit a document with `dispatch doc-edit`.
19
-
20
- Mark each requirement of the spec as a `requirement` block, and write the issue's Verification
21
- document (`verification.md`) with it, uploading each version after the first with `--force`: one
22
- `check` block per thing that must be proved, each with
23
- `serves` naming the requirements it serves, its `surface`, its `run`, its `when` and its
24
- `negative_control`, or `ci_check` in place of its `run` (below). The human approves both
25
- documents in one request (step 4 below), and every later role reads the checks: the implementer
26
- and the tester record a result against each check with no `ci_check`, and the
27
- reviewer approves only once a pass stands for every `before_merge` check at the head, which is the
28
- check's own answer in `dispatch results --issue <issue>`, and never a pass at another commit, a
29
- pass recorded under an older wording of the check or a retracted one.
30
-
31
- A check proves only the clauses that something drove, so each clause of its `negative_control`
32
- names the test row or the run that drives it. A check of a requirement over every member of a
33
- class iterates that class's list as data, never a sample of it: a sample passes while a member it
34
- left out is broken.
35
-
36
- Where a real recorded input exists for the work (a stored record, a captured log, an answer the
37
- real service gave), the Verification document holds at least one read-only check against it,
38
- because a fixture written for the test proves only what its author expected; where no such check
39
- can be written, a decision block says why. A requirement of the form "try X and see" is an
40
- experiment, and its acceptance is a real run that someone observed.
41
-
42
- On your first pass over the spec, cut each requirement carried over from an earlier issue's spec or
43
- decisions that no source of this issue states: those were decided for that issue. This issue's
44
- sources are the words a person wrote in it, and its `Filed for` line with what that line cites: the
45
- answer, Slack message or direct message of a `Filed for <person> at their request:` line, or the
46
- evidence of a controller's `Filed for Legion from <role> on <issue>:` line
47
- ([The `Filed for` line](skill://legion-controller/references/finding-asks.md#the-filed-for-line)).
8
+ - Write it as `skill://dispatch-writing-specs` says, extending the issue's primary document in
9
+ place with `dispatch doc-edit`. Never post a second spec artifact: `dispatch artifact --force`
10
+ replaces a whole document. Each point the person decides is a decision block.
11
+ - Upload `verification.md` beside it (`--force` from its second version). Each clause of a check's
12
+ `negative_control` names the test row or run that drives it. A requirement over every member of
13
+ a class iterates the class's list, never a sample.
14
+ - Where a real recorded input exists (a stored record, a captured log, a real service's answer),
15
+ hold at least one read-only check against it, or say in a decision block why none can be
16
+ written. A requirement of the form "try X and see" is accepted by an observed real run.
17
+ - Cut each requirement carried over from an earlier issue that no source of this issue states:
18
+ the words a person wrote in it, and what its `Filed for` line cites.
48
19
 
49
20
  ## A check CI proves
50
21
 
51
- A check carrying `ci_check` is CI's: `ci_check` names the GitHub check run that proves the check
52
- at the head, and the check takes no `run`. Its `when` is `before_merge`, and it names its
53
- `negative_control`. No role runs it or records a result for it. `dispatch results` derives its
54
- one result from the named run (`skill://legion-worker/references/ci-checks.md`). Where a CI job
55
- that runs on an ordinary pull request already makes a check's proof, write that check as
56
- `ci_check` rather than as a command. A check that a whole test suite proves names the CI job that
57
- runs that suite as its `ci_check`, and a check's `run` that names tests names specific tests or
58
- files, never a package path, a `./...` pattern or a package's whole `test` script: CI proves a
59
- suite on the pull request and the merge queue on the merged tree, and a suite run in a pod repeats
60
- that work slower. Any other `run` is the procedure a role drives on the check's surface.
61
- Write a `ci_check` check by three rules:
22
+ A check carrying `ci_check` is CI's: `ci_check` names the GitHub check run that proves it at the
23
+ head; it takes no `run`, its `when` is `before_merge`, and no role runs it or records its result
24
+ (`skill://legion-worker/references/ci-checks.md`). Where a CI job that runs on an ordinary pull
25
+ request already makes a check's proof, write that check as `ci_check` rather than as a command. A
26
+ `run` that names tests names specific tests or files; a whole suite is the CI job that runs it.
62
27
 
63
- 1. Name the check run of the job that runs the proof, never a roll-up run that stands for other
64
- jobs. A roll-up run can pass at a head where the job of the check did not run.
65
- 2. Name a job that the repository holds back from an ordinary pull request too, because a `run` in
66
- its place leaves the pod as the only place its proof runs. The worker adds the label that runs
67
- the held-back jobs at the head, and the tester takes the result from that run. Without the
68
- label such a job reads `skipped`, so the label stays on for as long as a check of the issue
69
- names a held-back job, and each later head gets its own run.
70
- 3. Write in `negative_control` the case inside that job that fails when the property breaks. A
71
- job's conclusion is not the property: a step with `continue-on-error` keeps its job green,
72
- and a test deleted from a suite takes its failure with it.
73
-
74
- On cybermonklabs/legion: `ci-ok` passes when the jobs it did not select were skipped
75
- (`.github/scripts/ci-ok.sh`), so never name `ci-ok`. The slow suites and the full browser lane
76
- run only in the merge queue or under `full-ci`, the label of rule 2 (`AGENTS.md`).
28
+ 1. Name the check run of the job that runs the proof, never a roll-up. On cybermonklabs/legion
29
+ never `ci-ok`, which passes when the jobs it did not select were skipped
30
+ (`.github/scripts/ci-ok.sh`).
31
+ 2. A job held back from ordinary pull requests needs its label on the pull request for as long as
32
+ a check names it (`full-ci` on cybermonklabs/legion); without it the job reads `skipped`.
33
+ 3. Write in `negative_control` the case inside that job that fails when the property breaks: a
34
+ step with `continue-on-error` keeps its job green.
77
35
 
78
36
  ## Show the surface before you ask
79
37
 
80
- Where this tree builds or changes a surface a person opens — a page, a screen, a dashboard — that
81
- person sees it and answers before you ask them to approve the spec. A spec for a surface they have not
82
- seen is refused, and the refusal costs a spec version, a closed gate, a second request and their time
83
- twice.
84
-
85
- Whether a change needs the round is your judgement. These readings inform it:
86
-
87
- - A new surface a person opens, and a large visual change to one, need it. The larger the visual
88
- change, the more a page the person can click is worth over a picture: a person judges a layout from
89
- a picture, and judges a flow only by acting on it.
90
- - A small change inside a shape that stands — a label, a copy change, a style fix, a bug fix — does
91
- not, unless you are unsure what the person wants, which is itself a reason to show them.
92
- - A change whose only reader surface is text — an alert message, a report, a command's printed output
93
- — carries that literal text in the spec, at the values it will carry, and needs no round. The person
94
- reads the spec before the build; a pull request body reaches a reviewer after it.
95
- - A change with no surface a person reads needs nothing, and nothing in this section applies to it.
96
-
97
- The round is standard user research run on one reader: show the surface rather than describe it, let
98
- them act on it where the flow is the question, ask what they expected rather than whether they
99
- approve, and show another round on an answer that asks for changes
100
- (https://www.nngroup.com/articles/ux-prototype-hi-lo-fidelity). Before you first ask the person to
101
- approve the spec:
38
+ Where this tree builds or changes a surface a person opens (a page, a screen, a dashboard), that
39
+ person sees it and answers before you request approval: a spec for a surface they have not seen is
40
+ refused. A new surface or a large visual change needs this round, and a flow needs a page they can
41
+ click; a small change inside a standing shape does not, unless you are unsure what they want. A
42
+ surface that is only text (an alert, a report, printed output) carries that literal text in the
43
+ spec instead.
102
44
 
103
- 1. Build the surface as a page, from real readings of the real system. Draw the empty state and the
104
- worst realistic data, or say which states you did not draw. Mark every invented figure in the
105
- picture itself, the way a check names its negative control: a picture whose figures are all
106
- plausible is the hardest one to judge. Where the surface exists already, draw it as it is now
107
- beside the new one: a picture a person cannot place is a round spent for nothing.
108
- 2. Take the picture with the pod's own Chromium, then put each one on the issue:
45
+ 1. Build the surface as a page from real readings of the real system. Draw the empty state and the
46
+ worst realistic data, or say which states you left out. Mark every invented figure in the
47
+ picture, and draw an existing surface as it is now beside the new one.
48
+ 2. Take the picture with the pod's Chromium and put it on the issue, with a clickable page as a
49
+ `file` artifact for a flow:
109
50
 
110
51
  ```bash
111
52
  chromium --headless --disable-gpu --no-sandbox --window-size=1440,900 \
@@ -113,289 +54,83 @@ approve the spec:
113
54
  dispatch artifact --issue <KEY> --name <name>.png --path <file.png>
114
55
  ```
115
56
 
116
- The upload stores it as an `image` artifact and prints its slug.
117
- 3. For a large visual change, or where the question is about a flow rather than a layout, build the
118
- page so the person can click it, put that one file up beside the pictures as a `file` artifact, and
119
- say in your question what works in it and what does not.
120
- 4. Ask one question with two to four answers, one of which says this is the wrong surface. Write no
121
- code on the branch for the round, and end your turn as for any question to a person.
122
- 5. The agreed pictures go in the spec, in line, each with a line of prose under it saying what it
123
- shows and which of its readings are real:
57
+ 3. Ask one question with two to four answers, one of them that this is the wrong surface. Write no
58
+ code for the round, and end your turn.
59
+ 4. Put the agreed pictures in the spec, each with a line on what it shows and which readings are
60
+ real, and one line on the states they do not show. The spec's words still govern the build.
124
61
 
125
- ```md
126
- ![the priorities page with no priority set](dispatch://<KEY>/artifact/<slug>)
127
- The page as a reader opens it. The 529 issues and their ages are read from this deployment; the
128
- two ranks on the right are invented.
129
- ```
130
-
131
- One further line says what the pictures do not show: the states you did not draw. The words of the
132
- spec still govern the build, because a reader on the command line gets the link text and not the
133
- picture.
134
-
135
- You end the round, not the person: when their answer is carried into the pictures or into the spec,
136
- go on to the approval request with the pictures as they then stand. A person who stops answering
137
- holds nothing up.
138
-
139
- The picture is the cheapest thing that answers the question. A labelled sketch is enough where it
140
- answers it. Where the real surface, built read-only, costs no more than the mock-up, build that and
141
- show that.
142
-
143
- The ordering, which this rule needs and does not change:
144
-
145
- - A spec written before the picture is fine. What may not happen is reaching the gate with no picture.
146
- - A tree whose gate is already open starts no round for the work in flight and writes no spec version
147
- for a picture: a new version closes the gate and stops the phase under it ("After approval").
148
- - The round writes no spec version of its own. The agreed pictures go into the version you first
149
- submit for approval.
150
- - A picture that must change after approval follows "After approval": it is a new version only when
151
- what is built changes, and then you request approval again.
152
- - Where the `Design gate steps` sentence of your `Legion addressing` line says `none`, nobody approves
153
- the spec. Make the picture, put it in the spec for whoever builds it, and ask nobody.
154
- - The surfaces this tree's children build are the root architect's. Their pictures go in the root
155
- spec. A sub-architect that finds a surface the root spec never drew tells the architect above
156
- it, and each architect above sends it up the tree to the root architect.
62
+ You end the round, not the person. The round writes no spec version of its own, and a tree whose
63
+ gate is open starts none. Under `Design gate steps: none`, put the picture in the spec and ask
64
+ nobody. The surfaces children build are the root architect's.
157
65
 
158
66
  ## Which steps are gated
159
67
 
160
- The `Design gate steps` sentence of your `Legion addressing` line names the steps this deployment
161
- gates, in the order it gates them, each in backticks: ``Design gate steps: `spec`.``,
162
- ``Design gate steps: `decisions`, `criteria`.``, or `Design gate steps: none.` A sub-architect on
163
- a child issue has no such sentence and never runs the gate.
164
-
165
- Each step is one document of the root issue, and the daemon keeps one gate record for each step:
68
+ The `Design gate steps` sentence of your `Legion addressing` line names the gated steps, or `none`.
69
+ Each step records one document of the root issue:
166
70
 
167
- | Step | The document it records |
71
+ | Step | Document |
168
72
  | --- | --- |
169
- | `decisions` | the issue's decisions document (`decisions.md`) |
170
- | `criteria` | its Verification document (`verification.md`) |
171
- | `spec` | its primary document |
73
+ | `decisions` | the decisions document (`decisions.md`) |
74
+ | `criteria` | the Verification document (`verification.md`) |
75
+ | `spec` | the primary document |
172
76
 
173
- The tree's work starts when every step the sentence names is open, so run the armed sequence below
174
- once for each of them, each on that step's own document. Under `Design gate steps: none.` write
175
- the spec and register it with `register_gate` at its current version, with no `step` and no
176
- approval step: do not request approval and do not wait for `design-approved`; the gate opens at
177
- registration. File every child of your decomposition before that registration, since the gate's
178
- opening starts the root's own first phase unless the root waits on another issue, an open child
179
- under it or a `blocked_by` link to an issue that is not `done`.
77
+ Under `none`, `register_gate` the spec at its current version with no `step`, and request nothing.
180
78
 
181
79
  ## The armed gate
182
80
 
183
- Run this exact sequence for each gated step, before the tree's work starts, with every child of
184
- your decomposition filed before step 4, since the gate's opening starts the root's own first
185
- phase unless the root waits on another issue, an open child under it or a `blocked_by` link to an
186
- issue that is not `done`. One approval request covers the `criteria`
187
- and the `spec` step together (step 4), and each of them is registered on its own document
188
- (step 5); the `decisions` step is a request of its own.
81
+ For each gated step, once every child is filed:
189
82
 
190
- 1. Extend the primary document in place:
83
+ 1. Edit the document in place: `dispatch doc-edit --issue <root> --ops-json-file -`.
84
+ 2. Settle every decision block (`skill://dispatch-writing-specs`, "Approval").
85
+ 3. Give the current spec, the code and output it relies on, and the person's words to two fresh
86
+ reviewers: `task(agent="plan-gap-analyst")` for its gaps, and `task(agent="plan-reviewer")`,
87
+ told it is a spec, for each factual claim. `wait` for each, resolve every finding, and check
88
+ each unverified claim with a command or take it out.
89
+ 4. Request approval only once the person has agreed to every point; a new point gets its own
90
+ decision block first. `--include-verification` covers `spec` and `criteria` in one request;
91
+ `decisions` takes its own (`--artifact decisions.md`):
191
92
 
192
93
  ```bash
193
- dispatch doc-edit --issue <root issue> --ops-json-file - <<'EOF'
194
- ...
195
- EOF
94
+ dispatch request-approval --issue <root> --include-verification --summary '<what they approve> Reviews: <gap result>, <claim result>; <what they do not show>.'
196
95
  ```
197
96
 
198
- 2. Settle every decision block as
199
- [Approval](skill://dispatch-writing-specs/SKILL.md#approval) says;
200
- `dispatch request-approval` refuses while one is open. Each answer reaches you, since you follow
201
- every ask you open.
202
- 3. Before every approval request, give two fresh reviewers the current root spec, the code and
203
- command output it relies on, and the human's words: `task(agent="plan-gap-analyst")` finds its
204
- gaps, and `task(agent="plan-reviewer")`, told the document is a spec, checks each factual claim
205
- against the code, the docs or a read-only command it runs. Each runs as a job of its own, so
206
- `wait` for its result and read what it found before you act on it. Resolve every finding in the
207
- root spec. Check with a command each claim either reviewer marks unverified: fix it when it is
208
- false, or take it out.
209
- 4. Request approval only once the human has agreed to every point in the spec, because the human
210
- approves what they already agreed to and a point new in the request has no decision block for
211
- them to answer: give such a point its own decision block first, or take it out of the spec.
212
-
213
- ```bash
214
- dispatch request-approval --issue <root issue> --include-verification --summary '<what the human is approving> Reviews: <gap result>, <claim result>; <what they do not show>.'
215
- ```
216
-
217
- `--include-verification` asks for the spec and the Verification document in one request, each
218
- at its own current settled version, and the human's answer records a review on each: that one
219
- request covers the `criteria` and the `spec` step together. An issue with no `verification.md`
220
- is refused `NO_VERIFICATION_DOCUMENT`, and one whose Verification document has no settled
221
- version `NO_VERSION`.
222
-
223
- The `decisions` step is a request of its own, since `--include-verification` is for the issue's
224
- spec alone and any other document is refused `NOT_SPEC_DOCUMENT`:
225
-
226
- ```bash
227
- dispatch request-approval --issue <root issue> --artifact decisions.md --summary '<what the human is approving> Reviews: <gap result>, <claim result>; <what they do not show>.'
228
- ```
229
-
230
- `--summary` says in one to three sentences what the human is approving and nothing else (no
231
- commentary and no open question), then one sentence with both reviews' results and what they do
232
- not show, for example `Reviews: no open gap, 14 of 14 claims verified; neither shows that the
233
- design works once built.` The primary document is the default; the
234
- command prints `Approval requested for spec.md (document id <UUID>) at version <N> (ask <id>)`.
235
- 5. Register each gated step's document and version with the daemon, one call for each step:
97
+ 5. Register each step on its own document, with the id and version the request printed, never a
98
+ slug. Leave `step` out only where your line names one step:
236
99
 
237
100
  ```ts
238
- legion({
239
- op: "register_gate",
240
- issue: "<root issue>",
241
- step: "<decisions|criteria|spec>", // the step this document is for
242
- artifactId: "<UUID>", // that step's document id, which the request printed
243
- version: <N>, // the version the human is asked to approve
244
- })
101
+ legion({ op: "register_gate", issue: "<root>", step: "spec", artifactId: "<UUID>", version: <N> })
245
102
  ```
246
103
 
247
- Copy `artifactId` and `version` from what `dispatch request-approval` printed. The document id is
248
- never the slug or file name you passed in (`spec`, `spec.md`): the daemon recognizes the
249
- document's approval events by that id alone; the `legion` tool looks a slug or file name up in
250
- Dispatch and hands the daemon the id.
251
-
252
- Each step records its own document, so register the spec's id and version under `step: "spec"`
253
- and the Verification document's under `step: "criteria"`: the request that named both sent an
254
- `artifact.approved` event for each, and each step opens on its own document's alone. Leave
255
- `step` out only where your line names one step, which is the whole list a one-step deployment
256
- gates. Register no step your line does not name: a step the deployment does not gate is
257
- refused, and a record of it would hold nothing open.
258
-
259
- Facts about the request:
104
+ 6. End your turn. The person's review brings your next task (the `design-approved` row of
105
+ `skill://legion-architect/references/wake-routing.md`).
260
106
 
261
- - `dispatch request-approval` opens a system question with the fixed options `Approve` and
262
- `Request changes`; a human answers it from the Inbox or approves from the document's header.
263
- Never open a `dispatch ask` with an `Approve` option yourself: the daemon ignores its answer.
264
- - Repeating the request while it waits on the human, with the same `--summary`, changes nothing and
265
- returns it ("already waits on the human"); a different `--summary` is refused then.
266
- - A newer version of a document moves an open approval request of it to that version and leaves it
267
- waiting on you: the human stops seeing it in their "Waiting on you" band, and nothing tells them.
268
- The write itself reports it. `dispatch doc-edit` and `dispatch artifact` print the request, each
269
- document that stands above the version the request asks about with both versions, and the call
270
- that hands it back. Once the human has agreed to every point in that version, run that call to
271
- hand the same request back. Run it whether or not your write printed the line: a pane prints it
272
- only once its Dispatch client carries that report.
273
- - If the output reads `spec.md (document id <UUID>) is already approved at version <N>`, still call
274
- `register_gate` with that id and version: the daemon reads the approval from Dispatch as it
275
- registers, opens the gate and delivers `design-approved` at once, and only once even when the
276
- approval's own event opened the gate first. The same read covers a human who answers between
277
- your two calls: a changes request on that version arrives as `design-changes-requested`, once.
278
- You never approve anything yourself.
279
- - `register_gate` refused 409 `VERSION_NOT_IN_DISPATCH` means the version you named is above the
280
- latest version Dispatch holds for that document (the message names both), and a version Dispatch
281
- never wrote is no registration: the gate is as it was. Read the document's latest version, check
282
- it is the spec the human is asked to approve, and `register_gate` that version.
283
- - `register_gate` refused 400 `GATE_STEP_REQUIRED` means this deployment gates more than one step
284
- and your call named none; the message names the steps it gates. Call again with `step` naming
285
- the one that document is for.
286
- - `register_gate` refused 409 `GATE_STEP_NOT_CONFIGURED` means the `step` you named is not one
287
- this deployment gates; the message names the steps it does gate. Register those and no other.
288
- - `register_gate` refused 409 `GATE_STEP_DOCUMENT_MISMATCH` means the document you named is not
289
- that step's document of that issue; the message names the step and the document it records.
290
- Register that step's own document, as the table in "Which steps are gated" says.
291
-
292
- Each of those four refusals is given before anything is recorded, so the gate is as it was.
293
-
294
- A `design-approved` or `design-changes-requested` notice carries a version and a reason and names
295
- no step. Read your own issue record with the `legion` tool's `read_record` to see which step the
296
- review was of: `gatedSteps` carries one entry for each gated step, with its `artifactId`, its
297
- `currentVersion`, its `approvedVersion`, its `status` (`unregistered`, `waiting`, `approved` or
298
- `changes_requested`) and the `changesReason` of a step whose reviewer asked for changes. That
299
- list, and not the notice, says which steps are open and which still hold the tree's work.
300
-
301
- Then end your turn. The registrations hand those documents to the human: when nothing else of the
302
- tree is at work, the root moves to `awaiting_person` and waits on its design gate, keeping the
303
- admission slot it took at its admission, as a root question handed to the human does ("Every turn" in
304
- `skill://legion-architect/SKILL.md`). Stay live to read the human's comments and replies. Their
305
- approval or changes request delivers your next task, and so does a newer spec version once
306
- Dispatch shows the request back on your turn. While the root waits on a question instead, the
307
- human's approval or changes request of the spec answers that wait too, and the task says how the
308
- spec stands. Your resume takes no slot, whether or not the gate opened, because the root holds
309
- one all along: a root in `awaiting_person` keeps its admission slot
310
- ([Admission and the `legion` label](https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label)). The answered root stands in
311
- the admission line until the pass that resumes it, and nothing is sent to you about that wait:
312
- your record's `waitingLine` gives the live place in the line and the line's length, and beside
313
- them the line's own fields — `part` and `kind`, `partPlace` of `partLength` inside that part,
314
- `holdsSlot`, true for your root, which holds its slot already, `since` for an issue
315
- whose work came back or `rootRank`, `ownRank` and `rootKey` for one that has not started, and
316
- `reason`, the daemon's own sentence for that place. `why` on any issue of your tree that is
317
- not working now says the same in one word and one sentence: `claim_stopped`, a claim nothing
318
- will wake; `waiting`, this line; `blocked`, a Dispatch link or an open child below it;
319
- `unlisted`, an issue the record holds in the workflow that no admission list places. Your
320
- resume task says what answered the wait, and you act on neither your place nor your wait,
321
- because the daemon starts you again by itself on that pass.
322
- Release no child until every gated step is open: a delivered wake shows
323
- `design-approved` on the root, or a task says its design gate is open, and under more than one
324
- step `gatedSteps` in your record shows each one `approved`. The daemon sends a root waiting on a
325
- person no `design-approved` notice, and "this resume is your design-approved wake" is that wake.
326
- On `design-changes-requested`: revise the document that step records as the human's reason asks,
327
- run step 3's two reviews on the new version, resolve every finding, request approval again and
328
- end your turn. A
329
- `design-changes-requested` may name a version below the latest, or arrive after another for the
330
- same version: it is a request the human made that reached the daemon late, and no approval came
331
- after it. Each request arrives once. The gate is as the newest review left it; still read the
332
- reason, and answer it in the spec if the latest version does not already.
107
+ - A newer version moves the open request to it and to your turn, and the person stops seeing it:
108
+ once they have agreed to that version, run `dispatch request-approval` again to give it back.
109
+ - `already approved at version <N>`: still `register_gate` that id and version.
110
+ - Refusals record nothing: `VERSION_NOT_IN_DISPATCH` (register the latest version),
111
+ `GATE_STEP_REQUIRED` (name the step), `GATE_STEP_NOT_CONFIGURED` (register only gated steps),
112
+ `GATE_STEP_DOCUMENT_MISMATCH` (register that step's own document).
113
+ - Never open a `dispatch ask` with an `Approve` option: the daemon ignores its answer.
333
114
 
334
115
  ## After approval
335
116
 
336
- Each step's approval is pinned to the version of the document that step records: a new version of
337
- that document closes that step again, with no wake to say so; you know from your own edit, or
338
- from the `artifact.version` event on your issue. One step closing holds the tree's work whatever
339
- the other steps stand at. The exceptions are the version a human's own answer to a decision block
340
- writes when that answer is the whole change since the version they approved, and a version whose
341
- text is exactly that of the version they approved, with no decision block in it decided
342
- since, such as an accidental edit undone exactly: for either, Dispatch records an `approved`
343
- review in their name at the new version and emits `artifact.approved`, and the daemon reopens the
344
- gate and sends `design-approved`. Undo an accidental edit of an approved root spec exactly. When
345
- the spec then reads Approved at the new version, request nothing; when it does not (a block in
346
- it was decided since), request approval again with steps 3 to 5.
347
-
348
- So edit an approved root spec only when its Summary, a requirement it marks, a check of its
349
- Verification document, the tree's scope or a settled decision changes. Such a change is a point
350
- the human has not agreed to: put the problem behind it to them as its own decision block, with
351
- its evidence, at the end of the section it changes, and add nothing else. If you edit the block before
352
- the human answers, the gate closes like any new version, but their answer still carries the approval
353
- to the version it writes. Once they have answered:
117
+ An approval is pinned to its version: any new version closes that step, with no wake. Two keep it:
118
+ a version whose only change is a person's answer to a decision block, and one equal to the approved
119
+ text (an accidental edit undone exactly).
354
120
 
355
- - When the answer is the whole change, request nothing: the document's chip reads Approved at the
356
- new version and the `design-approved` the daemon sent opens nothing new. Carry on; release no
357
- child because of it.
358
- - When the answer changes the Summary, a requirement, a check or the tree's scope, rewrite that
359
- text and repeat steps 3 to 5 on the new version, with a one-sentence `--summary` naming what
360
- changed since the earlier approval, then the reviews' sentence (the card shows `Approved at
361
- version N on <date> by <who>.`, and its `Show diff` control carries the detail). The rewrite
362
- closes the gate until they approve. Release no further child until the `design-approved` after
363
- it; work already in flight, including what the daemon started at the answer, continues through
364
- its merge.
121
+ Edit an approved spec only where its Summary, a requirement, a check, the scope or a settled
122
+ decision changes: put the problem to the person as a decision block at the end of the section it
123
+ changes. When their answer changes text outside the block, rewrite it and repeat steps 3 to 5,
124
+ with a `--summary` sentence naming what changed. Work in flight goes on; release no further child
125
+ until the next `design-approved`.
365
126
 
366
- A settled decision is the human's. A plan that would overturn one goes back to the planner with the
367
- decision kept, unless the planner brings evidence the human did not weigh that would change it
368
- (such as a measurement showing the settled choice cannot pass a check); then a decision
369
- block names the decision and that evidence. A plan never overturns a settled decision on its own.
370
- A person's request after the approval becomes a requirement only when you write it into the spec
371
- and they approve that version; it is never another issue's, and no comment or answer of theirs
372
- takes a requirement out.
373
-
374
- A design change that leaves the Summary, the requirements, the checks, the scope and the settled
375
- decisions intact (a planner's measurement finding a better way to the same outcome) goes in the
376
- plan (the issue's `plan.md` and the planner's `plan` handoff), never into the approved spec, even
377
- where the spec's text describes the older design; the reviewer reads the plan beside the spec.
378
-
379
- When a planner's `phase-finished` names a departure, compare it with the approved spec: with the
380
- Summary, the requirements, the checks, the scope and every settled decision unchanged, the plan
381
- is the record and the tree carries on; otherwise change the root spec and request approval again.
382
-
383
- Later children and re-scoping open children toward the same requirements need no spec edit and no
384
- new approval. A child issue's spec is never gated, and its parent's review stands in its place
385
- (`skill://legion-architect/references/decomposition.md`, "Reviewing a child's spec").
127
+ A change that keeps all five goes in the plan (`plan.md`), never the spec. A plan overturns a
128
+ settled decision only with evidence the person did not weigh, put to them as a decision block. A
129
+ person's later request is a requirement only once written into the spec and approved.
386
130
 
387
131
  ## A decision block for a read no pod can make
388
132
 
389
- A check sometimes needs evidence from a production or external system before a
390
- human can approve it: a measurement, a current count, a stored record. First check whether a
391
- credential this tree's pods carry reaches it: the model route every pod has, and any identity the
392
- operator's deployment grants pods. Read the pod's own environment (for example `AWS_CONFIG_FILE` or
393
- `AGENT_SECRETS_URL`), because a credential can exist without any skill naming it;
394
- `skill://agent-secrets` says how a pod's session uses the secrets broker's client.
395
-
396
- When the evidence is not reachable, do not have another running session read it for this tree and
397
- fold the result into the spec, because that hides the gap from the next tree that hits it. Write
398
- the missing capability as its own decision block to the human (which external system, which read or
399
- write, why the spec needs it), and leave it open until the human resolves it. A child's own
400
- architect writes no decision block: it sends the missing capability to the architect above it with
401
- `envoy_publish`, and the root architect writes the block in the root spec.
133
+ When a check needs evidence from a production or outside system, first check whether a credential
134
+ the pod carries reaches it: read the pod's environment (for example `AWS_CONFIG_FILE` or
135
+ `AGENT_SECRETS_URL`) and `skill://agent-secrets`. If none does, write the missing capability as a
136
+ decision block (which system, which read, why); never fold in a read another session made.