@sjawhar/pi-legion 8.11.0 → 8.13.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.
package/dist/legion.js CHANGED
@@ -15244,7 +15244,7 @@ function onEnvoyRoleRegained(listener) {
15244
15244
  // package.json
15245
15245
  var package_default = {
15246
15246
  name: "@sjawhar/pi-legion",
15247
- version: "8.11.0",
15247
+ version: "8.13.0",
15248
15248
  license: "Apache-2.0",
15249
15249
  type: "module",
15250
15250
  omp: {
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: legion-controller
3
- description: Use when handling Legion controller wakes for root-issue triage, keeping the admission slots full from `todo` issues, the daily report, architect escalation, or human interaction.
3
+ description: Use when handling Legion controller wakes for weekly-plan ranking, backlog stewardship, root-issue triage, keeping the admission slots full from `todo` issues, the daily report, architect escalation, or human interaction.
4
4
  ---
5
5
 
6
6
  # Legion Controller
7
7
 
8
8
  The controller is the one persistent, wake-driven session for a Legion project. It keeps the
9
- project's admission slots full with the highest-priority work, and makes triage, escalation, and
10
- human-interaction judgments; it never does phase-worker work or routes raw events into an
11
- architect.
9
+ project's admission slots full with the highest-priority work, keeps the weekly plan's order and
10
+ owners current in Dispatch, and makes triage, escalation, and human-interaction judgments; it never
11
+ does phase-worker work or routes raw events into an architect.
12
12
 
13
13
  ## Start and claim the controller role
14
14
 
@@ -25,6 +25,16 @@ alone: `op: "read_state"` returns the daemon's whole state (`issues.<KEY>.phase`
25
25
  `status` (`todo`, `backlog` or `icebox`) moves an issue. It never reads GitHub, and it runs no
26
26
  `legion` from bash.
27
27
 
28
+ ## Backlog stewardship
29
+
30
+ The controller is the project's order keeper. It retains its startup role,
31
+ `legion-<project>-controller`; `backlog-order` is retired. Send READY packets, scope questions,
32
+ and routing requests to `notifications.role.legion-<project>-controller`, then follow
33
+ [Backlog stewardship](skill://legion-controller/references/backlog-stewardship.md) for daily
34
+ weekly-plan reconciliation, Sami's rulings, ownership routing, and stopped-session recovery.
35
+ These duties change Dispatch's priority and board-rank data; they do not change the admission order
36
+ in [Keeping the slots full](#keeping-the-slots-full-go-daemon).
37
+
28
38
  For an interactive takeover from a hand-started OMP session, start OMP with
29
39
  `LEGION_CONTROLLER_SECRET` (or `LEGION_CONTROLLER_SECRET_FILE`, a path to a file holding it),
30
40
  `LEGION_DAEMON_URL`, `LEGION_PROJECT` (the daemon's project) and `LEGION_STATE_DIR` in its
@@ -324,11 +334,15 @@ priority first, then board rank ([Keeping the slots full](#keeping-the-slots-ful
324
334
 
325
335
  - **Direct user message always first.** If this turn includes a direct user message, answer
326
336
  it before handling every other wake.
337
+ - **Sami's rulings.** A direct Dispatch message from Sami is a ruling: after answering it, run
338
+ the full [Backlog stewardship](#backlog-stewardship) reconciliation and record the current rule
339
+ in the weekly plan.
327
340
  - **One wake = one turn.** Handle exactly the wake's implication, then end the turn. Never
328
341
  poll, idle-loop, or wait for another event. Two additions, after any direct user message: every
329
342
  turn first rechecks the [trees waiting on a root
330
343
  claim](#trees-waiting-on-a-root-claim-go-daemon), and your first turn of each UTC day, whatever
331
- woke you, also posts the day's report ([Daily report](#daily-report-go-daemon)).
344
+ woke you, also runs the [Backlog stewardship](#backlog-stewardship) reconciliation and posts the
345
+ day's report ([Daily report](#daily-report-go-daemon)).
332
346
  - **Wakes are advisory.** Before any side effect, verify the current daemon state and the
333
347
  relevant Dispatch issue. A stale or duplicate wake may cost a read, never a wrong action.
334
348
  - **Controller state is disposable.** Do not reconstruct or preserve local controller
@@ -0,0 +1,60 @@
1
+ # Backlog stewardship
2
+
3
+ The controller keeps the Dispatch backlog's facts aligned with the deployment's current weekly
4
+ plan. The plan is the source of the work order and its one-owner map; Dispatch priority and board
5
+ rank are the executable form of that order. The deployment instructions name the weekly-planning
6
+ issue and its `plan-week-*` artifact.
7
+
8
+ ## Controller routing address
9
+
10
+ The controller keeps its startup role, `legion-<project>-controller`; it never claims
11
+ `backlog-order`, which is retired. Send READY packets, scope questions, and routing requests to
12
+ `notifications.role.legion-<project>-controller`. Do not add another role claim or manual
13
+ subscription: changing roles ends the controller's wake delivery.
14
+
15
+ ## Reconcile the weekly plan
16
+
17
+ Run this pass on the first turn of every UTC day and after every ruling from Sami:
18
+
19
+ 1. Read the weekly-planning issue and select its newest `plan-week-*` artifact by its latest
20
+ `artifact.version` event. Read that artifact before changing any issue.
21
+ 2. For every current plan line in this deployment's project, make Dispatch's sort order exactly
22
+ match the line order: set the coarse priority and board rank together so the admission rule
23
+ (highest priority, then board rank) produces the plan's order. Keep each line's own stated
24
+ sequence. Do not invent a second order from a title, a stale route, or an instruction.
25
+ Reorder through Dispatch's board-rank API described in
26
+ `skill://dispatch/references/issues.md#board-rank-priority-and-assignee-on-a-read`.
27
+ 3. Reconcile the plan's one-owner map. For each listed owner, verify the named session is live.
28
+ For unowned work, find a suitable live owner with `envoy_sessions` filtered by `title` or `dir`,
29
+ route the issue to that exact session, and tell it what it owns. Do not change the human
30
+ `Assignee:` field: it controls who receives asks, not the working session.
31
+ 4. Rewrite the plan row with `dispatch doc-edit` guarded by the document token from the current
32
+ `dispatch doc-read`. The artifact states the current rule; replace superseded text instead of
33
+ keeping a change log in it. A comment or message does not update the one-owner map.
34
+
35
+ A ruling from Sami is a direct Dispatch message to this controller. Answer it first, carry out its
36
+ scope or priority decision, then record the resulting current rule in the affected weekly-plan row
37
+ (or its ruling section when it has no one line). Link the message when Dispatch gave it a reference.
38
+ A ruling triggers the full reconciliation pass even when it appears to affect only one issue.
39
+
40
+ ## Answering controller deliveries
41
+
42
+ Read every delivery to `notifications.role.legion-<project>-controller` against live Dispatch and
43
+ daemon state. Answer scope questions from the weekly plan and deployment instructions. Route a
44
+ request to the verified owner when it is not the controller's decision.
45
+
46
+ Until the deployment's daemon arms READY pull requests, answer each READY packet with its current
47
+ queue or hold outcome and route it to the live owner named by the deployment's rules. Never merge
48
+ or use a GitHub credential from the controller. Once the daemon arms READY pull requests, the
49
+ controller confirms the Dispatch record and leaves the arm to the daemon.
50
+
51
+ ## Recovering stopped-session work
52
+
53
+ Treat a session route as stopped only after the owner audit's two `no_holder` reads at least ten
54
+ minutes apart. Do not poll to create the second read; use the next normal controller wake. Confirm
55
+ that no live owner is available with `envoy_sessions` before changing the issue.
56
+
57
+ For work that the plan or its handoff says moves to Legion when its session stops, preserve its
58
+ existing labels, add `legion`, then use `legion status <KEY> todo`. The label comes first: it is what
59
+ lets the daemon admit the root. Do not apply that recovery to an issue already in an active Legion
60
+ tree; its architect and daemon own its lifecycle. Update the weekly-plan owner row after the move.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "8.11.0",
3
+ "version": "8.13.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {