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
fix(blueprint): starters find each version's own rows [S1,I1]
Corey Olsonc74628902662
diff --cc docs/api.mdindex 2a1d12d0,68262013..03a192f0--- a/docs/api.md+++ b/docs/api.md@@@ -142,10 -125,9 +142,11 @@@ For example: `flow: review wait averag| `spec check` | `version:number`, `rows:array` || `spec view` | `version:number`, `path:string` || `spec show` | `version:number`, `row:object`, `standing:object` |+ | `blueprint starters` | `version:number`, `blueprint:object`, `starters:array` || `spec draft` | `version:number`, `id:string`, `row:object` || `blueprint add` | `version:number`, `blueprint:object`, `section:string`, `rows:array`, `items:array`, `gate:string\|null`, `proposedLanes:array` |+| `blueprint fit` | `version:number`, `proposals:array` |+| `spec fit` | `version:number`, `proposals:array` || `spec unmet` | `version:number`, `rows:array` || `spec signoff` | `version:number`, `count:number`, `by:string`, `ids:array`, `evidence:array` || `spec signers` | `version:number`, `added:boolean`, `by:string`, `path:string`, `initial:boolean` |@@@ -368,14 -337,12 +369,16 @@@ Decision moves keep the CLI's routing:Only the coordinator runs `spec apply`. It preflights every pending row against the exact source text, refusing stale decisions before writing any file. Approval changes the status to `approved`; decline changes it to `wont` with the person's reason as the row text, preserving trailing fields. SSH-enabled approvals carry one signed `row-decision` receipt binding the file, source, replacement, decision, reason and row text. Apply copies that same receipt into `.pullboard/signoffs.jsonl`; it remains a current exact-text sign-off. Commit the changed files and receipts together.+`init` and `blueprint add` take `--blueprint` more than once, and the blueprints land in the order given. A board takes at most one product blueprint and one architecture blueprint, and any number of practice and beyond-code ones; a second product or architecture blueprint is refused with `BLUEPRINT_KIND_TAKEN`, naming both, before anything is written, whether the first is named in the same command or already on the board. Every blueprint leaves `<!-- pullboard-blueprint-kind <name> <kind or none> -->` beside its rows, which is how a later command finds it. A blueprint an older Pullboard added has its marker alone: its kind is read from the bundled file of that name, else from `<name>.json` or `<name>.blueprint.json` at the repo root; failing both, its kind is unknown, and a product or architecture blueprint is refused with `BLUEPRINT_KIND_TAKEN` naming both until the person records the kind by adding that blueprint's file again. Adding the blueprint the board already has again changes nothing but that kind line and is no clash. A rule or question whose row text an earlier blueprint in the same command drafted is drafted once: the later blueprint cites that row and lists it in `shared` as `{ key, id }`. Each starter item in `items` carries `blueprint`, the name of the blueprint that filed it, and its add appends a `note` fact `blueprint starter: {"blueprint":"<name>","version":<version>,"key":"<key>"}` to the item. With several blueprints, `blueprint add` returns the first blueprint's fields with every blueprint's `rows`, `items`, `proposedLanes` and `checksNotRun`, and each one's own result in `blueprints`; `init` returns the first in `blueprint` and all of them in `blueprints`.+To answer a pending question row (`<ask>: <default>. Choices: a, b.`, as `blueprint add` writes it), the person runs `spec answer <id> "<choice or text>"`, or the local view sends `spec-answer` with `args: {row: "B1", answer: "Postgres"}`. A listed choice matches in any case and keeps its listed spelling; other text joins the choices last. It refuses agent shells, agent worktrees and the API channel, records the same exact-row approval receipt, whose JSON `decisions` carry an `answer` read back from the signed text (never stored on its own), and the row leaves pending when the coordinator runs `spec apply`. `spec check` errors on a question that was pending at the trunk tip and now differs with no matching person decision.+`blueprint fit <name or file> <row id or #item> keep|adapt|drop|answer [--text "..."] [--reason "why"]` records a seat's fit proposal for one row, question or open starter item of a blueprint fully added to this board. Proposals are unverified drafts in `blueprint-fit.json` beside the board; nothing changes until the person reads `spec fit`, edits if needed, and approves the exact batch code with `spec fit approve <batch>`. Approval refuses the proposer, non-person channels, rewritten readings, and any proposal added, removed or changed since the person's reading. Row decisions preserve the proposal reason and blueprint source in their note; starter adaptations change the criterion and drops withdraw the item after recording a decision fact. The local view/API state carries the waiting batch and per-row/item fit status.+To approve new wording, the person uses `spec approve <one-id> --text "exact proposed text"`, or `spec-approve` with `args: {ids: "G1", text: "exact proposed text"}`. This records the same exact-row receipt; files wait for coordinator apply. Text must be one nonempty line without a field separator. Pre-commit checks the staged row against that person decision or a verified staged SSH sign-off; unstaged receipts cannot authorize a commit.+ `blueprint starters <name or file>` lists a blueprint's starter items and whether each is on this board. Each entry in `starters` is `{ key, title, filed, id, status }`: a filed starter is the item this blueprint's add filed for it, with its id and status, and an unfiled one has `id` and `status` null. When `blueprint add` files a starter it appends a `note` fact to the item, `blueprint starter: {"blueprint":"<name>","version":<version>,"key":"<key>"}`, and `blueprint starters` counts only items whose link names the same blueprint, version and starter key. An item with no such fact, filed before adds recorded one, counts only when no linked item names the starter and it carries the starter's title and cites exactly the rows that blueprint's add numbered for the starter's keys. `blueprint starters` reads the board and changes nothing. A repeat `blueprint add` of a version already on the board returns `marked: true` with empty `rows` and `items`, changes no file and records no board event. `init --blueprint` adds `blueprint.marked` and `blueprint.waitingRows`, every row that waits for the person as `{ id, status, text, file }`: the blueprint's new SPEC.md rows, then each draft or pending doctrine row, such as an inherited standard rule.+A coordinator criterion or check correction on a live claim remains pending until its holder or the coordinator runs `pullboard refreeze <id>`. Renewal and submission refuse with `PENDING_REFREEZE` until then. This refreeze keeps the holder, lease and claim base, and returns `retainedClaim: true` in JSON.Doctor and resume report every stale frozen item after cited text changes. Open, claimed and submitted items suggest coordinator refreeze. Verified and merged items keep their receipts, report that they shipped against the old text, and suggest adding a follow-up citing the changed row. Resume JSON includes these findings in `stale`.diff --cc src/blueprint-report.jsindex 00000000,ed33ede4..c3d75795mode 000000,100644..100644--- a/src/blueprint-report.js+++ b/src/blueprint-report.js@@@ -1,0 -1,203 +1,207 @@@+ /** What blueprint commands report back: a blueprint's starters on this board and the rows that wait [S1,I1]. */++import { readFileSync } from 'node:fs';++import { join } from 'node:path';+ import * as store from './board.js';-import { bundledBlueprints, readBlueprint } from './blueprints.js';++import { blueprintMarker, bundledBlueprints, readBlueprint } from './blueprints.js';+ import { loadConfig } from './config.js';+ import { loadDoctrine } from './doctrine.js';+ import { Refused } from './refused.js';+ import { loadSpec } from './spec.js';++ /**+ * @typedef {object} StarterState+ * @property {string} key - The starter's key in the blueprint.+ * @property {string} title - The starter's title.+ * @property {boolean} filed - The blueprint's own add filed this starter on the board.+ * @property {number | null} id - The filed item's id, or null when it is not filed.+ * @property {string | null} status - The filed item's status, or null when it is not filed.+ */++ /**+ * The row id each rule and question key of a blueprint got on this board, read from its SPEC.md- * section. Blueprint add numbers the rules, then the questions, in blueprint order, as the first- * rows of a section named after the blueprint's title; a row the person rewords or declines keeps- * its id, so the positions still name the same keys. Empty when the blueprint has no section here.++ * section. Blueprint add numbers the rules, then the questions, in blueprint order, as the rows it++ * writes just before its finished marker for that name and version; a row the person rewords or++ * declines keeps its id, so the positions still name the same keys. Why the marker: two versions of++ * one blueprint share a title, so the first section by title is the older version's on an upgraded++ * board (#734 review). The rows are those after the section's heading, or after an earlier++ * blueprint's marker in it, up to this marker. With no marker, the first section by title. Empty++ * when the blueprint has no rows here.+ *- * @param {{ title: string, rules: { key: string }[], questions: { key: string }[] }} blueprint- * @param {{ sections: { name: string }[], rows: { id: string, section: string }[] }} spec - loadSpec's result.++ * @param {{ name: string, version: number, title: string, rules: { key: string }[], questions: { key: string }[] }} blueprint++ * @param {{ sections: { name: string, line: number }[], rows: { id: string, section: string, line: number }[] }} spec - loadSpec's result.++ * @param {string} [source] - SPEC.md's text, where the markers are.+ * @returns {Record<string, string>}+ */-export function blueprintRowIds(blueprint, spec) {- const section = spec.sections.find((entry) => /^[A-Z][A-Z0-9]*\s*[·.:-]/u.test(entry.name)- && entry.name.replace(/^[A-Z][A-Z0-9]*\s*[·.:-]\s*/u, '') === blueprint.title.trim());- if (!section) return {};- const rows = spec.rows.filter((row) => row.section === section.name);++export function blueprintRowIds(blueprint, spec, source = '') {++ const lines = source.split(/\r?\n/u);++ const markerLine = lines.findIndex((line) => line.trim() === blueprintMarker(blueprint)) + 1;++ const titled = (entry) => /^[A-Z][A-Z0-9]*\s*[·.:-]/u.test(entry.name)++ && entry.name.replace(/^[A-Z][A-Z0-9]*\s*[·.:-]\s*/u, '') === blueprint.title.trim();++ let rows;++ if (markerLine) {++ const section = spec.sections.filter((entry) => entry.line < markerLine).at(-1);++ const sectionStart = section?.line ?? 0;++ const earlier = lines.slice(sectionStart, markerLine - 1).reduce((at, line, index) => (/^<!-- pullboard-blueprint \S+ \d+ -->$/u.test(line.trim()) ? sectionStart + index + 1 : at), sectionStart);++ rows = spec.rows.filter((row) => row.line > earlier && row.line < markerLine);++ } else {++ const section = spec.sections.find(titled);++ if (!section) return {};++ rows = spec.rows.filter((row) => row.section === section.name);++ }+ const keys = [...blueprint.rules, ...blueprint.questions].map((entry) => entry.key);+ return Object.fromEntries(keys.flatMap((key, index) => (rows[index] ? [[key, rows[index].id]] : [])));+ }+-/** The start of the note fact blueprint add records on each starter item it files. */++/** The start of the note fact blueprint add records on each starter item it files (blueprintStarterNote). */+ const STARTER_LINK = 'blueprint starter: ';+-/**- * The note fact text blueprint add records on a starter item it files: the blueprint's name and- * version and the starter's key, as JSON after a fixed prefix. Why a fact: an item's title and- * citations can repeat across blueprint versions and unrelated items, so the add itself records- * which starter of which version this item is, and blueprint starters reads that record back.- *- * @param {{ name: string, version: number }} blueprint- * @param {string} key - The starter's key in the blueprint.- * @returns {string}- */-export function starterLinkText(blueprint, key) {- return `${STARTER_LINK}${JSON.stringify({ blueprint: blueprint.name, version: blueprint.version, key })}`;-}-+ /**+ * The starter link an item's thread records, or null when its add recorded none, as on an item+ * filed by hand or by an add from before links were recorded.+ *+ * @param {{ type: string, kind?: string, text?: string }[]} thread - The item's thread, from store.itemThread.+ * @returns {{ blueprint: string, version: number, key: string } | null}+ */+ export function starterLink(thread) {+ for (const entry of thread) {+ if (entry.type !== 'fact' || entry.kind !== 'note' || !entry.text?.startsWith(STARTER_LINK)) continue;+ try {+ const link = JSON.parse(entry.text.slice(STARTER_LINK.length));+ if (typeof link?.blueprint === 'string' && Number.isInteger(link.version) && typeof link.key === 'string') return link;+ } catch (error) {+ // A note that only starts like a link is someone's own words; it links nothing.+ if (!(error instanceof SyntaxError)) throw error;+ }+ }+ return null;+ }++ /**+ * Each of a blueprint's starter items and whether its add filed it on this board. An item is the+ * starter when the link its add recorded names this blueprint, this version and the starter's key.+ * An item with no recorded link at all, filed before adds recorded one, counts only when it carries+ * the starter's title and cites exactly the rows this blueprint's add gave the starter's keys, the+ * identity a resumed add uses; a starter that cites no rows must also match its criterion. That+ * fallback is used only when no linked item names the starter, and an item linked to another+ * blueprint, version or starter never counts. When several items match, a live one is named+ * before a withdrawn one, then the oldest.+ *+ * @param {{ name: string, version: number, items: { key: string, title: string, cites?: string[], criterion?: string }[] }} blueprint+ * @param {Record<string, any>[]} items - Every item on the board, as store.listItems returns them.+ * @param {Record<string, string>} rowIds - Row id by rule or question key, from blueprintRowIds.+ * @param {Map<number, { blueprint: string, version: number, key: string } | null>} links - Each item's recorded link, by item id.+ * @returns {StarterState[]}+ */+ export function starterStates(blueprint, items, rowIds, links) {+ const order = (a, b) => Number(a.item_status === 'withdrawn') - Number(b.item_status === 'withdrawn') || a.item_id - b.item_id;+ return blueprint.items.map((starter) => {+ const title = starter.title.trim();+ const own = items.filter((item) => {+ const link = links.get(item.item_id);+ return link && link.blueprint === blueprint.name && link.version === blueprint.version && link.key === starter.key;+ });+ const cites = starter.cites ?? [];+ const specIds = cites.map((key) => rowIds[key]).filter(Boolean).join(',');+ const cited = cites.length+ ? (item) => specIds.length > 0 && item.item_spec_ids === specIds+ : (item) => item.item_spec_ids === '' && item.item_criterion === (starter.criterion ?? '');+ const unlinked = items.filter((item) => !links.get(item.item_id) && item.item_title === title && cited(item));+ const found = (own.length ? own : unlinked).sort(order)[0];+ const status = found?.item_status ?? null;+ return { key: starter.key, title, filed: Boolean(found), id: found?.item_id ?? null, status };+ });+ }++ /**+ * The lines pullboard blueprint starters prints: a heading with the count filed, then one line per+ * starter that names its item id and status when it is filed.+ *+ * @param {{ name: string, title: string, version: number }} blueprint+ * @param {StarterState[]} starters+ * @returns {string[]}+ */+ export function starterLines(blueprint, starters) {+ const filed = starters.filter((starter) => starter.filed).length;+ const lines = [`${blueprint.title} (version ${blueprint.version}) has ${starters.length} starter ${starters.length === 1 ? 'item' : 'items'}; ${filed} filed on this board`];+ for (const starter of starters) {+ lines.push(starter.filed ? ` #${starter.id} ${starter.status} ${starter.title}` : ` not filed ${starter.title}`);+ }+ if (filed < starters.length) lines.push(`next: file the rest with pullboard blueprint add ${blueprint.name}`);+ return lines;+ }++ /**+ * Every row that waits for the person after init --blueprint: the blueprint's new rows in SPEC.md+ * and each doctrine row still draft or pending, such as a standard rule the repo inherits. Why the+ * doctrine rows: init writes the doctrine file too, and a pending rule there waits for the same+ * person, so a summary of the blueprint's rows alone hides one (the blueprint trial missed PB7).+ *+ * @param {{ id: string, status: string, text: string }[]} rows - The rows the blueprint added.+ * @param {{ rows: { id: string, status: string, text: string, file?: string }[] }} doctrine - loadDoctrine's result.+ * @param {string} specFile - The spec file's name, such as SPEC.md.+ * @returns {{ id: string, status: string, text: string, file: string }[]}+ */+ export function waitingRows(rows, doctrine, specFile) {+ return [+ ...rows.map(({ id, status, text }) => ({ id, status, text, file: specFile })),+ ...doctrine.rows.filter((row) => ['draft', 'pending'].includes(row.status))+ .map(({ id, status, text, file }) => ({ id, status, text, file: file ?? 'doctrine' })),+ ];+ }++ /**+ * The lines init prints for the rows that wait: a count, then one line per row with its file.+ *+ * @param {{ id: string, status: string, text: string, file: string }[]} waiting+ * @returns {string[]}+ */+ export function waitingRowLines(waiting) {+ if (!waiting.length) return [];+ return [` ${waiting.length} ${waiting.length === 1 ? 'row waits' : 'rows wait'} for the person:`,+ ...waiting.map((row) => ` ${row.id} ${row.status} ${row.text} (${row.file})`)];+ }++ /**+ * The rows that wait for the person after init added a blueprint, read from the repo init set up.+ *+ * @param {string} root - The repository root.+ * @param {{ rows: { id: string, status: string, text: string }[] }} added - What the add returned.+ * @returns {{ id: string, status: string, text: string, file: string }[]}+ */+ export function initWaitingRows(root, added) {+ const config = loadConfig(root);+ return waitingRows(added.rows, loadDoctrine(root, config), config.spec);+ }++ /**+ * The line a repeat add prints: the blueprint is already here, and where its starters are listed.+ *+ * @param {{ name: string, title: string, version: number }} blueprint+ * @returns {string}+ */+ export function alreadyAddedLine(blueprint) {+ return `the ${blueprint.title} blueprint (version ${blueprint.version}) is already on this board; nothing added; see its starters with pullboard blueprint starters ${blueprint.name}`;+ }++ /**+ * pullboard blueprint starters <name or file>: list a blueprint's starters and the item each one's+ * add filed. It reads the spec and the board and writes nothing. The caller passes its own context+ * and board opener, so this command reads the board exactly as every other command does.+ *+ * @param {any} io+ * @param {{ second?: string, rest: string[], context: (io: any) => any, withBoard: (ctx: any, work: (board: any) => any) => any }} args+ * @returns {number}+ */+ export function startersCommand(io, { second, rest, context, withBoard }) {+ if (!second || rest.length) throw new Refused('USAGE', `pullboard blueprint starters <name or file>; bundled: ${bundledBlueprints().join(', ')}`);+ const blueprint = readBlueprint(second, io.cwd);+ const ctx = context(io);- const rowIds = blueprintRowIds(blueprint, loadSpec(ctx.info.root, ctx.config));++ const rowIds = blueprintRowIds(blueprint, loadSpec(ctx.info.root, ctx.config), readFileSync(join(ctx.info.root, ctx.config.spec), 'utf8'));+ const starters = withBoard(ctx, (board) => {+ const items = store.listItems(board, { all: true });+ return starterStates(blueprint, items, rowIds, new Map(items.map((item) => [item.item_id, starterLink(store.itemThread(board, item.item_id))])));+ });+ io.result?.({ blueprint: { name: blueprint.name, title: blueprint.title, version: blueprint.version }, starters });+ starterLines(blueprint, starters).forEach((line) => io.say(line));+ return 0;+ }diff --cc src/cli.jsindex f35149a5,bf19ee83..538b21ba--- a/src/cli.js+++ b/src/cli.js@@@ -63,14 -63,11 +63,15 @@@ importunmetRows,} from './spec.js';import { answerQuestion, bundledBlueprints, landBlueprint, planBlueprint, readBlueprint, repoAnswers, saveBlueprint } from './blueprints.js';+import { fitCommand } from './blueprint-fit-command.js';+import { fitSummary, readFitBatch } from './blueprint-fit.js';+import { blueprintStarterNote, combinedSummary, initBlueprintLines, initBlueprintResult, installedBlueprints, landEach, readBlueprints, sharedRowLines } from './blueprint-set.js';import { briefFiles } from './brief.js';import { commitFirst, commitOwnerLines, commitOwners, coordinatorInbox, coordinatorInboxLines, inboxFirst } from './resume.js';-import { checkBaseline, prepareCheckBaseline, sayCheckBaseline, refuseCheckSyntax } from './check-baseline.js';+import { checkBaseline, prepareCheckBaseline, refuseCheckSyntax, sayCheckBaseline } from './check-baseline.js';+import { checkAcceptCommand, refuseClaimProvesNothing, refuseProvesNothing } from './check-accept.js';import { retryCheckBaselines, startCheckBaseline } from './check-baseline-worker.js';-import { alreadyAddedLine, initWaitingRows, startersCommand, starterLinkText, waitingRowLines } from './blueprint-report.js';++import { alreadyAddedLine, initWaitingRows, startersCommand, waitingRowLines } from './blueprint-report.js';import { compareMainFailures, mainRedMessage, mainRedReworkItems } from './main-red.js';import { runItems } from './run.js';import { parseProblems, sweepItems } from './sweep.js';@@@ -1699,19 -1701,20 +1700,27 @@@ function setupCommands(io, { first, sec{ lane: COORDINATOR, path: info.root, model },]));// Keep blueprint initialization and the person's unwritten lane proposals in the same result.- const added = blueprint ? await addBlueprintHere(io, values.blueprint, { report: false, blueprint }) : null;- io.result?.({ root: info.root, notes, proposedLanes: proposeLanes(info.root),- ...(added ? { blueprint: { name: added.blueprint.name, title: added.blueprint.title, marked: added.marked, waitingRows: initWaitingRows(info.root, added),- section: added.section, waiting: added.rows.length, items: added.items.length, gate: added.gate, checksNotRun: added.checksNotRun } } : {}) });+ const landed = await landEach(blueprints, ({ reference, blueprint }, drafted) => addBlueprintHere(io, reference, { report: false, blueprint, drafted }));++ // Every row that waits for the person once, the blueprints' new rows and the doctrine's pending rows alike (#734).++ const fresh = landed.filter((added) => !added.marked);++ const waiting = landed.length ? initWaitingRows(info.root, { rows: fresh.flatMap((added) => added.rows) }) : [];++ const blueprintResult = (added) => ({ ...initBlueprintResult(added), marked: added.marked, waitingRows: waiting });+ const result = { root: info.root, notes, proposedLanes: proposeLanes(info.root),- ...(landed.length ? { blueprint: initBlueprintResult(landed[0]), blueprints: landed.map(initBlueprintResult) } : {}) };++ ...(landed.length ? { blueprint: blueprintResult(landed[0]), blueprints: landed.map(blueprintResult) } : {}) };+ io.result?.(result);const staging = notes.at(-1)?.startsWith('git add -f -- ') ? notes.at(-1) : null;(staging ? notes.slice(0, -1) : notes).forEach((note) => io.say(note));- for (const added of landed) initBlueprintLines(added, askedLaneNotes(added.items, loadConfig(info.root))).forEach((line) => io.say(line));- if (added && !added.marked) {- io.say(`added the ${added.blueprint.title} blueprint: ${added.rows.length} ${added.rows.length === 1 ? 'row waits' : 'rows wait'} for your approval in SPEC.md (${added.section}), `- + `${added.items.length} starter ${added.items.length === 1 ? 'item' : 'items'} filed${added.proposedLanes.length ? ` in the ${added.proposedLanes.map((lane) => lane.name).join(' and ')} lane, proposed above and not written until the person accepts` : ''}${added.gate ? `, gate set to ${added.gate}` : ''}`);- for (const note of askedLaneNotes(added.items, loadConfig(info.root))) io.say(` ${note}`);- if (added.checksNotRun.length) io.say(` checks stored, not run: ${added.checksNotRun.map((id) => `#${id}`).join(', ')}; no check baseline ran, so read each check before work starts: pullboard show <id>`);++ for (const added of landed) {++ if (added.marked) io.say(alreadyAddedLine(added.blueprint));++ else initBlueprintLines(added, askedLaneNotes(added.items, loadConfig(info.root))).forEach((line) => io.say(line));+ }- if (added) (added.marked ? [alreadyAddedLine(added.blueprint)] : waitingRowLines(initWaitingRows(info.root, added))).forEach((line) => io.say(line));++ if (fresh.length) waitingRowLines(waiting).forEach((line) => io.say(line));if (await registerProjectAndLink(info.root, new Date(), loadConfig(info.root), io)) io.say('registered this project on this machine, so pullboard view lists it');+ // Once registered, a background view lists this board for pullboard.dev [H5,N26].+ const view = await keepViewRunning();+ io.result?.({ ...result, view });+ const viewLine = backgroundViewLine(view);+ if (viewLine) io.say(viewLine);io.say(agentSessionDigest()? 'Next: run pullboard resume now to continue setup in this session; the new skills load next session, and setup does not need them.': 'Next: ask your agent to set up Pullboard here; in Claude Code, start a new session first so it loads the Pullboard skills.');@@@ -2542,9 -2490,7 +2551,9 @@@ async function addBlueprint(ctx, boardchecksNotRun: added.filter((item) => item.check).map((item) => item.id) };io.result?.(summary);if (plan.marked) {- io.say(`${blueprint.title} (version ${blueprint.version}) is already on this board; nothing added`);+ io.say(`${blueprint.title} (version ${blueprint.version}) is already on this board; nothing added; see its starters with pullboard blueprint starters ${blueprint.name}`);+ // A board an older Pullboard set up gets the blueprint's kind recorded beside its marker (#720).+ if (plan.specRows !== source) io.say(` recorded its kind (${blueprint.kind ?? 'none'}) in ${ctx.config.spec}; commit ${ctx.config.spec}`);return summary;}io.say(`added ${blueprint.title} (version ${blueprint.version}) as drafts in ${ctx.config.spec}, section ${plan.section.name}`);@@@ -4104,12 -3934,8 +4113,13 @@@ async function runCommand(argv, io)for (const entry of left) io.say(` left out ${entry.id}: ${entry.reason}`);return 0;}+ if (command === 'blueprint' && first === 'starters') return startersCommand(io, { second, rest, context, withBoard });if (command === 'gate') {+ if (first !== undefined || second !== undefined || rest.length > 0) {+ const words = [first, second, ...rest].filter((word) => word !== undefined);+ const next = 'use pullboard resources for status, or pullboard gate with no extra words to run the gate';+ throw new Refused('GATE_ARGUMENT', `pullboard gate does not accept extra words: ${words.join(' ')}. Use pullboard resources for status, or pullboard gate with no extra words to run the gate.`, next);+ }const ctx = context(io);let config;try { config = mainPolicy(ctx.info.root).config; }diff --cc src/help.jsindex 6e1a824d,f50e7173..5d2d44ae--- a/src/help.js+++ b/src/help.js@@@ -192,13 -173,12 +192,15 @@@ Spe[--doctrine --source "<shout id or chat, date>"] the coordinator proposes a sourced doctrine ruling--section chooses the section prefix; defaults to G, or DR with --doctrineDefaults to must and gate review.- pullboard blueprint add <name or file> add a blueprint's rules and questions as drafts, and its starter items+ pullboard blueprint add <name or file> [--blueprint <name or file>]... add a blueprint's rules and questions as drafts, and its starter itemsbundled: web-app; nothing is approved, and a repeat adds nothing+ several land in order: one product, one architecture, any practice; a shared rule is drafted once+ pullboard blueprint fit <name or file> <row id or #item> keep|adapt|drop|answer [--text "..."] [--reason "why"] propose this repo's fit; nothing applies yet+ pullboard spec fit [approve <batch>] | fit edit <row id or #item> keep|adapt|drop|answer [--text "..."] [--reason "why"] the person's fit batchpullboard blueprint save [file] [--name <name>] [--title "<title>"] write approved rules and answered questions as a blueprintnever items, notes, paths, emails or names; file defaults to <project>.blueprint.json+ pullboard blueprint starters <name or file> list a blueprint's starter items and whether each is filed+ a filed starter shows its item id and status; add links each starter it files with a note factpullboard spec signers add [--key <path>] [--by <principal>] opt into SSH-signed sign-offsprincipal defaults to Git user.email; --by overrides itpullboard spec approve <ids> | decline <ids> --reason "why" the person's exact-row decision@@@ -226,11 -206,11 +228,11 @@@ Reject reasons: TEST_FAILURE, BEHAVIOR_const HELP_NAMES = ['tour', 'init', 'worktree', 'join', 'takeover', 'whoami', 'lanes', 'lane', 'lane add', 'status', 'resources', 'settings', 'view', 'view export','serve', 'mcp', 'relay', 'relay recover', 'resume', 'hooks', 'add', 'edit', 'escalate', 'run', 'list', 'doctor', 'health', 'skills', 'show', 'next', 'land',- 'check', 'claim', 'release', 'submit', 'done', 'verify', 'fact', 'why', 'shout', 'answer', 'pass', 'decisions', 'inbox', 'export', 'import',- 'sweep', 'merged', 'withdraw', 'refreeze', 'reopen', 'hold', 'stats', 'ledger', 'log', 'spec', 'spec check', 'spec view',+ 'check', 'check accept', 'claim', 'release', 'submit', 'done', 'verify', 'fact', 'why', 'shout', 'answer', 'pass', 'decisions', 'inbox', 'watch', 'export', 'digest', 'import',+ 'sweep', 'merged', 'withdraw', 'refreeze', 'reopen', 'hold', 'stats', 'ledger', 'log', 'rigor', 'rigor draft', 'spec', 'spec check', 'spec view',- 'spec show', 'spec unmet', 'spec signoff', 'spec draft', 'spec signers', 'spec signers add', 'doctrine', 'doctrine check', 'forget', 'prompt', 'gate', 'hook',+ 'spec show', 'spec unmet', 'spec signoff', 'spec draft', 'blueprint starters', 'spec signers', 'spec signers add', 'doctrine', 'doctrine check', 'forget', 'prompt', 'gate', 'hook','hook pre-commit', 'hook pre-merge-commit', 'hook commit-msg', 'hook pre-push', 'view export', 'version', 'lifecycle', 'help',- 'roadmap', 'milestone', 'runner', 'runner add', 'blueprint', 'blueprint add', 'blueprint save',+ 'roadmap', 'milestone', 'runner', 'runner add', 'blueprint', 'blueprint add', 'blueprint fit', 'blueprint save', 'spec fit',];const HELP_GROUPS = [@@@ -267,10 -242,8 +269,10 @@@ const HELP_EXAMPLES ='spec check': 'pullboard spec check',doctrine: 'pullboard doctrine check', 'doctrine check': 'pullboard doctrine check','spec view': 'pullboard spec view', 'spec show': 'pullboard spec show G1',- 'spec draft': 'pullboard spec draft "Describe the first requirement"',+ 'spec draft': 'pullboard spec draft "Describe the first requirement"', 'blueprint starters': 'pullboard blueprint starters web-app','blueprint add': 'pullboard blueprint add web-app', 'blueprint save': 'pullboard blueprint save',+ 'blueprint fit': 'pullboard blueprint fit web-app G1 keep --reason "the repository already meets this row"',+ 'spec fit': 'pullboard spec fit','spec unmet': 'pullboard spec unmet', 'spec signoff': 'pullboard spec signoff G1','spec signers add': 'pullboard spec signers add', help: 'pullboard help claim', version: 'pullboard --version',};diff --cc src/json.jsindex 5e438398,aa027064..684bdc0e--- a/src/json.js+++ b/src/json.js@@@ -85,10 -79,9 +85,11 @@@ export const JSON_SHAPES ='spec check': shape({ rows: 'array' }),'spec view': shape({ path: 'string' }),'spec show': shape({ row: 'object', standing: 'object' }),+ 'blueprint starters': shape({ blueprint: 'object', starters: 'array' }),'spec draft': shape({ id: 'string', row: 'object' }),'blueprint add': shape({ blueprint: 'object', section: 'string', rows: 'array', items: 'array', gate: 'string|null', proposedLanes: 'array' }),+ 'blueprint fit': shape({ proposals: 'array' }),+ 'spec fit': shape({ proposals: 'array' }),'spec unmet': shape({ rows: 'array' }),'spec signoff': shape({ count: 'number', by: 'string', ids: 'array', evidence: 'array' }),'spec signers': shape({ added: 'boolean', by: 'string', path: 'string', initial: 'boolean' }),diff --cc src/templates.jsindex a7f7c248,4d150669..9480ef89--- a/src/templates.js+++ b/src/templates.js@@@ -105,10 -103,10 +105,12 @@@ This repo runs on pullboard: a work boa**Source of truth.** \`SPEC.md\` holds every requirement as a row with an id, like \`G1.2\`. Code follows the spec. Commits cite the ids they serve: \`feat(scope): subject [G1.2]\`. Only a person approves or changes an approved row. Ids are permanent: a row the person cuts stays, marked \`wont\` (won't build), so every commit that cites it keeps its meaning. Propose each requirement with \`pullboard spec draft "<text>"\`; it returns the draft row id for the person to approve. To start from a blueprint's rules, questions and starter items, run \`pullboard blueprint add <name or file>\` (bundled: web-app); it files them all as drafts for the person to approve. Its questions file as pending rows, each with a default answer and its choices: the person answers one with \`pullboard spec answer <id> "<choice or text>"\` from the main checkout or the view, and the coordinator writes it with \`pullboard spec apply\`. Never answer a question by editing SPEC.md; spec check flags it. To share this board's approved rules and answered questions as a blueprint, run \`pullboard blueprint save [file]\`; it never writes items, notes, paths, emails or names.+ **Blueprint starters.** To see which of a blueprint's starter items are on the board, run \`pullboard blueprint starters <name or file>\`; it names each filed item's id and status. \`pullboard init --blueprint\` lists every row that waits for the person, doctrine rows included.+**Doctrine.** Our house rules for agentic development. This repo inherits Pullboard standard doctrine version 1. ${doctrine.repo ? doctrine.name : DOCTRINE_FILE} adds the repo's own rows, overrides a standard rule by its PB id, or declines it with a wont row and its reason as the row text: - PB7 [wont] <why>. Approved rows are in force; follow them as you would the spec. A rule with \`gate: check <command>\` and \`count: N\` holds a count that only falls: run pullboard doctrine check to see each count, and submit refuses RATCHET_ROSE when a touched rule rises or a changed file gains a problem. Lower \`count:\` in a commit when you fix problems; only the person raises it. Run pullboard spec --json to read the current merged rules. Re-run pullboard init after changing the doctrine to refresh this managed guidance.+**Fit a blueprint.** After \`blueprint add\`, a seat can propose how each drafted row, question and starter item fits this repository with \`pullboard blueprint fit <name or file> <row id or #item> keep|adapt|drop|answer\`. Include \`--text\` for adapted wording or an answer, and \`--reason\` for why. The proposals remain drafts until the person reads \`pullboard spec fit\`, optionally edits one with \`pullboard spec fit edit <row id or #item> keep|adapt|drop|answer\`, and approves the batch with its printed code using \`pullboard spec fit approve <batch>\`. The proposer cannot run the person-only edit or approval commands.+### Current doctrine${doctrineText(doctrine)}diff --cc test/api.test.jsindex 0be6c4c3,65e5eca5..7c3047ba--- a/test/api.test.js+++ b/test/api.test.js@@@ -625,9 -624,11 +625,11 @@@ test('[A1] command results match the cajson(box, repo, 'spec', ['view', '--out', join(box.dir, 'spec.html')], 'view');json(box, repo, 'spec', ['show', 'G1'], 'show');json(box, repo, 'spec', ['unmet'], 'unmet');+ const catalogStarters = json(box, repo, 'blueprint', ['starters', 'web-app'], 'starters').starters;+ assert.ok(catalogStarters.length && catalogStarters.every((starter) => !starter.filed && starter.id === null), 'blueprint starters lists unfiled starters with no id');assert.equal(json(box, repo, 'spec', ['draft', 'A draft API catalogue row'], 'draft').id, 'G2');- writeFileSync(join(box.dir, 'catalog-blueprint.json'), `${JSON.stringify({ blueprint: 1, name: 'catalog', title: 'Catalog', version: 1, rules: [{ key: 'R1', text: 'A catalog rule.', why: 'the API lists it.' }] })}\n`);- assert.equal(json(box, repo, 'blueprint', ['add', join(box.dir, 'catalog-blueprint.json')], 'add').rows[0].status, 'draft');+ for (const [name, kind, rules] of [['catalog', undefined, [['R1', 'A catalog rule.']]], ['catalog-practice', 'practice', [['R1', 'A catalog rule.'], ['R2', 'A practice catalog rule.']]]]) writeFileSync(join(box.dir, `${name}-blueprint.json`), `${JSON.stringify({ blueprint: 1, name, title: name, version: 1, kind, rules: rules.map(([key, text]) => ({ key, text, why: 'the API lists it.' })) })}\n`);+ assert.deepEqual((({ rows, blueprints }) => [rows[0].status, rows.length, blueprints.length, blueprints[1].shared.length])(json(box, repo, 'blueprint', ['add', join(box.dir, 'catalog-blueprint.json'), '--blueprint', join(box.dir, 'catalog-practice-blueprint.json')], 'add')), ['draft', 2, 2, 1], 'two blueprints in one add land as one result, a shared rule drafted once (#720)');mkdirSync(join(repo, 'test'));writeFileSync(join(repo, 'test', 'proof.test.js'), "import { test } from 'node:test';\ntest('proof [G1]', () => {});\n");box.git(repo, 'add', 'SPEC.md', 'test/proof.test.js');diff --cc test/blueprint.test.jsindex c2cd1bf6,faefd3fb..ae902c5d--- a/test/blueprint.test.js+++ b/test/blueprint.test.js@@@ -7,6 -6,6 +7,7 @@@ import { join, resolve } from 'node:patimport { after, test } from 'node:test';import { runFixtureChild, runFixtureGit } from './fixture-child.js';import { bundledBlueprints, readBlueprint, validateBlueprint } from '../src/blueprints.js';++import { blueprintRowIds, starterStates } from '../src/blueprint-report.js';import { parseSpec } from '../src/spec.js';import { createE2eHelpers } from './e2e-helpers.js';@@@ -566,6 -556,99 +567,122 @@@ test('bundled blueprint rows carry theiassert.equal(saved.blueprint.rules.length, 5);});+ test('blueprint commands say what they did [S1,I1]', () => {+ // Every file's bytes outside Git's object store, and every board event, so a repeat add is proven to change nothing.+ const snapshot = (box) => {+ const files = readdirSync(box.repo, { recursive: true, withFileTypes: true })+ .filter((entry) => entry.isFile())+ .map((entry) => join(entry.parentPath, entry.name))+ .filter((path) => !path.includes(`${join('.git', 'objects')}`) && !/board\.sqlite/u.test(path))+ .sort()+ .map((path) => [path, readFileSync(path).toString('base64')]);+ return { files, events: json(box, 'log').events };+ };++ // Before any add, every starter is listed and none is filed, even with an older unrelated item+ // filed under a starter's title that cites no blueprint row (review 12394).+ const box = freshBoard();+ const decoy = json(box, 'add', 'coordinator', PUBLISHED.items[0].title).item;+ assert.equal(decoy.item_spec_ids ?? '', '', 'the unrelated item cites no row');+ // A row that exists before the add, and an older item under another starter's title citing it.+ const existingRow = json(box, 'spec', 'draft', 'A requirement written before the blueprint').id;+ const citing = json(box, 'add', 'coordinator', PUBLISHED.items[1].title, '--specs', existingRow).item;+ assert.equal(citing.item_spec_ids, existingRow, 'the second unrelated item cites the row that was there first');+ const unfiled = json(box, 'blueprint', 'starters', 'web-app');+ assert.deepEqual(unfiled.blueprint, { name: 'web-app', title: 'Web app', version: 1 });+ assert.deepEqual(unfiled.starters.map((starter) => [starter.title, starter.filed, starter.id]), PUBLISHED.items.map((item) => [item.title, false, null]));+ const unfiledText = box.run('blueprint', 'starters', 'web-app');+ assert.equal(unfiledText.status, 0, unfiledText.stdout + unfiledText.stderr);+ for (const item of PUBLISHED.items) assert.ok(unfiledText.stdout.split('\n').includes(` not filed ${item.title}`), `${item.title} is listed as not filed:\n${unfiledText.stdout}`);++ // A second add says it is already there, and no file byte and no board event changes.+ const firstAdd = json(box, 'blueprint', 'add', 'web-app');+ assert.equal(firstAdd.items.length, PUBLISHED.items.length, 'the add files every starter');+ const before = snapshot(box);+ const again = box.run('blueprint', 'add', 'web-app');+ assert.equal(again.status, 0, again.stdout + again.stderr);+ assert.match(again.stdout, /^Web app \(version 1\) is already on this board; nothing added/mu, 'a second add says so');+ assert.match(again.stdout, /pullboard blueprint starters web-app/u, 'a second add points at its starters');+ const repeat = json(box, 'blueprint', 'add', 'web-app');+ assert.deepEqual([repeat.marked, repeat.rows, repeat.items, repeat.gate], [true, [], [], null]);+ const after = snapshot(box);+ assert.deepEqual(after.files, before.files, 'a second add changes no file bytes');+ assert.deepEqual(after.events, before.events, 'a second add records no board event');++ // Once added, each starter names the item its add filed, never the unrelated same-title item.+ const filed = json(box, 'blueprint', 'starters', 'web-app').starters;+ assert.equal(filed.length, PUBLISHED.items.length, 'every starter is listed');+ const filedText = box.run('blueprint', 'starters', 'web-app').stdout.split('\n');+ for (const [index, item] of PUBLISHED.items.entries()) {+ const own = firstAdd.items.find((entry) => entry.key === item.key);+ assert.ok(own && own.id !== decoy.item_id, `${item.title} was filed by the add as its own item`);+ assert.notEqual(filed[index].id, decoy.item_id, `${item.title} never names the unrelated item #${decoy.item_id}`);+ assert.deepEqual([filed[index].title, filed[index].filed, filed[index].id, filed[index].status], [item.title, true, own.id, 'open']);+ assert.ok(filedText.includes(` #${own.id} open ${item.title}`), `${item.title} shows its id:\n${filedText.join('\n')}`);+ }+ assert.ok(!filedText.some((line) => line.startsWith(` #${decoy.item_id} `)), `the unrelated item is never listed:\n${filedText.join('\n')}`);+ assert.ok(!filed.some((starter) => starter.id === citing.item_id), 'an item citing a row from before the add is never the starter');++ // Two versions of one blueprint, the same title and starter: each version names the item it filed.+ const versioned = join(box.dir, 'versioned.json');- const firstVersion = { ...PUBLISHED, name: 'versioned', title: 'Versioned plan', version: 1, items: [PUBLISHED.items[0]] };++ // No kind: web-app already holds its kind on this board, and a blueprint of a kind already taken is refused (#720).++ const firstVersion = { ...PUBLISHED, name: 'versioned', title: 'Versioned plan', version: 1, kind: undefined, items: [PUBLISHED.items[0]] };+ writeFileSync(versioned, JSON.stringify(firstVersion));+ const one = json(box, 'blueprint', 'add', versioned).items[0];+ writeFileSync(versioned, JSON.stringify({ ...firstVersion, version: 2 }));+ const two = json(box, 'blueprint', 'add', versioned).items[0];+ assert.notEqual(two.id, one.id, 'version 2 files its own starter');+ const forTwo = json(box, 'blueprint', 'starters', versioned);+ assert.deepEqual([forTwo.blueprint.version, forTwo.starters[0].id], [2, two.id], 'version 2 names the item version 2 filed');+ writeFileSync(versioned, JSON.stringify(firstVersion));+ assert.equal(json(box, 'blueprint', 'starters', versioned).starters[0].id, one.id, 'version 1 names the item version 1 filed');++ // init --blueprint lists every row that waits for the person, the inherited doctrine row PB7 included.+ const started = emptyRepo();+ const init = started.run('init', '--blueprint', 'web-app');+ assert.equal(init.status, 0, init.stdout + init.stderr);+ const waiting = JSON.parse(started.run('spec', '--json').stdout).rows.filter((row) => ['draft', 'pending'].includes(row.status));+ const doctrineRows = waiting.filter((row) => row.file !== 'SPEC.md');+ const specRows = waiting.filter((row) => row.file === 'SPEC.md');+ assert.ok(doctrineRows.some((row) => row.id === 'PB7' && row.status === 'pending'), 'the standard doctrine has PB7 pending');+ assert.equal(specRows.length, PUBLISHED.rules.length + PUBLISHED.questions.length);+ const lines = init.stdout.split('\n');+ for (const row of doctrineRows) assert.ok(lines.includes(` ${row.id} ${row.status} ${row.text} (${row.file})`), `init names doctrine row ${row.id}:\n${init.stdout}`);+ for (const row of specRows) assert.ok(lines.includes(` ${row.id} ${row.status} ${row.text} (SPEC.md)`), `init names spec row ${row.id}:\n${init.stdout}`);+ assert.ok(lines.includes(` ${waiting.length} rows wait for the person:`), `init counts every waiting row:\n${init.stdout}`);+ const fromJson = emptyRepo().run('init', '--blueprint', 'web-app', '--json');+ assert.equal(fromJson.status, 0, fromJson.stdout + fromJson.stderr);+ assert.deepEqual(JSON.parse(fromJson.stdout).blueprint.waitingRows.map((row) => row.id).sort(), waiting.map((row) => row.id).sort(), 'the JSON lists the same waiting rows');++ // A second init --blueprint says the blueprint is already there.+ const reinit = started.run('init', '--blueprint', 'web-app');+ assert.equal(reinit.status, 0, reinit.stdout + reinit.stderr);+ assert.match(reinit.stdout, /the Web app blueprint \(version 1\) is already on this board; nothing added/u);+ assert.doesNotMatch(reinit.stdout, /added the Web app blueprint/u);+ });+++test('blueprint starters reads its own version on a board added before starter links [S1,I1]', () => {++ // An older Pullboard filed starters with no link note (review of #734, the v1/v2 upgrade counter): two versions of one++ // custom blueprint, one title and one starter. Read back with no links, each version must still find the item it filed.++ const box = freshBoard();++ const file = join(box.dir, 'versioned.json');++ const first = { ...PUBLISHED, name: 'versioned', title: 'Versioned plan', version: 1, items: [PUBLISHED.items[0]] };++ writeFileSync(file, JSON.stringify(first));++ const one = json(box, 'blueprint', 'add', file).items[0];++ writeFileSync(file, JSON.stringify({ ...first, version: 2 }));++ const two = json(box, 'blueprint', 'add', file).items[0];++ assert.notEqual(two.id, one.id, 'version 2 files its own starter');++ const source = readFileSync(join(box.repo, 'SPEC.md'), 'utf8');++ const spec = parseSpec(source);++ const items = json(box, 'list', '--all').items;++ const unlinked = new Map();++ for (const [version, id] of [[1, one.id], [2, two.id]]) {++ const blueprint = { ...first, version };++ const [found] = starterStates(blueprint, items, blueprintRowIds(blueprint, spec, source), unlinked);++ assert.deepEqual([found.filed, found.id], [true, id], `version ${version} names the item version ${version} filed, never the other version's`);++ }++});++test('blueprint add files a blueprint as drafts after an add stopped part way [S1,I1]', () => {// A finished add on one board gives the exact rows; a second board is left where an add stops// after its rows and first starter: the rows and the under-way marker written, item 1 added.