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
chore(merge): integrate rigor with command imports [D1,H16]
Corey Olsonf30efa9bf479
diff --cc src/board.jsindex 85582be4,61fb27ff..d2d25e27--- a/src/board.js+++ b/src/board.js@@@ -13,17 -24,42 +24,47 @@@ importimport { dirname } from 'node:path';import { DatabaseSync } from 'node:sqlite';import { boardNotWritable } from './board-access.js';- import { briefFiles, briefSections } from './brief.js';+ import {+ briefFiles,+ briefSections,+ } from './brief.js';import { COORDINATOR } from './config.js';- import { ENGINE_VERSION, VERDICT_REVIEW_ENGINE, MILESTONE_RANK_ENGINE, GUARDS, IN_STATE, MOVES, STATES, UNKNOWN_MOVE, effectiveGuards, storeTriggers } from './machine.js';+ import {+ ENGINE_VERSION,+ VERDICT_REVIEW_ENGINE,+ MILESTONE_RANK_ENGINE,+ GUARDS,+ IN_STATE,+ MOVES,+ STATES,+ UNKNOWN_MOVE,+ effectiveGuards,+ storeTriggers,+ } from './machine.js';import { Refused } from './refused.js';- import { causeProblem, requireNeverAgain } from './rigor.js';- import { newRigorNotices, rigorNoticeText } from './rigor-notices.js';++import {++ newRigorNotices,++ rigorNoticeText,++} from './rigor-notices.js';+import { RIGOR_NOTICE_ENGINE } from './rigor-source.js';+ import {+ causeProblem,+ requireNeverAgain,+ } from './rigor.js';import { barCorrectionFields } from './bar-corrections.js';import { factReference } from './fact-reference.js';- import { factFromEvent, requestAnswerRefusal, tellAnswerImplications, tellFactImplications, tellVerdictImplications } from './implies.js';- import { landingFlakes, landingWaiverCovers, landingWaiverKind } from './landing-exceptions.js';+ import {+ factFromEvent,+ requestAnswerRefusal,+ tellAnswerImplications,+ tellFactImplications,+ tellVerdictImplications,+ } from './implies.js';+ import {+ landingFlakes,+ landingWaiverCovers,+ landingWaiverKind,+ } from './landing-exceptions.js';import { parseSpec } from './spec.js';export { landingFlakes, landingWaiverCovers, landingWaiverKind };export { acceptCheck } from './check-accept.js';diff --cc src/needs-state.jsindex de0e8143,18b55884..d7d1366c--- a/src/needs-state.js+++ b/src/needs-state.js@@@ -3,16 -3,14 +3,22 @@@ import { join } from 'node:path'import * as store from './board.js';import { repoInfo } from './git.js';import { projectRowDecisions } from './row-decisions.js';- import { pendingFit, projectFit } from './blueprint-fit.js';+ import {+ pendingFit,+ projectFit,+ } from './blueprint-fit.js';import { projectState } from './serve.js';+import { loadConfig } from './config.js';+import { loadSpec } from './spec.js';+import { loadDoctrine } from './doctrine.js';- import { rigorDraftNeeds, undraftedRigor } from './rigor-notices.js';++import {++ rigorDraftNeeds,++ undraftedRigor,++} from './rigor-notices.js';+import { personNeeds } from './needs.js';/** Borrow an existing connection or open a read-only one; retain exact row-decision matching. */-export function personNeedsState(root, { board: providedBoard = null } = {}) {+export function personNeedsState(root, { board: providedBoard = null, includeRigorUndrafted = false } = {}) {const info = repoInfo(root);const board = providedBoard ?? { db: store.openBoardReadOnly(join(info.commonDir, 'pullboard', 'board.sqlite')) };try {diff --cc src/rigor-draft.jsindex 9e29a543,4864b802..70085a26--- a/src/rigor-draft.js+++ b/src/rigor-draft.js@@@ -6,10 -6,12 +6,13 @@@* approves or applies a row.*/import { Refused } from './refused.js';- import { causeProblem, rigorReport } from './rigor.js';+ import {+ causeProblem,+ rigorReport,+ } from './rigor.js';import { draftRow } from './spec-draft.js';import { proveCauseCheck } from './rigor-proof.js';+import { rigorSource } from './rigor-source.js';/*** Draft the rows for a repeated cause, after proving its check. Refused when the key is malformed,diff --cc src/rigor-notices.jsindex ff668031,00000000..9a44e60amode 100644,000000..100644--- a/src/rigor-notices.js+++ b/src/rigor-notices.js@@@ -1,90 -1,0 +1,98 @@@+/** Automatic repeated-cause notices and proved rows waiting on the person [D1,D3,S1]. */- import { causeProblem, eventCauses, isMergeConflict, rigorReport } from './rigor.js';++import {++ causeProblem,++ eventCauses,++ isMergeConflict,++ rigorReport,++} from './rigor.js';+import { parseSpec } from './spec.js';- import { readRigorSource, RIGOR_NOTICE_ENGINE } from './rigor-source.js';++import {++ readRigorSource,++ RIGOR_NOTICE_ENGINE,++} from './rigor-source.js';++/** Cause keys carried by this move, including the person's immediate never-again fact. */+export function rigorTriggerCauses(event, person) {+ if (event.event_kind === 'fact' && event.event_by === person) {+ const detail = JSON.parse(event.event_detail);+ if (detail.neverAgain === true && typeof detail.cause === 'string' && !causeProblem(detail.cause)) return [detail.cause];+ }+ return eventCauses(event);+}++/** Ignore an unreadable historical row source; it cannot establish a person’s typed decline. */+function declinedRigorSource(source) {+ if (typeof source !== 'string') return null;+ let rows;+ try { rows = parseSpec(`## Source\n${source}\n`).rows; }+ catch { return null; } // Historical metadata is optional; a parser refusal must never abort the original item move.+ return rows.length === 1 ? readRigorSource(rows[0].source) : null;+}++/** Reconstruct notice and exact person-decline state from ordered receipts, never free text. */+function noticeState(events, person) {+ const seen = new Map();+ const notified = new Map();+ const declined = new Map();+ for (const event of events) {+ for (const key of rigorTriggerCauses(event, person)) {+ if (!seen.has(key)) seen.set(key, new Set());+ if (event.item_id !== null) seen.get(key).add(event.item_id);+ }+ const detail = JSON.parse(event.event_detail);+ if (event.event_kind === 'rigor-notice' && event.event_by === 'rigor' && detail.engine === RIGOR_NOTICE_ENGINE+ && typeof detail.cause === 'string' && !causeProblem(detail.cause)) notified.set(detail.cause, event.event_id);+ if (event.event_kind !== 'row_decision' || event.event_by !== person || detail.record?.decision !== 'decline') continue;+ const source = declinedRigorSource(detail.record.source);+ if (source) declined.set(source.key, { event: event.event_id, items: new Set(seen.get(source.key) ?? []) });+ }+ return { notified, declined };+}++/** A person's decline stays quiet until an item absent at that decision repeats the cause. */+function declinedRepeat(cause, state) {+ const decline = state.declined.get(cause.key);+ return Boolean(decline && !cause.items.some(item => !decline.items.has(item.id)));+}++/** The move that crosses the repeat threshold posts once, and a third failure stays quiet. */+export function newRigorNotices(events, trigger, { person }) {+ const keys = new Set(rigorTriggerCauses(trigger, person).filter(key => !isMergeConflict(key)));+ if (!keys.size) return [];+ const state = noticeState(events, person);+ return rigorReport(events, { person }).causes.filter(cause => {+ if (!keys.has(cause.key) || declinedRepeat(cause, state)) return false;+ const notice = state.notified.get(cause.key);+ const decline = state.declined.get(cause.key);+ return notice === undefined || Boolean(decline && notice < decline.event);+ });+}++/** Every typed Rigor row, across the spec and the repository's doctrine. */+function rigorRows(state) {+ return [...(state.spec ?? []).map(row => ({ ...row, kind: 'spec' })),+ ...(state.practice ?? []).filter(row => row.origin !== 'standard').map(row => ({ ...row, kind: 'doctrine' }))]+ .flatMap(row => { const source = readRigorSource(row.source); return source ? [{ row, source }] : []; });+}++/** Proved drafts are individual person calls, with their real evidence and both executed commits. */+export function rigorDraftNeeds(state) {+ return rigorRows(state).filter(({ row }) => row.status === 'draft' && !row.decision).map(({ row, source }) => ({+ kind: 'rigor-draft', id: `${row.kind}:${row.id}`, ref: row.kind === 'doctrine' ? `doctrine:${row.id}` : row.id,+ text: `Rigor draft: ${row.text}`, what: 'Approve or Decline', target: `${row.kind}:${row.id}`,+ cause: source.key, evidence: source.evidence, proof: source.proof,+ }));+}++/** Resume asks the coordinator to draft each repeated cause that has no live or approved proved row. */+export function undraftedRigor(events, state, { person }) {+ const notices = noticeState(events, person);+ const drafted = new Set(rigorRows(state).filter(({ row }) => row.decision?.decision === 'approve'+ || (!row.decision && ['draft', 'pending', 'approved'].includes(row.status))).map(({ source }) => source.key));+ return rigorReport(events, { person }).causes.filter(cause => !drafted.has(cause.key) && !declinedRepeat(cause, notices));+}++/** One actionable notice names the cause and every item, with the ordinary proof-bearing draft command. */+export function rigorNoticeText(cause) {+ return `Repeated cause ${cause.key}: ${cause.items.map(item => `#${item.id}`).join(', ') || 'the person marked never again'}. Next: pullboard rigor draft "${cause.key.replaceAll('"', '\\"')}" "<rule>" --check "<command>" --red <commit> --green <commit>; prove the rule in this session, then the person approves or declines its draft.`;+}