Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

feat(resume): the coordinator sees its unread shouts first [I1,A9]

Corey Olson98a2cd37ea30
diff --git a/docs/api.md b/docs/api.md
index 75ddc138..b8fa1b91 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -35,6 +35,8 @@ The single recommended action uses the first matching rule: review wait with few
The coordinator's `resume` ends with one `flow:` line if the measured review-wait average is strictly greater than **60 minutes**, or the oldest currently unreviewed submission is strictly older than **180 minutes**. Exact boundaries do not trip. Both thresholds share one line if both trip. The line gives the tripped threshold's numbers, the measured bottleneck stage, its share and total cycle minutes, and the same recommended action as `stats`. It does not replace a measured build, review or merge bottleneck with review wait. Without a fully measured cycle, a trip still names its threshold and waiting item, followed by **bottleneck: not measured yet**, with no invented stage or action. A healthy or unmeasured board with no trip adds no line. Agent resumes do not add this line. Coordinator resume JSON includes the same `flow` observation as stats.
+The coordinator's `resume` opens, after its header line, with its inbox: `inbox: <n> unread shouts, <n> open decisions for you`, then the newest three unread shouts by id, sender, age and first line, then `<n> more; read them all with pullboard inbox` when there are more. Only shouts to the coordinator, its lane or all count. While shouts are unread its `next:` reads `read your <n> unread shouts first: pullboard inbox; then ...`. Resume marks nothing read; `inbox` does. Coordinator resume JSON carries the same as `inbox: {unread, decisions, newest: [{id, from, at, text}], more, read}`.
+
For example: `flow: review wait average 61 min (1 measured; > 60 min); bottleneck: build (66.67% of 300 measured cycle min); next: add a builder when open work is available`. An unmeasured trip reads `flow: unreviewed #1 waiting 181 min (> 180 min); bottleneck: not measured yet`.
`firstEventAt` and `lastEventAt` are the first and latest dates in the selected window, or `null` when it is empty. `since` is the inclusive boundary as an ISO UTC timestamp, or `null` for the full history. Dates accept `YYYY-MM-DD` or an ISO UTC timestamp ending in `Z`; invalid dates return `BAD_SINCE` with repair guidance.
diff --git a/src/cli.js b/src/cli.js
index 7c289e1f..b55d8107 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -61,6 +61,7 @@ import {
} from './spec.js';
import { bundledBlueprints, planBlueprint, readBlueprint, saveBlueprint } from './blueprints.js';
import { briefFiles } from './brief.js';
+import { coordinatorInbox, coordinatorInboxLines, inboxFirst } from './resume.js';
import { checkBaseline, prepareCheckBaseline, sayCheckBaseline } from './check-baseline.js';
import { retryCheckBaselines, startCheckBaseline } from './check-baseline-worker.js';
import { compareMainFailures, mainRedMessage, mainRedReworkItems } from './main-red.js';
@@ -1300,6 +1301,7 @@ function resumeHere(io) {
holds: store.laneHolds(board),
unread: store.unreadCount(board, me.id),
newest: store.peekShouts(board, me.id, 1),
+ ...(me.id === COORDINATOR ? { inbox: coordinatorInbox(board, me.id, decisions.openDecisions ?? store.openDecisions(board, COORDINATOR)) } : {}),
agents: store.listAgents(board),
viewOpened: viewSetupComplete(ctx, board),
};
@@ -1326,6 +1328,7 @@ function resumeHere(io) {
for (const problem of card.hookProblems) say(`${problem.message}; ${problem.next}`);
const plural = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;
say(`resume: ${me.displayName}${me.family ? ` [family ${me.family}]` : ''}, ${me.lane} lane${isMain ? ', the main checkout' : ''}, at ${root}`);
+ if (card.inbox) for (const line of coordinatorInboxLines(card.inbox, name, (at) => span(ctx, at), firstLine)) say(line);
card.setup = boardSetup(ctx, card, setupScope);
if (card.setup) {
say(`Setting up: step ${card.setup.step} of 5`);
@@ -1393,7 +1396,7 @@ function resumeHere(io) {
} else if (card.hold) {
say(`the ${me.lane} lane is held by ${name(card.hold.hold_by)}: ${card.hold.hold_reason}`);
}
- if (card.unread) say(`${plural(card.unread, 'unread shout')}; newest from ${name(card.newest[0].shout_from)}: ${firstLine(card.newest[0].shout_text)} (pullboard inbox reads them)`);
+ if (card.unread && !card.inbox) say(`${plural(card.unread, 'unread shout')}; newest from ${name(card.newest[0].shout_from)}: ${firstLine(card.newest[0].shout_text)} (pullboard inbox reads them)`);
const inLane = card.open.filter((item) => item.item_lane === me.lane);
const isVerified = (id) => card.all.find((other) => other.item_id === Number(id))?.item_status === 'verified';
const ready = inLane.filter((item) => !item.item_after || item.item_after.split(',').every(isVerified)).length;
@@ -1407,6 +1410,7 @@ function resumeHere(io) {
else if (card.awaiting.length) next = 'pullboard next --wait 9 (minutes); a rejected item comes back to your lane';
else next = 'nothing open in your lane; pullboard next --verify names work you can check';
if (card.setup) next = card.setup.agentNext ?? card.setup.command;
+ if (card.inbox) next = inboxFirst(card.inbox, next);
io.result?.({ ...card, root, dirty, next });
say(`next: ${next}`);
const flowAlert = isMain ? flowAlertLine(card.flow) : null;
diff --git a/src/resume.js b/src/resume.js
new file mode 100644
index 00000000..dbf1c8f4
--- /dev/null
+++ b/src/resume.js
@@ -0,0 +1,68 @@
+/**
+ * What `pullboard resume` tells the coordinator seat about its inbox [I1,A9].
+ *
+ * The blueprint trial found a coordinating agent that never read its inbox in about 17 turns: its
+ * resume buried one unread line near the end, and its next step never named the inbox. So the
+ * coordinator's resume opens with how many shouts and decisions wait for it and the newest few,
+ * and its next step reads them first. Resume only looks: `pullboard inbox` is what marks shouts
+ * read, so a session that starts and stops never swallows a message nobody read.
+ */
+import * as store from './board.js';
+
+/** How many of the newest unread shouts resume names; the rest are a count and a command. */
+export const INBOX_NEWEST = 3;
+
+/** The command that reads every waiting shout and marks it read. */
+const READ_ALL = 'pullboard inbox';
+
+/**
+ * The coordinator's waiting inbox, read without marking anything read: the unread count, the open
+ * decisions addressed to it, and the newest unread shouts, oldest of them first. Only shouts to
+ * the seat, its lane or all count, never another seat's private shouts (the inbox's own rule).
+ *
+ * @param {any} board
+ * @param {string} agentId
+ * @param {{ id: number }[]} openDecisions the open decisions addressed to this seat
+ * @returns {{ unread: number, decisions: number, newest: { id: number, from: string, at: string, text: string }[], more: number, read: string }}
+ */
+export function coordinatorInbox(board, agentId, openDecisions) {
+ const unread = store.unreadCount(board, agentId);
+ const newest = store.peekShouts(board, agentId, INBOX_NEWEST).map((shout) => ({
+ id: shout.shout_id, from: shout.shout_from, at: shout.shout_at, text: shout.shout_text,
+ }));
+ return { unread, decisions: openDecisions.length, newest, more: Math.max(0, unread - newest.length), read: READ_ALL };
+}
+
+/**
+ * The text lines for the coordinator's inbox: one count line, then the newest few by name and
+ * the command that reads them all. Bounded, so a busy board never floods the session start.
+ *
+ * @param {ReturnType<typeof coordinatorInbox>} inbox
+ * @param {(id: string) => string} name display name for an agent id
+ * @param {(at: string) => string} age how long ago a time was
+ * @param {(text: string) => string} firstLine
+ * @returns {string[]}
+ */
+export function coordinatorInboxLines(inbox, name, age, firstLine) {
+ const plural = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;
+ const counts = `${plural(inbox.unread, 'unread shout')}, ${plural(inbox.decisions, 'open decision')} for you`;
+ if (!inbox.unread && !inbox.decisions) return [`inbox: ${counts}`];
+ const lines = [`inbox: ${counts}; read them with ${inbox.read}`];
+ for (const shout of [...inbox.newest].reverse()) {
+ lines.push(` newest #${shout.id} from ${name(shout.from)} (${age(shout.at)} ago): ${firstLine(shout.text)}`);
+ }
+ if (inbox.more) lines.push(` ${inbox.more} more; read them all with ${inbox.read}`);
+ return lines;
+}
+
+/**
+ * The coordinator's next step with a waiting inbox in front of it, so reading comes first.
+ *
+ * @param {ReturnType<typeof coordinatorInbox>} inbox
+ * @param {string} next the step the board names otherwise
+ * @returns {string}
+ */
+export function inboxFirst(inbox, next) {
+ if (!inbox.unread) return next;
+ return `read your ${inbox.unread === 1 ? 'unread shout' : `${inbox.unread} unread shouts`} first: ${inbox.read}; then ${next}`;
+}
diff --git a/test/resume-flow.test.js b/test/resume-flow.test.js
index eaa350c2..11f3e5c4 100644
--- a/test/resume-flow.test.js
+++ b/test/resume-flow.test.js
@@ -8,6 +8,7 @@ import * as store from '../src/board.js';
import { main } from '../src/cli.js';
import { spawn } from 'node:child_process';
import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
+import { RESUME_HOOK } from '../src/init.js';
import { proofStats } from '../src/stats.js';
import { runFixtureChild, runFixtureGit } from './fixture-child.js';
import { takeDefaultViewPort } from './view-port-fixture.js';
@@ -225,7 +226,7 @@ function fixture(t, { wait = null, age = null, reservation = null, otherAge = nu
assert.equal(code, 0, stderr || stdout);
return args.includes('--json') ? JSON.parse(stdout) : stdout.trimEnd();
}
- return { root, web, waiting, run, stats: () => proofStats(board, { now: clock.now().getTime() }) };
+ return { root, web, waiting, run, board, builder, reviewer, stats: () => proofStats(board, { now: clock.now().getTime() }) };
}
/** Require exactly one final line while preserving the ordinary next-step line immediately before it. */
@@ -303,6 +304,74 @@ test('agent resume keeps its next step without a coordinator flow alert [N32,R1,
assert.equal(Object.hasOwn(await box.run(['resume', '--json'], box.web), 'flow'), false);
});
+/** Prove the coordinator's resume counts and names its waiting inbox, privately and read-only. */
+test('resume shows the coordinator its unread shouts [I1,A9]', async t => {
+ const box = fixture(t);
+ const none = await box.run(['resume']);
+ assert.ok(none.split('\n').includes('inbox: 0 unread shouts, 0 open decisions for you'), none);
+ assert.match(none.split('\n').at(-1), /^next: (?!read your)/u, 'nothing waiting puts no inbox step first');
+ assert.deepEqual((await box.run(['resume', '--json'])).inbox,
+ { unread: 0, decisions: 0, newest: [], more: 0, read: 'pullboard inbox' });
+ const say = (from, to, text, decision = false) => store.shout(box.board, { from, to, text, lanes: ['web'], decision });
+ const first = say(box.builder, 'coordinator', 'Builder asks the coordinator something');
+ say(box.builder, box.reviewer, 'Private note for the reviewer alone');
+ say(box.reviewer, 'web', 'A note for the web lane alone');
+ const second = say(box.reviewer, 'coordinator', 'Which lane owns the docs?\nMore detail below.', true);
+ const text = await box.run(['resume']);
+ assert.equal(store.unreadCount(box.board, 'coordinator'), 2, 'resume marks nothing read');
+ const lines = text.split('\n');
+ const at = lines.indexOf('inbox: 2 unread shouts, 1 open decision for you; read them with pullboard inbox');
+ assert.ok(at > 0 && lines[at - 1].startsWith('resume: '), `the count opens the card, after its header:\n${text}`);
+ assert.doesNotMatch(text, /Private note|for the web lane/u, 'another seat\'s private and lane shouts stay out');
+ assert.doesNotMatch(text, /\d+ unread shouts?; newest from/u, 'the old line at the end of the card is not repeated');
+ assert.deepEqual(lines.slice(at + 1, at + 3), [
+ ` newest #${second} from ${box.reviewer} (unknown) (0m ago): Which lane owns the docs?`,
+ ` newest #${first} from ${box.builder} (unknown) (0m ago): Builder asks the coordinator something`,
+ ], text);
+ assert.equal(lines.at(-1), `next: read your 2 unread shouts first: pullboard inbox; then ${none.split('\n').at(-1).slice('next: '.length)}`);
+ const json = await box.run(['resume', '--json']);
+ assert.deepEqual(json.inbox, { unread: 2, decisions: 1, more: 0, read: 'pullboard inbox', newest: [
+ { id: first, from: box.builder, at: '2026-10-10T08:20:00.000Z', text: 'Builder asks the coordinator something' },
+ { id: second, from: box.reviewer, at: '2026-10-10T08:20:00.000Z', text: 'Which lane owns the docs?\nMore detail below.' },
+ ] });
+ const builderCard = await box.run(['resume', '--json'], box.web);
+ assert.equal(Object.hasOwn(builderCard, 'inbox'), false, 'an agent keeps its own unread line');
+ assert.equal(builderCard.unread, 1, 'the builder sees its lane, never the coordinator or reviewer shouts');
+ assert.equal(builderCard.newest[0].shout_text, 'A note for the web lane alone');
+ for (let n = 0; n < 3; n += 1) say(box.builder, 'all', `Board-wide note ${n}`);
+ const busy = (await box.run(['resume'])).split('\n');
+ const top = busy.findIndex(line => line.startsWith('inbox: '));
+ assert.equal(busy[top], 'inbox: 5 unread shouts, 1 open decision for you; read them with pullboard inbox');
+ assert.deepEqual(busy.slice(top + 1, top + 5).map(line => line.replace(/#\d+ /u, '')), [
+ ` newest from ${box.builder} (unknown) (0m ago): Board-wide note 2`,
+ ` newest from ${box.builder} (unknown) (0m ago): Board-wide note 1`,
+ ` newest from ${box.builder} (unknown) (0m ago): Board-wide note 0`,
+ ' 2 more; read them all with pullboard inbox',
+ ], 'the newest three by name, then the rest as a count and the command');
+ assert.equal(store.inbox(box.board, 'coordinator').length, 5, 'inbox still reads every shout resume showed');
+ const read = await box.run(['resume']);
+ assert.ok(read.split('\n').includes('inbox: 0 unread shouts, 1 open decision for you; read them with pullboard inbox'), read);
+ assert.match(read.split('\n').at(-1), /^next: (?!read your)/u, 'a read inbox no longer goes first');
+});
+
+/** Prove the SessionStart hook prints the same inbox count, since it runs pullboard resume. */
+test('resume shows the coordinator its unread shouts through the SessionStart hook [I1,A9]', t => {
+ const box = releaseFixture(t);
+ const other = join(box.root, 'other-checkout');
+ box.git(box.repo, 'add', '-A');
+ box.git(box.repo, 'commit', '-q', '-m', 'chore: initialize hook inbox fixture [N19]');
+ box.git(box.repo, 'worktree', 'add', '-q', '-b', 'other', other);
+ const lane = Object.keys(JSON.parse(readFileSync(join(box.repo, 'pullboard.json'), 'utf8')).lanes)[0];
+ const joined = box.run(other, 'join', lane, '--model', 'Fixture');
+ assert.equal(joined.status, 0, joined.failure || joined.stderr || joined.stdout);
+ const shouted = box.run(other, 'shout', 'coordinator', 'The hook shows this shout');
+ assert.equal(shouted.status, 0, shouted.failure || shouted.stderr || shouted.stdout);
+ const hook = runFixtureChild('sh', ['-c', RESUME_HOOK], { cwd: box.repo, env: box.env, encoding: 'utf8' });
+ assert.equal(hook.status, 0, hook.failure || hook.stderr || hook.stdout);
+ assert.match(hook.stdout, /^inbox: 1 unread shout, 0 open decisions for you; read them with pullboard inbox$/mu, hook.stdout);
+ assert.match(hook.stdout, /^ {2}newest #\d+ from .+ \(\d+m ago\): The hook shows this shout$/mu, hook.stdout);
+});
+
test('spec draft adds draft rows and resume names them [N32]', t => {
const box = releaseFixture(t, { freshSetup: true });
const initial = JSON.parse(box.run(box.repo, 'resume', '--json').stdout);