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
feat(spec): spec answer records the person's choice [S1,E3]
Corey Olsonfc9746fe6fe7
diff --git a/docs/api.md b/docs/api.mdindex fd626f8b..001fb78d 100644--- a/docs/api.md+++ b/docs/api.md@@ -117,6 +117,7 @@ For example: `flow: review wait average 61 min (1 measured; > 60 min); bottlenec| `spec signers` | `version:number`, `added:boolean`, `by:string`, `path:string`, `initial:boolean` || `spec approve` | `version:number`, `decisions:array` || `spec decline` | `version:number`, `decisions:array` |+| `spec answer` | `version:number`, `decisions:array` || `spec apply` | `version:number`, `applied:array`, `files:array` || `hook pre-commit` | `version:number`, `messages:array` || `hook pre-merge-commit` | `version:number`, `messages:array` |@@ -273,6 +274,8 @@ Decision moves keep the CLI's routing: `shout` with `args.decision: true` may omOnly 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.+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 with an `answer` field, 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.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.diff --git a/src/blueprints.js b/src/blueprints.jsindex 233c426c..d4f75646 100644--- a/src/blueprints.js+++ b/src/blueprints.js@@ -408,9 +408,12 @@ function readQuestion(text) {}/**- * A question row's text once the person answers it: "<ask>: <answer>. Choices: <choices>.". A- * listed choice matches in any case and keeps its listed spelling; any other answer joins the- * choices last, so blueprint save still reads the answered row back as a question [S1].+ * A question row's text once the person answers it: "<ask>: <answer>. Choices: <choices>.". The+ * choices stay exactly as written. A listed choice (any run of the comma-separated parts, so a+ * choice holding ", " counts) matches in any case and keeps its listed spelling; any other answer+ * joins the choices last. The ask ends at the one ": " whose remainder is a listed choice, or at+ * the last ": " when the default is none of them; readQuestion's single reading is not required,+ * because three or more choices always read more than one way there [S1].** @param {string} text - The pending row's text, as questionText wrote it.* @param {string} given - The person's answer: one of the choices, or their own one-line text.@@ -418,22 +421,22 @@ function readQuestion(text) {* @returns {{ text: string, answer: string, listed: boolean }}*/export function answerQuestion(text, given, id) {- const read = readQuestion(text);- if (!read?.question) {- throw new Refused('SPEC_ANSWER', `${id} does not read as one question with its choices (${read?.reason ?? 'it has no ". Choices: " list'})`,- `the person approves its exact new text instead: pullboard spec approve ${id} --text "<the answered row>"`);- }- const { ask, choices } = read.question;+ const at = text.lastIndexOf(CHOICES);+ const approve = `the person approves its exact new text instead: pullboard spec approve ${id} --text "<the answered row>"`;+ if (at < 0 || !text.endsWith('.')) throw new Refused('SPEC_ANSWER', `${id} does not read as a question with its choices: it has no ". Choices: " list`, approve);+ const head = text.slice(0, at);+ const choicesText = text.slice(at + CHOICES.length, -1);+ const parts = choicesText.split(', ');+ const runs = parts.flatMap((_, from) => parts.slice(from).map((__, length) => parts.slice(from, from + length + 1).join(', ')));+ const colons = positions(head, ': ');+ const listedSplits = colons.filter((colon) => runs.includes(head.slice(colon + 2)));+ if (!colons.length || listedSplits.length > 1) throw new Refused('SPEC_ANSWER', `${id}'s question and its current answer cannot be told apart`, approve);+ const ask = head.slice(0, listedSplits[0] ?? colons.at(-1));const answer = given.trim();- const listed = choices.find((choice) => choice.toLowerCase() === answer.toLowerCase());- const question = listed ? { ask, choices, default: listed } : { ask, choices: [...choices, answer], default: answer };- const answered = questionText(question);- const back = readQuestion(answered)?.question;- if (!back || back.default !== question.default || back.choices.join('\n') !== question.choices.join('\n')) {- throw new Refused('SPEC_ANSWER', `"${answer}" cannot be read back as ${id}'s one answer`,- `give the answer without ", " or ": ": pullboard spec answer ${id} "<answer>"`);- }- return { text: answered, answer: question.default, listed: Boolean(listed) };+ if (answer.includes(CHOICES.trim())) throw new Refused('SPEC_ANSWER', `the answer to ${id} cannot hold "Choices:"`, `give the answer alone: pullboard spec answer ${id} "<answer>"`);+ const listed = runs.find((choice) => choice.toLowerCase() === answer.toLowerCase());+ const chosen = listed ?? answer;+ return { text: `${ask}: ${chosen}${CHOICES}${listed ? choicesText : `${choicesText}, ${answer}`}.`, answer: chosen, listed: Boolean(listed) };}/**diff --git a/src/help.js b/src/help.jsindex 7d2958d2..66f3201c 100644--- a/src/help.js+++ b/src/help.js@@ -162,6 +162,8 @@ Specprincipal defaults to Git user.email; --by overrides itpullboard spec approve <ids> | decline <ids> --reason "why" the person's exact-row decisionapprove <id> --text "new wording" approves an exact rewrite+ pullboard spec answer <id> "<choice or text>" the person's answer to a pending question+ a listed choice, or their own words added as the last choicepullboard spec apply coordinator applies recorded row decisions to the filesRole guidesdiff --git a/src/json.js b/src/json.jsindex 3cef0d18..82258c51 100644--- a/src/json.js+++ b/src/json.js@@ -83,6 +83,7 @@ export const JSON_SHAPES = {'spec signers': shape({ added: 'boolean', by: 'string', path: 'string', initial: 'boolean' }),'spec approve': shape({ decisions: 'array' }),'spec decline': shape({ decisions: 'array' }),+ 'spec answer': shape({ decisions: 'array' }),'spec apply': shape({ applied: 'array', files: 'array' }),'hook pre-commit': shape({ messages: 'array' }),'hook pre-merge-commit': shape({ messages: 'array' }),diff --git a/src/templates.js b/src/templates.jsindex 99097bd1..8e26957f 100644--- a/src/templates.js+++ b/src/templates.js@@ -100,7 +100,7 @@ On a board that is not set up, run \`pullboard resume\` first. Walk the person tThis repo runs on pullboard: a work board, lanes and a spec that live in git. Nothing ships until a second agent verifies it.-**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. 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.+**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.**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. Run pullboard spec --json to read the current merged rules. Re-run pullboard init after changing the doctrine to refresh this managed guidance.diff --git a/test/api.test.js b/test/api.test.jsindex bc4f56d0..5a4c715b 100644--- a/test/api.test.js+++ b/test/api.test.js@@ -978,6 +978,8 @@ test('[A1] every catalog command and subcommand has a real CLI exercise', () =>json(source, source.repo, 'reopen', [String(reopenItem.item_id), '--note', 'exercise the versioned reopen result']);json(source, source.repo, 'spec', ['approve', 'G1'], 'approve');json(source, source.repo, 'spec', ['decline', 'G1', '--reason', 'Catalog decline'], 'decline');+ writeFileSync(join(source.repo, 'SPEC.md'), `${readFileSync(join(source.repo, 'SPEC.md'), 'utf8')}- G2 [pending, must] Which store holds the catalog: SQLite. Choices: SQLite, Postgres. | gate: review\n`);+ json(source, source.repo, 'spec', ['answer', 'G2', 'Postgres'], 'answer');json(source, source.repo, 'spec', ['apply'], 'apply');/** Exercise the agent-only takeover with a private explicit session, leaving later terminal calls markerless. */diff --git a/test/spec.test.js b/test/spec.test.jsindex 2b58145e..757e0a23 100644--- a/test/spec.test.js+++ b/test/spec.test.js@@ -564,7 +564,7 @@ test("spec answer records the person's choice [S1,E3,P6]", (t) => {assert.equal(line('B1'), '- B1 [approved, must] Which store holds the data: Postgres. Choices: SQLite, Postgres. | gate: review','the row leaves pending with the chosen answer');assert.equal(line('B2'), '- B2 [approved, must] Which store holds the cache: Redis on the host. Choices: SQLite, Postgres, Redis on the host. | gate: review',- 'an answer outside the choices joins them, so blueprint save still reads the row back');+ 'an answer outside the choices is kept and joins them as the last choice');const view = viewMove(box, { verb: 'spec-answer', args: { row: 'B3', answer: 'SQLite' } }, 'view', { ...box.env, CLAUDECODE: '1' });assert.equal(view.status, 200, JSON.stringify(view));@@ -608,7 +608,7 @@ test('an agent cannot answer a pending row [P6,B26,E3]', (t) => {}const flagged = runIn(box, box.root, ['spec', 'answer', 'B1', 'Postgres', '--as', 'person', '--json'], { ...box.env, CLAUDECODE: '1' });assert.equal(flagged.status, 1);- assert.equal(JSON.parse(flagged.stdout).error.code, 'FLAG_NOT_ALLOWED', 'no flag makes an agent the person');+ assert.equal(JSON.parse(flagged.stdout).error.code, 'B26_PERSON_CHANNEL', 'no flag makes an agent the person: --as person is refused first');const api = viewMove(box, { verb: 'spec-answer', args: { row: 'B1', answer: 'Postgres' } }, 'api', box.env);assert.equal(api.status, 409, JSON.stringify(api));