@sjawhar/claude-envoy 5.10.2 → 5.11.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 (36) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/dist/codex-hook.js +1 -1
  4. package/dist/dispatch.js +1 -1
  5. package/dist/envoy-channel.js +104 -77
  6. package/dist/session-hook.js +1 -1
  7. package/legion/agents/thermonuclear-code-quality.md +1 -0
  8. package/legion/agents/thermonuclear-deep-review.md +1 -0
  9. package/legion/skills/legion-architect/SKILL.md +1 -1
  10. package/legion/skills/legion-architect/references/acceptance.md +1 -2
  11. package/legion/skills/legion-architect/references/decomposition.md +4 -4
  12. package/legion/skills/legion-architect/references/design-gate.md +5 -3
  13. package/legion/skills/legion-architect/references/wake-routing.md +4 -4
  14. package/legion/skills/legion-controller/references/admission.md +3 -3
  15. package/legion/skills/legion-controller/references/consolidation.md +1 -1
  16. package/legion/skills/legion-controller/references/daily-report.md +1 -1
  17. package/legion/skills/legion-controller/references/finding-asks.md +2 -2
  18. package/legion/skills/legion-controller/references/parked-decisions.md +2 -2
  19. package/legion/skills/legion-controller/references/wakes.md +3 -3
  20. package/legion/skills/legion-oracle/SKILL.md +1 -3
  21. package/legion/skills/legion-retro/SKILL.md +3 -3
  22. package/legion/skills/legion-worker/SKILL.md +6 -8
  23. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +2 -2
  24. package/legion/skills/legion-worker/references/pr-body.md +1 -1
  25. package/package.json +1 -1
  26. package/skills/agent-secrets/SKILL.md +4 -4
  27. package/skills/envoy/references/check-settlement.md +2 -1
  28. package/skills/envoy/references/legion.md +1 -1
  29. package/skills/envoy/references/roles.md +1 -1
  30. package/skills/thermonuclear-code-quality/SKILL.md +0 -2
  31. package/skills/thermonuclear-deep-review/SKILL.md +0 -2
  32. package/src/codex/codex-server.ts +6 -2
  33. package/src/envoy-channel-server.ts +6 -2
  34. package/src/installed-build.ts +22 -1
  35. package/legion/skills/legion-worker/references/default-branch-check.md +0 -31
  36. package/legion/skills/legion-worker/references/foreign-path.md +0 -19
@@ -14903,7 +14903,7 @@ var dispatchToolSpecs = [
14903
14903
  verdict: "pass",
14904
14904
  commit: "1111111111111111111111111111111111111111"
14905
14905
  },
14906
- description: "Record one result of one check of an issue's Verification document, or retract a result " + "recorded before. A record prints the pull-request body line it implies. Write that line " + "into the pull-request body unchanged: it is the one grammar every writer uses, and it " + "carries no link to Dispatch, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "Name the check by its block id. Where two Verification documents in reach hold that id, " + "name it by its canonical reference (dispatch://KEY/artifact/verification-md#b-<id>). " + "409 CHECK_AMBIGUOUS names both documents. An id no Verification document of the issue " + "or of an issue above it holds is 400 UNKNOWN_CHECK. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "A pass that counts a failed, a skipped or an excluded case contradicts itself, and is " + "400 RESULT_CONTRADICTS. " + "Dispatch asks GitHub whether the repository of the check's issue holds the commit. If " + "GitHub does not say that it does, Dispatch reads the external links of the check's issue: " + "a link to a GitHub pull request (https://github.com/<owner>/<repo>/pull/<n>) that is open " + "or merged, in a repository that Dispatch's GitHub App is installed on and can read, adds " + "the repository of that pull request. One record reads at most 10 linked pull requests. A " + "commit that none of these repositories holds is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and each owner/repo that Dispatch asked. It also names, with its reason " + "(owner/repo#n (repository_unreadable)), each linked pull request that Dispatch could not " + "read, at most 10 and a count of the rest, and every linked pull request in whose " + "repository it could not read the commit, since each of those spent one of the record's 10 " + "reads, and says to grant Dispatch's GitHub App that repository or to link a readable pull " + "request. It says how many linked pull requests it left unread past that bound. Record the " + "result after the commit is pushed. A linked repository that the App is not installed on " + "or cannot read does " + "not count. Where a read of " + "a linked pull request or of a linked repository does not answer, and no repository is shown " + "to hold the commit, the record is 502 GITHUB_UNREADABLE and nothing is recorded: record the " + "result again, after the wait the refusal names for a rate limit. Where the issue has no " + "repository, the result is recorded as before. Where Dispatch cannot read the repository " + "of the check's issue, the result is recorded as before only when every linked read " + "answers and no linked repository holds the commit: a linked read that does not answer " + "is 502 GITHUB_UNREADABLE and nothing is recorded. " + "The result is recorded against the check's own issue, so a child's run of a parent's " + "check appears under that check. A closed issue takes a result only for a check whose " + "when is after_merge or default_branch, the production check after the merge. It refuses " + "every other record with 409 ISSUE_CLOSED, as it refuses every other write. " + "A check a document version rewords while the result is being written is 409 " + "CHECK_CONTENDED, with nothing recorded: run the same command again. " + RESULT_RETRACT_RULE + " The retraction keeps both records: the result stays readable, and it proves nothing " + "from then on. Record a new result where the check still needs one. A retraction is " + "taken on a closed issue and for a check of any when. Three callers may retract: the " + "session that recorded the result, a session that holds the Dispatch claim of the issue " + "the result was recorded on, and a caller whose credential carries a person. Every other " + "caller is 403 RETRACTION_FORBIDDEN. A result retracted already is 409 RESULT_RETRACTED. " + ISSUE_REFERENCE,
14906
+ description: "Record one result of one check of an issue's Verification document, or retract a result " + "recorded before. A record prints the pull-request body line it implies. Write that line " + "into the pull-request body unchanged: it is the one grammar every writer uses, and it " + "carries no link to Dispatch, no private host and no issue key: Dispatch keeps only words " + "of letters, digits and plain punctuation, and of those leaves out every word that holds " + "`://`, a private or Dispatch host, or an issue key of one of its projects; the record keeps " + "the whole reading. --dry-run prints the line the record would print, and records nothing. " + "Name the check by its block id. Where two Verification documents in reach hold that id, " + "name it by its canonical reference (dispatch://KEY/artifact/verification-md#b-<id>). " + "409 CHECK_AMBIGUOUS names both documents. An id no Verification document of the issue " + "or of an issue above it holds is 400 UNKNOWN_CHECK. " + `${CHECK_PROVED_BY_CI}. ` + "Dispatch reads its result from that run, so a record for it is 409 " + "CHECK_PROVED_BY_CI from every role, which names the check and the run. " + "A pass that counts a failed, a skipped or an excluded case contradicts itself, and is " + "400 RESULT_CONTRADICTS. " + "Dispatch asks GitHub whether the repository of the check's issue holds the commit. If " + "GitHub does not say that it does, Dispatch reads the external links of the check's issue: " + "a link to a GitHub pull request (https://github.com/<owner>/<repo>/pull/<n>) that is open " + "or merged, in a repository that Dispatch's GitHub App is installed on and can read, adds " + "the repository of that pull request. One record reads at most 10 linked pull requests. A " + "commit that none of these repositories holds is 400 RESULT_COMMIT_UNKNOWN, which names the " + "commit and each owner/repo that Dispatch asked. It also names, with its reason " + "(owner/repo#n (repository_unreadable)), each linked pull request that Dispatch could not " + "read, at most 10 and a count of the rest, and every linked pull request in whose " + "repository it could not read the commit, since each of those spent one of the record's 10 " + "reads, and says to grant Dispatch's GitHub App that repository or to link a readable pull " + "request. It says how many linked pull requests it left unread past that bound. Record the " + "result after the commit is pushed. A linked repository that the App is not installed on " + "or cannot read does " + "not count. Where a read of " + "a linked pull request or of a linked repository does not answer, and no repository is shown " + "to hold the commit, the record is 502 GITHUB_UNREADABLE and nothing is recorded: record the " + "result again, after the wait the refusal names for a rate limit. Where the issue has no " + "repository, the result is recorded as before. Where Dispatch cannot read the repository " + "of the check's issue, the result is recorded as before only when every linked read " + "answers and no linked repository holds the commit: a linked read that does not answer " + "is 502 GITHUB_UNREADABLE and nothing is recorded. " + "The result is recorded against the check's own issue, so a child's run of a parent's " + "check appears under that check. A closed issue takes a result only for a check whose " + "when is after_merge or default_branch, the production check after the merge. It refuses " + "every other record with 409 ISSUE_CLOSED. " + "A check a document version rewords while the result is being written is 409 " + "CHECK_CONTENDED, with nothing recorded: run the same command again. " + RESULT_RETRACT_RULE + " The retraction keeps both records: the result stays readable, and it proves nothing " + "from then on. Record a new result where the check still needs one. A retraction is " + "taken on a closed issue and for a check of any when. Three callers may retract: the " + "session that recorded the result, a session that holds the Dispatch claim of the issue " + "the result was recorded on, and a caller whose credential carries a person. Every other " + "caller is 403 RETRACTION_FORBIDDEN. A result retracted already is 409 RESULT_RETRACTED. " + ISSUE_REFERENCE,
14907
14907
  arguments: (z) => ({
14908
14908
  issue: z.string().describe(ISSUE_REFERENCE).optional(),
14909
14909
  check: z.string().describe("The check block's id, or its canonical reference dispatch://KEY/artifact/verification-md#b-<id> when the id is not unique among the issue's Verification document and those of the issues above it.").optional(),
@@ -22,6 +22,7 @@ Do not demand abstraction before two real change axes exist. Do not flag code th
22
22
 
23
23
  - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell, where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call there. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
24
24
  - Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact path. Never delete by a glob in a shared directory: every role of this issue writes into the same `$TMPDIR` on the issue's volume, so a sweep like `rm -rf "$TMPDIR"/tmp.*` deletes directories another role has open.
25
+ - If a skill disagrees with the code, a command's output or its `--help`, follow those and say which line of the skill is wrong.
25
26
 
26
27
  ## Output
27
28
 
@@ -22,6 +22,7 @@ Do not report issues in code the pull request leaves unchanged, other than the u
22
22
 
23
23
  - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell, where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call there. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
24
24
  - Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact path. Never delete by a glob in a shared directory: every role of this issue writes into the same `$TMPDIR` on the issue's volume, so a sweep like `rm -rf "$TMPDIR"/tmp.*` deletes directories another role has open.
25
+ - If a skill disagrees with the code, a command's output or its `--help`, follow those and say which line of the skill is wrong.
25
26
 
26
27
  ## Output
27
28
 
@@ -7,7 +7,7 @@ description: "Use when you are a Legion root or child architect, before any life
7
7
 
8
8
  You own one issue and every issue under it until the merge that closes it. The daemon starts every
9
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.
10
+ skill the procedures.
11
11
 
12
12
  ## Every turn
13
13
 
@@ -96,8 +96,7 @@ request.
96
96
 
97
97
  Only the pull request author's App resolves a thread, so the implementer resolves them all. When
98
98
  GitHub refuses its `resolveReviewThread`, open a `dispatch ask` with the thread's URL and GitHub's
99
- message, for a person to resolve it, with the options resolved and could not. The merger does not
100
- complete while it is open.
99
+ message, for a person to resolve it, with the options resolved and could not.
101
100
 
102
101
  ## The close
103
102
 
@@ -13,15 +13,15 @@ for an earlier one.
13
13
 
14
14
  Release a child a person created at once and as it is:
15
15
  `legion({ op: "release_children", issues: ["LEGION-41", "LEGION-42"] })`. The answer names
16
- `released`, `started` and `held`, each held child with what it waits on. A refused release writes
17
- nothing: release the rest again without the child it names.
16
+ `released`, `started` and `held`, each held child with what it waits on. A release refused with
17
+ one of the codes below writes nothing: release the rest again without the child it names.
18
18
 
19
19
  - `CHILD_NOT_ADOPTABLE`: it runs or ran as a tree of its own. Leave it, or ask the controller.
20
20
  - `CHILD_IN_OTHER_TREE`: re-parent it back in Dispatch, or ask that tree's architect or the
21
21
  controller.
22
22
  - `ISSUE_NOT_OWNED`: the issue is another architect's; send the move to the architect above you.
23
- - `CHILD_UNDER_ACCEPTED_PARENT`: an ancestor is already accepted. Take it back with
24
- `request_backward_move`, or release once it has closed.
23
+ - `CHILD_UNDER_ACCEPTED_PARENT`: an ancestor is already accepted. Release again once it has closed,
24
+ where it is not the tree's root.
25
25
 
26
26
  ## Creating children
27
27
 
@@ -112,9 +112,11 @@ For each gated step, once every child is filed:
112
112
 
113
113
  ## After approval
114
114
 
115
- An approval is pinned to its version: any new version closes that step, with no wake. Two keep it:
116
- a version whose only change is a person's answer to a decision block, and one equal to the approved
117
- text (an accidental edit undone exactly).
115
+ An approval is pinned to its version: any new version closes that step, with no wake. Three keep it:
116
+ a version whose only change is the approver's own answer to a decision block, given after the
117
+ approval at a browser or under a credential with the approve scope; one equal to the approved text
118
+ (an accidental edit undone exactly) with no decision block in it decided since; and, after a close
119
+ and a reopen, the approved text with only the questions the close withdrew open again.
118
120
 
119
121
  Edit an approved spec only where its Summary, a requirement, a check, the scope or a settled
120
122
  decision changes: put the problem to the person as a decision block at the end of the section it
@@ -3,7 +3,7 @@
3
3
  Read this when a wake reaches you. A wake about an issue reaches its own architect while that
4
4
  architect holds its role, else the nearest one above that does. A `child-status` or `child-closed`,
5
5
  and a `worker-died` or `worker-stalled` about a child's own architect, reach the architect above the
6
- child. Your role prompt describes each notice; this table says what to do. "Section N" is that
6
+ child. Your role prompt describes most notices; this table says what to do. "Section N" is that
7
7
  section of `skill://legion-architect`. Where a row says to ask a person, a child's own architect
8
8
  sends the question to the architect above it.
9
9
 
@@ -26,7 +26,7 @@ sends the question to the architect above it.
26
26
  | `child-release-stalled` | Read the parent's record (`read_record`), release the parent first when the reason says so, then release the child again. Tell the controller if the parent never records. |
27
27
  | `child-not-recorded` | Set the child's repository (`dispatch issue-update --repo owner/name`) or get the named App installed, then release it again; else tell the controller. |
28
28
  | `worker-died` | A phase worker: the issue is held; `retry_or_escalate` with `retry` for an agent or transient failure (its `reason` says what changed), `escalate` for an environmental one or a prompt too large for its pod. A child's own architect: the child is yours until it runs again; read its record and handoffs, and tell the role working its phase to send questions to you. A finished role: nothing is held; read its handoff. |
29
- | `worker-stalled` | The daemon relaunched or queued the turn. Judge from the reason whether the work needs a decision of yours. Tell the controller of a stop the runtime did not confirm. |
29
+ | `worker-stalled` | The daemon relaunched or queued the turn, retries its relaunch, let a suspension already waiting for the claim run instead, or failed the claim. Judge from the reason whether the work needs a decision of yours. Tell the controller of a stop the runtime did not confirm. |
30
30
  | `worker-silent` | The daemon already sent the work again; start nothing. Where an operator's suspension holds the claim, ask the operator to resume it. |
31
31
  | `worker-background-stalled` | Read what the session waits on: a missing surface or a person needs your decision, a long build does not. |
32
32
  | `held` | No `reason`: answer the `worker-died` that comes with it. `reason: "escalated"`: the controller has it; start nothing. |
@@ -38,8 +38,8 @@ sends the question to the architect above it.
38
38
  ## A capped pull request
39
39
 
40
40
  A `pr-blocked` reason reads `<n> rounds counted, <m> conflict rounds not counted`: judge the cap by
41
- `<n>`. Tester fails and requests for changes are what it counts. Read what every counted round
42
- found, choose one, act on it, and post the rounds you read and the choice as a `dispatch comment`:
41
+ `<n>`. Requests for changes are what it counts. Read what every counted round found, choose one, act
42
+ on it, and post the rounds you read and the choice as a `dispatch comment`:
43
43
 
44
44
  - **Narrow**: the change is sound but each round finds more around it. Tell the implementer and the
45
45
  reviewer which checks the next round answers, dropping no requirement. A correctness finding or
@@ -17,11 +17,11 @@ Holding no slot is no fault by itself.
17
17
 
18
18
  ## `admission.held`: what nothing starts
19
19
 
20
- Every issue the record holds in the workflow that is in neither `admission.active` nor `admission.waiting`, with one word for why nothing of it runs and `heldBy`, the issues that hold it. The daemon starts none of them by itself: name them in the day's report and take nothing for them.
20
+ Every issue the record holds in the workflow that is in neither `admission.active` nor `admission.waiting`, with one word for why nothing of it runs and `heldBy`, the issues that hold it. Name them in the day's report and take nothing for them.
21
21
 
22
22
  | Word | Meaning | What ends it |
23
23
  |---|---|---|
24
- | `tree_closed` | Its tree's root is `done`, or still lingering after it left the workflow | An architect's `release_children` of the live tree its Dispatch parent reaches, where that release is accepted |
24
+ | `tree_closed` | Its tree's root is `done`, or still lingering after it left the workflow | An architect's `release_children` of the live tree its Dispatch parent reaches, where that release is accepted, the end of the root's linger, or a `todo` on the root |
25
25
  | `tree_parked` | Its tree was parked and the linger ran out | A `todo` on the root; your own hold, the parked-root walk decides |
26
26
  | `label_off` | A root whose `legion` label is off | A person's label |
27
27
  | `ancestry` | Its Dispatch chain reaches another live root: that tree's unreleased work | That tree's architect releasing it or its parent, or the chain leaving that tree |
@@ -29,6 +29,6 @@ Every issue the record holds in the workflow that is in neither `admission.activ
29
29
  | `design_gate` | Its root's design gate is not open at every gated step | A person's approval of each step's document |
30
30
  | `dispatch_blocker` | A `blocked_by` issue is not `done` | Each blocker `done`, or the link taken off |
31
31
  | `children_first` | An open child under it | The last open child leaving the workflow |
32
- | `accepted_ancestor` | An ancestor's reviewed head is accepted | That ancestor's close |
32
+ | `accepted_ancestor` | An ancestor's reviewed head is accepted | That ancestor standing in neither `retro` nor `merging` (a `held` ancestor stands in the phase it was held from) |
33
33
  | `at_work` | Past its review, not `held`, on no slot | Its own sign-off, retro and merge |
34
34
  | `unclassified` | None of the above | Nothing of yours: name it with its `phase` and `status` |
@@ -27,4 +27,4 @@ Root each cause once, as `skill://legion-controller/references/finding-asks.md#h
27
27
 
28
28
  ## The record
29
29
 
30
- Add at the top of the record a section `## Consolidation pass <block start>` with three counts and their keys: issues read, pairs folded, causes rooted; then every pair and group you skipped, with what settles it. Drop sections older than eight days, and upload the whole record: `dispatch artifact --issue <REPORT KEY> --name consolidation.md --path <the record file>`. Never post the pass as a message: that reaches a person's Inbox.
30
+ Add at the top of the record a section `## Consolidation pass <block start>` with three counts and their keys: issues read, pairs folded, causes rooted; then every pair and group you skipped, with what settles it. Drop sections older than eight days, and upload the whole record: `dispatch artifact --issue <REPORT KEY> --name consolidation.md --path <the record file> --force`. Never post the pass as a message: that reaches a person's Inbox.
@@ -32,7 +32,7 @@ After the turn's own work, read the report issue, keep it answerable, and post w
32
32
  One `dispatch message --issue <report KEY> --body-file -` of at most 2,000 characters, written as `skill://dispatch-writing-specs`'s "Rules for the text" say: every issue by its `dispatch://` link and what it does for the reader, every pull request by its URL. A day with nothing finished says so in one sentence; when the lists do not fit, give each list's count and name its priority 0 and 1 issues in board rank order.
33
33
 
34
34
  - **Finished.** `dispatch issues --project <PROJECT> --status done --updated-since <the previous report's time, or 24 hours ago> --all`, keeping the issues `read_state` records whose `issue.closed` is after the previous report, each with the pull request under its `External links:`.
35
- - **Closed without a change.** Those with no pull request, each with the reason its closing message gave (the `message.created` just before `issue.closed`).
35
+ - **Closed without a change.** Those with no pull request, each with the reason its closing message gave (the `message.created` before `issue.closed`, with only the close's own settlement and withdrawal lines between them).
36
36
  - **Running.** Each root in `admission.trees` with its phase, and under it each of its issues in `admission.active` with its own; then `admission.waiting`; then each root the every-turn check found waiting on a claim, with its holder.
37
37
  - **Waiting on Dispatch links.** Each issue in `admission.blocked` with what it waits on; say of each whose `waitingLine.kind` is `waiting_on_issue` that it holds no slot while it waits, nothing of its work stopped, and it takes one again by itself.
38
38
  - **What nothing starts.** `admission.held` grouped by `reason`, each group's count, issues and `heldBy`, and what ends it (`skill://legion-controller/references/admission.md`); an `unclassified` issue with its `phase` and `status`.
@@ -13,7 +13,7 @@ Every issue you file carries one line in its spec, which triage reads to tell yo
13
13
 
14
14
  A role sends a clear defect with its role token, the defect, its issue, where the fix belongs, the fix, and its evidence comment on the report issue, whose first line is `Clear defect from <role>`. When the message carries the evidence itself, create or reopen the report issue (`skill://legion-controller/references/daily-report.md`) and post it there with that first line. One you find yourself gets the same comment, with `controller` as the role. A clear-defect ask needs no answer: take it as below, and resolve it (`dispatch resolve-ask --kind resolved`) only once it carries your reply.
15
15
 
16
- 1. Check it is clear: the fix needs no choice a person must make, in a repository your addressing line lists. Otherwise open a decision ask as `findings.md` says, and reply `Moved dispatch://<REPORT KEY>/ask/<new id>`.
16
+ 1. Check it is clear: the fix needs no choice a person must make, in a repository of an owner your addressing line names. Otherwise open a decision ask as `findings.md` says, and reply `Moved dispatch://<REPORT KEY>/ask/<new id>`.
17
17
  2. Search first (`skill://dispatch-first`). When an open issue tracks it, comment the evidence there and reply `Filed dispatch://<that KEY>`.
18
18
  3. When a root in `admission.trees` matches its repository and component, `envoy_publish` the defect, its evidence reference and the fix to `notifications.role.<issues.<KEY>.architect.locator.claim>`. Reply `Handed dispatch://<that KEY>` only when a live holder took the publish; when Envoy kept it, or the root has no locator, reply nothing and publish again at your next wake. File nothing while a tree owns the code.
19
19
  4. When no running tree owns it, file it where the fix belongs:
@@ -36,7 +36,7 @@ A park ask's answer goes to `skill://legion-controller/references/park-asks.md`
36
36
 
37
37
  An ask that re-files an escalated child also takes the steps of `skill://legion-controller/references/escalation.md#a-child-that-looks-independent`.
38
38
 
39
- Then reply under the ask, first line exactly `Filed dispatch://<NEW KEY>`, `Handed dispatch://<KEY>` or `Not filed: <reason>`: `dispatch comment --issue <the ask's issue> --reply-to-ask '<ask id>' --body-file -`. Dispatch cannot resolve an answered ask, so that reply is its record. Close an open finding ask that turned moot with `dispatch resolve-ask --kind resolved`, naming why.
39
+ Then reply under the ask, first line exactly `Filed dispatch://<NEW KEY>`, `Handed dispatch://<KEY>` or `Not filed: <reason>`: `dispatch comment --issue <the ask's issue> --reply-to-ask '<ask id>' --body-file -`. Dispatch cannot resolve an answered ask, so that reply is its record. Close an open finding ask that turned moot with `dispatch resolve-ask --kind retracted`, naming why.
40
40
 
41
41
  ## Catch up at every start
42
42
 
@@ -11,9 +11,9 @@ A held root is not a parked one: `todo` on a root at `phase: held` releases the
11
11
  1. **Where the tree stands.** Read `issues.<root>`.
12
12
  - `phase` is not `done`: the tree runs. When its `architect.state` is `failed` or `retired`, nobody heard: judge it in steps 3 and 4, and re-admit a tree whose decision gives a next step with `backlog`, then `todo`, once the `worker-died` cause is gone (`skill://legion-controller/references/wakes.md`). In those comments write `<root>'s architect has stopped, so it` for `<root> is parked, so its architect` and `The tree waits.` for `The tree stays parked.`. Otherwise the tree heard it: do nothing.
13
13
  - `phase` is `done`: `dispatch read --issue <root>`. In `backlog` or `icebox`, go on. In any other status, set nothing and name `ref` in your summary.
14
- 2. **Who parked it.** Under the root's `Events:`, each `issue.created`, `issue.updated` and `issue.closed` line ends `status <status>`. The park is the oldest line of the newest unbroken run of those lines showing the current status. It is your own hold only when that line is by `session legion-daemon:<PROJECT>` and, within 10 minutes after it, a session's comment begins `Parked by Legion while it waits on:`. Every other park is someone else's. `Events:` shows only the last 10 events: when the run reaches the oldest one shown, read `/api/v1/issues/<root>/events?limit=200` with the `curl` of `skill://legion-controller/references/session.md` ("Reading Dispatch's API"); when it still does, you cannot read who parked it, so judge only the events newer than the oldest you read, and name older decisions in your summary as ones you could not place. A decision older than the park is no reason to run.
14
+ 2. **Who parked it.** Under the root's `Events:`, each `issue.created`, `issue.updated` and `issue.closed` line ends `status <status>`, except that a forced create adds `· forced …` after it. The park is the oldest line of the newest unbroken run of those lines showing the current status. It is your own hold only when that line is by `session legion-daemon:<PROJECT>` and, within 10 minutes after it, a session's comment begins `Parked by Legion while it waits on:`. Every other park is someone else's. `Events:` shows only the last 10 events: when the run reaches the oldest one shown, read `/api/v1/issues/<root>/events?order=desc&limit=200` with the `curl` of `skill://legion-controller/references/session.md` ("Reading Dispatch's API"); when it still does, you cannot read who parked it, so judge only the events newer than the oldest you read, and name older decisions in your summary as ones you could not place. A decision older than the park is no reason to run.
15
15
  3. **Read once.** A `Parked decision read:` comment from any session, newer than the decision, on the root or the decision's issue, has judged it: do nothing.
16
- 4. **Judge the words, not the kind.** Read the decision (`dispatch read --ref <ref>`; for an approval, `issues.<root>.designGate` and `gatedSteps`). An approval and its approval request's `ask.answered` are one decision, `ref` `dispatch://<KEY>/spec`.
16
+ 4. **Judge the words, not the kind.** Read the decision (`dispatch read --ref <ref>`; for an approval, `issues.<root>.designGate` and `gatedSteps`). An approval and its approval request's `ask.answered` are one decision, `ref` the approved document's (`dispatch://<KEY>/spec` for the spec).
17
17
  - It gives the work a next step: an approval (every `gatedSteps` entry `approved`; an `approvedVersion` below `currentVersion` counts), a change request that says what to change, an answer that picks an option or supplies the fact, a reply that tells the agent to go on.
18
18
  - Your own hold: `set_status` the root to `todo`, and comment `Parked decision read: <ref> by <login> gives this tree its next step (<one sentence>). Legion runs it again.`
19
19
  - Another's park, or one you cannot read, whose words ask Legion to start the tree: `todo`, and comment `Parked decision read: <ref> by <login> asks Legion to start this tree. Legion runs it again.`
@@ -6,7 +6,7 @@ Read this when the skill's wake table sends you here. Wakes come on `notificatio
6
6
 
7
7
  Run the every-turn steps and the parked-root walk. Name in the day's report, and take nothing for: each `openCapabilities` row (the operator decides a deployment row, whose `configLine` names its `legion.yaml` line; the operator or the issue's architect fixes a live row's session), each `blocked` and `held` row, and each `silent` entry with its role and how long it has been quiet (with `backgroundSince`, how long its background work has stood).
8
8
 
9
- A `silent` entry is a phase worker nothing will prompt: the daemon sends its task again and tells its architect. When that architect is itself not answering, read the tree's root claim (`issues.<ROOT>.architect`, `<ROOT>` the entry's `tree`). When it reads `failed`, act as [`worker-died`](#worker-died-architect) says. When the owning architect's claim does not read `failed` and the Envoy registry shows its session `gone`, `fresh_session` that architect.
9
+ A `silent` entry is a phase worker nothing will prompt: the daemon sends its task again (with `backgroundSince`, it sends nothing) and tells its architect. When that architect is itself not answering, read the tree's root claim (`issues.<ROOT>.architect`, `<ROOT>` being `issues.<KEY>.tree` and `<KEY>` the entry's `issue`). When it reads `failed`, act as [`worker-died`](#worker-died-architect) says. When the owning architect's claim does not read `failed` and the Envoy registry shows its session `gone`, `fresh_session` that architect.
10
10
 
11
11
  ## `awaiting-person`
12
12
 
@@ -14,7 +14,7 @@ A root that waits only on a person keeps its slot: do not park it or take anythi
14
14
 
15
15
  ## `tree-stalled`
16
16
 
17
- Nothing of the tree has moved for `stalled_tree_notice_hours` and no agent of it works; the daemon starts nothing and tells you once per stop. Read the tree and decide: ask a role what it waits on (`envoy_publish` to its role topic), move an issue back a phase nobody works, or, for a tree that waits on an event outside Legion, ask whether to park it (`skill://legion-controller/references/park-asks.md`).
17
+ Nothing of the tree has moved for `stalled_tree_notice_hours` and no agent of it works; the daemon starts nothing and tells you once per stop. Read the tree and decide: ask a role what it waits on (`envoy_publish` to its role topic), or, for a tree that waits on an event outside Legion, ask whether to park it (`skill://legion-controller/references/park-asks.md`).
18
18
 
19
19
  ## `architect-stalled`
20
20
 
@@ -34,7 +34,7 @@ The root's architect ran out of launches or prompts. When the root's `phase` is
34
34
 
35
35
  ## `worker-stalled` (architect)
36
36
 
37
- The daemon ended a stalled turn of the tree's architect; the notice says what became of the process and what the owed task waits on. Do nothing, unless it names the failed end (its `worker-died` follows) or a stop the runtime did not confirm, which is a finding for a person, as are repeated stalls of one architect.
37
+ The daemon ended a stalled turn of the tree's architect, took the turn off its claim, or took back its task without ending the turn; the notice says what became of the process and what the owed task waits on. Do nothing, unless it names the failed end (its `worker-died` follows) or a stop the runtime did not confirm, which is a finding for a person, as are repeated stalls of one architect.
38
38
 
39
39
  ## `provider-errors`
40
40
 
@@ -31,9 +31,7 @@ exist. Each `task` runs as a job of its own: `wait` for each result and answer f
31
31
 
32
32
  Before you rely on a step 1 hit, `grep` `docs/solutions/` for its path. If another file lists that
33
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 that tells a worker to check the GitHub
35
- App of a commit's author or committer, follow the trailer rule of
36
- `skill://legion-worker/references/default-branch-check.md` instead.
34
+ `Extends docs/solutions/<hit path>`, read both.
37
35
 
38
36
  ## Output
39
37
 
@@ -9,9 +9,9 @@ Retro runs on the reviewed head, between the architect's acceptance and the merg
9
9
  `<issue>` is your `LEGION_ISSUE`. Run every step, even on a mechanical change.
10
10
 
11
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.
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
15
  Retro writes no handoff. In the workspace it changes nothing; outside it, it writes only step 4's
16
16
  `mktemp -d` directory, the PR body and the Dispatch comment and message. It sets no GitHub or
17
17
  Dispatch label: Legion keeps phase state in the daemon.
@@ -5,16 +5,15 @@ description: Use when dispatched as a per-process Legion phase worker — planne
5
5
 
6
6
  # Legion Phase Worker
7
7
 
8
- Your role prompt gives the workspace, the push, the handoff, `handoff_complete`, the waits and the pod release; this skill adds the rest. Where it disagrees with the code or a command's `--help`, follow those and tell your architect which line is wrong.
8
+ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`, the waits and the pod release; this skill adds the rest.
9
9
 
10
10
  ## Every phase
11
11
 
12
12
  1. Read the issue, then its `open-items.md` where one exists (`dispatch doc-read --issue <issue> --artifact open-items-md`): the architect records decisions there that it does not message. Then read each earlier phase's handoff (`dispatch handoff-read --issue <issue> --phase <plan|implement|test|review>`). A record beats your memory.
13
- 2. Before the turn's first `jj new`, list `jj -R "$LEGION_WORKSPACE" diff -r @ --name-only` and `jj -R "$LEGION_WORKSPACE" diff --from "legion/<issue>@origin" --to @ --name-only`. A path you did not write in either list: read `skill://legion-worker/references/foreign-path.md`.
14
- 3. Commit only your phase's paths: `jj -R "$LEGION_WORKSPACE" split -m "<message>" <paths…>`.
15
- 4. 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: the working copy is the next role's first commit.
16
- 5. 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
- 6. A codebase-wide rename or deletion leaves historical records (transcripts, test snapshots, changelog entries) unchanged.
13
+ 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.
16
+ 5. A codebase-wide rename or deletion leaves historical records (transcripts, test snapshots, changelog entries) unchanged.
18
17
 
19
18
  ## Stop rules
20
19
 
@@ -30,12 +29,11 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
30
29
  - a pushing role whose second push still did not carry the pull request onto its commit.
31
30
  - 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.
32
31
  - No surface reaches the changed path: report it to the architect, never complete (`skill://legion-worker/references/pr-body.md`).
33
- - 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.
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.
34
33
  - When another role's topic answers 404, read its handoff with `dispatch handoff-read`.
35
34
 
36
35
  ## Commits and pushes
37
36
 
38
- - Before a push, run the trailer check in `skill://legion-worker/references/default-branch-check.md`. Then, with the `$default` it set, read your branch's full commit messages: `jj -R "$LEGION_WORKSPACE" log -r "${default}@origin..@" -T 'description ++ "\n"'`. Earlier phases' commits in it are expected; `description.first_line()` shows no trailer.
39
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.
40
38
  - A repository you clone under `$LEGION_WORKSPACE` is stamped with this issue's key: clone one you will push elsewhere outside it.
41
39
  - A planner whose issue moved back from implementing starts on the remote tip: `jj -R "$LEGION_WORKSPACE" new legion/<KEY>@origin`.
@@ -21,7 +21,7 @@ Before you race another tree's pull request on shared files, `envoy_publish` to
21
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").
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
- 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`, which rewrite the shared operation log.
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`.
25
25
 
26
26
  ## Reading a merge of the base
27
27
 
@@ -34,7 +34,7 @@ Every role reads a merge of the base the same way:
34
34
 
35
35
  A head that conflicts with its base keeps the issue in its phase. The daemon reads GitHub twice, at least a minute apart, and acts only on a conflict both reads report, and only when the next step needs a mergeable head: the issue stands in `merging`; a check the base requires has no green result on the head, since GitHub runs no check on a conflicting head; the base requires a pull request to be current with it; or the daemon could not read the base's rules. In `accepting` and `retro` the conflict waits for the merger.
36
36
 
37
- - Before `merging` the implementer gets a merge-forward message on its role topic, and in `merging` the merger does. Merge the base forward in `$LEGION_WORKSPACE`, the one workspace every role of the issue shares, so another role's work can sit in it: before this merge's `jj new`, run the two path lists of step 2 of `skill://legion-worker` again, even when this turn already ran a `jj new`, and read `skill://legion-worker/references/foreign-path.md` for any path you did not write. Then merge as *Reintegrating the base* says and push the issue branch, with no handoff and no completion for the merge. In `implementing` the phase is the implementer's, and its assignment and its completion stand.
37
+ - Before `merging` the implementer gets a merge-forward message on its role topic, and in `merging` the merger does. Merge the base forward in `$LEGION_WORKSPACE`, the one workspace every role of the issue shares, as *Reintegrating the base* says, and push the issue branch, with no handoff and no completion for the merge. In `implementing` the phase is the implementer's, and its assignment and its completion stand.
38
38
  - In `testing` and `reviewing`, the phase's worker is told to stop writing the workspace: stop at once, complete nothing at the old head, and keep your turn and its jobs. When the push lands you are told the new head: read the merge as above and go on at that head.
39
39
 
40
40
  ## A wrong pushed commit
@@ -49,7 +49,7 @@ GitHub refuses a body over 65,536 characters: past about 48,000, link evidence r
49
49
 
50
50
  ## The brief for the human
51
51
 
52
- The implementer keeps `Outcome`, `Why`, `Change`, `Proven by` and `Size` true after every push. At each round the reviewer writes `Look at first`, and `Not proven / risk`, copying word for word every claim recorded as unproven (the tester's `failures`, its own review, a proof-check comment). A requirement there is unmet, unless only the deploy can show it and the plan names its observation. A stale `Outcome` is a finding against the implementer; the merger rewrites nothing.
52
+ The implementer keeps `Outcome`, `Why`, `Change`, `Proven by` and `Size` true after every push. At each round the reviewer writes `Look at first`, and `Not proven / risk`, copying word for word every claim recorded as unproven (the tester's `failures`, its own review). A requirement there is unmet, unless only the deploy can show it and the plan names its observation. A stale `Outcome` is a finding against the implementer; the merger rewrites nothing.
53
53
 
54
54
  ## What a result is
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "5.10.2",
3
+ "version": "5.11.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -12,7 +12,7 @@ Every message the client prints is explained at https://cybermonklabs.github.io/
12
12
  ## The one form
13
13
 
14
14
  ```sh
15
- agent-secrets NAME... --reason 'TEXT' [--wait DURATION] [--ttl DURATION] -- <command> [args...]
15
+ agent-secrets NAME... [--reason 'TEXT'] [--wait DURATION] [--ttl DURATION] -- <command> [args...]
16
16
  ```
17
17
 
18
18
  - Each granted secret reaches `<command>`'s environment under its own name. Nothing runs unless every name is granted.
@@ -70,12 +70,12 @@ Your transcript keeps everything a command prints.
70
70
  A deployment can keep a secret's value back. The name then holds `agent-secrets-placeholder-` and 32 letters and digits, and the broker's proxy, which the run's `HTTPS_PROXY` names, puts the real value into the call to the secret's service. A shape check reads only the placeholder.
71
71
 
72
72
  - Make every call inside the `agent-secrets NAME -- <command>` run. A tool that caches a token across runs, or calls outside the run, stops working.
73
- - A proxy refusal names the rule that refused it, and a retry does not fix it: report it with the command and its output. `407` means the grant ended: ask again. `503` means the broker could not read the grant: try the call again.
73
+ - A proxy refusal names why it refused the call, and a retry does not fix it: change what the command sent as the refusal says, or report it with the command and its output. `407` means the grant ended: ask again. `503` means the broker could not read the grant: try the call again.
74
74
  - A GitHub narrowing and an airlocked name cannot share a run: ask for the GitHub App secret in a run of its own.
75
75
 
76
76
  ## What the exit status means
77
77
 
78
- After a grant the client writes `agent-secrets: <names> from <source>` to stderr, and the status is then the command's own. Without that line the status is the client's:
78
+ After a grant the client writes `agent-secrets: <names> from <source>` to stderr, and the status is then the command's own, unless a line `agent-secrets: exec <command>: …` follows it: then the status is 1. Without the grant line the status is the client's:
79
79
 
80
80
  - **1**: a refusal or a failure that the message names.
81
81
  `UNKNOWN_SECRET` is final: do not ask again, and do not try a name of your own.
@@ -83,7 +83,7 @@ After a grant the client writes `agent-secrets: <names> from <source>` to stderr
83
83
  `REQUEST_PENDING` names a waiting request of this session that shares a name with this one.
84
84
  - **2**: a usage error, such as no `AGENT_SECRETS_URL` or no `--`.
85
85
  - **75**: the request is still undecided when `--wait` runs out, and nothing ran. The message gives the `agent-secrets status <request_id>` that reads it.
86
- - **77**: the request was denied; the message gives the broker's reason when it recorded one. Final: ask for none of it again, and try no name of your own. The one exception is a message that says `ask again with --reason`: ask again with `--reason`.
86
+ - **77**: the request was denied; the message gives the broker's reason when it recorded one. Final: ask for none of it again, and try no name of your own. The exceptions: on a message that says `ask again with --reason`, ask again with `--reason`; on `requester-group-unread`, ask again later.
87
87
 
88
88
  ## Where a name comes from
89
89
 
@@ -32,6 +32,7 @@ Compare the check-run ids of the names both attempt sets share; a name only the
32
32
 
33
33
  ## Reconcile with GitHub's rollup
34
34
 
35
+ - The reference reads no rollup.
35
36
  - GitHub's read is complete: its failing check runs and failing statuses replace the stored ones wholesale.
36
37
  - Compare its attempt set in the same way. A newer set merges into the fence and takes the identity, with no listener generation; the same set applies GitHub's verdict and keeps the listener identity for duplicate detection; ignore an older set, a mixed set, and an empty set when the fence already holds ids.
37
38
  - After a terminal (green or red) read, accept a live settlement at the same set only if its effective outcome agrees with GitHub's verdict: the check-run failures it reports, plus the stored ones it leaves out, plus each failed status you keep once its `statuses` merge in. One that disagrees is stale, whatever its generation, until the set advances.
@@ -40,6 +41,6 @@ Compare the check-run ids of the names both attempt sets share; a name only the
40
41
  ## Known gaps
41
42
 
42
43
  - A run whose conclusion changes in place, on the same run id: GitHub's view stands until the next successful, non-skipped read at that set.
43
- - A check whose highest run is deleted on GitHub: the fence keeps that id, and only GitHub's read retires its failure.
44
+ - A check whose highest run is deleted on GitHub: the fence keeps that id, and only a newer run of that name, or GitHub's read, retires its failure.
44
45
  - A legacy in-progress check whose completion is never seen holds the head unsettled: rerun that check.
45
46
  - A consumer that orders head changes by the pull request's `updated_at` (one-second resolution) accepts a stale read of the previous head made in the same second as its replacement, until its next accurate read.
@@ -14,4 +14,4 @@ Read this in a Legion pane before you touch a role claim, or when a Legion role
14
14
  - `delivery_failed`: the stream stored no forward for the holder. It releases no claim.
15
15
  - A role message to a released Legion role is kept for one hour and wakes the role. The woken session gets it as an Envoy card with `kept_at`, which can come before the daemon's task.
16
16
  - A role send the listener refuses `404` also raises an exception on `notifications.envoy.exceptions.notifications.role.<role>`, naming `unclaimed` or `holder_lapsed`.
17
- No consumer acts on it, and the daemon's own refused message retries by itself: never re-send a refused message by hand because of one.
17
+ No consumer acts on it, and the daemon decides by itself whether to send its own refused message again: never re-send a refused message by hand because of one.
@@ -6,7 +6,7 @@ Read this when a role you held is gone after a resume, fork or restart, or when
6
6
  - `/fork`, `/branch`, `/handoff` and any other switch that carries the transcript move the previous session's role to the new id. `/new` and `/resume` install an unrelated transcript and carry no role.
7
7
  - A holder past the live window reads `unresponsive` and keeps its role. It is not dead: start no replacement for that session and take nothing from it.
8
8
  Only the role-claim reaper releases a claim, once the holder is `gone`.
9
- - An automatic reclaim is a soft claim and never steals. The listener grants it when the role is unheld, when its holder is not `live`, or when the holder is the session this one continues (a fork's parent) and no other client instance runs it live.
9
+ - An automatic reclaim is a soft claim and never steals. The listener grants it when the role is unheld, when its holder is not `live`, or when the holder is the session this one continues (a fork's parent) and either no other client instance runs it live or one of the two carries no client instance id.
10
10
  Any other `live` holder keeps the role: the listener refuses, names that holder, and the resumed session logs a warning and holds nothing.
11
11
  - A refused session keeps running and stays registered, without the role, and does not claim again at each heartbeat.
12
12
  The Oh My Pi plugin takes the role at its next session event once the holder is no longer live; the Claude Code channel takes it at an explicit claim. `envoy_role_get` names the holder now.
@@ -6,8 +6,6 @@ disable-model-invocation: true
6
6
 
7
7
  # Thermonuclear Code Quality
8
8
 
9
- 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.
10
-
11
9
  Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact path. Never delete by a glob in a shared directory: another session's open directories may sit beside yours, as they do in a shared `$TMPDIR`.
12
10
 
13
11
  This is a maintainability review of one diff: the current branch's changes, or the range you are given. Every remedy keeps behavior the same and removes code or concepts, or moves code where a reader finds it without reading the rest of the file. A behavior change is work for `skill://thermonuclear-deep-review`. The table's last two rows change ordering or failure behavior: say so in the finding.
@@ -6,8 +6,6 @@ disable-model-invocation: true
6
6
 
7
7
  # Thermonuclear Deep Review
8
8
 
9
- 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.
10
-
11
9
  Make your own scratch as `skill://thermonuclear-code-quality` says.
12
10
 
13
11
  ## Verdict
@@ -41,7 +41,7 @@ import {
41
41
  startChannelSession,
42
42
  } from "../envoy-channel-server"
43
43
  import { inboundOffChannelSession } from "../envoy-off"
44
- import { installedPluginVersion } from "../installed-build"
44
+ import { channelConnectionName, installedPluginVersion } from "../installed-build"
45
45
  import { SessionIdentity } from "../session-identity"
46
46
  import { sessionTitle } from "../session-title"
47
47
  import { type CodexAgentStream, startCodexAgentStream } from "./codex-agent-stream"
@@ -542,7 +542,11 @@ export async function runCodexEnvoyServer(): Promise<void> {
542
542
  // taken; or the listener's relay socket, opened again for the new session at a `/new`. A
543
543
  // connection that closes for good is replaced as the Claude Code one is (`channelReopener`):
544
544
  // Codex starts no plugin server again for a thread whose server lost its connection.
545
- const natsName = `codex-envoy-channel-${id.id}`
545
+ const natsName = channelConnectionName(
546
+ `codex-envoy-channel-${id.id}`,
547
+ bundlePath,
548
+ CODEX_PACKAGE_NAME,
549
+ )
546
550
  // A stop asked for while the token or the dial is awaited ends the start, and is no failure:
547
551
  // the process ends as an asked-for stop does, as the Claude Code server's does.
548
552
  const dialled = await dialChannelInbound(
@@ -114,7 +114,7 @@ import {
114
114
  } from "./channel-topics"
115
115
  import { claudeProjectDirectory, claudeSessionId, configuredValue } from "./claude-session"
116
116
  import { inboundOffChannelSession, serveEnvoyOff } from "./envoy-off"
117
- import { installedPluginVersion } from "./installed-build"
117
+ import { channelConnectionName, installedPluginVersion } from "./installed-build"
118
118
  import {
119
119
  endPane,
120
120
  type LegionClaim,
@@ -2809,7 +2809,11 @@ export async function runEnvoyChannelServer(): Promise<void> {
2809
2809
  : inbound.natsCredential.kind === "broker"
2810
2810
  ? "it waits for this session's broker token, and its stderr says what each trade came to"
2811
2811
  : "it connects to NATS"
2812
- const natsName = `claude-envoy-channel-${identity.id}`
2812
+ const natsName = channelConnectionName(
2813
+ `claude-envoy-channel-${identity.id}`,
2814
+ bundlePath,
2815
+ packageName,
2816
+ )
2813
2817
  const dialled = await dialChannelInbound(
2814
2818
  inbound,
2815
2819
  envoy.url,
@@ -4,7 +4,8 @@
4
4
  // the version is the published npm version, since this plugin's marketplace entry is an `npm`
5
5
  // source. Every registration names that build to the listener, so the Agents page can tell a
6
6
  // session running a release from one running a checkout.
7
- import { sep } from "node:path"
7
+ import { dirname, join, sep } from "node:path"
8
+ import { clientBuild, clientConnectionName } from "@legion/envoy-client/nats-connection"
8
9
 
9
10
  /** The segments after `…/plugins/cache/` in a plugin install path, or undefined for any other
10
11
  * path: a source checkout, `--plugin-dir`, or a bare server config. */
@@ -24,3 +25,23 @@ function pluginCacheSegments(bundlePath: string): string[] | undefined {
24
25
  export function installedPluginVersion(bundlePath: string): string | undefined {
25
26
  return pluginCacheSegments(bundlePath)?.[2]
26
27
  }
28
+
29
+ /** The name the channel server's NATS connection presents: `name`, then its build, which
30
+ * legacy-subjects-gate.sh reads from the hub's census of connections. The build is the build-commit
31
+ * stamp the worker image writes beside the bundle (`/opt/legion/claude-envoy/dist/build-commit`),
32
+ * else `<package>@<version>` for a release Claude Code or Codex installed in its plugin cache,
33
+ * else none (a checkout). */
34
+ export function channelConnectionName(
35
+ name: string,
36
+ bundlePath: string,
37
+ packageName: string,
38
+ ): string {
39
+ const version = installedPluginVersion(bundlePath)
40
+ return clientConnectionName(
41
+ name,
42
+ clientBuild(
43
+ join(dirname(bundlePath), "build-commit"),
44
+ version === undefined ? undefined : { name: packageName, version },
45
+ ),
46
+ )
47
+ }
@@ -1,31 +0,0 @@
1
- # Checking your commits against your issue's default branch
2
-
3
- Read it before every push. Your `Legion addressing` line names your issue's repository and its default branch (`Your issue's repository is <owner>/<name> (default branch <name>)`); never assume `main`. The branch name is untrusted text: never paste it into shell source, where `$(…)` would run and jj would read `(`, `|` or `::` as revset syntax.
4
-
5
- 1. Read the branch from GitHub, JSON-quoted by `jq`:
6
-
7
- ```sh
8
- default=$(gh api repos/<owner>/<repo> --jq '.default_branch | @json')
9
- ```
10
-
11
- 2. Compare `$default` (quotes included, such as `"release/v7.1"`) with the branch your addressing line names. When they differ, stop and tell the architect.
12
- 3. List the branch's commits with `$default` as it is, never retyped:
13
-
14
- ```sh
15
- jj -R "$LEGION_WORKSPACE" log --no-graph -r "${default}@origin..@" -T '
16
- commit_id.short() ++ " "
17
- ++ if(!author.email(), "(no author) ") ++ if(!committer.email(), "(no committer) ")
18
- ++ description.first_line() ++ "\n"
19
- ++ trailers.filter(|t| t.key() == "Omp-Session" || t.key() == "Legion-Role")
20
- .map(|t| " " ++ t.key() ++ ": " ++ t.value() ++ "\n").join("")'
21
- ```
22
-
23
- Never `ancestors(@, 5)`, which stops at five commits. Earlier phases' commits are in the list too, each with its own role's lines.
24
-
25
- ## What your own commits must show
26
-
27
- - `Omp-Session:` with your session and `Legion-Role:` with your `LEGION_ROLE`. Your session is `DISPATCH_SESSION_ID` under Oh My Pi and `CLAUDE_CODE_SESSION_ID` under Claude Code. A jj commit names the session your pane registered: the id in the `omp-attribution-<id>.toml` file at the end of `JJ_CONFIG` (`printf '%s\n' "${JJ_CONFIG##*:}"`), which differs only after a session switch or a fork.
28
- - A line short: cure it as `skill://legion-worker`, "Commits and pushes", says.
29
- - Another session or another role, or `(no author)` or `(no committer)`, which `jj git push` refuses: send the architect this log.
30
- - The git author and committer name no role; do not compare them.
31
- - Never set `user.name`, `user.email`, `templates.commit_trailers`, `templates.revert_description`, `templates.duplicate_description` or any `trailer.*` key in any jj or git scope: the repository's jj config is shared by every workspace of the clone, and a `templates.commit_trailers` there replaces the pane's trailers.