@sjawhar/claude-envoy 5.12.5 → 5.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/dist/codex-hook.js +8 -8
  4. package/dist/dispatch.js +8 -8
  5. package/dist/envoy-channel.js +52 -18
  6. package/dist/session-hook.js +8 -8
  7. package/legion/skills/legion-architect/SKILL.md +76 -84
  8. package/legion/skills/legion-architect/references/acceptance.md +83 -79
  9. package/legion/skills/legion-architect/references/decomposition.md +73 -77
  10. package/legion/skills/legion-architect/references/design-gate.md +1 -1
  11. package/legion/skills/legion-architect/references/plan-changes.md +30 -0
  12. package/legion/skills/legion-architect/references/plan.md +66 -0
  13. package/legion/skills/legion-architect/references/wake-routing.md +28 -27
  14. package/legion/skills/legion-controller/references/admission.md +34 -10
  15. package/legion/skills/legion-controller/references/daily-report.md +57 -17
  16. package/legion/skills/legion-retro/SKILL.md +65 -60
  17. package/legion/skills/legion-retro/references/pr-body-content.md +22 -23
  18. package/legion/skills/legion-worker/SKILL.md +89 -21
  19. package/legion/skills/legion-worker/references/ci-checks.md +28 -7
  20. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +1 -1
  21. package/legion/skills/legion-worker/references/merge-gate.md +64 -25
  22. package/legion/skills/legion-worker/references/pr-body.md +22 -29
  23. package/legion/skills/legion-worker/references/results.md +50 -0
  24. package/legion/skills/legion-worker/references/review-threads.md +19 -4
  25. package/package.json +2 -2
@@ -1,63 +1,66 @@
1
1
  ---
2
2
  name: legion-retro
3
- description: "Use when the Legion daemon starts you, the implementer, on `Phase: retro` after the architect accepted the reviewed head."
3
+ description: "Use when the Legion daemon starts you, the implementer, on `Phase: retro` after the task's last step passed."
4
4
  ---
5
5
 
6
6
  # Legion retro
7
7
 
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.
8
+ Retro runs after the task's last step, between that step and the merger's merge.
9
+ The architect's acceptance precedes it only where the task names `acceptance:owner`.
10
+ `<issue>` is your `LEGION_ISSUE`.
11
+ Run every step, even on a mechanical change.
10
12
 
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. Outside a forward merge of the base, no Legion check
13
- compares the head that merges with the one the review approved. Never rebase the branch or make
14
- 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/`.
13
+ Retro commits nothing and pushes nothing: the merger merges the branch's head, and a push would put a commit above the head the last worker step passed.
14
+ Outside a forward merge of the base, no Legion check compares the head that merges with a review's head.
15
+ Never rebase the branch or make another branch or bookmark.
16
+ Retro writes no handoff.
17
+ In the workspace it changes nothing; outside it, it writes only step 4's `mktemp -d` directory, the PR body, the Dispatch comment and message, and, with no reviewer step, the review-thread replies and resolutions of step 1.
18
+ It sets no GitHub or Dispatch label: Legion keeps phase state in the daemon.
19
+ What the work taught is a `dispatch comment` for the skill librarian; no role writes to `docs/solutions/`.
20
20
 
21
21
  ## When retro stops
22
22
 
23
- When a step fails (the body cannot be computed, read or written, or Dispatch refuses a write), do
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.
23
+ When a step fails (the body cannot be computed, read or written, or Dispatch refuses a write), do not call `handoff_complete`:
24
+ send the command and its output to the architect's topic on your `Legion addressing` line.
25
+ A defect you find in the work, other than a bot thread that step 1 sends back, goes to the architect with its evidence, and you hold your completion until it answers:
26
+ while retro holds the phase, `request_backward_move` is yours, and `handoff_complete` takes it away.
27
+ End each turn of that hold with a WAITING line naming the defect and the answer you wait on.
29
28
 
30
29
  ## Steps
31
30
 
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
- - A `ci_check` check whose derived result is a fail is the merger's: the change is accepted,
44
- and the merger decides at the merge whether the base or the change broke it. Name it in your
45
- retro message and complete.
46
- - Any other check with no pass standing, or a check with no `ci_check` whose only evidence is a
47
- unit suite: `request_backward_move` with `to: implementing` for the implementer's result, or
48
- `to: testing` for the tester's, its `reason` naming the check's block id.
49
- 2. **Get a second reading.** First list in your session the constraints the issue did not state,
50
- choices between two working options, abandoned approaches and reusable code. Then run
51
- `task(agent="oracle")` with the issue, the pull request body and the diff, asking for reusable
52
- learnings, and `wait` for its answer. Drop a point that cites no file, symbol, quoted text or
53
- commit of this pull request.
54
- 3. **Record the learnings** as one `dispatch comment` on the issue, per
55
- `skill://legion-retro/references/learnings.md`. When no point qualifies, write no comment and
56
- say so in step 5's message.
57
- 4. **Update the PR body**, per `skill://legion-retro/references/pr-body-content.md`, when the
58
- repository derives body lines from changed paths.
59
- 5. **Post one Dispatch message on the issue**, at most 32,000 characters (never a `gh issue`
60
- write):
31
+ 1. **Read the evidence**: the issue, `dispatch results --issue <issue>`, the pull request, and the implementer's handoff.
32
+ Also read the tester's handoff (`dispatch handoff-read --issue <issue> --phase test`) where it has a tester step, and the review at the version your task's `Handoff:` line names (`--phase review --version <n>`) where it has a reviewer step.
33
+ A pass must stand at the last worker step's head for every `before_merge` check, and the body's `Checks` block carries each.
34
+
35
+ - A check carrying `ci_check` is CI's: its derived result is the pass it needs (`skill://legion-worker/references/ci-checks.md`).
36
+ A `ci_check` check has no pass standing at that head when its derived result is a fail, or its run concluded `skipped`, `neutral` or `cancelled`.
37
+ A run that has not concluded, or one GitHub could not be read for, is neither a pass nor a fail yet: never wait for, watch or poll it, as your role prompt says of CI.
38
+ Name each run that has not concluded, with the time you read it, in step 5's `Runs still going` line, and go on; when CI settles, the daemon tells the architect and the worker of the phase the issue then stands in.
39
+ Send a name that no run answers (`absent`) to the architect as a finding, since the check's words are wrong, and the same for a check whose `run` is a whole test suite.
40
+ Neither that run nor that finding moves the issue back.
41
+
42
+ - A `ci_check` check whose derived result is a fail is the merger's: the change is accepted, and the merger decides at the merge whether the base or the change broke it.
43
+ Name it in your retro message and complete.
44
+
45
+ - Any other check with no pass standing, or a check with no `ci_check` whose only evidence is a unit suite:
46
+ `request_backward_move` with `to: implementing` for the implementer's result, or, where the task has a tester step, `to: testing` for the tester's result;
47
+ name the check's block id in the reason.
48
+
49
+ - With no reviewer step, list the unresolved bot threads and answer the ones you find, as `skill://legion-worker/references/review-threads.md` says.
50
+ For a thread that needs a fix, `request_backward_move` with `to: implementing`, the thread's URL in its `reason`.
51
+
52
+ 2. **Get a second reading.**
53
+ First list in your session the constraints the issue did not state, choices between two working options, abandoned approaches and reusable code.
54
+ Then run `task(agent="oracle")` with the issue, the pull request body and the diff, asking for reusable learnings, and `wait` for its answer.
55
+ Drop a point that cites no file, symbol, quoted text or commit of this pull request.
56
+
57
+ 3. **Record the learnings** as one `dispatch comment` on the issue, per `skill://legion-retro/references/learnings.md`.
58
+ When no point qualifies, write no comment and say so in step 5's message.
59
+
60
+ 4. **Update the PR body** per `skill://legion-retro/references/pr-body-content.md`: the lines the repository derives from changed paths, where it derives any.
61
+ With no reviewer step, also record step 1's bot threads in `Threads` at the head you found, and bring `Not proven / risk` up to date from the tester's handoff where the task has one, naming each check whose run has not concluded (`skill://legion-worker/references/pr-body.md`, "The brief for the human").
62
+
63
+ 5. **Post one Dispatch message on the issue**, at most 32,000 characters (never a `gh issue` write):
61
64
 
62
65
  ```bash
63
66
  dispatch message --issue '<KEY>' --body-file - <<'EOF'
@@ -68,7 +71,11 @@ with a WAITING line naming the defect and the answer you wait on.
68
71
  **Key takeaways:**
69
72
  - <one to three reusable lessons>
70
73
 
71
- **Results read:** implementer <check and result>, tester <check and result>.
74
+ **Results read:** implementer <check and result>, tester <check and result, where the task has a tester step>.
75
+
76
+ **Declined threads:** <with no reviewer step, each bot thread step 1 declined, by node id with its reason, or none>
77
+
78
+ **Runs still going:** <each run whose check had not concluded when you read `dispatch results`, by its name with the time you read it, and that it may open more bot threads; or none>
72
79
 
73
80
  **Production check:** <the command or user action that will show the change working in production>
74
81
  **Carried by:** <the deploy or restart that carries the merge there>
@@ -78,20 +85,18 @@ with a WAITING line naming the defect and the answer you wait on.
78
85
 
79
86
  A Dispatch comment or message never carries the `<!-- legion: … -->` footer. Dispatch records the session that wrote it, and only a pull-request comment or review needs the footer.
80
87
 
81
- 6. **Complete** with the `legion` tool's `handoff_complete`, its summary two sentences for the
82
- architect. In the same call, rate the plan the issue ran (its steps and the role that worked
83
- each, not the planner's `plan.md`): send both `plan_rating`, a whole number from 1 (the plan
84
- cost the work) to 5 (the plan fit the work), and `plan_reason`, one sentence of why from step
85
- 1's evidence, or neither where your `legion` tool's `handoff_complete` takes neither field. The
86
- daemon refuses a completion without them (`PLAN_RATING_REQUIRED`), with one alone, a rating off
87
- that scale or a reason blank or over 2,000 characters (`PLAN_RATING_INPUT`), and with both on
88
- any other completion (`PLAN_RATING_UNEXPECTED`). A refusal records nothing: complete again.
88
+ 6. **Complete** with the `legion` tool's `handoff_complete`, its summary two sentences for the architect.
89
+ In the same call, rate the plan the issue ran (its steps and the role that worked each, not the planner's `plan.md`):
90
+ send both `plan_rating`, a whole number from 1 (the plan cost the work) to 5 (the plan fit the work), and `plan_reason`, one sentence of why from step 1's evidence, or neither where your `legion` tool's `handoff_complete` takes neither field.
91
+ The daemon refuses a completion without them (`PLAN_RATING_REQUIRED`), with one alone, a rating off that scale or a reason blank or over 2,000 characters (`PLAN_RATING_INPUT`), and with both on any other completion (`PLAN_RATING_UNEXPECTED`).
92
+ A refusal records nothing: complete again.
89
93
 
90
94
  ## Before you complete
91
95
 
92
- - `jj -R "$LEGION_WORKSPACE" diff --from "legion/${LEGION_ISSUE:?}@origin" --to @ --name-only`
93
- lists nothing.
96
+ - `jj -R "$LEGION_WORKSPACE" diff --from "legion/${LEGION_ISSUE:?}@origin" --to @ --name-only` lists nothing.
97
+
94
98
  - Each body line you added or changed that says work was done names work this pull request did.
99
+
95
100
  - The comment and the message are posted, and the pull request's head is the head you found.
96
- - Your `handoff_complete` carries `plan_rating` and `plan_reason`, or neither where your `legion`
97
- tool's `handoff_complete` takes neither.
101
+
102
+ - Your `handoff_complete` carries `plan_rating` and `plan_reason`, or neither where your `legion` tool's `handoff_complete` takes neither.
@@ -1,40 +1,39 @@
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 "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.
13
- 2. List the paths the pull request changes at `<head>`, the approved head your task names:
3
+ Read this at step 4 of `skill://legion-retro`.
4
+ A failure here stops retro as its "When retro stops" says.
5
+ A repository can require body lines derived from the changed paths, read by a required check;
6
+ the body written earlier may not cover every path the pull request now changes, and the merger reports a stale body rather than rewriting it.
7
+ `<owner>/<repo>` and `<n>` are the pull request's repository and number.
8
+
9
+ 1. Read your deployment instructions, the repository's agent guide (`AGENTS.md`, `CLAUDE.md`), its pull request template where it has one (`.github/pull_request_template.md` or `.github/PULL_REQUEST_TEMPLATE/`) and the workflow under `.github/workflows/` that reads the body, for lines they require per changed path.
10
+ When they require none, skip step 2, and stop here unless the task has no reviewer step (step 4 of `skill://legion-retro`).
11
+
12
+ 2. List the paths the pull request changes at `<head>`, the head the task's last step passed (step 1 of `skill://legion-retro`):
14
13
 
15
14
  ```bash
16
15
  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
17
16
  ```
18
17
 
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:
18
+ `@json` quotes `base` as a jj string; never quote a branch name by hand.
19
+ Write the line each matching path pattern requires.
20
+ A line that says work was done names work this pull request did: a line whose work is undone is a finding for the architect.
21
+
22
+ 3. Make a directory outside the workspace with `dir=$(mktemp -d)` (jj would commit a file inside it), save the live body as `$dir/before.md` and `$dir/body.md`, and stop unless the read succeeded and is not empty:
25
23
 
26
24
  ```bash
27
25
  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"
28
26
  ```
29
27
 
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,
32
- the `Checks` block included.
33
- 4. Write it back. A body edit changes no commit, so the approval stands:
28
+ The parentheses keep `pipefail` to this line.
29
+ In `$dir/body.md`, change only the path-derived lines, adding a missing one where the sources place it, and with no reviewer step the `Not proven / risk` and `Threads` lines (step 4 of `skill://legion-retro`);
30
+ leave every other line byte for byte, the `Checks` block included, except a no-result line, which you replace as `skill://legion-worker/references/ci-checks.md` says.
31
+
32
+ 4. Write it back.
33
+ A body edit changes no commit, so no result or approval at the head moves:
34
34
 
35
35
  ```bash
36
36
  cd -- "$LEGION_WORKSPACE" && gh api --method PATCH repos/<owner>/<repo>/pulls/<n> -F body=@"$dir/body.md"
37
37
  ```
38
38
 
39
- When the write is refused, or the check it feeds fails, report it to the architect with the
40
- command and its output.
39
+ When the write is refused, or the check it feeds fails, report it to the architect with the command and its output.
@@ -9,57 +9,125 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
9
9
 
10
10
  ## Every phase
11
11
 
12
- 1. Read the issue, then your task, then each earlier phase's handoff (`dispatch handoff-read --issue <issue> --phase <plan|implement|test|review>`). Your architect's decisions for you come in your task and your messages: read no other document for them. A record beats your memory.
12
+ 1. Read the issue, then your task, then each earlier phase's handoff (`dispatch handoff-read --issue <issue> --phase <plan|implement|test|review>`).
13
+ Your architect's decisions for you come in your task and your messages: read no other document for them.
14
+ A record beats your memory.
15
+
13
16
  2. Commit only your phase's paths: `jj -R "$LEGION_WORKSPACE" split -m "<message>" <paths…>`.
14
- 3. Before you write the handoff, run `jj -R "$LEGION_WORKSPACE" status` and remove or restore every file you copied in that is not your phase's work: another role that commits next sets aside whatever the working copy holds.
15
- 4. Every role writes the one workspace, so a file can change under your check. Run checks from a copy of the head (`git archive`, or a clone under `$TMPDIR`) where you can, and run `git diff --quiet <head> -- <files the check reads>` before you record a result. A script that fails in the workspace is a finding only when it fails again with `sha256sum <script>` unchanged just before and after. A run whose output you did not capture can be neither confirmed nor cleared.
17
+
18
+ 3. Before you write the handoff, run `jj -R "$LEGION_WORKSPACE" status` and remove or restore every file you copied in that is not your phase's work:
19
+ another role that commits next sets aside whatever the working copy holds.
20
+
21
+ 4. Every role writes the one workspace, so a file can change under your check.
22
+ Run checks from a copy of the head (`git archive`, or a clone under `$TMPDIR`) unless the check needs the workspace itself, and run `git diff --quiet <head> -- <files the check reads>` before you record a result.
23
+ A script that fails in the workspace is a finding only when it fails again with `sha256sum <script>` unchanged just before and after.
24
+ A run whose output you did not capture can be neither confirmed nor cleared.
25
+
16
26
  5. A codebase-wide rename or deletion leaves historical records (transcripts, test snapshots, changelog entries) unchanged.
17
27
 
18
28
  ## Stop rules
19
29
 
20
- - A refused completion is information, not a retry loop. Quote the answer verbatim to the architect.
21
- - `HANDOFF_STALE_GENERATION` or `HANDOFF_NO_RUN`: push nothing more and end the turn without completing. When the task then arrives with its work and handoff done, call `handoff_complete` again in its turn; never redo the work.
22
- - `HANDOFF_STALE_ENTRY`: end the turn without completing; the daemon sends the new entry's task by itself. Do what it asks at the head it names, with a handoff of its own.
23
- - `HANDOFF_HEAD_MERGED_FORWARD`: a merge forward the daemon asked for has landed above the head your completion names, or your completion names no head; nothing was recorded. Read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`), then complete again at the new head with a handoff that names it.
24
- - `HANDOFF_NOT_CURRENT_PHASE`: report it; never complete again. `HANDOFF_ALREADY_RECORDED`: the first answer stands.
30
+ - A refused completion is information, not a retry loop.
31
+ Quote the answer verbatim to the architect.
32
+
33
+ - `HANDOFF_STALE_GENERATION` or `HANDOFF_NO_RUN`: push nothing more and end the turn without completing.
34
+ When the task then arrives with its work and handoff done, call `handoff_complete` again in its turn; never redo the work.
35
+
36
+ - `HANDOFF_STALE_ENTRY`: end the turn without completing; the daemon sends the new entry's task by itself.
37
+ Do what it asks at the head it names, with a handoff of its own.
38
+
39
+ - `HANDOFF_HEAD_MERGED_FORWARD`: a merge forward the daemon asked for has landed above the head your completion names, or your completion names no head; nothing was recorded.
40
+ Read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`), then complete again at the new head with a handoff that names it.
41
+
42
+ - `HANDOFF_NOT_CURRENT_PHASE`: report it; do not retry that completion.
43
+ `HANDOFF_ALREADY_RECORDED`: the first answer stands.
44
+
25
45
  - These waits stand rather than proceed, each ending the turn with a `WAITING` line naming what it waits on:
46
+
26
47
  - a planner on a decision the plan itself needs, because a plan completed around an open decision carries that gap into every later phase;
48
+
27
49
  - a reviewer on a half of the round that has no review, on a required check with no run at the head, or on the architect's rewrite of a check whose `run` is a whole test suite (`skill://legion-worker/references/merge-gate.md`);
50
+
28
51
  - retro on the architect's answer to a defect it reported;
52
+
29
53
  - a pushing role whose second push still did not carry the pull request onto its commit.
54
+
30
55
  - Send any other decision someone else owns (product, scope, design, lifecycle, another phase's) to the owning architect with what you observed, what you tried and the decision needed, then go on.
31
- - No surface reaches the changed path: report it to the architect, never complete (`skill://legion-worker/references/pr-body.md`).
32
- - A released pod is not a stop. Your session, phase and task are kept, and the next pod restores your unpushed tracked work; nothing else of the disk survives, except on a volume the deployment keeps.
56
+
57
+ - No surface reaches the changed path: report it to the architect, never complete (`skill://legion-worker/references/results.md`).
58
+
59
+ - A released pod is not a stop.
60
+ Your session, phase and task are kept, and the next pod restores your unpushed tracked work; nothing else of the disk survives, except on a volume the deployment keeps.
61
+
33
62
  - When another role's topic answers 404, read its handoff with `dispatch handoff-read`.
34
63
 
35
64
  ## Commits and pushes
36
65
 
37
- - Write no trailer yourself. The pane's jj adds `Omp-Session:` and `Legion-Role:`, and `Dispatch: <KEY>` in a repository the deployment names; the git wrapper adds the first two to a `git commit`. A merge, revert, cherry-pick or rebase that git makes gets none. Cure a commit that lacks a line by describing it again in the pane's shell; where that adds no issue line and `LEGION_ISSUE_TRAILER` is set, add the trailer line `Dispatch: $LEGION_ISSUE_TRAILER` yourself.
66
+ - Write no trailer yourself.
67
+ The pane's jj adds `Omp-Session:` and `Legion-Role:`, and `Dispatch: <KEY>` in a repository the deployment names;
68
+ the git wrapper adds the first two to a `git commit`.
69
+ A merge, revert, cherry-pick or rebase that git makes gets none.
70
+ Cure an unpushed commit that lacks a line by describing it again in the pane's shell;
71
+ where that adds no issue line and `LEGION_ISSUE_TRAILER` is set, add the trailer line `Dispatch: $LEGION_ISSUE_TRAILER` yourself.
72
+
38
73
  - A repository you clone under `$LEGION_WORKSPACE` is stamped with this issue's key: clone one you will push elsewhere outside it.
74
+
39
75
  - A planner whose issue moved back from implementing starts on the remote tip: `jj -R "$LEGION_WORKSPACE" new legion/<KEY>@origin`.
40
76
 
41
77
  ## Pull request and merge gate
42
78
 
43
- - The implementer opens the pull request with the line `Dispatch: <KEY>` in its body. Later phases push to that branch and edit that pull request.
44
- - No deferrals. A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request. So is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and a review. `Fast-follow:` reads `none` or names cleanup in files the pull request does not touch.
45
- - The merge gate, in order: the tester's evidence green → the reviewer's approval of the head → the architect's acceptance → retro, which commits nothing → the merger's merge of the head it read, which closes the issue → the production check after the close, the tester's unless the project's `production_check` is `off`. Only the merger runs `gh pr merge`; nobody turns auto-merge on.
79
+ - The implementer opens the pull request with the line `Dispatch: <KEY>` in its body.
80
+ Later phases push to that branch and edit that pull request.
81
+
82
+ - No deferrals.
83
+ A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request.
84
+ So is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and a review.
85
+ `Fast-follow:` reads `none` or names cleanup in files the pull request does not touch.
86
+
87
+ - The merge gate follows the task's `Steps:` line: each named step runs in order, then retro and the merger.
88
+ The default task has tester evidence, reviewer approval and architect acceptance.
89
+ With no tester step, the implementer's evidence serves;
90
+ with no reviewer step, no Legion approval is awaited; without `acceptance:owner`, the last step starts retro.
91
+ Only the merger runs `gh pr merge`; nobody turns auto-merge on.
92
+
46
93
  - End every pull-request comment you post with `<!-- legion: {"session":"<session-id>","phase":"<phase>"} -->`.
47
- - A Dispatch comment or message never carries the `<!-- legion: … -->` footer. Dispatch records the session that wrote it, and only a pull-request comment or review needs the footer.
48
- - Never run `gh config set` or `gh alias set`, and leave `GH_TOKEN`, `GITHUB_TOKEN` and `GH_HOST` unset: a set variable outranks the gh directory the daemon refreshes.
49
- - Before you report a resource unreachable, or read a GitHub `404` as no access, try the call through `skill://agent-secrets` and read the profiles in `AWS_CONFIG_FILE`. Request a secret only for your issue's work.
94
+
95
+ - A Dispatch comment or message never carries the `<!-- legion: … -->` footer.
96
+ Dispatch records the session that wrote it, and only a pull-request comment or review needs the footer.
97
+
98
+ - Never run `gh config set` or `gh alias set`, and leave `GH_TOKEN`, `GITHUB_TOKEN` and `GH_HOST` unset:
99
+ a set variable outranks the gh directory the daemon refreshes.
100
+
101
+ - Before you report a resource unreachable, or read a GitHub `404` as no access, try the call through `skill://agent-secrets` and read the profiles in `AWS_CONFIG_FILE`.
102
+ Request a secret only for your issue's work.
50
103
 
51
104
  ## Deployment instructions
52
105
 
53
- They override this skill, except: no deferrals; the base merged forward only as `skill://legion-worker/references/conflicts-and-rewrites.md#reintegrating-the-base` allows; the implementer's own result for every `before_merge` check with no `ci_check` (`skill://legion-worker/references/pr-body.md#what-a-result-is`); and the production check after the close (`skill://legion-worker/references/merge-gate.md#the-production-check-after-the-close`).
106
+ They override this skill, except: no deferrals;
107
+ the base merged forward only as `skill://legion-worker/references/conflicts-and-rewrites.md#reintegrating-the-base` allows;
108
+ the implementer's own result for every `before_merge` check with no `ci_check` (`skill://legion-worker/references/results.md#what-a-result-is`);
109
+ and the production check after the close (`skill://legion-worker/references/merge-gate.md#the-production-check-after-the-close`).
54
110
 
55
111
  ## References
56
112
 
57
- - PR body, a check's result, the simplify pass: `skill://legion-worker/references/pr-body.md`.
113
+ - The PR body, its `Thermo` line, the simplify pass: `skill://legion-worker/references/pr-body.md`.
114
+
115
+ - A check's result, the evidence each phase owes, a red or missing CI check, no surface for the changed path: `skill://legion-worker/references/results.md`.
116
+
58
117
  - A check carrying `ci_check`: `skill://legion-worker/references/ci-checks.md`.
118
+
59
119
  - Review, approval, merge, production check: `skill://legion-worker/references/merge-gate.md`.
120
+
60
121
  - Review threads, a bot's finding: `skill://legion-worker/references/review-threads.md`.
61
- - A conflict, the daemon's merge-forward message, a need for the base, a retarget, a wrong pushed commit: `skill://legion-worker/references/conflicts-and-rewrites.md`.
122
+
123
+ - A conflict, the daemon's merge-forward message, a need for the base, a retarget, a wrong pushed commit:
124
+ `skill://legion-worker/references/conflicts-and-rewrites.md`.
125
+
62
126
  - A plan you write or review: `skill://legion-worker/references/plan-tests.md`.
63
- - Builds, tests, tools or a database in the pod: `skill://legion-worker/references/tools.md`; before you unpack or install what the image lacks: `skill://legion-worker/references/withheld-capability.md`.
127
+
128
+ - Builds, tests, tools or a database in the pod:
129
+ `skill://legion-worker/references/tools.md`; before you unpack or install what the image lacks: `skill://legion-worker/references/withheld-capability.md`.
130
+
64
131
  - A problem outside your issue, or a failed production check: `skill://legion-worker/references/findings.md`.
132
+
65
133
  - Text that reaches a person outside the company: `skill://outside-message`.
@@ -4,11 +4,15 @@ Read it when a check of the issue's Verification document carries `ci_check`, be
4
4
 
5
5
  ## What it is
6
6
 
7
- `ci_check` names the GitHub check run that proves the check at the head. Such a check has no `run`, its `when` is `before_merge`, and it names its `negative_control`. The architect writes it as `skill://legion-architect/references/design-gate.md` says.
7
+ `ci_check` names the GitHub check run that proves the check at the head.
8
+ Such a check has no `run`, its `when` is `before_merge`, and it names its `negative_control`.
9
+ The architect writes it as `skill://legion-architect/references/design-gate.md` says.
8
10
 
9
11
  ## No role runs it
10
12
 
11
- A check carrying `ci_check` is CI's. No role runs its work in the pod or records a result for it: Dispatch refuses one with `409 CHECK_PROVED_BY_CI`. `dispatch results --issue <issue>` reads the named run at the head of the issue's pull request and prints the one result it derives, its `A pass stands:` line, and the line for the PR body:
13
+ A check carrying `ci_check` is CI's.
14
+ No role runs its work in the pod or records a result for it: Dispatch refuses one with `409 CHECK_PROVED_BY_CI`.
15
+ `dispatch results --issue <issue>` reads the named run at the head of the issue's pull request and prints the one result it derives, its `A pass stands:` line, and the line for the PR body:
12
16
 
13
17
  ```
14
18
  - <id> (before_merge): <verdict> at <sha> by ci (CI run <name>, <conclusion>), <currency>. <text>
@@ -19,26 +23,43 @@ A check carrying `ci_check` is CI's. No role runs its work in the pod or records
19
23
  When the run gives no result, the line reads `CI run <name> has no result (<case>)`, the case one of:
20
24
 
21
25
  - `not_completed`: the run is still going.
26
+
22
27
  - `absent`: no run of that name is at the head.
28
+
23
29
  - `no_head`: Dispatch holds no pull request head of the issue.
30
+
24
31
  - `neutral`, `skipped` or `cancelled`: the run concluded and proved nothing.
32
+
25
33
  - `github_unreadable`: Dispatch could not read GitHub; treat it as a run still going.
26
34
 
27
35
  ## What each role does
28
36
 
29
- - The implementer copies each such check's `Pull request line` into the `Checks` block. The next role that writes the body reads `dispatch results` again and replaces a no-result line.
30
- - The tester runs and records only the checks with no `ci_check`. A `ci_check` check goes in `failures` only when its derived result is a fail, or its run concluded `skipped`, `neutral` or `cancelled`. A run still going fails no round: say so in `implementerProof.how`.
37
+ - The implementer copies each such check's `Pull request line` into the `Checks` block.
38
+ The next role that writes the body reads `dispatch results` again and replaces a no-result line.
39
+
40
+ - The tester runs and records only the checks with no `ci_check`.
41
+ A `ci_check` check goes in `failures` only when its derived result is a fail, or its run concluded `skipped`, `neutral` or `cancelled`.
42
+ A run still going fails no round: say so in `implementerProof.how`.
43
+
31
44
  - The reviewer waits for a run still going by its name, and neither approves nor requests changes for that check until it concludes.
32
- - A job the repository runs on a pull request only under the label `full-ci` (on cybermonklabs/legion, the slow suites and the full browser lane) reads `skipped` without it. The implementer adds the label, then pushes, because the workflow starts on a push and not on a label. The label stays on while a `ci_check` of the issue names such a job.
45
+
46
+ - A job the repository runs on a pull request only under the label `full-ci` (on cybermonklabs/legion, the slow suites and the full browser lane) reads `skipped` without it.
47
+ The implementer adds the label, then pushes, because the workflow starts on a push and not on a label.
48
+ The label stays on while a `ci_check` of the issue names such a job.
33
49
 
34
50
  ## A name that no run answers
35
51
 
36
52
  When the head's checks have settled and no run of the name answers:
37
53
 
38
54
  1. Read the merge state first (`gh pr view <n> --json mergeStateStatus`): a `DIRTY` head gets no `pull_request` run, and the forward merge cures it.
55
+
39
56
  2. A held-back job reads `skipped`, not absent: the label cures it.
40
- 3. Otherwise the check's words are wrong. The tester and the reviewer each send it to the architect as a finding with `envoy_publish`; neither fails the round nor requests changes for it.
57
+
58
+ 3. Otherwise the check's words are wrong.
59
+ Each tester and reviewer step sends it to the architect as a finding with `envoy_publish`; with neither step, the implementer sends it during retro.
60
+ No role fails the round or requests changes for it.
41
61
 
42
62
  ## What the evidence is
43
63
 
44
- The named job is the check's proof at the head, and no role repeats it, even when it is a unit or integration suite. It proves only that the job passed there: the tester still proves the real surface with the checks CI cannot run.
64
+ The named job is the check's proof at the head, and no role repeats it, even when it is a unit or integration suite.
65
+ It proves only that the job passed there: the tester, or the implementer with no tester step, still proves the real surface with the checks CI cannot run.
@@ -18,7 +18,7 @@ Before you race another tree's pull request on shared files, `envoy_publish` to
18
18
  Write `<message>` in the repository's own commit convention (its commit-lint configuration, else its recent commits on the base), such as `chore(<scope>): merge <base> into <branch>`, or `Merge <base> into <branch>` where none shows. `@` after a split is an empty commit with no description, which `jj git push` refuses.
19
19
  2. Resolve any conflict in that one commit, then `jj -R "$LEGION_WORKSPACE" new` to move off it.
20
20
  3. A merge brings instances from the base that the branch's own diff never shows, so before you push the merge search its head for the class of every finding of every earlier review round.
21
- 4. Push the merge as any code push, build the branch, and record the issue's checks again at the merge head, each check with no `ci_check` (a check carrying one is read again from its CI run), even with no text conflict. The merger records none itself: it asks the implementer and the tester to record theirs at the merge head (its role prompt, "A head that conflicts with its base").
21
+ 4. Push the merge as any code push, build the branch, and record the issue's checks again at the merge head, each check with no `ci_check` (a check carrying one is read again from its CI run), even with no text conflict. The merger records none itself: it asks the implementer, and the tester where the task has a tester step, to record theirs at the merge head (its role prompt, "A head that conflicts with its base").
22
22
  5. Post one PR comment with the Legion footer: `forward merge <old-tip-sha> → <new-tip-sha>; <the condition it meets>`, with each class search beside it. In a parent's last round, end it with `parent's last round: full test round`.
23
23
 
24
24
  After a retarget, do the same merge onto the new base, and cite the new head's run in the PR body. Recover a jj mistake forward (`jj new`, `jj restore <paths>`), never with `jj undo`, `jj abandon` or `jj op restore`.