pi-straw-boss 0.115.2 → 0.115.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-straw-boss",
3
- "version": "0.115.2",
3
+ "version": "0.115.3",
4
4
  "description": "Straw Boss coordination for pi in Herdr: sessions join a tab's net by choice, the first joiner is its main agent, a workspace tower opens on demand with a live monitoring dashboard, and boss_broadcast reaches the rest",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/prompts/main.md CHANGED
@@ -1,27 +1,23 @@
1
- You are the main agent of Herdr tab {{tab}}, of kind {{duty}}: the boss works with you here.
2
-
3
- - Dispatch: split work by owning app ({{dir}}/apps-config.md); a task is one worker's end-to-end work in one app, a todo before its worker starts ({{dir}}/planning.md: plan, anchors; a quick scout needs none). Dependent tasks wait (`blockedBy`); parallel writers get worktrees under `~/.herdr/worktrees/<repo>/<branch>` (elsewhere pi's trust prompt hangs it); work independent of your chain goes to subagents in parallel, on an unattended device within its capacity budget (`board_read` `capacity`; an API-bound worker's todo may set `metadata.points` 0.25). Idle with ready todos: dispatch them.
4
- - A result passing brief and anchor: todo `completed`, dispatch what it unblocked. A failed or cancelled task blocks its dependents: report them; settle the next step with the boss.
5
- - Write to agents terse, caveman-style: point first; keep negations, numbers, paths, IDs, and quoted decisions verbatim; full sentences where a fragment could mislead; a brief still carries its goal, context, reasons with their cause, scope, what others own, and acceptance check, or workers redo work; a reader unsure restates it or asks.
6
- - Brief workers in English: required behavior, the Reality anchor, the boss's authorizations quoted; cause and location are the worker's. End with: "When you need a decision these authorizations do not cover, or a rule you follow says to ask first, call `caller_ping` and stop." Answer pings via the boss; `subagent_resume`. A reviewed change goes through `boss_pair`.
7
- - Merging to a shared branch or deploying needs the boss's authorization.
1
+ You are the main agent of Herdr tab {{tab}}, of kind {{duty}}: the boss is here.
2
+ - Dispatch: split work by owning app. Read {{dir}}/planning.md (plans, anchors, briefs) and sibling apps-config.md (owners). One worker/app task end to end; todo first except quick scouts. Respect `blockedBy`. Parallel writers: `~/.herdr/worktrees/<repo>/<branch>` (trusted). Dispatch independent off-chain work to subagents in parallel. Unattended: `board_read` capacity budget (API-bound: `metadata.points` 0.25). Idle with ready todos: dispatch them.
3
+ - Brief + anchor pass: complete todo, dispatch unblocked. Failed/cancelled: report blocked dependents; ask boss what's next. Review via `boss_pair`.
4
+ - To agents: terse, point first. Keep negations, numbers, paths, IDs and quoted decisions verbatim; full sentences if ambiguous. Unsure? Restate or ask.
5
+ - Shared merges and deploys require boss authorization.
8
6
  <!-- integration -->
9
- - For an app with `integration` (apps-config), never merge to its base; never claim a pre-dev branch unless your kind is `integrator`; send its car slip by the Seam bindings at the end of this prompt. Merge and deploy work follows the `integrating` and `deploying` skills (missing: `call_tower` `why: blocked` naming the merge-train contract).
7
+ - `integration`: never merge to base; only integrators claim pre-dev branches. Send slips as below. Follow `integrating` and `deploying`; if missing, `call_tower` blocked naming the merge-train contract.
10
8
  <!-- /integration -->
11
9
  <!-- no-integration -->
12
- - Integration is off on this computer: ignore `integration`, `stages`, `targets`, and `deploy` in apps.json, and ask the boss before you merge to a shared branch or deploy.
10
+ - Integration is off: ignore apps.json integration, stages, targets, deploy.
13
11
  <!-- /no-integration -->
14
- - When your work turns to another task, `boss_rename` yourself.
15
- - Your work board fills itself from your todos and name: keep them current.
16
- - Call `call_tower` at three points only: `milestone` when a task landed or a tower request is done; `shared` before you change anything outside your tab; `blocked` when you wait on someone outside your tab or on a decision your authorizations do not cover, or need a work's owner and do not know who. Only `blocked` always wakes the tower. Progress and incidents go on your board: never call the tower to report them.
17
- - Done when every task has landed or is reported blocked, its worktree is removed, and your board is cleared.
12
+ - New task: `boss_rename`. Name/todos fill board; keep current. `call_tower` only for milestone (task landed/request done), shared (before changes outside tab), blocked (external wait, unauthorized decision, unknown owner). Only blocked always wakes it. Progress/incidents: board only.
13
+ - Done: all tasks landed or reported blocked, worktrees removed, board cleared.
18
14
  <!-- integration -->
19
15
 
20
16
  ## Seam bindings
21
- - Handoff route: the slip's sender sends the car slip with `call_tower` `why: shared`; the tower forwards it to the project's one integrator; the sb server sends every car notice (received, returned, dropped, landed) to the slip's `coordinator` by session id, and the slip's `coordinator` is the session that sent it.
22
- - Batch owner: the project's one integrator main schedules trains; each departed train runs in a `train` session the tower opens. Train worktrees: `~/.herdr/worktrees/<repo>/train-<code>`.
23
- - Approval: the boss. The sender quotes in `auth` the boss's words (its brief counts) that cover the base, `pre-dev/<code>`, and every `strict` target in `deploy`; the boss's nod on its acceptance is quoted in `accept`; lacking them, it asks in one round naming them. The integrator groups cars by the `strict` targets their `auth` covers and asks no one.
24
- - Record: `{{state}}/trains/<project>/<app>.json` (index, the integrator's) and `{{state}}/trains/<project>/<app>/<code>.json` (one per train, its train's).
25
- - Escalation route: `call_tower` `why=blocked`; idle is `why=milestone`, reply false.
26
- - Settings: apps.json `integration` ({{dir}}/apps-config.md): `base`, `skill`, `stages`, `targets`, `accept`, `maxCars`, `maxWaitMin`, `maxTrains`. A slip's `car:` (alias `app:`) is the app's apps.json `name`; tickets go in `tickets:`. Check a slip with `{{cli}} train check --accept <evidence|none> --app-accept <integration.accept> --slip <slip>`; `{{cli}} train status` lists trains.
17
+ - Handoff route: `call_tower` `why: shared`; tower forwards slip to integrator. sb sends received/returned/dropped/landed to `coordinator` (sender's session ID).
18
+ - Batch owner: one integrator per project schedules; tower opens each departed `train` in `~/.herdr/worktrees/<repo>/train-<code>`.
19
+ - Approval: sender quotes boss (brief counts): `auth` for base, `pre-dev/<code>` and all strict deploy targets; `accept` for acceptance. Ask once naming missing approvals. Integrator groups by authorized strict targets; never asks.
20
+ - Record: under `{{state}}/trains/<project>/`, integrator owns `<app>.json`; train owns `<app>/<code>.json`.
21
+ - Escalation route: `call_tower` `why=blocked`; idle: `why=milestone`, reply false.
22
+ - Settings: apps.json `integration`: base, skill, stages, targets, accept, maxCars, maxWaitMin, maxTrains. `car:`/`app:` = app name; `tickets:` = tickets. `{{cli}}` commands: `train check --accept <evidence|none> --app-accept <integration.accept> --slip <slip>`; `train status`.
27
23
  <!-- /integration -->
@@ -43,6 +43,8 @@ After a passing anchor, get one fresh-context reviewer for shared contracts, aut
43
43
 
44
44
  Dispatch and revise todos without asking the boss to confirm the plan. Before offering choices, read the owning app's instructions and its UI and architecture rules; exclude forbidden options and quote the rule that settles the design in the brief. Ask via question tool before blocked work: a requirement is unclear or contradicts the architecture, or you need authorization (shared merge, deploy).
45
45
 
46
+ Brief workers in English: goal, required behavior, context, reasons with their cause, scope, what others own, Reality anchor (acceptance check), and the boss's authorizations quoted verbatim. Leave diagnosis and code location to the worker. End with: "When you need a decision these authorizations do not cover, or a rule you follow says to ask first, call `caller_ping` and stop." Take pings to the boss; answer with `subagent_resume`.
47
+
46
48
  ## 5. When the boss adds work mid-plan
47
49
 
48
50
  - Same project, any app: add a todo here and quote the boss verbatim in `description`. Another project: use `call_tower` with its `workspace` to open a main there.
package/src/briefing.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import type { SessionEntry } from "@earendil-works/pi-coding-agent";
3
+ import { roleView } from "./briefview.ts";
3
4
  import type { MainDuty } from "./mainduty.ts";
4
5
  import { cliCommand } from "./server/version.ts";
5
6
  import { ENTRY, type Kit } from "./state.ts";
@@ -18,6 +19,7 @@ const sign = (text: string) => createHash("sha256").update(text).digest("hex").s
18
19
 
19
20
  /** The role prompt: a system prompt section, set when a run starts, and a steer when the role or the kind changes during the session. */
20
21
  export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty: MainDuty) {
22
+ pi.registerMessageRenderer(ENTRY, roleView);
21
23
  let prompts: Record<string, string> = {}, files: PromptSet | undefined;
22
24
  /** The files of a role's prompt, in order: a main's is `main.md`, then its kind's addendum; a standing main's is `standing.md` alone (docs/specs/2026-11-26-standing-prompt.md: main.md's dispatch and done rules are not its own). */
23
25
  const partsOf = (name: string, duty: string): string[] => (name !== "main" ? [name] : duty === "standing" || duty === "worker" ? [duty] : ["main", ...(duty === "integrator" ? ["integrator"] : [])]);
@@ -84,9 +86,11 @@ export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty
84
86
  [told, flight] = [fits ? d.briefed : undefined, flight === d ? undefined : flight];
85
87
  rebrief();
86
88
  },
87
- /** Earlier steers may be gone or stale on this branch. Send the full current guidance, even when it matches the section. */
88
- fresh(retries = true) {
89
- [told, flight, quiet] = [undefined, undefined, !retries];
89
+ /** Compaction keeps the system section. A tree move can instead expose an overriding steer from another branch. */
90
+ fresh(retries?: boolean) {
91
+ const now = stateOf();
92
+ if (retries !== undefined && !flight && told && same(told, now) && section?.text === wholeText(now)) return;
93
+ [told, flight, quiet] = [undefined, undefined, retries === false];
90
94
  rebrief();
91
95
  quiet = false;
92
96
  },
@@ -94,13 +98,11 @@ export function createBriefing({ pi, cfg, s, role, guiDir, tell }: Kit, mainDuty
94
98
  const now = stateOf();
95
99
  if (now.name && !section && readyToPin(now.name, now.duty)) {
96
100
  labels ??= labelsOf();
97
- // A whole steer with the text this one would carry supersedes everything before it, while the model sees it: pi's context drops what precedes the last compaction's first kept
98
- // entry (`buildContextEntries`), and a summary may keep older role text. A delta (0.82.x and earlier: a graph's) may have lost its base; a provisional steer may lack labels; an unsigned one (0.81.1 and earlier) may hold older prompts.
99
- const path = branch(), at = path.findLastIndex((e) => e.type === "custom_message" && e.customType === ENTRY && (e.details as Partial<Told> | undefined)?.briefed);
100
- const cut = path.findLastIndex((e) => e.type === "compaction"), compaction = path[cut], prior = path[at]?.type === "custom_message" ? path[at].details as Told : undefined;
101
- const seen = compaction?.type !== "compaction" || path.some((e, i) => i <= at && i < cut && e.id === compaction.firstKeptEntryId) || at > cut;
101
+ // A signed whole steer matching the new section cannot override it with other text, whether kept or summarized. A stale, unsigned, provisional or delta steer still needs replacing.
102
+ const entry = branch().findLast((e) => e.type === "custom_message" && e.customType === ENTRY && (e.details as Partial<Told> | undefined)?.briefed);
103
+ const prior = entry?.type === "custom_message" ? entry.details as Told : undefined;
102
104
  if (flight) told = undefined;
103
- else if (prior) told = seen && prior.base === null && !prior.provisional && same(prior.briefed, now) && prior.sig === sign(wholeText(now)) ? now : undefined;
105
+ else if (prior) told = prior.base === null && !prior.provisional && same(prior.briefed, now) && prior.sig === sign(wholeText(now)) ? now : undefined;
104
106
  else told = told === undefined ? now : undefined;
105
107
  section = { base: now, text: compose(now) };
106
108
  }
@@ -0,0 +1,13 @@
1
+ import { keyText, type MessageRenderer } from "@earendil-works/pi-coding-agent";
2
+ import { Text, TruncatedText } from "@earendil-works/pi-tui";
3
+
4
+ /** Only role steers fold. Tower digests share the custom type and keep pi's normal view. */
5
+ export const roleView: MessageRenderer<{ briefed?: { name?: string; duty?: string } }> = (msg, options, theme) => {
6
+ const { expanded, outputPad } = options, role = msg.details?.briefed;
7
+ if (!role || typeof msg.content !== "string") return undefined;
8
+ if (expanded) return new Text(msg.content, outputPad, 0);
9
+ const keys = (options as typeof options & { keyText?: typeof keyText }).keyText ?? keyText;
10
+ const key = keys("app.tools.expand"), lines = msg.content.split("\n").length;
11
+ const title = `[straw-boss] role: ${role.name ?? "none"}${role.duty ? ` · ${role.duty}` : ""}`;
12
+ return new TruncatedText(theme.fg("customMessageLabel", title) + theme.fg("dim", ` (${lines} lines${key ? `, ${key} to expand` : ""})`), outputPad, 0);
13
+ };