@sabaiway/agent-workflow-kit 23.12.0 → 24.0.0

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 (150) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +4 -4
  3. package/SKILL.md +1 -1
  4. package/bridges/codex-cli-bridge/SKILL.md +7 -2
  5. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +11 -6
  6. package/bridges/codex-cli-bridge/bin/codex-exec.sh +72 -33
  7. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +111 -3
  8. package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +16 -1
  9. package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +5 -3
  10. package/bridges/codex-cli-bridge/bin/codex-review.sh +1 -1
  11. package/bridges/codex-cli-bridge/capability.json +2 -2
  12. package/capability.json +1 -1
  13. package/package.json +1 -1
  14. package/references/advisor-writers.md +2 -0
  15. package/references/agents/author.md +21 -0
  16. package/references/agents/executor.md +12 -6
  17. package/references/contracts.md +4 -4
  18. package/references/hooks/gate-approve.mjs +7 -8
  19. package/references/hooks/stage-write-guard.mjs +314 -0
  20. package/references/modes/agents.md +6 -4
  21. package/references/modes/bootstrap.md +1 -1
  22. package/references/modes/flow-writer.md +10 -2
  23. package/references/modes/hook.md +4 -1
  24. package/references/modes/now.md +1 -1
  25. package/references/modes/procedures.md +49 -10
  26. package/references/modes/recipes.md +7 -7
  27. package/references/modes/recommendations.md +4 -3
  28. package/references/modes/robustness-brief.md +9 -8
  29. package/references/modes/set-recipe.md +1 -1
  30. package/references/modes/state-block-guard.md +4 -3
  31. package/references/modes/status.md +1 -1
  32. package/references/modes/upgrade.md +1 -1
  33. package/references/modes/worktrees.md +28 -5
  34. package/references/rules/story-sessions.md +2 -2
  35. package/references/scripts/archives/archive-caps.mjs +1 -1
  36. package/references/scripts/archives/archive-changelog.mjs +8 -8
  37. package/references/scripts/archives/archive-decisions.mjs +7 -7
  38. package/references/scripts/archives/archive-issues.mjs +5 -5
  39. package/references/scripts/archives/rotation-conservation.mjs +2 -1
  40. package/references/scripts/docs-size/check-docs-size.mjs +15 -15
  41. package/references/scripts/family.json +2 -0
  42. package/references/scripts/gates/kit-command-gates.mjs +7 -8
  43. package/references/scripts/gates/migrate-gates.mjs +10 -10
  44. package/references/scripts/git-hooks/install-git-hooks.mjs +13 -13
  45. package/references/scripts/run.mjs +1 -2
  46. package/references/scripts/shared/index.mjs +2 -0
  47. package/references/scripts/shared/locations.mjs +103 -0
  48. package/references/scripts/spec-schema/spec-schema.mjs +2 -1
  49. package/references/templates/orchestration.json +1 -1
  50. package/tools/ack-store.mjs +2 -1
  51. package/tools/apply-danger-check.mjs +20 -6
  52. package/tools/atomic-write.mjs +3 -2
  53. package/tools/attribution.mjs +2 -1
  54. package/tools/autonomy-config.mjs +2 -1
  55. package/tools/bridge-wiring.mjs +13 -11
  56. package/tools/carriers.mjs +54 -14
  57. package/tools/cheap-agents-read.mjs +28 -7
  58. package/tools/cheap-agents.mjs +15 -10
  59. package/tools/checker-gates-read.mjs +6 -5
  60. package/tools/commands.mjs +2 -2
  61. package/tools/coverage-declared/config.mjs +2 -1
  62. package/tools/coverage-producer.mjs +10 -9
  63. package/tools/delegation.mjs +7 -6
  64. package/tools/detect-backends.mjs +1 -1
  65. package/tools/dispatch-baseline.mjs +2 -1
  66. package/tools/distribution-files/scripts.mjs +4 -4
  67. package/tools/ensure-configs.mjs +2 -2
  68. package/tools/ensure-ops.mjs +24 -24
  69. package/tools/ensure-specs.mjs +7 -7
  70. package/tools/epic-shape-cli.mjs +2 -2
  71. package/tools/epic-shape-ledger.mjs +5 -5
  72. package/tools/epic-shape.mjs +5 -3
  73. package/tools/epic-store.mjs +2 -1
  74. package/tools/family-members.mjs +7 -5
  75. package/tools/family-registry.mjs +36 -30
  76. package/tools/feedback-record-cli.mjs +4 -5
  77. package/tools/flow-writer.mjs +26 -15
  78. package/tools/gate-hook.mjs +33 -28
  79. package/tools/gates-declaration.mjs +2 -1
  80. package/tools/gates-init.mjs +6 -5
  81. package/tools/git-hooks.mjs +64 -41
  82. package/tools/grounding.mjs +3 -2
  83. package/tools/hide-footprint.mjs +2 -1
  84. package/tools/hook-writer/index.mjs +147 -0
  85. package/tools/init-preflight.mjs +5 -4
  86. package/tools/init-project.mjs +12 -11
  87. package/tools/inject-methodology.mjs +3 -2
  88. package/tools/jev-guide.mjs +2 -2
  89. package/tools/known-footprint.mjs +27 -25
  90. package/tools/mcp-registration.mjs +6 -5
  91. package/tools/migration-blocks.mjs +2 -1
  92. package/tools/migration-notes.mjs +2 -2
  93. package/tools/node-evidence.mjs +4 -4
  94. package/tools/now-facts.mjs +5 -5
  95. package/tools/now-status.mjs +1 -5
  96. package/tools/orchestration-config.mjs +2 -1
  97. package/tools/orchestration-readme.mjs +7 -2
  98. package/tools/plan-approval/cli.mjs +45 -0
  99. package/tools/plan-approval/entries.mjs +109 -0
  100. package/tools/plan-approval/index.mjs +2 -0
  101. package/tools/plan-approval/record.mjs +198 -0
  102. package/tools/plan-files.mjs +6 -4
  103. package/tools/plan-shape-cli.mjs +10 -64
  104. package/tools/plan-shape-facts.mjs +240 -83
  105. package/tools/plan-shape.mjs +173 -160
  106. package/tools/plan-structure/cli.mjs +79 -0
  107. package/tools/plan-structure/index.mjs +67 -0
  108. package/tools/procedures.mjs +21 -17
  109. package/tools/profile-gaps.mjs +4 -6
  110. package/tools/project-rules/rules-priors.mjs +2 -0
  111. package/tools/project-rules/themes.mjs +6 -4
  112. package/tools/recipes.mjs +44 -29
  113. package/tools/recommendations.mjs +84 -33
  114. package/tools/reference-profile.mjs +2 -2
  115. package/tools/renderers.mjs +14 -8
  116. package/tools/repo-lex.mjs +84 -0
  117. package/tools/robustness-brief.mjs +14 -11
  118. package/tools/satellite-locator.mjs +3 -2
  119. package/tools/script-priors.mjs +3 -2
  120. package/tools/session-close-check.mjs +71 -15
  121. package/tools/set-flow.mjs +2 -2
  122. package/tools/set-recipe.mjs +17 -9
  123. package/tools/source-size/help.mjs +4 -4
  124. package/tools/source-size/layout.mjs +2 -1
  125. package/tools/source-size/piles.mjs +2 -2
  126. package/tools/source-size-config.mjs +3 -3
  127. package/tools/source-size-refusal.mjs +4 -3
  128. package/tools/source-size-report.mjs +41 -13
  129. package/tools/spec-check-cli.mjs +159 -21
  130. package/tools/spec-check-ops.mjs +74 -5
  131. package/tools/spec-check.mjs +54 -45
  132. package/tools/spec-coverage-cli.mjs +3 -2
  133. package/tools/stage-render/cli.mjs +231 -0
  134. package/tools/stage-render/index.mjs +340 -0
  135. package/tools/stage-render/stages.json +115 -0
  136. package/tools/stage-write-guard/cli.mjs +64 -0
  137. package/tools/stage-write-guard/index.mjs +56 -0
  138. package/tools/state-block-hook.mjs +38 -163
  139. package/tools/task-brief.mjs +8 -13
  140. package/tools/task-thread.mjs +3 -1
  141. package/tools/tier-guide-facts.mjs +23 -9
  142. package/tools/tier-preview.mjs +15 -19
  143. package/tools/transition/index.mjs +10 -9
  144. package/tools/uninstall.mjs +26 -12
  145. package/tools/vehicle-settings.mjs +2 -1
  146. package/tools/velocity-profile.mjs +5 -6
  147. package/tools/view-model.mjs +7 -4
  148. package/tools/worktree-prompt.mjs +7 -3
  149. package/tools/worktrees.mjs +235 -159
  150. package/tools/write-lanes.mjs +20 -14
@@ -4,17 +4,17 @@
4
4
  import { readFileSync, mkdirSync, readdirSync, existsSync, realpathSync } from 'node:fs';
5
5
  import { resolve, basename } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
- import { tokenizeMarkdown, findParagraphBreak, fail, findProjectRoot,
8
- composeRedBlock, composeUsageRefusal, guardChecker } from '../shared/index.mjs';
7
+ import { tokenizeMarkdown, findParagraphBreak, fail, findProjectRoot, composeRedBlock, composeUsageRefusal, guardChecker,
8
+ CHANGELOG, CHANGELOG_LEGACY, CONDENSED_INDEX, HISTORY, PACKAGE_JSON, RECENT } from '../shared/index.mjs';
9
9
  import { CAP_TABLE, capFor, countLines, shardingWarning } from './archive-caps.mjs';
10
10
  import { fsIo, writeWhole } from './whole-write.mjs';
11
11
  import { CARRY_REL, readCarry, renderCarry, unionEntries } from './rotation-conservation.mjs';
12
12
 
13
13
  const ROOT = findProjectRoot(import.meta.url);
14
14
  const CHECKER_NAME = 'archive-changelog';
15
- const PACKAGE_REL = 'package.json';
15
+ const PACKAGE_REL = PACKAGE_JSON;
16
16
  const GUARD = Object.freeze({ name: CHECKER_NAME, exitCode: 1, remedy: 'fix the cause the stack below names, then re-run' });
17
- const INDEX_REL = 'docs/ai/history/condensed-index.md';
17
+ const INDEX_REL = CONDENSED_INDEX;
18
18
  const shown = (text) => text.replace(/\r/g, '\\r').replace(/\n/g, '\\n');
19
19
  const composeFailure = (failed, findings, remedy, after = []) => ({
20
20
  exitCode: 1,
@@ -35,10 +35,10 @@ export const readProjectName = (root) => {
35
35
  return basename(root);
36
36
  }
37
37
  };
38
- const CHANGELOG_REL = 'docs/ai/changelog.md';
39
- const HISTORY_REL = 'docs/ai/history';
40
- const RECENT_REL = 'docs/ai/history/recent.md';
41
- const LEGACY_REL = 'docs/ai/changelog-archive.md';
38
+ const CHANGELOG_REL = CHANGELOG;
39
+ const HISTORY_REL = HISTORY;
40
+ const RECENT_REL = RECENT;
41
+ const LEGACY_REL = CHANGELOG_LEGACY;
42
42
 
43
43
  const DEFAULT_HOT_DAYS = 3;
44
44
  const DEFAULT_WARM_DAYS = 30;
@@ -92,20 +92,20 @@ import { spawnSync } from 'node:child_process';
92
92
  import { createHash } from 'node:crypto';
93
93
  import { fsIo, writeWhole } from './whole-write.mjs';
94
94
  import { tmpdir } from 'node:os';
95
- import { tokenizeMarkdown, findProjectRoot } from '../shared/index.mjs';
95
+ import { tokenizeMarkdown, findProjectRoot, ADR_LOG, ADR_STORE, DECISIONS, DECISIONS_ARCHIVE, DECISIONS_ARCHIVE_EARLY, DOCS_TREE } from '../shared/index.mjs';
96
96
 
97
97
  const __dirname = dirname(fileURLToPath(import.meta.url));
98
98
  const DEFAULT_ROOT = findProjectRoot(import.meta.url);
99
99
  // The command this rotator prints for itself is the stable kit command (spec kit-command).
100
100
  const SELF = 'node scripts/agent-workflow/run.mjs archive-decisions';
101
101
 
102
- export const HOT_REL = 'docs/ai/decisions.md';
102
+ export const HOT_REL = DECISIONS;
103
103
  // The retired monolith tiers — still READ during migration (their entries explode into records) and
104
104
  // still DETECTED by the legacy guard; never written by the new scheme.
105
- export const WARM_REL = 'docs/ai/history/decisions-archive.md';
106
- export const COLD_REL = 'docs/ai/history/decisions-archive-early.md';
107
- export const ADR_DIR_REL = 'docs/ai/adr';
108
- export const NAV_REL = 'docs/ai/adr/log.md';
105
+ export const WARM_REL = DECISIONS_ARCHIVE;
106
+ export const COLD_REL = DECISIONS_ARCHIVE_EARLY;
107
+ export const ADR_DIR_REL = ADR_STORE;
108
+ export const NAV_REL = ADR_LOG;
109
109
 
110
110
  // A per-record cap (generous vs the largest real ADR ~74 lines; a body over it is a genuine smell) and
111
111
  // the navigator's FLOOR: the navigator stamps 200 while it fits and its own line count past it, since
@@ -318,7 +318,7 @@ export const verifyConservation = (oldItems, newItems) => {
318
318
  // Match contract (line-scoped; fenced lines never count): a textual occurrence of the
319
319
  // source-file-plus-fragment form. The lookbehind rejects a longer filename
320
320
  // (`other-decisions.md#…` is a different file, never a match); a bare `#ad-NNN` has no file part.
321
- const DOCS_AI_REL = 'docs/ai';
321
+ const DOCS_AI_REL = DOCS_TREE;
322
322
  const HOT_LINK_RE = /(?<![\w.-])decisions\.md#(ad-(\d{3,})[\w-]*)/g;
323
323
  const MONOLITH_LINK_RE = /(?<![\w.-])(?:\.\.?\/)*(?:history\/)?decisions-archive(?:-early)?\.md#(ad-(\d{3,})[\w-]*)/g;
324
324
  // The right boundary mirrors the lookbehind: `…md.bak` / `…md/child` are DIFFERENT targets, never
@@ -4,13 +4,13 @@
4
4
  import { readFileSync, mkdirSync, existsSync, realpathSync } from 'node:fs';
5
5
  import { resolve, basename } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
- import { tokenizeMarkdown, fail, findProjectRoot, composeRedBlock, composeUsageRefusal, guardChecker } from '../shared/index.mjs';
7
+ import { tokenizeMarkdown, fail, findProjectRoot, composeRedBlock, composeUsageRefusal, guardChecker, HISTORY, ISSUES_RESOLVED, KNOWN_ISSUES, PACKAGE_JSON } from '../shared/index.mjs';
8
8
  import { fsIo, writeWhole } from './whole-write.mjs';
9
9
  import { trimmedLines, sectionsToAppend } from './rotation-conservation.mjs';
10
10
 
11
11
  const ROOT = findProjectRoot(import.meta.url);
12
12
  const CHECKER_NAME = 'archive-issues';
13
- const PACKAGE_REL = 'package.json';
13
+ const PACKAGE_REL = PACKAGE_JSON;
14
14
  const GUARD = Object.freeze({ name: CHECKER_NAME, exitCode: 1, remedy: 'fix the cause the stack below names, then re-run' });
15
15
  const shown = (text) => text.replace(/\r/g, '\\r').replace(/\n/g, '\\n');
16
16
  const composeFailure = (failed, findings, remedy) => ({
@@ -31,9 +31,9 @@ export const readProjectName = (root) => {
31
31
  return basename(root);
32
32
  }
33
33
  };
34
- const KNOWN_REL = 'docs/ai/known_issues.md';
35
- const HISTORY_REL = 'docs/ai/history';
36
- const RESOLVED_REL = 'docs/ai/history/issues-resolved.md';
34
+ const KNOWN_REL = KNOWN_ISSUES;
35
+ const HISTORY_REL = HISTORY;
36
+ const RESOLVED_REL = ISSUES_RESOLVED;
37
37
 
38
38
  const DEFAULT_CUTOFF_DAYS = 14;
39
39
  const MS_PER_DAY = 24 * 60 * 60 * 1000;
@@ -2,8 +2,9 @@
2
2
 
3
3
  import { readFileSync } from 'node:fs';
4
4
  import { resolve } from 'node:path';
5
+ import { CHANGELOG_CARRY } from '../shared/index.mjs';
5
6
 
6
- export const CARRY_REL = 'docs/ai/history/changelog.carry';
7
+ export const CARRY_REL = CHANGELOG_CARRY;
7
8
 
8
9
  export const readCarry = (root) => {
9
10
  try {
@@ -30,17 +30,17 @@ import { dirname, resolve, relative, join, basename, sep } from 'node:path';
30
30
  import { fileURLToPath } from 'node:url';
31
31
  import { randomBytes } from 'node:crypto';
32
32
  import { readSpecDocument, SPECS_COLLAPSE } from '../spec-schema/index.mjs';
33
- import { findProjectRoot } from '../shared/index.mjs';
33
+ import { ADR_LOG, ADR_STORE, AGENTS_FILE, AGENTS_SKILLS, CLAUDE_FILE, DOCS_TREE, INDEX, PACKAGE_JSON, findProjectRoot } from '../shared/index.mjs';
34
34
 
35
35
  const ROOT = findProjectRoot(import.meta.url);
36
- const DOCS_DIR = resolve(ROOT, 'docs/ai');
37
- const INDEX_PATH = resolve(DOCS_DIR, 'index.md');
36
+ const DOCS_DIR = resolve(ROOT, DOCS_TREE);
37
+ const INDEX_PATH = resolve(ROOT, INDEX);
38
38
 
39
39
  // The module ROOT constants are the CLI DEFAULT (this deployment's own root); `--root=<dir>` and the
40
40
  // exported `regenerateIndex(root, today)` target an arbitrary root (the ADR-rotation hook, hermetic tests).
41
41
  const pathsFor = (root) => {
42
42
  const base = resolve(root);
43
- return { root: base, docsDir: resolve(base, 'docs/ai'), indexPath: resolve(base, 'docs/ai/index.md') };
43
+ return { root: base, docsDir: resolve(base, DOCS_TREE), indexPath: resolve(base, INDEX) };
44
44
  };
45
45
 
46
46
  const MS_PER_DAY = 24 * 60 * 60 * 1000;
@@ -95,7 +95,7 @@ export const discoverMeta = async (root = ROOT, { strict = false, deps = {} } =
95
95
  // fallback, under strict too.
96
96
  let manifest = null;
97
97
  try {
98
- manifest = await read(resolve(root, 'package.json'), 'utf8');
98
+ manifest = await read(resolve(root, PACKAGE_JSON), 'utf8');
99
99
  } catch (err) {
100
100
  rethrowUnlessAbsent(err, strict);
101
101
  }
@@ -109,8 +109,8 @@ export const discoverMeta = async (root = ROOT, { strict = false, deps = {} } =
109
109
  }
110
110
  const agentsFiles = await walkForName(root, 'AGENTS.md', [], 0, strict, deps);
111
111
  const claudeFiles = await walkForName(root, 'CLAUDE.md', [], 0, strict, deps);
112
- const rootAgents = resolve(root, 'AGENTS.md');
113
- const rootClaude = resolve(root, 'CLAUDE.md');
112
+ const rootAgents = resolve(root, AGENTS_FILE);
113
+ const rootClaude = resolve(root, CLAUDE_FILE);
114
114
  // A subdir typically holds AGENTS.md plus a CLAUDE.md symlink to it — list each
115
115
  // dir once (prefer AGENTS.md, drop its sibling CLAUDE.md alias).
116
116
  const agentsDirs = new Set(agentsFiles.map((file) => dirname(resolve(file))));
@@ -126,12 +126,12 @@ export const discoverMeta = async (root = ROOT, { strict = false, deps = {} } =
126
126
  .map((rel) => `[\`${rel}\`](../../${rel})`);
127
127
  let onDemandLinks = [];
128
128
  try {
129
- const skillDirs = await readDir(resolve(root, '.agents/skills'), { withFileTypes: true });
129
+ const skillDirs = await readDir(resolve(root, AGENTS_SKILLS), { withFileTypes: true });
130
130
  onDemandLinks = skillDirs
131
131
  .filter((dirent) => dirent.isDirectory() && /-(patterns|commands)$/.test(dirent.name))
132
132
  .map((dirent) => dirent.name)
133
133
  .sort()
134
- .map((name) => `[\`${name}\`](../../.agents/skills/${name}/SKILL.md)`);
134
+ .map((name) => `[\`${name}\`](../../${AGENTS_SKILLS}/${name}/SKILL.md)`);
135
135
  } catch (err) {
136
136
  // No .agents/skills — omit the section (under strict, only a real absence may omit it).
137
137
  rethrowUnlessAbsent(err, strict);
@@ -348,10 +348,10 @@ maxLines: __CAP__
348
348
  ## Files
349
349
 
350
350
  `;
351
-
351
+ const stripDocsTreePrefix = (path) => path.startsWith(`${DOCS_TREE}/`) ? path.slice(DOCS_TREE.length + 1) : path;
352
352
  const formatIndexRow = (row) => {
353
353
  const fm = row.frontmatter ?? {};
354
- const name = row.path.replace(/^docs\/ai\//, '');
354
+ const name = stripDocsTreePrefix(row.path);
355
355
  const link = `[\`${name}\`](./${name})`;
356
356
  return `| ${link} | ${fm.type ?? '—'} | ${row.lineCount}/${fm.maxLines ?? '—'} | ${fm.lastUpdated ?? '—'} | ${fm.staleAfter ?? '—'} |`;
357
357
  };
@@ -362,9 +362,9 @@ const formatIndexRow = (row) => {
362
362
  // index RENDERING is collapsed). Membership is by PROOF: a genuine ADR record / the adr navigator,
363
363
  // or a spec-store file the shared reader accepts. Anything else under either dir (a stray README.md,
364
364
  // a malformed spec) renders as its OWN visible row — never silently hidden by the collapse.
365
- const ADR_DIR_PREFIX = 'docs/ai/adr/';
365
+ const ADR_DIR_PREFIX = `${ADR_STORE}/`;
366
366
  const ADR_RECORD_RE = /\/AD-(\d{3,})-[^/]*\.md$/;
367
- const ADR_NAV_PATH = 'docs/ai/adr/log.md';
367
+ const ADR_NAV_PATH = ADR_LOG;
368
368
 
369
369
  const formatAdrCollapseRow = (adrRows) => {
370
370
  const recs = adrRows
@@ -381,7 +381,7 @@ const formatAdrCollapseRow = (adrRows) => {
381
381
  // The live counts make the row change when a spec is added or removed, so --check-index sees it.
382
382
  const formatSpecsCollapseRow = (specRows) => {
383
383
  const count = (kind) => specRows.filter((r) => r.spec.kind === kind).length;
384
- const link = `[\`${SPECS_COLLAPSE.label}\`](./${SPECS_COLLAPSE.navPath.replace(/^docs\/ai\//, '')})`;
384
+ const link = `[\`${SPECS_COLLAPSE.label}\`](./${stripDocsTreePrefix(SPECS_COLLAPSE.navPath)})`;
385
385
  return `| ${link} | ${SPECS_COLLAPSE.type} | ${count('spec')} specs | ${count('part')} parts · ${count('index')} indexes | — |`;
386
386
  };
387
387
 
@@ -403,7 +403,7 @@ export const buildIndex = (rows, todayStr, meta = {}) => {
403
403
  const singles = [];
404
404
  const grouped = COLLAPSE_GROUPS.map(() => []);
405
405
  for (const r of rows) {
406
- if (r.path === 'docs/ai/index.md') continue;
406
+ if (r.path === INDEX) continue;
407
407
  const group = COLLAPSE_GROUPS.findIndex((g) => g.isMember(r));
408
408
  (group === -1 ? singles : grouped[group]).push(r);
409
409
  }
@@ -35,10 +35,12 @@
35
35
  { "path": "gates/migrate-gates.test.mjs", "role": "suite" },
36
36
  { "path": "gates/migrate-gates-branches.test.mjs", "role": "suite" },
37
37
  { "path": "gates/kit-command-gates.test.mjs", "role": "suite" },
38
+ { "path": "shared/locations.mjs", "role": "deployed", "seed": true },
38
39
  { "path": "shared/markdown-blocks.mjs", "role": "deployed", "seed": true },
39
40
  { "path": "shared/project-root.mjs", "role": "deployed", "seed": true },
40
41
  { "path": "shared/verdict-block.mjs", "role": "deployed", "seed": true },
41
42
  { "path": "shared/index.mjs", "role": "deployed", "seed": true },
43
+ { "path": "shared/locations.test.mjs", "role": "suite" },
42
44
  { "path": "shared/markdown-blocks.test.mjs", "role": "suite" },
43
45
  { "path": "shared/project-root.test.mjs", "role": "suite" },
44
46
  { "path": "shared/verdict-block.test.mjs", "role": "suite" },
@@ -5,17 +5,16 @@
5
5
  import { lstatSync, readFileSync } from 'node:fs';
6
6
  import { dirname, join, posix } from 'node:path';
7
7
  import { fileURLToPath } from 'node:url';
8
- import { KIT_COMMANDS, KIT_COMMAND_PATH } from '../run.mjs';
8
+ import { KIT_COMMANDS } from '../run.mjs';
9
9
  import { readFamily } from '../family.mjs';
10
+ import { KIT_COMMAND, KIT_FOLDER, SCRIPTS } from '../shared/index.mjs';
10
11
 
11
12
  const TREE = dirname(dirname(fileURLToPath(import.meta.url)));
12
- const KIT_FOLDER = dirname(KIT_COMMAND_PATH);
13
- const SCRIPTS_FOLDER = dirname(KIT_FOLDER);
14
- const COMMAND = `node ${KIT_COMMAND_PATH}`;
13
+ const COMMAND = `node ${KIT_COMMAND}`;
15
14
 
16
15
  const fileNameOf = (path) => path.slice(path.lastIndexOf('/') + 1);
17
16
  const NAME_BY_FILE = new Map(Object.entries(KIT_COMMANDS).map(([name, target]) => [fileNameOf(target), name]));
18
- const flatOf = (target) => `${SCRIPTS_FOLDER}/${fileNameOf(target)}`;
17
+ const flatOf = (target) => `${SCRIPTS}/${fileNameOf(target)}`;
19
18
 
20
19
  // path token → { name, flat } for the deployed or the flat path of a known name, relative to the project root.
21
20
  const KNOWN_PATHS = new Map(Object.entries(KIT_COMMANDS).flatMap(([name, target]) => [
@@ -43,7 +42,7 @@ const matchOf = (cmd) => {
43
42
  // Every known name whose target's file name stands whole in the cmd and not as the end of its deployed path, one per occurrence.
44
43
  const namedChecks = (cmd) => [...cmd.matchAll(CHECK_FILE)].flatMap((found) => {
45
44
  const name = NAME_BY_FILE.get(found[1]);
46
- return cmd.slice(0, found.index).endsWith(`agent-workflow/${posix.dirname(KIT_COMMANDS[name])}/`) ? [] : [name];
45
+ return cmd.slice(0, found.index).endsWith(`${posix.basename(KIT_FOLDER)}/${posix.dirname(KIT_COMMANDS[name])}/`) ? [] : [name];
47
46
  });
48
47
 
49
48
  export const repointsOf = (gate) => namedChecks(gate.cmd).map((name) => ({ id: gate.id, repoint: `${COMMAND} ${name}` }));
@@ -61,12 +60,12 @@ const firstStaleKitPath = (projectDir, name) => {
61
60
  }
62
61
  };
63
62
  const folders = new Set();
64
- for (const folder of [SCRIPTS_FOLDER, KIT_FOLDER]) {
63
+ for (const folder of [SCRIPTS, KIT_FOLDER]) {
65
64
  if (!isPlain(folder, 'directory')) return folder;
66
65
  folders.add(folder);
67
66
  }
68
67
  const deployedPaths = new Set(readFamily(TREE).filter((entry) => entry.role === 'deployed').map(({ path }) => path));
69
- const needed = new Set([fileNameOf(KIT_COMMAND_PATH), KIT_COMMANDS[name]]);
68
+ const needed = new Set([posix.relative(KIT_FOLDER, KIT_COMMAND), KIT_COMMANDS[name]]);
70
69
  for (const path of needed) {
71
70
  const deployed = `${KIT_FOLDER}/${path}`;
72
71
  const folder = dirname(deployed);
@@ -35,6 +35,8 @@ import { dirname, join, resolve, isAbsolute } from 'node:path';
35
35
  import { fileURLToPath } from 'node:url';
36
36
  import { randomBytes } from 'node:crypto';
37
37
  import { spawnSync } from 'node:child_process';
38
+ import { DOCS, DOCS_TREE, GATES, KIT_COMMAND, KIT_FOLDER } from '../shared/index.mjs';
39
+ import { UNIT_TESTS_NAME, UNIT_TESTS_REPORTER } from '../run.mjs';
38
40
  import { planKitCommandGates, repointsOf } from './kit-command-gates.mjs';
39
41
 
40
42
  export const MIGRATE_GATES_STOP = 'MIGRATE_GATES_STOP';
@@ -42,7 +44,7 @@ const stop = (message) =>
42
44
  Object.assign(new Error(`[agent-workflow] ${message}`), { name: 'MigrateGatesStop', code: MIGRATE_GATES_STOP, exitCode: 1 });
43
45
  const usageFail = (message) => Object.assign(new Error(`[agent-workflow] ${message}`), { exitCode: 2 });
44
46
 
45
- export const GATES_REL = join('docs', 'ai', 'gates.json');
47
+ export const GATES_REL = join(...GATES.split('/'));
46
48
 
47
49
  // The documented canonical forms — ONE plain invocation, quoted or bare path, `--check` at END
48
50
  // (the run-gates strict-matcher shape; a masked/compound form is a CUSTOMIZED entry).
@@ -53,15 +55,13 @@ export const LEGACY_FORMS = Object.freeze([
53
55
  ]);
54
56
 
55
57
  // coverage-producer canon >>> BEGIN drift-guarded region
56
- // Authored TWICE, byte-identically: in the memory substrate's references/scripts/migrate-gates.mjs
57
- // and in the composition root's tools/coverage-producer.mjs. Neither side imports the other — the
58
- // substrate is standalone and must not depend on the root, and the root must not import mirrored
59
- // bytes — so a TEXT drift guard beside the root's copy holds them equal. Edit BOTH, then re-run the
60
- // mirror sync.
58
+ // Authored twice, byte-identically. Each host imports the four names above this region, and neither
59
+ // imports the other. A text drift guard beside the kit's copy keeps the regions equal.
60
+ // Edit both copies, then sync the mirror.
61
61
  //
62
62
  // The ONE producer form the kit writes: the stable kit command's unit-tests name (spec kit-command) —
63
63
  // the Node test runner with the lcov reporter under AW_GIT_DIR and the kit test reporter on stdout.
64
- export const COVERAGE_PRODUCER_BODY = 'node scripts/agent-workflow/run.mjs unit-tests';
64
+ export const COVERAGE_PRODUCER_BODY = `node ${KIT_COMMAND} ${UNIT_TESTS_NAME}`;
65
65
 
66
66
  // The reporter flag sets earlier kits wrote after `node --test`, newest first, byte for byte: a MOVE
67
67
  // LIST the gate migration switches onto the body above, never read as a producer.
@@ -140,7 +140,7 @@ export const retiredProducerFormOf = (cmd) => {
140
140
  // unitTestsGuardFailure → the guard on every write of the body: run.mjs a regular file equal to `ownRun`, then the reporter
141
141
  // a regular file, every folder on the way a directory (lstat: a link fails); null, or the first failing path and kind,
142
142
  // worded by guardRemedy with the caller's upgrade.
143
- const GUARD_PATHS = Object.freeze(['scripts/agent-workflow/run.mjs', 'scripts/agent-workflow/test-reporter/reporter.mjs']);
143
+ const GUARD_PATHS = Object.freeze([KIT_COMMAND, `${KIT_FOLDER}/${UNIT_TESTS_REPORTER}`]);
144
144
  export const unitTestsGuardFailure = (projectDir, ownRun, { lstatSync, readFileSync }) => {
145
145
  for (const rel of GUARD_PATHS) {
146
146
  const parts = rel.split('/');
@@ -642,8 +642,8 @@ export const formatPreview = (analysis, applyHint) => {
642
642
  // "no declaration" (a preview no-op); any OTHER lstat failure (EACCES, EIO) fails CLOSED —
643
643
  // an unverifiable parent is never treated as safe. lstatFn is the injectable test seam.
644
644
  const checkRealParents = (cwd, lstatFn) => {
645
- for (const rel of ['docs', join('docs', 'ai')]) {
646
- const p = join(cwd, rel);
645
+ for (const rel of [DOCS, DOCS_TREE]) {
646
+ const p = join(cwd, ...rel.split('/'));
647
647
  let st;
648
648
  try {
649
649
  st = lstatFn(p);
@@ -8,8 +8,8 @@
8
8
  // stale archive entries never reach a commit. The hook runs no suite.
9
9
  // First after `set -e` it runs the project's own `scripts/pre-commit.local` with bash when present.
10
10
  //
11
- // The project root is three levels above this file's own folder (scripts/agent-workflow/git-hooks/):
12
- // the installer imports nothing, so the bytes a danger check binds are the bytes the run executes.
11
+ // The installer gets its project root from findProjectRoot through the shared index.
12
+ // The git-hook items bind the installer and every deployed path it may load (spec init-project, part git-hooks).
13
13
  //
14
14
  // The hooks location comes from git's OWN answer (`git rev-parse --git-path hooks`) — a linked
15
15
  // worktree resolves ITS OWN hooks path (its `.git` is a FILE; a hardcoded `.git/hooks` would
@@ -40,13 +40,12 @@
40
40
 
41
41
  import { writeFile, readFile, mkdir, chmod } from 'node:fs/promises';
42
42
  import { existsSync, realpathSync } from 'node:fs';
43
- import { dirname, resolve, basename } from 'node:path';
43
+ import { resolve, basename } from 'node:path';
44
44
  import { fileURLToPath } from 'node:url';
45
45
  import { spawnSync } from 'node:child_process';
46
+ import { KIT_COMMAND, LOCAL_HOOK, findProjectRoot } from '../shared/index.mjs';
46
47
 
47
- const __filename = fileURLToPath(import.meta.url);
48
- const __dirname = dirname(__filename);
49
- const ROOT = resolve(__dirname, '..', '..', '..');
48
+ const ROOT = findProjectRoot(import.meta.url);
50
49
 
51
50
  export const MAGIC_MARKER = '# agent-workflow:install-git-hooks.mjs';
52
51
  const MARKER_TAIL = ':install-git-hooks.mjs';
@@ -160,13 +159,13 @@ ${MAGIC_MARKER}
160
159
  # never reach a commit.
161
160
  set -e
162
161
  # Your own commit checks go in scripts/pre-commit.local; it runs first, with bash, when present.
163
- if [ -f scripts/pre-commit.local ]; then bash scripts/pre-commit.local; fi
164
- if [ -f scripts/agent-workflow/run.mjs ]; then
165
- node scripts/agent-workflow/run.mjs docs-size
166
- node scripts/agent-workflow/run.mjs docs-size --check-index
167
- node scripts/agent-workflow/run.mjs archive-changelog --check
168
- node scripts/agent-workflow/run.mjs archive-issues --check
169
- node scripts/agent-workflow/run.mjs archive-decisions --check
162
+ if [ -f ${LOCAL_HOOK} ]; then bash ${LOCAL_HOOK}; fi
163
+ if [ -f ${KIT_COMMAND} ]; then
164
+ node ${KIT_COMMAND} docs-size
165
+ node ${KIT_COMMAND} docs-size --check-index
166
+ node ${KIT_COMMAND} archive-changelog --check
167
+ node ${KIT_COMMAND} archive-issues --check
168
+ node ${KIT_COMMAND} archive-decisions --check
170
169
  else
171
170
  echo "scripts/agent-workflow/run.mjs is not in this checkout — the kit's docs and archive checks are skipped for this commit; merge the commit that adds scripts/agent-workflow/, or run the kit's upgrade in this checkout"
172
171
  fi
@@ -214,6 +213,7 @@ const isDirectRun = (() => {
214
213
  const invoked = process.argv[1];
215
214
  if (!invoked) return false;
216
215
  try {
216
+ const __filename = fileURLToPath(import.meta.url);
217
217
  return realpathSync(invoked) === realpathSync(__filename);
218
218
  } catch {
219
219
  return false;
@@ -12,7 +12,6 @@ import { spawnSync } from 'node:child_process';
12
12
  const __filename = fileURLToPath(import.meta.url);
13
13
  const HERE = dirname(__filename);
14
14
 
15
- export const KIT_COMMAND_PATH = 'scripts/agent-workflow/run.mjs';
16
15
  export const KIT_COMMANDS = Object.freeze({
17
16
  'docs-size': 'docs-size/check-docs-size.mjs',
18
17
  'archive-changelog': 'archives/archive-changelog.mjs',
@@ -25,7 +24,7 @@ export const UNIT_TESTS_REPORTER = 'test-reporter/reporter.mjs';
25
24
 
26
25
  const NAMES = [...Object.keys(KIT_COMMANDS), UNIT_TESTS_NAME];
27
26
  const PREFIX = '[run]';
28
- const USAGE = `Usage: node ${KIT_COMMAND_PATH} <name> [arguments...]
27
+ const USAGE = `Usage: node scripts/agent-workflow/run.mjs <name> [arguments...]
29
28
  Runs the named kit check with every argument after the name, unchanged; ${UNIT_TESTS_NAME} runs the Node test runner
30
29
  with the lcov reporter and the kit test reporter over the arguments. Names: ${NAMES.join(', ')}.
31
30
  `;
@@ -1,4 +1,6 @@
1
1
  // The shared module's one door (spec script-family).
2
+ export { ACKS, ADR_LOG, ADR_STORE, AGENTS_DIR, AGENTS_FILE, AGENTS_SKILLS, AGENT_RULES, AIDER_CHAT_HISTORY, AIDER_CONF, AIDER_INPUT_HISTORY, ANTIGRAVITY_FILE, AUTONOMY, BINDING_GYP, BUN_LOCK, BUN_LOCKB, CHANGELOG, CHANGELOG_CARRY, CHANGELOG_LEGACY, CLAUDE_DIR, CLAUDE_FILE, CODEIUM_DIR, CODEX_LAST_SESSION, CONDENSED_INDEX, CONTINUE_DIR, CURSORRULES, CURSOR_RULES, DECISIONS, DECISIONS_ARCHIVE, DECISIONS_ARCHIVE_EARLY, DOCS, DOCS_TREE, EPIC_STORE, EPIC_STORE_SEED, GATES, GATE_HOOK, GEMINI_FILE, GITHUB_DIR, GIT_CONFIG, GIT_DIR, GIT_EXCLUDE, GIT_HOOKS, HANDOVER, HISTORY, HOOKS_DIR, INDEX, ISSUES_RESOLVED, KIT_COMMAND, KIT_FOLDER, KNOWN_ISSUES, LANES, LERNA_JSON, LOCAL_HOOK, MCP_FILE, MEMORY_STAMP, NODE_MODULES, NPM_LOCK, ORCHESTRATION, PACKAGE_JSON, PLANS, PNPM_LOCK, PNPM_WORKSPACE, PNPM_WORKSPACE_YML, PRE_COMMIT, PROFILE_DECLINES, QUEUE, RECENT, RULES, RULES_EFFECTIVE, RULES_LOCAL, RULES_RECORD, SCRIPTS, SETTINGS, SETTINGS_LOCAL, SKILLS_DIR, SOURCE_SIZE } from './locations.mjs';
3
+ export { COVERAGE_DECLARED, SPEC_COVERAGE, SPEC_STORE, SPEC_STORE_INDEX, STAGE_GUARD_HOOK, STOP_HOOK, SYNC_MIRRORS, VEHICLES, VSCODE_DIR, VSCODE_SETTINGS, WINDSURFRULES, WINDSURF_DIR, WORKFLOW_STAMP, WORKTREES, YARN_LOCK } from './locations.mjs';
2
4
  export { tokenizeMarkdown, findParagraphBreak, fail } from './markdown-blocks.mjs';
3
5
  export { findProjectRoot } from './project-root.mjs';
4
6
  export { composeRedBlock, composeUsageRefusal, guardChecker } from './verdict-block.mjs';
@@ -0,0 +1,103 @@
1
+ // locations.mjs — docs/ai/specs/memory/locations.md
2
+
3
+ export const DOCS = 'docs';
4
+ export const SCRIPTS = 'scripts';
5
+ export const CLAUDE_DIR = '.claude';
6
+ export const GIT_DIR = '.git';
7
+ export const PACKAGE_JSON = 'package.json';
8
+ export const AGENTS_FILE = 'AGENTS.md';
9
+ export const CLAUDE_FILE = 'CLAUDE.md';
10
+ export const MCP_FILE = '.mcp.json';
11
+ export const GITIGNORE = '.gitignore';
12
+ export const GITATTRIBUTES = '.gitattributes';
13
+ export const DOT_AGENTS = '.agents';
14
+ export const NPM_LOCK = 'package-lock.json';
15
+ export const PNPM_LOCK = 'pnpm-lock.yaml';
16
+ export const YARN_LOCK = 'yarn.lock';
17
+ export const BUN_LOCKB = 'bun.lockb';
18
+ export const BUN_LOCK = 'bun.lock';
19
+ export const PNPM_WORKSPACE = 'pnpm-workspace.yaml';
20
+ export const PNPM_WORKSPACE_YML = 'pnpm-workspace.yml';
21
+ export const LERNA_JSON = 'lerna.json';
22
+ export const NODE_MODULES = 'node_modules';
23
+ export const CODEX_LAST_SESSION = '.codex-last-session';
24
+ export const VSCODE_DIR = '.vscode';
25
+ export const CURSOR_DIR = '.cursor';
26
+ export const CURSORRULES = '.cursorrules';
27
+ export const CODEIUM_DIR = '.codeium';
28
+ export const WINDSURF_DIR = '.windsurf';
29
+ export const WINDSURFRULES = '.windsurfrules';
30
+ export const GEMINI_FILE = 'GEMINI.md';
31
+ export const ANTIGRAVITY_FILE = '.antigravity.md';
32
+ export const GITHUB_DIR = '.github';
33
+ export const AIDER_CONF = '.aider.conf.yml';
34
+ export const AIDER_CHAT_HISTORY = '.aider.chat.history.md';
35
+ export const AIDER_INPUT_HISTORY = '.aider.input.history';
36
+ export const CONTINUE_DIR = '.continue';
37
+ export const BINDING_GYP = 'binding.gyp';
38
+
39
+ export const DOCS_TREE = `${DOCS}/ai`;
40
+ export const PLANS = `${DOCS}/plans`;
41
+ export const QUEUE = `${PLANS}/queue.md`;
42
+
43
+ export const KIT_FOLDER = `${SCRIPTS}/agent-workflow`;
44
+ export const LOCAL_HOOK = `${SCRIPTS}/pre-commit.local`;
45
+ export const SYNC_MIRRORS = `${SCRIPTS}/sync-mirrors.mjs`;
46
+ export const KIT_COMMAND = `${KIT_FOLDER}/run.mjs`;
47
+
48
+ export const AGENTS_SKILLS = `${DOT_AGENTS}/skills`;
49
+ export const VSCODE_SETTINGS = `${VSCODE_DIR}/settings.json`;
50
+ export const CURSOR_RULES = `${CURSOR_DIR}/rules`;
51
+
52
+ export const SETTINGS = `${CLAUDE_DIR}/settings.json`;
53
+ export const SETTINGS_LOCAL = `${CLAUDE_DIR}/settings.local.json`;
54
+ export const AGENTS_DIR = `${CLAUDE_DIR}/agents`;
55
+ export const HOOKS_DIR = `${CLAUDE_DIR}/hooks`;
56
+ export const SKILLS_DIR = `${CLAUDE_DIR}/skills`;
57
+ export const GATE_HOOK = `${HOOKS_DIR}/agent-workflow-gates.mjs`;
58
+ export const STOP_HOOK = `${HOOKS_DIR}/state-block-guard.mjs`;
59
+ export const STAGE_GUARD_HOOK = `${HOOKS_DIR}/stage-write-guard.mjs`;
60
+
61
+ export const GIT_CONFIG = `${GIT_DIR}/config`;
62
+ export const GIT_HOOKS = `${GIT_DIR}/hooks`;
63
+ export const GIT_EXCLUDE = `${GIT_DIR}/info/exclude`;
64
+ export const PRE_COMMIT = `${GIT_HOOKS}/pre-commit`;
65
+
66
+ export const INDEX = `${DOCS_TREE}/index.md`;
67
+ export const HANDOVER = `${DOCS_TREE}/handover.md`;
68
+ export const AGENT_RULES = `${DOCS_TREE}/agent_rules.md`;
69
+ export const CHANGELOG = `${DOCS_TREE}/changelog.md`;
70
+ export const CHANGELOG_LEGACY = `${DOCS_TREE}/changelog-archive.md`;
71
+ export const KNOWN_ISSUES = `${DOCS_TREE}/known_issues.md`;
72
+ export const DECISIONS = `${DOCS_TREE}/decisions.md`;
73
+ export const HISTORY = `${DOCS_TREE}/history`;
74
+ export const ADR_STORE = `${DOCS_TREE}/adr`;
75
+ export const SPEC_STORE = `${DOCS_TREE}/specs`;
76
+ export const EPIC_STORE = `${DOCS_TREE}/epics`;
77
+ export const RULES = `${DOCS_TREE}/rules`;
78
+ export const WORKFLOW_STAMP = `${DOCS_TREE}/.workflow-version`;
79
+ export const MEMORY_STAMP = `${DOCS_TREE}/.memory-version`;
80
+ export const GATES = `${DOCS_TREE}/gates.json`;
81
+ export const LANES = `${DOCS_TREE}/lanes.json`;
82
+ export const ORCHESTRATION = `${DOCS_TREE}/orchestration.json`;
83
+ export const AUTONOMY = `${DOCS_TREE}/autonomy.json`;
84
+ export const VEHICLES = `${DOCS_TREE}/vehicles.json`;
85
+ export const WORKTREES = `${DOCS_TREE}/worktrees.json`;
86
+ export const SOURCE_SIZE = `${DOCS_TREE}/source-size.json`;
87
+ export const SPEC_COVERAGE = `${DOCS_TREE}/spec-coverage.json`;
88
+ export const COVERAGE_DECLARED = `${DOCS_TREE}/coverage-declared.json`;
89
+ export const PROFILE_DECLINES = `${DOCS_TREE}/profile-declines.json`;
90
+ export const ACKS = `${DOCS_TREE}/acks.json`;
91
+
92
+ export const RECENT = `${HISTORY}/recent.md`;
93
+ export const CONDENSED_INDEX = `${HISTORY}/condensed-index.md`;
94
+ export const ISSUES_RESOLVED = `${HISTORY}/issues-resolved.md`;
95
+ export const CHANGELOG_CARRY = `${HISTORY}/changelog.carry`;
96
+ export const DECISIONS_ARCHIVE = `${HISTORY}/decisions-archive.md`;
97
+ export const DECISIONS_ARCHIVE_EARLY = `${HISTORY}/decisions-archive-early.md`;
98
+ export const ADR_LOG = `${ADR_STORE}/log.md`;
99
+ export const SPEC_STORE_INDEX = `${SPEC_STORE}/index.md`;
100
+ export const EPIC_STORE_SEED = `${EPIC_STORE}/.gitkeep`;
101
+ export const RULES_LOCAL = `${RULES}/local`;
102
+ export const RULES_EFFECTIVE = `${RULES}/effective`;
103
+ export const RULES_RECORD = `${RULES_EFFECTIVE}/sources.json`;
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  // Canon: the methodology engine's references/specs.md (frozen schema, refusals table).
3
+ import { SPEC_STORE } from '../shared/index.mjs';
3
4
 
4
5
  export const SPEC_SCHEMA = Object.freeze({
5
- storePrefix: 'docs/ai/specs/',
6
+ storePrefix: `${SPEC_STORE}/`,
6
7
  navigatorFile: 'index.md',
7
8
  upLink: 'technical_specification.md',
8
9
  upLinkLine: '> Up: [technical_specification.md](../technical_specification.md)',
@@ -1,5 +1,5 @@
1
1
  {
2
- "_README": "Per-project orchestration config: the recipe used at each step (slot) of each named activity. Easiest: tell the agent in plain language and run the `set-recipe` writer — it interprets your intent, previews the change, and writes valid JSON for you. You can still hand-edit this file directly whenever you prefer; that option never goes away. Six activities are configured independently, and so is each slot within them: 'plan-authoring' (slots author, fold, review), 'plan-execution' (slots execute, review), 'routine' (slots carrier, parallel), 'feedback-triage' (slot review), 'epic' (slots author, review) and 'task' (slots author, execute). A slot's value is a recipe: a 'review' slot accepts solo | reviewed | council (you self-review / one backend reviews / both review and you synthesize), or an explicit roster array such as [\"codex-review\", \"agy-review\", \"review-lens\"] in hand-edit form; an 'execute' slot accepts solo | delegated | subagent (you implement / a backend runs a bounded sub-task / a full-tool frontier subagent carries a bounded slice you verify); the carrier slots 'plan-authoring.author', 'plan-authoring.fold', 'routine.carrier' and 'epic.author' accept solo | subagent, and the task slots 'task.author' and 'task.execute' take the execute values. 'routine.parallel' is a flag rather than a recipe: it accepts on | off and decides whether file-disjoint subagent slices dispatch concurrently. Every slot seeded below is 'solo' — no execution backend required. A slot the seed leaves silent takes the computed default stated further down: 'feedback-triage.review' is reviewed as soon as a review backend is ready (solo until then), and so is 'epic.review'; 'plan-authoring.author', 'plan-authoring.fold', 'routine.carrier', 'epic.author', 'task.author' and 'task.execute' stay 'solo', and 'routine.parallel' stays 'on'. Raise a slot to reviewed or council for a second opinion, or to delegated to hand off execution; those need an execution backend set up first. 'subagent' needs the executor vehicle placed in this project — the composition root's `agents` writer places it; without it the slot resolves to solo with the reason stated. Remove a slot's line, or a whole activity block (or run `set-recipe --unset <activity>.<slot>`), to fall back to the computed default: reviewed when a review backend is ready and otherwise solo for a review slot, solo for author, fold, execute and carrier, on for parallel. Run the read-only procedures advisor to see an activity's steps plus the recipe resolved for your environment. Strict JSON — no comments.",
2
+ "_README": "Per-project orchestration config: the recipe used at each step (slot) of each named activity. Easiest: tell the agent in plain language and run the `set-recipe` writer — it interprets your intent, previews the change, and writes valid JSON for you. You can still hand-edit this file directly whenever you prefer; that option never goes away. Six activities are configured independently, and so is each slot within them: 'plan-authoring' (slots author, fold, review), 'plan-execution' (slots execute, review), 'routine' (slots carrier, parallel), 'feedback-triage' (slot review), 'epic' (slots author, review) and 'task' (slots author, execute). A slot's value is a recipe: a 'review' slot accepts solo | reviewed | council (you self-review / one backend reviews / both review and you synthesize), or an explicit roster array such as [\"codex-review\", \"agy-review\", \"review-lens\"] in hand-edit form; an 'execute' slot accepts solo | delegated | subagent (you implement / a backend runs a bounded sub-task / a full-tool frontier subagent carries a bounded slice you verify); the carrier slots 'plan-authoring.author', 'plan-authoring.fold', 'routine.carrier' and 'epic.author' accept solo | subagent, and the task slots 'task.author' and 'task.execute' take the execute values. 'routine.parallel' is a flag rather than a recipe: it accepts on | off and decides whether file-disjoint subagent slices dispatch concurrently. Every slot seeded below is 'solo' — no execution backend required. A slot the seed leaves silent takes the computed default stated further down: 'feedback-triage.review' is reviewed as soon as a review backend is ready (solo until then), and so is 'epic.review'; 'plan-authoring.author', 'plan-authoring.fold', 'routine.carrier', 'epic.author', 'task.author' and 'task.execute' stay 'solo', and 'routine.parallel' stays 'on'. Raise a slot to reviewed or council for a second opinion, or to delegated to hand off execution; those need an execution backend set up first. 'subagent' needs the author vehicle for 'plan-authoring.author', 'plan-authoring.fold' and 'epic.author', and the executor vehicle for every other subagent slot — the composition root's `agents` writer places both; without its role's ready vehicle the slot resolves to solo with the reason stated. Remove a slot's line, or a whole activity block (or run `set-recipe --unset <activity>.<slot>`), to fall back to the computed default: reviewed when a review backend is ready and otherwise solo for a review slot, solo for author, fold, execute and carrier, on for parallel. Run the read-only procedures advisor to see an activity's steps plus the recipe resolved for your environment. Strict JSON — no comments.",
3
3
  "plan-authoring": {
4
4
  "review": "solo"
5
5
  },
@@ -5,10 +5,11 @@
5
5
  import { createHash } from 'node:crypto';
6
6
  import { lstatSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
+ import { ACKS } from '../references/scripts/shared/index.mjs';
8
9
  import { assertContainedRealPath } from './fs-safe.mjs';
9
10
  import { readRegularFileNoFollow } from './fs-read-nofollow.mjs';
10
11
 
11
- export const ACKS_FILE = 'docs/ai/acks.json';
12
+ export const ACKS_FILE = ACKS;
12
13
  export const ACKS_LANE_KEY = 'sandboxLaneAck';
13
14
  export const ACKS_WORKTREES_DIR_KEY = 'worktreesDirAck';
14
15
  export const ACKS_COVERAGE_DOMAIN_KEY = 'coverageDomainAck';