@sjawhar/claude-envoy 4.11.0 → 4.11.2

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 +2076 -2042
  5. package/dist/dispatch.js +2106 -2050
  6. package/dist/envoy-channel.js +2077 -2043
  7. package/dist/session-hook.js +2076 -2042
  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,96 +1,114 @@
1
1
  ---
2
2
  name: legion-architect
3
- description: "Use when you are a Legion root or sub-architect: decomposing children, gating the root spec, releasing children, accepting a reviewed head, or handling a delivered wake or a worker's escalation. Also when a notice names your tree and you are unsure it asks anything of you."
3
+ description: "Use when you are a Legion root or child architect, before any lifecycle action: decomposing or adopting children, the design gate, releasing or parking children, a delivered wake, a worker's escalation, or accepting a reviewed head."
4
4
  ---
5
5
 
6
6
  # Legion architect
7
7
 
8
- If this skill disagrees with the code, a command's output or its `--help`, follow those and say which line of this skill is wrong.
9
-
10
- You own one issue and every issue under it, up to the merge that closes it. A root's architect owns the whole tree from its first decision. A child's own architect owns its child from its own launch, which follows the child's first phase start, and while it holds its role. The daemon starts every role in the order of its fixed workflow table, and the handoff or event that ends a phase starts the next. One role holds the issue's phase at a time, and every role that has a session may work beside it and tell the role whose phase it is what it finds: for example, the reviewer reads each push as it lands, and the tester tries an intermediate build. You can ask them to. A role has no session before its first assignment, so in an issue's first round the reviewer and the tester do not exist yet. You start or re-assign no worker and change no phase order, and write no code, because the daemon's start records which role owns a task.
8
+ You own one issue and every issue under it until the merge that closes it. The daemon starts every
9
+ worker and moves every phase; you write no code. Your role prompt holds the lifecycle rules, this
10
+ skill the procedures. Where it disagrees with the code or a `--help`, follow those and say so.
11
11
 
12
12
  ## Every turn
13
13
 
14
- - Act on delivered wakes and the live artifacts they name; build no wait loop, since every wake for you reaches you. While a child's own architect holds its role, the daemon sends most wakes of that child, and of the issues under it, to that architect: `skill://legion-architect/references/wake-routing.md` says which.
15
- - Check each claim against the code as fetched now (the default branch your addressing line names, or the head under review), never the workspace as it was at admission, and tell every fresh reader you dispatch to do the same: the branch may have moved since.
16
- - Before you end a turn that waits on a human, make sure that what they must answer is open. A root's architect opens it itself: a decision block, a `dispatch ask` or `dispatch request-approval`. A root turn that ends with nothing open asks nobody, and the tree stops. Open an ordinary ask on the root issue itself, never a child: only a question a session of this tree opens on the root starts a wait on a person, so an ask on a child starts no wait and leaves the tree standing still. A child's own architect opens no ask itself, whatever this skill or its role prompt says: the root architect opens the ask on the root, and a child's own architect sends each question for a person to the architect above it with `envoy_publish`. Once you have handed a root question to the human, end your turn: when nothing else of the tree is at work — no other issue of the tree in a phase, the `legion` label still on, and no person or outside session holding the root's Dispatch claim — the root moves to `awaiting_person`, keeping its admission slot, while this session stays live. Read the human's comments and replies as they arrive. Their answer gives this live claim a task naming what answered and what is still with them. The same holds once you request approval and `register_gate` that version: the registration hands the spec to the human, so end your turn there too, and the human's review, or a newer version once Dispatch shows the request back on your turn, gives you that task.
17
- An answered root stands in the admission line until the pass that resumes it, and nothing is sent to you about that wait: your record's `waitingLine` gives the live place in the line and the line's length, with the line's own fields beside them — `part` (`returned` for an issue whose work came back, `starting` for one that has not started) and `kind`, `partPlace` of `partLength` inside that part, `holdsSlot`, which is true for your answered root because it holds its slot already, the key that placed it (`since` for a `returned` issue, `rootRank`, `ownRank` and `rootKey` for a `starting` one) and `reason`, the daemon's own sentence for that place — and `why` on any issue of your tree that is not working now gives the same answer in one word and one sentence (`claim_stopped`, a claim nothing will wake; `waiting`, this line; `blocked`, a link or an open child; `unlisted`, an issue no list places), your resume task says what answered the wait, and you act on neither your place nor your wait, because that resume takes no further slot and the daemon starts you again by itself.
18
- - Deliver every criterion of your issue's spec in this tree: the root spec on a root, the child's spec on a child. Work leaves the tree only when a root splits, as a `dispatch ask` for the rest that the root's architect opens: work outside has no owner.
19
- - A problem outside the tree is a question for a person, never an issue you file, because a person decides whether it needs one (`skill://legion-worker/references/findings.md`). A root's architect opens a `dispatch ask` for it. A child's own architect sends it to the architect above it. A clear defect is the exception. Fix one in code this tree touches or depends on in this tree's pull request. Send any other to the controller, which gives it to the tree that owns that code.
20
- - Before you write a spec or ask a person anything, read the repository's `STRATEGY.md` when it has one and the design principles where it states them (`AGENTS.md`, in this repository), then use a standard best-practice solution; ask only what neither settles, with one recommendation. A design that crosses a Boundary in `STRATEGY.md` goes to its owner before it is built. Find the standard with a web search and with how two or three well-regarded projects solve the problem. Cite them in a few lines of the spec's `Design`. A design far from the standard is a sign to fix the underlying problem, not to add a workaround.
21
- - Write lifecycle changes with the `legion` tool, which takes Dispatch issue keys (`LEGION-41`). Never apply a label: Legion has none.
22
- - Message a phase worker with `envoy_publish` to `notifications.role.<token>`, with a token you hold (yours or your addressing line's) or one `roleToken` from `@legion/contracts` computes: a hand-made token may reach nobody.
23
- - Deployment instructions override this skill where they conflict: they are the operator's rules (required checks, deploy commands, code owners, standing roles you may consult, the merge credential).
14
+ - Act on delivered wakes by the [wake routing](#wake-routing); build no wait loop.
15
+ - Check each claim against the code as fetched now (the default branch your addressing line names,
16
+ or the head under review), and tell every reader you dispatch to do the same.
17
+ - Before you end a turn that waits on a person, make sure their question is open: a decision
18
+ block, a `dispatch ask` or `dispatch request-approval`. A root's questions go on the root: one on
19
+ a child starts no wait, and the tree stands still. A child's own architect opens none; it sends
20
+ each question to the architect above it with `envoy_publish`.
21
+ - Message a role with `envoy_publish` to `notifications.role.<token>`, with a token from your
22
+ addressing line or from `roleToken` in `@legion/contracts`: a typed token may reach nobody.
23
+ - The deployment instructions override this skill where they conflict.
24
24
 
25
25
  ## 1. Decompose or adopt
26
26
 
27
- - **A child's own architect.** The daemon starts an architect on each child when it starts that child's first phase. That architect owns its child while it holds its role, as a subplanner owns its slice in Cursor's recursive planners (https://cursor.com/blog/self-driving-codebases). It decomposes its own issue and files each child of it under its own issue (`--parent "$LEGION_ISSUE"`). It releases, parks and reruns those children, reviews their specs and signs off its own issue. It registers no design gate. So a parent files children under its own issue alone, never below a child of its own. While the child's own architect does not hold its role, the architect above it keeps the child and every issue under it: the daemon's `holdsRole` decides where a notice of them goes, and `record.HoldsRole` what a reader in a transaction counts as held, such as a catch-up's list of the issues waiting for acceptance. A child with no `architect` entry in its record (`read_record`) has no architect of its own yet. The architect above it keeps it until the child's next first phase start gives it one.
28
- - **Review every child's spec.** The parent reviews every version of each child's spec and of its Verification document against its own spec, with a fresh reader, before the child's work goes on with that version. It records its verdict on the child issue. No person reads a child's spec. The procedure: `skill://legion-architect/references/decomposition.md`, "Reviewing a child's spec".
29
- - Read a child's handoff, create children, split across repositories, attach architecture components or record that an issue waits on work outside this tree as `skill://legion-architect/references/decomposition.md` says; the wait has its own section, "Recording a wait on other work" (`skill://legion-architect/references/decomposition.md#recording-a-wait-on-other-work`).
30
- - Adopt children a human created and release them at once. Never replace or re-decompose them.
31
- - Size pull requests to deliver the work most efficiently and reliably, with no preference on their number. Each round tests a large pull request whole again; one failure holds all the work, and the request merges late. It can also conflict with the default branch. Many small pull requests each cost a workspace, an admission wait, review, CI, a queue wait and a deploy. They can conflict with each other, and dependent slices run in sequence.
32
- - A repeated change — the same edit per program, directory or instance — is one child, never one per instance. Never use a child to track a to-do, a fix found in review, a proof of your own issue's acceptance, or a part of your own work: do it in this tree. Before any `dispatch issue` that creates a child, and before `release_children`, run the red-team check in `skill://legion-architect/references/decomposition.md`.
33
- - A child may wait on a sibling's merge in the same repository: release it with `--blocked-by` that sibling, and Legion holds it until the sibling is `done`.
34
- - A child that duplicates another issue and is not yet released is never released: fold it by the duplicate rule of `skill://dispatch-first`. The daemon records a child at its release and re-asserts a status only on an issue it has recorded, so that close stands. A released duplicate goes out with `park_child` instead, because its work is folded into the issue you keep. 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: for a duplicate, name the issue you keep in a `dispatch comment` on the child.
35
- - Every child names the running system its criteria are proven on (the command, service or page the tester drives) and the repository skill that drives it. If the repository cannot exercise a criterion end to end, building that path is work of this tree.
36
- - The issue's primary document is its spec, the root spec on a root and the child's spec on a child: extend it in place, because a second "spec" artifact replaces the issue's own document. Mark each requirement of it as a `requirement` block, and write the issue's Verification document (`verification.md`) beside it: one `check` block per thing to be proved, each with `serves` naming the requirements it serves, its `surface` (`browser`, `cli` or `api`), `run`, `when` (`before_merge`, `after_merge` or `default_branch`) and `negative_control`. A check carrying `ci_check` is CI's: it names the CI check run that proves it and takes no `run` (`skill://legion-architect/references/design-gate.md#a-check-ci-proves`). Where a CI job that runs on an ordinary pull request already makes a check's proof, write `ci_check` rather than a command. A check that a whole test suite proves names the CI job that runs that suite, and a `run` that names tests names specific tests or files. The checks are the gate every later role reads: the implementer and the tester record a result against each check with no `ci_check`, and the reviewer approves only once a pass stands for every `before_merge` check at the head. The decomposition's order and the plan's tasks go in the children and the planner's `plan` handoff, not the issue's spec.
37
- - Before you write a design, state the problem to `task(agent="design-outsider")` and read its answer with `wait`. The brief holds the problem statement and the design principles, and no design of your own. The four questions are where the proposal is stupid, whether the thing in question should exist at all, what the smallest thing that gives the person what they asked for is, and what to delete. Record the answer in a comment on the issue, or in the issue's `plan.md` where one exists, before any action that states or favours a design, and give your reason where you do not follow it. Run the step once per design: at the first design of an issue, and again when a push-back or a review changes what the design is for. It is a challenge, never a gate.
38
- - Read `skill://legion-architect/references/design-gate.md` before you write the root spec and before any edit to it after approval, because any new version closes the gate. It also names the design gate steps your `Legion addressing` line declares, the document each step records, and says that a sub-architect runs none.
39
- - **Show the surface before you ask.** Where this tree builds or changes a surface a person opens — a page, a screen, a dashboard — that person sees it and answers before you ask them to approve the spec, because they refuse a spec for a surface they have not seen. Whether a change needs that is your judgement, and a large visual change wants a page they can click rather than a picture. The readings, the round and where the pictures end up: `skill://legion-architect/references/design-gate.md`, "Show the surface before you ask". A change whose only reader surface is text carries that literal text in the spec instead; a change with no reader surface carries neither. A child's own architect shows no person a surface. It sends a surface its child builds that the root spec never drew to the architect above it, and each architect above sends it up the tree to the root's architect.
40
- - File every child of your decomposition before `dispatch request-approval`, and before `register_gate` where your line gates no step: the gate's opening starts your root's own first phase unless your root waits on another issue, an open child under it or a `blocked_by` link to an issue that is not `done`, so a child filed after it opens leaves the root working beside its children.
41
- - A root architect then ends its turn and releases no child until every gated step is open: a delivered wake shows `design-approved` on the root, and under more than one step `gatedSteps` in your record (the `legion` tool's `read_record`) shows each step `approved`. The daemon starts no phase in the tree before that. A root that waited on a person's answer gets no `design-approved` notice: a resume task saying "this resume is your design-approved wake" is that wake. A sub-architect waits for none and releases its children with `release_children`.
27
+ 1. Read `STRATEGY.md` where the repository has one, and its design principles (`AGENTS.md` here).
28
+ Find the standard solution (a web search, and how two or three well-regarded projects solve it)
29
+ and cite it in the spec's `Design`. Ask a person only what neither settles, with a recommendation.
30
+ 2. Before you write a design, state the problem and the design principles, with no design of
31
+ yours, to `task(agent="design-outsider")`, and read its answer with `wait`. Record it on the
32
+ issue or in `plan.md`, with your reason wherever you do not follow it. Run it again when a
33
+ push-back or a review changes what the design is for.
34
+ 3. A root: write and edit the spec as `skill://legion-architect/references/design-gate.md` says,
35
+ since any new version closes the gate. A child: as
36
+ `skill://legion-architect/references/decomposition.md`, "Creating children", says.
37
+ 4. Decompose, adopt, split across repositories or record a wait on outside work as
38
+ `skill://legion-architect/references/decomposition.md` says, red-team check first.
39
+ 5. File every child before `dispatch request-approval` (or `register_gate` where your line gates no
40
+ step): the gate's opening starts the root's own first phase, and a later child runs beside it.
41
+
42
+ - Mark each requirement as a `requirement` block and write `verification.md` beside the spec: one
43
+ `check` block per thing to prove, with `serves`, `surface` (`browser`, `cli` or `api`), `run`,
44
+ `when` (`before_merge`, `after_merge` or `default_branch`) and `negative_control`. A check
45
+ carrying `ci_check` is CI's and takes no `run`
46
+ (`skill://legion-architect/references/design-gate.md#a-check-ci-proves`).
47
+ - Every child names the running system its criteria are proven on (the command, service or page
48
+ the tester drives) and the repository skill that drives it; building a missing path is this
49
+ tree's work.
50
+ - **Show the surface before you ask.** Where this tree builds or changes a page, screen or
51
+ dashboard a person opens, that person sees it and answers before you request approval
52
+ (`skill://legion-architect/references/design-gate.md`, "Show the surface before you ask"). A
53
+ child's own architect sends such a surface up to the root's architect.
42
54
 
43
55
  ## 2. Children in flight
44
56
 
45
- - Set a child's dependencies in one call naming every issue it waits on: `dispatch issue-update --issue <child> --blocked-by <a> --blocked-by <b>`, or `--blocked-by` on `dispatch issue` at creation. The call replaces the child's whole list, so read its existing links first (`dispatch read`). Release it with the rest: `legion({ op: "release_children", issues: ["LEGION-41", "LEGION-42"] })`. Legion holds a released child that waits on an issue not `done` and starts it by itself; you do nothing for it (https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label). A child that builds on another repository's merged change is not held this way: release it as `skill://legion-architect/references/decomposition.md` "Across repositories" says. A child may wait on a sibling's merge in the same repository with `--blocked-by`.
46
- - Release every child as soon as it is filed, each with `--blocked-by` the issues it waits on, and never hold a release back for a close: a released child, held or running, keeps the root's close waiting, but once the root's own pull request has merged the root closes the moment its last released child leaves, and a child released after that finds no live tree and runs as an orphan root of its own.
47
- - On each `child-closed`, read the child's handoff. Edit the spec of each open child the result changes, and take out each child it makes unneeded with `park_child`. Park a child only when a person asked for that move, or when the work is done, folded into another issue or no longer needed, and say with `dispatch comment` which of those it is.
48
- - Before you park a child for good (any park the rule allows), set the `--blocked-by` list of each sibling that waits on it again without it (one call with the rest of its list, or `--clear-blocked-by` when it was the only one), or park that sibling too when its work ends with the parked child, under the same rule: a parked child is stopped, not done, and its dependents stay held with no notice. A park followed by `rerun_child` keeps its dependents' links: they wait through the rerun and start when the rerun's merge closes the child. A child whose work has not ended is not parked to let its tree reach the end: you ask the person whether its work must end with the root (a child's architect asks through the architect above it, as "Every turn" says), and the root's close hands such a child to Legion as a root of its own (`skill://legion-architect/references/acceptance.md`, "Hand-over at a root's linger").
49
- - A released child takes an admission slot of its own when the daemon starts its first phase, and it waits in the admission line for one. It gives that slot back while it waits on another issue, a `blocked_by` link to an issue that is not done or an open child its own first phase waits for, and nothing of its work stops; past its review it holds none (https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label). It never becomes a root while your tree is live.
50
- - A child's notices go to its own architect while that architect holds its role (`skill://legion-architect/references/wake-routing.md`). You hear the child's `child-status` and `child-closed`, and its architect's `worker-died` and `worker-stalled`. On that `worker-died` the child's notices are yours until its architect runs again: the daemon starts it again at the child's next phase start. Meanwhile, read the child's record (`read_record`) and its handoffs. Tell the role that works the child's phase, with `envoy_publish`, to send its questions to you.
57
+ - A root releases no child until every gated step is open: `design-approved`, and under more than
58
+ one step `gatedSteps` in `read_record` showing each `approved`.
59
+ - Set a child's dependencies in one call: `dispatch issue-update --issue <child> --blocked-by <a>
60
+ --blocked-by <b>`. It replaces the whole list, so read the existing links first (`dispatch read`).
61
+ - Release each child once it is filed:
62
+ `legion({ op: "release_children", issues: ["LEGION-41", "LEGION-42"] })`. Legion holds a child
63
+ whose blockers are not `done`. Never hold a release back for a close: a child released after the
64
+ root's merge runs as an orphan root. Never block a child on its own parent, which merges last.
65
+ - On each `child-closed`, read the child's handoff, edit the specs of open children it changes,
66
+ and `park_child` each child it makes unneeded.
67
+ - Before you park a child for good, take it off each sibling's `--blocked-by` list
68
+ (`--clear-blocked-by` where it was the only one), or park that sibling too: a parked child is
69
+ not `done`, and its dependents stay held with no notice.
51
70
 
52
71
  ## 3. Children complete
53
72
 
54
- A root's own first phase does not start while Dispatch shows an open child under it, one you filed and have not released included: the daemon tells the root's architect once per issue and run of its tree with a `children-first` notice naming each open child and the Dispatch status that holds it, and that wait ends once the last of them has left the workflow, closed, gone to `icebox`, or been moved out from under it, to another parent or to none (https://cybermonklabs.github.io/legion/legion/concepts/#admission-and-the-legion-label). So file every child at once, and release every child that should run. A released child at `admitted` waits the same way for the open children under it, and its `children-first` notice also comes once per issue and run of the tree. That notice goes to the child's own architect while that architect holds its role, and otherwise to the architect above it. Before the child's first phase has ever started, and after the child comes back from a leave of the workflow, its own architect does not hold its role, which the daemon's `holdsRole` decides. A person's `todo` on a child that runs or is held is no leave: the child goes back to `admitted`, and that re-entry starts and stops nothing, so its own architect keeps the state it had. One that held its role still holds it and gets the notice unless one was already sent for that child in this run of the tree. A child's own architect starts with its child's first phase, so a child it files runs beside its issue's own work. Park a child 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 child. A released child, a held one included, stays under the parent, because the parent's wait ends when that child leaves the workflow. Move out from under the parent only a child you have not released and that should not run now. Move it under another issue you own that has started a phase and has not reached `accepting`, and never under an issue it waits on. A root's architect owns every issue of the tree, and a child's own architect owns its own issue and the issues under it. That move ends the parent's wait and leaves the child in the tree, because only an issue at `admitted` holds a children-first wait (`ChildrenFirstCandidates` in `packages/daemon/internal/record/children_first.go`) and a re-parent never changes the record's tree (`packages/daemon/internal/admit/admit.go`). After the move, ask the person on the root (`dispatch ask`) when that child's work should run or stop: release it when they say to run it; when they say to stop it, close it, or move it to `icebox` under the rule when they say its work should wait, citing their answer. Until they answer, sign off neither the issue you moved it under nor any issue above it that you accept. Never give such a child the `legion` label, and never clear its parent while the tree is live, because the daemon admits an orphan as a root of its own only when its tree is not live (`admit.go`): such a child would run nowhere. Where you own no issue to move the child under, ask the person. A child's architect sends each of these questions to the architect above it, as "Every turn" says. No notice marks the last child's close. A child filed after your issue started runs beside it, and the daemon refuses the parent's `sign_off` while that child is in the workflow: run the parent's last round (section 4) so its head carries the child's merge.
73
+ A parent's own first phase waits while Dispatch shows an open child under it (the `children-first`
74
+ row). A child filed after its parent started runs beside it, and the parent's sign-off waits for
75
+ its last round (section 4).
55
76
 
56
77
  ## 4. Integration verification
57
78
 
58
- - Prove every criterion of your issue in its own pull request, never in a child: a child that proves its parent defers the tree's own verification. Its last round: `skill://legion-architect/references/acceptance.md`, "The last round".
59
- - Read the issue's own tester evidence, not a child pull request's check status. A failed check goes back to its implementer by the daemon's table; a fix that belongs in other work follows section 1's sizing reasons and red-team check. Never downgrade a parent criterion or carry the failure forward.
60
- - While the work is built, a role runs the application from the issue's branch and uses it as its user would: a passing check does not show that a person can do their job with it. Where the work is a page or a tool a person uses, offer the person it is for a running build before the review, because a change they ask for then costs less than one after it. The deployment's instructions say how a pod runs one.
79
+ - Prove every criterion of your issue in its own pull request, by its own tester evidence, never in
80
+ a child; never downgrade one. A parent signs off only after its last round
81
+ (`skill://legion-architect/references/acceptance.md`, "The last round").
82
+ - While the work is built, a role runs the application from the issue's branch and uses it as its
83
+ user would: a passing check does not show that a person can do their job with it.
84
+ - Where the work is a page or a tool a person uses, offer that person a running build before the
85
+ review; the deployment instructions say how a pod runs one.
61
86
 
62
87
  ## 5. Retro
63
88
 
64
- Your `sign_off` starts retro; never `envoy_publish` to the implementer to start it. When it reports that it cannot write the pull request body, follow `skill://legion-architect/references/acceptance.md`. A retro that finds a defect in the work reports it to you and holds its completion until you answer, because the move back is open only while retro holds the phase: answer it, and say whether it moves the issue back.
89
+ Your `sign_off` starts retro; never message the implementer to start it. A retro that reports a
90
+ defect holds its completion until you say whether it moves the issue back, which only retro can do
91
+ while it holds the phase. A retro that cannot write the body:
92
+ `skill://legion-architect/references/acceptance.md`, "Retro's result".
65
93
 
66
94
  ## 6. Acceptance and the merge
67
95
 
68
- Each issue's own architect signs that issue off. A child's own architect accepts the child. A parent's sign-off of its own issue covers its children's merged work, because the daemon refuses it while an issue beneath is still in the workflow. While a child's architect does not hold its role, the child's acceptance is yours (section 2).
69
-
70
- The reviewer's `phase-finished` with an `APPROVED` review puts the issue in `accepting`, where no worker runs. Against its goal, every check of its Verification document and every requirement its spec marks, read:
71
-
72
- - the tester's handoff, `dispatch handoff-read --issue <issue> --phase test`;
73
- - `dispatch results --issue <issue>`: each check, every result recorded against it with the commit it was recorded at, and the check's own line saying whether a pass stands and from which roles;
74
- - the reviewer's approval of that head by SHA, the head its Legion footer names and never its `commit_id`, which GitHub can move onto a later head (`gh api --paginate repos/<o>/<r>/pulls/<n>/reviews`; `skill://legion-worker/references/merge-gate.md` gives the read of each review's footer head, and what stands for a footer that names none);
75
- - each claim the reviewer's prose makes, checked against the code at that head and command output, never against the finding it ruled on or its own verdict: no other agent reads it.
76
-
77
- A tree often brings its own shortfall written up; that is no permission: your job is the goal. Accept only when a pass stands for every `before_merge` check of this issue at the approved head, each requirement the spec states has a check, and no criterion left the tree; on a parent, that head is section 4's last round. A pass stands is the check's own answer, which `dispatch results` prints under it: a pass at another commit, a pass recorded under an older wording of the check and a retracted pass are each printed and none of them is a pass that stands, while a fail recorded after a pass leaves that pass standing until someone retracts it.
78
-
79
- - Read each requirement as written: a narrower reading is unmet, and one unmet stops the sign-off, declared or not. A requirement is in the approved spec or it is not one: a person's later request becomes one once written there and approved. Where its parts disagree on scope, settling it is the owner's: ask, and hold the acceptance.
80
- - Your role prompt carries the `goal-red-team` dispatch, before you decide the acceptance. On a root the requirements go to it at the version its gate approved. On a child they go to it at the version its parent's review approved.
81
- - A child's result against one of your checks proves nothing: it was recorded at the child's head and not at yours. A child carrying part of a root requirement proves it with a check of its own, clearing the root's coverage flag.
82
- - An issue with no Verification document, or none holding a `before_merge` check, is a gap the tester and the reviewer name and neither refuses: its spec's delivered items are the requirements, met here or sent back. Checks you write close the `criteria` step where it is gated.
83
- - A finding ask holds the acceptance until it resolves or the controller replies (`skill://legion-architect/references/acceptance.md`).
84
-
85
- Post it as a `dispatch comment` naming each check and its result, then `legion({ op: "sign_off", issue: "<KEY>" })`.
96
+ In `accepting` no worker runs; the issue's own architect accepts it. Read, against the goal, every
97
+ check and every requirement, in the five sources that
98
+ `skill://legion-architect/references/acceptance.md`, "Accepting", lists.
86
99
 
87
- - `sign_off` works only in `accepting` (`SIGNOFF_OUTSIDE_ACCEPTING`), and the daemon refuses it while an issue beneath it is still in the workflow (`SIGNOFF_CHILD_IN_WORKFLOW`, naming each one), so a parent is accepted after its children, on the head of its last round (section 4).
88
- - When no pass stands for a check at that head, or a result contradicts what you read: `request_backward_move` with `issue`, `to` (`implementing` or `testing`) and a `reason` naming the check by its block id. It counts a review round. A `ci_check` run still going, or GitHub unread, is waited for and moves nothing back. A name no run answers is yours to correct in the check's words.
89
- - On every end-game wake (`phase-finished`, `catch-up`, `checks-red`, `review-stuck`), read `gh pr view <n> --json mergeable,mergeStateStatus`, because a `CONFLICTING` pull request gets no CI and no wake. Then, and after acceptance, follow `skill://legion-architect/references/acceptance.md`.
100
+ Run the `goal-red-team` read your role prompt names. Accept only when a pass stands for every
101
+ `before_merge` check at the approved head, every requirement has a check, and none is unmet or read
102
+ narrower than written: post a `dispatch comment` naming each check and its result, then
103
+ `legion({ op: "sign_off", issue: "<KEY>" })`. Otherwise `request_backward_move` with `to`
104
+ (`implementing` or `testing`) and a `reason` naming the check's block id. Wait for a `ci_check` run
105
+ still going; a name no run answers is yours to correct in the check. Finding asks, refusals and
106
+ what follows: `skill://legion-architect/references/acceptance.md`.
90
107
 
91
108
  ## 7. Close
92
109
 
93
- The merge closes the issue once every issue beneath it has left the workflow: for a root, every other issue of its tree. Nothing after it is yours. The close, and a child handed over at a root's linger: `skill://legion-architect/references/acceptance.md`.
110
+ The merge closes the issue once every issue beneath it has left the workflow; nothing after it is
111
+ yours (`skill://legion-architect/references/acceptance.md`, "The close").
94
112
 
95
113
  ## Wake routing
96
114
 
@@ -98,7 +116,11 @@ Handle each delivered wake by its row in `skill://legion-architect/references/wa
98
116
 
99
117
  ## Escalation judgment
100
118
 
101
- - `envoy_publish` to the controller (its topic is on your addressing line) a child that serves no criterion of the root, a need for admission slots, and two trees changing the same code, because only it sees other trees. Handle everything else.
102
- - On a root, a decision that needs the human, yours or a worker's, is a decision block you write, never the worker, because a new version of an approved root spec closes the gate. A child's architect writes no such block in its spec: it sends the decision to the architect above it, and the root architect asks it on the root (`skill://legion-architect/references/decomposition.md`, "Reviewing a child's spec").
103
- - A clear defect the controller hands you is in code your tree owns, so it is work inside the tree. Choose an open pull request or a child by section 1's sizing reasons, with a child (`dispatch issue --parent`) only after the red-team check. Reply under its evidence comment with the issue that carries it. Change no root spec for it: a child's spec is never gated, and a new root-spec version closes the gate (`skill://legion-architect/references/design-gate.md`, "After approval"). Only a fix that would change the root's Summary, its requirements, its checks or its scope is a decision block instead.
104
- - A tool a worker cannot get is yours: a pull request changing `cybermonklabs/legion`'s worker image (`skill://legion-worker/references/tools.md`).
119
+ - Send the controller (its topic is on your addressing line) a child that serves no criterion of
120
+ the root, a need for admission slots, and two trees changing the same code.
121
+ - A clear defect the controller gives you is this tree's work: an open pull request, or a child
122
+ after the red-team check; reply under its evidence comment with the issue that carries it. It
123
+ changes the root spec only where it changes the Summary, a requirement, a check or the scope
124
+ (`skill://legion-architect/references/design-gate.md`, "After approval").
125
+ - A tool a worker cannot get is a pull request to the worker image
126
+ (`skill://legion-worker/references/tools.md`).