@pazmo/ai-workflow-kit 4.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/README.ko.md +22 -4
  5. package/README.md +23 -4
  6. package/assets/check.mjs +4 -3
  7. package/bin/ai-workflow-kit.mjs +6 -1
  8. package/examples/host-routing/README.md +15 -0
  9. package/examples/verification/README.md +11 -0
  10. package/examples/verification/app.mjs +6 -0
  11. package/examples/verification/prove.mjs +12 -0
  12. package/examples/verification/verification.json +7 -0
  13. package/examples/verification/verify-cli/SKILL.md +34 -0
  14. package/examples/verification/verify-cli/features/README.md +7 -0
  15. package/examples/verification/verify-cli/features/addition.md +9 -0
  16. package/package.json +8 -3
  17. package/skills/workflow/EVALS.md +60 -2
  18. package/skills/workflow/SKILL.md +5 -3
  19. package/skills/workflow/references/execution.md +7 -7
  20. package/skills/workflow/references/graph-engineering.md +27 -5
  21. package/skills/workflow/references/intake.md +6 -2
  22. package/skills/workflow/references/model-selection.md +40 -0
  23. package/skills/workflow/references/pstack/LICENSE +21 -0
  24. package/skills/workflow/references/pstack/create-verification-skill.md +44 -0
  25. package/skills/workflow/references/pstack/principle-prove-it-works.md +22 -0
  26. package/skills/workflow/references/pstack/provenance.json +37 -0
  27. package/skills/workflow/references/pstack/references/feature-map-example/README.md +47 -0
  28. package/skills/workflow/references/pstack/references/feature-map-example/create-note.md +39 -0
  29. package/skills/workflow/references/pstack/references/feature-map-example/search.md +45 -0
  30. package/skills/workflow/references/role-graphs.md +142 -0
  31. package/skills/workflow/references/skill-integration.md +18 -3
  32. package/skills/workflow/references/understanding-gate.md +6 -3
  33. package/skills/workflow/references/verification.md +64 -0
  34. package/src/graph/approvals.mjs +19 -0
  35. package/src/graph/cli.mjs +159 -12
  36. package/src/graph/execution-metadata.mjs +22 -0
  37. package/src/graph/roles.mjs +62 -0
  38. package/src/graph/snapshot.mjs +76 -0
  39. package/src/graph/verification.mjs +151 -0
  40. package/src/graph/workflow.mjs +61 -12
  41. package/src/managed-block.mjs +3 -2
@@ -0,0 +1,151 @@
1
+ import fs from 'node:fs/promises';
2
+ import { spawn } from 'node:child_process';
3
+ import { randomUUID } from 'node:crypto';
4
+ import { digest, projectFile, readJson, updateRun } from './storage.mjs';
5
+ import { taskToken } from './workflow.mjs';
6
+
7
+ export const PROFILE = '.ai-workflow/verification.json';
8
+ export const needsExecution = (run, nodeId) => nodeId === 'workflow-verify'
9
+ || (run.kind === 'role' && run.assignment.value.role === 'developer' && nodeId === 'self-check');
10
+
11
+ export async function verificationProfile(root, ids) {
12
+ const value = await readJson(root, PROFILE);
13
+ if (value.version !== 1 || !Array.isArray(value.checks) || value.checks.length === 0
14
+ || (value.inputs !== undefined && (!Array.isArray(value.inputs) || value.inputs.length === 0))
15
+ || (value.requiresG3 !== undefined && typeof value.requiresG3 !== 'boolean')) throw new Error('Invalid verification profile.');
16
+ const seen = new Set();
17
+ for (const check of value.checks) {
18
+ if (typeof check.id !== 'string' || !/^[a-zA-Z0-9][\w-]*$/.test(check.id) || ['constructor', 'prototype'].includes(check.id) || seen.has(check.id)
19
+ || !Array.isArray(check.covers) || !check.covers.length || check.covers.some(id => !/^V-?\d+$/.test(id) || !ids.includes(id))
20
+ || !Array.isArray(check.argv) || !check.argv.length || check.argv.some(arg => typeof arg !== 'string' || arg.includes('\0')) || !check.argv[0]
21
+ || (check.timeoutMs !== undefined && (!Number.isInteger(check.timeoutMs) || check.timeoutMs < 1 || check.timeoutMs > 300000))) {
22
+ throw new Error('Invalid verification check: unique id, Story V references, argv and timeout (1..300000ms) are required.');
23
+ }
24
+ seen.add(check.id);
25
+ }
26
+ for (const id of ids.filter(id => /^V-?\d+$/.test(id))) {
27
+ if (!value.checks.some(check => check.covers.includes(id))) throw new Error(`Verification profile does not cover ${id}.`);
28
+ }
29
+ if (value.requiresG3 && (typeof value.design !== 'string' || !value.design.trim())) throw new Error('G3 requires a design artifact path.');
30
+ let recipe;
31
+ if (value.recipe !== undefined) {
32
+ const bytes = await fs.readFile(await projectFile(root, value.recipe));
33
+ if (!bytes.toString('utf8').trim()) throw new Error('Verification recipe must not be empty.');
34
+ recipe = { path: value.recipe, hash: digest(bytes) };
35
+ }
36
+ return { value, fingerprint: digest(JSON.stringify(value)), ...(recipe ? { recipe } : {}) };
37
+ }
38
+
39
+ async function execute(argv, root, timeoutMs) {
40
+ return new Promise(resolve => {
41
+ const stdout = [], stderr = [];
42
+ let bytes = 0, timedOut = false, truncated = false, spawnError, killer, settled = false;
43
+ const child = spawn(argv[0], argv.slice(1), { cwd: root, shell: false, detached: process.platform !== 'win32', stdio: ['ignore', 'pipe', 'pipe'] });
44
+ const kill = signal => {
45
+ try { process.platform === 'win32' ? child.kill(signal) : process.kill(-child.pid, signal); }
46
+ catch (error) { if (error.code !== 'ESRCH') spawnError ??= error.message; }
47
+ };
48
+ const finish = (exitCode, signal, outputIncomplete = false) => {
49
+ if (settled) return;
50
+ settled = true;
51
+ clearTimeout(timer); clearTimeout(killer);
52
+ if (process.platform !== 'win32' && child.pid) kill('SIGKILL');
53
+ if (outputIncomplete) { child.stdout.destroy(); child.stderr.destroy(); child.unref(); }
54
+ resolve({ exitCode, signal, timedOut, truncated, outputIncomplete, ...(spawnError ? { spawnError } : {}), stdout: Buffer.concat(stdout), stderr: Buffer.concat(stderr) });
55
+ };
56
+ const stop = () => {
57
+ if (settled) return;
58
+ kill('SIGTERM');
59
+ // An escaped descendant may keep the pipes open after our process group exits.
60
+ killer ??= setTimeout(() => {
61
+ kill('SIGKILL');
62
+ finish(child.exitCode, child.signalCode, true);
63
+ }, 500);
64
+ };
65
+ const capture = target => chunk => {
66
+ if (settled) return;
67
+ bytes += chunk.length;
68
+ if (bytes <= 10 * 1024 * 1024) target.push(chunk);
69
+ else { truncated = true; stop(); }
70
+ };
71
+ child.stdout.on('data', capture(stdout));
72
+ child.stderr.on('data', capture(stderr));
73
+ child.on('error', error => { spawnError = error.message; });
74
+ // Kill descendants belonging to this command when the parent exits, too.
75
+ child.on('exit', () => { if (process.platform !== 'win32') stop(); });
76
+ const timer = setTimeout(() => { timedOut = true; stop(); }, timeoutMs);
77
+ child.on('close', (exitCode, signal) => finish(exitCode, signal));
78
+ });
79
+ }
80
+
81
+ export async function checkExecutions(root, run, nodeId, { requirePass = false } = {}) {
82
+ const state = run.state.nodes[nodeId];
83
+ const receipts = [];
84
+ for (const binding of Object.values(state.executions ?? {})) {
85
+ if (binding.pending) { if (requirePass) throw new Error('Verification execution is still running.'); continue; }
86
+ const receipt = await readJson(root, binding.file);
87
+ if (digest(JSON.stringify(receipt)) !== binding.hash || receipt.token !== taskToken(run, nodeId)
88
+ || receipt.runId !== run.runId || receipt.storyHash !== run.story.fingerprint) throw new Error('Verification receipt changed or belongs to stale work.');
89
+ for (const stream of ['stdout', 'stderr']) {
90
+ const bytes = await fs.readFile(await projectFile(root, receipt[stream]));
91
+ if (digest(bytes) !== receipt[`${stream}Hash`]) throw new Error('Verification raw log changed.');
92
+ }
93
+ if (requirePass && (!receipt.passed || receipt.snapshotBefore !== state.snapshot || receipt.snapshotAfter !== state.snapshot)) {
94
+ throw new Error('Verification execution failed or its code snapshot changed.');
95
+ }
96
+ receipts.push(receipt);
97
+ }
98
+ if (requirePass) {
99
+ const ids = run.graph.nodes.find(node => node.id === nodeId).covers.filter(id => /^V-?\d+$/.test(id));
100
+ for (const id of ids) if (!receipts.some(receipt => receipt.covers.includes(id))) throw new Error(`Verification execution required for ${id}.`);
101
+ for (const check of run.verification.value.checks.filter(check => check.covers.some(id => ids.includes(id)))) {
102
+ if (!receipts.some(receipt => receipt.checkId === check.id)) throw new Error(`Verification execution required for configured check ${check.id}.`);
103
+ }
104
+ }
105
+ return receipts;
106
+ }
107
+
108
+ export async function runVerification({ root, runFile, nodeId, token, checkId, validate, snapshot }) {
109
+ const executionId = randomUUID();
110
+ const reserved = await updateRun(root, runFile, async previous => {
111
+ const run = structuredClone(previous);
112
+ await validate(run);
113
+ if (run.version !== 3 || !needsExecution(run, nodeId) || run.question
114
+ || run.state.nodes[nodeId]?.status !== 'running' || token !== taskToken(run, nodeId)) throw new Error('Verification requires the current running verification task token.');
115
+ const check = run.verification.value.checks.find(check => check.id === checkId);
116
+ if (!check) throw new Error('Unknown verification check.');
117
+ if (Object.hasOwn(run.state.nodes[nodeId].executions ?? {}, checkId)) throw new Error('Check already executed in this attempt; reset before retrying.');
118
+ const before = (await snapshot(run)).fingerprint;
119
+ if (before !== run.state.nodes[nodeId].snapshot) throw new Error('Verification snapshot is stale; reset affected work.');
120
+ run.state.nodes[nodeId].executions ??= {};
121
+ run.state.nodes[nodeId].executions[checkId] = { pending: executionId };
122
+ return run;
123
+ });
124
+ const check = reserved.verification.value.checks.find(check => check.id === checkId);
125
+ const directory = `.ai-workflow/evidence/${reserved.runId}/${executionId}`;
126
+ await fs.mkdir(await projectFile(root, directory), { recursive: true, mode: 0o700 });
127
+ const startedAt = new Date().toISOString();
128
+ const result = await execute(check.argv, root, check.timeoutMs ?? 30000);
129
+ const receipt = { version: 1, runId: reserved.runId, storyHash: reserved.story.fingerprint, nodeId, token, checkId, covers: check.covers,
130
+ ...(reserved.verification.recipe ? { recipe: reserved.verification.recipe } : {}),
131
+ argv: check.argv, cwd: '.', startedAt, finishedAt: new Date().toISOString(),
132
+ ...result, stdout: `${directory}/stdout.log`, stderr: `${directory}/stderr.log`,
133
+ stdoutHash: digest(result.stdout), stderrHash: digest(result.stderr),
134
+ snapshotBefore: reserved.state.nodes[nodeId].snapshot, snapshotAfter: null };
135
+ for (const stream of ['stdout', 'stderr']) await fs.writeFile(await projectFile(root, receipt[stream]), result[stream], { flag: 'wx', mode: 0o600 });
136
+ try { receipt.snapshotAfter = (await snapshot(reserved)).fingerprint; }
137
+ catch (error) { receipt.snapshotError = error.message; }
138
+ receipt.passed = receipt.exitCode === 0 && !receipt.signal && !receipt.timedOut && !receipt.truncated && !receipt.outputIncomplete && !receipt.spawnError
139
+ && !receipt.snapshotError && receipt.snapshotBefore === receipt.snapshotAfter;
140
+ const file = `${directory}/receipt.json`;
141
+ await fs.writeFile(await projectFile(root, file), `${JSON.stringify(receipt, null, 2)}\n`, { flag: 'wx', mode: 0o600 });
142
+ const run = await updateRun(root, runFile, async previous => {
143
+ const next = structuredClone(previous);
144
+ await validate(next);
145
+ if (token !== taskToken(next, nodeId) || next.state.nodes[nodeId].status !== 'running'
146
+ || next.state.nodes[nodeId].executions?.[checkId]?.pending !== executionId) throw new Error('Late verification result rejected after reset/answer.');
147
+ next.state.nodes[nodeId].executions[checkId] = { file, hash: digest(JSON.stringify(receipt)) };
148
+ return next;
149
+ });
150
+ return { run, verification: { ...receipt, receipt: file } };
151
+ }
@@ -1,15 +1,21 @@
1
1
  import { randomUUID } from 'node:crypto';
2
+ import fs from 'node:fs/promises';
2
3
  import { createTaskGraph, dependencyIds, descendantIds, nodeById } from './task-graph.mjs';
3
4
  import { assertRunState, blockedNodeIds, createRunState, selectReadyNodes } from './scheduler.mjs';
4
- import { digest, readProjectFile } from './storage.mjs';
5
+ import { digest, projectFile } from './storage.mjs';
6
+ import { assertRoleOutput, assertRoleRun } from './roles.mjs';
7
+ import { canonicalStory } from './snapshot.mjs';
8
+
9
+ export const isRoleRun = run => run.version === 2 || run.kind === 'role';
5
10
 
6
11
  export const MAX_ATTEMPTS = 3;
12
+ export const MAX_QUESTIONS = 3;
7
13
  const REVIEW = 'workflow-review';
8
14
  const VERIFY = 'workflow-verify';
9
15
 
10
16
  export function storyContract(text) {
11
17
  // Progress metadata is mutable; requirements and human decisions are not.
12
- const content = text.split(/\r?\n/).filter(line => !/^(?:Status:|Understanding gate \(G[134]\):|G4:)/i.test(line)).join('\n').trim();
18
+ const content = canonicalStory(text);
13
19
  const sectionIds = (heading, prefix) => {
14
20
  const body = text.match(new RegExp(`^##\\s+${heading}\\s*$([\\s\\S]*?)(?=^##\\s|$(?![\\s\\S]))`, 'im'))?.[1] ?? '';
15
21
  return [...body.matchAll(new RegExp(`^[-*]\\s+(${prefix}-?\\d+)\\b`, 'gim'))].map(match => match[1].toUpperCase());
@@ -43,14 +49,22 @@ export function createWorkflowGraph(plan, ids) {
43
49
  }
44
50
 
45
51
  export function newWorkflowRun(graph, story, contract) {
46
- return { version: 1, runId: randomUUID(), graph, state: createRunState(graph), story: { path: story, fingerprint: contract.fingerprint }, history: [] };
52
+ return { version: 3, kind: 'delivery', runId: randomUUID(), graph, state: createRunState(graph), story: { path: story, fingerprint: contract.fingerprint }, history: [] };
47
53
  }
48
54
 
49
55
  export function assertWorkflowRun(run) {
50
- if (run?.version !== 1 || typeof run.runId !== 'string' || !run.runId.trim()
56
+ if (![1, 2, 3].includes(run?.version) || (run.version === 3 && !['delivery', 'role'].includes(run.kind)) || typeof run.runId !== 'string' || !run.runId.trim()
51
57
  || !run.graph || !run.story?.path || !Array.isArray(run.history)) throw new Error('Invalid workflow run.');
52
58
  const graph = createTaskGraph(run.graph);
53
59
  assertRunState(graph, run.state);
60
+ if (run.question && (run.state.nodes[run.question.nodeId]?.status !== 'running'
61
+ || typeof run.question.id !== 'string' || !run.question.id
62
+ || typeof run.question.text !== 'string' || !run.question.text.trim()
63
+ || run.question.token !== taskToken(run, run.question.nodeId))) throw new Error('Invalid pending question.');
64
+ if (isRoleRun(run)) {
65
+ assertRoleRun(run);
66
+ return graph;
67
+ }
54
68
  if (!graph.nodes.some(node => node.id === REVIEW) || !graph.nodes.some(node => node.id === VERIFY)) throw new Error('Workflow review/verification nodes are missing.');
55
69
  if (!dependencyIds(graph, VERIFY).includes(REVIEW)
56
70
  || graph.nodes.some(node => node.id !== VERIFY && !descendantIds(graph, [node.id]).has(VERIFY))) {
@@ -62,25 +76,35 @@ export function assertWorkflowRun(run) {
62
76
  export function taskToken(run, nodeId) {
63
77
  return digest(JSON.stringify([run.runId, run.state.fingerprint, run.story.fingerprint, nodeId,
64
78
  run.state.nodes[nodeId].attempts, run.state.nodes[nodeId].revision,
65
- dependencyIds(run.graph, nodeId).map(id => run.state.nodes[id]) ]));
79
+ dependencyIds(run.graph, nodeId).map(id => run.state.nodes[id]),
80
+ ...(isRoleRun(run) ? [run.assignment.fingerprint] : []) ]));
81
+ }
82
+
83
+ export function revisionToken(run) {
84
+ return digest(JSON.stringify([run.runId, run.story, run.assignment, run.state]));
66
85
  }
67
86
 
68
87
  export async function evidenceHashes(root, evidence) {
69
88
  if (!Array.isArray(evidence) || evidence.length === 0) throw new Error('Node output requires evidence files.');
70
89
  const hashes = {};
71
90
  for (const file of evidence) {
72
- const body = await readProjectFile(root, file);
73
- if (!body.trim()) throw new Error(`Empty evidence file: ${file}`);
91
+ const body = await fs.readFile(await projectFile(root, file));
92
+ if (!body.toString('utf8').trim()) throw new Error(`Empty evidence file: ${file}`);
74
93
  Object.defineProperty(hashes, file, { value: digest(body), enumerable: true, configurable: true });
75
94
  }
76
95
  return hashes;
77
96
  }
78
97
 
79
98
  export async function checkRunEvidence(root, run) {
99
+ for (const event of run.history.filter(entry => ['answer', 'feedback'].includes(entry.event))) {
100
+ const actual = await evidenceHashes(root, event.evidence);
101
+ if (JSON.stringify(actual) !== JSON.stringify(event.evidenceHashes)) throw new Error('Conversation evidence changed; preserve the original answer/feedback.');
102
+ }
80
103
  for (const node of run.graph.nodes) {
81
104
  const state = run.state.nodes[node.id];
82
105
  if (!['completed', 'failed'].includes(state.status)) continue;
83
106
  if (typeof state.output?.summary !== 'string' || !state.output.summary.trim()) throw new Error(`Missing output summary: ${node.id}`);
107
+ if (state.status === 'completed') assertRoleOutput(run, node.id, state.output);
84
108
  const actual = await evidenceHashes(root, state.output.evidence);
85
109
  if (JSON.stringify(actual) !== JSON.stringify(state.evidenceHashes)) throw new Error(`Node evidence changed: ${node.id}; reset affected work.`);
86
110
  }
@@ -93,22 +117,47 @@ export function workflowStatus(run) {
93
117
  const running = nodes.filter(([, state]) => state.status === 'running').map(([id]) => id);
94
118
  const exhausted = nodes.some(([, state]) => ['pending', 'failed'].includes(state.status) && state.attempts >= MAX_ATTEMPTS);
95
119
  let action;
96
- if (exhausted) action = 'stop';
120
+ if (run.version < 3) action = 'upgrade-required';
121
+ else if (exhausted) action = 'stop';
97
122
  else if (failed.some(node => node.action === 'human')) action = 'human';
98
123
  else if (failed.some(node => node.action === 'replan')) action = 'replan';
124
+ else if (run.question) action = 'question';
99
125
  else if (failed.length) action = 'fix';
100
- else if (nodes.every(([, state]) => state.status === 'completed')) action = 'g4';
126
+ else if (nodes.every(([, state]) => state.status === 'completed')) action = isRoleRun(run) ? 'role-complete' : 'g4';
101
127
  else action = 'execute';
102
128
  const ready = ['execute', 'fix'].includes(action) ? selectReadyNodes(graph, run.state, 4).map(node => taskInput(run, node.id)) : [];
103
129
  if (action === 'execute' && ready.length === 0 && running.length) action = 'wait';
104
- return { runId: run.runId, action, ready, running, failed, blocked: blockedNodeIds(graph, run.state),
130
+ return { runId: run.runId, revisionToken: revisionToken(run), action, ready, running, failed, blocked: blockedNodeIds(graph, run.state),
131
+ ...(isRoleRun(run) ? { assignment: run.assignment.value } : {}),
132
+ ...(run.question ? { question: run.question } : {}),
133
+ ...(action === 'role-complete' ? { submission: { nodeId: graph.nodes.at(-1).id, output: run.state.nodes[graph.nodes.at(-1).id].output } } : {}),
105
134
  completed: nodes.filter(([, state]) => state.status === 'completed').map(([id]) => id),
106
- gate: 'Graph evidence never approves G3/G4. G4 remains human-owned.', maxAttempts: MAX_ATTEMPTS };
135
+ gate: 'Graph evidence never approves G3/G4. G4 remains human-owned.', maxAttempts: MAX_ATTEMPTS, maxQuestionsPerNode: MAX_QUESTIONS };
107
136
  }
108
137
 
109
138
  export function taskInput(run, nodeId) {
110
- return { ...nodeById(run.graph, nodeId), token: taskToken(run, nodeId), input: {
139
+ const affected = descendantIds(run.graph, [nodeId]);
140
+ const node = nodeById(run.graph, nodeId);
141
+ return { ...node, token: taskToken(run, nodeId),
142
+ ...(run.state.nodes[nodeId].snapshot ? { snapshot: run.state.nodes[nodeId].snapshot } : {}), input: {
111
143
  story: run.story.path,
144
+ ...(run.verification ? { verification: {
145
+ ...(run.verification.recipe ? { recipe: run.verification.recipe } : {}),
146
+ checks: run.verification.value.checks.filter(check => check.covers.some(id => node.covers.includes(id)))
147
+ .map(({ id, covers }) => ({ id, covers })),
148
+ } } : {}),
149
+ ...(nodeId === 'workflow-review' || (isRoleRun(run) && run.assignment.value.role === 'reviewer' && nodeId === 'review') ? {
150
+ reviewBudget: { defaultAgents: 3, smallChangeAgents: [0, 2], highRiskAgents: [4, 5], scope: 'whole-review-round',
151
+ nestedDelegation: false, dispatchOwner: 'host', aggregation: 'caller' },
152
+ } : {}),
153
+ ...(isRoleRun(run) ? { assignment: run.assignment.value } : {}),
154
+ messages: run.history.flatMap(entry => {
155
+ if (entry.event === 'record' && affected.has(entry.nodeId) && entry.result.evaluation?.passed === false) {
156
+ return [{ event: 'failure', nodeId: entry.nodeId, feedback: entry.result.evaluation.feedback, output: entry.result.output }];
157
+ }
158
+ return (['question', 'answer'].includes(entry.event) && entry.nodeId === nodeId)
159
+ || (entry.event === 'feedback' && entry.affected.includes(nodeId)) ? [entry] : [];
160
+ }),
112
161
  dependencies: Object.fromEntries(dependencyIds(run.graph, nodeId).map(id => [id, run.state.nodes[id].output])),
113
162
  } };
114
163
  }
@@ -10,9 +10,10 @@ export const MANAGED_BLOCK = `${START_MARKER}
10
10
  - Keep Tasks at most 30 non-empty lines and reference Story M/V IDs; HOW belongs to the repository-grounded plan.
11
11
  - After G1, automatically initialize/resume the installed graph with \`node .ai-workflow/bin/graph.mjs\`. Follow the workflow graph reference; record node evidence, route failures and require graph readiness before G4. No separate npm dependency or Graph opt-in is needed.
12
12
  - Within an assigned kit graph node, apply only its role/task procedure and return evidence to that run. Office assigns roles and launches agents; the kit graph still controls readiness, joins and failure routing. Do not recursively start full delivery workflows.
13
- - Use compatible Superpowers focused TDD, diagnosis and fresh-verification skills with CE caller-owned planning, \`ce-simplify-code\`, report-only review and verified learning capture. Read the workflow skill-integration reference for exact modes, direct fallback and host limits. Do not nest end-to-end workflows or repeat approved plans. High-risk work retains G3.
13
+ - Use compatible Superpowers focused TDD, diagnosis and fresh-verification skills with CE caller-owned planning, bounded review and verified learning capture. Simplify inline by default; optional \`ce-simplify-code\` workers share the review allocation. Read skill-integration for exact modes, fallback and host limits. Do not nest end-to-end workflows or repeat approved plans. High-risk work retains G3.
14
14
  - Do not merge non-trivial changes until the workflow's G4 question gate records that a human understands behavior, an invariant/failure path, and the evidence boundary.
15
- - Gates are satisfied by evidence, not by assertion. Verify with \`node .ai-workflow/bin/check.mjs story <story-file>\` and report the exit code; exit 0 is the only pass.
15
+ - Configure the project verification profile using the workflow verification reference. Run required checks through Graph \`verify\`; inspect actual exit results/logs. Code changes make review/checks stale. Host model selection follows the workflow model policy; unknown actual model/cost stay unknown.
16
+ - \`node .ai-workflow/bin/check.mjs story <story-file>\` checks document shape/gate presence only. Report its exit code, and require \`node .ai-workflow/bin/graph.mjs delivery <run.json>\` after real G4 for bound execution/approval validation.
16
17
  ${END_MARKER}`;
17
18
 
18
19
  export function managedBlockFor(host) {