@sjawhar/claude-envoy 4.10.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 (69) 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/codex-hook.js +9 -3
  5. package/dist/dispatch.js +9 -3
  6. package/dist/envoy-channel.js +10 -4
  7. package/dist/session-hook.js +9 -3
  8. package/legion/skills/legion-architect/SKILL.md +88 -66
  9. package/legion/skills/legion-architect/references/acceptance.md +89 -258
  10. package/legion/skills/legion-architect/references/decomposition.md +94 -213
  11. package/legion/skills/legion-architect/references/design-gate.md +88 -353
  12. package/legion/skills/legion-architect/references/wake-routing.md +51 -43
  13. package/legion/skills/legion-controller/SKILL.md +50 -181
  14. package/legion/skills/legion-controller/references/admission.md +25 -54
  15. package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
  16. package/legion/skills/legion-controller/references/consolidation.md +9 -93
  17. package/legion/skills/legion-controller/references/daily-report.md +21 -99
  18. package/legion/skills/legion-controller/references/escalation.md +16 -118
  19. package/legion/skills/legion-controller/references/finding-asks.md +31 -162
  20. package/legion/skills/legion-controller/references/park-asks.md +33 -0
  21. package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
  22. package/legion/skills/legion-controller/references/session.md +26 -84
  23. package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
  24. package/legion/skills/legion-controller/references/triage.md +18 -89
  25. package/legion/skills/legion-controller/references/wakes.md +22 -549
  26. package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
  27. package/legion/skills/legion-oracle/SKILL.md +19 -28
  28. package/legion/skills/legion-retro/SKILL.md +54 -93
  29. package/legion/skills/legion-retro/references/learnings.md +21 -33
  30. package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
  31. package/legion/skills/legion-worker/SKILL.md +50 -64
  32. package/legion/skills/legion-worker/references/ci-checks.md +16 -84
  33. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
  34. package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
  35. package/legion/skills/legion-worker/references/findings.md +25 -180
  36. package/legion/skills/legion-worker/references/foreign-path.md +14 -22
  37. package/legion/skills/legion-worker/references/gvisor.md +20 -0
  38. package/legion/skills/legion-worker/references/merge-gate.md +43 -419
  39. package/legion/skills/legion-worker/references/plan-tests.md +8 -28
  40. package/legion/skills/legion-worker/references/pr-body.md +19 -218
  41. package/legion/skills/legion-worker/references/review-threads.md +16 -70
  42. package/legion/skills/legion-worker/references/tools.md +31 -578
  43. package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
  44. package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
  45. package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
  46. package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
  47. package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
  48. package/package.json +1 -1
  49. package/skills/agent-secrets/SKILL.md +46 -312
  50. package/skills/agent-secrets/references/store-a-secret.md +9 -0
  51. package/skills/approval-review/SKILL.md +20 -76
  52. package/skills/asd-ste100/SKILL.md +43 -85
  53. package/skills/asd-ste100/examples/before-after.md +18 -53
  54. package/skills/dispatch/SKILL.md +1 -1
  55. package/skills/dispatch-writing-specs/SKILL.md +1 -1
  56. package/skills/envoy/SKILL.md +56 -126
  57. package/skills/envoy/references/check-settlement.md +26 -43
  58. package/skills/envoy/references/deliveries.md +26 -144
  59. package/skills/envoy/references/legion.md +12 -45
  60. package/skills/envoy/references/roles.md +11 -9
  61. package/skills/envoy/references/sources.md +13 -25
  62. package/skills/outside-message/SKILL.md +24 -81
  63. package/skills/plain-words/SKILL.md +24 -55
  64. package/skills/thermonuclear-code-quality/SKILL.md +16 -26
  65. package/skills/thermonuclear-deep-review/SKILL.md +22 -31
  66. package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
  67. package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
  68. package/skills/asd-ste100/references/writing-rules.md +0 -59
  69. package/skills/plain-words/references/mechanics.md +0 -49
@@ -1,46 +1,12 @@
1
1
  # Slack mentions
2
2
 
3
- A person who mentions the Legion Slack app in one of the project's Slack channels is talking to
4
- you, and you answer in that thread. The `Slack channels:` line of your system prompt names each
5
- channel `legion.yaml` gives the project (`projects.<KEY>.slack_channels`). Only the controller the
6
- daemon launches has one, because the daemon names a project's channels to that controller alone.
7
- With no such line the project has no channel, and nothing here applies.
8
-
9
- ## Your session subscribes for you
10
-
11
- Your session hears each listed channel's mentions by itself, on
12
- `notifications.slack.*.<channel>.mention`, for as long as it holds the controller role: a resumed or
13
- relaunched session hears the channels its launch names and no others, and drops every Slack topic an
14
- earlier session subscribed to by hand. Never `envoy_subscribe` a Slack topic yourself, because a
15
- hand subscription is dropped on the next relaunch and hears channels the launch does not name.
16
-
17
- A delivery from Slack whose `channel_id` the line does not name is not yours: do nothing with it.
18
-
19
- A mention published while no controller ran never arrives: Envoy hands a session no copy of an
20
- event from before it subscribed. Nothing tells you about one, so there is nothing to catch up. When
21
- the project's `slack_channels` change, the daemon relaunches you into this session with the new
22
- line.
23
-
24
- ## What a mention carries
25
-
26
- The delivery's `message` holds Slack's fields: `channel_id`, `user_id` (a Slack user id such as
27
- `U0123ABCD`), `text` (the message's own words, then the display text its blocks and then its
28
- attachments carry, a line apiece; a line an object has already shown under another of its own
29
- names is left out, and so is one equal to the message's own words or to a line of them, while two
30
- objects saying the same thing both deliver it; an attachment's `fallback` comes last of that
31
- attachment and only when the attachment did not say it already; a mention a person typed
32
- in a Slack client carries its own words alone, since a `rich_text` block that only repeats those
33
- words is not read, while an app's rich text, which says more, is delivered; the mention itself
34
- appears in it as `<@U…>`, the app's own
35
- id), `ts` (the mention's own timestamp), `thread_ts` (the thread's root, only when the mention was
36
- posted inside a thread), and `bot_id` and `bot_name` when a bot posted it.
3
+ Read this on a Slack mention. A person who mentions the Legion Slack app in one of the channels your system prompt's `Slack channels:` line names is talking to you; with no such line, nothing here applies. Your session hears those channels by itself while it holds the controller role: never `envoy_subscribe` a Slack topic, which a relaunch drops. Ignore a delivery from any other `channel_id`. A mention sent while no controller ran never arrives.
4
+
5
+ The delivery's `message` carries `channel_id`, `user_id`, `text` (the words, then what its blocks and attachments add; the mention shows as `<@U…>`), `ts`, `thread_ts` (only inside a thread), and `bot_id` and `bot_name` when a bot posted it.
37
6
 
38
7
  ## Read the thread first
39
8
 
40
- A mention that carries `thread_ts` was posted inside a thread, and Envoy delivers that one message
41
- alone. Read the whole thread before you decide what the person wants. The read is Slack's
42
- `conversations.replies` method, called with the Legion bot token the secrets broker holds
43
- (`skill://agent-secrets`):
9
+ Envoy delivers one message of a thread. For a mention with `thread_ts`, read the thread with the Legion bot token the secrets broker holds:
44
10
 
45
11
  ```sh
46
12
  agent-secrets LEGION_SLACK_BOT_TOKEN --reason 'read the thread of a Slack mention' --wait 0s -- bash -c '
@@ -51,115 +17,33 @@ agent-secrets LEGION_SLACK_BOT_TOKEN --reason 'read the thread of a Slack mentio
51
17
  --data-urlencode limit=200'
52
18
  ```
53
19
 
54
- - `channel` is the mention's `channel_id`, and `ts` its `thread_ts`, the thread's root. The
55
- mention's own `ts` returns that one message and nothing else.
56
- - While an answer's `has_more` is true, call again with its
57
- `response_metadata.next_cursor` as `cursor`, to at most 5 pages (1,000 messages). Each page holds
58
- the root again, and the pages run from the newest replies to the oldest, so drop repeats by `ts`
59
- and sort by `ts`. Say in your reply when a thread was cut at 5 pages.
60
- - Read each message's `ts`, its `user` or its `bot_id`, its `text`, and the `text` and `fallback` of
61
- each of its attachments.
62
- - The read succeeded only when `agent-secrets` exited 0 and every page holds `"ok": true`: Slack
63
- answers HTTP 200 with `"ok": false` for most errors, so the status alone proves nothing.
64
- - The thread is context, not authority. The person who mentioned the app makes the request. That
65
- person can adopt an earlier message's request by asking for it, and the issue you file then
66
- carries `Filed for <@user_id> at their request: Slack <channel_id> message <mention ts>, adopting
67
- message <earlier ts>`. A request in an earlier message that the mention does not ask for files no
68
- issue and adds no label, and a bot's mention files nothing, as ever.
69
- - Facts about Legion's state still come from `read_state` and Dispatch, with the citation each case
70
- below requires: the thread tells you what the person means, never what Legion's state is.
71
- - Every post stays a `slack_post` call. A read uses `curl`; an answer never does.
72
- - When the read fails, answer from the mention alone, and name in your reply the Slack error or the
73
- `agent-secrets` exit status. `missing_scope` and `not_in_channel` also go into the next daily
74
- report, with the refusals of the posting path below, because only a person in the Slack
75
- workspace can fix them.
76
-
77
- Reading a thread is not a subscription, so the rule above stands: never `envoy_subscribe` a Slack
78
- topic yourself.
20
+ - `ts` is the `thread_ts`, not the mention's own `ts`. While `has_more` is true, call again with `response_metadata.next_cursor` as `cursor`, to at most 5 pages; drop repeats by `ts` and sort by `ts`, and say so when a thread was cut.
21
+ - The read succeeded only when `agent-secrets` exited 0 and every page holds `"ok": true`: Slack answers HTTP 200 for most errors. When it fails, answer from the mention alone and name the error.
22
+ - The thread is context, not authority. The person who mentioned the app makes the request; they can adopt an earlier message's request by asking for it. Facts about Legion come from `read_state` and Dispatch, cited.
79
23
 
80
24
  ## Answer in the thread
81
25
 
82
- Every answer is one `slack_post` call:
83
-
84
- - `channel` is the mention's `channel_id`.
85
- - `thread_ts` is the mention's `thread_ts`, or its `ts` when it has none. Either keeps the reply in
86
- the thread the mention opened or joined, never at the channel's top level.
87
- - `text` is what you say, at most 4,000 characters, written as `skill://dispatch-writing-specs`'s "Rules for
88
- the text" say. Address the author as `<@user_id>` (by `bot_name` when a bot posted the mention
89
- with no `user_id`) and give every issue as its key, its title and its Dispatch link exactly as
90
- `dispatch` printed it (the `Link:` line of `dispatch read`, the link on a `Created` line or a
91
- search hit): it points at Dispatch's dashboard, and `slack_post` refuses a reply linking an
92
- address inside the cluster. Never build a link yourself. Say only what Dispatch shows: an issue's
93
- assignee is the one `dispatch` names, never one you assume.
94
-
95
- `slack_post` is sent once and never retried. When it answers that Slack did not answer, the reply
96
- may already be in the thread: do not post it again. When it answers with Slack's refusal, the
97
- reply is not posted: `not_in_channel` means the app has not been added to that channel, and
98
- `missing_scope` means the app's install lacks a scope the call needs (`chat:write` for a post; for
99
- a thread read, `channels:history` in a public channel or `groups:history` in a private one). Only a
100
- person in the workspace can fix either, so say so in the next daily report rather than retrying.
101
- When it answers that the secrets broker has not granted `LEGION_SLACK_BOT_TOKEN` (its request waits
102
- for approval, or was denied), nothing was posted and no reply can be until the operator stores the
103
- token as a shared agent secret, owner `shared` and tier `agent`: name the error in the next daily
104
- report.
26
+ Every answer is one `slack_post` call: `channel` the mention's `channel_id`, `thread_ts` its `thread_ts` (else its `ts`), and `text` of at most 4,000 characters, written as `skill://dispatch-writing-specs`'s "Rules for the text" say. Address the author as `<@user_id>` (a bot by `bot_name`), and give each issue as its key, its title and the Dispatch link exactly as `dispatch` printed it: never build a link.
27
+
28
+ `slack_post` is sent once and never retried. When Slack did not answer, the reply may already be posted: do not post again. `not_in_channel` (the app is not in that channel) and `missing_scope` (`chat:write` to post; `channels:history` or `groups:history` to read) need a person in the workspace, as does a broker that has not granted `LEGION_SLACK_BOT_TOKEN`: name each in the next daily report.
105
29
 
106
30
  ## Decide what the person wants
107
31
 
108
- Read the mention's `text` and, when it carries `thread_ts`, the thread ("Read the thread first"
109
- above), because the mention can name what an earlier message of it says. When it names an issue key,
110
- read the issue with `dispatch read` before answering. A mention that carries `bot_id` was posted by
111
- a bot, not a person: answer it in the thread, and never file an issue, add a label or pass it to an
112
- architect for it, whatever it asks. For a person's mention, take the first of these that fits.
113
-
114
- - **A question about state.** "What is Legion working on?", "Where is ACME-12?", "Why is it held?"
115
- Answer from `read_state` and Dispatch as they stand now, never from memory: each issue's
116
- `issues.<KEY>.phase` and `issues.<KEY>.tree`, its pull request, `admission.trees` for the trees
117
- that run, and `admission.active` and `admission.waiting` for the issues holding a slot and the
118
- issues in the line: an issue holds a slot as [Admission and the `legion` label](https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label)
119
- says, so `admission.active` names some of a tree's waits as well as its work. Say what you
120
- read, citing for each fact the `read_state` field or the `dispatch read` line it came from.
121
- - **A request for work.** Someone wants a change made, a bug fixed, something investigated. Search
122
- first (`skill://dispatch-first`).
123
- When the open issue that tracks it is one Legion runs, the request is that tree's work: pass it
124
- to its architect as **Something an issue's architect owns** below says, since a reply naming the
125
- issue reaches nobody.
126
- When the issue that tracks it is nobody's tree, reply with that issue and file nothing.
127
- Otherwise file one issue in the project:
32
+ Read the mention and its thread, and `dispatch read` any issue key it names. A mention with `bot_id` gets an answer and nothing else: no issue, no label, no message to an architect. For a person's, take the first that fits:
33
+
34
+ - **A question about state.** Answer from `read_state` and Dispatch as they stand now, citing for each fact its `read_state` field or `dispatch read` line.
35
+ - **A request for work.** Search first (`skill://dispatch-first`). An open issue a Legion tree runs: pass the request to its architect as below. An open issue nobody's tree runs: reply with it. Otherwise file one issue:
128
36
 
129
37
  ```text
130
38
  dispatch issue --project <PROJECT> --title '<the request, as a title>' --spec-file - <<'EOF'
131
39
  ## Summary
132
40
 
133
- <what the person asked for, in your words, and why if they said>
41
+ <what the person asked for, and why if they said>
134
42
 
135
43
  Filed for <@user_id> at their request: Slack <channel_id> message <ts>
136
44
  EOF
137
45
  ```
138
46
 
139
- The last line is the `Filed for` line (`skill://legion-controller/references/finding-asks.md`), which triage
140
- reads; when the mention adopts an earlier message's request, that line reads `Filed for
141
- <@user_id> at their request: Slack <channel_id> message <mention ts>, adopting message <earlier
142
- ts>`. Add `--label legion` only when the person asks Legion to do the work ("Legion, fix…", "can
143
- Legion take…"); a request for someone to look at something, or one that does not say who, gets
144
- no label and waits for a person to hand it over. Never label a request outside the scope the
145
- deployment instructions state. Reply with the new issue's key, its title, the link and assignee
146
- the `Created` line names (naming nobody, Dispatch assigns the issue to your token's owner, or,
147
- under the shared token, to the project's default assignee, which every project names),
148
- and whether Legion will take it: with the label, triage admits it in its next turn unless a
149
- person's request says to wait or puts it out of scope. That request is the request itself, the
150
- deployment instructions, or a line of the weekly plan that names the person's request behind it.
151
- - **Something an issue's architect owns.** A question about a tree's design, a change of direction,
152
- a decision only an architect of its tree can make about an issue Legion runs. Find the issue:
153
- follow `Links:` up through each `child_of` parent with `dispatch read` until you reach an issue
154
- `read_state` records, `<KEY>`. Its `issues.<KEY>.tree` is `<ROOT>`, the tree's root. Send it to
155
- the nearest architect that runs on the chain from `<KEY>` up to `<ROOT>`: the first issue of
156
- that chain, from `<KEY>` up, whose `issues.<ISSUE>.architect.locator.claim` is there.
157
- `envoy_publish` the person's words to `notifications.role.` followed by that claim, with the
158
- channel id and `thread_ts` you reply on, and reply in the thread that you passed it to that
159
- architect, which answers on the issue. When no issue of that chain has a locator, no architect
160
- of it is running: say that in the thread instead and what `read_state` shows for the tree. Never
161
- invent a role token.
162
- - **Anything else** (a greeting, a question about Legion itself): answer it briefly in the thread.
163
-
164
- A request to approve a design is answered as `skill://legion-controller/references/wakes.md`
165
- "GitHub mentions" says: a person approves the spec in Dispatch, and you never open a gate.
47
+ Add `--label legion` only when the person asks Legion to do the work, and never outside the scope the deployment instructions state. Reply with the issue's key, title, link and assignee from the `Created` line, and whether Legion will take it.
48
+ - **Something an issue's architect owns.** Follow `Links:` up through each `child_of` parent to an issue `read_state` records, then up its tree to the first issue with an `issues.<ISSUE>.architect.locator.claim`. `envoy_publish` the person's words, the channel id and the `thread_ts` to `notifications.role.<that claim>`, and reply that you passed it on. When no issue of that chain has a locator, say so in the thread with what `read_state` shows. Never invent a role token.
49
+ - **Anything else**: answer briefly in the thread. A request to approve a design is answered as `skill://legion-controller/references/wakes.md#github-mentions` says.
@@ -1,107 +1,36 @@
1
1
  # Triage and handover
2
2
 
3
- Read this on a `triage` wake, at every start, and when a person hands you an issue. Dispatch and
4
- `read_state`, not the wake text, decide triage.
3
+ Read this on a `triage` wake, at every start, and when a person hands you an issue. Dispatch and `read_state` decide triage, not the wake text.
5
4
 
6
5
  ## At every start
7
6
 
8
- 1. List the project's triage issues handed to Legion:
9
- `dispatch issues --project <PROJECT> --status triage --label legion --all`. `--all` reads every
10
- match in one request, so no row is missed or repeated while the list changes.
11
- 2. The rows show no parent, so `dispatch read` each one and follow `Links:` up through each
12
- `child_of` parent. A `child_of` under `Referenced by:` is a child of this issue, not its parent.
13
- 3. Leave a child whose `issues.<KEY>.tree` is a root in `admission.trees`, or that has an ancestor
14
- that is, because that tree's architect owns it. `admission.trees` is the live trees: a slot is
15
- one issue the daemon has started, held as [Admission and the `legion` label](https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label) says, so a tree is live whether or not its root holds one.
16
- 4. Every other row with no `issues.<KEY>` entry in `read_state` is a root to you, a child whose
17
- tree is not in `admission.trees` included. Read who set its label
18
- ("Triage a root", step 2). A root a person labelled is queued by the daemon and needs nothing
19
- from you. Triage, as a root, each one whose label a session set.
20
- 5. A root `read_state` records and that is now in `triage` is one a person pulled back. Never
21
- re-admit it yourself; ask the person in your summary: "<KEY> was pulled back to triage; what do
22
- you want?".
7
+ 1. List the triage issues handed to Legion: `dispatch issues --project <PROJECT> --status triage --label legion --all`.
8
+ 2. `dispatch read` each and follow `Links:` up through each `child_of` parent (a `child_of` under `Referenced by:` is a child, not the parent).
9
+ 3. Leave a row whose `issues.<KEY>.tree`, or an ancestor, is a root in `admission.trees`: that tree's architect owns it.
10
+ 4. Every other row with no `issues.<KEY>` in `read_state` is a root: [triage it](#triage-a-root). A root a person labelled is queued by the daemon and needs nothing from you.
11
+ 5. A root `read_state` records that is back in `triage` was pulled back by a person. Re-admit nothing; ask in your summary: "<KEY> was pulled back to triage; what do you want?".
23
12
 
24
13
  ## Triage a root
25
14
 
26
- 1. Read `read_state`, then the issue with `dispatch read`. Check that it is in this project, that
27
- it is a root, and whether it already has children. A child the daemon carried to a root of its
28
- own when its old root closed (`skill://legion-controller/references/wakes.md`) is not new work:
29
- leave it. Note its `Assignee:`: that person answers the tree's asks, because their Inbox opens on the
30
- issues they hold. Never reassign it, because who holds an issue is the people's decision, made
31
- from the issue header.
32
- 2. Find who set the label. `dispatch read` does not show who set a label, so list its events in bash:
33
- `curl -sS -H @<(printf 'Authorization: Bearer %s' "$(< "$DISPATCH_TOKEN_FILE")") "$DISPATCH_URL/api/v1/issues/<issue>/events?limit=200"`,
34
- oldest first, 200 a page. When a page holds 200 events, read the next with
35
- `&after=<the last event's seq>` until a page holds fewer: the setter is the newest transition,
36
- and the daemon reads the whole log. The event that added the label set it, and its `actor` is
37
- who: the newest `issue.created` or `issue.updated` event whose `payload.labels` holds `legion`
38
- (any case) while the previous `issue.created` or `issue.updated` event held none, or the
39
- `issue.created` event itself when it carries the label. Events of other kinds between them do
40
- not count.
41
- - `actor.kind` is `user`: a person set it. That root is queued by the daemon (its own `todo`
42
- write through its outbox). Write no `todo` and post no note for it. Your work on it is done.
43
- - Your own filing for a person hands it over too: its spec as filed (`dispatch doc-read --issue
44
- <issue> --version 1`) holds a `Filed for <person> at their request: <request>` line, and its
45
- `actor` is this session (`dispatch whoami` names it) or an earlier one of yours. For a request
46
- that is an ask, an earlier session is yours when its reply under that ask (`dispatch read
47
- --ref`) starts `Filed dispatch://<this KEY>` after a newest answer of `File it for Legion`.
48
- - Your own filing for a clear defect no tree owns hands it over too: its spec as filed holds a
49
- `Filed for Legion from <role> on <issue>: <evidence>` line, and its `actor` is a session of
50
- yours. An earlier session is yours when its reply under that evidence (a comment or an ask)
51
- starts `Filed dispatch://<this KEY>`.
52
- - Any other actor hands over nothing. Leave the issue in `triage` and ask the person on your
53
- report issue whether Legion should take it, naming the issue and who labelled it, with the
54
- options `Admit it` and `Leave it`. On `Admit it`, go on to step 3. Either way, reply under the
55
- ask `Admitted dispatch://<KEY>` or `Not admitted: <reason>`, because the start procedure's
56
- catch-up reads that reply as done.
57
- 3. Admit it (`set_status` to `todo`) only when you labelled it at a person's request, you filed it
58
- yourself (for a person, or for a clear defect no tree owns), or a person answered `Admit it`,
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.
69
- 5. For a root you admitted or parked, comment on the issue (`dispatch comment`) what you decided
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>,
74
- who will get this tree's questions and its design approval`, or, when `Assignee:` says
75
- `unassigned`, `Unassigned — this tree's questions and its design approval go to the project's
76
- default assignee until someone takes it from the issue header (Assignee, beside Priority)`.
77
- Promise the design approval only when your system prompt's `Design gate steps:` sentence names
78
- at least one step; when it reads `Design gate steps: none.` nobody approves a design, so drop
79
- "and its design approval". Take the assignee from the read, never from how the issue was
80
- created: an issue filed with no assignee lands on the project's default assignee, which every
81
- project names, but a person can clear an assignee later, and a root with none still has its
82
- architect's asks reach the project's default assignee.
15
+ 1. Read `read_state`, then `dispatch read` the issue: in this project, a root, and whether it has children. A child the daemon carried to a root of its own when its old root closed is not new work: leave it. Never reassign its `Assignee:`: that person answers the tree's asks.
16
+ 2. Find who set the label: read `/api/v1/issues/<issue>/events?limit=200` with the `curl` of `skill://legion-controller/references/session.md` ("Reading Dispatch's API"), oldest first; while a page holds 200 events, read the next with `&after=<the last event's seq>`. The setter is the `actor` of the newest `issue.created` or `issue.updated` event whose `payload.labels` holds `legion` (any case) where the previous such event held none.
17
+ - `actor.kind` is `user`: the daemon queues the root itself. Do nothing more.
18
+ - Your own filing hands it over: its spec as filed (`dispatch doc-read --issue <issue> --version 1`) holds a `Filed for` line, and the actor is this session (`dispatch whoami`) or an earlier one of yours, which is one whose reply `Filed dispatch://<this KEY>` stands under the ask or evidence that line names. Where that line names an ask, the reply counts only when it follows a newest answer of `File it for Legion` on that ask.
19
+ - Any other actor hands over nothing. Leave the issue in `triage` and open an ask on the report issue naming it and who labelled it, options `Admit it` and `Leave it`. Reply under it `Admitted dispatch://<KEY>` or `Not admitted: <reason>`.
20
+ 3. Admit it (`set_status` to `todo`) only when you labelled it at a person's request, filed it yourself, or a person answered `Admit it`, unless a person's request says to wait or puts it out of scope. The deployment instructions are such a request; a line of your weekly plan is one only when it names the person's request behind it.
21
+ 4. When a person's request says to wait, park it (`backlog`, or `icebox` for a longer wait); its label stays. Never park a root for lack of a free slot: in `todo` the waiting line holds it.
22
+ 5. Comment on each root you admitted or parked what you decided and why, citing the request or reason behind a park. For one you admitted, say who gets its questions: `Assigned to <login>, who will get this tree's questions and its design approval`, or, with `Assignee: unassigned`, `Unassigned — this tree's questions and its design approval go to the project's default assignee until someone takes it from the issue header (Assignee, beside Priority)`. Leave out "and its design approval" when your system prompt reads `Design gate steps: none.`
83
23
 
84
24
  ## Label an issue for a person
85
25
 
86
- Keep the labels the issue has, which `Labels:` lists (`none` is no labels), because the `--label`
87
- flags replace the whole set. Pass each label single-quoted, exactly as `Labels:` shows it:
26
+ `--label` replaces the whole set, so pass every label `Labels:` lists (`none` is none), each single-quoted exactly as shown:
88
27
 
89
28
  ```text
90
29
  dispatch issue-update --issue <KEY> --label '<each current label>' --label legion
91
30
  ```
92
31
 
93
- A label holding a `'` or a line break cannot be quoted and never goes in a command: tell the person
94
- (`<KEY>: label <label> cannot be quoted`), so they hand it over from the issue header.
32
+ A label holding a `'` or a line break cannot be quoted and never goes in a command: tell the person (`<KEY>: label <label> cannot be quoted`), so they hand it over from the issue header.
95
33
 
96
- Then: in `todo` the label admits it. The label you set is a session's label, so the daemon queues
97
- nothing for it: in `triage` its `triage` wake brings the root back to you at step 3. Admit it in
98
- the same turn, from step 3 above, because the person's request is its handover. In any other
99
- status, `set_status` it to `todo` only when the person asked Legion to start it now.
34
+ The daemon queues nothing for a label a session set, so admit a `triage` root in the same turn, from step 3. In any other status, `set_status` it to `todo` only when the person asked Legion to start it now. When you file or admit an issue, name each priority it advances (`--advance <id>`; `dispatch priorities` lists them). A child needs no label: it runs in its tree.
100
35
 
101
- Filing or admitting an issue, name each priority it advances (`--advance <id>` of `dispatch issue` and `issue-update`, repeatable).
102
- `dispatch priorities` lists the ids, and names each issue in flight that advances no priority.
103
-
104
- Taking the label off a waiting root drops it from the waiting line; taking it off an admitted tree
105
- does not stop it. A child needs no label: it runs in its tree once its root is admitted, and under
106
- its own architect once its first phase starts. A child outside a live tree is admitted as a root
107
- of its own and needs the label.
36
+ Work that must start at a commit other than its base branch's head needs `legion/<KEY>` there before Legion starts the issue: a root before admission, a child before its first phase. You push nothing, so whoever gives you the root, or the architect that owns a child's parent, runs `gh api -X POST repos/<owner>/<name>/git/refs -f ref=refs/heads/legion/<KEY> -f sha=<commit>`. Read it back before `set_status` to `todo`: `gh api repos/<owner>/<name>/git/ref/heads/legion/<KEY>`.