@sjawhar/claude-envoy 5.16.8 → 5.18.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 (29) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.omp-plugin/plugin.json +1 -1
  3. package/dist/codex-hook.js +14 -2
  4. package/dist/dispatch.js +14 -2
  5. package/dist/envoy-channel.js +86 -6
  6. package/dist/session-hook.js +14 -2
  7. package/legion/skills/legion-architect/SKILL.md +8 -6
  8. package/legion/skills/legion-architect/references/acceptance.md +6 -12
  9. package/legion/skills/legion-architect/references/decomposition.md +10 -20
  10. package/legion/skills/legion-architect/references/design-gate.md +21 -42
  11. package/legion/skills/legion-architect/references/plan.md +1 -1
  12. package/legion/skills/legion-architect/references/surface-round.md +29 -0
  13. package/legion/skills/legion-architect/references/wake-routing.md +2 -2
  14. package/legion/skills/legion-controller/SKILL.md +4 -6
  15. package/legion/skills/legion-controller/references/admission.md +5 -1
  16. package/legion/skills/legion-controller/references/parked-decisions.md +1 -1
  17. package/legion/skills/legion-controller/references/wakes.md +1 -1
  18. package/legion/skills/legion-controller/references/weekly-audit.md +1 -1
  19. package/legion/skills/legion-worker/SKILL.md +6 -3
  20. package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +11 -4
  21. package/legion/skills/legion-worker/references/merge-gate.md +3 -8
  22. package/legion/skills/legion-worker/references/pr-body.md +4 -6
  23. package/legion/skills/legion-worker/references/results.md +2 -2
  24. package/legion/skills/simplify-settled-diff/SKILL.md +1 -1
  25. package/package.json +2 -2
  26. package/skills/dispatch-writing-specs/SKILL.md +3 -6
  27. package/skills/plain-words/SKILL.md +1 -1
  28. package/skills/thermonuclear-deep-review/SKILL.md +1 -1
  29. package/src/envoy-channel-server.ts +6 -0
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "5.16.8"
5
+ "version": "5.18.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "5.16.8",
3
+ "version": "5.18.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -23082,9 +23082,20 @@ function renderInbound(raw, sessionID, subject, wholeBody) {
23082
23082
  },
23083
23083
  ...unrecognised === undefined ? {} : { unrecognised }
23084
23084
  };
23085
+ let card;
23086
+ let payloadShownAsText;
23087
+ try {
23088
+ card = encode3({ envoy: rendered });
23089
+ } catch (error) {
23090
+ const payloadKey = dispatchRendered ? "dispatch" : "message";
23091
+ if (envelope.payload === undefined || !(payloadKey in rendered))
23092
+ throw error;
23093
+ card = encode3({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
23094
+ payloadShownAsText = messageFor(error);
23095
+ }
23085
23096
  return {
23086
23097
  skip: false,
23087
- content: trailer === "" ? encode3({ envoy: rendered }) : `${encode3({ envoy: rendered })}
23098
+ content: trailer === "" ? card : `${card}
23088
23099
 
23089
23100
  ${trailer}`,
23090
23101
  envelope,
@@ -23093,7 +23104,8 @@ ${trailer}`,
23093
23104
  ...rejectedDelivery === undefined ? {} : { rejectedDelivery },
23094
23105
  ...malformedDelivery ? { malformedDelivery: true } : {},
23095
23106
  ...pictures.length === 0 ? {} : { pictures },
23096
- ...cutItem === undefined ? {} : { cutItem }
23107
+ ...cutItem === undefined ? {} : { cutItem },
23108
+ ...payloadShownAsText === undefined ? {} : { payloadShownAsText }
23097
23109
  };
23098
23110
  }
23099
23111
 
package/dist/dispatch.js CHANGED
@@ -28371,9 +28371,20 @@ function renderInbound(raw, sessionID, subject, wholeBody) {
28371
28371
  },
28372
28372
  ...unrecognised === undefined ? {} : { unrecognised }
28373
28373
  };
28374
+ let card;
28375
+ let payloadShownAsText;
28376
+ try {
28377
+ card = encode5({ envoy: rendered });
28378
+ } catch (error) {
28379
+ const payloadKey = dispatchRendered ? "dispatch" : "message";
28380
+ if (envelope.payload === undefined || !(payloadKey in rendered))
28381
+ throw error;
28382
+ card = encode5({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
28383
+ payloadShownAsText = messageFor(error);
28384
+ }
28374
28385
  return {
28375
28386
  skip: false,
28376
- content: trailer === "" ? encode5({ envoy: rendered }) : `${encode5({ envoy: rendered })}
28387
+ content: trailer === "" ? card : `${card}
28377
28388
 
28378
28389
  ${trailer}`,
28379
28390
  envelope,
@@ -28382,7 +28393,8 @@ ${trailer}`,
28382
28393
  ...rejectedDelivery === undefined ? {} : { rejectedDelivery },
28383
28394
  ...malformedDelivery ? { malformedDelivery: true } : {},
28384
28395
  ...pictures.length === 0 ? {} : { pictures },
28385
- ...cutItem === undefined ? {} : { cutItem }
28396
+ ...cutItem === undefined ? {} : { cutItem },
28397
+ ...payloadShownAsText === undefined ? {} : { payloadShownAsText }
28386
28398
  };
28387
28399
  }
28388
28400
 
@@ -50336,9 +50336,20 @@ function renderInbound(raw, sessionID, subject, wholeBody) {
50336
50336
  },
50337
50337
  ...unrecognised === undefined ? {} : { unrecognised }
50338
50338
  };
50339
+ let card;
50340
+ let payloadShownAsText;
50341
+ try {
50342
+ card = encode5({ envoy: rendered });
50343
+ } catch (error) {
50344
+ const payloadKey = dispatchRendered ? "dispatch" : "message";
50345
+ if (envelope.payload === undefined || !(payloadKey in rendered))
50346
+ throw error;
50347
+ card = encode5({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
50348
+ payloadShownAsText = messageFor(error);
50349
+ }
50339
50350
  return {
50340
50351
  skip: false,
50341
- content: trailer === "" ? encode5({ envoy: rendered }) : `${encode5({ envoy: rendered })}
50352
+ content: trailer === "" ? card : `${card}
50342
50353
 
50343
50354
  ${trailer}`,
50344
50355
  envelope,
@@ -50347,7 +50358,8 @@ ${trailer}`,
50347
50358
  ...rejectedDelivery === undefined ? {} : { rejectedDelivery },
50348
50359
  ...malformedDelivery ? { malformedDelivery: true } : {},
50349
50360
  ...pictures.length === 0 ? {} : { pictures },
50350
- ...cutItem === undefined ? {} : { cutItem }
50361
+ ...cutItem === undefined ? {} : { cutItem },
50362
+ ...payloadShownAsText === undefined ? {} : { payloadShownAsText }
50351
50363
  };
50352
50364
  }
50353
50365
 
@@ -62276,9 +62288,9 @@ var import_nats5 = __toESM(require_mod4(), 1);
62276
62288
 
62277
62289
  // package.json
62278
62290
  var name2 = "@sjawhar/claude-envoy";
62279
- var version2 = "5.16.8";
62291
+ var version2 = "5.18.0";
62280
62292
  var legion = {
62281
- daemonApiVersion: 220
62293
+ daemonApiVersion: 228
62282
62294
  };
62283
62295
  var package_default = {
62284
62296
  name: name2,
@@ -64210,6 +64222,34 @@ var legionConsumerLag = object({
64210
64222
  stalled: boolean2().optional(),
64211
64223
  unavailable: nonEmptyString2.optional()
64212
64224
  });
64225
+ var LEGION_INTAKE_GIVE_UP_REASONS = [
64226
+ "bound",
64227
+ "did not end",
64228
+ "retention",
64229
+ "undecodable",
64230
+ "consumer moved past"
64231
+ ];
64232
+ var legionIntakeGiveUpCount = object({
64233
+ name: nonEmptyString2,
64234
+ open: number2().int().positive(),
64235
+ newestSeq: number2().int().positive()
64236
+ });
64237
+ var legionIntakeGiveUp = object({
64238
+ id: number2().int().positive().optional(),
64239
+ consumer: nonEmptyString2.optional(),
64240
+ subject: nonEmptyString2.optional(),
64241
+ streamSeq: number2().int().positive().optional(),
64242
+ storedAt: timestamp.optional(),
64243
+ eventId: nonEmptyString2.nullable().optional(),
64244
+ deliveries: number2().int().nonnegative().optional(),
64245
+ gaveUpAt: timestamp.optional(),
64246
+ reason: _enum2(LEGION_INTAKE_GIVE_UP_REASONS).optional(),
64247
+ lastError: string2().optional()
64248
+ });
64249
+ var legionIntakeGiveUps = object({
64250
+ consumers: array(legionIntakeGiveUpCount),
64251
+ newest: array(legionIntakeGiveUp).optional()
64252
+ });
64213
64253
  var legionPauseActor = discriminatedUnion("kind", [
64214
64254
  object({ kind: literal("controller"), session: nonEmptyString2 }),
64215
64255
  object({ kind: literal("operator") })
@@ -64266,7 +64306,8 @@ var LegionStateResponse = object({
64266
64306
  repositories: legionRepositories.optional(),
64267
64307
  settings: legionSettings.optional(),
64268
64308
  consumers: array(legionConsumerLag).optional(),
64269
- lowestPluginContract: number2().int().positive().optional()
64309
+ lowestPluginContract: number2().int().positive().optional(),
64310
+ intakeGiveUps: legionIntakeGiveUps.optional()
64270
64311
  });
64271
64312
  var LegionIssueRecordResponse = legionIssue;
64272
64313
  var LegionHealthResponse = object({
@@ -64503,6 +64544,20 @@ var LegionPauseFailureResponse = object({
64503
64544
  pause: legionPause.optional(),
64504
64545
  lastPause: legionEndedPause.optional()
64505
64546
  });
64547
+ var LEGION_INTAKE_REPLAY_OUTCOMES = ["applied", "already applied", "no fact", "failed"];
64548
+ var LegionIntakeReplayResponse = object({
64549
+ replayed: array(object({
64550
+ id: number2().int().positive().optional(),
64551
+ consumer: nonEmptyString2.optional(),
64552
+ streamSeq: number2().int().positive().optional(),
64553
+ outcome: _enum2(LEGION_INTAKE_REPLAY_OUTCOMES).optional(),
64554
+ error: nonEmptyString2.optional()
64555
+ })).optional(),
64556
+ remaining: number2().int().nonnegative().optional()
64557
+ });
64558
+ var LegionIntakeDiscardResponse = object({
64559
+ discarded: array(number2().int().positive()).optional()
64560
+ });
64506
64561
  var LegionGrantRequest = strictObject({
64507
64562
  sessionId: nonEmptyString2,
64508
64563
  secret: nonEmptyString2,
@@ -64557,6 +64612,19 @@ var LegionProjectPauseRequest = strictObject({
64557
64612
  var LegionProjectResumeRequest = strictObject({
64558
64613
  grantId: nonEmptyString2
64559
64614
  });
64615
+ var oneGiveUp = { giveUp: number2().int().positive() };
64616
+ var giveUpsThroughSeq = {
64617
+ consumer: nonEmptyString2,
64618
+ throughSeq: number2().int().positive()
64619
+ };
64620
+ var LegionIntakeReplayRequest = union([
64621
+ strictObject({ grantId: nonEmptyString2, ...oneGiveUp }),
64622
+ strictObject({ grantId: nonEmptyString2, ...giveUpsThroughSeq })
64623
+ ]);
64624
+ var LegionIntakeDiscardRequest = union([
64625
+ strictObject({ grantId: nonEmptyString2, ...oneGiveUp, reason: nonEmptyString2 }),
64626
+ strictObject({ grantId: nonEmptyString2, ...giveUpsThroughSeq, reason: nonEmptyString2 })
64627
+ ]);
64560
64628
  var LegionOperatorProjectPauseRequest = strictObject({
64561
64629
  reason: nonEmptyString2
64562
64630
  });
@@ -64679,7 +64747,13 @@ var LEGION_ANSWER_READS = {
64679
64747
  "lastPause.endedBy",
64680
64748
  "lastPause.endedBy|0.kind",
64681
64749
  "lastPause.endedBy|1.kind",
64682
- "lastPause.endedBy|0.session"
64750
+ "lastPause.endedBy|0.session",
64751
+ "intakeGiveUps",
64752
+ "intakeGiveUps.consumers",
64753
+ "intakeGiveUps.consumers[].name",
64754
+ "intakeGiveUps.consumers[].open",
64755
+ "intakeGiveUps.consumers[].newestSeq",
64756
+ "consumers[].name"
64683
64757
  ],
64684
64758
  LegionIssueRecordResponse: ISSUE_RECORD_READS,
64685
64759
  LegionHealthResponse: ["project"],
@@ -64969,6 +65043,8 @@ function createLegionDaemonClient(baseUrl, options) {
64969
65043
  compact: (input) => post("/legion/v1/claims/compact", LegionClaimRequest, LegionCompactResponse, input),
64970
65044
  projectPause: (input) => post("/legion/v1/project/pause", LegionProjectPauseRequest, LegionProjectPauseResponse, input),
64971
65045
  projectResume: (input) => post("/legion/v1/project/resume", LegionProjectResumeRequest, LegionProjectResumeResponse, input),
65046
+ intakeReplay: (input) => post("/legion/v1/intake/replay", LegionIntakeReplayRequest, LegionIntakeReplayResponse, input),
65047
+ intakeDiscard: (input) => post("/legion/v1/intake/discard", LegionIntakeDiscardRequest, LegionIntakeDiscardResponse, input),
64972
65048
  gateRegister: (input) => post("/legion/v1/gates/register", LegionGateRegisterRequest, LegionEmptyResponse, input),
64973
65049
  waveRelease: (input) => post("/legion/v1/waves/release", LegionWaveReleaseRequest, LegionWaveReleaseResponse, input),
64974
65050
  phaseBackward: (input) => post("/legion/v1/phase/backward", LegionPhaseBackwardRequest, LegionEmptyResponse, input),
@@ -67780,6 +67856,10 @@ function createChannelDelivery(input) {
67780
67856
  }
67781
67857
  if (late === true && passOverLateBtw(rendered))
67782
67858
  return tail.then(() => false);
67859
+ if (rendered.payloadShownAsText !== undefined) {
67860
+ process.stderr.write(`envoy-channel: message ${rendered.envelope?.event_id ?? "unknown"}'s payload is shown as its text; the card could not lay it out (${rendered.payloadShownAsText})
67861
+ `);
67862
+ }
67783
67863
  return queued(async () => {
67784
67864
  const routed = await input.router?.()?.route(rendered);
67785
67865
  if (routed === true) {
@@ -25882,9 +25882,20 @@ function renderInbound(raw, sessionID, subject, wholeBody) {
25882
25882
  },
25883
25883
  ...unrecognised === undefined ? {} : { unrecognised }
25884
25884
  };
25885
+ let card;
25886
+ let payloadShownAsText;
25887
+ try {
25888
+ card = encode5({ envoy: rendered });
25889
+ } catch (error) {
25890
+ const payloadKey = dispatchRendered ? "dispatch" : "message";
25891
+ if (envelope.payload === undefined || !(payloadKey in rendered))
25892
+ throw error;
25893
+ card = encode5({ envoy: { ...rendered, [payloadKey]: envelope.payload } });
25894
+ payloadShownAsText = messageFor(error);
25895
+ }
25885
25896
  return {
25886
25897
  skip: false,
25887
- content: trailer === "" ? encode5({ envoy: rendered }) : `${encode5({ envoy: rendered })}
25898
+ content: trailer === "" ? card : `${card}
25888
25899
 
25889
25900
  ${trailer}`,
25890
25901
  envelope,
@@ -25893,7 +25904,8 @@ ${trailer}`,
25893
25904
  ...rejectedDelivery === undefined ? {} : { rejectedDelivery },
25894
25905
  ...malformedDelivery ? { malformedDelivery: true } : {},
25895
25906
  ...pictures.length === 0 ? {} : { pictures },
25896
- ...cutItem === undefined ? {} : { cutItem }
25907
+ ...cutItem === undefined ? {} : { cutItem },
25908
+ ...payloadShownAsText === undefined ? {} : { payloadShownAsText }
25897
25909
  };
25898
25910
  }
25899
25911
 
@@ -23,20 +23,22 @@ Your role prompt holds the lifecycle rules, this skill the procedures.
23
23
 
24
24
  - The deployment instructions override this skill where they conflict.
25
25
 
26
+ - Ask a person only for what needs that person: their authority, their taste or risk appetite, or something only they can give.
27
+
28
+ - Fix a fault's cause where the cause is, and add no new gate, check or job for it.
29
+
26
30
  ## 1. Decompose or adopt
27
31
 
28
32
  1. Read `STRATEGY.md` where the repository has one, and its design principles (`AGENTS.md` here).
29
33
  Find the standard solution (a web search, and how two or three well-regarded projects solve it) and cite it in the spec's `Design`.
30
34
  Ask a person only what neither settles, with a recommendation.
31
35
 
32
- 2. Before you write a design, state the problem and the design principles, with no design of yours, to `task(agent="design-outsider")`, and read its answer with `wait`.
33
- Record it on the issue or in `plan.md`, with your reason wherever you do not follow it.
34
- Run it again when a push-back or a review changes what the design is for.
36
+ 2. Where you doubt that a design is the right thing to build, state the problem to `task(agent="design-outsider")` and read its answer with `wait`: it asks whether the thing should exist at all, what the smallest thing that gives the person what they asked for is, and what to delete.
35
37
 
36
38
  3. A root: write and edit the spec as `skill://legion-architect/references/design-gate.md` says, since a new version closes the gate, except two kinds it names.
37
39
  A child: as `skill://legion-architect/references/decomposition.md`, "Creating children", says.
38
40
 
39
- 4. Decompose, adopt, split across repositories or record a wait on outside work as `skill://legion-architect/references/decomposition.md` says, red-team check first.
41
+ 4. Decompose, adopt, split across repositories or record a wait on outside work as `skill://legion-architect/references/decomposition.md` says.
40
42
 
41
43
  5. Before you write or give an issue's plan, read `skill://legion-architect/references/plan.md`:
42
44
  a root's plan comes before `register_gate`, a child's before `release_children`, and an issue with none runs the default steps.
@@ -49,7 +51,7 @@ Your role prompt holds the lifecycle rules, this skill the procedures.
49
51
  one `check` block per thing to prove, with `serves`, `surface` (`browser`, `cli` or `api`), `run`, `when` (`before_merge`, `after_merge` or `default_branch`) and `negative_control`.
50
52
  A check carrying `ci_check` is CI's and takes no `run` (`skill://legion-architect/references/design-gate.md#a-check-ci-proves`).
51
53
 
52
- - Where this tree builds or changes a page, screen or dashboard a person opens, that person sees it and answers before you request approval (`skill://legion-architect/references/design-gate.md`, "Show the surface before you ask").
54
+ - Where this tree builds or changes a page, screen or dashboard a person opens, that person sees it and answers before you request approval (`skill://legion-architect/references/surface-round.md`).
53
55
  A child's own architect sends such a surface up to the root's architect.
54
56
 
55
57
  ## 2. Children in flight
@@ -108,7 +110,7 @@ nothing after it is yours (`skill://legion-architect/references/acceptance.md`,
108
110
  - Send the controller (its topic is on your addressing line) a child that serves no criterion of the root, a need for admission slots, and two trees changing the same code.
109
111
 
110
112
  - Carry a clear defect the controller gives you in this tree:
111
- in an open pull request, or in a child after the red-team check; reply under its evidence comment with the issue that carries it.
113
+ in an open pull request, or in a child; reply under its evidence comment with the issue that carries it.
112
114
  It changes the root spec only where it changes the Summary, a requirement, a check or the scope (`skill://legion-architect/references/design-gate.md`, "After approval").
113
115
 
114
116
  - A tool a worker cannot get is a pull request to the worker image (`skill://legion-worker/references/tools.md`).
@@ -38,28 +38,22 @@ Read, against the goal, every check and every requirement:
38
38
  ## The last round
39
39
 
40
40
  A parent has a last round only where its task names `acceptance:owner`.
41
- Sign it off only on a head that carries the merges of every child its checks need.
41
+ Sign it off only on a head at which its checks pass.
42
42
  Each check needs a pass at that head; one in another repository needs a pass standing since the close of each child it needs, at a commit on the branch that issue's pull request merged into or on its default branch;
43
43
  a `default_branch` check needs the default branch.
44
44
  A criterion proven on a deployed system is proven after that child's deploy, as the repository's deploy skill says.
45
45
  A child's result proves no check of the parent: a child carrying part of a parent's requirement proves it with a check of its own whose `serves` names it.
46
46
  Nothing builds on the parent's merge, which comes last.
47
47
  Until those children close, leave the issue in `accepting`.
48
- Then, in one turn:
49
-
50
- 1. Where a tester step comes before your acceptance, `envoy_publish` to its tester's role topic:
51
- "The next round of <KEY> is its last round: a full test round of every check of the issue with no `ci_check`."
52
- With no tester step before your acceptance, the implementer's evidence for those checks at the merge head is the full round.
53
-
54
- 2. `request_backward_move` to `implementing`, with the reason "Last round:
55
- merge the default branch your addressing line names into the branch, push, end your forward-merge comment with `parent's last round: full test round`, and complete."
56
- Never hard-code `main`.
48
+ Then start the last round: `request_backward_move` to `testing`, or to `implementing` where no tester step comes before your acceptance, its reason naming the children that closed and the checks of the parent that need their code.
49
+ The tester sizes that round like any other; with no tester step before your acceptance, the implementer's evidence for those checks at its head is the round.
50
+ The last round merges the base only on a trigger every pull request has: GitHub reads the pull request `CONFLICTING` (*A conflicting head*, below), or a check that needs a child's merged code fails at the head without it, and the implementer merges the base on that trigger.
57
51
 
58
52
  A child's merge while the parent waits needs no move of its own:
59
- the last round's forward merge takes them all, and the daemon answers a conflict on its head (*A conflicting head*, below).
53
+ the last round tests them all, and the daemon answers a conflict on its head (*A conflicting head*, below).
60
54
  If the pull request merged before its last round, move nothing back. Once the children close:
61
55
 
62
- 1. Have a fresh `task` subagent run each check with no `ci_check` on the default branch and record each result, and `wait` for its report.
56
+ 1. Run each check with no `ci_check` on the default branch and record each result, yourself or by a subagent you dispatch; `wait` for a subagent's report.
63
57
  2. Read each `ci_check` result in `dispatch results`.
64
58
  3. Post the results in the acceptance comment, then `sign_off`.
65
59
 
@@ -27,21 +27,10 @@ A release refused with a code below writes nothing: release the rest again witho
27
27
 
28
28
  1. Write each child's spec as `skill://dispatch-writing-specs` says, scaled to the child, each requirement a `requirement` block, with its `verification.md`: its workers read only these.
29
29
  Cite no item number of another document and copy no text that does not apply to the child.
30
-
31
- 2. Red-team the list with a fresh `task(agent="oracle")`, and `wait` for its verdict.
32
- Give it your issue's spec, the tree's open children with their repositories and pull requests, and each proposed child's title and whole spec, with this mandate: "You did not write this list.
33
- Argue that each child should not exist.
34
- Name every child that is a to-do, a fix found in review, a proof of the acceptance of the issue it is filed under, or a part of the architect's own work, and say where it folds.
35
- Weigh each separate pull request against combining its work:
36
- each round tests a large pull request whole again, and each small one costs a workspace, an admission wait, review, CI, a queue wait and a deploy."
30
+ Weigh each separate pull request against combining its work: each round tests a large pull request whole again, and each small one costs a workspace, an admission wait, review, CI, a queue wait and a deploy.
37
31
  A repeated change is one child, and deleting what this tree replaced is this tree's work.
38
32
 
39
- 3. Post the verdict and your folds as one `dispatch comment` on your own issue whose first line is exactly `Red-team verdict for <your issue key>:`.
40
- The controller's weekly audit reads that line.
41
-
42
- 4. Check each survivor's spec with a fresh `task(agent="plan-gap-analyst")` against `skill://dispatch-writing-specs`, `wait` for it, and fix what it flags.
43
-
44
- 5. File only the survivors, and reply under the verdict with their keys:
33
+ 2. File each child:
45
34
 
46
35
  ```bash
47
36
  dispatch issue --project <project> --parent "$LEGION_ISSUE" --title '<child outcome>' --spec-file - <<'EOF'
@@ -49,7 +38,7 @@ A release refused with a code below writes nothing: release the rest again witho
49
38
  EOF
50
39
  ```
51
40
 
52
- 6. Review the version you filed ("Reviewing a child's spec") before `release_children`.
41
+ 3. Review the version you filed ("Reviewing a child's spec") before `release_children`.
53
42
 
54
43
  - `--project` is the key's prefix (`LEGSMOKE-3` → `LEGSMOKE`).
55
44
  `--parent` is `$LEGION_ISSUE`, never a child of yours: that child's own architect files its children.
@@ -65,18 +54,19 @@ A release refused with a code below writes nothing: release the rest again witho
65
54
 
66
55
  - Where the project has architecture components, give each child a `check` for the update of `.dispatch/architecture/<id>.md` of each component its pull request changes.
67
56
 
57
+ - Your `Production check` line says whether this project checks production after a merge.
58
+ When it names a role, write one `after_merge` check for the production check in each child's Verification document, with its spec and while the child is open, because a closed issue refuses every new document.
59
+ Under `Production check: off`, write none.
60
+
68
61
  - A role token is `legion-<project>-<key>-<role>` with the daemon's project and the key lower-cased: `legion-acme-legion-41-architect`.
69
62
 
70
63
  ## Reviewing a child's spec
71
64
 
72
65
  No person reads a child's spec: review every version of it and of its Verification document, whoever wrote it, before the child's work goes on with that version.
73
66
 
74
- 1. Have a fresh `task(agent="plan-reviewer")`, told the documents are a child's spec and its Verification document, read them against your own spec (a root's at its approved version, a child's at the version its parent approved) with this mandate:
75
- "Does this version serve each requirement of the parent spec that it names?
76
- Does it narrow or contradict any?
77
- Does it add scope the parent spec does not ask for?
78
- Check each fact it states against the code, the docs or a read-only command."
79
- `wait` for its result.
67
+ 1. Read the child's spec and its Verification document, at the versions you review, against your own spec (a root's at its approved version, a child's at the version its parent approved).
68
+ Ask whether the version serves each requirement of your spec that it names, whether it narrows or contradicts any of them, whether it adds scope your spec does not ask for, and whether each fact it states holds in the code, the docs or a read-only command.
69
+ Use a reader (`plan-reviewer`, `plan-gap-analyst`) where the reading needs one.
80
70
 
81
71
  2. Approve or request changes, with a reason either way.
82
72
 
@@ -11,6 +11,10 @@ Read this before you write a root spec, before any edit to an approved one, and
11
11
  - Upload `verification.md` beside it (`--force` from its second version). Each clause of a check's
12
12
  `negative_control` names the test row or run that drives it. A requirement over every member of
13
13
  a class iterates the class's list, never a sample.
14
+ - Your `Production check` line says whether this project checks production after a merge. When it
15
+ names a role, write one `after_merge` check for the production check in the Verification
16
+ document, with the spec and while the issue is open, because a closed issue refuses every new
17
+ document. Under `Production check: off`, write none.
14
18
  - Where a real recorded input exists (a stored record, a captured log, a real service's answer),
15
19
  hold at least one read-only check against it, or say in a decision block why none can be
16
20
  written. A requirement of the form "try X and see" is accepted by an observed real run.
@@ -33,36 +37,6 @@ request already makes a check's proof, write that check as `ci_check` rather tha
33
37
  3. Write in `negative_control` the case inside that job that fails when the property breaks: a
34
38
  step with `continue-on-error` keeps its job green.
35
39
 
36
- ## Show the surface before you ask
37
-
38
- Where this tree builds or changes a surface a person opens (a page, a screen, a dashboard), that
39
- person sees it and answers before you request approval: a spec for a surface they have not seen is
40
- refused. A new surface or a large visual change needs this round, and a flow needs a page they can
41
- click; a small change inside a standing shape does not, unless you are unsure what they want. A
42
- surface that is only text (an alert, a report, printed output) carries that literal text in the
43
- spec instead.
44
-
45
- 1. Build the surface as a page from real readings of the real system. Draw the empty state and the
46
- worst realistic data, or say which states you left out. Mark every invented figure in the
47
- picture, and draw an existing surface as it is now beside the new one.
48
- 2. Take the picture with the pod's Chromium and put it on the issue, with a clickable page as a
49
- `file` artifact for a flow:
50
-
51
- ```bash
52
- chromium --headless --disable-gpu --no-sandbox --window-size=1440,900 \
53
- --screenshot=<file.png> file://<page.html>
54
- dispatch artifact --issue <KEY> --name <name>.png --path <file.png>
55
- ```
56
-
57
- 3. Ask one question with two to four answers, one of them that this is the wrong surface. Write no
58
- code for the round, and end your turn.
59
- 4. Put the agreed pictures in the spec, each with a line on what it shows and which readings are
60
- real, and one line on the states they do not show. The spec's words still govern the build.
61
-
62
- You end the round, not the person. The round writes no spec version of its own, and a tree whose
63
- gate is open starts none. Under `Design gate steps: none`, put the picture in the spec and ask
64
- nobody. The surfaces children build are the root architect's.
65
-
66
40
  ## Which steps are gated
67
41
 
68
42
  The `Design gate steps` sentence of your `Legion addressing` line names the gated steps, or `none`.
@@ -81,17 +55,20 @@ For each gated step, once every child is filed:
81
55
 
82
56
  1. Edit the document in place: `dispatch doc-edit --issue <root> --ops-json-file -`.
83
57
  2. Settle every decision block (`skill://dispatch-writing-specs`, "Approval").
84
- 3. Give the current spec, the code and output it relies on, and the person's words to two fresh
85
- reviewers: `task(agent="plan-gap-analyst")` for its gaps, and `task(agent="plan-reviewer")`,
86
- told it is a spec, for each factual claim. `wait` for each, resolve every finding, and check
87
- each unverified claim with a command or take it out.
58
+ 3. Where the spec is large, or changed in a way you cannot check alone,
59
+ `task(agent="plan-gap-analyst")` can find its gaps and `task(agent="plan-reviewer")`, told the
60
+ document is a spec, can check its factual claims; each runs as a job of its own, so `wait` for
61
+ its result.
88
62
  4. Request approval only once the person has agreed to every point; a new point gets its own
89
63
  decision block first. `--include-verification` covers `spec` and `criteria` in one request:
90
64
 
91
65
  ```bash
92
- dispatch request-approval --issue <root> --include-verification --summary '<what they approve> Reviews: <gap result>, <claim result>; <what they do not show>.'
66
+ dispatch request-approval --issue <root> --include-verification --summary '<what they approve>'
93
67
  ```
94
68
 
69
+ `--summary` says in one to three sentences what the person approves, and nothing else. A
70
+ measurement or test result the design rests on goes in the document the request names.
71
+
95
72
  5. Register each step on its own document, with the id and version the request printed, never a
96
73
  slug. Leave `step` out only where your line names one step:
97
74
 
@@ -106,21 +83,23 @@ For each gated step, once every child is filed:
106
83
  once they have agreed to that version, run `dispatch request-approval` again to give it back.
107
84
  - `already approved at version <N>`: still `register_gate` that id and version.
108
85
  - Refusals record nothing: `VERSION_NOT_IN_DISPATCH` (register the latest version),
109
- `GATE_STEP_REQUIRED` (name the step), `GATE_STEP_NOT_CONFIGURED` (register only gated steps),
86
+ `GATE_STEP_REQUIRED` (name the step),
87
+ `GATE_STEP_NOT_CONFIGURED` (register only gated steps, and `criteria` where the line names `spec` and not `criteria`),
110
88
  `GATE_STEP_DOCUMENT_MISMATCH` (register that step's own document).
111
89
  - Never open a `dispatch ask` with an `Approve` option: the daemon ignores its answer.
112
90
 
113
91
  ## After approval
114
92
 
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 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.
93
+ An approval is pinned to its version: any new version closes that step. The daemon tells the
94
+ architect and every phase holder when the gate closes. Three keep it: a version whose only change
95
+ is the approver's answer to a decision block, given after the approval at a browser or under a
96
+ credential with the approve scope; one equal to the approved text (an accidental edit undone
97
+ exactly) with no decision block in it decided since; and, after a close and a reopen, the approved
98
+ text with only the questions the close withdrew open again.
120
99
 
121
100
  Edit an approved spec only where its Summary, a requirement, a check, the scope or a settled
122
101
  decision changes: put the problem to the person as a decision block at the end of the section it
123
- changes. When their answer changes text outside the block, rewrite it and repeat steps 3 to 5,
102
+ changes. When their answer changes text outside the block, rewrite it and repeat steps 4 and 5,
124
103
  with a `--summary` sentence naming what changed. Work in flight goes on; release no further child
125
104
  until the next `design-approved`.
126
105
 
@@ -35,7 +35,7 @@ The table lists the steps in the order of the default steps:
35
35
  | --- | --- | --- | --- |
36
36
  | `planner` | planning | `planning` | No implementation plan and no plan review: the steps work from your task's text and the spec. |
37
37
  | `implementer` | implementation | `implementing` | Required. It also works the retro, and a failed step returns to it unless the failed step names an earlier one. |
38
- | `tester` | testing | `testing` | Only the implementer records results against the checks, and no other step runs them again, except where a parent's pull request merged before its last round: your subagent then runs and records them (`skill://legion-architect/references/acceptance.md`, *The last round*). |
38
+ | `tester` | testing | `testing` | Only the implementer records results against the checks, and no other step runs them again, except where a parent's pull request merged before its last round: you, or a subagent you dispatch, then run and record them (`skill://legion-architect/references/acceptance.md`, *The last round*). |
39
39
  | `reviewer` | review | `reviewing` | No review: on a base whose rules require an approving review, the merger waits and tells you. |
40
40
  | `acceptance:owner` | review | `accepting` | Your step. Without it the last step's pass starts the retro, or holds a parent before it while issues beneath it are in the workflow, and nothing waits for you to read the evidence. |
41
41
 
@@ -0,0 +1,29 @@
1
+ # Show the surface before you ask
2
+
3
+ Where this tree builds or changes a surface a person opens (a page, a screen, a dashboard), that
4
+ person sees it and answers before you request approval: a spec for a surface they have not seen is
5
+ refused. A new surface or a large visual change needs this round, and a flow needs a page they can
6
+ click; a small change inside a standing shape does not, unless you are unsure what they want. A
7
+ surface that is only text (an alert, a report, printed output) carries that literal text in the
8
+ spec instead.
9
+
10
+ 1. Build the surface as a page from real readings of the real system. Draw the empty state and the
11
+ worst realistic data, or say which states you left out. Mark every invented figure in the
12
+ picture, and draw an existing surface as it is now beside the new one.
13
+ 2. Take the picture with the pod's Chromium and put it on the issue, with a clickable page as a
14
+ `file` artifact for a flow:
15
+
16
+ ```bash
17
+ chromium --headless --disable-gpu --no-sandbox --window-size=1440,900 \
18
+ --screenshot=<file.png> file://<page.html>
19
+ dispatch artifact --issue <KEY> --name <name>.png --path <file.png>
20
+ ```
21
+
22
+ 3. Ask one question with two to four answers, one of them that this is the wrong surface. Write no
23
+ code for the round, and end your turn.
24
+ 4. Put the agreed pictures in the spec, each with a line on what it shows and which readings are
25
+ real. The spec's words still govern the build.
26
+
27
+ You end the round, not the person. The round writes no spec version of its own, and a tree whose
28
+ gate is open starts none. Under `Design gate steps: none`, put the picture in the spec and ask
29
+ nobody. The surfaces children build are the root architect's.
@@ -22,7 +22,7 @@ Where a row says to ask a person, a child's own architect sends the question to
22
22
  | `pr-closed-unmerged` | Decide whether the work reopens, restarts or ends, and give the reason. A phase worker makes the repository change. |
23
23
  | `pull-request-missing` | Tell the implementer to open the pull request from the branch the reason names. |
24
24
  | `child-status` | A child left, re-entered, joined the tree or started. The daemon starts what runs. |
25
- | `child-closed` | Section 2. File any new child it calls for after the red-team check, and release it at once. When it was the last child an issue in `accepting` waits on, run that issue's last round. |
25
+ | `child-closed` | Section 2. File any new child it calls for as `skill://legion-architect/references/decomposition.md` says, and release it at once. When it was the last child an issue in `accepting` waits on, run that issue's last round. |
26
26
  | `children-first` | Release every child that should run. Move one that should not run now where your role prompt's `children-first` paragraph says, then ask the person on the root when it should run; sign off neither issue until they answer. A `blocked_by` link up the parent chain: ask a person to remove it. |
27
27
  | `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. |
28
28
  | `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. |
@@ -48,7 +48,7 @@ Read what every counted round found, choose one, act on it, and post the rounds
48
48
 
49
49
  - **Split**: part of the work cannot settle here.
50
50
  On a child, it becomes a child of this issue's parent (a child's own architect sends it up with `envoy_publish`);
51
- that parent's architect files it after the red-team check with `--blocked-by <this issue>` and releases it at once.
51
+ that parent's architect files it with `--blocked-by <this issue>` and releases it at once.
52
52
  On the root, open a `dispatch ask`; the part stays a requirement until the person's answer says otherwise.
53
53
 
54
54
  - **Accept the rounds**: each round found less than the one before, and the last found no defect in the change itself.
@@ -16,16 +16,18 @@ Your system prompt holds the rules on registration, one wake per turn, reading s
16
16
  - Keep no notes between turns. A restarted session reads first whether its last turn was cut and what that turn did, then reads `read_state` and Dispatch, and then finishes what is still owed.
17
17
  - An agent's directive that cites no person's request is no reason to park an issue.
18
18
  - Never edit a repository, push, merge, or call `handoff_complete`.
19
- - Never open a design gate: only a person's approval in Dispatch of each step your `Design gate steps:` line names opens it.
19
+ - Never open a design gate: only a person's approval in Dispatch of each step your `Design gate steps:` line names opens it. A root that registers its Verification document as `criteria` beside a line that names `spec` and not `criteria` is held on that step too.
20
20
  - When a `dispatch` command fails, or a `curl` read of Dispatch fails or prints no JSON array, act on nothing it would decide and name its first line in your summary (the turn's last message).
21
21
  - Call a service unreachable only after running the call through the secrets broker's client (`skill://agent-secrets`), with the command and its output.
22
22
  - Write every comment, message and ask as `skill://dispatch-writing-specs`'s "Rules for the text" say.
23
+ - Ask a person only for what needs that person: their authority, their taste or risk appetite, or something only they can give.
24
+ - Fix a fault's cause where the cause is, and add no new gate, check or job for it.
23
25
 
24
26
  Read `skill://legion-controller/references/session.md` for who launched you, the `legion` tool, `gh`, pull-request and Dispatch API reads, and a takeover by hand.
25
27
 
26
28
  ## Every turn
27
29
 
28
- 1. Recheck [trees waiting on a root claim](#trees-waiting-on-a-root-claim).
30
+ 1. Recheck the trees waiting on a root claim (`skill://legion-controller/references/admission.md#trees-waiting-on-a-root-claim`).
29
31
  2. Do the wake's work, or the start procedure below.
30
32
  3. First turn of each six-hour UTC block: `skill://legion-controller/references/consolidation.md`.
31
33
  4. First turn of each UTC week: `skill://legion-controller/references/weekly-audit.md`.
@@ -58,10 +60,6 @@ Every launch opens with a start message. Envoy keeps no wake sent while no contr
58
60
  | An answer to a park ask; a deferral ask | `skill://legion-controller/references/park-asks.md`; `skill://legion-controller/references/backlog-stewardship.md#a-root-the-plan-defers` |
59
61
  | Any other wake, a GitHub mention | `skill://legion-controller/references/wakes.md` |
60
62
 
61
- ## Trees waiting on a root claim
62
-
63
- A root architect whose claim on its root was refused waits, and nothing tells it when the holder lets go. `dispatch read` each root in `admission.trees` still at `phase: admitted`. When `Claimed by:` is `nobody` or ends `· not running`, `envoy_publish` `<KEY>: the claim is free; claim it again.` to `notifications.role.<issues.<KEY>.architect.locator.claim>`.
64
-
65
63
  ## Issues handed to Legion
66
64
 
67
65
  The daemon works only issues labelled `legion` (any case), and a labelled root in `todo` is admitted. Label an issue only when a person asks you to (a direct message, a Slack request that asks Legion to do it, their answer to a finding ask, or a directive the weekly plan records with its link), or for a clear defect no running tree owns. Never take a person's label off. How: `skill://legion-controller/references/triage.md#label-an-issue-for-a-person`.
@@ -49,7 +49,7 @@ Name them in the day's report and take nothing for them.
49
49
  | `label_off` | A root whose `legion` label is off | A person's label |
50
50
  | `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 |
51
51
  | `root_awaiting_person` | Its root waits on a person | The root's resume |
52
- | `design_gate` | Its root's design gate is not open at every gated step | A person's approval of each step's document |
52
+ | `design_gate` | Its root's design gate is not open at every step that holds the tree: each gated step, and `criteria` where the root registered it | A person's approval of each step's document |
53
53
  | `dispatch_blocker` | A `blocked_by` issue is not `done` | Each blocker `done`, or the link taken off |
54
54
  | `children_first` | An open child under it | The last open child leaving the workflow |
55
55
  | `accepted_ancestor` | The daemon has accepted the head an ancestor's last step passed | That ancestor standing in neither `retro` nor `merging` (a `held` ancestor stands in the phase it was held from) |
@@ -57,3 +57,7 @@ Name them in the day's report and take nothing for them.
57
57
  | `task_stopped` | A task is stopped and no step of it runs | A later `register_plan` version that changes the task, a root's `todo`, or a child's restart (`backlog`, then `rerun_child`) starts its first step, and an issue whose experiment's group runs the project's default steps takes no later version |
58
58
  | `at_work` | In `accepting`, `retro` or `merging`, not `held`, on no slot | Its own sign-off, retro and merge |
59
59
  | `unclassified` | None of the above | Nothing of yours: name it with its `phase` and `status` |
60
+
61
+ ## Trees waiting on a root claim
62
+
63
+ A root architect whose claim on its root was refused waits, and nothing tells it when the holder lets go. `dispatch read` each root in `admission.trees` still at `phase: admitted`. When `Claimed by:` is `nobody` or ends `· not running`, `envoy_publish` `<KEY>: the claim is free; claim it again.` to `notifications.role.<issues.<KEY>.architect.locator.claim>`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Read this on a `parked-decision` wake, and for the parked-root walk at every start and on each `tick`. A parked tree is a labelled root in `backlog` or `icebox` whose `issues.<KEY>.phase` is `done`. Its architect is gone, so nobody inside it hears a person's decision. The daemon sends you each one as `parked-decision` (`decision`, `root`, `ref`, `actor`, and a spec decision's `version` and `reason`); the walk finds those sent while no controller ran.
4
4
 
5
- A person's own approval of a parked root's primary document while no tree is live is no decision for you: the daemon sets the root `todo` itself. A carried approval, or one on a root that keeps a Dispatch parent, is a decision. A session's reply on a parked tree is none.
5
+ A person's own approval of a parked root's primary document while no tree is live is no decision for you: the daemon sets the root `todo` itself, unless the daemon sends it as a `parked-decision` whose `reason` says the root's status changed after the approval and Legion queued nothing; decide that one as [Deciding](#deciding) says. A carried approval, or one on a root that keeps a Dispatch parent, is a decision. A session's reply on a parked tree is none.
6
6
 
7
7
  A held root is not a parked one: `todo` on a root at `phase: held` releases the hold at the same generation. A root still in the workflow whose architect stopped takes `backlog`, then `todo`, which re-admits the tree.
8
8
 
@@ -42,4 +42,4 @@ Six turns of `role` in a row ended in a provider error; the daemon keeps prompti
42
42
 
43
43
  ## GitHub mentions
44
44
 
45
- Answer a mention that asks for triage or for what `read_state` or Dispatch holds. Send any other to the owning architect: `envoy_publish` its URL, its text and the issue key to that architect's role, never to a token built from a partial issue reference. A person who asks how to pass a design gate approves, in Dispatch, the document of each step your `Design gate steps:` line names; a project that wants no gate sets `gates.design: []` in `legion.yaml`.
45
+ Answer a mention that asks for triage or for what `read_state` or Dispatch holds. Send any other to the owning architect: `envoy_publish` its URL, its text and the issue key to that architect's role, never to a token built from a partial issue reference. A person who asks how to pass a design gate approves, in Dispatch, the document of each step your `Design gate steps:` line names, and the Verification document where the root registered it as `criteria`; a project that wants no gate sets `gates.design: []` in `legion.yaml`.
@@ -23,7 +23,7 @@ A tree is an open `legion`-labelled issue with no labelled ancestor, with its de
23
23
 
24
24
  ## 3. The nudges
25
25
 
26
- Nudge the architect of each tree with at least one open descendant that has more than 8 descendants or more than 2 levels below its root, or that filed a child no red-team verdict names. Each architect posts its verdict on the issue it files children under, a comment whose first line reads `Red-team verdict for <issue key>:`, so read every such issue of the tree (`--all-events`). Count no child created before the first release that carries this rule.
26
+ Nudge the architect of each tree with at least one open descendant that has more than 8 descendants or more than 2 levels below its root.
27
27
 
28
28
  A nudge is one `dispatch comment` on the root naming what you counted and asking the architect to fold what can ride in an open pull request, ending `descendants: <n>, levels: <m>`; send the same text to the architect's role topic when `read_state` names one. Send no new nudge to a tree whose architect replied to your newest one until its descendants pass that `<n>`. List each nudge in the report.
29
29
 
@@ -36,8 +36,7 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
36
36
  - `HANDOFF_STALE_ENTRY`: end the turn without completing; the daemon sends the new entry's task by itself.
37
37
  Do what it asks at the head it names, with a handoff of its own.
38
38
 
39
- - `HANDOFF_HEAD_MERGED_FORWARD`: a merge forward the daemon asked for has landed above the head your completion names, or your completion names no head; nothing was recorded.
40
- Read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`), then complete again at the new head with a handoff that names it.
39
+ - `HANDOFF_HEAD_MERGED_FORWARD`: `skill://legion-worker/references/conflicts-and-rewrites.md#the-daemons-ask`.
41
40
 
42
41
  - `HANDOFF_NOT_CURRENT_PHASE`: report it; do not retry that completion.
43
42
  `HANDOFF_ALREADY_RECORDED`: the first answer stands.
@@ -54,6 +53,10 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
54
53
 
55
54
  - 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.
56
55
 
56
+ - **Ask a person only for what needs that person**: their authority, their taste or risk appetite, or something only they can give.
57
+
58
+ - **Fix a fault's cause where the cause is**, and add no new gate, check or job for it.
59
+
57
60
  - No surface reaches the changed path: report it to the architect, never complete (`skill://legion-worker/references/results.md`).
58
61
 
59
62
  - A released pod is not a stop.
@@ -81,7 +84,7 @@ Your role prompt gives the workspace, the push, the handoff, `handoff_complete`,
81
84
 
82
85
  - No deferrals.
83
86
  A finding that changes behaviour, hides an error, or breaks a gate is fixed in this pull request.
84
- So is a wording nit or any clear fix in a file it touches: a later round costs a CI pass and a review, if any.
87
+ So is any clear fix in a file it touches: a later round costs a CI pass and a review, if any.
85
88
  `Fast-follow:` reads `none` or names cleanup in files the pull request does not touch.
86
89
 
87
90
  - The merge gate follows the task's `Steps:` line: each named step runs in order, then retro and the merger.
@@ -4,7 +4,7 @@ Read it when GitHub reports the pull request `CONFLICTING`, the daemon's merge-f
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 architect's backward move names a parent's last round, 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), 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).
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
 
@@ -17,9 +17,8 @@ Before you race another tree's pull request on shared files, `envoy_publish` to
17
17
 
18
18
  Write `<message>` in the repository's own commit convention (its commit-lint configuration, else its recent commits on the base), such as `chore(<scope>): merge <base> into <branch>`, or `Merge <base> into <branch>` where none shows. `@` after a split is an empty commit with no description, which `jj git push` refuses.
19
19
  2. Resolve any conflict in that one commit, then `jj -R "$LEGION_WORKSPACE" new` to move off it.
20
- 3. A merge brings instances from the base that the branch's own diff never shows, so before you push the merge search its head for the class of every finding of every earlier review round.
21
- 4. Push the merge as any code push, build the branch, and record the issue's checks again at the merge head, each check with no `ci_check` (a check carrying one is read again from its CI run), even with no text conflict. The merger records none itself: it asks the implementer, and the tester where the task has a tester step, to record theirs at the merge head (its role prompt, "A head that conflicts with its base").
22
- 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`.
20
+ 3. Push the merge as any code push and build the branch: a clean merge can change a function's signature under the branch's own callers. Run again each check the merge can reach (*Reading a merge of the base*, below), and record each other check again at the merge head as carried from its earlier pass, without running it (`skill://legion-worker/references/results.md#what-a-result-is`). A `ci_check` check is read again from its CI run at the merge head. The merger records none itself: it asks the implementer, and the tester where the task has a tester step, to record theirs at the merge head (its role prompt, "A head that conflicts with its base").
21
+ 4. Post one PR comment with the Legion footer: `forward merge <old-tip-sha> → <new-tip-sha>; <the condition it meets>`.
23
22
 
24
23
  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
24
 
@@ -30,12 +29,20 @@ Every role reads a merge of the base the same way:
30
29
  - `git show --remerge-diff <merge>` shows its resolution, and `git diff --stat <merge>^1 <merge>` lists the files the base brought in.
31
30
  - A check those files or the resolution can reach runs again, and a check the merge was made for has no pass to carry.
32
31
 
32
+ For a reviewer, this lists your session's reviews, oldest first; no line, or `no head` on the last one, means you read the whole diff:
33
+
34
+ ```bash
35
+ gh api --paginate repos/<o>/<r>/pulls/<n>/reviews --jq '.[] | {id, state, submitted_at, footer: ([.body // "" | scan("<!-- legion: (\\{.*?\\}) -->")] | last | .[0]? // "" | try fromjson catch {})} | select(.footer.phase == "review" and .footer.session == "<your session id>") | [.id, .state, .submitted_at, (.footer.head // "no head")] | @tsv'
36
+ ```
37
+
33
38
  ## The daemon's ask
34
39
 
35
40
  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. It acts only when the next step needs a mergeable head, which is so in four cases. 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. The daemon could not read the base's rules. Where every step of the task has run, in `retro` or in `accepting` with no step of its task after it, the conflict waits for the merger.
36
41
 
37
42
  - 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
43
  - 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.
44
+ - `HANDOFF_HEAD_MERGED_FORWARD`: a merge forward the daemon asked for has landed above the head your completion names, or your completion names no head; nothing was recorded.
45
+ Read the merge (*Reading a merge of the base*, above), then complete again at the new head with a handoff that names it.
39
46
 
40
47
  ## A wrong pushed commit
41
48
 
@@ -8,13 +8,13 @@ The merger's steps are all in its role prompt.
8
8
 
9
9
  1. Read CI on GitHub and the issue's results with `dispatch results --issue <issue>`, never from a handoff.
10
10
  2. When the diff the round reads touches runtime code (the whole change, or the difference from the commit your task names), run `task(agent="thermonuclear-deep-review")` and `task(agent="thermonuclear-code-quality")` once at the head the round reviews, and `wait` for each result: each runs as a job of its own.
11
- Each agent reviews only the diff its task supplies: name in each task the commit, the head and `git diff <sha> <head>`, or the whole change.
11
+ Each agent reviews only the diff its task supplies: name in each task the commit, the head and `git diff <sha> <head>`, or the whole change, or, for a merge of the base, the merge's resolution (`git show --remerge-diff <merge>`) and this change's own commits since that commit.
12
12
  The last two sentences of your task, `Last reviewed commit: <sha>.` and `Review entry: <n>.`, are the daemon's; your role prompt says how to read them.
13
13
  3. A result that carries no report, or that names another place for it, is a failed run, not a verdict: run that agent again, or read its transcript.
14
14
  Reading the agent's diff yourself and recording that in its place is the same as answering the rubric from a bare verdict.
15
15
  When you can do neither, that half of the round has no review: tell the architect, do not approve, and wait with a `WAITING` line naming what you wait on until it answers.
16
16
  4. A `CHANGES` from either half is answered in the review: its findings are carried into a `REQUEST_CHANGES`, or each finding is recorded with why it does not stand.
17
- Your `APPROVE` needs both halves run at the reviewed head, or both `Thermo` rows reading `not run` because the diff the round reads touches no runtime code.
17
+ Your `APPROVE` needs both halves run at the reviewed head, or both `Thermo` rows reading `not run` because the diff the round reads touches no runtime code, or no `Thermo` line on a docs-only pull request.
18
18
 
19
19
  ### What the base requires
20
20
 
@@ -79,12 +79,7 @@ Cases 2, 3, 4 and 6 end: tell the architect, do not approve, and wait with a `WA
79
79
 
80
80
  ### A merge of the base is reviewed for what it changed
81
81
 
82
- After a forward merge, read the merge (`skill://legion-worker/references/conflicts-and-rewrites.md`) and this change's own commits since your last submitted review's footer `head`.
83
- This lists your session's reviews, oldest first; no line, or `no head` on the last one, means you read the whole diff:
84
-
85
- ```bash
86
- gh api --paginate repos/<o>/<r>/pulls/<n>/reviews --jq '.[] | {id, state, submitted_at, footer: ([.body // "" | scan("<!-- legion: (\\{.*?\\}) -->")] | last | .[0]? // "" | try fromjson catch {})} | select(.footer.phase == "review" and .footer.session == "<your session id>") | [.id, .state, .submitted_at, (.footer.head // "no head")] | @tsv'
87
- ```
82
+ After a forward merge, read the merge and this change's own commits since your last submitted review's footer `head` (`skill://legion-worker/references/conflicts-and-rewrites.md#reading-a-merge-of-the-base`, which lists your reviews).
88
83
 
89
84
  ## The production check after the close
90
85
 
@@ -17,8 +17,7 @@ Edit the live body: read it (`gh api repos/{owner}/{repo}/pulls/{number} --jq .b
17
17
  - <two to five bullets, each one behaviour a user or operator meets, never a file name>
18
18
  **Look at first:** <one to three `path:line` places where a wrong decision would hurt> (the reviewer writes this line; with no reviewer step, the implementer does)
19
19
  **Proven by:** <the surface and the run of the check the change turns on, one line>
20
- **Not proven / risk:**
21
- - <one line per claim recorded as unproven before the merge>, or the single word `none` (the reviewer writes this line; with no reviewer step, the implementer does; `none` is invalid while such a claim stands)
20
+ **Not proven / risk:** <a risk that stands, in one sentence; leave the line out where none stands. The reviewer writes it; with no reviewer step, the implementer does>
22
21
  **Size:** <files changed, +added/−removed>
23
22
 
24
23
  ## Verification
@@ -29,7 +28,7 @@ Edit the live body: read it (`gh api repos/{owner}/{repo}/pulls/{number} --jq .b
29
28
  - Thread <node id>: accepted by the reviewer — <its reason, one line>; resolved at <head-sha>.
30
29
  - Thread <node id>: still open — <what remains>; unresolved at <head-sha>.
31
30
 
32
- **Thermo:** `simplify-settled-diff` once at <head-sha>, a docs-only PR included: <0 applied | applied → new head <sha>>; defects reported: <none | <n>, fixed in <sha>>; thermonuclear pair at the reviewed head <sha> over <the whole change | <last-reviewed-sha>..<sha>>, one row per half:
31
+ **Thermo:** `simplify-settled-diff` once at <head-sha> (a docs-only PR has no `Thermo` line): <0 applied | applied → new head <sha>>; defects reported: <none | <n>, fixed in <sha>>; thermonuclear pair at the reviewed head <sha> over <the whole change | <last-reviewed-sha>..<sha>>, one row per half:
33
32
  - `thermonuclear-deep-review`: <APPROVE | CHANGES>, <n> findings stand
34
33
  - `thermonuclear-code-quality`: <APPROVE | CHANGES>, <n> findings stand
35
34
  Where the diff the round reads touches no runtime code, each row reads `not run (<the whole change | <last-reviewed-sha>..<sha>> touches no runtime code)`, and the two rows of the last round the pair ran in stay beside them.
@@ -53,15 +52,14 @@ GitHub refuses a body over 65,536 characters: past about 48,000, link evidence r
53
52
  ## The brief for the human
54
53
 
55
54
  The implementer keeps `Outcome`, `Why`, `Change`, `Proven by` and `Size` true after every push.
56
- 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).
55
+ At each round the reviewer writes `Look at first`, and a risk on the `Not proven / risk` line where one stands.
57
56
  With no reviewer step, the implementer writes both, including what its own evidence does not prove; where the body claims a check that has not concluded at the head, the implementer names that check under `Not proven / risk`.
58
57
  With no reviewer step, at retro the implementer updates `Not proven / risk` after reading the tester's handoff where the task has a tester step.
59
- A requirement there is unmet, unless only the deploy can show it and the plan names its observation.
60
58
  A stale `Outcome` is a finding against the implementer; the merger rewrites nothing.
61
59
 
62
60
  ## The simplify pass and the `Thermo` line
63
61
 
64
- - The implementer runs `skill://simplify-settled-diff` once per pull request, in its first implementing round, after its own results and before it completes, whatever the diff touches, a docs-only diff included.
62
+ - The implementer runs `skill://simplify-settled-diff` once per pull request, in its first implementing round, after its own results and before it completes; a docs-only diff needs none.
65
63
  Applied: rerun the fast local checks and the issue's checks the simplify diff touches, and record them at the applied head.
66
64
  A defect the pass reports is fixed outside the pass and the results recorded again, never dropped as out of scope;
67
65
  the `Thermo` line names the count and the fixing commit.
@@ -25,14 +25,14 @@ The pull request body's `Checks` lines are in `skill://legion-worker/references/
25
25
 
26
26
  - A `before_merge` result stands while its commit is the head of an open pull request Dispatch attributes to the check's issue (`packages/envoy/internal/dispatch/delivery/attribution.go`), or the final head of a merged one, and while no part of the check's block has changed.
27
27
  So after a push, record each `before_merge` check with no `ci_check` again.
28
+ Run it again only when the change since its pass can affect what it drives; otherwise record its earlier pass at the new head with `--observed 'carried from <old sha>: <why the change cannot affect it>'`.
28
29
 
29
30
  ## The rules every phase's evidence follows
30
31
 
31
32
  - The tester tries to break the changed surface (wrong and boundary inputs, the second and the concurrent run, the party it must refuse) and writes a failing test for each way it breaks that no existing test catches.
32
33
  Lint, types and the unit and integration suites are CI's: read them on GitHub at the head, rerun no lane as evidence, and wait for none.
33
34
 
34
- - After a forward merge, the tester reruns each check the merge can reach (`skill://legion-worker/references/conflicts-and-rewrites.md`) and records each other check with no `ci_check` at the new head unrun, its `--observed` naming the earlier pass and why the merge misses it.
35
- A class search that finds an instance, or a parent's last round, takes a full test round.
35
+ - On a new head, the tester reruns each check the change since the head it last tested can reach (for a merge of the base, `skill://legion-worker/references/conflicts-and-rewrites.md#reading-a-merge-of-the-base`) and records each other check with no `ci_check` at the new head unrun, its `--observed` naming the earlier pass and why the merge misses it.
36
36
 
37
37
  ## Never waiting on CI
38
38
 
@@ -14,7 +14,7 @@ Simplify recently changed code for clarity, reuse, quality and efficiency while
14
14
 
15
15
  If none of these gives a non-empty scope, ask the user what to simplify, with the host's question tool where it has one, else as numbered options in chat. Where the host lists a question tool that is not loaded, load it with the host's tool-discovery primitive before you fall back to chat. Never skip the question.
16
16
 
17
- Every file of the scope is in the pass: documentation, workflow and configuration files as much as code, and a scope that holds no code at all still runs. Read generated, vendored and lockfile content for what it shows, and edit none of it. Size is no gate: callers own any size or cost threshold.
17
+ Every file of the scope is in the pass: documentation, workflow and configuration files as much as code. Read generated, vendored and lockfile content for what it shows, and edit none of it. Size is no gate: callers own any size or cost threshold.
18
18
 
19
19
  ## Step 2: Three reviewers in parallel
20
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "5.16.8",
3
+ "version": "5.18.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "AGENTS.md"
20
20
  ],
21
21
  "legion": {
22
- "daemonApiVersion": 220
22
+ "daemonApiVersion": 228
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -39,7 +39,6 @@ For each spec, ask, comment and message:
39
39
  - Link each source where the person wrote it. With no link, state the design.
40
40
  - Treat a person's stated preference or past answer as evidence of their taste, never as a decision that settles the question. A commit attributed to a person is not their decision.
41
41
  - In a spec, cite code by file and symbol, never a line number.
42
- - A sentence citing a gate passing also says what the pass does not show: "Tests pass: a wrong verdict, not a missing one."
43
42
  - Keep only text a reader needs to understand, decide, build or check, and say what each issue you name does for them (`skill://plain-words`).
44
43
  - In an ask, ask block, comment or message, name a requirement or check by what it is, never its number.
45
44
 
@@ -48,16 +47,14 @@ For each spec, ask, comment and message:
48
47
  - Name the concrete case and its numbers, then the choice in those terms, never "Which option?".
49
48
  - A choice inside what the person asked for, one their messages favour, routine cleanup, sequencing, naming, a choice between equivalent options, and a fix you can make are yours.
50
49
  - Ask with an [ask block](skill://dispatch/SKILL.md#asks-and-ask-blocks): 2 to 4 options, short and self-contained: a person answers it with no other reading.
51
- - For each technical term you coined in this session, count by exact match the files holding it, in the repositories the work touches and in Dispatch. Expand or drop a term with a single-digit count. Read the draft for a coinage of common words too.
52
- - Measure each claim the ask rests on, its premise and each option's precondition. Where you cannot, mark the claim unverified and name the missing measurement; call an option unavailable only where a precondition demonstrably fails. No unmeasured number goes in a premise.
50
+ - Measure each claim the ask rests on, its premise and each option's precondition. A claim you cannot measure stays out of the ask until it is measured. Call an option unavailable only where a precondition demonstrably fails. No unmeasured number goes in a premise.
53
51
  - Before you pass a question on as one only an attended or privileged act answers, try the source that answers it, then the other records holding it. Keep a privileged read for what only the live system knows.
54
52
 
55
53
  ## Each version
56
54
 
57
55
  1. After a person's answer, comment or edit, reread the problem and rewrite what the answer touches, deleting what it contradicts. Answer each comment in its thread. Never narrate an edit.
58
- 2. Before each spec write, paste the whole spec, never a path, into a fresh subagent to list gaps, conflicts, uncheckable requirements, unclear text and needless questions. Fix or record each.
59
- 3. Before each approval request, `wait` for a read-only fact check: `task(agent="scout")`.
60
- 4. Name each version with `dispatch doc-edit --summary`.
56
+ 2. Where a spec is large, or changed in a way you cannot check alone, give the whole spec to a fresh subagent to find its gaps or check its facts.
57
+ 3. Name each version with `dispatch doc-edit --summary`.
61
58
 
62
59
  ## Decisions
63
60
 
@@ -21,7 +21,7 @@ Take the verb phrase out and ask: what literally happens? Write that. If you can
21
21
  |---|---|
22
22
  | land the change, land the PR | merge it, release it, deploy it, apply it — whichever one it is |
23
23
  | unblock the work | X can start once Y merges |
24
- | name the problem, name the owner, name a date | say the problem; who owns it is X; Y is left, and at the measured rate it ends on <date> |
24
+ | name the problem, name the owner, name a date | say the problem; who owns it is X; Y is left, and Z decides when it ends |
25
25
  | it pays for itself, that pays | it costs $16,306 and returns $60,379 a month |
26
26
  | carry it to X, carry the finding | tell X; send it to X; put it on the issue |
27
27
  | this shows the gap, the number shows | the gap is 12 of 30; the number is 1.17 |
@@ -58,7 +58,7 @@ For each row whose surface the diff touches, answer with a file:line citation.
58
58
  - A security finding with no stated exploit path is hardening, ranked Minor. One that states an exploit path is a finding at its real priority.
59
59
  - Report at most two hardening items, ranked, and put the rest in one paragraph.
60
60
  - Start each security finding with its row's tag, `Security[<tag>]:`.
61
- - End the report with one `Security:` line: each touched row's tag and its answer with file:line, or `Security: no sensitive surface in this diff.` when the diff touches none.
61
+ - When the diff touches a row, end the report with one `Security:` line: each touched row's tag and its answer with file:line.
62
62
 
63
63
  ## Findings
64
64
 
@@ -631,6 +631,12 @@ export function createChannelDelivery(input: {
631
631
  return tail.then(() => false)
632
632
  }
633
633
  if (late === true && passOverLateBtw(rendered)) return tail.then(() => false)
634
+ // A payload the card could not lay out is shown as the text its sender sent, said once here.
635
+ if (rendered.payloadShownAsText !== undefined) {
636
+ process.stderr.write(
637
+ `envoy-channel: message ${rendered.envelope?.event_id ?? "unknown"}'s payload is shown as its text; the card could not lay it out (${rendered.payloadShownAsText})\n`,
638
+ )
639
+ }
634
640
  return queued(async () => {
635
641
  // A message Dispatch accepted as this session's own turn is never also a card. A failure
636
642
  // after that acceptance throws, so the frame is not answered and the listener sends it