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/720-claude
Corey Olson53fbdc4d1200
diff --cc docs/api.mdindex 1ef5b00d,6a7705cc..5a645c7c--- a/docs/api.md+++ b/docs/api.md@@@ -291,8 -334,6 +334,8 @@@ 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 (kind `infrastructure` fills the architecture slot), 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. A product or architecture blueprint leaves `<!-- pullboard-blueprint-kind <name> <kind> -->` beside its rows, which is how a later command finds it; a board added before that line existed is read from its bundled blueprint markers. Adding the blueprint the board already has again changes nothing 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`.++`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. A product or architecture blueprint leaves `<!-- pullboard-blueprint-kind <name> <kind> -->` beside its rows, which is how a later command finds it; a board added before that line existed is read from its bundled blueprint markers. Adding the blueprint the board already has again changes nothing 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.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.diff --cc src/blueprint-set.jsindex 0f81d935,00000000..2766ff87mode 100644,000000..100644--- a/src/blueprint-set.js+++ b/src/blueprint-set.js@@@ -1,149 -1,0 +1,148 @@@+/**+ * Several blueprints in one init or blueprint add [S1,I1]: --blueprint repeats, and the blueprints+ * land in the order given. A board takes at most one product blueprint and one architecture+ * blueprint, one per deployable (research U110), and any number of practice and beyond-code ones.+ * A rule or question text two of them share is drafted once, by the first, and the later blueprint+ * cites that row. Every starter item keeps the name of the blueprint that filed it.+ */+import { existsSync, readFileSync } from 'node:fs';+import { join } from 'node:path';+import { bundledBlueprints, readBlueprint } from './blueprints.js';+import { CONFIG_FILE } from './config.js';+import { Refused } from './refused.js';++/**- * The kinds a board takes one of, by the slot each fills. Why infrastructure fills the- * architecture slot: the bundled serverless and data-pipeline blueprints say infrastructure today,- * and #719 renames that kind to architecture, so both spellings name the same slot.++ * The kinds a board takes one of, by the slot each fills. Why infrastructure is here: #719 renamed++ * it architecture and loads it as such, but a kind line written by name still says what it read.+ */+const ONE_PER_BOARD = { product: 'product', infrastructure: 'architecture', architecture: 'architecture' };++/**+ * The slot a blueprint fills, product or architecture, or null for a kind a board takes any number of.+ *+ * @param {{ kind?: string }} blueprint+ * @returns {string | null}+ */+export function blueprintSlot(blueprint) {+ return ONE_PER_BOARD[blueprint.kind] ?? null;+}++/**+ * The product and architecture blueprints a repo's board already has, read from its SPEC.md: the+ * kind line each one's add leaves, and for a board added before that line existed, the marker of a+ * bundled blueprint, whose kind its bundled file says. Nothing when the repo has no spec yet.+ *+ * @param {string} root - The repository root.+ * @returns {{ name: string, slot: string }[]}+ */+export function installedBlueprints(root) {+ let specFile = 'SPEC.md';+ try { specFile = JSON.parse(readFileSync(join(root, CONFIG_FILE), 'utf8')).spec ?? specFile; }+ catch (error) {+ // No pullboard.json yet, or one init will refuse on its own: the default spec file is read.+ if (!(error instanceof SyntaxError) && error?.code !== 'ENOENT') throw error;+ }+ const file = join(root, String(specFile));+ if (!existsSync(file)) return [];+ const found = new Map();+ const bundled = bundledBlueprints();+ for (const line of readFileSync(file, 'utf8').split(/\r?\n/u)) {+ const kind = /^<!-- pullboard-blueprint-kind (\S+) (\S+) -->$/u.exec(line.trim());+ const marker = /^<!-- pullboard-blueprint (\S+) \d+(?: adding .*)? -->$/u.exec(line.trim());+ if (kind && blueprintSlot({ kind: kind[2] })) found.set(kind[1], blueprintSlot({ kind: kind[2] }));+ else if (marker && !found.has(marker[1]) && bundled.includes(marker[1])) {+ const slot = blueprintSlot(readBlueprint(marker[1], root));+ if (slot) found.set(marker[1], slot);+ }+ }+ return [...found].map(([name, slot]) => ({ name, slot }));+}++/**+ * Read every named blueprint, in the order given, before anything is written, so an unknown name+ * or a clash leaves the repository as it was. The same blueprint version named twice is read once.+ * A second product or architecture blueprint is refused with BLUEPRINT_KIND_TAKEN naming both,+ * whether the first is named in the same command or already on the board; adding again the+ * blueprint the board already has is no clash, since that add changes nothing.+ *+ * @param {string[]} references - Bundled names or paths, as --blueprint gave them.+ * @param {string} cwd+ * @param {string} command - The command to name in the next step, such as "init".+ * @param {{ name: string, slot: string }[]} [installed] - The board's own, from installedBlueprints.+ * @returns {{ reference: string, blueprint: import('./blueprints.js').Blueprint }[]}+ */+export function readBlueprints(references, cwd, command, installed = []) {+ const read = [];+ for (const reference of references) {+ const blueprint = readBlueprint(reference, cwd);+ if (read.some((entry) => entry.blueprint.name === blueprint.name && entry.blueprint.version === blueprint.version)) continue;+ const slot = blueprintSlot(blueprint);+ const onBoard = slot && installed.find((entry) => entry.slot === slot && entry.name !== blueprint.name);+ if (onBoard) {+ throw new Refused('BLUEPRINT_KIND_TAKEN',+ `${onBoard.name} and ${blueprint.name} are both ${slot} blueprints, and this board already has ${onBoard.name}; a board takes one ${slot} blueprint, so add ${blueprint.name} on a board of its own`,+ `keep ${onBoard.name} and leave ${blueprint.name} out of pullboard ${command}`);+ }+ const holder = slot && read.find((entry) => blueprintSlot(entry.blueprint) === slot);+ if (holder) {+ const keep = read.map((entry) => `--blueprint ${entry.reference}`).join(' ');+ throw new Refused('BLUEPRINT_KIND_TAKEN',+ `${holder.blueprint.name} and ${blueprint.name} are both ${slot} blueprints, and a board takes one ${slot} blueprint; keep one of them: pullboard ${command} ${keep}`,+ `name one ${slot} blueprint: pullboard ${command} ${keep}`);+ }+ read.push({ reference, blueprint });+ }+ return read;+}++/**+ * The result blueprint add gives for several blueprints: the first blueprint's own fields, as one+ * add gives them, with the rows, items, lanes and stored checks of all of them, and each one's own+ * summary in blueprints, in the order they landed.+ *+ * @param {any[]} added - Each blueprint's summary from its add, in order.+ * @returns {any}+ */+export function combinedSummary(added) {+ return { ...added[0], rows: added.flatMap((entry) => entry.rows), items: added.flatMap((entry) => entry.items),+ gate: added.find((entry) => entry.gate)?.gate ?? null, marked: added.every((entry) => entry.marked),+ proposedLanes: [...new Map(added.flatMap((entry) => entry.proposedLanes).map((lane) => [lane.name, lane])).values()],+ checksNotRun: added.flatMap((entry) => entry.checksNotRun), blueprints: added };+}++/**+ * What init's JSON result says about one blueprint it added.+ *+ * @param {any} added - The blueprint's summary from its add.+ * @returns {any}+ */+export function initBlueprintResult(added) {+ return { name: added.blueprint.name, title: added.blueprint.title, section: added.section, waiting: added.rows.length,+ items: added.items.length, gate: added.gate, checksNotRun: added.checksNotRun, shared: added.shared ?? [] };+}++/**+ * The line init and blueprint add print for rows a blueprint shares with one added before it:+ * the rows it cites from there instead of drafting them again. Empty when it shares none.+ *+ * @param {any} added - The blueprint's summary from its add.+ * @returns {string[]}+ */+export function sharedRowLines(added) {+ const shared = added.shared ?? [];+ if (!shared.length) return [];+ return [`${added.blueprint.name} shares ${shared.map((row) => row.id).join(', ')} with an earlier blueprint, so each is drafted once`];+}++/**+ * The note fact blueprint add records on each starter item it files, so the item keeps the name of+ * its blueprint: the blueprint's name and version and the starter's key, as JSON after a fixed+ * prefix. The text is the link #734 reads back with blueprint starters, so either reads the other.+ *+ * @param {{ name: string, version: number }} blueprint+ * @param {string} key - The starter's key in the blueprint.+ * @returns {string}+ */+export function blueprintStarterNote(blueprint, key) {+ return `blueprint starter: ${JSON.stringify({ blueprint: blueprint.name, version: blueprint.version, key })}`;+}diff --cc src/blueprints.jsindex e28cf9f8,8486eda5..9664c57f--- a/src/blueprints.js+++ b/src/blueprints.js@@@ -370,15 -407,13 +419,15 @@@ export function landBlueprint(blueprint* the blueprint's section (found by title, or new), and plans every starter item. A retry after a* failure part way (the under-way marker is there) files no rows and plans only the starters not* yet on the board, found by title and the row ids they cite. A finished add (the marker is there)- * plans nothing.+ * plans nothing. A rule or question whose row text is in drafted, drafted by a blueprint added+ * before it in the same command, files no row: its key takes that row's id, and it is listed in+ * shared, so a text two blueprints share is drafted once (#720).** @param {Blueprint} blueprint- * @param {{ source: string, spec: any, doctrine: any, existingItems: { id: number, title: string, specIds: string[] }[], gate: string }} board+ * @param {{ source: string, spec: any, doctrine: any, existingItems: { id: number, title: string, specIds: string[] }[], gate: string, drafted?: Map<string, string> }} board* source is SPEC.md's text and spec its parse; doctrine is loadDoctrine's result; existingItems- * are the items on the board; gate is pullboard.json's gate now.- * @returns {{ marked: boolean, resumed: boolean, section: { prefix: string, name: string, isNew: boolean }, rows: { key: string, id: string, status: string, text: string, source?: string, line: string }[], specRows: string, specAfter: string, ids: Record<string, string>, items: { key: string, title: string, specIds: string[], after: string[], lane?: string, route: string, criterion: string, brief: string }[], existing: Record<string, number>, gate: string | null }}+ * are the items on the board; gate is pullboard.json's gate now; drafted maps row text to row id.- * @returns {{ marked: boolean, resumed: boolean, section: { prefix: string, name: string, isNew: boolean }, rows: { key: string, id: string, status: string, text: string, line: string }[], shared: { key: string, id: string }[], specRows: string, specAfter: string, ids: Record<string, string>, items: { key: string, title: string, specIds: string[], after: string[], lane?: string, route: string, criterion: string, brief: string }[], existing: Record<string, number>, gate: string | null }}++ * @returns {{ marked: boolean, resumed: boolean, section: { prefix: string, name: string, isNew: boolean }, rows: { key: string, id: string, status: string, text: string, source?: string, line: string }[], shared: { key: string, id: string }[], specRows: string, specAfter: string, ids: Record<string, string>, items: { key: string, title: string, specIds: string[], after: string[], lane?: string, route: string, criterion: string, brief: string }[], existing: Record<string, number>, gate: string | null }}* specRows is the text to write before the items (rows and the under-way marker), specAfter the* text once they are all added (the finished marker); existing maps starter keys already on the* board to their item ids.@@@ -416,24 -450,18 +465,27 @@@ export function planBlueprint(blueprintreturn id;};ids = {};+ /** True when an earlier blueprint in this command drafted the same text: the key cites its row. */+ const reuse = (key, text) => {+ if (!drafted.has(text)) return false;+ ids[key] = drafted.get(text);+ shared.push({ key, id: ids[key] });+ return true;+ };for (const rule of blueprint.rules) {- const id = allocate();const text = ruleText(rule);+ if (reuse(rule.key, text)) continue;+ const id = allocate();ids[rule.key] = id;- rows.push({ key: rule.key, id, status: 'draft', text, line: `- ${id} [draft, ${rule.tier}] ${text} | gate: ${rule.gate}` });+ // The rule's source rides on its row as a field, so the text the person approves stays the rule.+ const source = rule.source ? sourceText(rule.source) : '';+ rows.push({ key: rule.key, id, status: 'draft', text, ...(source ? { source } : {}),+ line: `- ${id} [draft, ${rule.tier}] ${text} | gate: ${rule.gate}${source ? ` | source: ${source}` : ''}` });}for (const question of blueprint.questions) {- const id = allocate();const text = questionText(question);+ if (reuse(question.key, text)) continue;+ const id = allocate();ids[question.key] = id;rows.push({ key: question.key, id, status: 'pending', text, line: `- ${id} [pending, must] ${text} | gate: review` });}diff --cc src/cli.jsindex 195eaa3a,a4040e01..33bccdb9--- a/src/cli.js+++ b/src/cli.js@@@ -2476,9 -2473,9 +2484,9 @@@ async function addBlueprint(ctx, boardwriteRowApply(ctx.info.root, { records: [], files: [{ file: ctx.config.spec, before: plan.specRows, after: plan.specAfter }], signoffs: { before: null, receipts: [] } });}if (plan.specAfter !== source && !files.some((file) => file.file === ctx.config.spec)) files.unshift({ file: ctx.config.spec });- const rows = plan.rows.map(({ key, id, status, text }) => ({ key, id, status, text }));+ const rows = plan.rows.map(({ key, id, status, text, source }) => ({ key, id, status, text, ...(source ? { source } : {}) }));const summary = { blueprint: { name: blueprint.name, title: blueprint.title, version: blueprint.version },- section: plan.section.name, rows, items: added, gate: plan.gate, marked: plan.marked, proposedLanes: added.length ? proposedLanes : [],+ section: plan.section.name, rows, items: added.map((item) => ({ ...item, blueprint: blueprint.name })), gate: plan.gate, shared: plan.shared, marked: plan.marked, proposedLanes: added.length ? proposedLanes : [],// Item checks are stored and never run during add; the caller tells the reader so.checksNotRun: added.filter((item) => item.check).map((item) => item.id) };io.result?.(summary);diff --cc src/next-steps.jsindex 57d096be,4bc1f143..59ce1b54--- a/src/next-steps.js+++ b/src/next-steps.js@@@ -68,7 -68,7 +68,8 @@@ export const NEXT_STEPS = Object.freezeBLOCKED: 'take another item with pullboard next, or shout the lane it waits on: pullboard shout <lane> "<text>"',BLUEPRINT_EXISTS: 'choose a file that does not exist: pullboard blueprint save <new-file>',BLUEPRINT_ITEM_UNCHECKED: 'give the starter item named in the message a criterion and a check command, then run pullboard blueprint add <file> again',+ BLUEPRINT_KIND_TAKEN: 'keep at most one product and one architecture blueprint, then run the same command again',+ BLUEPRINT_NO_SOURCE: 'give the rule named in the message the reference it paraphrases as source { name, id, url }, then run pullboard blueprint add <file> again',BLUEPRINT_URL: 'download and read the blueprint yourself, then run pullboard blueprint add <local-file>',BOARD_BUSY: 'wait for the other pullboard process to finish, then retry',BOARD_NOT_WRITABLE: 'give the agent write access to the repo\'s .git/pullboard folder, or run the command outside the sandbox',