@sjawhar/claude-envoy 4.11.0 → 4.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/AGENTS.md +43 -497
  4. package/dist/envoy-channel.js +1 -1
  5. package/legion/skills/legion-architect/SKILL.md +88 -66
  6. package/legion/skills/legion-architect/references/acceptance.md +89 -258
  7. package/legion/skills/legion-architect/references/decomposition.md +94 -213
  8. package/legion/skills/legion-architect/references/design-gate.md +88 -353
  9. package/legion/skills/legion-architect/references/wake-routing.md +51 -43
  10. package/legion/skills/legion-controller/SKILL.md +50 -181
  11. package/legion/skills/legion-controller/references/admission.md +25 -54
  12. package/legion/skills/legion-controller/references/backlog-stewardship.md +23 -119
  13. package/legion/skills/legion-controller/references/consolidation.md +9 -93
  14. package/legion/skills/legion-controller/references/daily-report.md +21 -99
  15. package/legion/skills/legion-controller/references/escalation.md +16 -118
  16. package/legion/skills/legion-controller/references/finding-asks.md +31 -162
  17. package/legion/skills/legion-controller/references/park-asks.md +33 -0
  18. package/legion/skills/legion-controller/references/parked-decisions.md +20 -264
  19. package/legion/skills/legion-controller/references/session.md +26 -84
  20. package/legion/skills/legion-controller/references/slack-mentions.md +18 -134
  21. package/legion/skills/legion-controller/references/triage.md +18 -89
  22. package/legion/skills/legion-controller/references/wakes.md +22 -549
  23. package/legion/skills/legion-controller/references/weekly-audit.md +9 -90
  24. package/legion/skills/legion-oracle/SKILL.md +19 -28
  25. package/legion/skills/legion-retro/SKILL.md +54 -93
  26. package/legion/skills/legion-retro/references/learnings.md +21 -33
  27. package/legion/skills/legion-retro/references/pr-body-content.md +21 -37
  28. package/legion/skills/legion-worker/SKILL.md +50 -64
  29. package/legion/skills/legion-worker/references/ci-checks.md +16 -84
  30. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +34 -93
  31. package/legion/skills/legion-worker/references/default-branch-check.md +22 -60
  32. package/legion/skills/legion-worker/references/findings.md +25 -180
  33. package/legion/skills/legion-worker/references/foreign-path.md +14 -22
  34. package/legion/skills/legion-worker/references/gvisor.md +20 -0
  35. package/legion/skills/legion-worker/references/merge-gate.md +43 -419
  36. package/legion/skills/legion-worker/references/plan-tests.md +8 -28
  37. package/legion/skills/legion-worker/references/pr-body.md +19 -218
  38. package/legion/skills/legion-worker/references/review-threads.md +16 -70
  39. package/legion/skills/legion-worker/references/tools.md +31 -578
  40. package/legion/skills/legion-worker/references/withheld-capability.md +12 -163
  41. package/legion/skills/simplify-settled-diff/SKILL.md +23 -41
  42. package/legion/skills/simplify-settled-diff/references/personas/code-quality-reviewer.md +14 -14
  43. package/legion/skills/simplify-settled-diff/references/personas/code-reuse-reviewer.md +4 -4
  44. package/legion/skills/simplify-settled-diff/references/personas/efficiency-reviewer.md +8 -8
  45. package/package.json +1 -1
  46. package/skills/agent-secrets/SKILL.md +46 -312
  47. package/skills/agent-secrets/references/store-a-secret.md +9 -0
  48. package/skills/approval-review/SKILL.md +20 -76
  49. package/skills/asd-ste100/SKILL.md +43 -85
  50. package/skills/asd-ste100/examples/before-after.md +18 -53
  51. package/skills/dispatch/SKILL.md +1 -1
  52. package/skills/dispatch-writing-specs/SKILL.md +1 -1
  53. package/skills/envoy/SKILL.md +56 -126
  54. package/skills/envoy/references/check-settlement.md +26 -43
  55. package/skills/envoy/references/deliveries.md +26 -144
  56. package/skills/envoy/references/legion.md +12 -45
  57. package/skills/envoy/references/roles.md +11 -9
  58. package/skills/envoy/references/sources.md +13 -25
  59. package/skills/outside-message/SKILL.md +24 -81
  60. package/skills/plain-words/SKILL.md +24 -55
  61. package/skills/thermonuclear-code-quality/SKILL.md +16 -26
  62. package/skills/thermonuclear-deep-review/SKILL.md +22 -31
  63. package/legion/skills/legion-worker/references/cleanup-deletion.md +0 -22
  64. package/legion/skills/legion-worker/references/systematic-rename.md +0 -19
  65. package/skills/asd-ste100/references/writing-rules.md +0 -59
  66. package/skills/plain-words/references/mechanics.md +0 -49
@@ -1,113 +1,32 @@
1
1
  # The weekly audit
2
2
 
3
- Read this on your first turn of each UTC week, whatever woke you, and run the three passes below,
4
- and sum the fourth, before you post the day's report. They are the week's own numbers, beside the
5
- daily ones.
3
+ Read this on your first turn of each UTC week, and run it before that day's report, which carries its numbers. Each number goes beside the command that recounts it.
6
4
 
7
5
  ## The week
8
6
 
9
- The week's boundary is your first turn on or after Monday 00:00 UTC. The window is the seven days
10
- before that boundary: `date -u +%Y-%m-%dT%H:%M:%SZ` prints the time now, and the window runs from
11
- seven days before it to it. Name the window's two times in the report, so a reader can recount.
12
-
13
- You already ran this week when the report issue carries a message of yours from on or after the
14
- boundary whose text names the window. Read the report issue before you start
15
- (`skill://legion-controller/references/daily-report.md`).
7
+ The window is the seven days before your first turn on or after Monday 00:00 UTC (`date -u +%Y-%m-%dT%H:%M:%SZ`); name its two times in the report. It ran already when the report issue holds a message of yours since that boundary that names the window.
16
8
 
17
9
  ## 1. The week's forced creates
18
10
 
19
- A create that went past Dispatch's near-copy refusal with `--force` carries `forced` on its
20
- `issue.created` event, with `past` naming the issues the refusal named. A forced create the
21
- refusal would not have stopped carries nothing, so this is a count of overrides, not of uses of
22
- `--force`. A `past` that is the empty list is a create whose check did not answer: report those
23
- apart, since nobody forced past anything there. Each form reads as itself on the `issue.created`
24
- line: an override ends `forced past <keys>`, and a create whose check did not answer ends
25
- `forced, the near-copy check did not answer`.
11
+ A create that went past Dispatch's near-copy refusal with `--force` ends its `issue.created` line `forced past <keys>`; one whose check did not answer ends `forced, the near-copy check did not answer`. Read the issues created in the window, each line from `dispatch read --issue <KEY> --all-events` (a bare read prints only the last ten events):
26
12
 
27
13
  ```bash
28
14
  dispatch issues --project <PROJECT> --all
29
- dispatch read --issue <KEY> --all-events # read the issue.created line
15
+ dispatch read --issue <KEY> --all-events
30
16
  ```
31
17
 
32
- `--all-events` is not optional: a bare `dispatch read` prints the last ten events alone, and on
33
- any issue with more than ten the `issue.created` line is not printed at all.
34
-
35
- Keep the issues created inside the window, read each one's `issue.created` line, and count by
36
- filer. The line names its writer as `session <id> (<the session's title>)`, and the filer is that
37
- title cut at its last middle dot (`·`), so `Legion implementer · ACME-3` counts as
38
- `Legion implementer`, with every person counted together as one filer. A session that carries no
39
- title prints its id alone and is counted by that id. Report, per filer, how many creates forced
40
- past a refusal and which issues each named, then the no-answer creates as their own line.
41
-
42
- The recount is the same two commands: name them in the report beside the number.
18
+ Count by filer, the line's `session <id> (<title>)` title cut at its last `·` (people count together as one filer, an untitled session by its id): per filer, the overrides with the issues each named, then the no-answer creates apart. The report key is `forced_creates_by_filer`.
43
19
 
44
20
  ## 2. The week's tree sizes
45
21
 
46
- A Legion tree is an open issue with the `legion` label and no ancestor carrying it, with its
47
- descendants. A tree closed inside the window counts at its close.
48
-
49
- ```bash
50
- dispatch issues --project <PROJECT> --label legion --all
51
- dispatch read --issue <KEY> # Referenced by: child_of names its children
52
- dispatch issues --project <PROJECT> --parent <KEY> # the same children, one level at a time
53
- ```
54
-
55
- `Links: child_of` on that read gives the issue's own parent, never its children, so walk down
56
- instead: read the root, take each `child_of` row under `Referenced by:` as a child, and read each
57
- child the same way until a read names none. `dispatch issues --parent` lists one level in one
58
- request and is the shorter walk on a wide tree.
59
-
60
- Count each tree's descendants at any depth, and report the trees in five buckets: 0, 1-2, 3-5,
61
- 6-10, and 11 or more. Count the parked descendants of each bucket too: a descendant in `backlog`
62
- or `icebox`. Name the recount commands beside the numbers, since a reader checks them against
63
- Dispatch's own parent links.
64
-
65
- The report carries the two measures, under the keys `forced_creates_by_filer` and `tree_sizes`.
22
+ A tree is an open `legion`-labelled issue with no labelled ancestor, with its descendants; one closed in the window counts at its close. Walk down from each root with `dispatch issues --project <PROJECT> --parent <KEY> --all`, level by level (`Links: child_of` names the parent, never a child). Report the trees by descendant count at any depth in five buckets, 0, 1-2, 3-5, 6-10 and 11 or more, with each bucket's parked (`backlog`, `icebox`) descendants. The report key is `tree_sizes`.
66
23
 
67
24
  ## 3. The nudges
68
25
 
69
- Ask the architect of each tree the counts name to fold what can ride in an open pull request.
70
- Both rules below count only a tree with at least one open descendant, a descendant whose status
71
- is not `done`. A tree whose descendants are all closed has nothing left to fold, and a nudge
72
- sent to one asks its architect to fold work that is already finished.
73
-
74
- - a tree with at least one open descendant, and more than 8 descendants in all or more than 2
75
- levels below its root;
76
- - a tree with at least one open descendant that filed a child no red-team verdict names. Each
77
- architect posts its verdict on its own issue, the issue it files its children under: a comment
78
- whose first line reads `Red-team verdict for <issue key>:`, with that issue's key
79
- (`skill://legion-architect/references/decomposition.md`). The root's architect posts on the
80
- root, and a child's own architect posts on that child. So read the verdicts on every
81
- architect's issue of the tree, not only the root's: the root and each issue of the tree that has
82
- children. Read each one's comments with `dispatch read --issue <KEY> --all-events` and the
83
- replies under each verdict comment. A child named in none of the tree's verdicts was filed
84
- without the check.
85
-
86
- Count no child created before that first line existed. The architects write it from the Legion
87
- release that carries this file, so every child filed before then has no verdict comment to
88
- find and is not evidence of a skipped check: read the release's own publication time from its
89
- tag and leave out every child created at or before it. Without that, the first run of this
90
- pass nudges nearly every tree that has children. Until a release carries this file, there is
91
- no such tag to read: when `git tag --contains <the commit that added this file>` names no
92
- release, the cutoff is the time of your run, so every child that exists counts as filed
93
- before the rule and no tree is nudged for a missing verdict yet.
94
-
95
- Each nudge is one `dispatch comment` on the tree's root, naming what you counted and asking the
96
- architect to fold what can ride in an open pull request of the tree. End the comment with
97
- `descendants: <n>, levels: <m>`, the counts you sent it at. When the daemon's state names an
98
- architect for the tree (`read_state`'s `issues.<KEY>`), send the same text to that architect's
99
- role topic with `envoy_publish`.
100
-
101
- Send no new comment to a tree whose architect replied in the thread of your newest nudge comment
102
- there, until the tree's descendants pass the number that comment ends with. A tree whose children
103
- were all filed before the verdict's first line existed has no such comment and is nudged once;
104
- the architect's reply then settles it until the tree grows.
26
+ Nudge the architect of each tree with at least one open descendant that has more than 8 descendants or more than 2 levels below its root, or that filed a child no red-team verdict names. Each architect posts its verdict on the issue it files children under, a comment whose first line reads `Red-team verdict for <issue key>:`, so read every such issue of the tree (`--all-events`). Count no child created before the first release that carries this rule.
105
27
 
106
- List every nudge you sent in the day's report.
28
+ A nudge is one `dispatch comment` on the root naming what you counted and asking the architect to fold what can ride in an open pull request, ending `descendants: <n>, levels: <m>`; send the same text to the architect's role topic when `read_state` names one. Send no new nudge to a tree whose architect replied to your newest one until its descendants pass that `<n>`. List each nudge in the report.
107
29
 
108
30
  ## 4. The duplicate audit
109
31
 
110
- The consolidation pass runs it every six hours
111
- (`skill://legion-controller/references/consolidation.md`). The week's report sums the three counts
112
- over the week's sections of the report issue's `consolidation.md` artifact (`dispatch doc-read
113
- --issue <REPORT KEY> --artifact consolidation.md`).
32
+ Sum the three counts of the week's sections of the report issue's `consolidation.md` (`skill://legion-controller/references/consolidation.md`), with the artifact's link.
@@ -5,44 +5,35 @@ description: Use when you are about to ask a human a question about a pattern, c
5
5
 
6
6
  # Legion Oracle
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
- Which questions to research and which to put to a person, and what your answer must say about
11
- what you searched: `skill://dispatch-first`, "Research before you ask". The steps below are how
12
- you research in a Legion repository.
8
+ Which questions to research, which to put to a person, and what your answer says about what you
9
+ searched: `skill://dispatch-first`, "Research before you ask". These are the research steps in a
10
+ Legion repository.
13
11
 
14
12
  ## Research steps
15
13
 
16
- If the deployment instructions (the `# Deployment instructions` part of your system prompt, from
17
- `legion.yaml`'s `instructions:`) name a role and say it answers research questions (a role, not the
18
- `oracle` task agent), send your question to it first with
19
- `envoy_publish(topic="notifications.role.<name>", expects_reply="required")`, because that role may
20
- already hold the answer. Then end your turn: the reply arrives as a delivery that starts your next
21
- one, and research before it duplicates the role's work. If no live session holds the role, the
22
- publish answers that Envoy kept the question for one hour, until its `kept_until`, and the next
23
- session to hold the role live in that hour is handed it once. If none does, Envoy drops it, and
24
- when your publish named your session, sends your session a message that names it, unless it
25
- dropped it more than an hour late. Nobody can answer you now, so put that kept answer in your
26
- output and research at once rather than wait for it.
27
-
28
- Run steps 1 and 2, in parallel if you choose, since neither needs the other's result. Run step 3
29
- when the question names a library, and step 4 when it asks for general practice, each only when
30
- steps 1 and 2 give no `file:line` source for some part of the question. Use only `read`, `grep`,
31
- `web_search`, the `envoy_publish` above, and `task` with `scout` or `oracle`: the daemon's boot
32
- gate checks that the agents Legion's prompts name exist, and no other. A `task` runs as a job of
33
- its own, so `wait` for its result — two dispatched together are two results to wait for — and
34
- answer from what came back, never from the dispatch.
14
+ If your deployment instructions name a role that answers research questions, send it the question
15
+ first with `envoy_publish(topic="notifications.role.<name>", expects_reply="required")` and end
16
+ your turn: the reply starts your next one. When the publish says Envoy only kept the question
17
+ because no session holds the role, put the publish's answer in your output and research at once.
18
+
19
+ Run steps 1 and 2, in parallel if you like. Run step 3 when the question names a library, and
20
+ step 4 when it asks for general practice, each only where steps 1 and 2 give no `file:line` source
21
+ for some part of the question. Use only `read`, `grep`, `web_search`, `envoy_publish`, and `task`
22
+ with `scout` or `oracle`: the daemon's boot gate checks that the agents Legion's prompts name
23
+ exist. Each `task` runs as a job of its own: `wait` for each result and answer from what came back.
35
24
 
36
25
  | Step | Tool | Query |
37
26
  |------|------|-------|
38
27
  | 1. Institutional learnings | `grep`, then `read`, over `docs/solutions/` (front-matter `tags` first, then the body) | each name the question gives (module, file, function, error text), then two or three words for the problem |
39
28
  | 2. Codebase patterns | `task(agent="scout")` for a read-only search; `task(agent="oracle")` when scout's answer spans two or more modules or shows patterns that disagree | how [module] handles [topic] |
40
29
  | 3. Framework docs | `web_search`, then `read` the library's official docs page | [library] docs [topic] |
41
- | 4. External practices | `web_search`, then `read` what the tool's or standard's maintainer publishes (docs, RFC, changelog); give its URL | current practice for [topic] |
30
+ | 4. External practices | `web_search`, then `read` what the tool's or standard's maintainer publishes; give its URL | current practice for [topic] |
42
31
 
43
- Before you rely on a step 1 hit, `grep` `docs/solutions/` for its path. If another file lists that path under its front-matter `supersedes:` key (on that line or as a list item below it), use that file instead; if one has a line `Extends docs/solutions/<hit path>`, read both. The "Documentation" section of the repository's `AGENTS.md` names the pages whose rule a later rule replaces: for a hit on one of them, follow the rule that section names. Nothing else reconciles these links.
32
+ Before you rely on a step 1 hit, `grep` `docs/solutions/` for its path. If another file lists that
33
+ path under its front-matter `supersedes:` key, use that file instead; if one has a line
34
+ `Extends docs/solutions/<hit path>`, read both. For a hit on a page the "Documentation" section of
35
+ the repository's `AGENTS.md` names as replaced, follow the rule that section names.
44
36
 
45
37
  ## Output
46
38
 
47
- Report as `skill://dispatch-first` says, and name `docs/solutions/` and the codebase queries you
48
- ran, so the reader knows what was searched.
39
+ Report as `skill://dispatch-first` says, naming `docs/solutions/` and the codebase queries you ran.
@@ -5,83 +5,56 @@ description: "Use when the Legion daemon starts you, the implementer, on `Phase:
5
5
 
6
6
  # Legion retro
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
- Retro runs on the reviewed head, after the architect's acceptance and before the merger merges it
11
- (`skill://legion-worker/references/merge-gate.md` has the whole order).
12
- `<issue>` is your `LEGION_ISSUE`.
13
- Run steps 1-6 even when the change looks mechanical; each gives its reason.
14
-
15
- Retro commits nothing and pushes nothing: every handoff is a record on the Dispatch issue, no
16
- commit carries one, and what the work taught is a `dispatch comment` on the issue, for the skill
17
- librarian to read. `docs/solutions/` stays as history, and no role writes there.
18
- The head the merger names is the head the reviewer approved.
19
-
20
- ## What sends the issue back here
21
-
22
- Nothing does.
23
- No Legion check compares the head that merges with the one the review approved, so whether a push
24
- made after the approval must be reviewed again is the repository's own rule, and no handoff is a
25
- commit, so no head carries one for a retro to remove.
26
-
27
- Work on the existing issue branch: never rebase it onto another base, never make another branch or
28
- bookmark, and push nothing, because the merger merges this branch's head and a push of yours
29
- would put a commit above the head the reviewer approved.
8
+ Retro runs on the reviewed head, between the architect's acceptance and the merger's merge.
9
+ `<issue>` is your `LEGION_ISSUE`. Run every step, even on a mechanical change.
10
+
11
+ Retro commits nothing and pushes nothing: the merger merges the branch's head, and a push would put
12
+ a commit above the head the reviewer approved. No Legion check compares the head that merges with
13
+ the one the review approved, so whether a push after the approval needs a new review is the
14
+ repository's own rule. Never rebase the branch or make another branch or bookmark.
15
+ Retro writes no handoff. In the workspace it changes nothing; outside it, it writes only step 4's
16
+ `mktemp -d` directory, the PR body and the Dispatch comment and message. It sets no GitHub or
17
+ Dispatch label: Legion keeps phase state in the daemon.
18
+ What the work taught is a `dispatch comment` for the skill librarian; no role writes to
19
+ `docs/solutions/`.
30
20
 
31
21
  ## When retro stops
32
22
 
33
23
  When a step fails (the body cannot be computed, read or written, or Dispatch refuses a write), do
34
- not call `handoff_complete`. Report it with `envoy_publish` to the architect's
35
- topic in the `Legion addressing` line of your system prompt, with the command and its output. A
36
- check with no pass standing at the head goes back as step 1 says. A defect you find in the work at
37
- any other step goes to the architect with its evidence, and you hold your completion until the
38
- architect answers: while retro holds the phase, `request_backward_move` is yours to make, and your
39
- `handoff_complete` moves the issue to `merging`, which takes that move from you. End each turn of
40
- that hold with a WAITING line naming the defect and the architect's answer you wait on. The
41
- Dispatch message (step 5) is for a finished retro only.
24
+ not call `handoff_complete`: send the command and its output to the architect's topic on your
25
+ `Legion addressing` line. A defect you find in the work goes to the architect with its evidence,
26
+ and you hold your completion until it answers: while retro holds the phase,
27
+ `request_backward_move` is yours, and `handoff_complete` takes it away. End each turn of that hold
28
+ with a WAITING line naming the defect and the answer you wait on.
42
29
 
43
30
  ## Steps
44
31
 
45
- 1. **Read the evidence:** the issue, its checks (`dispatch results --issue <issue>`), the pull
46
- request, and the tester's and reviewer's handoffs
47
- (`dispatch handoff-read --issue <issue> --phase test`, then the review
48
- at the version your task's `Handoff:` line names, `--phase review --version <n>`, the command
49
- that line quotes). A pass stands for every `before_merge` check of the issue at the approved
50
- head, from the implementer and from the tester alike, and the pull request
51
- body's `Checks` block carries each of those lines. A check carrying `ci_check` is CI's: the
52
- result that `dispatch results` derives is the pass it needs, and its CI job is its evidence
53
- (`skill://legion-worker/references/ci-checks.md`). In
54
- cybermonklabs/legion a surface may also be the daemon's real-process tests, a live proof under
55
- `scripts/e2e/`, or a live check at the operator's next daemon restart recorded on the pull
56
- request. A `ci_check` check has no pass standing at that head when its derived result is a
57
- fail, or its run concluded `skipped`, `neutral` or `cancelled`. Wait for a run that has not
58
- concluded, and read again where GitHub could not be read. Send a name that no run answers
59
- (`absent`) to the architect as a finding, because the words of the check are wrong. Neither
60
- wait nor that finding moves the issue back. A check whose `run` is a whole test suite has wrong
61
- words too: send it to the architect the same way, and it moves the issue back no more than that
62
- finding does. When any other check has no pass standing at that head, or
63
- a check with no `ci_check` has a unit suite as its only evidence, call the `legion` tool's
64
- `request_backward_move` with `to: implementing` for the implementer's result or a `ci_check`
65
- check, or `to: testing` for the tester's result, its `reason` naming the check by its block
66
- id. When
67
- retro runs again, that gap is your first learning.
68
- 2. **Get a second reading**, because a reader without your context sees what you stopped seeing.
69
- First list, in your session, the constraints the issue did not state, choices between two
70
- working options, approaches you abandoned, and code another issue could reuse, so the second
71
- answer does not set your list. Then run `task(agent="oracle")` (read-only) with the issue, the
72
- pull request body and the diff in its brief, asking for reusable learnings, and `wait` for its
73
- answer, since it runs as a job of its own. You decide which points to keep. Drop a point that
74
- cites no file, symbol, quoted text or commit of this pull request.
75
- 3. **Record the learnings.** Write each kept point you can state as a rule a worker on another
76
- issue could follow as one `dispatch comment` on the issue, per
77
- `skill://legion-retro/references/learnings.md`, which says what a point must carry for the
78
- skill librarian to use it. When none qualifies, say so in that comment's place in step 5's
79
- message and write no comment.
80
- 4. **Update the PR body**, per `skill://legion-retro/references/pr-body-content.md`,
81
- when the repository derives body lines from changed paths.
82
- 5. **Post one Dispatch message on the issue**, the record of the retro that the architect reads.
83
- No `gh issue` write: Legion issues live on Dispatch. The body is at most 32,000 characters,
84
- Dispatch's message limit, and ends with your attribution footer:
32
+ 1. **Read the evidence**: the issue, `dispatch results --issue <issue>`, the pull request, the
33
+ tester's handoff (`dispatch handoff-read --issue <issue> --phase test`) and the review at the
34
+ version your task's `Handoff:` line names (`--phase review --version <n>`). A pass must stand at
35
+ the approved head for every `before_merge` check, and the body's `Checks` block carries each.
36
+ - A check carrying `ci_check` is CI's: its derived result is the pass it needs
37
+ (`skill://legion-worker/references/ci-checks.md`). A `ci_check` check has no pass standing at
38
+ that head when its derived result is a fail, or its run concluded `skipped`, `neutral` or
39
+ `cancelled`. Wait for a run that has not concluded, and read again where GitHub could not be
40
+ read. Send a name that no run answers (`absent`) to the architect as a finding, since the
41
+ check's words are wrong, and the same for a check whose `run` is a whole test suite. Neither
42
+ wait nor that finding moves the issue back.
43
+ - Any other check with no pass standing, or a check with no `ci_check` whose only evidence is a
44
+ unit suite: `request_backward_move` with `to: implementing` for the implementer's result or a
45
+ `ci_check` check, or `to: testing` for the tester's, its `reason` naming the check's block id.
46
+ 2. **Get a second reading.** First list in your session the constraints the issue did not state,
47
+ choices between two working options, abandoned approaches and reusable code. Then run
48
+ `task(agent="oracle")` with the issue, the pull request body and the diff, asking for reusable
49
+ learnings, and `wait` for its answer. Drop a point that cites no file, symbol, quoted text or
50
+ commit of this pull request.
51
+ 3. **Record the learnings** as one `dispatch comment` on the issue, per
52
+ `skill://legion-retro/references/learnings.md`. When no point qualifies, write no comment and
53
+ say so in step 5's message.
54
+ 4. **Update the PR body**, per `skill://legion-retro/references/pr-body-content.md`, when the
55
+ repository derives body lines from changed paths.
56
+ 5. **Post one Dispatch message on the issue**, at most 32,000 characters (never a `gh issue`
57
+ write):
85
58
 
86
59
  ```bash
87
60
  dispatch message --issue '<KEY>' --body-file - <<'EOF'
@@ -102,32 +75,20 @@ Dispatch message (step 5) is for a finished retro only.
102
75
  EOF
103
76
  ```
104
77
 
105
- The merge's close hands the production check's first look to the role the project's
106
- `production_check` setting names — the tester, unless the setting is `off`, where the close
107
- opens no check at all — so it reaches that role's session, not yours, and the look after it is
108
- the one that look's own `wake_at` names
109
- (`skill://legion-worker/references/merge-gate.md#the-production-check-after-the-close`).
110
78
  6. **Complete** with the `legion` tool's `handoff_complete`, its summary two sentences for the
111
- architect. It reports the commit your workspace stands on, which is the head you found: retro
112
- writes no handoff and makes no commit. In the workspace retro changes nothing; outside it, it
113
- writes only step 4's `mktemp -d` directory, the PR body and the Dispatch comment and message.
114
- It sets no GitHub or Dispatch label: Legion keeps phase state in the daemon, not in labels.
115
- In the same call, rate the plan the issue ran: its steps and the role that worked each, not the
116
- planner's `plan.md`. Send both or neither of `plan_rating`, a whole number from 1 (the plan cost
117
- the work) to 5 (the plan fit the work), and `plan_reason`, one sentence of why from step 1's
118
- evidence. The daemon refuses this completion without them (`PLAN_RATING_REQUIRED`), one alone,
119
- a rating off that scale or a reason blank or over 2,000 characters (`PLAN_RATING_INPUT`), and
120
- both on any other completion (`PLAN_RATING_UNEXPECTED`). A refusal records nothing, so complete
121
- again. A `legion` tool whose `handoff_complete` takes neither field is the release before the
122
- rating: send neither.
79
+ architect. In the same call, rate the plan the issue ran (its steps and the role that worked
80
+ each, not the planner's `plan.md`): send both `plan_rating`, a whole number from 1 (the plan
81
+ cost the work) to 5 (the plan fit the work), and `plan_reason`, one sentence of why from step
82
+ 1's evidence, or neither where your `legion` tool's `handoff_complete` takes neither field. The
83
+ daemon refuses a completion without them (`PLAN_RATING_REQUIRED`), with one alone, a rating off
84
+ that scale or a reason blank or over 2,000 characters (`PLAN_RATING_INPUT`), and with both on
85
+ any other completion (`PLAN_RATING_UNEXPECTED`). A refusal records nothing: complete again.
123
86
 
124
87
  ## Before you complete
125
88
 
126
89
  - `jj -R "$LEGION_WORKSPACE" diff --from "legion/${LEGION_ISSUE:?}@origin" --to @ --name-only`
127
- lists nothing: retro leaves the workspace as it found it, and the merger merges the head the
128
- reviewer approved.
90
+ lists nothing.
129
91
  - Each body line you added or changed that says work was done names work this pull request did.
130
- - The Dispatch comment and the Dispatch message are posted, and the pull request's head is the
131
- head you found.
132
- - Your `handoff_complete` carries `plan_rating` and `plan_reason` (step 6), or neither where your
133
- `legion` tool's `handoff_complete` takes neither.
92
+ - The comment and the message are posted, and the pull request's head is the head you found.
93
+ - Your `handoff_complete` carries `plan_rating` and `plan_reason`, or neither where your `legion`
94
+ tool's `handoff_complete` takes neither.
@@ -1,44 +1,35 @@
1
- # Writing a retro learning as a Dispatch comment
1
+ # Writing a retro learning
2
2
 
3
- Read this at step 3 of `skill://legion-retro`, when you write what the work taught. It is one
4
- `dispatch comment` on the issue, and its reader is the skill librarian, who turns a point into a
5
- rule in a skill, a role prompt or a repository guide. Retro commits nothing:
6
- `docs/solutions/` stays as the history of the rules written before this, and no role writes there.
3
+ Read this at step 3 of `skill://legion-retro`. The learnings are one `dispatch comment` on the
4
+ issue. Its reader is the skill librarian, who turns a point into a rule in a skill, a role prompt
5
+ or a repository guide.
7
6
 
8
7
  ## What a point must carry
9
8
 
10
- Write each kept point as a rule a worker on another issue could follow, and give it:
9
+ - **The rule**, in a few imperative lines, in the present tense, about the work and never about
10
+ this pull request.
11
+ - **The evidence** below the rule: the file and symbol, or text quoted from the file, read at the
12
+ head you commit, and what went wrong before the rule. Never a line number: the next edit above
13
+ it moves it. Where the head no longer shows what your sentence says, quote the text and name the
14
+ commit you read it at.
15
+ - **Where it belongs**: the file a reader would look in, for example
16
+ `skills/legion-worker/references/tools.md`; the librarian decides.
17
+ - **What it replaces**, when an instruction the repository carries is wrong: quote it and its path.
11
18
 
12
- - **The rule**, in a few imperative lines. State it in the present tense, about the work, never
13
- about this pull request.
14
- - **The evidence** below the rule: the file and symbol, or text quoted from the file, read at
15
- the head you commit, and what went wrong before the rule. Never a line number: the next edit
16
- above it moves it. Where the head no longer shows what your sentence says, quote the text and
17
- name the commit you read it at. A reader takes a story as an instruction, so the story never
18
- stands in the rule's place.
19
- - **Where it belongs**: the skill, role prompt or guide a reader would look in — for example
20
- `skills/legion-worker/references/tools.md` or `packages/daemon/internal/prompts/roles/tester.md`.
21
- Name the file; the librarian decides whether to write it there.
22
- - **What it replaces**, when an instruction the repository already carries is wrong: quote that
23
- instruction and its path, so the librarian can find both.
24
-
25
- Drop a point that cites no file, symbol, quoted text or commit of this pull request, and a
26
- point that only restates what a skill already says.
19
+ Drop a point that cites no file, symbol, quoted text or commit of this pull request, and a point
20
+ that only restates what a skill already says.
27
21
 
28
22
  ## Find what already covers the topic
29
23
 
30
- 1. `dispatch search --query '<two or three words naming the topic>'` finds the issues and
31
- comments that hold it, this project's retros included.
32
- 2. Search `docs/solutions/` with the `grep` tool, case-insensitive, for the same words, and read
33
- each hit's H1 and rule: a rule written before this change may already say it, or may say the
34
- opposite, which is itself the point to report.
35
- 3. Search the skills and role prompts the point would change (`skills/`,
36
- `packages/daemon/internal/prompts/`). A rule one of them already states is no learning.
24
+ 1. `dispatch search --query '<two or three words naming the topic>'`.
25
+ 2. The `grep` tool, case-insensitive, over `docs/solutions/`: an older rule may say it already, or
26
+ say the opposite, which is itself the point to report.
27
+ 3. The skills and role prompts the point would change (`skills/`,
28
+ `packages/daemon/internal/prompts/`). A rule one of them states is no learning.
37
29
 
38
30
  ## The comment
39
31
 
40
- One comment holds every kept point, each under its own `###` heading, so the issue carries one
41
- record of the retro rather than a thread of them:
32
+ One comment holds every kept point, each under its own `###` heading:
42
33
 
43
34
  ```bash
44
35
  dispatch comment --issue '<KEY>' --body-file - <<'EOF'
@@ -55,6 +46,3 @@ Replaces: <the instruction and its path>, or nothing.
55
46
  <!-- legion: {"session":"<session-id>","phase":"retro"} -->
56
47
  EOF
57
48
  ```
58
-
59
- When no point qualifies, write no comment and say so in the retro message (step 5 of
60
- `skill://legion-retro`).
@@ -1,56 +1,40 @@
1
1
  # The PR body lines the changed paths require
2
2
 
3
- Read this at step 4 of `skill://legion-retro`. A failure here stops retro as its
4
- *When retro stops* section says.
5
-
6
- ## Bring the body up to date before you complete
7
-
8
- A repository can require body lines derived from the pull request's changed paths (for example one
9
- checklist line when `src/**` changed and another when `docs/**` changed) and have a required check
10
- read them from the body. The body approved earlier in the round may not account for every path the
11
- pull request now changes, so that check fails at the head. The
12
- merger reports a stale body rather than rewriting it, and GitHub will not merge a head whose
13
- required check failed, so the merge waits.
14
-
15
- `<owner>/<repo>` and `<n>` are the pull request's repository and number in every command below.
16
-
17
- 1. Read your system prompt's deployment instructions, the repository's agent guide (`AGENTS.md`,
18
- `CLAUDE.md`), its pull request template (`.github/pull_request_template.md` or
19
- `.github/PULL_REQUEST_TEMPLATE/`), and the workflow under `.github/workflows/` that reads the
20
- body, for lines they require per changed path. When they require none, there is nothing to do.
3
+ Read this at step 4 of `skill://legion-retro`. A failure here stops retro as its "When retro
4
+ stops" says. A repository can require body lines derived from the changed paths, read by a required
5
+ check; the body approved earlier may not cover every path the pull request now changes, and the
6
+ merger reports a stale body rather than rewriting it. `<owner>/<repo>` and `<n>` are the pull
7
+ request's repository and number.
8
+
9
+ 1. Read your deployment instructions, the repository's agent guide (`AGENTS.md`, `CLAUDE.md`), its
10
+ pull request template (`.github/pull_request_template.md` or `.github/PULL_REQUEST_TEMPLATE/`)
11
+ and the workflow under `.github/workflows/` that reads the body, for lines they require per
12
+ changed path. When they require none, stop here.
21
13
  2. List the paths the pull request changes at `<head>`, the approved head your task names:
22
14
 
23
15
  ```bash
24
16
  base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && cd -- "$LEGION_WORKSPACE" && jj -R "$LEGION_WORKSPACE" git fetch && jj -R "$LEGION_WORKSPACE" diff --from "fork_point(${base}@origin | <head>)" --to <head> --name-only
25
17
  ```
26
18
 
27
- `@json` makes `base` a quoted jj string literal; never paste a branch name between quotes
28
- yourself, because a name with a quote or revset character then breaks the command. For each
29
- path pattern the step 1 sources name, write the line they require when a listed path matches
30
- it. A line that says work was done names work this pull request did: retro commits nothing, so
31
- a line whose work is undone is a finding for the architect, not work you do here.
32
- 3. Make a directory outside `$LEGION_WORKSPACE` with `dir=$(mktemp -d)`, the one place you write
33
- outside it: jj would commit a file inside it, and a fixed name in a shared `/tmp` can hold
34
- another session's body. Save the live body as `$dir/before.md` (to restore on failure) and
35
- `$dir/body.md` (to edit), and stop unless the read succeeded and is not empty:
19
+ `@json` quotes `base` as a jj string; never quote a branch name by hand. Write the line each
20
+ matching path pattern requires. A line that says work was done names work this pull request
21
+ did: a line whose work is undone is a finding for the architect.
22
+ 3. Make a directory outside the workspace with `dir=$(mktemp -d)` (jj would commit a file inside
23
+ it), save the live body as `$dir/before.md` and `$dir/body.md`, and stop unless the read
24
+ succeeded and is not empty:
36
25
 
37
26
  ```bash
38
27
  cd -- "$LEGION_WORKSPACE" && ( set -o pipefail && gh api repos/<owner>/<repo>/pulls/<n> --jq .body | tee "$dir/before.md" "$dir/body.md" ) && test -s "$dir/before.md"
39
28
  ```
40
29
 
41
- Without `pipefail` a failed read exits with `tee`'s status and leaves two empty files. The
42
- parentheses keep `pipefail` to this line, since your shell persists and a later `cmd | head`
43
- would exit 141 under it. In `$dir/body.md`, change only the lines the step 1 sources derive
44
- from paths, adding a missing one where they place it. Leave every other line byte for byte,
30
+ The parentheses keep `pipefail` to this line. In `$dir/body.md`, change only the path-derived
31
+ lines, adding a missing one where the sources place it; leave every other line byte for byte,
45
32
  the `Checks` block included.
46
- 4. Write it back:
33
+ 4. Write it back. A body edit changes no commit, so the approval stands:
47
34
 
48
35
  ```bash
49
36
  cd -- "$LEGION_WORKSPACE" && gh api --method PATCH repos/<owner>/<repo>/pulls/<n> -F body=@"$dir/body.md"
50
37
  ```
51
38
 
52
- A body edit changes no commit, so the reviewer's approval stands, and a check that judges the
53
- body runs again at once on the head as it is.
54
-
55
- When the write back is refused, or the check it feeds fails, report it to the architect as *When
56
- retro stops* says, with the command and its output.
39
+ When the write is refused, or the check it feeds fails, report it to the architect with the
40
+ command and its output.