@sjawhar/claude-envoy 6.6.0 → 6.8.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 (41) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/dist/codex-hook.js +49 -18
  4. package/dist/dispatch.js +49 -18
  5. package/dist/envoy-channel.js +88 -22
  6. package/dist/session-hook.js +49 -18
  7. package/legion/skills/legion-architect/SKILL.md +10 -6
  8. package/legion/skills/legion-architect/references/acceptance-steps.md +13 -0
  9. package/legion/skills/legion-architect/references/acceptance.md +7 -2
  10. package/legion/skills/legion-architect/references/decomposition.md +3 -3
  11. package/legion/skills/legion-architect/references/operations.md +57 -0
  12. package/legion/skills/legion-architect/references/wake-routing-steps.md +18 -0
  13. package/legion/skills/legion-architect/references/wake-routing.md +23 -20
  14. package/legion/skills/legion-controller/SKILL.md +23 -28
  15. package/legion/skills/legion-controller/references/admission.md +25 -6
  16. package/legion/skills/legion-controller/references/backlog-stewardship.md +17 -4
  17. package/legion/skills/legion-controller/references/consolidation.md +3 -3
  18. package/legion/skills/legion-controller/references/daily-report.md +12 -7
  19. package/legion/skills/legion-controller/references/escalation.md +10 -6
  20. package/legion/skills/legion-controller/references/finding-asks-steps.md +19 -0
  21. package/legion/skills/legion-controller/references/finding-asks.md +13 -19
  22. package/legion/skills/legion-controller/references/merge-holds.md +49 -0
  23. package/legion/skills/legion-controller/references/operations-steps.md +46 -0
  24. package/legion/skills/legion-controller/references/operations.md +75 -0
  25. package/legion/skills/legion-controller/references/parked-decisions.md +1 -1
  26. package/legion/skills/legion-controller/references/session.md +11 -6
  27. package/legion/skills/legion-controller/references/slack-mentions.md +4 -4
  28. package/legion/skills/legion-controller/references/triage.md +1 -1
  29. package/legion/skills/legion-controller/references/wakes.md +24 -14
  30. package/legion/skills/legion-controller/references/weekly-audit.md +1 -1
  31. package/legion/skills/legion-oracle/SKILL.md +6 -0
  32. package/legion/skills/legion-worker/SKILL.md +17 -22
  33. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +2 -2
  34. package/legion/skills/legion-worker/references/findings-steps.md +31 -0
  35. package/legion/skills/legion-worker/references/findings.md +21 -22
  36. package/legion/skills/legion-worker/references/stop-rules.md +15 -0
  37. package/legion/skills/legion-worker/references/tools-steps.md +11 -0
  38. package/legion/skills/legion-worker/references/tools.md +3 -3
  39. package/package.json +2 -2
  40. package/skills/dispatch/SKILL.md +1 -1
  41. package/src/legion-phase-hook.ts +13 -12
@@ -1,10 +1,10 @@
1
1
  # Conflicts, retargets, and a wrong pushed commit
2
2
 
3
- Read it when GitHub reports the pull request `CONFLICTING`, the daemon's merge-forward message asks you to merge the base forward or to stop writing the workspace, the controller asks you to resolve a conflict, the change needs something only the base has, the pull request is retargeted, you read a merge of the base, or a commit you pushed is wrong.
3
+ Read it when GitHub reports the pull request `CONFLICTING`, the daemon's merge-forward message asks you to merge the base forward or to stop writing the workspace, your own architect asks you to resolve a conflict another tree reported, the change needs something only the base has, the pull request is retargeted, you read a merge of the base, or a commit you pushed is wrong.
4
4
 
5
5
  ## Reintegrating the base
6
6
 
7
- The implementer merges the base into the issue branch only when GitHub reports it `CONFLICTING`, the daemon's merge-forward message asks it (*The daemon's ask*, below), the controller asks because of a conflict, the change needs something only the base has, or the pull request was retargeted. Past the review the merger merges the base forward when it merges, for a conflict or for a check the base's newer code breaks (its role prompt, "A head that conflicts with its base"), so the implementer merges then only when the daemon's merge-forward message or the merger asks it. Never to refresh CI or pick up the default branch: each merge is a new head that reruns CI and can void a review. Never with `jj rebase`, which rewrites pushed commits (*A wrong pushed commit*, below).
7
+ The implementer merges the base into the issue branch only when GitHub reports it `CONFLICTING`, the daemon's merge-forward message asks it (*The daemon's ask*, below), its own architect asks because of a conflict another tree reported, the change needs something only the base has, or the pull request was retargeted. Past the review the merger merges the base forward when it merges, for a conflict or for a check the base's newer code breaks (its role prompt, "A head that conflicts with its base"), so the implementer merges then only when the daemon's merge-forward message or the merger asks it. Never to refresh CI or pick up the default branch: each merge is a new head that reruns CI and can void a review. Never with `jj rebase`, which rewrites pushed commits (*A wrong pushed commit*, below).
8
8
 
9
9
  Before you race another tree's pull request on shared files, `envoy_publish` to its implementer's role topic, ask when its next push lands, and merge once, after it.
10
10
 
@@ -0,0 +1,31 @@
1
+ # The steps of a finding's routes
2
+
3
+ Read this when `skill://legion-worker/references/findings.md` sends you here for a route's steps; that file states the rule each section here carries out.
4
+
5
+ ## Write to the owner
6
+
7
+ 1. Find the owning issue: the issue of an open pull request on a `legion/<KEY>` branch that changes that code, or the open issue `dispatch search` finds for it.
8
+ 2. Walk its `child_of` links up to the tree's root: `dispatch read --issue <KEY>` names each parent under `Links:`.
9
+ 3. Post the evidence on the owning issue, and mention the root's architect. `<project>` is the Legion project that runs the tree; for your own project it is the word after `legion-` in your role token.
10
+
11
+ ```bash
12
+ dispatch comment --issue '<owning KEY>' --mention 'role:legion-<project>-<root key, lower case>-architect' --body-file - <<'EOF'
13
+ Clear defect from <your role token>
14
+ <what went wrong, where and to whom, with the numbers; dispatch://<KEY> it came from; the repository and component; the fix; why you do not make it yourself>
15
+ EOF
16
+ ```
17
+
18
+ When no tree owns the code, post the same comment on that project's report issue (`skill://legion-worker/references/findings.md#where-it-goes`; a closed one takes a comment too, and with none, your own issue), with `--mention 'role:legion-<project>-controller'`. The controller replies under it and mentions your role. `Filed dispatch://<KEY>` names the issue it filed. On `Not filed: dispatch://<ROOT> owns it; write to role:<token>` or `Not filed: tracked by dispatch://<KEY>; write to role:<token>`, write the same comment on the issue it names, mentioning that role. On `Not filed: dispatch://<KEY> owns it; role:<token> is mentioned here`, the owner has it: write nothing. On any other `Not filed:` reply, open the ask yourself (`skill://legion-worker/references/findings.md`, step 3 of its first section).
19
+
20
+ Apart from that reply, file nothing and wait for nothing. A production check's result names your comment, `dispatch://<KEY>/comment/<id>`.
21
+
22
+ ## Another agent that needs an action
23
+
24
+ `<project>` is the word after `legion-` in your role token. Name the agent by its issue and role, the action in plain words, and why, with what you observed:
25
+
26
+ ```bash
27
+ dispatch comment --issue '<KEY>' --mention 'role:legion-<project>-controller' --body-file - <<'EOF'
28
+ Action on an agent
29
+ <KEY> <role>: <the action: stop, retry, suspend, resume the agent, compact, or start it in a fresh session>, because <what you observed, with the numbers and when>
30
+ EOF
31
+ ```
@@ -1,48 +1,47 @@
1
1
  # A finding outside your issue
2
2
 
3
- Read it when you find a problem your issue does not cover (a defect in another component, repository or tool, a gap in Legion itself) or a production check look fails. It holds for every Legion role and its subagents, and replaces the filing step of `skill://dispatch-first`. A child's own architect opens no ask itself: it sends the finding to the architect above it, and the root's architect opens the ask.
3
+ Read it when you find a problem your issue does not cover (a defect in another component, repository or tool, a gap in Legion itself), when another agent needs an action, or when a production check look fails. It holds for every Legion role and its subagents, and replaces the filing step of `skill://dispatch-first`. A child's own architect opens no ask itself: it sends the finding to the architect above it, and the root's architect opens the ask.
4
4
 
5
- ## Fix it where you are, else hand it over, and ask only for a decision
5
+ ## Fix it yourself, else write to its owner, and ask only for a decision
6
6
 
7
7
  A finding outside your issue never becomes a `dispatch issue` you file. Take the first step that fits:
8
8
 
9
- 1. **Fix it here.** A defect with a clear fix, in code your tree touches or depends on, goes into your tree's own pull request; say so in the PR body.
10
- 2. **Hand it over.** Any other clear defect goes to the controller with its evidence (*Send a finding to the controller*). It gives the work to the tree that owns the code, or files a Legion root when none does.
11
- 3. **Ask.** A finding that needs a person's authority, taste or risk appetite (whether it is wanted, which design, who owns it, a change of scope, cost or risk) is a `dispatch ask` with one recommendation (*What the ask says*).
9
+ 1. **Fix it yourself.** A defect with a clear fix is your tree's to fix, in whichever repository it is, with judgment: in your own pull request, or in a separate pull request of your tree. The implementer makes the fix, and a tester or a reviewer sends it to the implementer with its evidence (a tester with its red test, the reviewer in its review). Say so in the PR body. A phase worker whose own pull request cannot carry the fix sends it to the architect that owns its issue with `envoy_publish`; that architect adds it to an open pull request or files a child.
10
+ 2. **Write to its owner.** A defect goes to another tree's architect only when your fix would collide with that tree's open pull request. A defect in a repository your token does not reach goes to the architect of the tree whose code it is. Only when no tree owns that code does it go to the controller of the project that repository maps to, or of your own project when Dispatch maps it to none, which files it. After the merge, the tester writes each clear defect a production check finds to its owner. How: [Write to the owner](#write-to-the-owner).
11
+ 3. **Ask.** A defect goes to a person only when it needs a person's decision, a deploy window or work much larger than your own. So does a finding that needs a person's authority, taste or risk appetite (whether it is wanted, which design, who owns it, a change of scope, cost or risk). It is a `dispatch ask` with one recommendation (*What the ask says*).
12
12
 
13
- A fix you are not sure of is not step 1. A problem inside your issue is fixed in your change. A phase worker's problem inside its tree but outside its issue goes to the architect its `Legion addressing` line names.
13
+ A human-only to-do, such as a deploy that only a person may make, is a `dispatch ask` too.
14
14
 
15
- Search first (`skill://dispatch-first`). An open issue that tracks the problem gets your evidence as a comment. An open ask on the report issue about it (`dispatch open-asks --project <PROJECT>`) gets your evidence as a reply (`dispatch comment --issue <REPORT KEY> --reply-to-ask '<ask id>' --body-file -`); open no second one.
15
+ A fix you are not sure of is not step 1: take step 2 when it holds, else step 3. A problem inside your issue is fixed in your change. A phase worker's problem inside its tree but outside its issue goes to the architect its `Legion addressing` line names. A fault of Legion's own machinery that holds your phase is a finding too, never a request to another session to act on your agent or your session; tell the owning architect too where a stop rule says so.
16
16
 
17
- ## Send a finding to the controller
17
+ Search first (`skill://dispatch-first`). An open issue that tracks the problem gets your evidence as a comment. An open ask on the report issue about it (`dispatch open-asks --project <PROJECT>`) gets your evidence as a reply (`dispatch comment --issue <REPORT KEY> --reply-to-ask '<ask id>' --body-file -`); open no second one.
18
18
 
19
- 1. Post the evidence as a `dispatch comment` on the report issue (*Where it goes*), its first line exactly `Clear defect from <your role token>`. It prints `Posted comment <id>`.
20
- 2. `envoy_publish` one message to the controller topic your `Legion addressing` line names, with `expects_reply: false`: your role token; the defect (what went wrong, where, to whom, the numbers, `dispatch://<KEY>`); the repository and component where the fix belongs; the fix; and `dispatch://<REPORT KEY>/comment/<id>`.
21
- 3. File nothing and wait for nothing. The controller replies under your evidence comment with where the work went. When the report issue is missing or closed, put the evidence in the message itself.
19
+ ## Write to the owner
22
20
 
23
- ### When no controller takes it
21
+ Write to the owner on Dispatch: a comment on the issue that owns the subject, which mentions the owner's role. Dispatch delivers the mention and retries it, so check no liveness first. The controller forwards no message from one agent to another, and it edits no repository, so a defect it finds goes to its owner this way too. Mention the root architect of the tree that owns the code, on its issue; when no tree owns it, mention the controller of the project the repository maps to, on that project's report issue. The steps, the comment's form and what to do with each reply the controller writes are in `skill://legion-worker/references/findings-steps.md#write-to-the-owner`: read them before you write.
24
22
 
25
- A publish to a role answers with its live `holder`. When no live session holds the controller role, the answer says Envoy kept the message for one hour (`kept_until`); a keep is not a delivery. An `unresponsive` holder is not a stopped one: release nothing, take nothing from it, and publish no second copy. Treat a kept answer as a controller not taking it, and make the finding an ask on the first of these that holds:
23
+ ## Another agent that needs an action
26
24
 
27
- 1. **The report issue is open:** ask there, the question opening `Clear defect from <your role token>` and `--ref` naming your evidence comment, then reply `Asked dispatch://<REPORT KEY>/ask/<id>` under that comment.
28
- 2. **The report issue is missing or closed:** post the evidence on your own issue and ask there, then publish the ask's reference to the architect that owns your issue. Where your task has an `acceptance:owner` step, it holds your issue's acceptance until a controller takes the ask. That hold keeps your issue open: an open ask on a closed issue drops out of the controller's listing.
29
- 3. **Your own issue is closed too** (`409 ISSUE_CLOSED`): put the report issue back in reach, then post and ask there, and say in your summary that you did. This is the one lifecycle status you write, and never through the `legion` tool's `set_status`.
30
- - It exists and is closed: `dispatch issue-update --issue <REPORT KEY> --status icebox`, the status alone (a closed issue refuses a reopening status beside any other field).
31
- - None exists: `dispatch issue --project <PROJECT> --title 'Legion daily report' --spec-file -`, with the Summary `skill://legion-controller/references/daily-report.md` gives, then `dispatch issue-update --issue <NEW KEY> --status icebox`. It carries no `legion` label.
25
+ The actions on an agent (stop, retry, suspend, resume the agent, compact, and start it in a fresh session) are the project's controller's alone: neither you nor your architect can take one. When another agent needs one, ask the controller with a `dispatch comment` on that agent's issue, `<KEY>`, that mentions the controller's role. Read its form in `skill://legion-worker/references/findings-steps.md#another-agent-that-needs-an-action` before you write the comment. Send the controller no `envoy_publish` for it: Dispatch delivers the mention and retries it. The controller replies under your comment with what it ran, or why it ran nothing; wait for nothing.
32
26
 
33
27
  ## Where it goes
34
28
 
35
- An ask goes on the controller's report issue while it is open: the issue the deployment instructions name for Legion's reports, else the project's `Legion daily report` (`dispatch search --query '"Legion daily report"' --project <PROJECT>`). It stays open in `icebox`, so its asks stay answerable; a closed issue withdraws its open asks and refuses answers. With no open report issue, send the finding to the controller as text (the problem, the issue it came from, the evidence and the decision it needs), and the controller opens the ask; when no controller takes that publish, follow step 2 or 3 above.
29
+ An ask goes on the controller's report issue while it is open: the issue the deployment instructions name for Legion's reports, else the project's `Legion daily report` (`dispatch search --query '"Legion daily report"' --project <PROJECT>`). It stays open in `icebox`, so its asks stay answerable; a closed issue withdraws its open asks and refuses answers. With no open report issue, open the ask on the first of these that holds:
30
+
31
+ 1. **Your own issue is open:** post the evidence and ask there, then publish the ask's reference to the architect that owns your issue. Where your task has an `acceptance:owner` step, it holds your issue's acceptance until a controller takes the ask. That hold keeps your issue open: an open ask on a closed issue drops out of the controller's listing.
32
+ 2. **Your own issue is closed too** (`409 ISSUE_CLOSED`): put the report issue back in reach, then post and ask there, and say in your summary that you did. This is the one lifecycle status you write, and never through the `legion` tool's `set_status`.
33
+ - It exists and is closed: `dispatch issue-update --issue <REPORT KEY> --status icebox`, the status alone (a closed issue refuses a reopening status beside any other field).
34
+ - None exists: `dispatch issue --project <PROJECT> --title 'Legion daily report' --spec-file -`, with the Summary `skill://legion-controller/references/daily-report.md` gives, then `dispatch issue-update --issue <NEW KEY> --status icebox`. It carries no `legion` label.
36
35
 
37
36
  ## What the ask says
38
37
 
39
- The question stands alone in at most 2,000 characters, the `Ref:` line `--ref` appends included. Its first line is `Clear defect from <your role token>` for a clear defect no controller took, else `Finding from <your role token>`. Then the concrete case: what went wrong, where and to whom (`dispatch://<KEY>`, the machine, file, command or session, the numbers); where the fix belongs, saying plainly when it is not Legion's; the decision a person must make, each option's effect and your recommendation. A clear defect carries the fix instead, with `Hand it to the owning tree` as the first, recommended option. Evidence the decision does not need goes in a comment posted first and cited by `--ref`:
38
+ The question stands alone in at most 2,000 characters, the `Ref:` line `--ref` appends included. Its first line is `Finding from <your role token>`. Then the concrete case: what went wrong, where and to whom (`dispatch://<KEY>`, the machine, file, command or session, the numbers); where the fix belongs, saying plainly when it is not Legion's; the decision a person must make, each option's effect and your recommendation. Evidence the decision does not need goes in a comment posted first and cited by `--ref`:
40
39
 
41
40
  ```bash
42
41
  dispatch comment --issue '<ASK KEY>' --body-file - <<'EOF'
43
42
  <the evidence: commands, output with its time, file:line, links>
44
43
  EOF
45
- # Keep `File it for Legion` only when your Legion addressing line lists the repository where the fix belongs.
44
+ # Keep `File it for Legion` only when both role GitHub Apps are installed on the repository where the fix belongs.
46
45
  dispatch ask --issue '<ASK KEY>' --ref 'dispatch://<ASK KEY>/comment/<id>' --question-file - \
47
46
  --option 'File an issue: <what it would track, and who would own it>' \
48
47
  --option 'File it for Legion: Legion works it once it is filed' \
@@ -54,4 +53,4 @@ EOF
54
53
 
55
54
  ## Tell the controller about the ask
56
55
 
57
- The answer reaches only the ask's followers. Once the ask is open, `envoy_publish` `dispatch://<REPORT KEY>/ask/<id>` to the controller topic with `expects_reply: false`; the controller files what the answer asks for, and you file nothing. When the listener only kept that publish, do nothing more for an ask on the report issue: the controller's catch-up finds it. An ask on the report issue blocks nothing of your own issue; one on your own issue holds its acceptance. A production check look names the message or the ask in its result and summary.
56
+ The answer reaches only the ask's followers. Once the ask is open, `envoy_publish` `dispatch://<REPORT KEY>/ask/<id>` to the controller topic with `expects_reply: false`; the controller files what the answer asks for, and you file nothing. When the listener only kept that publish, do nothing more for an ask on the report issue: the controller's catch-up finds it. An ask on the report issue blocks nothing of your own issue; one on your own issue holds its acceptance. A production check look names the comment or the ask in its result and summary.
@@ -0,0 +1,15 @@
1
+ # A refused completion
2
+
3
+ Read this when `handoff_complete` refuses your completion (`skill://legion-worker/SKILL.md`, "Stop rules"): its code says what to do.
4
+ Quote the answer verbatim to the architect first.
5
+
6
+ - `HANDOFF_STALE_GENERATION` or `HANDOFF_NO_RUN`: push nothing more and end the turn without completing.
7
+ When the task then arrives with its work and handoff done, call `handoff_complete` again in its turn; never redo the work.
8
+
9
+ - `HANDOFF_STALE_ENTRY`: end the turn without completing; the daemon sends the new entry's task by itself.
10
+ Do what it asks at the head it names, with a handoff of its own.
11
+
12
+ - `HANDOFF_HEAD_MERGED_FORWARD`: `skill://legion-worker/references/conflicts-and-rewrites.md#the-daemons-ask`.
13
+
14
+ - `HANDOFF_NOT_CURRENT_PHASE`: report it; do not retry that completion.
15
+ `HANDOFF_ALREADY_RECORDED`: the first answer stands.
@@ -0,0 +1,11 @@
1
+ # The commands of the tools reference
2
+
3
+ Read this when `skill://legion-worker/references/tools.md` sends you here; that file states the rule each command here carries out.
4
+
5
+ ## Reading a shared database
6
+
7
+ The read `tools.md`, "Reading a shared database", asks for: the reader URL piped to psql as a service file, in one read-only transaction, with no `COMMIT` in `<file>`.
8
+
9
+ ```sh
10
+ PGSERVICEFILE=<(python3 -c 'from urllib.parse import*;u=urlsplit(input());q=unquote;print(f"[r]\nhost={u.hostname}\nport={u.port or 5432}\ndbname={q(u.path[1:])}\nuser={q(u.username)}\npassword={q(u.password)}",*map("=".join,parse_qsl(u.query)),sep="\n")' <"$SESSION_READER_DSN_FILE" 2>/dev/null) PGSERVICE=r psql -1qX -v ON_ERROR_STOP=1 -c 'SET TRANSACTION READ ONLY' -f <file>
11
+ ```
@@ -12,8 +12,8 @@ Read it before you run a build or tests in your pod, read a shared database, rea
12
12
 
13
13
  - One volume at `/legion` holds the clone, every workspace, `$TMPDIR` and the caches, shared by the issue's roles. Your home and `/tmp` are on the node's small disk, whose limit evicts the pod. Read free space with `df -h /legion`.
14
14
  - A cache trimmer sweeps at 85 per cent used toward 70 (the defaults), oldest first. It deletes only `$TMPDIR/go-build<digits>` directories, `-a` and `-d` entries of `/legion/go/build`, directories directly under `/legion/scratch/cache` but `ms-playwright` and `legion-claude-code`, and directories directly under `/legion/scratch/bun/install/cache`. It skips anything open or changed in the last fifteen minutes, and deletes nothing a role put anywhere else.
15
- - `$TMPDIR` is yours to clean: nothing else deletes what you leave there, and it fills the volume for every role. Delete the paths you made, each by its exact path.
16
- - Chain a command that enters a scratch directory with `&&` (`cd -- "$TMPDIR/probe" && ./run.sh`): after a failed `cd`, `;` runs the command where the shell last stood, often the shared workspace.
15
+ - `$TMPDIR` is yours to clean: nothing else deletes what you leave there, and it fills the volume for every role.
16
+ - Chain a command that enters a scratch directory with `&&`: after a failed `cd`, `;` runs the command where the shell last stood, often the shared workspace.
17
17
 
18
18
  ## The database your tests use
19
19
 
@@ -25,7 +25,7 @@ Read it before you run a build or tests in your pod, read a shared database, rea
25
25
 
26
26
  ## Reading a shared database
27
27
 
28
- Read a database outside your pod through the read-only login whose URL is in the file `SESSION_READER_DSN_FILE` names. Never read it through the session URL the file `OMP_SESSION_SQL_DSN_FILE` names. Keep read-only inside one transaction (`BEGIN READ ONLY; … COMMIT;`, or `psql "$URL" --single-transaction -q -X -v ON_ERROR_STOP=1 -c 'SET TRANSACTION READ ONLY' -f <file>` with no `COMMIT` in the file): a session-wide setting stays on the pooled backend and fails the next client's writes. With no reader URL, report it as a fault of the deployment.
28
+ Read a database outside your pod through the read-only login whose URL is in the file `SESSION_READER_DSN_FILE` names. Never read it through the session URL the file `OMP_SESSION_SQL_DSN_FILE` names. Put no URL on a command line, which any process of the pod can read: pipe its parts to psql as a service file, with the command in `skill://legion-worker/references/tools-steps.md#reading-a-shared-database`. Put no `COMMIT` in `<file>`, so the read stays in one read-only transaction: a session-wide setting stays on the pooled backend and fails the next client's writes. With no reader URL, report it as a fault of the deployment.
29
29
 
30
30
  ## What the image carries
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "6.6.0",
3
+ "version": "6.8.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -45,6 +45,6 @@
45
45
  "zod": "4.3.6"
46
46
  },
47
47
  "legion": {
48
- "daemonApiVersion": 281
48
+ "daemonApiVersion": 282
49
49
  }
50
50
  }
@@ -10,7 +10,7 @@ Dispatch is a record for the people who decide, never a log of your work.
10
10
  - Use the `dispatch` command; the HTTP API only for what no command does. `dispatch <command> --help` gives its rules and an example.
11
11
  - Put long text on stdin, one flag per call: `--<field>-file -` with `<<'EOF'`; objects and lists take JSON.
12
12
  - Exit 2 is a usage error: fix every problem it names before you call again. Exit 1 is any other failure: Dispatch's refusal, a Dispatch the command cannot reach, or `ANSWER_NOT_KEPT` for a call that wrote nothing, which you run again. `dispatch login` exits 1 when the broker cannot be reached or refuses, the person denies the login, or its code expires; its usage error names only the first bad argument.
13
- - Never work around a hard-to-use command, or one storing or losing something wrongly: open an issue in the owning project and tell its controller. A Legion role tells its architect (`skill://legion-worker/references/findings.md`).
13
+ - Never work around a hard-to-use command, or one storing or losing something wrongly: open an issue in the owning project. A Legion role's tree fixes it, through its implementer, as `skill://legion-worker/references/findings.md` says.
14
14
 
15
15
  ## Asks and ask blocks
16
16
 
@@ -51,9 +51,10 @@ import { configuredValue } from "./claude-session"
51
51
  * daemon has failed this role's claim. The bridge reports each turn's outcome to the daemon, with
52
52
  * the status Claude Code named, and marks a turn no prompt of the daemon's ran — a reminder
53
53
  * written over the inbox — so the daemon judges that turn from the report (dispatch://INFRA-4508):
54
- * a refusal whose status cannot clear fails the claim at once and holds the issue, and a refusal
55
- * that can clear fails nothing, so the reminders keep their pace and the project's controller is
56
- * told once at six such turns in a row.
54
+ * a refusal whose status cannot clear fails the claim at once and holds the issue, and a
55
+ * refusal that can clear fails nothing, so the reminders keep their pace. At six such turns in
56
+ * a row the daemon sends the `provider-errors` notice once (`providerErrorRunReached` in the
57
+ * daemon's `workflow.go` says to whom).
57
58
  */
58
59
 
59
60
  /** The tool's name: Claude Code shows it as `mcp__legion__legion_phase_hook`, and a hook entry
@@ -544,15 +545,15 @@ export function createPhaseHookEndpoint(deps: PhaseHookDeps): PhaseHookEndpoint
544
545
  case "StopFailure": {
545
546
  // Claude Code runs this instead of `Stop` when the turn ended on an API error, and
546
547
  // `${last_assistant_message}` is then the error text itself rather than anything the
547
- // worker said ("Hooks reference", code.claude.com/docs/en/hooks). So this is the
548
- // provider refusing the turn, and the machine takes it as one: it earns no
549
- // continuation, because the next turn would be refused the same way, and one timer,
550
- // because nothing else would wake this worker once the task that turn carried ended
551
- // with it. What ends the reminding is the daemon failing the claim, which the timer's
552
- // own record check reads: it does at once for a refusal whose status cannot clear, the
553
- // status the bridge reports beside the turn's outcome, a reminder's own turn included,
554
- // and never for a refusal that can clear, of which the controller is told at six in a
555
- // row (dispatch://INFRA-4508).
548
+ // worker said ("Hooks reference", code.claude.com/docs/en/hooks). So this is the provider
549
+ // refusing the turn, and the machine takes it as one: it earns no continuation, because
550
+ // the next turn would be refused the same way, and one timer, because nothing else would
551
+ // wake this worker once the task that turn carried ended with it. What ends the reminding
552
+ // is the daemon failing the claim, which the timer's own record check reads: it does at
553
+ // once for a refusal whose status cannot clear, the status the bridge reports beside the
554
+ // turn's outcome, a reminder's own turn included, and never for a refusal that can clear,
555
+ // of which the daemon sends the `provider-errors` notice at six in a row
556
+ // (dispatch://INFRA-4508; `providerErrorRunReached` in the daemon says to whom).
556
557
  // Claude Code ignores whatever this hook returns, which costs nothing now that there
557
558
  // is nothing to return.
558
559
  await reminder.settle({ kind: "refused", message: event.lastAssistantMessage ?? "" })