@sjawhar/claude-envoy 2.11.1 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,41 @@
1
1
  # Decisions on a parked tree
2
2
 
3
- A parked tree is a root handed to Legion (the `legion` label) whose Dispatch status is `backlog`
4
- or `icebox` and whose `issues.<KEY>.phase` in `read_state` is `done`. Its architect is suspended
5
- or gone, so nobody inside the tree hears what a person says on it. The Go daemon sends you each
6
- such decision as `parked-decision on <KEY>`; the walk below finds one sent while no controller
7
- ran. You decide whether the tree runs again, unless the park is not your own hold. When it
8
- runs, its architect's start task, or the catch-up of a later launch, names each decision the
9
- daemon relayed, and both spec versions when the approved one is not the current one, so you need
10
- not tell it.
3
+ A parked tree is a root handed to Legion (the `legion` label) whose Dispatch status is `backlog` or
4
+ `icebox` and whose `issues.<KEY>.phase` in `read_state` is `done`. Its architect is suspended or
5
+ gone, so nobody inside the tree hears what a person says on it. The Go daemon sends you each such
6
+ decision as `parked-decision on <KEY>`; the walk below finds one sent while no controller ran. When
7
+ the park is your own hold, you decide whether such a decision runs the tree again; whoever made the
8
+ park, you start the tree when a person asks you to. When it runs, its architect's start task, or the
9
+ catch-up of a later launch, names each decision the daemon relayed, and both spec versions when the
10
+ approved one is not the current one, so you need not tell it.
11
11
 
12
12
  ## Backlog and icebox
13
13
 
14
14
  A park means "should not run now", and a parked root keeps its `legion` label. A parked root runs
15
- again when a person sets it to `todo`, when a wake tells you to re-admit it (`worker-died`,
16
- `held`), or when it is your own hold (a park you marked `Parked by Legion while it waits on:`, step
17
- 2 of **Deciding**) and a person's decision after the park gives its work a next step, as below.
15
+ again when a person sets it to `todo`, or when it is your own hold (a park you marked
16
+ `Parked by Legion while it waits on:`, step 2 of **Deciding**) and a person's decision after the
17
+ park gives its work a next step, as below.
18
+ A parked root that is your own hold also runs again when you checked that the hold's cause or the
19
+ architect's cause is gone, or that the event it waits on has happened, as the wakes reference
20
+ says (the `held` and `worker-died` wakes, and
21
+ [A tree that waits on an event outside Legion](skill://legion-controller/references/wakes.md#a-tree-that-waits-on-an-event-outside-legion)):
22
+ you set it to `todo` with a comment on the root that cites the park's mark and says what you
23
+ checked.
24
+ [The walk](#the-walk) makes that check at every start and on each `tick`.
18
25
  Every other park, a person's, another session's or an operator's `legion status`, stays parked
19
- until whoever parked it sets it to `todo`.
26
+ until a person sets it to `todo`, the daemon queues a person's approval of its spec (**The
27
+ notice**, the paragraph that begins "A person's own approval"), or a person asks you to start it:
28
+ that request is a person's move, as the list of moves to `todo` in
29
+ [Free slots](skill://legion-controller/SKILL.md#free-slots) says.
20
30
 
21
31
  A held root is not a parked one. It stands at `phase: held` and is still in the workflow, and a
22
32
  `todo` on it releases the hold instead of starting a new run: the issue returns to the phase its
23
33
  hold came from and that phase's role starts again, at the same generation
24
- (`skill://legion-controller/references/wakes.md`, the `held` wake). The recipe below, `backlog`
25
- and then `todo`, is for a root that is parked or lingers, and it is what re-admits a tree.
34
+ (`skill://legion-controller/references/wakes.md`, the `held` wake). A root that is parked or
35
+ lingers takes `todo` alone, and that `todo` re-admits its tree. The pair `backlog` and then `todo`
36
+ (step 1 of **Deciding**) is for a root still in the workflow whose architect has stopped, a held
37
+ root included, where `todo` alone would only release the hold. The `backlog` write takes that
38
+ tree out of the workflow, so the `todo` after it re-admits the tree.
26
39
 
27
40
  ## The notice
28
41
 
@@ -47,25 +60,31 @@ A person's own approval of a parked root's own spec (its primary document), when
47
60
  live, is no notice either: it is that person's handover, and the daemon sets the root `todo`
48
61
  itself, whoever parked it (`admission: queued a person's handover`, `source=approval`). Two
49
62
  approvals of a root's spec are not that handover and still come as notices: a carried approval,
50
- which Dispatch writes in the person's name when their answer to a decision block was the whole
51
- change since the version they approved, and an approval on a root that keeps a Dispatch parent,
52
- as a child a linger handed to Legion does. The other spec notices are a request for changes and
53
- an approval of a document that is not the root's primary one.
63
+ which Dispatch writes in the person's name with a reason that begins
64
+ `Carried forward from the approval of version`, when their answer to a decision block was the
65
+ whole change since the version they approved or when a later version's text is the text of the
66
+ version they approved, and an approval on a root that keeps a Dispatch parent, as a child a linger
67
+ handed to Legion does. The other spec notices are a request for changes and an approval of a
68
+ document that is not the root's primary one.
54
69
 
55
70
  ## Deciding
56
71
 
57
72
  1. **Where the tree stands.** Read `issues.<root>` with `read_state`.
58
73
  - Its `phase` is not `done`: the tree runs. When `architect.state` is `failed` or `retired`,
59
74
  nobody in the tree heard the decision: skip step 2 and judge it in steps 3 and 4. A decision
60
- that gives the work a next step re-admits the tree as the `worker-died` section of
61
- [the wakes reference](skill://legion-controller/references/wakes.md) says
62
- (`set_status` of the root to `backlog`, then to `todo`), not to `todo` alone. On a root at
63
- `phase: held`, `todo` alone releases that hold and starts the held phase's worker, which
64
- leaves the failed architect where it is, so the park before it is what gives the tree an
65
- architect again. Answer a question as step 4 says, and leave the tree as it is. In that reply
66
- and in the root's copy, write `<root>'s architect has stopped, so it` for
67
- `<root> is parked, so its architect`, `The tree waits.` for `The tree stays parked.`, and
68
- `backlog, then todo,` for `todo`.
75
+ that gives the work a next step re-admits the tree (`set_status` of the root to `backlog`,
76
+ then to `todo`, not to `todo` alone) as the `worker-died` section of
77
+ [the wakes reference](skill://legion-controller/references/wakes.md) says, once that section
78
+ finds no cause or finds it gone; while the cause stays, the tree stays admitted under that
79
+ section's park ask. That pair is a restart and not a park. On a root at `phase: held`, `todo`
80
+ alone releases that hold and starts the held phase's worker, which leaves the failed
81
+ architect where it is, so the `backlog` write before it is what gives the tree an architect
82
+ again.
83
+ You park an issue in `backlog` or `icebox` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue.
84
+ Answer a question as step 4 says, and leave the tree as it is. In that reply and in the
85
+ root's copy, write `<root>'s architect has stopped, so it` for `<root> is parked, so its
86
+ architect`, `The tree waits.` for `The tree stays parked.`, and `backlog, then todo,` for
87
+ `todo`.
69
88
  Otherwise the tree already heard the decision: do nothing.
70
89
  - Its `phase` is `done`: read the root's Dispatch status (`dispatch read --issue <root>`).
71
90
  `backlog` or `icebox`: go on. `done`: the tree finished; set nothing and name `ref` in your
@@ -81,9 +100,13 @@ an approval of a document that is not the root's primary one.
81
100
  legion-daemon:<PROJECT>` and, after it and at most 10 minutes after it, `Events:` show a
82
101
  `comment.created` from a session (any controller session: its id changes when the controller
83
102
  restarts or is taken over) that begins `Parked by Legion while it waits on:`. That is the mark
84
- you post on the root, in the same turn, when you park a tree for a hold (the `held` section of
85
- [the wakes reference](skill://legion-controller/references/wakes.md)), and for no other
86
- park: a park a person asks for, or one you make at triage, gets no mark. The window pairs the
103
+ you post on the root, in the same turn, when you park a tree on a person's answer to the
104
+ `dispatch ask` you opened for a hold, for a failed architect or for a tree that waits on an
105
+ event outside Legion (the `held`, `worker-died` and
106
+ [A tree that waits on an event outside Legion](skill://legion-controller/references/wakes.md#a-tree-that-waits-on-an-event-outside-legion)
107
+ sections of [the wakes reference](skill://legion-controller/references/wakes.md)), and for no
108
+ other park: a park a person asks for on their own, without your ask, or one you make at
109
+ triage, gets no mark. The window pairs the
87
110
  mark with the park it was posted for: `set_status` writes the status to Dispatch before it
88
111
  returns, so the mark's line follows the park's within the turn, and a mark older than the park
89
112
  line belongs to an earlier park. Every other park is someone else's: a person's (`user
@@ -125,19 +148,29 @@ an approval of a document that is not the root's primary one.
125
148
  `todo` releases no hold. Post one comment on the issue where the decision was made
126
149
  (`dispatch comment --issue <KEY> --body-file -`): `Parked decision read: <ref> by <login>
127
150
  gives this tree its next step (<one sentence>). Legion runs it again.`
128
- - Any other park, or you cannot read who parked the tree: set nothing, since you move only a
129
- hold of your own ([Free slots](skill://legion-controller/SKILL.md#free-slots)).
130
- Post one comment there: `Parked decision read: <ref> by <login> gives this tree its next
131
- step (<one sentence>).`, then the sentence for that park, then `Its architect then starts
151
+ - Any other park, or you cannot read who parked the tree, when the decision's own words ask
152
+ Legion to start the tree: that is a person's request to start it
153
+ ([Free slots](skill://legion-controller/SKILL.md#free-slots)). Set the root to `todo`
154
+ (`set_status`) and post one comment on the issue where the decision was made:
155
+ `Parked decision read: <ref> by <login> asks Legion to start this tree. Legion runs it
156
+ again.`
157
+ - Any other park, or you cannot read who parked the tree, in any other case: set nothing. A
158
+ decision that only gives the work a next step is no request to start it.
159
+ Post one comment on the issue where the decision was made: `Parked decision read: <ref> by
160
+ <login> gives this tree its next step (<one sentence>).`, then the sentence for that park,
161
+ then `Its architect then starts
132
162
  with this decision.` For a comment that is no reply on an ask, leave out the last sentence:
133
163
  the daemon relays no such comment. The sentence for the park:
134
- - A person's or another session's: `<parker> parked the tree, so it stays parked until they
135
- set it to todo.`, with the login for a person and `session <id>` for a session.
164
+ - A person's or another session's: `<parker> parked the tree, so it stays parked until a
165
+ person sets it to todo, approves its spec when it has no parent, or asks Legion to start
166
+ it.`, with the login for a person and `session <id>` for a session.
136
167
  - One by `session legion-daemon:<PROJECT>` with no mark: `The tree was parked through Legion
137
168
  (session legion-daemon:<PROJECT>) for no hold of its own, so it stays parked until a
138
- person sets it to todo.`
169
+ person sets it to todo, approves its spec when it has no parent, or asks Legion to start
170
+ it.`
139
171
  - One you cannot read: `Its last 10 events do not show who parked the tree, so it stays
140
- parked until whoever parked it sets it to todo.`
172
+ parked until a person sets it to todo, approves its spec when it has no parent, or asks
173
+ Legion to start it.`
141
174
  - It only questions the work: a question, a doubt about the premise, a request for changes that
142
175
  only asks why. Leave it parked and answer the question in one reply:
143
176
  - Answer from the record when it holds the answer: the issue and its spec (`dispatch read`,
@@ -175,9 +208,10 @@ an approval of a document that is not the root's primary one.
175
208
 
176
209
  At every start (step 4 of the start procedure) and on each `tick`:
177
210
 
178
- 1. List the parked roots: `dispatch issues --project <PROJECT> --status backlog --label legion
179
- --limit 250 --offset 0`, then the same with `--status icebox`, each paged as
180
- [At every start](skill://legion-controller/references/triage.md#at-every-start) pages triage.
211
+ 1. List the parked roots:
212
+ `dispatch issues --project <PROJECT> --status backlog --label legion --all`, then the same
213
+ with `--status icebox`. `--all` reads every match in one request, as
214
+ [At every start](skill://legion-controller/references/triage.md#at-every-start) reads triage.
181
215
  Keep the rows that `read_state` records under `issues` at phase `done`.
182
216
  2. For each, read the root (`dispatch read --issue <root>`), then its children
183
217
  (`dispatch read --ref dispatch://<root>/children`) and each child (`dispatch read --issue
@@ -190,8 +224,9 @@ At every start (step 4 of the start procedure) and on each `tick`:
190
224
  `artifact.approved` or `artifact.changes_requested` event, with the approval request's
191
225
  `ask.answered` at the same time, is one decision whose `ref` is `dispatch://<KEY>/spec`, and
192
226
  the issue's `Spec approval:` line shows a request's reason. Skip an `artifact.approved` only
193
- when it is the person's handover, which the daemon queues itself (the paragraph under **The
194
- notice**), and with it the approval request's `ask.answered` at the same time. It is that
227
+ when it is the person's handover, which the daemon queues itself (**The notice**, the paragraph
228
+ that begins "A person's own approval"), and with it the approval request's `ask.answered` at the
229
+ same time. It is that
195
230
  handover when all three hold: the root's `parent` is `null`; the event's `payload.artifact_id`
196
231
  is the root's `primary_artifact_id`; and its `payload.reason` does not begin `Carried forward
197
232
  from the approval of version`. The events `curl` of
@@ -211,3 +246,28 @@ At every start (step 4 of the start procedure) and on each `tick`:
211
246
  notice does not depend on that window.
212
247
  4. Decide each tree's decisions as **Deciding** says, its step 1 included. An event of those types
213
248
  that is older than the park goes in your summary when **Deciding** step 2 says so.
249
+ 5. Take each root of step 1's list whose park is your own hold (**Deciding**, step 2) and whose
250
+ tree had no decision that step 4 judged in this walk: the next walk checks a root whose tree
251
+ had a decision. The mark of each root you take, the first line of the
252
+ `Parked by Legion while it waits on:` comment that **Deciding** step 2 pairs with the park,
253
+ names the cause or the event that the tree waits on. When that comment cites an ask's answer,
254
+ the root's `Asked whether to park:` comment that names that ask gives the `<key>` of the same
255
+ wait on its second line
256
+ (`skill://legion-controller/references/wakes.md#ask-whether-to-park-a-tree`). Check that wait
257
+ now:
258
+ - For an `event:` key, read what its reference names: the issue, the pull request, the
259
+ release, the deploy run, or the message or comment that names what the tree waits on.
260
+ - For any other mark, check the cause that the mark names. That is a mark with a `held` or an
261
+ `architect failed:` key, or a mark with no park ask: its comment cites no ask, or cites an
262
+ ask that no `Asked whether to park:` comment names. A mark with no park ask comes from an
263
+ escalated hold that an earlier Legion parked at once. Judge whether the cause is gone with
264
+ the test of step 3 of
265
+ [An escalated hold](skill://legion-controller/references/escalation.md#an-escalated-hold).
266
+ A live row of `read_state`'s `capabilities` speaks only for a session that runs, and the
267
+ parked tree runs none. So the lack of such a row is no evidence that the cause is gone.
268
+
269
+ When the event has happened or the cause is gone, set the root to `todo` (`set_status`). Post
270
+ one comment on the root (`dispatch comment --issue <root> --body-file -`) that cites the mark
271
+ and says what you checked, as the wakes reference says. When the event has not happened, the
272
+ cause stays, or you cannot tell, move nothing. Name the root and what it waits on in your
273
+ summary.
@@ -29,12 +29,20 @@ answer to your ask, a mention), Envoy or Slack. No `legion controller start` can
29
29
  `issues.<KEY>.holdReason`, `issues.<KEY>.architect`, `issues.<KEY>.tree` (the root of the
30
30
  issue's tree), `admission.cap`, `admission.active` (the issues holding a slot, roots and
31
31
  children), `admission.waiting` (the issues in the line, in its order), `admission.trees` (the
32
- roots of the live trees), `admission.blocked`, `capabilities[]`, `daemon.project`, and
32
+ roots of the live trees), `admission.blocked`, `admission.held` (every issue the record holds
33
+ in the workflow that stands in neither `admission.active` nor `admission.waiting`, each with
34
+ one word for why nothing of it runs and the issues that hold it;
35
+ `skill://legion-controller/references/admission.md` gives the word for each row and what ends
36
+ it), `capabilities[]`, `daemon.project`, and
33
37
  `settings` (the daemon's resolved `legion.yaml`, with no credential in it).
34
38
  - `op: "set_status"` with `issue` and `status` (`todo`, `backlog` or `icebox`) moves an issue. Each
35
39
  call mints its grant in-process from the secret the session registered with, so a stale secret
36
- fails it with a 403. You cannot set `done`: only an issue's architect or the daemon closes an
37
- issue.
40
+ fails it with a 403.
41
+ Move an issue to `backlog` or `icebox` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
42
+ Cite that reason in a comment on the issue. Two writes are not that move: a root's restart,
43
+ which sets `backlog` and then `todo` in the same turn, and the report issue's `icebox`, because
44
+ that issue holds no work. You cannot set `done`: only an issue's architect or the daemon closes
45
+ an issue.
38
46
 
39
47
  ## `gh`
40
48
 
@@ -142,8 +142,9 @@ architect for it, whatever it asks. For a person's mention, take the first of th
142
142
  deployment instructions state. Reply with the new issue's key, its title, the link and assignee
143
143
  the `Created` line names (naming nobody, Dispatch assigns the issue to your token's owner, or,
144
144
  under the shared token, to the project's default assignee when a person set one),
145
- and whether Legion will take it: with the label, triage admits it in its next turn unless the
146
- request, the weekly plan or the deployment instructions say to wait.
145
+ and whether Legion will take it: with the label, triage admits it in its next turn unless a
146
+ person's request says to wait or puts it out of scope. That request is the request itself, the
147
+ deployment instructions, or a line of the weekly plan that names the person's request behind it.
147
148
  - **Something an issue's architect owns.** A question about a tree's design, a change of direction,
148
149
  a decision only the tree's architect can make about an issue Legion runs. Find the tree: follow
149
150
  `Links:` up through each `child_of` parent with `dispatch read` until you reach the issue
@@ -56,15 +56,21 @@ Read this on a `triage` wake, at every start, and when a person hands you an iss
56
56
  catch-up reads that reply as done.
57
57
  3. Admit it (`set_status` to `todo`) only when you labelled it at a person's request, you filed it
58
58
  yourself (for a person, or for a clear defect no tree owns), or a person answered `Admit it`,
59
- unless the request, the weekly plan or the deployment instructions say to wait or put it out of
60
- scope:
61
- `legion({ op: "set_status", issue: "<issue>", status: "todo" })`.
62
- 4. When one of those says to wait, park it with `set_status` to `backlog`, or `icebox` when the
63
- request asks for a longer deferral, instead of leaving it in `triage`; the label stays. Never
64
- park a root for lack of a free slot, because in `todo` the daemon's waiting line already holds
65
- it until a slot frees.
59
+ unless a person's request says to wait or puts it out of scope:
60
+ `legion({ op: "set_status", issue: "<issue>", status: "todo" })`. The operator's deployment
61
+ instructions are such a request. A line of your own weekly plan is not, unless that line names
62
+ the person's request behind it.
63
+ 4. When a person's request says to wait, park it with `set_status` to `backlog`, or `icebox` when
64
+ the request asks for a longer deferral, instead of leaving it in `triage`; the label stays.
65
+ Park a root only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
66
+ Never park a root for lack of a free slot, because in `todo` the daemon's waiting line already
67
+ holds it until a slot frees: admit it as step 3 says, and report the capacity to the person in
68
+ the day's report.
66
69
  5. For a root you admitted or parked, comment on the issue (`dispatch comment`) what you decided
67
- and why. For a root you admitted, say in that comment who will be asked: `Assigned to <login>,
70
+ and why. For a root you parked, cite in that comment why: the person's request behind the park
71
+ (the deployment instructions as that file, or the request the plan's line names), or that the
72
+ work is done, folded into another issue (name it) or no longer needed.
73
+ For a root you admitted, say in that comment who will be asked: `Assigned to <login>,
68
74
  who will get this tree's questions and its design approval`, or, when `Assignee:` says
69
75
  `unassigned`, `Unassigned — nobody's Inbox shows this tree's questions or its design approval
70
76
  until someone takes it from the issue header (Assignee, beside Priority)`. Promise the design
@@ -15,7 +15,9 @@ label, and on each later change while it stays in `triage`, the change that adds
15
15
  included. Triage the root as `skill://legion-controller/references/triage.md` says. A person's
16
16
  label on a `triage` root wakes nobody: the root is queued by the daemon (its own `todo` write). A
17
17
  person's approval of a parked (`backlog` or `icebox`) labelled root's spec is queued by the daemon
18
- the same way and wakes nobody.
18
+ the same way and wakes nobody, except a carried approval and one on a root that keeps a Dispatch
19
+ parent, which come as notices
20
+ (`skill://legion-controller/references/parked-decisions.md#the-notice`).
19
21
 
20
22
  ## `slot-free on <KEY>` (`{kind: "slot-free"}`)
21
23
 
@@ -32,7 +34,7 @@ child, so the issue it names may be either. Name the free slots; take nothing.
32
34
  daemon waits half a minute and folds that window's events into one wake. Take nothing: it is not
33
35
  Legion's.
34
36
 
35
- ## `tick on <PROJECT>` (`{kind: "tick", openCapabilities?, blocked?, silent?}`)
37
+ ## `tick on <PROJECT>` (`{kind: "tick", openCapabilities?, blocked?, held?, silent?}`)
36
38
 
37
39
  The daemon's periodic wake, a minute after it starts and then every
38
40
  `controller_wake_interval_seconds` (an hour by default), whatever the slots. Run the skill's every-turn
@@ -57,6 +59,18 @@ link is taken off (by a person or the tree's architect), and a children-first wa
57
59
  last open child leaves the workflow: name the waits in the day's report and
58
60
  take nothing for them.
59
61
 
62
+ `held`, when present, is `[{issue, reason, heldBy?}, …]`: every issue the daemon's record holds
63
+ in the workflow that stands in neither `admission.active` nor `admission.waiting`, each with one
64
+ word for why nothing of it runs and the issues that hold it. `heldBy` is absent where no issue
65
+ holds the one that waits. The field is absent where the project holds nothing, as `blocked` is.
66
+ `read_state` shows the same rows under `admission.held`, with the same word for each issue, and
67
+ `legion state` prints their counts as `admission.held:`. The word for each row, and what ends
68
+ each hold, is the table in `skill://legion-controller/references/admission.md`. The rows name the
69
+ blocked issues again, under whichever word the daemon's order gives them, so an issue can stand
70
+ in `blocked` and in `held` at once: `blocked` is what readers use for a link or a children-first
71
+ wait, and `held` says of every held issue what it waits for. Name them in the day's report and
72
+ take nothing for them.
73
+
60
74
  `silent`, when present, is `[{issue, role, lastStep, silent, backgroundSince?}, …]`: every issue whose phase worker
61
75
  nothing will prompt, with the role whose claim is silent, the moment that claim's agent last
62
76
  stepped, and how long it has been quiet.
@@ -78,9 +92,13 @@ handler refuses a fact of another generation.
78
92
  So read the issue's record for every entry rather than taking its architect as told:
79
93
  `read_state`'s `issues.<KEY>` gives its phase and each role's claim, and says whether the worker
80
94
  has moved since the tick was queued.
81
- Where the architect of that issue is itself a claim that is not answering — its claim reads
82
- `failed`, or the Envoy registry shows its session gone — `fresh_session` on that architect, because
83
- a notice sent to a claim that reads nothing reaches nobody and the work stands still.
95
+ Where the architect of that issue is itself a claim that is not answering, a notice sent to it
96
+ reaches nobody and the work stands still. When the tree's architect claim reads `failed`
97
+ (`issues.<ROOT>.architect.state`, `<ROOT>` being the silent issue's `tree`), act as the
98
+ `worker-died` section below says, with `<ROOT>` as its `<KEY>`: restart the tree when you find no
99
+ cause or its cause is gone, and otherwise ask the person whether to park it, with no relaunch
100
+ while the cause stays. When its claim does not read `failed` and the Envoy registry shows its
101
+ session gone, `fresh_session` on that architect.
84
102
  Name each silent issue in the day's report, with its role and the length of its silence.
85
103
 
86
104
  ## `unslotted on <KEY>` (`{kind: "unslotted", reason}`)
@@ -162,16 +180,120 @@ releases the hold only on a root standing at `phase: held`: a root whose tree li
162
180
  `phase: done` is re-admitted by the same `todo` at a new generation, and a held child comes back
163
181
  at `admitted` with a new generation of its own.
164
182
 
165
- When an escalated hold's cause is not gone, park the tree: `set_status` the root to `backlog`,
166
- then, in the same turn, post one comment on the root (`dispatch comment --issue <root>
167
- --body-file -`) whose first line is `Parked by Legion while it waits on: <the hold's cause>`, the
168
- cause being what you found the held phase waits on (the payload's `phase` and `role`, and the held
169
- issue's `dispatch read`). That mark is what makes the park Legion's own hold
170
- (`skill://legion-controller/references/parked-decisions.md#deciding`, step 2). Set the root back to
171
- `todo` only when you checked that the hold's cause is gone, a person asks, or a person's decision
172
- after the park gives its work a next step (that reference's step 4), because the park took the tree
173
- out of the workflow: the `todo` after it starts a new generation of the tree, from its architect,
174
- and releases no hold.
183
+ When an escalated hold's cause is not gone, do not park the tree. The tree stays admitted and
184
+ keeps its slot. Ask the person whether to park it, as
185
+ [Ask whether to park a tree](#ask-whether-to-park-a-tree) says. Its `<cause>` is what the held
186
+ phase waits on: the payload's `phase` and `role`, and the held issue's `dispatch read`. Its
187
+ `<key>` is `held <ISSUE> in <heldFrom> (<role>) at <failure.at>`: `<ISSUE>` is the held issue's
188
+ key, `<heldFrom>` is `issues.<ISSUE>.heldFrom`, `<role>` is the role of that phase, whose claim
189
+ failed, and `<failure.at>` is that claim's `issues.<ISSUE>.workers.<role>.claim.failure.at`,
190
+ exactly as `read_state` gives it. Where `failure.at` is absent, the key ends `generation <n>` in
191
+ place of `at <failure.at>`. `<n>` is `issues.<ISSUE>.generation` in `read_state`. The next
192
+ failure gets a new key, so a `Left admitted` answers only the failure it was given for.
193
+ Park the tree only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
194
+ A person's `Park it` answer to that ask is such a request. Only a park on that answer carries the
195
+ mark. Cite the ask's answer in the comment you post with the park, and make that comment's first
196
+ line `Parked by Legion while it waits on: <the hold's cause>`, because that mark is what makes the
197
+ park Legion's own hold (`skill://legion-controller/references/parked-decisions.md#deciding`,
198
+ step 2). Set the root of a park with that mark back to `todo` only when you checked that the
199
+ hold's cause is gone, a person asks, or a person's decision after the park gives its work a next
200
+ step (that reference's step 4), because the park took the tree out of the workflow: the `todo`
201
+ after it starts a new generation of the tree, from its architect, and releases no hold. For a
202
+ `todo` after your check, post one comment on the root
203
+ (`dispatch comment --issue <root> --body-file -`) that cites the park's
204
+ `Parked by Legion while it waits on:` mark and says what you checked.
205
+
206
+ ## Ask whether to park a tree
207
+
208
+ The `held` wake's escalated hold, a tree that waits on an event outside Legion, and the
209
+ `worker-died` wake send you here when a tree's wait has a cause that stays, with that cause as
210
+ `<cause>`. Each of those sections also gives the cause a fixed key, `<key>`: its text is the same
211
+ at every run, while the text of `<cause>` can change from one run to the next. The tree stays
212
+ admitted and keeps its slot while you ask. A comment or a reply from any session counts as yours
213
+ here, because the controller's session id changes when it restarts or is taken over.
214
+
215
+ 1. Look for the ask you opened for this key already. List the root's comments that name an ask:
216
+
217
+ ```text
218
+ notes=$(curl -sS --fail-with-body -H "Authorization: Bearer $(cat "$DISPATCH_TOKEN_FILE")" "$DISPATCH_URL/api/v1/issues/<root>/comments") || { echo "Dispatch read failed" >&2; exit 1; }
219
+ printf '%s' "$notes" | jq -cn 'input | if type == "array" then [.[] | select(.author.kind == "session" and (.body | startswith("Asked whether to park: "))) | {id, created_at, body}] else error("Dispatch did not answer the list") end'
220
+ ```
221
+
222
+ Take the newest of them whose second line is exactly `<key>`. Compare that line alone, and not
223
+ the `<cause>` text under it. Read the ask its first line names
224
+ (`dispatch read --ref '<that reference>'`):
225
+ - It is open: open nothing and post nothing.
226
+ - It is resolved with no answer: open nothing and post nothing for this key. The day's report
227
+ names the tree and that ask, as `skill://legion-controller/references/daily-report.md` says.
228
+ - It is answered, and no reply of yours under it starts `Parked dispatch://`,
229
+ `Not parked dispatch://` or `Left admitted dispatch://`: act on its answer now (step 4).
230
+ - Your reply under it starts `Left admitted dispatch://`: the person chose to leave the tree
231
+ admitted for this key. Open nothing and post nothing.
232
+ - Your reply under it starts `Parked dispatch://`: the tree runs again after that park, so its
233
+ wait now is a new one. Go on to step 2.
234
+ - Your reply under it starts `Not parked dispatch://`: that ask is spent, because its `Park it`
235
+ came when the root was `done` or the tree no longer had the wait that `<key>` names. Go on
236
+ to step 2: a new wait asks again.
237
+
238
+ With no such comment, go on to step 2.
239
+ 2. Open a `dispatch ask` on the report issue that names the root and `<cause>` and asks the person
240
+ whether to park the tree, with the options `Park it` and `Leave it admitted`. The ask also says
241
+ that, after a park on `Park it`, Legion sets the root back to `todo` when the wait that
242
+ `<cause>` names ends (the cause is gone, or the event happens). Follow it
243
+ (`dispatch follow --ask '<ref>' --action follow`), as
244
+ `skill://legion-controller/references/finding-asks.md#follow-it` says, so that its answer
245
+ reaches you. Post one comment on the root (`dispatch comment --issue <root> --body-file -`).
246
+ Make its first line `Asked whether to park: dispatch://<REPORT KEY>/ask/<id>`. Make its second
247
+ line `<key>`, exactly as the section of the cause gives it. Write `<cause>` on the lines under
248
+ the key.
249
+ 3. Name the tree and the ask's reference in the day's report while the ask is open.
250
+ 4. Act on the ask's newest answer. The start procedure's catch-up sends every answer that has no
251
+ reply here, so an answer can come after the root is `done` or after its cause is gone.
252
+ - `Park it`, when the root's `phase` is not `done` and the tree still has the wait that `<key>`
253
+ names: park the tree. Post the park's comment as the section of its cause says: the
254
+ `held` wake's escalated hold, a tree that waits on an event outside Legion, or the
255
+ `worker-died` wake. That comment cites the answer, and its first line is the mark
256
+ `Parked by Legion while it waits on: <cause>`.
257
+ - `Park it` in any other case: move nothing, and say in your reply what you checked.
258
+ - `Leave it admitted`: move nothing.
259
+
260
+ That `<key>` is the second line of the root's comment that names this ask. The tree still has
261
+ the wait that `<key>` names when the section of its cause, applied to `read_state` now, builds
262
+ that same `<key>`. Compare the two keys exactly, as step 1 compares the second line. A cause
263
+ that is gone, an issue no longer at `phase: held`, or an architect no longer `failed` builds no
264
+ key. For an `event:` key, that is when the tree still waits on that event.
265
+
266
+ In each case, reply under the ask with what you did, its first line exactly
267
+ `Parked dispatch://<root>`, `Not parked dispatch://<root>` or `Left admitted dispatch://<root>`:
268
+ `dispatch comment --issue <REPORT KEY> --reply-to-ask '<ask id>' --body-file -`. Dispatch
269
+ refuses to resolve an answered ask, so that reply is the ask's record: step 1 and the start
270
+ procedure's catch-up
271
+ (`skill://legion-controller/references/finding-asks.md#catch-up-at-every-start`, step 3) read
272
+ it.
273
+
274
+ ## A tree that waits on an event outside Legion
275
+
276
+ A running tree can hold a slot while it waits on an event outside Legion: a deploy, another
277
+ project's release, a vendor, or a person outside the company. Do not park it: the tree stays
278
+ admitted and keeps its slot. Ask the person whether to park it, as
279
+ [Ask whether to park a tree](#ask-whether-to-park-a-tree) says, with the event as `<cause>`. Its
280
+ `<key>` is `event: <the event>`. `<the event>` is the one thing the tree waits on, named by a
281
+ fixed reference: an issue's `dispatch://` reference, a pull request's or a release's URL, or the
282
+ deploy's run URL. For a vendor or a person outside the company, it is the `dispatch://`
283
+ reference of the message or comment that names what the tree waits on. Choose that reference at
284
+ the first ask. After that, copy it exactly from the second line of that ask's comment on the
285
+ root. A tree in which an issue stands at `phase: held` with `holdReason: escalated` takes the
286
+ `held` key above for that issue, and a tree whose root's `architect.state` is `failed` takes the
287
+ `architect failed:` key below. Neither takes the `event:` key, whichever wake or pass brought the
288
+ tree to you.
289
+ Park the tree only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
290
+ A person's `Park it` answer to that ask is such a request. Only a park on that answer carries the
291
+ mark: cite the ask's answer in the park's comment, whose first line is
292
+ `Parked by Legion while it waits on: <the event>`, the mark that makes the park Legion's own hold
293
+ (`skill://legion-controller/references/parked-decisions.md#deciding`, step 2).
294
+ Set the root of a park with that mark back to `todo` once you checked that the event has
295
+ happened, a person asks, or a person's decision after the park gives its work a next step, as the
296
+ escalated hold above says.
175
297
 
176
298
  ## `worker-died on <KEY>` (`role: "architect"`)
177
299
 
@@ -181,10 +303,25 @@ notice of the tree goes to that architect, so nobody inside the tree can act. Ch
181
303
  parked: do nothing (a failed architect reads `failed` until the tree closes). Otherwise look for
182
304
  the cause. `issues.<KEY>.architect.failure` holds the record the `held` wake above describes. Read
183
305
  after it an open `capabilities` row whose `detail` names the architect's session, or the
184
- architect's last message on the root issue. When you find none, or it is gone, re-admit the tree
185
- (`set_status` the root to `backlog`, then to `todo`: a new generation whose architect starts with
186
- fresh budgets). When it stays, park the tree (`set_status` the root to `backlog`) and say why on
187
- the issue, because a relaunch would fail the same way.
306
+ architect's last message on the root issue. When you find none, or it is gone, restart the tree
307
+ (`set_status` the root to `backlog`, then, in the same turn, to `todo`: a new generation whose
308
+ architect starts with fresh budgets). That pair is a restart and not a park: the daemon re-admits
309
+ only a root whose tree lingers or is done, so the `backlog` write is how a restart reaches `todo`.
310
+ When the cause stays, the tree stays admitted and keeps its slot, because a relaunch would fail
311
+ the same way. Ask the person whether to park it, as
312
+ [Ask whether to park a tree](#ask-whether-to-park-a-tree) says, with the architect's cause as
313
+ `<cause>`. Its `<key>` is `architect failed: <cause word> at <failure.at>`, where `<cause word>`
314
+ is the `cause` of `issues.<KEY>.architect.failure` and `<failure.at>` is its `at`, exactly as
315
+ `read_state` gives it. Where `failure.at` is absent, the key ends `generation <n>` in place of
316
+ `at <failure.at>`. `<n>` is `issues.<KEY>.generation` in `read_state`.
317
+ Park the tree only when a person asked for that move, or when the work is done, folded into another issue or no longer needed.
318
+ A person's `Park it` answer to that ask is such a request. Only a park on that answer carries the
319
+ mark. Cite the ask's answer in the park's comment, whose first line is
320
+ `Parked by Legion while it waits on: <the cause>`, the mark that makes the park Legion's own hold
321
+ (`skill://legion-controller/references/parked-decisions.md#deciding`, step 2). Set the root of a
322
+ park with that mark back to `todo` once you checked that the architect's cause is gone, a person
323
+ asks, or a person's decision after the park gives its work a next step, as the escalated hold
324
+ above says.
188
325
 
189
326
  This re-admission is not the hold release of the `held` wake above. The `backlog` takes the tree
190
327
  out of the workflow, so the `todo` after it starts a new generation whatever phase the root stood
@@ -109,6 +109,9 @@ of these that holds, so a person sees it and the controller finds it when it ret
109
109
  alone, and your session is refused `set_status is not
110
110
  available to a phase-worker session` (`packages/pi-legion/src/tools.ts`'s `OPERATIONS`). No
111
111
  other issue can hold an answerable ask, so this is the one case a role writes the report issue.
112
+ A report issue holds no work, which is why it sits in `icebox` and why neither write below is
113
+ the move the rule limits:
114
+ move an issue to `backlog`, `icebox` or `triage` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue.
112
115
  - It exists and is closed: `dispatch issue-update --issue <REPORT KEY> --status icebox`. Send
113
116
  the status by itself. A closed issue takes a reopening status alone, and refuses it beside
114
117
  an assignee or any other field (`api/issue_patch.go`, the `before.ClosedAt` branch). This is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "2.11.1",
3
+ "version": "2.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "AGENTS.md"
20
20
  ],
21
21
  "legion": {
22
- "daemonApiVersion": 94
22
+ "daemonApiVersion": 98
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -10,13 +10,13 @@ Dispatch is a record for the people who decide, never a log of your work.
10
10
  - Use the `dispatch` command; the HTTP API only for what no command does. `dispatch <command> --help` gives its rules and an example.
11
11
  - Put long text on stdin: `--<field>-file -` with a quoted here-document (`<<'EOF'`); give object and list fields as JSON.
12
12
  - Exit 1 is a refusal, 2 a usage error. A refusal lists every problem: fix all, call once.
13
- - A command hard to use, or storing or losing something wrongly, is a defect to report, not work around: open an issue in the owning project's code and tell its controller; a Legion role tells its architect (`skill://legion-worker/references/findings.md`).
13
+ - Never work around a hard-to-use command, or one storing or losing something wrongly: open an issue in the owning project and tell its controller. A Legion role tells its architect (`skill://legion-worker/references/findings.md`).
14
14
 
15
15
  ## Asks and ask blocks
16
16
 
17
17
  - An ask is a question for a person, never a request to another agent. Ask an agent by envoy_send or a comment on the issue.
18
18
  - An ask waits on the issue's assignee until a person hands it on. No agent can hand one on.
19
- - A design question a document records is an ask block ending its section:
19
+ - A design question's ask block ends its section:
20
20
 
21
21
  ```md
22
22
  :::ask{urgency="med"}
@@ -29,22 +29,23 @@ The question and the recommendation (`skill://dispatch-writing-specs`).
29
29
 
30
30
  - A decision block in a comment, message or close reason is refused: ask in the issue's document, or `dispatch ask`.
31
31
  - Never repeat an open ask in a message.
32
- - Change an open ask's block with `dispatch edit-ask` (its ask id), or `doc-edit`'s `replace` or `move` (its block id). An answered ask is fixed: ask anew. `dispatch read --ref` takes either id.
32
+ - Change an open ask's block with `dispatch edit-ask` (ask id) or `doc-edit`'s `replace` or `move` (block id). An answered ask is fixed: ask anew. `dispatch read --ref` takes either id.
33
33
  - Reply on an open ask with `dispatch comment --reply-to-ask`; `--turn agent` (a progress note) needs it. An approval request a newer version moved needs `request-approval` again.
34
34
  - When an answer's option and text disagree, the text wins.
35
35
 
36
36
  ## Choosing what to work on
37
37
 
38
- - Finishing an issue, take the top `todo` one by priority then board rank, per project.
39
- - `todo` means specced and waiting on nothing; one that waits goes in `backlog`, saying on what.
40
- - Hold at most three issues in flight; move the rest to `backlog`, saying where each is.
38
+ - When you finish an issue, take the next one per project: the top `todo` issue by priority, then board rank. Pass over one that waits on an unfinished `blocked_by` link or an open ask.
39
+ - Work on three issues at most, fewer when each needs your attention. Change no status, priority or board rank to make room.
40
+ - Move an issue to `backlog`, `icebox` or `triage` only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and cite that reason in a comment on the issue. An agent's directive citing no person's request is no reason.
41
+ - When you stop work on an issue before it is done, release your claim and say why in a comment. Set its status to the one it had when you took it (`todo` for an issue from the queue). Change no priority or board rank.
42
+ - Record each wait in that comment. A wait on a same-project issue also goes in a `blocked_by` link, and one on a person in a `dispatch ask`.
43
+ - `dispatch issue-update --blocked-by` replaces the issue's whole list, so read its links first. Dispatch refuses a link to another project's issue (`BLOCKED_BY_OUTSIDE_PROJECT`).
41
44
  - Never reorder the board: one agent keeps each project's order (`issue-update --before`/`--after`). If the top looks wrong, tell `notifications.role.legion-<project>-controller`.
42
45
 
43
46
  ## Issue status is yours to move
44
47
 
45
- Outside Legion, claim your issue (`dispatch claim`) and move it and your children: `in_progress` at implementation, `testing` on a production-like surface, `needs_review` while its PR waits, `done` with `--reason` once driven in production. Never write or route the status of an issue with the `legion` label or under one, and claim one only as a role of its tree: an outside claim can take the tree out of the workflow. A status write is set back or stands.
46
-
47
- `unresponsive` holders keep their claims 20 minutes (`skill://envoy`).
48
+ Outside Legion, claim your issue (`dispatch claim`) and move it and your children: `in_progress` at implementation, `testing` on a production-like surface, `needs_review` while its PR waits, `done` with `--reason` once driven in production. Never write or route the status of a `legion`-labelled issue or one under it, and claim one only as a role of its tree: an outside claim can take the tree out of the workflow. A status write is set back or stands.
48
49
 
49
50
  A claim (or `dispatch issue-update --route session:<your id>`, `--route ''` to release) brings a person's answers, comments and messages; `envoy_subscribe notifications.dispatch.issue.<KEY>.>` adds agents' activity, no quiet event.
50
51