benignswarm 0.12.78 → 0.12.80

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/args.js CHANGED
@@ -3,8 +3,8 @@ import { CliError } from "./errors.js";
3
3
  // These options accept comma-separated collections, so repeating them should
4
4
  // append another collection instead of discarding earlier values.
5
5
  export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "default-tags", "units", "waits-on", "needs", "exclude", "remove", "post", "harness", "variant", "requires"];
6
- export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text"];
7
- export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel"];
6
+ export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "follow-delay", "env", "scope", "append", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "default-tags", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason", "at", "requires", "priority", "informs", "amend", "waive-informs", "text", "kind", "claim", "decision"];
7
+ export const BOOL_FLAGS = ["latest", "no-restart", "json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "scope-only", "unread", "pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel"];
8
8
  export function parse(argv) {
9
9
  const options = {};
10
10
  for (const f of STRING_FLAGS)
package/dist/brief.js ADDED
@@ -0,0 +1,35 @@
1
+ import { Client } from "./client.js";
2
+ import { loadAgent, resolveAgentName } from "./config.js";
3
+ export async function fetchRecoveryBrief(nameOrRef) {
4
+ const name = resolveAgentName(nameOrRef);
5
+ const creds = loadAgent(name);
6
+ const response = await Client.forAgent(creds, undefined, { presence: false }).call("GET", "/agents/me/brief");
7
+ return response.brief;
8
+ }
9
+ export function formatRecoveryBrief(brief) {
10
+ const lines = [`[bschat] Resume brief for ${brief.agent}`, `Role: ${brief.role}`];
11
+ if (brief.projects.length)
12
+ lines.push(`Process: ${brief.projects.map((p) => `${p.name} ${p.process} (${Array.isArray(p.changed_since_last_read) ? `changed since you last read: ${p.changed_since_last_read.join("; ")}` : p.changed_since_last_read})`).join("; ")}`);
13
+ lines.push("Units:");
14
+ lines.push(...(brief.units.length ? brief.units.map((u) => ` [${u.state}] ${u.project} WU #${u.number} ${u.title} — ${u.next}`) : [" none"]));
15
+ lines.push("Reviews waiting on you:");
16
+ lines.push(...(brief.reviews.length ? brief.reviews.map((r) => ` ${r.project} ${r.slice ? `slice ${r.slice}` : `WU #${r.number}`} ${r.title} — ${r.next}`) : [" none"]));
17
+ lines.push("Open questions and asks:");
18
+ lines.push(...[...brief.questions.map((q) => ` ${q.project} WU #${q.number}: ${q.question} — ${q.next}`), ...brief.asks.map((a) => ` ${a.project} ask ${a.id}: ${a.question} (${a.blocks}) — ${a.next}`)].slice(0, 10));
19
+ if (!brief.questions.length && !brief.asks.length)
20
+ lines.push(" none");
21
+ lines.push("Slices:");
22
+ lines.push(...(brief.slices.length ? brief.slices.map((s) => ` ${s.project} ${s.key}: ${s.title} — ${s.next}`) : [" none"]));
23
+ lines.push("Recent decisions:");
24
+ lines.push(...(brief.decisions.length ? brief.decisions.map((d) => ` ${d.project} ${d.slice} WU #${d.unit} (${d.source}): ${d.ruling}`) : [" none"]));
25
+ return lines.join("\n");
26
+ }
27
+ export const recoveryBriefUnavailableText = "[bschat] Recovery brief unavailable after compaction. Run bschat resume to retrieve the current agent state.";
28
+ export function recoveryBriefWasDelivered(brief, sent) {
29
+ return !!brief && sent;
30
+ }
31
+ export async function resume(p, out) {
32
+ const name = resolveAgentName(typeof p.flags.as === "string" ? p.flags.as : undefined);
33
+ const brief = await fetchRecoveryBrief(name);
34
+ out.print(formatRecoveryBrief(brief), brief);
35
+ }
@@ -82,10 +82,10 @@ export async function admin(p, out) {
82
82
  return milestonesWith(adminClient(p), action, rest[0], p, out);
83
83
  }
84
84
  case "milestone": {
85
- // bschat-admin milestone <project> add|edit|show|close|reopen|review|verdict|gap-units <key> ...
85
+ // bschat-admin milestone <project> add|edit|show|decide|close|reopen|review|verdict|gap-units <key> ...
86
86
  if (!action)
87
- throw new CliError("usage", "milestone <project> <add|edit|show|close|reopen|review|verdict|gap-units> <key> ...");
88
- return milestoneWith(adminClient(p), action, rest[0], rest[1], p, out);
87
+ throw new CliError("usage", "milestone <project> <add|edit|show|decide|close|reopen|review|verdict|gap-units> <key> ...");
88
+ return milestoneWith(adminClient(p), action, rest[0], rest[1], p, out, rest.slice(2));
89
89
  }
90
90
  case "needs":
91
91
  return needsAdmin(p, out);
@@ -359,10 +359,14 @@ export async function skill(p, out) {
359
359
  const main = await fetchText("/skill/SKILL.md");
360
360
  const api = await fetchText("/skill/references/api.md");
361
361
  const watchers = await fetchText("/skill/references/watchers.md");
362
+ const processGuide = await fetchText("/skill/references/process.md");
363
+ const continuity = await fetchText("/skill/references/continuity.md");
362
364
  mkdirSync(join(dir, "references"), { recursive: true });
363
365
  writeFileSync(join(dir, "SKILL.md"), main);
364
366
  writeFileSync(join(dir, "references", "api.md"), api);
365
367
  writeFileSync(join(dir, "references", "watchers.md"), watchers);
368
+ writeFileSync(join(dir, "references", "process.md"), processGuide);
369
+ writeFileSync(join(dir, "references", "continuity.md"), continuity);
366
370
  out.print(`Installed skill to ${dir}`, { dir });
367
371
  return;
368
372
  }
@@ -43,6 +43,12 @@ export async function evidence(p, out) {
43
43
  const label = str(p.flags, "label");
44
44
  if (label)
45
45
  headers["x-bschat-label"] = label;
46
+ const kind = str(p.flags, "kind");
47
+ if (kind)
48
+ headers["x-bschat-kind"] = kind;
49
+ const claim = str(p.flags, "claim");
50
+ if (claim)
51
+ headers["x-bschat-claim"] = claim;
46
52
  const res = await fetch(`${creds.url}/projects/${project}/evidence`, { method: "POST", headers, body: new Uint8Array(bytes) });
47
53
  const json = await res.json();
48
54
  if (!res.ok)
@@ -51,9 +57,15 @@ export async function evidence(p, out) {
51
57
  return;
52
58
  }
53
59
  if (sub === "list") {
54
- const r = await client.call("GET", `/projects/${project}/evidence?limit=${str(p.flags, "limit") ?? "50"}`);
55
- const rows = r.evidence.map((e) => ({ id: e.id, filename: e.filename, size: e.size, by: e.agent_name, label: e.label, sha256: e.sha256.slice(0, 12), created_at: e.created_at }));
56
- out.print(table(rows, ["id", "filename", "size", "by", "label", "sha256", "created_at"]), r);
60
+ const qs = new URLSearchParams({ limit: str(p.flags, "limit") ?? "50" });
61
+ for (const flag of ["unit", "kind"]) {
62
+ const value = str(p.flags, flag);
63
+ if (value !== undefined)
64
+ qs.set(flag, value);
65
+ }
66
+ const r = await client.call("GET", `/projects/${project}/evidence?${qs}`);
67
+ const rows = r.evidence.map((e) => ({ id: e.id, filename: e.filename, size: e.size, kind: e.kind, claim: e.claim, by: e.agent_name, label: e.label, sha256: e.sha256.slice(0, 12), created_at: e.created_at }));
68
+ out.print(table(rows, ["id", "filename", "size", "kind", "claim", "by", "label", "sha256", "created_at"]), r);
57
69
  return;
58
70
  }
59
71
  if (sub === "info") {
@@ -7,6 +7,7 @@ import { fmtMessage } from "../output.js";
7
7
  import { readState, writeState } from "../state.js";
8
8
  import { goalFromClaudeTranscript, modelFromClaudeTranscript } from "../model.js";
9
9
  import { conversationAgent, sessionAgent, syncFromWatchers } from "../sessions.js";
10
+ import { fetchRecoveryBrief, formatRecoveryBrief, recoveryBriefUnavailableText } from "../brief.js";
10
11
  const HEARTBEAT_MS = 60_000;
11
12
  /** Reads the harness's hook payload from stdin without blocking when there is none. */
12
13
  function readStdinJson() {
@@ -330,7 +331,10 @@ export async function hook(p) {
330
331
  // Standing rules die with the context. On SessionStart (startup, resume, and after a compaction)
331
332
  // re-deliver the role description and the project's process when the agent has not seen this
332
333
  // version, and record that it was shown.
333
- const standing = harness === "claude-code" && event === "SessionStart" ? await standingRules(name, input?.source === "compact") : null;
334
+ const compacted = input?.source === "compact";
335
+ const standing = harness === "claude-code" && event === "SessionStart"
336
+ ? compacted ? await recoveryBrief(name) : await standingRules(name, false)
337
+ : null;
334
338
  // The hook firing is proof the harness is working; tell the server, at most once a minute.
335
339
  // The session goal (/goal) rides along from the transcript, and a change goes out at once.
336
340
  if (harness === "claude-code") {
@@ -362,6 +366,17 @@ export async function hook(p) {
362
366
  }
363
367
  await acknowledgeStanding(name, standing, formatted.acknowledge);
364
368
  }
369
+ /** After compaction, restore agent-specific state instead of repeating the standing agreements. */
370
+ export async function recoveryBrief(name) {
371
+ try {
372
+ const text = formatRecoveryBrief(await fetchRecoveryBrief(name));
373
+ return { text, deferredText: text, acknowledge: false, version: 0, project: null };
374
+ }
375
+ catch (e) {
376
+ process.stderr.write(`bschat: could not fetch recovery brief: ${e.message}\n`);
377
+ return { text: recoveryBriefUnavailableText, deferredText: recoveryBriefUnavailableText, acknowledge: false, version: 0, project: null };
378
+ }
379
+ }
365
380
  /**
366
381
  * The role and process the agent must hold after a new session or a compaction, when it has not
367
382
  * seen this process version (or always after a compaction). Records that it was shown.
@@ -21,7 +21,13 @@ async function fetchSkill(url) {
21
21
  throw new CliError("fetch_failed", `${url}${p} returned ${res.status}`);
22
22
  return res.text();
23
23
  };
24
- return { skill: await get("/skill/SKILL.md"), api: await get("/skill/references/api.md"), watchers: await get("/skill/references/watchers.md") };
24
+ return {
25
+ skill: await get("/skill/SKILL.md"),
26
+ api: await get("/skill/references/api.md"),
27
+ watchers: await get("/skill/references/watchers.md"),
28
+ process: await get("/skill/references/process.md"),
29
+ continuity: await get("/skill/references/continuity.md"),
30
+ };
25
31
  }
26
32
  function harnessList(p, vendor) {
27
33
  const flag = str(p.flags, "harness");
@@ -20,6 +20,7 @@ import { acquireWatchLock } from "../lock.js";
20
20
  import { formatUpdates, gatherUpdates, reportDelivery } from "./hook.js";
21
21
  import { readState, writeState } from "../state.js";
22
22
  import { probeCapabilities } from "../capabilities.js";
23
+ import { fetchRecoveryBrief, formatRecoveryBrief, recoveryBriefUnavailableText, recoveryBriefWasDelivered } from "../brief.js";
23
24
  /** Reports host probes without refreshing the agent's presence; the host identity is still explicit. */
24
25
  export async function reportWatcherCapabilities(creds, project, definitions, cwd = process.cwd()) {
25
26
  const results = probeCapabilities(definitions, cwd);
@@ -134,6 +135,7 @@ export async function watch(p, out) {
134
135
  let lastKeyCheck = 0;
135
136
  const ctl = { turn: null, failedAt: 0, loggedRunning: null, pausedUntil: 0, pausedAt: 0 };
136
137
  const probe = turn ? probeFor(turn.harness, turn.session, name) : null;
138
+ let resumeBriefDelivered = false;
137
139
  while (!stopping) {
138
140
  if (activity && heartbeatClient)
139
141
  lastSample = await heartbeatIfActive(heartbeatClient, activity, lastSample, interval, log);
@@ -210,9 +212,14 @@ export async function watch(p, out) {
210
212
  if (!full) {
211
213
  try {
212
214
  if (probe)
213
- await turnStep(ctl, probe, turnTimeout, log, (sink) => wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once, sink), name);
214
- else
215
- await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once);
215
+ await turnStep(ctl, probe, turnTimeout, log, async (sink) => {
216
+ const result = await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once, sink, !resumeBriefDelivered);
217
+ resumeBriefDelivered = resumeBriefDelivered || result.recoveryBriefDelivered;
218
+ }, name);
219
+ else {
220
+ const result = await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once, undefined, !resumeBriefDelivered);
221
+ resumeBriefDelivered = resumeBriefDelivered || result.recoveryBriefDelivered;
222
+ }
216
223
  }
217
224
  catch (e) {
218
225
  if (e.code === "unauthorized" && !once) {
@@ -233,21 +240,27 @@ export async function watch(p, out) {
233
240
  if (stopping)
234
241
  return stoppingCode;
235
242
  if (u) {
236
- const total = u.counts.messages + u.counts.items + u.counts.followed + u.counts.digest;
237
- const summary = u.text.split("\n")[0].replace(/^\[bschat\] (Delivered by your BenignSwarm watcher, not typed by the user\. )?/, "");
243
+ const recovery = resumeBriefDelivered ? null : await recoveryBriefText(name, log);
244
+ const update = resumeBriefDelivered ? u : formatUpdates(u, [recovery ?? recoveryBriefUnavailableText]);
245
+ const total = update.counts.messages + update.counts.items + update.counts.followed + update.counts.digest;
246
+ const summary = update.text.split("\n")[0].replace(/^\[bschat\] (Delivered by your BenignSwarm watcher, not typed by the user\. )?/, "");
247
+ let delivered = true;
238
248
  if (exec) {
239
- const cmd = exec.replaceAll("{count}", String(total)).replaceAll("{summary}", shellQuote(summary)).replaceAll("{text}", shellQuote(u.text));
249
+ const cmd = exec.replaceAll("{count}", String(total)).replaceAll("{summary}", shellQuote(summary)).replaceAll("{text}", shellQuote(update.text));
240
250
  log(`new activity (${summary}); running: ${cmd}`);
241
- const code = await run(cmd, u.text, { BSCHAT_TEXT: u.text, BSCHAT_SUMMARY: summary, BSCHAT_COUNT: String(total) });
242
- if (code !== 0)
251
+ const code = await run(cmd, update.text, { BSCHAT_TEXT: update.text, BSCHAT_SUMMARY: summary, BSCHAT_COUNT: String(total) });
252
+ if (code !== 0) {
243
253
  log(`command exited ${code}`);
254
+ delivered = false;
255
+ }
244
256
  }
245
257
  else {
246
- process.stdout.write(u.text + "\n");
258
+ process.stdout.write(update.text + "\n");
247
259
  }
248
260
  // Full mode delivers the update payload directly instead of using the wake path, so
249
261
  // record the same actual payload bytes and kinds through the hook's existing metric call.
250
- await reportDelivery(name, u.text, u.delivery.by_kind, "watch");
262
+ await reportDelivery(name, update.text, update.delivery.by_kind, "watch");
263
+ resumeBriefDelivered = resumeBriefDelivered || recoveryBriefWasDelivered(recovery, delivered);
251
264
  if (stopping)
252
265
  return stoppingCode;
253
266
  }
@@ -266,16 +279,7 @@ async function waitIntervalOrStop(ms, stopped) {
266
279
  if (timer)
267
280
  clearTimeout(timer);
268
281
  }
269
- /**
270
- * One numbered wake-up at a time. Each wake-up carries a sequence number and asks the agent to
271
- * acknowledge it first (bschat wake ack <n>); until it does, nothing else is queued for it, for
272
- * any reason. Learned from Codex: a harness delivers queued prompts only after its current turn,
273
- * so the old rule (pending clears when the agent's read cursors move, an operator message or a
274
- * timeout queues another) let six or seven wake-ups pile up behind a busy turn. Delivered back to
275
- * back, they pulled sol-architect off its task and it stopped with the task unfinished. The
276
- * cursors moved because the agent was reading while it worked, not because it saw the wake-up.
277
- */
278
- async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once, turnSink) {
282
+ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once, turnSink, includeResumeBrief = false) {
279
283
  const state = readState(name);
280
284
  const pending = state.watch_pending;
281
285
  if (pending) {
@@ -302,7 +306,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
302
306
  }
303
307
  else if (once)
304
308
  log(`wake-up ${st.watch_pending.seq !== undefined ? `#${st.watch_pending.seq} ` : ""}queued ${Math.round(waited / 1000)}s ago and not acknowledged; not queueing another`);
305
- return;
309
+ return { sent: false, recoveryBriefDelivered: false };
306
310
  }
307
311
  const u = await gatherUpdates(name, { force: true, model, delivery: "watch", dryRun: true });
308
312
  // A process change is news too. Watched harnesses never see the Claude Code hook re-deliver the
@@ -315,7 +319,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
315
319
  if (!processNews) {
316
320
  if (once)
317
321
  log("nothing new");
318
- return;
322
+ return { sent: false, recoveryBriefDelivered: false };
319
323
  }
320
324
  }
321
325
  else if (u.tier === "digest" && !processNews) {
@@ -323,7 +327,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
323
327
  // follow delay so bursts collapse; digest-only channels never wake it on their own.
324
328
  if (once)
325
329
  log("only digest-level unread; not waking");
326
- return;
330
+ return { sent: false, recoveryBriefDelivered: false };
327
331
  }
328
332
  else if (u.tier === "followed" && !processNews) {
329
333
  const since = st.watch_followed_since ?? Date.now();
@@ -333,11 +337,13 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
333
337
  if (waited < followDelay * 1000) {
334
338
  if (once)
335
339
  log(`followed-channel traffic only; waiting (${Math.round(waited / 1000)}/${followDelay}s) before waking`);
336
- return;
340
+ return { sent: false, recoveryBriefDelivered: false };
337
341
  }
338
342
  }
339
343
  const seq = (st.watch_seq ?? 0) + 1;
340
344
  const operatorNew = !!u && u.latestOperatorAt !== null && u.latestOperatorAt !== (st.watch_operator_at ?? null);
345
+ const recovery = includeResumeBrief ? await recoveryBriefText(name, log) : null;
346
+ const recoveryPrompt = includeResumeBrief ? recovery ?? recoveryBriefUnavailableText : null;
341
347
  const wakePrefix = [
342
348
  ...(turnSink
343
349
  ? [`[bschat] Turn #${seq}, started by your BenignSwarm watcher because you were idle; not typed by the user. It is already acknowledged.`]
@@ -346,6 +352,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
346
352
  `First acknowledge it: bschat wake ack ${seq} (no other wake-up comes until you do). If you are in the middle of a task, acknowledge, read, then carry on with the task.`,
347
353
  ]),
348
354
  operatorNew ? `A human operator wrote to you directly.` : null,
355
+ recoveryPrompt,
349
356
  processNews ? processLine(lag) : null,
350
357
  ].filter(Boolean);
351
358
  const wakeSuffix = [
@@ -360,7 +367,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
360
367
  // the acknowledgement, operator note, process pointer, read commands, and delivery body.
361
368
  const line = wake;
362
369
  if (!(await deliver(name, exec, wake, line, u ? u.tier : "process", total, log, operatorNew ? "operator message; " : "", seq, turnSink, payload?.delivery.by_kind ?? u?.delivery.by_kind)))
363
- return;
370
+ return { sent: false, recoveryBriefDelivered: false };
364
371
  writeState(name, {
365
372
  ...readState(name),
366
373
  watch_seq: seq,
@@ -370,6 +377,16 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
370
377
  watch_followed_since: undefined,
371
378
  watch_dormant_logged_at: undefined,
372
379
  });
380
+ return { sent: true, recoveryBriefDelivered: recoveryBriefWasDelivered(recovery, true) };
381
+ }
382
+ async function recoveryBriefText(name, log) {
383
+ try {
384
+ return formatRecoveryBrief(await fetchRecoveryBrief(name));
385
+ }
386
+ catch (e) {
387
+ log(`recovery brief unavailable: ${e.message}`);
388
+ return null;
389
+ }
373
390
  }
374
391
  /** Runs the wake command (or prints the wake-up without one). False when the command failed: nothing was delivered. */
375
392
  async function deliver(name, exec, wake, summary, tier, total, log, prefix, seq, turnSink, kinds = {}) {
@@ -7,9 +7,34 @@ import { readState } from "../state.js";
7
7
  import { codexRollout, sessionsOf } from "../sessions.js";
8
8
  import { sessionUsage } from "../usage.js";
9
9
  import { CliError } from "../errors.js";
10
- import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, fullSha, isAncestor, remoteHead, removeWorktreeIfClean, repoName, repoParent, verifyMergedCommit, worktreeForBranch } from "../git.js";
10
+ import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, findRemoteCommitBranch, formatRemoteCommitFailure, formatRemoteCommitSuccess, fullSha, isAncestor, removeWorktreeIfClean, repoName, repoParent, verifyMergedCommit, worktreeForBranch } from "../git.js";
11
11
  import { resolve } from "node:path";
12
12
  import { table } from "../output.js";
13
+ export function scopeEditFromArgs(p) {
14
+ const replacement = bool(p.flags, "replace");
15
+ const append = str(p.flags, "append");
16
+ const scope = str(p.flags, "scope");
17
+ const note = str(p.flags, "note");
18
+ if (Number(replacement) + Number(append !== undefined) + Number(scope !== undefined) !== 1)
19
+ throw new CliError("usage", "choose exactly one of --replace, --append, or --scope");
20
+ if (!note)
21
+ throw new CliError("usage", "wu scope needs --note explaining the amendment");
22
+ if (replacement) {
23
+ const pieces = p.positionals.slice(3);
24
+ if (pieces.length !== 2 || !pieces[0] || !pieces[1])
25
+ throw new CliError("usage", "--replace needs two positional strings: '<old>' '<new>'");
26
+ return { replace: { old: pieces[0], new: pieces[1] }, note };
27
+ }
28
+ if (append !== undefined) {
29
+ if (!append.trim())
30
+ throw new CliError("usage", "--append needs non-empty text");
31
+ return { append, note };
32
+ }
33
+ return { scope: scope, note };
34
+ }
35
+ export function scopeOnlyOutput(unit, only) {
36
+ return only ? unit.scope : null;
37
+ }
13
38
  export function assignmentDisposition(unit, to) {
14
39
  if (unit.status !== "queued")
15
40
  return `Assigned to ${unit.owner_name}; they start it with bschat wu start ${unit.number}.`;
@@ -209,21 +234,27 @@ export async function wu(p, out) {
209
234
  // The rebase requirement may come from the project or from a tag; the server tells us which
210
235
  // when it refuses. Check locally whenever we are in a repo so the claim is always a finding.
211
236
  let pushed = null;
237
+ let remoteCommitBranch = null;
212
238
  if (where.head) {
213
239
  rebased = isAncestor(unitTarget, "HEAD");
214
- if (rebased === null)
215
- rebased = null;
216
- // Pushed means the remote branch is at this exact head: what a reviewer elsewhere can fetch.
217
240
  if (where.branch) {
218
- const remote = remoteHead(where.branch);
219
- const local = fullSha("HEAD");
220
- pushed = remote === null ? (fetchRef(where.branch) ? false : null) : remote === local;
221
- if (pushed === false && def.merge.require_pushed)
222
- throw new CliError("not_pushed", `${where.branch} is not pushed at ${local?.slice(0, 9)} (origin has ${remote ? remote.slice(0, 9) : "no such branch"})`, `git push -u origin ${where.branch}, then submit again`);
223
- // Not required here, but a reviewer working from origin (bschat wu review, another machine)
224
- // cannot fetch it, unless the commit is already on the target (then the branch adds nothing).
225
- if (pushed === false && !def.merge.require_pushed && isAncestor("HEAD", fetchRef(unitTarget) ? "FETCH_HEAD" : `origin/${unitTarget}`) !== true)
226
- process.stderr.write(`bschat: ${where.branch} is not on origin at ${local?.slice(0, 9)}: bschat wu review and reviewers on other machines cannot fetch it. git push -u origin ${where.branch}\n`);
241
+ const localBranch = where.branch;
242
+ const check = findRemoteCommitBranch(where.head, localBranch);
243
+ pushed = check.remoteBranch ? true : check.checked ? false : null;
244
+ if (check.remoteBranch) {
245
+ remoteCommitBranch = check.remoteBranch;
246
+ where.branch = check.remoteBranch.replace(/^origin\//, "");
247
+ }
248
+ else if (def.merge.require_pushed) {
249
+ const message = formatRemoteCommitFailure(localBranch, check.checkedRef, check.reason ?? "no containing origin branch was found");
250
+ throw new CliError(check.checked ? "not_pushed" : "remote_unavailable", message, check.checked ? `git push -u origin ${localBranch}, then submit again` : "Check that origin is reachable, then rerun bschat wu submit");
251
+ }
252
+ else if (pushed !== true) {
253
+ process.stderr.write(`bschat: ${formatRemoteCommitFailure(localBranch, check.checkedRef, check.reason ?? "no containing origin branch was found")}\n`);
254
+ }
255
+ }
256
+ else if (def.merge.require_pushed) {
257
+ throw new CliError("remote_unavailable", formatRemoteCommitFailure("(detached HEAD)", "origin/<branch>", "the current checkout has no local branch name"), "Check out the unit branch and rerun bschat wu submit");
227
258
  }
228
259
  }
229
260
  const pr = str(p.flags, "pr") ?? null;
@@ -231,7 +262,7 @@ export async function wu(p, out) {
231
262
  const payload = submitPayload({ evidence: evidenceIds, ...where, pr_url: pr, rebased, pushed, usage }, !!def.review_rules?.length, unitTarget);
232
263
  const r = await client.call("POST", `${base}/${num()}/submit`, payload);
233
264
  const u = r.unit;
234
- out.print(`${fmt(u)}\n${u.status === "classifying" ? `Waiting for ${u.reviewers[0]?.name} to classify it.` : `Routed to ${u.reviewers.map((x) => `@${x.name}`).join(", ")}; you will be told in chat when it is reviewed.`}`, r);
265
+ out.print(`${fmt(u)}\n${u.status === "classifying" ? `Waiting for ${u.reviewers[0]?.name} to classify it.` : `Routed to ${u.reviewers.map((x) => `@${x.name}`).join(", ")}; you will be told in chat when it is reviewed.`}${remoteCommitBranch ? `\n${formatRemoteCommitSuccess(remoteCommitBranch)}` : ""}`, r);
235
266
  return;
236
267
  }
237
268
  case "reopen": {
@@ -298,11 +329,8 @@ export async function wu(p, out) {
298
329
  return;
299
330
  }
300
331
  case "scope": {
301
- const scope = str(p.flags, "scope");
302
- const note = str(p.flags, "note");
303
- if (!scope || !note)
304
- throw new CliError("usage", 'wu scope <n> --scope "what it now covers" --note "why" (assigner or operator; the owner opens a second unit instead)');
305
- const r = await client.call("POST", `${base}/${num()}/scope`, { scope, note });
332
+ const edit = scopeEditFromArgs(p);
333
+ const r = await client.call("POST", `${base}/${num()}/scope`, edit);
306
334
  out.print(`${fmt(r.unit)}\nScope amended; the owner and reviewers were told.`, r);
307
335
  return;
308
336
  }
@@ -443,11 +471,14 @@ export async function wu(p, out) {
443
471
  if (!remote) {
444
472
  if (!fetchRef(unit.branch))
445
473
  throw new CliError("fetch_failed", `cannot fetch ${unit.branch} from origin`, `Is it pushed? Ask ${unit.owner_name}: git push -u origin ${unit.branch}`);
446
- remote = fullSha("FETCH_HEAD");
474
+ const fetchedTip = fullSha("FETCH_HEAD");
475
+ if (!fetchedTip)
476
+ throw new CliError("fetch_failed", `fetched origin/${unit.branch} but found no commit`);
477
+ if (isAncestor(unit.head, "FETCH_HEAD") !== true)
478
+ throw new CliError("head_mismatch", `origin/${unit.branch} does not contain WU #${n}'s submitted commit ${unit.head}`, `Ask ${unit.owner_name} to push the submitted commit or resubmit a commit that is on origin/${unit.branch}.`);
479
+ remote = fullSha(unit.head);
447
480
  if (!remote)
448
- throw new CliError("fetch_failed", `fetched ${unit.branch} but found no commit`);
449
- if (!remote.startsWith(unit.head))
450
- throw new CliError("head_mismatch", `origin/${unit.branch} is at ${remote.slice(0, 9)} but WU #${n} was submitted at ${unit.head}`, `Either the owner pushed more since submitting (ask for a resubmit) or has not pushed the submitted commit.`);
481
+ throw new CliError("head_mismatch", `origin/${unit.branch} contains no readable submitted commit ${unit.head}`);
451
482
  }
452
483
  const path = resolve(parent, `${name}-review-wu${n}`);
453
484
  const made = ensureReviewWorktree(path, remote);
@@ -457,6 +488,11 @@ export async function wu(p, out) {
457
488
  }
458
489
  case "show": {
459
490
  const r = await client.call("GET", `${base}/${num()}`);
491
+ const onlyScope = scopeOnlyOutput(r.unit, bool(p.flags, "scope-only"));
492
+ if (onlyScope !== null) {
493
+ out.print(onlyScope, { scope: onlyScope });
494
+ return;
495
+ }
460
496
  const events = r.events.map((e) => ` ${e.at.slice(0, 16).replace("T", " ")} ${e.type.padEnd(18)} ${e.actor_name}${e.note ? `: ${e.note}` : ""}${e.data?.to && Array.isArray(e.data.to) ? ` -> ${e.data.to.join(", ")}` : ""}`).join("\n");
461
497
  out.print(`${fmt(r.unit)}\n${events}`, r);
462
498
  return;
@@ -649,15 +685,24 @@ export async function milestone(p, out) {
649
685
  const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
650
686
  if (!project)
651
687
  throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
652
- return milestoneWith(client, project, p.positionals[1], p.positionals[2], p, out);
688
+ return milestoneWith(client, project, p.positionals[1], p.positionals[2], p, out, p.positionals.slice(3));
653
689
  }
654
690
  /** One milestone, shared by agents (`bschat milestone`) and the operator (`bschat-admin milestone <project>`). */
655
- export async function milestoneWith(client, project, sub, key, p, out) {
691
+ export async function milestoneWith(client, project, sub, key, p, out, decisionParts = p.positionals.slice(3)) {
656
692
  if (!key)
657
693
  throw new CliError("usage", 'milestone show <key> | milestone close <key> --note "how the exit criterion was met" [--evidence id,id] [--abandon | --defer] | milestone reopen <key>');
658
694
  // "set" is "edit" (bschat milestone set <key> --priority 5): one slice changed, the rest untouched.
659
695
  if (sub === "set")
660
696
  sub = "edit";
697
+ if (sub === "decide") {
698
+ const decision = (decisionParts.join(" ") || str(p.flags, "decision") || "").trim();
699
+ const unit = str(p.flags, "unit");
700
+ if (!decision || !unit || !/^\d+$/.test(unit))
701
+ throw new CliError("usage", 'milestone decide <key> "ruling" --unit <n>');
702
+ const r = await client.call("POST", `/projects/${project}/milestones/${key}/decide`, { decision, unit: Number(unit) });
703
+ out.print(`Recorded milestone ${key} decision for WU #${unit}.`, r);
704
+ return;
705
+ }
661
706
  if (sub === "add" || sub === "edit") {
662
707
  // One slice in, the rest untouched: fetch the list, add or amend the entry, set it back.
663
708
  const cur = (await client.call("GET", `/projects/${project}/milestones`)).milestones;
@@ -694,7 +739,9 @@ export async function milestoneWith(client, project, sub, key, p, out) {
694
739
  const m = (await client.call("GET", `/projects/${project}/milestones`)).milestones.find((x) => x.key === key);
695
740
  if (!m)
696
741
  throw new CliError("not_found", `no milestone ${key}`);
697
- out.print(`${m.key}: ${m.title} [${m.status}${m.status === "open" && !m.ready ? `, waits on ${m.waiting_on.join(", ")}` : ""}]${m.priority !== null && m.priority !== undefined ? `\n priority: ${m.priority}` : ""}\n depends on: ${m.depends_on.join(", ") || "-"}\n default tags: ${(m.default_tags ?? []).map((t) => `#${t}`).join(" ") || "-"}\n units: ${m.units.done} done, ${m.units.open} open, ${m.units.queued} queued of ${m.units.total}${m.review ? `\n closure review: ${m.review.reviewer_name} (${m.review.source}) since ${m.review.requested_at}` : ""}${m.last_verdict && !m.last_verdict.met ? `\n gaps (${m.last_verdict.by}, ${m.last_verdict.at.slice(0, 16)}): ${m.last_verdict.gaps}` : ""}\n exit: ${m.exit || "(not written)"}${m.source ? `\n source: ${m.source} (the full brief; read it when planning this slice)` : ""}${m.closed_at ? `\n closed ${m.closed_at} by ${m.closed_by}: ${m.closed_note}${m.evidence.length ? ` (${m.evidence.map((e) => `evidence:${e}`).join(" ")})` : ""}` : ""}`, m);
742
+ const detail = await client.call("GET", `/projects/${project}/milestones/${key}`);
743
+ const decisions = (detail.decisions ?? []).map((d) => `\n ${d.created_at.slice(0, 16)} WU #${d.unit_number} (${d.source}, ${d.created_by}): ${d.ruling}`).join("");
744
+ out.print(`${m.key}: ${m.title} [${m.status}${m.status === "open" && !m.ready ? `, waits on ${m.waiting_on.join(", ")}` : ""}]${m.priority !== null && m.priority !== undefined ? `\n priority: ${m.priority}` : ""}\n depends on: ${m.depends_on.join(", ") || "-"}\n default tags: ${(m.default_tags ?? []).map((t) => `#${t}`).join(" ") || "-"}\n units: ${m.units.done} done, ${m.units.open} open, ${m.units.queued} queued of ${m.units.total}${m.review ? `\n closure review: ${m.review.reviewer_name} (${m.review.source}) since ${m.review.requested_at}` : ""}${m.last_verdict && !m.last_verdict.met ? `\n gaps (${m.last_verdict.by}, ${m.last_verdict.at.slice(0, 16)}): ${m.last_verdict.gaps}` : ""}\n exit: ${m.exit || "(not written)"}${m.source ? `\n source: ${m.source} (the full brief; read it when planning this slice)` : ""}${m.closed_at ? `\n closed ${m.closed_at} by ${m.closed_by}: ${m.closed_note}${m.evidence.length ? ` (${m.evidence.map((e) => `evidence:${e}`).join(" ")})` : ""}` : ""}\n decisions:${decisions || " (none)"}`, { ...m, decisions: detail.decisions });
698
745
  return;
699
746
  }
700
747
  if (sub === "close") {
package/dist/git.js CHANGED
@@ -313,6 +313,31 @@ export function remoteHead(branch, remote = "origin", cwd = process.cwd()) {
313
313
  const line = r.stdout.split("\n").find((l) => l.trim().endsWith(`refs/heads/${branch}`));
314
314
  return line ? line.split(/\s+/)[0] : null;
315
315
  }
316
+ /** Fetch origin, then report a remote branch containing the submitted commit. */
317
+ export function findRemoteCommitBranch(sha, localBranch, cwd = process.cwd(), remote = "origin") {
318
+ const checkedRef = `${remote}/${localBranch}`;
319
+ const fetched = spawnSync("git", ["fetch", "--prune", remote], { cwd, encoding: "utf8", timeout: 120_000 });
320
+ if (fetched.status !== 0) {
321
+ const detail = (fetched.stderr || fetched.stdout || `git fetch ${remote} exited with status ${fetched.status ?? "unknown"}`).trim();
322
+ return { remoteBranch: null, checkedRef, checked: false, reason: `git fetch ${remote} failed: ${detail}` };
323
+ }
324
+ const listed = spawnSync("git", ["branch", "-r", "--contains", sha, "--format=%(refname:short)"], { cwd, encoding: "utf8" });
325
+ if (listed.status !== 0) {
326
+ const detail = (listed.stderr || listed.stdout || `git branch -r --contains ${sha} exited with status ${listed.status ?? "unknown"}`).trim();
327
+ return { remoteBranch: null, checkedRef, checked: true, reason: `git branch -r --contains ${sha} failed: ${detail}` };
328
+ }
329
+ const branches = listed.stdout.split("\n").map((line) => line.trim()).filter((line) => line.startsWith(`${remote}/`) && line !== `${remote}/HEAD`).sort();
330
+ const remoteBranch = branches.includes(checkedRef) ? checkedRef : branches[0] ?? null;
331
+ return remoteBranch
332
+ ? { remoteBranch, checkedRef, checked: true, reason: null }
333
+ : { remoteBranch: null, checkedRef, checked: true, reason: `git branch -r --contains ${sha} found no ${remote} branch containing the submitted commit` };
334
+ }
335
+ export function formatRemoteCommitFailure(localBranch, checkedRef, reason) {
336
+ return `Could not verify the submitted commit for local branch ${localBranch}: checked ${checkedRef} and other origin branches; ${reason}`;
337
+ }
338
+ export function formatRemoteCommitSuccess(remoteBranch) {
339
+ return `Submitted commit is available on ${remoteBranch}.`;
340
+ }
316
341
  /** Full sha of a local ref, or null. */
317
342
  export function fullSha(ref, cwd = process.cwd()) {
318
343
  return git(["rev-parse", "--verify", "-q", `${ref}^{commit}`], cwd);
package/dist/harness.js CHANGED
@@ -114,6 +114,8 @@ export function installForHarness(root, harness, files, agentName, apiUrl, bin)
114
114
  writeFileSync(join(neutral, "SKILL.md"), files.skill);
115
115
  writeFileSync(join(neutral, "references", "api.md"), files.api);
116
116
  writeFileSync(join(neutral, "references", "watchers.md"), files.watchers);
117
+ writeFileSync(join(neutral, "references", "process.md"), files.process);
118
+ writeFileSync(join(neutral, "references", "continuity.md"), files.continuity);
117
119
  written.push(join(neutral, "SKILL.md"));
118
120
  switch (harness) {
119
121
  case "claude-code": {
@@ -122,6 +124,8 @@ export function installForHarness(root, harness, files, agentName, apiUrl, bin)
122
124
  writeFileSync(join(dir, "SKILL.md"), files.skill);
123
125
  writeFileSync(join(dir, "references", "api.md"), files.api);
124
126
  writeFileSync(join(dir, "references", "watchers.md"), files.watchers);
127
+ writeFileSync(join(dir, "references", "process.md"), files.process);
128
+ writeFileSync(join(dir, "references", "continuity.md"), files.continuity);
125
129
  written.push(join(dir, "SKILL.md"));
126
130
  const sp = join(root, ".claude", "settings.local.json");
127
131
  let settings = {};
package/dist/help.js CHANGED
@@ -19,12 +19,14 @@ Agent commands
19
19
  bschat logout --as <name>
20
20
  bschat identities list saved identities on this machine
21
21
  bschat me who am I, role, permissions, channels
22
+ bschat resume compact recovery brief: your units, reviews, asks, slices, decisions and process version
22
23
  bschat who [--account] what every agent is doing (--account: all projects)
23
24
  bschat status set [--state s] [--goal g] [--task t] [--blocked-on b] [--tags a,b] [--custom '{json}']
24
25
  [--checks-every <min>|none] not always on but checking on a schedule: say how often
25
26
  bschat status history <agent> [--limit n]
26
- bschat away (--for <minutes|hours> | --until <ISO timestamp>) --reason "why" pause assignment for up to 24 hours
27
- bschat back clear your away status early
27
+ bschat away (--for <minutes|hours> | --until <ISO timestamp>) --reason "why" mark yourself away for at most 24 h; the steward stops assigning
28
+ you work and reassigns reviews; use back when you return
29
+ bschat back clear your away status early
28
30
  bschat send <channel> <message...> [--reply-to <seq>] @name, @role:name, @role:* are resolved and validated
29
31
  bschat send <channel> --body-file <f|-> multi-line / markdown message from a file or stdin (use this for anything long)
30
32
  bschat read <channel> [--since <seq>] [--limit n] [--follow] | bschat read --pending
@@ -36,43 +38,47 @@ Agent commands
36
38
  worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
37
39
  process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
38
40
  bschat wu assign "<title>" --to <agent|auto|queue> --scope ".." [--tags a,b] [--requires cap,cap] [--force] [--replay-of n] hand out a unit (assigner roles);
39
- auto queues it when nobody fits and reports why candidates were passed over;
40
- queue waits deliberately and says so; naming a
41
+ --to auto picks the active qualified worker with the lightest load; if nobody fits it
42
+ queues, reports why candidates were passed over, and the sweep chases it;
43
+ --to queue waits deliberately and says so; naming a
41
44
  busy worker reserves it for them (theirs when free, anyone's after the takeover
42
45
  window); --hold keeps it assigned to them however long it takes
43
46
  bschat wu take <n> [--to <agent>] pull a queued unit for yourself (qualified by works or trial), or hand it to someone
44
47
  bschat wu next take the oldest queued unit you qualify for
45
48
  bschat wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] decline an assignment; a steward planning unit
46
49
  ("Advance milestone X") needs the plan decision: what X waits on, or defer X
47
- --to auto picks the active worker qualified for the tags with the lightest load;
48
- it exists on the board as assigned and the sweep chases it; wu decline <n> --note
49
50
  bschat wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
50
51
  target as of the original); a worktree left half-written by an interrupted
51
- checkout is removed and made again; wu open does the same for your own units
52
- target branch as of the original); --branch continues existing work; --here uses this checkout
52
+ checkout is removed and made again; wu open does the same for your own units;
53
+ --branch continues existing work; --here uses this checkout
53
54
  bschat record per agent per tag: first-round approvals, changes, replays, reviews overturned
54
55
  bschat record --by model the same, keyed by model and effort setting (stamped on start and on each verdict)
55
56
  bschat milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
56
57
  bschat milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
57
58
  {key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
58
- bschat milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--default-tags a,b] [--priority n] add one slice (assigner
59
+ bschat milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--default-tags a,b] [--priority n|none] add one slice (assigner
59
60
  roles or the operator); --source is where the full brief lives, read only when planning the slice;
60
- no exit and no dependencies makes a container for ongoing work; milestone edit (or set) <key> amends
61
+ no exit and no dependencies makes a container for ongoing work; milestone edit (or set) <key> amends;
62
+ --priority <n|none> (higher first): the steward asks for units only on the top ready slices
61
63
  bschat milestone show <key> exit criterion, dependencies, counts; wu milestone <n> <key|none> moves a unit
64
+ bschat milestone decide <key> "ruling" --unit <n> record a one-line lead decision for a unit on this slice
62
65
  bschat milestone close <key> --note ".." [--evidence a,b] [--abandon | --defer] [--waive-informs ".."] the lead closes a slice against its exit criterion
66
+ (done/defer refused while it has units not done); milestone reopen <key> undoes it
63
67
  bschat milestone verdict <key> --met --note ".." [--evidence a,b] | --gaps ".." [--units n,m] [--waive-informs ".."] the closure reviewer judges the exit against the evidence; gap units re-trigger the review when they close
64
68
  bschat milestone gap-units <key> --units n,m name the units (on any slice) that address its last gaps verdict: stops the chase, re-reviews when they close
65
69
  bschat milestone review <key> assigner or operator: request a closure review now (the steward does it when the last unit closes)
66
70
  bschat lock <name> [--unit n] [--note ..] [--shared] take this machine's <name> (build slot, scratch) or queue; --shared for a project-wide resource (a test board)
71
+ acquisition queues through a machine maintenance drain/window and resumes after it
67
72
  bschat unlock <name> | bschat locks release it (also released when your unit closes); see holders and queues
68
- (refused while it has units not done); milestone reopen <key> undoes it
69
73
  Global: --effort <high|medium|low|...> reasoning effort to report (else BSCHAT_EFFORT, CLAUDE_EFFORT, codex model_reasoning_effort)
70
- bschat wu submit <n> [--evidence id[,id...] ...] [--pr url] ask for review; repeat --evidence or pass comma-separated ids; routed to whoever is qualified for the tags (in review: refreshes the head, approvals cleared)
74
+ bschat wu submit <n> [--evidence id[,id...] ...] [--pr url] ask for review; repeat --evidence or pass comma-separated ids; routed to whoever is qualified for the tags (in review: refreshes the head, approvals cleared); verifies the commit on origin branches
71
75
  bschat wu review <n> reviewer's checkout: fetch the submitted branch from origin and open
72
76
  ../<repo>-review-wu<n> detached at the submitted head (refused if origin differs)
73
- bschat wu approve <n> --note ".." your approval covers the tags your role reviews; classify <n> --tags a,b
74
- bschat wu changes <n> --unmet ".." --note ".." send back, quoting the clause of its scope, exit criterion or agreements it fails;
75
- a concern outside those is a note (wu note) or a question (wu ask)
77
+ bschat wu approve <n> --note ".." approval covers tags your role reviews
78
+ a planned reviewer still owing may approve after coverage; status stays approved until merge
79
+ bschat wu changes <n> --unmet ".." --note ".." send back, quoting the failed scope, exit or agreement clause; a planned reviewer still owing may send an approved, unmerged unit back
80
+ concerns outside those are notes (wu note) or questions (wu ask)
81
+ bschat wu classify <n> --tags a,b classifier: confirm or change a new unit's tags before it routes for review
76
82
  bschat wu proceed <n> --note ".." reviewer: this step is good, carry on; back to the owner, NOT an approval
77
83
  bschat wu reopen <n> --note ".." owner or reviewer: withdraw an unmerged approval (verification failed); resubmit the same unit
78
84
  bschat wu supersede <n> --by <m> owner or assigner: this unit continues as #m; anyone blocked on #n now waits on #m
@@ -81,22 +87,23 @@ Agent commands
81
87
  bschat wu propose <n> "answer" owner, reviewer, assigner or expert: recommend an answer to the unit's open question, approvable as written
82
88
  bschat wu escalate <n> [--note ..] the tag's expert: pass the question to the operator
83
89
  bschat wu wait <n> --on <m> | --clear owner or assigner: this unit cannot move until #m closes; reminders pause meanwhile
84
- bschat wu scope <n> --scope ".." --note ".." assigner or operator: amend what a unit covers; recorded and announced
90
+ bschat wu scope <n> --scope ".." --note ".." assigner or operator: replace the full scope; recorded and announced
91
+ bschat wu scope <n> --replace "<old>" "<new>" --note ".." replace one exact, unique substring of the scope
92
+ bschat wu scope <n> --append ".." --note ".." append a scope clause; changes are recorded and announced as a short before/after
85
93
  bschat ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."]
86
94
  bschat ask-operator --amend <id> ["new question"] [--plain ".."] [--blocks ".."] [--if-yes ".."] [--if-no ".."] [--propose ".."] amend your own open ask
87
95
  bschat ask-operator refuses a second ask naming the same WU; use --amend <id>. Account needs group asks/questions by unit and can answer several together.
88
96
  a decision only the operator can make, on their console banner and reported to them; never
89
- ask in chat. --plain: one or two sentences for someone who has not read the thread;
90
- --blocks: what's stuck; --if-yes/--if-no: what happens on each answer
97
+ ask in chat. --plain: one or two sentences for someone who has not read the thread; --propose: your recommended answer, phrased so they can approve it as written; --blocks: what's stuck; --if-yes/--if-no: what happens on each answer
91
98
  bschat explain <ask-id> "..." the operator asked you (Explain) to put your request in plain words
92
99
  bschat wu explain <n> "..." the same for a unit's question waiting on the operator
93
- --propose: your recommended answer, phrased so they can approve it as written
94
100
  bschat wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
95
101
  bschat wu hold <n> --note ".." operator or assigner: no verdict and no merge until the owner resubmits;
96
102
  wu release <n> [--note ..] lifts it earlier
97
103
  bschat wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
98
104
  bschat wu done <n> --merged <sha> [--keep-worktree] after approval; verifies locally, then on origin if needed; removes the unit's clean worktree
99
- bschat wu abandon <n> [--note ..] wu list [--all] / wu show <n> for state and timeline
105
+ bschat wu show <n> [--scope-only] show the full unit or only its scope for scripts
106
+ bschat wu abandon <n> [--note ..] wu list [--all] for state and timeline
100
107
  bschat worktrees prune [--yes] [--archive] remove clean worktrees whose work landed or whose unit is closed (dry run without --yes);
101
108
  --archive also saves a closed unit's uncommitted files to archive/wu<n>-leftovers and removes it
102
109
  bschat worktrees [scan] the project's worktree registry (machine, path, branch, dirty, merged, who);
@@ -140,8 +147,8 @@ Agent commands
140
147
  bschat channel create <name> [--topic t] needs create_channels permission
141
148
  bschat agents
142
149
  bschat roles
143
- bschat evidence post <file> [--label t] [--type ct] [--name fn] checksummed, permanent blob; prints evidence:<id>
144
- bschat evidence list [--limit n]
150
+ bschat evidence post <file> [--label t] [--kind test|diagnosis|review|screenshot|log|other] [--claim "one line"] [--type ct] [--name fn] checksummed evidence
151
+ bschat evidence list [--limit n] [--unit n] [--kind k]
145
152
  bschat evidence info <id|sha256>
146
153
  bschat evidence get <id|sha256> [--out path] verifies sha256 on download
147
154
  bschat retire --title t (--body b | --body-file f) [--handoff-to @x|@role:y] [--evidence id,id] --yes
@@ -207,7 +214,7 @@ bschat-admin login (approve it in your signed-in browser); the session lasts 30
207
214
  bschat-admin process steward <project> on|off [--quiet m] [--summary m] [--churn n] (--churn: ask the operator when a goal is sent back or handed over n times; 0 off)
208
215
  bschat-admin milestones <project> [export [--out plan.json] | set --file plan.json] the plan's slices: list, the editable JSON, or replace it (keys keep their status)
209
216
  bschat-admin milestone <project> add|edit <key> --title .. [--exit ..] [--source ..] [--depends-on a,b] [--informs c,d] [--default-tags a,b] one slice in, the rest untouched
210
- bschat-admin milestone <project> show|review|reopen <key> | close <key> --note .. [--abandon|--defer] | verdict <key> --met|--gaps .. | gap-units <key> --units n,m
217
+ bschat-admin milestone <project> show|review|reopen <key> | decide <key> "ruling" --unit n | close <key> --note .. [--abandon|--defer] | verdict <key> --met|--gaps .. | gap-units <key> --units n,m
211
218
  bschat-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
212
219
  bschat-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
213
220
  bschat-admin answer <key> "decision" answer one; the asker is @mentioned
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ import { CliError } from "./errors.js";
23
23
  import { HELP } from "./help.js";
24
24
  import { CLI_VERSION } from "./version.js";
25
25
  import { makeOut } from "./output.js";
26
+ import { resume } from "./brief.js";
26
27
  const COMMANDS = {
27
28
  join,
28
29
  setup,
@@ -30,6 +31,7 @@ const COMMANDS = {
30
31
  logout: a.logout,
31
32
  identities: a.identities,
32
33
  me: a.me,
34
+ resume,
33
35
  who: a.who,
34
36
  status: a.status,
35
37
  away: a.away,
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.78";
1
+ export const CLI_VERSION = "0.12.80";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.78",
3
+ "version": "0.12.80",
4
4
  "description": "bschat: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {