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.
JavaScript agentic-codingai-agentsai-governanceautonomous-agentsclaude-codeclicode-reviewcodexcoding-agentsdeveloper-toolsgit-hooksllmlocal-firstmulti-agentsoftware-factoryspec-driven-developmentverificationvibe-coding
Merge remote-tracking branch 'origin/main' into core/469-claude
Corey Olsoncc36500aa62f
diff --cc docs/formats.mdindex f9bb0163,56cc62a3..dfc0bce0--- a/docs/formats.md+++ b/docs/formats.md@@@ -102,7 -102,7 +102,7 @@@ The board file is in the repository's G| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. || `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. || `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |- | `move engine` | `18` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |-| `move engine` | `19` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |++| `move engine` | `20` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |<!-- format-versions:end -->Pullboard 0.6.1 released engine 1. Engine 2 records a fresh explicit-build claim's skipped-review snapshot. Pullboard 0.8.1 released engine 3, including lane-sensitive graft refusals and authenticated relay senders. Engine 4 adds captured background-baseline completions through `completeCheckBaseline`; released engine-3 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Engine 5 requires a one-line reason when releasing a review and gives that reviewer a one-hour cooldown for the current submission. Each sealed move replays under its recorded engine version: engines 1 through 4 retain the original release event and review-reservation behavior. Engine 5 retains support for older moves, including engine-4 baseline completions. Pullboard 0.8.3 released engine 6, adding board-scoped machine credentials and permitting machine execution only for one exact, earlier authenticated phone request, including its payload digest. Engine 7 adds ordered item holds through `holdItem` and `releaseItemHold`; engine-6 clients stop with `ENGINE_VERSION` before interpreting either operation or advancing their replay cursor. Engine 8, shared by the 0.8.5 move changes, retains merged-item exception notes, selects the next review in roadmap order, and adds coordinator-only `reopen` for a submission returned without a verdict; engine-7 clients stop with `ENGINE_VERSION` before interpreting this new operation or advancing their replay cursor. Recorded engines 1 through 7 retain their original tier-first review selection. Engine 8 also adds durable refusal recovery for blocked relay positions; each explicit skip publishes the readable prefix even when another unsupported record follows. Engine 8 also permits coordinator criterion/check edits on a live claim as pending corrections; the holder cannot renew or submit until a refreeze adopts the correction while preserving the claim. Older request receipts retain their recorded engine semantics. Upgrade every linked device before using the new moves. Each release shares one engine bump across its changed moves. Engine 8 also retains declared model labels on registration and records each registered agent move's model snapshot; engines 1 through 7 retain their original registration and event details without these model fields. Pullboard 0.8.8 released engine 9, which allows resubmitting the same rejected commit after a corrected criterion is refrozen, but only when the rejection names a different frozen digest. Engine 8 retains its HEAD_NOT_NEW refusal and prior submit-event detail. Engine-9 submit events add `criterionDigest`, and engine-8 boards replay with the original refusal and event history.@@@ -113,8 -113,8 +113,10 @@@ Engine 11 permits resubmitting the samEngine 12 records declined person row decisions without replacing the exact source text: the row becomes `wont` and the reason stays in the decision record. Engine-11 decline receipts retain their original reason-as-row-text validation and replay outcome. Engine-11 clients refuse engine-12 moves before interpreting them; upgrade linked clients before recording new decline decisions.- Engine 18 lets a decision name the items it changes. An `appendFact`, `answerDecision` or `verify` move may carry `implies`, a list of existing item ids, and an `answerDecision` move may carry `supersedes`, the shout id of an earlier answer. Either makes the move an engine-18 move: an older engine refuses it with `RELAY_MOVE` before changing its board or cursor, and a board replaying an older engine refuses `implies` with `ENGINE_VERSION`. Engine 18 also tells implied items when a decision is superseded: by a fact's `supersedes`, by an answer's `supersedes`, or by the next verdict on the same item. Moves recorded under engines 13 to 17 replay without these notices. Engine numbers 13 to 17 are allocated to other changes; whichever lands later renumbers, keeping every earlier engine's replay unchanged.+ Engine 19 makes a corrected bar record why the old one was wrong. Once an item has ever been claimed, an `editItem` that changes its criterion or check must carry `reason`, the text of what the old bar got wrong; without one it is refused with `BAR_REASON`, naming `--reason`. The edit event then records `reason` and `barCorrection: {fields, reject}`: `fields` lists `criterion` and/or `check`, and `reject` is `{verdict, by, reason, at}` when the item's newest verdict is a reject no earlier correction already explained, or `null`. That reject is counted as caused by the bar. The board derives `barCorrection` from its own rows; a move supplies only `reason`. An edit before any claim needs no reason and records one only if given. `pullboard stats` JSON adds `bars`, keyed by agent: `{corrections, barRejects, buildRejects}`. Corrections and the rejects they explain count to the agent who corrected the bar; any other reject counts as the build's, to the agent who added the item. An `editItem` move carrying `reason` requires engine 19, and older engines refuse it with `RELAY_MOVE` before changing their board or cursor. Moves recorded under engines 18 and earlier replay without the reason rule. Engine numbers 13 to 18 are allocated to other changes; whichever lands later renumbers, keeping every earlier engine's replay unchanged.+++Engine 20 lets a decision name the items it changes. An `appendFact`, `answerDecision` or `verify` move may carry `implies`, a list of existing item ids, and an `answerDecision` move may carry `supersedes`, the shout id of an earlier answer. Either makes the move an engine-20 move: an older engine refuses it with `RELAY_MOVE` before changing its board or cursor, and a board replaying an older engine refuses `implies` with `ENGINE_VERSION`. Engine 20 also tells implied items when a decision is superseded: by a fact's `supersedes`, by an answer's `supersedes`, or by the next verdict on the same item. Moves recorded under engines 19 and earlier replay without these notices. Engine numbers 13 to 18 are allocated to other changes; whichever lands later renumbers, keeping every earlier engine's replay unchanged.+The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.A linked board requires at least engine 3 after issuing any agent token, includingrevoked or expired tokens. Issuing any machine credential raises that board’s minimum to engine 6, including after revocation or expiry. The minimum survives reopening the auth database;@@@ -304,17 -304,17 +306,17 @@@ The `event` table is a SQLite schema ob| `model` | agent | — || `moved` | coordinator | `path` || `add` | item creator | `lane`, `specIds`, `after`, `route` |- | `edit` | editor | `brief`, `route`, `criterion`, `check`, `unfrozen`, optional `after`, optional `pendingRefreeze` |+ | `edit` | editor | `brief`, `route`, `criterion`, `check`, `unfrozen`, optional `after`, optional `pendingRefreeze`, engine-19 `reason`, `barCorrection` || `escalate` | builder | `from`, `to`, `note`, `attempt` || `attempt` | reporting agent | `n`, `seconds`, `result` |- | `fact` | author | `id`, `kind`, `text`, `ref`, `supersedes`, engine-18 `implies`, `decision`, `supersededBy` |-| `fact` | author | `id`, `kind`, `text`, `ref`, `supersedes` |++| `fact` | author | `id`, `kind`, `text`, `ref`, `supersedes`, engine-20 `implies`, `decision`, `supersededBy` || `claim` | builder | `leaseUntil`, `digest` || `renew` | builder | `leaseUntil`, `digest` || `release` | builder | — || `submit` | builder | `commit`, `tree`, `policyCommit`, engine-9 `criterionDigest` || `reserve` | reviewer | `until` |- | `accept` | reviewer | `reason`, `commit`, engine-18 `implies` |- | `reject` | reviewer | `reason`, `commit`, engine-18 `implies` |-| `accept` | reviewer | `reason`, `commit` |-| `reject` | reviewer | `reason`, `commit` |++| `accept` | reviewer | `reason`, `commit`, engine-20 `implies` |++| `reject` | reviewer | `reason`, `commit`, engine-20 `implies` || `reopen` | coordinator | `commit`, `note`, `judgment`, engine-10 `supersedes`, `landingFailure` || `merged` | coordinator | `commit` || `landing_batch` | coordinator | `batch` |@@@ -330,7 -330,7 +332,7 @@@| `guards` | board | `missing`, `changed`, `stale` || `shout` | sender | `shout`, `to`, `decision`, `request`, `answers` || `pass` | coordinator | `shout`, `to`, `decision`, `request`, `answers` |- | `answer` | answerer | `shout`, `to`, `decision`, `request`, `answers`, `outcome`, `channel`, engine-18 `implies`, `supersedes` |-| `answer` | answerer | `shout`, `to`, `decision`, `request`, `answers`, `outcome`, `channel` |++| `answer` | answerer | `shout`, `to`, `decision`, `request`, `answers`, `outcome`, `channel`, engine-20 `implies`, `supersedes` || `row_decision` | person | `record`, `channel` || `row_apply` | coordinator | `events` |<!-- events:end -->diff --cc src/api-moves.jsindex c5617e12,9fb21c1f..c107d3d2--- a/src/api-moves.js+++ b/src/api-moves.js@@@ -7,8 -7,8 +7,8 @@@ const MOVES ='spec-decline': { prefix: ['spec', 'decline'], positions: ['ids'], flags: ['reason'] },'spec-answer': { prefix: ['spec', 'answer'], positions: ['row', 'answer'] },add: { positions: ['lane', 'title'], flags: ['criterion', 'specs', 'parent', 'after', 'brief', 'route', 'check'], booleans: ['wait'], booleans: ['wait'] },- edit: { item: true, flags: ['criterion', 'brief', 'route', 'check'], booleans: ['wait'], booleans: ['wait'] },+ edit: { item: true, flags: ['criterion', 'brief', 'route', 'check', 'reason'], booleans: ['wait'], booleans: ['wait'] },- fact: { item: true, positions: ['kind', 'text'], flags: ['supersedes', 'ref'] },+ fact: { item: true, positions: ['kind', 'text'], flags: ['supersedes', 'ref', 'implies'] },claim: { item: true },release: { item: true, flags: ['note'] },submit: { item: true },diff --cc src/board.jsindex 25a2c00f,090581bb..004f398a--- a/src/board.js+++ b/src/board.js@@@ -15,7 -15,7 +15,8 @@@ import { briefFiles, briefSections } frimport { COORDINATOR } from './config.js';import { ENGINE_VERSION, GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTriggers } from './machine.js';import { Refused } from './refused.js';- import { decisionFields, requestAnswerRefusal, tellAnswerImplications, tellFactImplications, tellVerdictImplications } from './implies.js';+ import { barCorrectionFields } from './bar-corrections.js';++import { factFromEvent, requestAnswerRefusal, tellAnswerImplications, tellFactImplications, tellVerdictImplications } from './implies.js';import { parseSpec } from './spec.js';export const ACCEPT_REASON = 'CRITERION_MET';@@@ -2078,13 -2078,13 +2080,6 @@@ export function factReference(ref)return { path, start, end, commit: commit.toLowerCase() };}--/** Give facts the same stamped identity on CLI, API, export and replica reads [B29,B31]. */--function factFromEvent(event) {-- const detail = JSON.parse(event.event_detail);-- return { id: detail.id, eventId: event.event_id, kind: detail.kind, text: detail.text,- by: event.event_by, at: event.event_at, ref: detail.ref ?? null, supersedes: detail.supersedes ?? null, ...decisionFields(detail) };- by: event.event_by, at: event.event_at, ref: detail.ref ?? null, supersedes: detail.supersedes ?? null };--}--/** Read every move and fact in append order, including superseded facts and full original text [B31,B32]. */export function itemThread(board, id) {itemById(board, id);diff --cc src/cli.jsindex 0a7b9dd4,c82f9c03..2204d84d--- a/src/cli.js+++ b/src/cli.js@@@ -32,10 -32,10 +32,11 @@@ importpushesTrunk,unwiredHookProblems,} from './hooks.js';- import { detectGate, initRepo, proposeLanes } from './init.js';+ import { askedLaneNotes, detectGate, initRepo, proposeLanes, starterLane, starterLaneNotes } from './init.js';import { lifecycleMarkdown } from './machine.js';import { HELP, VERSION } from './help.js';+ import { barCorrectionLine, barCorrections, barStatsLines } from './bar-corrections.js';+import { checkImplies, decisionsImplying, parseImplies, takeDecisionNotices, whyLine } from './implies.js';import { defaultViewPort } from './view-port.js';export { HELP, VERSION };import { productLine, productProblems, productSummaries } from './products.js';@@@ -1359,15 -1359,10 +1363,13 @@@ function resumeHere(io)say(`${plural(dirty, 'file')} uncommitted in the main checkout`);}if (isMain) {- const setup = uncommittedSetup(root, ctx.config);- if (setup) {- say(`The person must commit Pullboard's setup files before agents can use worktrees: ${setup.stage}`);- }+ card.commits = commitOwners(uncommittedSetup(root, ctx.config)?.differ ?? [], [ctx.config.spec, ctx.config.practice], root);+ for (const line of commitOwnerLines(card.commits)) say(line);}for (const request of card.requests) say(`request #${request.shout_id}: ${request.shout_text}; answer with pullboard answer ${request.shout_id} done, or declined <reason>`);+ card.decisions = takeDecisionNotices(ctx.info.gitDir, card.held);+ delete card.held;+ for (const notice of card.decisions) say(`decision for #${notice.item} ${notice.text}`);for (const item of card.holding) {say(`holding #${item.item_id} ${item.item_title}, lease ${span(ctx, item.item_lease_until)} left${item.item_check ? `; check: ${item.item_check}` : ''}`);const files = briefFiles(item.item_brief);diff --cc src/engine.jsindex a2b7165d,8f1c9ca0..8be6dc97--- a/src/engine.js+++ b/src/engine.js@@@ -2,7 -2,7 +2,8 @@@import { createHash, randomUUID } from 'node:crypto';import * as store from './board.js';import { recordedRefusal } from './recorded-refusal.js';+ import { BAR_ENGINE, carriesBarReason } from './bar-corrections.js';+import { carriesImplies, IMPLIES_ENGINE } from './implies.js';import { ENGINE_VERSION } from './machine.js';import { Refused } from './refused.js';import { requestMoveProblem, recordRequestMove } from './relay-requests.js';@@@ -23,10 -23,10 +24,11 @@@ export const ENGINE_OPERATIONS = Object/** Engine version at which each ordered operation first has stable replay semantics. */const OPERATION_ENGINE = Object.freeze({ reopen: 8, recordLandingBatch: 8, recordLandingWaiver: 8, recordLandingFlake: 8, finishLandingBatch: 8 });- /** Dependency edits add engine-10 meaning, and implied items engine-18 meaning, without changing ordinary historical envelopes. */-/** Dependency edits add engine-10 meaning, and edit reasons engine-19 meaning, without changing ordinary historical edit envelopes. */++/** Dependency edits add engine-10 meaning, edit reasons engine-19 and implied items engine-20, without changing ordinary historical envelopes. */function minimumOperationEngine(operation, args) {const options = args[1];+ if (carriesImplies(operation, args)) return IMPLIES_ENGINE;+ if (carriesBarReason(operation, args)) return BAR_ENGINE;return operation === 'editItem' && options && Object.hasOwn(options, 'after') && options.after !== undefined? 10 : OPERATION_ENGINE[operation] ?? 1;}diff --cc src/implies.jsindex bceeaa54,00000000..760443b9mode 100644,000000..100644--- a/src/implies.js+++ b/src/implies.js@@@ -1,330 -1,0 +1,337 @@@+/**+ * A decision names the items it changes, and each named item carries it [B29,B30,B31,N29,P6].+ *+ * An answer, a verdict or a fact can carry `implies`: the ids of other items the decision changes.+ * Each named item gets a fact citing the decision, and when the decision is superseded each gets a+ * second fact naming the new one. Both are ordinary item facts in the event log; no other store.+ *+ * Who decided always comes from the board's own record of the decision (the answer's sender, the+ * verdict's reviewer, the fact's author), never from the caller's arguments, so no relay or API+ * caller can mint a person-origin citation (P6). The only route to `by: "person"` is a real+ * person answer, which keeps its own person-channel rules.+ */+import { createHash, randomUUID } from 'node:crypto';+import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';+import { dirname, join } from 'node:path';+import { COORDINATOR } from './config.js';+import { ENGINE_VERSION } from './machine.js';+import { Refused } from './refused.js';++/** The engine whose moves may carry `implies`, or supersede an answer; older replays never do. */- export const IMPLIES_ENGINE = 18;++export const IMPLIES_ENGINE = 20;++/** The operations whose sealed options may carry `implies`. */+export const IMPLYING_OPERATIONS = Object.freeze(['appendFact', 'answerDecision', 'verify']);++/**+ * Parse an `--implies` value into item ids, accepting `12,13` or `#12, #13`.+ *+ * @param {string | undefined} text+ * @returns {number[] | undefined}+ */+export function parseImplies(text) {+ if (text === undefined) return undefined;+ const parts = String(text).split(',').map((part) => part.trim()).filter(Boolean);+ if (!parts.length || parts.some((part) => !/^#?[1-9]\d*$/u.test(part))) {+ throw new Refused('USAGE', `--implies takes item ids separated by commas, as in --implies 12,13 (saw "${text}")`);+ }+ return [...new Set(parts.map((part) => Number(part.replace('#', ''))))];+}++/**+ * True when a sealed move carries this engine's meaning: items it implies, or an answer it supersedes.+ * The relay refuses such a move from an older engine before it changes any board.+ *+ * @param {string} operation+ * @param {any[]} args+ * @returns {boolean}+ */+export function carriesImplies(operation, args) {+ const options = args?.[1];+ if (!IMPLYING_OPERATIONS.includes(operation) || !options || typeof options !== 'object') return false;+ return (Array.isArray(options.implies) && options.implies.length > 0)+ || (operation === 'answerDecision' && options.supersedes !== undefined && options.supersedes !== null);+}++/**+ * Validate the implied ids before any part of the decision is written, naming the first unknown one.+ * Refuses on a board replaying an older engine, so a forged older move cannot change state.+ *+ * @param {any} board+ * @param {unknown} implies+ * @returns {number[]}+ */+export function checkImplies(board, implies) {+ if (implies === undefined || implies === null) return [];+ if (!Array.isArray(implies) || implies.some((id) => !Number.isSafeInteger(id) || id < 1)) {+ throw new Refused('USAGE', '--implies takes item ids separated by commas, as in --implies 12,13');+ }+ const engine = board.executionEngineVersion ?? ENGINE_VERSION;+ if (implies.length && engine < IMPLIES_ENGINE) {+ throw new Refused('ENGINE_VERSION', `a decision that implies items requires engine ${IMPLIES_ENGINE}; this board uses engine ${engine}; upgrade Pullboard before using --implies`);+ }+ for (const id of implies) {+ if (!board.db.prepare('SELECT 1 FROM item WHERE item_id = ?').get(id)) {+ throw new Refused('NO_ITEM', `no item #${id} to imply; name items from pullboard list --all`);+ }+ }+ return [...new Set(implies)];+}++/** The first nonempty line of a decision's text, trimmed, as its citation reads it. */+export function firstLine(text) {+ return String(text ?? '').split('\n').map((line) => line.trim()).find(Boolean) ?? '';+}++/** A short name for a decision, as the facts and `pullboard why` print it. */+export function decisionLabel(decision) {+ if (decision.source === 'answer') return `answer #${decision.id}`;+ if (decision.source === 'verdict') return `verdict on #${decision.item}`;+ return `fact ${decision.id} on #${decision.item}`;+}++/** The citation of an answer, read from its shout row. */+export function answerDecisionRef(shout) {+ return { source: 'answer', id: shout.shout_id, item: null, by: shout.shout_from, line: firstLine(shout.shout_text) };+}++/** The citation of a verdict, read from its verdict row. */+export function verdictDecisionRef(verdict) {+ const verb = verdict.verdict_decision === 'ACCEPT' ? 'accept' : 'reject';+ const note = firstLine(verdict.verdict_note);+ return { source: 'verdict', id: verdict.verdict_id, item: verdict.item_id, by: verdict.verdict_by,+ line: `${verb} ${verdict.verdict_reason}${note ? `: ${note}` : ''}` };+}++/** The citation of a fact, read from its stamped event. */+export function factDecisionRef(fact, itemId) {+ return { source: 'fact', id: fact.id, item: itemId, by: fact.by, line: firstLine(fact.text) };+}++/**+ * The seed for implied-fact ids: the sealed move id on replay, or a fresh one when no move supplies it.+ * A move id may be 80 characters, but an implied id adds a suffix and must still fit a fact id, so a+ * move id longer than 72 is replaced by a digest of itself: every replica derives the same ids.+ */+export function impliesSeed(seed) {+ if (typeof seed === 'string' && /^[A-Za-z0-9_-]{1,72}$/u.test(seed)) return seed;+ if (typeof seed === 'string' && /^[A-Za-z0-9_-]{73,80}$/u.test(seed)) return `h${createHash('sha256').update(seed).digest('base64url').slice(0, 43)}`;+ return randomUUID();+}++/**+ * Write one fact on each implied item citing the decision, stamped with the decider.+ *+ * @param {(by: string, itemId: number, detail: object) => void} log appends one fact event+ * @param {{ seed: string, decision: object, implies: number[] }} options+ */+export function writeImplied(log, { seed, decision, implies }) {+ for (const itemId of implies) {+ log(decision.by, itemId, { id: `${seed}-i${itemId}`, kind: 'note', text: `implied by ${decisionLabel(decision)} by ${decision.by}: ${decision.line}`,+ ref: null, supersedes: null, decision });+ }+}++/**+ * Tell each item the old decision implied that a new decision supersedes it, stamped with the new decider.+ *+ * @param {(by: string, itemId: number, detail: object) => void} log appends one fact event+ * @param {{ seed: string, old: object, next: object, implies: number[] }} options+ */+export function writeSuperseded(log, { seed, old, next, implies }) {+ for (const itemId of implies) {+ log(next.by, itemId, { id: `${seed}-s${itemId}`, kind: 'note',+ text: `${decisionLabel(old)} by ${old.by} is superseded by ${decisionLabel(next)} by ${next.by}: ${next.line}`,+ ref: null, supersedes: null, decision: old, supersededBy: next });+ }+}++/** True when two citations name the same decision. */+function sameDecision(left, right) {+ return Boolean(left && right) && left.source === right.source && left.id === right.id && (left.item ?? null) === (right.item ?? null);+}++/**+ * The items an earlier decision implied, read from the facts it wrote.+ *+ * @param {any} board+ * @param {object} decision+ * @returns {number[]}+ */+export function impliedItems(board, decision) {+ const rows = board.db.prepare("SELECT item_id, event_detail FROM event WHERE event_kind = 'fact' AND json_extract(event_detail, '$.decision') IS NOT NULL AND json_extract(event_detail, '$.supersededBy') IS NULL ORDER BY event_id").all();+ return [...new Set(rows.filter((row) => sameDecision(JSON.parse(row.event_detail).decision, decision)).map((row) => row.item_id))];+}++/**+ * The decisions that imply an item, newest first, each with the decision that superseded it (N29).+ *+ * @param {any[]} thread the item's facts and moves, oldest first+ * @returns {{ source: string, id: any, item: number | null, by: string, line: string, at: string, fact: string, supersededBy: object | null }[]}+ */+export function decisionsImplying(thread) {+ const facts = thread.filter((entry) => entry.type === 'fact' && entry.decision);+ return facts.filter((fact) => !fact.supersededBy)+ .map((fact) => ({ ...fact.decision, at: fact.at, fact: fact.id,+ supersededBy: facts.filter((notice) => notice.supersededBy && sameDecision(notice.decision, fact.decision)).at(-1)?.supersededBy ?? null }))+ .reverse();+}++/** One line for a decision as `pullboard why` prints it. */+export function whyLine(entry) {+ return `${entry.at} ${decisionLabel(entry)} by ${entry.by}: ${entry.line}${entry.supersededBy ? ` (superseded by ${decisionLabel(entry.supersededBy)} by ${entry.supersededBy.by})` : ''}`;+}++/** True when this replay's engine tells implied items about supersession; older replays never did. */+export function tellsSupersession(board) {+ return (board.executionEngineVersion ?? ENGINE_VERSION) >= IMPLIES_ENGINE;+}++/** One shout row, or a refusal naming its id. */+function shoutRow(board, id) {+ const found = board.db.prepare('SELECT * FROM shout WHERE shout_id = ?').get(id);+ if (!found) throw new Refused('NO_SHOUT', `no shout #${id}`);+ return found;+}++/**+ * The earlier answer a new answer supersedes, or null; refuses anything that is not an answered+ * decision, and an agent overruling the person (P6) or another agent's answer (B30).+ *+ * @param {any} board+ * @param {number | null} supersedes+ * @param {{ from: string, person: string }} answerer who answers now, and the person's id+ * @returns {any | null}+ */+export function supersededAnswer(board, supersedes, { from, person }) {+ if (supersedes === null || supersedes === undefined) return null;+ const engine = board.executionEngineVersion ?? ENGINE_VERSION;+ if (engine < IMPLIES_ENGINE) throw new Refused('ENGINE_VERSION', `superseding an answer requires engine ${IMPLIES_ENGINE}; this board uses engine ${engine}; upgrade Pullboard before using --supersedes`);+ if (!Number.isSafeInteger(supersedes) || supersedes < 1) throw new Refused('USAGE', 'name the answer this one supersedes by its shout id: --supersedes 12');+ const old = shoutRow(board, supersedes);+ const ask = old.shout_answers === null ? null : shoutRow(board, old.shout_answers);+ if (old.shout_decision || !ask?.shout_decision || ask.shout_request) {+ throw new Refused('NOT_A_DECISION', `shout #${supersedes} is not an answer to a decision; supersede an answer id from pullboard decisions`);+ }+ if (old.shout_from === person && from !== person) {+ throw new Refused('B26_PERSON_ANSWER', `answer #${supersedes} is the person's; only the person supersedes it: ask your coordinator to pass a new decision to the person`);+ }+ if (from !== person && from !== COORDINATOR && old.shout_from !== from) {+ throw new Refused('NOT_YOUR_DECISION', `answer #${supersedes} is ${old.shout_from}'s; only its author, the coordinator or the person supersedes it`);+ }+ return old;+}++/**+ * Cite the newest verdict on each item it implies, and tell the items the verdict before it+ * implied that this one supersedes it. Engines before IMPLIES_ENGINE replay unchanged.+ * Runs inside the verdict's transaction, so a refused id leaves no verdict behind.+ *+ * @param {any} board+ * @param {(by: string, itemId: number, detail: object) => void} log appends one fact event+ * @param {number} id the verdict's item+ * @param {{ seed?: string, implies?: number[] }} options+ */+export function tellVerdictImplications(board, log, id, { seed, implies }) {+ const named = checkImplies(board, implies);+ const [latest, previous] = board.db.prepare('SELECT * FROM verdict WHERE item_id = ? ORDER BY verdict_id DESC LIMIT 2').all(id);+ const decision = verdictDecisionRef(latest);+ const ids = impliesSeed(seed);+ writeImplied(log, { seed: ids, decision, implies: named });+ if (!previous || !tellsSupersession(board)) return;+ const old = verdictDecisionRef(previous);+ writeSuperseded(log, { seed: ids, old, next: decision, implies: impliedItems(board, old) });+}++/**+ * Cite a new answer on each item it implies, and tell the items an earlier answer implied that this+ * one supersedes it. Runs inside the answer's transaction, so a refusal leaves no answer behind.+ *+ * @param {any} board+ * @param {(by: string, itemId: number, detail: object) => void} log appends one fact event+ * @param {number} answerId the new answer's shout id+ * @param {{ seed?: string, implies?: number[], supersedes?: number | null, from: string, person: string }} options+ * @returns {number} the answer's id, so the caller records and tells in one step+ */+export function tellAnswerImplications(board, log, answerId, { seed, implies, supersedes, from, person }) {+ const named = checkImplies(board, implies);+ const replaced = supersededAnswer(board, supersedes, { from, person });+ const decision = answerDecisionRef(shoutRow(board, answerId));+ const ids = impliesSeed(seed);+ writeImplied(log, { seed: ids, decision, implies: named });+ if (replaced) writeSuperseded(log, { seed: ids, old: answerDecisionRef(replaced), next: decision, implies: impliedItems(board, answerDecisionRef(replaced)) });+ return answerId;+}++/**+ * Cite a new fact on each item it implies, and tell the items the fact it supersedes implied.+ * Runs inside the fact's transaction, so a refused id leaves no fact behind.+ *+ * @param {any} board+ * @param {(by: string, itemId: number, detail: object) => void} log appends one fact event+ * @param {any} fact the new fact as the thread reads it+ * @param {{ id: number, implies?: number[], supersedes: string | null }} options its item, implied ids and the fact it corrects+ * @returns {any} the new fact+ */+export function tellFactImplications(board, log, fact, { id, implies, supersedes }) {+ const named = checkImplies(board, implies);+ const decision = factDecisionRef(fact, id);+ const seed = impliesSeed(fact.id);+ writeImplied(log, { seed, decision, implies: named });+ if (supersedes !== null && tellsSupersession(board)) {+ const row = board.db.prepare("SELECT event_by, event_detail FROM event WHERE event_kind = 'fact' AND item_id = ? AND json_extract(event_detail, '$.id') = ?").get(id, supersedes);+ const old = factDecisionRef({ id: supersedes, by: row.event_by, text: JSON.parse(row.event_detail).text }, id);+ writeSuperseded(log, { seed, old, next: decision, implies: impliedItems(board, old) });+ }+ return fact;+}++/** The refusal for an answer to a request: a person answer, or one that names items or supersedes. */+export function requestAnswerRefusal(id, { asPerson }) {+ return asPerson+ ? new Refused('B26_PERSON_ANSWER', `requests are answered by the coordinator; run pullboard answer ${id} done or declined <reason>`)+ : new Refused('NOT_A_DECISION', `request #${id} is not a decision, so it implies and supersedes nothing; answer it with pullboard answer ${id} done or declined <reason>`);+}+- /** The optional engine-18 fields of a fact, present only when its event set them. */++/** The optional engine-20 fields of a fact, present only when its event set them. */+export function decisionFields(detail) {+ return { ...(detail.implies ? { implies: detail.implies } : {}), ...(detail.decision ? { decision: detail.decision } : {}),+ ...(detail.supersededBy ? { supersededBy: detail.supersededBy } : {}) };+}++/** The most fact ids one checkout remembers as shown; older ones age out first. */+const SEEN_LIMIT = 2000;++/**+ * The decision facts on the items this agent holds that its resume has not shown yet, marking them+ * shown. The record is per checkout, like resume's release notes, so each shows once (B29).+ *+ * @param {string} gitDir this checkout's own git directory+ * @param {{ item: number, facts: any[] }[]} held each held item and its thread+ * @returns {{ item: number, fact: string, text: string }[]}+ */+export function takeDecisionNotices(gitDir, held) {+ const record = join(gitDir, 'pullboard-checkout', 'decisions-seen.json');+ let seen = [];+ try { seen = JSON.parse(readFileSync(record, 'utf8')).seen ?? []; }+ catch (error) { if (error.code !== 'ENOENT' && !(error instanceof SyntaxError)) throw error; }+ if (!Array.isArray(seen)) seen = [];+ const known = new Set(seen);+ const notices = held.flatMap(({ item, facts }) => facts+ .filter((fact) => fact.type === 'fact' && fact.decision && !known.has(fact.id))+ .map((fact) => ({ item, fact: fact.id, text: fact.text })));+ if (!notices.length) return notices;+ const next = [...seen, ...notices.map((notice) => notice.fact)].slice(-SEEN_LIMIT);+ mkdirSync(dirname(record), { recursive: true });+ const temporary = `${record}.${randomUUID()}.tmp`;+ writeFileSync(temporary, `${JSON.stringify({ version: 1, seen: next })}\n`);+ renameSync(temporary, record);+ return notices;+}++++/** Give facts the same stamped identity on CLI, API, export and replica reads [B29,B31]. */++export function factFromEvent(event) {++ const detail = JSON.parse(event.event_detail);++ return { id: detail.id, eventId: event.event_id, kind: detail.kind, text: detail.text,++ by: event.event_by, at: event.event_at, ref: detail.ref ?? null, supersedes: detail.supersedes ?? null, ...decisionFields(detail) };++}diff --cc src/machine.jsindex 9e840df5,bbd1cfb9..227bc125--- a/src/machine.js+++ b/src/machine.js@@@ -10,7 -10,7 +10,7 @@@*//** Executable move semantics, carried by every sealed move and retained during replay [H16]. */- export const ENGINE_VERSION = 18;-export const ENGINE_VERSION = 19;++export const ENGINE_VERSION = 20;/** @typedef {'agent' | 'coordinator' | 'clock'} Role */@@@ -168,13 -168,13 +168,13 @@@ export const MOVES ={verb: 'accept', from: ['submitted'], to: 'verified', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonIsMet', 'trunkMergeClean', 'noUnverifiedStack', 'itemCheckGreen', 'proofNoted'],- alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 18 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],- alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }],++ alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],sets: ['item_verified_by'], command: 'pullboard verify <id> accept --note "..."',},{verb: 'reject', from: ['submitted'], to: 'open', by: ['agent', 'coordinator'], refuse: 'NOT_SUBMITTED',guards: ['coordinatorSaysAs', 'joined', 'itemExists', IN_STATE, 'atSubmittedCommit', 'notBuilder', 'routeAllows', 'policyAllows', 'familyAllows', 'reviewFree', 'criterionUnchanged', 'reasonCoded', 'noteGiven'],- alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 18 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],- alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }],++ alsoRefuses: [{ code: 'LAND_HEADER', rule: 'a displayed merge command fits the commit-header limit', next: 'shorten the item title or cited rows so the merge header fits' }, { code: 'ENGINE_VERSION', rule: 'a verdict that implies items replays only under engine 20 or later', next: 'upgrade Pullboard on every linked device before using --implies' }],command: 'pullboard verify <id> reject --reason CODE --note "..."',},{diff --cc test/agent-model-engine.test.jsindex fcf27366,ba92a56d..c45f64d4--- a/test/agent-model-engine.test.js+++ b/test/agent-model-engine.test.js@@@ -11,7 -11,7 +11,7 @@@ import { tmpdir } from 'node:os'import { join } from 'node:path';test('model declarations and event snapshots retain engines 1 through 11 semantics [O8,O3,H16]', (t) => {- assert.equal(ENGINE_VERSION, 18, 'engine 18 preserves the released engine-8 through engine-11 model behavior');- assert.equal(ENGINE_VERSION, 19, 'engine 19 preserves the released engine-8 through engine-11 model behavior');++ assert.equal(ENGINE_VERSION, 20, 'engine 20 preserves the released engine-8 through engine-11 model behavior');for (const version of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ENGINE_VERSION]) {const board = store.openBoard(':memory:');t.after(() => store.closeBoard(board));diff --cc test/implies.test.jsindex 1bc77090,00000000..dd654dd5mode 100644,000000..100644--- a/test/implies.test.js+++ b/test/implies.test.js@@@ -1,252 -1,0 +1,252 @@@+/** A decision names the items it changes, and each named item carries it [B29,B30,B31,N29,P6]. */+import assert from 'node:assert/strict';+import { runFixtureChild, runFixtureGit } from './fixture-child.js';+import { chmodSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join, resolve } from 'node:path';+import { after, test } from 'node:test';+import * as store from '../src/board.js';+import { applyEngineMove, applyRelayMove, prepareEngineMove } from '../src/engine.js';++const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');+const sandboxes = [];+const SPEC = '# Implies fixture\n\n## G · Goals\n- G1 [approved, must] The feature works. | gate: test\n';+const HOUR = 3_600_000;++after(() => {+ for (const dir of sandboxes) rmSync(dir, { recursive: true, force: true });+});++/** Make an isolated real-Git repo with a board, a coordinator, one joined web builder and three web items. */+function fixture() {+ const dir = realpathSync(mkdtempSync(join(tmpdir(), 'pullboard-implies-')));+ sandboxes.push(dir);+ const shims = join(dir, 'bin');+ mkdirSync(shims);+ writeFileSync(join(shims, 'pullboard'), `#!/bin/sh\nexec "${process.execPath}" "${BIN}" "$@"\n`, { mode: 0o755 });+ chmodSync(join(shims, 'pullboard'), 0o755);+ const env = {+ ...process.env,+ PATH: `${shims}:${process.env.PATH}`,+ GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1',+ GIT_AUTHOR_NAME: 'Test Agent', GIT_AUTHOR_EMAIL: '[email protected]',+ GIT_COMMITTER_NAME: 'Test Agent', GIT_COMMITTER_EMAIL: '[email protected]',+ PULLBOARD_HOME: join(dir, 'home'), PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'),+ };+ for (const name of Object.keys(env)) if (name.startsWith('GIT_') && !name.startsWith('GIT_CONFIG') && !name.startsWith('GIT_AUTHOR') && !name.startsWith('GIT_COMMITTER')) delete env[name];+ delete env.PULLBOARD_RELAY_TOKEN;+ const repo = join(dir, 'repo');+ mkdirSync(repo);+ /** Run Git in this private fixture with its isolated identity. */+ const git = (cwd, ...args) => runFixtureGit(args, { cwd, env });+ /** Run the actual CLI in a fixture checkout and keep both output streams. */+ const run = (cwd, ...args) => {+ const result = runFixtureChild(process.execPath, [BIN, ...args], { cwd, env, encoding: 'utf8' });+ return { code: result.status, out: result.stdout ?? '', err: result.failure ?? result.stderr ?? '' };+ };+ /** Run a command that must succeed with --json and return its one document. */+ const json = (cwd, ...args) => {+ const result = run(cwd, ...args, '--json');+ assert.equal(result.code, 0, `${args.join(' ')}: ${result.err}${result.out}`);+ return JSON.parse(result.out);+ };+ git(repo, 'init', '-q', '-b', 'main');+ assert.equal(run(repo, 'init').code, 0);+ writeFileSync(join(repo, 'pullboard.json'), JSON.stringify({+ gate: 'true', spec: 'SPEC.md', verify: 'any', lease: '2h',+ lanes: { web: { owns: ['web/'], specs: ['G1'] } },+ }, null, 2));+ writeFileSync(join(repo, 'SPEC.md'), SPEC);+ mkdirSync(join(repo, 'web'));+ writeFileSync(join(repo, 'web', 'shared.txt'), 'base\n');+ git(repo, 'add', '-A');+ git(repo, 'commit', '-q', '-m', 'chore: create implies fixture');+ const web = json(repo, 'worktree', 'web', '--route', 'strong').path;+ for (const title of ['First implied item', 'Second implied item', 'Untouched item']) {+ json(repo, 'add', 'web', title, '--specs', 'G1', '--criterion', `${title} works`, '--check', 'true');+ }+ return { dir, env, repo, web, run, json };+}++/** The facts in one item's thread, read through the real show command. */+function facts(box, id) {+ return box.json(box.repo, 'show', String(id)).thread.filter((entry) => entry.type === 'fact');+}++/** Count how many times a literal string occurs in a text. */+function occurrences(text, needle) {+ return text.split(needle).length - 1;+}++test('[B29,B31,N29] a decision reaches the items it implies', () => {+ const box = fixture();+ assert.equal(box.json(box.web, 'claim', '1').id, 1);+ const ask = box.json(box.web, 'shout', 'coordinator', 'Which engine ships in 0.8.8?', '--decision').id;+ const answer = box.json(box.repo, 'answer', String(ask), 'Ship engine 9 in 0.8.8\nso #1 and #2 move to engine 10', '--implies', '1,#2');++ for (const id of [1, 2]) {+ const implied = facts(box, id).filter((fact) => fact.decision);+ assert.equal(implied.length, 1, `#${id} carries the decision as one fact`);+ assert.deepEqual(implied[0].decision, { source: 'answer', id: answer.id, item: null, by: 'coordinator', line: 'Ship engine 9 in 0.8.8' },+ `#${id}'s fact cites the decision's id, who decided and its first line`);+ assert.equal(implied[0].supersededBy, undefined, 'an implied fact is not a supersession notice');+ assert.match(implied[0].text, new RegExp(`answer #${answer.id} by coordinator: Ship engine 9 in 0\\.8\\.8$`), 'the fact text names the decision for any reader');+ const shown = box.run(box.repo, 'show', String(id));+ assert.equal(shown.code, 0, shown.err);+ assert.ok(shown.out.includes(`implied by answer #${answer.id} by coordinator: Ship engine 9 in 0.8.8`), `pullboard show #${id} prints the implied fact`);+ }+ assert.deepEqual(facts(box, 3), [], 'an item not named carries nothing');++ const notice = `implied by answer #${answer.id} by coordinator: Ship engine 9 in 0.8.8`;+ const first = box.run(box.web, 'resume');+ assert.equal(first.code, 0, first.err);+ assert.equal(occurrences(first.out, notice), 1, `the holder's next resume shows the decision once:\n${first.out}`);+ assert.ok(first.out.includes(`#1 ${notice}`), 'the resume line names the held item');+ const second = box.run(box.web, 'resume');+ assert.equal(second.code, 0, second.err);+ assert.equal(occurrences(second.out, notice), 0, `a later resume does not repeat it:\n${second.out}`);++ const ask2 = box.json(box.web, 'shout', 'coordinator', 'Engine 9 slipped; what now?', '--decision').id;+ const replacement = box.json(box.repo, 'answer', String(ask2), 'Ship engine 10 in 0.8.9 instead', '--supersedes', String(answer.id));+ for (const id of [1, 2]) {+ const told = facts(box, id).filter((fact) => fact.supersededBy);+ assert.equal(told.length, 1, `#${id} is told once that its decision was superseded`);+ assert.deepEqual(told[0].decision, { source: 'answer', id: answer.id, item: null, by: 'coordinator', line: 'Ship engine 9 in 0.8.8' }, 'the notice names the old decision');+ assert.deepEqual(told[0].supersededBy, { source: 'answer', id: replacement.id, item: null, by: 'coordinator', line: 'Ship engine 10 in 0.8.9 instead' }, 'the notice names the new decision');+ assert.match(told[0].text, new RegExp(`answer #${answer.id} by coordinator is superseded by answer #${replacement.id} by coordinator: Ship engine 10 in 0\\.8\\.9 instead$`));+ }+ assert.deepEqual(facts(box, 3), [], 'an item not named stays untouched by the supersession');+ const third = box.run(box.web, 'resume');+ assert.equal(occurrences(third.out, `is superseded by answer #${replacement.id}`), 1, `the holder's next resume shows the supersession once:\n${third.out}`);++ box.json(box.repo, 'fact', '3', 'decision', 'Keep #1 behind the engine flag', '--implies', '1');+ const why = box.json(box.repo, 'why', '1');+ assert.equal(why.id, 1);+ assert.deepEqual(why.decisions.map((entry) => [entry.source, entry.line, entry.supersededBy?.id ?? null]),+ [['fact', 'Keep #1 behind the engine flag', null], ['answer', 'Ship engine 9 in 0.8.8', replacement.id]],+ 'pullboard why lists the decisions that imply an item, newest first, with supersession');+ const whyText = box.run(box.repo, 'why', '1');+ assert.equal(whyText.code, 0, whyText.err);+ assert.ok(whyText.out.indexOf('Keep #1 behind the engine flag') < whyText.out.indexOf('Ship engine 9 in 0.8.8'), `newest first in text:\n${whyText.out}`);+ assert.match(whyText.out, new RegExp(`superseded by answer #${replacement.id}`));+ assert.deepEqual(box.json(box.repo, 'why', '3').decisions, [], 'an item nothing implies has no decisions');+});++test('[B29,B31] verdicts and facts carry --implies; a later verdict or a superseding fact tells the items; unknown ids are refused by name', () => {+ const box = fixture();+ box.json(box.web, 'claim', '1');+ box.json(box.web, 'submit', '1');+ const review = box.json(box.repo, 'worktree', 'web', '--route', 'strong').path;+ box.json(review, 'next', '--verify');+ const refused = box.run(review, 'verify', '1', 'reject', '--reason', 'TEST_FAILURE', '--note', 'x', '--implies', '2,99', '--json');+ assert.notEqual(refused.code, 0);+ assert.equal(JSON.parse(refused.out).error.code, 'NO_ITEM');+ assert.match(JSON.parse(refused.out).error.message, /#99/, 'the refusal names the unknown id');+ assert.equal(box.json(box.repo, 'show', '1').item_status, 'submitted', 'a refused --implies records no verdict');+ box.json(review, 'verify', '1', 'reject', '--reason', 'TEST_FAILURE', '--note', 'the fixture fails\nsecond line', '--implies', '2');+ const fromVerdict = facts(box, 2).filter((fact) => fact.decision);+ assert.equal(fromVerdict.length, 1);+ assert.equal(fromVerdict[0].decision.source, 'verdict');+ assert.equal(fromVerdict[0].decision.item, 1);+ assert.equal(fromVerdict[0].decision.line, 'reject TEST_FAILURE: the fixture fails');+ assert.equal(fromVerdict[0].by, fromVerdict[0].decision.by, 'the reviewer who decided authors the implied fact');+ box.json(box.web, 'claim', '1');+ writeFileSync(join(box.web, 'web', 'shared.txt'), 'fixed\n');+ runFixtureGit(['commit', '-q', '-am', 'fix: the fixture passes [G1]'], { cwd: box.web, env: box.env });+ const resubmitted = box.json(box.web, 'submit', '1').commit;+ box.json(review, 'next', '--verify');+ runFixtureGit(['switch', '-q', '--detach', resubmitted], { cwd: review, env: box.env });+ box.json(review, 'verify', '1', 'accept', '--note', 'ran the fixture check');+ const told = facts(box, 2).filter((fact) => fact.supersededBy);+ assert.equal(told.length, 1, 'a later verdict on the same item supersedes the earlier one for the items it implied');+ assert.equal(told[0].supersededBy.source, 'verdict');+ assert.equal(told[0].supersededBy.line, 'accept CRITERION_MET: ran the fixture check');+- const decision = box.json(box.repo, 'fact', '3', 'decision', 'Item 2 waits for engine 18', '--implies', '2').fact;++ const decision = box.json(box.repo, 'fact', '3', 'decision', 'Item 2 waits for engine 20', '--implies', '2').fact;+ box.json(box.repo, 'fact', '3', 'supersession', 'Item 2 waits for engine 19', '--supersedes', decision.id);+ const corrected = facts(box, 2).filter((fact) => fact.supersededBy?.source === 'fact');+ assert.equal(corrected.length, 1, 'superseding a fact that implied items tells each of them');+ assert.equal(corrected[0].decision.id, decision.id);+ assert.equal(corrected[0].supersededBy.line, 'Item 2 waits for engine 19');+ assert.equal(facts(box, 1).filter((fact) => fact.decision).length, 0, 'an item the fact never named is not told');+ const unknownFact = box.run(box.repo, 'fact', '3', 'note', 'stray', '--implies', '42', '--json');+ assert.equal(JSON.parse(unknownFact.out).error.code, 'NO_ITEM');+ const badList = box.run(box.repo, 'fact', '3', 'note', 'stray', '--implies', 'two', '--json');+ assert.equal(JSON.parse(badList.out).error.code, 'USAGE');+});++test('[P6,B26,H16] --implies cannot forge a person-origin fact through the relay, the API or the terminal', () => {+ let at = Date.parse('2026-10-17T00:00:00.000Z');+ const board = store.openBoard(':memory:', { now: () => new Date(at += 1000) });+ try {+ store.register(board, { lane: 'coordinator', path: '/repo' });+ store.register(board, { lane: 'web', path: '/repo-web-1' });+ const one = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'One' });+ const two = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Two' });+ store.claim(board, one, { agentId: 'web-1', lane: 'web', leaseMs: 2 * HOUR, freeze: (found) => ({ text: found.item_title, digest: 'd' }) });+ const personAsk = store.shout(board, { from: 'coordinator', to: 'person', text: 'Person decision', decision: true, lanes: ['web'] });+ const coordinator = { kind: 'agent', userId: 'user', agent: 'coordinator' };+ let sequence = 0;+ const relay = (move, sender = coordinator) => applyRelayMove(board, move, { sequence: ++sequence, at: new Date(at).toISOString(), sender, kind: 'move' });++ const forgedAnswer = relay(prepareEngineMove(board, 'answerDecision', [personAsk, { agentId: 'coordinator', asPerson: true, text: 'forged', lanes: ['web'], implies: [two] }]));+ assert.equal(forgedAnswer.error.code, 'RELAY_PERSON_ONLY', 'an agent cannot seal a person answer that implies items');+ const asCoordinator = relay(prepareEngineMove(board, 'answerDecision', [personAsk, { agentId: 'coordinator', text: 'forged', lanes: ['web'], implies: [two] }]));+ assert.equal(asCoordinator.error.code, 'B26_PERSON_ANSWER', 'the coordinator cannot answer the person decision for the person');+ const smuggled = relay(prepareEngineMove(board, 'appendFact', [one, { agentId: 'coordinator', kind: 'decision', text: 'Smuggled', implies: [two],+ by: 'person', asPerson: true, decision: { source: 'answer', id: personAsk, by: 'person', line: 'forged' } }]));+ assert.equal(smuggled.error, undefined, JSON.stringify(smuggled.error));+ const carried = store.itemThread(board, two).filter((entry) => entry.type === 'fact' && entry.decision);+ assert.equal(carried.length, 1);+ assert.equal(carried[0].by, 'coordinator', 'the implied fact is stamped with the authenticated decider');+ assert.deepEqual(carried[0].decision, { source: 'fact', id: carried[0].decision.id, item: one, by: 'coordinator', line: 'Smuggled' }, 'caller fields never reach the citation');+ const person = store.itemThread(board, two).filter((entry) => entry.type === 'fact' && (entry.by === 'person' || entry.decision?.by === 'person'));+ assert.deepEqual(person, [], 'no person-origin fact exists after agent relays');++ const old = prepareEngineMove(board, 'appendFact', [one, { agentId: 'coordinator', kind: 'note', text: 'old engine', implies: [two] }]);- old.engine = 12;++ old.engine = 19;+ const before = store.events(board).length;+ assert.throws(() => applyEngineMove(board, old, { sequence: sequence + 1, at: new Date(at).toISOString() }), { code: 'RELAY_MOVE' },- 'an implies move below engine 18 is refused before it is interpreted');++ 'an implies move below engine 20 is refused before it is interpreted');+ assert.equal(store.events(board).length, before, 'the refused older move changes nothing');++ const personAnswer = store.answerDecision(board, personAsk, { agentId: 'coordinator', asPerson: true, text: 'The person decides', lanes: ['web'], implies: [two] });+ const real = store.itemThread(board, two).filter((entry) => entry.type === 'fact' && entry.decision?.source === 'answer');+ assert.deepEqual(real.map((entry) => [entry.by, entry.decision.by, entry.decision.id]), [['person', 'person', personAnswer]],+ "only the person's own answer yields a person-origin implied fact");+ const agentAsk = store.shout(board, { from: 'web-1', to: 'coordinator', text: 'Agent decision', decision: true, lanes: ['web'] });+ assert.throws(() => store.answerDecision(board, agentAsk, { agentId: 'coordinator', text: 'Overrule the person', lanes: ['web'], supersedes: personAnswer }),+ { code: 'B26_PERSON_ANSWER' }, "an agent cannot supersede the person's decision");+ } finally { store.closeBoard(board); }+});++test('[B29,B31] every replica derives the same implied-fact ids for every supported move id', () => {+ /** Build one board the same way on each replica, with a fixed clock. */+ const replica = () => {+ let at = Date.parse('2026-10-17T00:00:00.000Z');+ const board = store.openBoard(':memory:', { now: () => new Date(at += 1000) });+ store.register(board, { lane: 'coordinator', path: '/repo' });+ store.register(board, { lane: 'web', path: '/repo-web-1' });+ const one = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'One' });+ const two = store.addItem(board, { by: 'coordinator', lane: 'web', title: 'Two' });+ return { board, one, two };+ };+ for (const [path, length] of [1, 72, 73, 80].flatMap((n) => [['fact', n], ['answer', n]])) {+ const id = 'm'.repeat(length);+ const ids = [];+ for (const side of [replica(), replica()]) {+ try {+ const ask = store.shout(side.board, { from: 'web-1', to: 'coordinator', text: 'Which way?', decision: true, lanes: ['web'] });+ const move = path === 'fact'+ ? prepareEngineMove(side.board, 'appendFact', [side.one, { agentId: 'coordinator', kind: 'decision', text: `Boundary ${length}`, implies: [side.two] }], { id, actor: 'coordinator' })+ : prepareEngineMove(side.board, 'answerDecision', [ask, { agentId: 'coordinator', text: `Boundary ${length}`, lanes: ['web'], implies: [side.two] }], { id, actor: 'coordinator' });+ const applied = applyEngineMove(side.board, move, { sequence: 1, at: '2026-10-17T00:00:30.000Z' });+ assert.equal(applied.error, undefined, JSON.stringify(applied.error));+ ids.push(store.itemThread(side.board, side.two).filter((entry) => entry.type === 'fact' && entry.decision).map((entry) => entry.id));+ } finally { store.closeBoard(side.board); }+ }+ assert.equal(ids[0].length, 1, `a ${length}-character ${path} move id implies one fact`);+ assert.deepEqual(ids[0], ids[1], `a ${length}-character ${path} move id gives the same implied-fact id on both replicas`);+ assert.ok(ids[0][0].length <= 80, `the implied-fact id fits a fact id: ${ids[0][0]}`);+ }+});diff --cc test/pending-refreeze.test.jsindex b1972e1a,7191bfc2..d5297661--- a/test/pending-refreeze.test.js+++ b/test/pending-refreeze.test.js@@@ -261,7 -261,7 +261,7 @@@ async function checkDependencyLegacyCli}test('dependency edits replay the same on every engine [B3,V2,H16]', async (t) => {- assert.equal(ENGINE_VERSION, 18);- assert.equal(ENGINE_VERSION, 19);++ assert.equal(ENGINE_VERSION, 20);const directory = mkdtempSync(join(tmpdir(), 'pullboard-dependency-engines-'));const cleanup = [];t.after(() => {