@isaacriehm/cairn-core 0.8.0 → 0.9.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 (141) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/attention/bulk-accept.d.ts +0 -2
  3. package/dist/attention/bulk-accept.js +0 -3
  4. package/dist/attention/bulk-accept.js.map +1 -1
  5. package/dist/attention/scoring.d.ts +1 -3
  6. package/dist/attention/scoring.js +1 -12
  7. package/dist/attention/scoring.js.map +1 -1
  8. package/dist/claude/cache.js +1 -0
  9. package/dist/claude/cache.js.map +1 -1
  10. package/dist/claude/runner.js +25 -1
  11. package/dist/claude/runner.js.map +1 -1
  12. package/dist/claude/types.d.ts +8 -0
  13. package/dist/hooks/runners/payload.d.ts +10 -0
  14. package/dist/hooks/runners/payload.js +13 -0
  15. package/dist/hooks/runners/payload.js.map +1 -1
  16. package/dist/hooks/runners/session-end.js +2 -4
  17. package/dist/hooks/runners/session-end.js.map +1 -1
  18. package/dist/hooks/runners/session-start.js +48 -4
  19. package/dist/hooks/runners/session-start.js.map +1 -1
  20. package/dist/init/brand-derive.js +6 -1
  21. package/dist/init/brand-derive.js.map +1 -1
  22. package/dist/init/brand-setup.d.ts +12 -1
  23. package/dist/init/brand-setup.js +36 -1
  24. package/dist/init/brand-setup.js.map +1 -1
  25. package/dist/init/curator/corpus.d.ts +92 -0
  26. package/dist/init/curator/corpus.js +171 -0
  27. package/dist/init/curator/corpus.js.map +1 -0
  28. package/dist/init/curator/emit.d.ts +42 -0
  29. package/dist/init/curator/emit.js +230 -0
  30. package/dist/init/curator/emit.js.map +1 -0
  31. package/dist/init/curator/index.d.ts +1 -0
  32. package/dist/init/curator/index.js +2 -0
  33. package/dist/init/curator/index.js.map +1 -0
  34. package/dist/init/curator/regex-prefilter.d.ts +54 -0
  35. package/dist/init/curator/regex-prefilter.js +185 -0
  36. package/dist/init/curator/regex-prefilter.js.map +1 -0
  37. package/dist/init/curator/validate.d.ts +46 -0
  38. package/dist/init/curator/validate.js +100 -0
  39. package/dist/init/curator/validate.js.map +1 -0
  40. package/dist/init/curator/walker.d.ts +36 -0
  41. package/dist/init/curator/walker.js +380 -0
  42. package/dist/init/curator/walker.js.map +1 -0
  43. package/dist/init/eta-calibration.d.ts +39 -0
  44. package/dist/init/eta-calibration.js +143 -0
  45. package/dist/init/eta-calibration.js.map +1 -0
  46. package/dist/init/index.d.ts +3 -2
  47. package/dist/init/index.js +2 -1
  48. package/dist/init/index.js.map +1 -1
  49. package/dist/init/init.js +4 -20
  50. package/dist/init/init.js.map +1 -1
  51. package/dist/init/mapper-merge.d.ts +4 -6
  52. package/dist/init/mapper-merge.js +11 -34
  53. package/dist/init/mapper-merge.js.map +1 -1
  54. package/dist/init/mapper-parallel.d.ts +0 -1
  55. package/dist/init/mapper-parallel.js +7 -6
  56. package/dist/init/mapper-parallel.js.map +1 -1
  57. package/dist/init/mapper-prompts.d.ts +1 -4
  58. package/dist/init/mapper-prompts.js +2 -6
  59. package/dist/init/mapper-prompts.js.map +1 -1
  60. package/dist/init/mapper.d.ts +8 -7
  61. package/dist/init/mapper.js +23 -15
  62. package/dist/init/mapper.js.map +1 -1
  63. package/dist/init/overlay.js +0 -1
  64. package/dist/init/overlay.js.map +1 -1
  65. package/dist/init/phases/10-rules-merge.d.ts +7 -2
  66. package/dist/init/phases/10-rules-merge.js +18 -45
  67. package/dist/init/phases/10-rules-merge.js.map +1 -1
  68. package/dist/init/phases/13-multidev.d.ts +5 -1
  69. package/dist/init/phases/13-multidev.js +23 -2
  70. package/dist/init/phases/13-multidev.js.map +1 -1
  71. package/dist/init/phases/4-seed.js +1 -2
  72. package/dist/init/phases/4-seed.js.map +1 -1
  73. package/dist/init/phases/5-preflight.d.ts +42 -0
  74. package/dist/init/phases/5-preflight.js +244 -0
  75. package/dist/init/phases/5-preflight.js.map +1 -0
  76. package/dist/init/phases/7-topic-index.d.ts +6 -0
  77. package/dist/init/phases/7-topic-index.js +13 -0
  78. package/dist/init/phases/7-topic-index.js.map +1 -1
  79. package/dist/init/phases/8-docs-ingest.d.ts +6 -5
  80. package/dist/init/phases/8-docs-ingest.js +17 -56
  81. package/dist/init/phases/8-docs-ingest.js.map +1 -1
  82. package/dist/init/phases/9a-walker.d.ts +15 -0
  83. package/dist/init/phases/9a-walker.js +63 -0
  84. package/dist/init/phases/9a-walker.js.map +1 -0
  85. package/dist/init/phases/9b-curate.d.ts +19 -0
  86. package/dist/init/phases/9b-curate.js +79 -0
  87. package/dist/init/phases/9b-curate.js.map +1 -0
  88. package/dist/init/phases/9c-emit.d.ts +13 -0
  89. package/dist/init/phases/9c-emit.js +57 -0
  90. package/dist/init/phases/9c-emit.js.map +1 -0
  91. package/dist/init/phases/index.d.ts +6 -5
  92. package/dist/init/phases/index.js +4 -4
  93. package/dist/init/phases/index.js.map +1 -1
  94. package/dist/init/phases/mapper-output-io.d.ts +5 -5
  95. package/dist/init/phases/mapper-output-io.js +5 -5
  96. package/dist/init/phases/orchestrator.js +1 -1
  97. package/dist/init/phases/state-io.js +1 -1
  98. package/dist/init/phases/types.d.ts +79 -13
  99. package/dist/init/phases/types.js +4 -2
  100. package/dist/init/phases/types.js.map +1 -1
  101. package/dist/init/source-comments/ingest.d.ts +0 -2
  102. package/dist/init/source-comments/ingest.js.map +1 -1
  103. package/dist/init/source-comments/walker.js +2 -2
  104. package/dist/init/topic-index/index.d.ts +8 -0
  105. package/dist/init/topic-index/index.js +10 -2
  106. package/dist/init/topic-index/index.js.map +1 -1
  107. package/dist/init/topic-index/judge.d.ts +15 -0
  108. package/dist/init/topic-index/judge.js +15 -1
  109. package/dist/init/topic-index/judge.js.map +1 -1
  110. package/dist/init/topic-index/resolve.js +41 -14
  111. package/dist/init/topic-index/resolve.js.map +1 -1
  112. package/dist/init/walker.d.ts +1 -1
  113. package/dist/init/walker.js +1 -1
  114. package/dist/init/workflow-block.d.ts +5 -6
  115. package/dist/init/workflow-block.js +5 -9
  116. package/dist/init/workflow-block.js.map +1 -1
  117. package/dist/mcp/tools/bulk-accept-attention.d.ts +1 -1
  118. package/dist/mcp/tools/bulk-accept-attention.js +4 -6
  119. package/dist/mcp/tools/bulk-accept-attention.js.map +1 -1
  120. package/dist/mcp/tools/init-phases.d.ts +7 -6
  121. package/dist/mcp/tools/init-phases.js +34 -59
  122. package/dist/mcp/tools/init-phases.js.map +1 -1
  123. package/package.json +2 -2
  124. package/templates/.cairn/config/trust-policy.yaml +0 -3
  125. package/templates/.cairn/config/workflow.md +0 -1
  126. package/templates/.cairn/ground/canonical-map/topics.yaml +0 -12
  127. package/dist/init/phases/5-pilot.d.ts +0 -10
  128. package/dist/init/phases/5-pilot.js +0 -108
  129. package/dist/init/phases/5-pilot.js.map +0 -1
  130. package/dist/init/phases/9-source-comments.d.ts +0 -6
  131. package/dist/init/phases/9-source-comments.js +0 -67
  132. package/dist/init/phases/9-source-comments.js.map +0 -1
  133. package/dist/init/phases/parallel-8910.d.ts +0 -27
  134. package/dist/init/phases/parallel-8910.js +0 -197
  135. package/dist/init/phases/parallel-8910.js.map +0 -1
  136. package/dist/init/phases/source-comments-output-io.d.ts +0 -89
  137. package/dist/init/phases/source-comments-output-io.js +0 -81
  138. package/dist/init/phases/source-comments-output-io.js.map +0 -1
  139. package/templates/.cairn/ground/capabilities/mcp-tools.yaml +0 -29
  140. package/templates/.cairn/ground/capabilities/skills.yaml +0 -25
  141. package/templates/.cairn/ground/capabilities/snippets.yaml +0 -29
@@ -1,108 +0,0 @@
1
- /**
2
- * Phase 5-pilot — operator picks the seed module.
3
- *
4
- * The mapper's `pilot_module` field is the model's first guess; this
5
- * phase surfaces it alongside the next 2 strongest `key_modules` so
6
- * the operator can override. Picking the pilot determines which
7
- * module's globs flow into `.cairn/config.yaml.project_globs` first.
8
- */
9
- import { advancePhase } from "./orchestrator.js";
10
- const MAX_OPTIONS = 3;
11
- export async function runPhase5Pilot(state) {
12
- const mapper = state.outputs["3-mapper"];
13
- if (mapper === undefined) {
14
- return {
15
- status: "error",
16
- error: {
17
- code: "missing-prereqs",
18
- message: "Phase 5 needs phase 3-mapper output",
19
- },
20
- state,
21
- };
22
- }
23
- // Operator already picked → consume + advance.
24
- if (state.answer !== undefined && state.answer.length > 0) {
25
- const next = {
26
- ...state,
27
- outputs: { ...state.outputs, "5-pilot": { picked: state.answer } },
28
- answer: undefined,
29
- };
30
- return {
31
- status: "complete",
32
- nextPhase: "6-brand",
33
- state: advancePhase(next),
34
- };
35
- }
36
- const out = mapper.output;
37
- const candidates = [];
38
- // Canonicalize repo-root forms — mapper can emit "" (key_module),
39
- // "." (Haiku merge override), or "ALL" (mapper-merge fallback) for
40
- // the same logical "whole repo" pick. Collapse them so dedup works.
41
- const canonId = (p) => {
42
- const trimmed = p.trim();
43
- if (trimmed.length === 0 || trimmed === "ALL")
44
- return ".";
45
- return trimmed;
46
- };
47
- // Render the repo-root canonical id with a contextual label so the
48
- // operator doesn't see a bare dot or the literal "ALL" between
49
- // backticks.
50
- const labelFor = (p) => (canonId(p) === "." ? "Repo root (.)" : p);
51
- const seen = new Set();
52
- const pushUnique = (opt) => {
53
- if (seen.has(opt.id))
54
- return;
55
- seen.add(opt.id);
56
- candidates.push(opt);
57
- };
58
- // Pilot first (always at least repo-root, even when empty).
59
- pushUnique({
60
- id: canonId(out.pilot_module),
61
- label: labelFor(out.pilot_module),
62
- detail: "Mapper's first pick",
63
- });
64
- // Top 2 key_modules other than pilot — dedup by canonical id so a
65
- // key_module pointing at the same path as the pilot doesn't surface
66
- // as a phantom second option.
67
- for (const km of out.key_modules) {
68
- if (candidates.length >= MAX_OPTIONS)
69
- break;
70
- pushUnique({
71
- id: canonId(km.path),
72
- label: labelFor(km.path),
73
- detail: km.purpose,
74
- });
75
- }
76
- // Fallback if mapper produced nothing.
77
- if (candidates.length === 0) {
78
- pushUnique({
79
- id: ".",
80
- label: "Repo root (.)",
81
- detail: "Whole repo as the pilot scope",
82
- });
83
- }
84
- // Single candidate → no real choice for the operator. Auto-pick and
85
- // skip the prompt rather than burning an interaction on a one-option
86
- // AskUserQuestion.
87
- if (candidates.length === 1) {
88
- const picked = candidates[0].id;
89
- const next = {
90
- ...state,
91
- outputs: { ...state.outputs, "5-pilot": { picked } },
92
- answer: undefined,
93
- };
94
- return {
95
- status: "complete",
96
- nextPhase: "6-brand",
97
- state: advancePhase(next),
98
- };
99
- }
100
- const question = {
101
- id: "5-pilot",
102
- prompt: "Which module should Cairn seed first?",
103
- options: candidates,
104
- default: candidates[0].id,
105
- };
106
- return { status: "needs_input", question, state };
107
- }
108
- //# sourceMappingURL=5-pilot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"5-pilot.js","sourceRoot":"","sources":["../../../src/init/phases/5-pilot.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQjD,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAiB;IACpD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK,EAAE;gBACL,IAAI,EAAE,iBAAiB;gBACvB,OAAO,EAAE,qCAAqC;aAC/C;YACD,KAAK;SACN,CAAC;IACJ,CAAC;IAED,+CAA+C;IAC/C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,MAAM,IAAI,GAAe;YACvB,GAAG,KAAK;YACR,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE;YAClE,MAAM,EAAE,SAAS;SAClB,CAAC;QACF,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,SAAS,EAA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jC,IAAI,UAAU,CAAC,MAAM,IAAI,WAAW;YAAE,MAAM;QAC5C,UAAU,CAAC;YACT,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC;YACpB,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC;YACxB,MAAM,EAAE,EAAE,CAAC,OAAO;SACnB,CAAC,CAAC;IACL,CAAC;IACD,uCAAuC;IACvC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC;YACT,EAAE,EAAE,GAAG;YACP,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE,+BAA+B;SACxC,CAAC,CAAC;IACL,CAAC;IAED,oEAAoE;IACpE,qEAAqE;IACrE,mBAAmB;IACnB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,GAAe;YACvB,GAAG,KAAK;YACR,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE;YACpD,MAAM,EAAE,SAAS;SAClB,CAAC;QACF,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC;SAC1B,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAkB;QAC9B,EAAE,EAAE,SAAS;QACb,MAAM,EAAE,uCAAuC;QAC/C,OAAO,EAAE,UAAU;QACnB,OAAO,EAAE,UAAU,CAAC,CAAC,CAAE,CAAC,EAAE;KAC3B,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AACpD,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Phase 9-source-comments — walk every source file's docblock-class
3
- * comment, classify via Haiku, write DEC drafts / invariant proposals.
4
- */
5
- import type { PhaseResult, PhaseState } from "./types.js";
6
- export declare function runPhase9SourceComments(state: PhaseState): Promise<PhaseResult>;
@@ -1,67 +0,0 @@
1
- /**
2
- * Phase 9-source-comments — walk every source file's docblock-class
3
- * comment, classify via Haiku, write DEC drafts / invariant proposals.
4
- */
5
- import { runSourceCommentsIngestion, } from "../source-comments/index.js";
6
- import { clearProgress } from "../progress.js";
7
- import { advancePhase, isSelfAdoptState } from "./orchestrator.js";
8
- import { to7bResultPersisted, writeSourceCommentsWalkFile, } from "./source-comments-output-io.js";
9
- export async function runPhase9SourceComments(state) {
10
- if (isSelfAdoptState(state)) {
11
- const skipped = { skipped: "self-adopt" };
12
- const next = {
13
- ...state,
14
- outputs: { ...state.outputs, "9-source-comments": skipped },
15
- };
16
- return {
17
- status: "complete",
18
- nextPhase: "10-rules-merge",
19
- state: advancePhase(next),
20
- };
21
- }
22
- const mapper = state.outputs["3-mapper"];
23
- const globs = mapper
24
- ? {
25
- route_handler_globs: mapper.output.route_handler_globs,
26
- dto_globs: mapper.output.dto_globs,
27
- generator_source_globs: mapper.output.generator_source_globs,
28
- high_stakes_globs: mapper.output.high_stakes_globs,
29
- off_limits: mapper.output.off_limits_globs,
30
- }
31
- : {};
32
- const pilotOut = state.outputs["5-pilot"];
33
- const pilotModule = typeof pilotOut?.picked === "string" && pilotOut.picked.length > 0
34
- ? pilotOut.picked
35
- : undefined;
36
- const startedAt = Date.now();
37
- try {
38
- const result = await runSourceCommentsIngestion({
39
- repoRoot: state.repoRoot,
40
- });
41
- writeSourceCommentsWalkFile(state.repoRoot, result);
42
- const persisted = to7bResultPersisted(result);
43
- clearProgress(state.repoRoot);
44
- const next = {
45
- ...state,
46
- outputs: { ...state.outputs, "9-source-comments": persisted },
47
- };
48
- return {
49
- status: "complete",
50
- nextPhase: "10-rules-merge",
51
- state: advancePhase(next),
52
- };
53
- }
54
- catch (err) {
55
- clearProgress(state.repoRoot);
56
- return {
57
- status: "error",
58
- error: {
59
- code: "source-comments-failed",
60
- message: "Source-comment ingestion failed",
61
- detail: err instanceof Error ? err.stack ?? err.message : String(err),
62
- },
63
- state,
64
- };
65
- }
66
- }
67
- //# sourceMappingURL=9-source-comments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"9-source-comments.js","sourceRoot":"","sources":["../../../src/init/phases/9-source-comments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,0BAA0B,GAE3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,aAAa,EAAiB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,gCAAgC,CAAC;AAGxC,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAiB;IAC7D,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAwC,EAAE,OAAO,EAAE,YAAqB,EAAE,CAAC;QACxF,MAAM,IAAI,GAAe;YACvB,GAAG,KAAK;YACR,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE;SAC5D,CAAC;QACF,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,SAAS,EAAE,gBAAgB;YAC3B,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC;SAC1B,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzC,MAAM,KAAK,GAAiB,MAAM;QAChC,CAAC,CAAC;YACE,mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,mBAAmB;YACtD,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS;YAClC,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,sBAAsB;YAC5D,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,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AAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACtE;YACD,KAAK;SACN,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Phases 8 / 9 / 10 sequential orchestrator.
3
- *
4
- * The three post-pilot ingestion phases (docs-ingest, source-comments,
5
- * rules-merge) all read + write the same v0.5.0 ground-state files —
6
- * `topic-index.yaml`, `anchor-map.yaml`, `sot-bindings.yaml`,
7
- * `sot-cache.yaml`. Concurrent execution races on those writes: each
8
- * phase reads at start, mutates in memory, writes at end → last writer
9
- * wipes the others.
10
- *
11
- * v0.5.0 fix: run the phases sequentially in canonical order
12
- * (8 → 9 → 10). Each phase still uses Haiku internally (with its own
13
- * concurrency for batching + per-section workers), so the wall-clock
14
- * cost vs. the v0.4.x parallel pipeline is bounded by the longest
15
- * phase plus the smaller two — historically <5s combined for the
16
- * smaller phases. Heartbeats fire per phase so the operator sees
17
- * motion across all three.
18
- *
19
- * State machine:
20
- * - The runner enters expecting `currentPhase === "8-docs-ingest"` and
21
- * exits with `currentPhase === "11-baseline"`, jumping past the
22
- * individual 9 / 10 slots in PHASE_IDS. The sequential per-phase
23
- * MCP tools remain available; this runner is the optimized path the
24
- * adopt skill prefers.
25
- */
26
- import type { PhaseResult, PhaseState } from "./types.js";
27
- export declare function runPhases8910Parallel(state: PhaseState): Promise<PhaseResult>;
@@ -1,197 +0,0 @@
1
- /**
2
- * Phases 8 / 9 / 10 sequential orchestrator.
3
- *
4
- * The three post-pilot ingestion phases (docs-ingest, source-comments,
5
- * rules-merge) all read + write the same v0.5.0 ground-state files —
6
- * `topic-index.yaml`, `anchor-map.yaml`, `sot-bindings.yaml`,
7
- * `sot-cache.yaml`. Concurrent execution races on those writes: each
8
- * phase reads at start, mutates in memory, writes at end → last writer
9
- * wipes the others.
10
- *
11
- * v0.5.0 fix: run the phases sequentially in canonical order
12
- * (8 → 9 → 10). Each phase still uses Haiku internally (with its own
13
- * concurrency for batching + per-section workers), so the wall-clock
14
- * cost vs. the v0.4.x parallel pipeline is bounded by the longest
15
- * phase plus the smaller two — historically <5s combined for the
16
- * smaller phases. Heartbeats fire per phase so the operator sees
17
- * motion across all three.
18
- *
19
- * State machine:
20
- * - The runner enters expecting `currentPhase === "8-docs-ingest"` and
21
- * exits with `currentPhase === "11-baseline"`, jumping past the
22
- * individual 9 / 10 slots in PHASE_IDS. The sequential per-phase
23
- * MCP tools remain available; this runner is the optimized path the
24
- * adopt skill prefers.
25
- */
26
- import { scanExistingDecisionIds, scanExistingInvariantIds, } from "../../decision-capture/id.js";
27
- import { logger } from "../../logger.js";
28
- import { runDocsIngestion } from "../ingest-docs.js";
29
- import { clearProgress, writeProgress } from "../progress.js";
30
- import { runRulesMerge } from "../rules-merge/index.js";
31
- import { runSourceCommentsIngestion } from "../source-comments/index.js";
32
- import { to7bResultPersisted, writeSourceCommentsWalkFile, } from "./source-comments-output-io.js";
33
- import { advancePhase, isSelfAdoptState } from "./orchestrator.js";
34
- const log = logger("init.phases.parallel-8910");
35
- export async function runPhases8910Parallel(state) {
36
- // Sanity: this runner only enters at the start of the 8 / 9 / 10
37
- // window. If currentPhase is anywhere else, the caller invoked the
38
- // wrong tool — surface as error so we don't mid-pipeline jump.
39
- if (state.currentPhase !== "8-docs-ingest") {
40
- return {
41
- status: "error",
42
- error: {
43
- code: "wrong-phase",
44
- message: `runPhases8910Parallel requires currentPhase=8-docs-ingest, got ${state.currentPhase}`,
45
- },
46
- state,
47
- };
48
- }
49
- // Self-adopt skip — Q11. Stamp empty outputs for all three phases
50
- // and advance past 9 + 10 to 11-baseline so the pipeline mirrors
51
- // the normal-path exit shape.
52
- if (isSelfAdoptState(state)) {
53
- const skippedDocs = { skipped: "self-adopt" };
54
- const skippedSrc = { skipped: "self-adopt" };
55
- const skippedRules = { skipped: "self-adopt" };
56
- let next = {
57
- ...state,
58
- outputs: {
59
- ...state.outputs,
60
- "8-docs-ingest": skippedDocs,
61
- "9-source-comments": skippedSrc,
62
- "10-rules-merge": skippedRules,
63
- },
64
- };
65
- const skipTargets = ["8-docs-ingest", "9-source-comments", "10-rules-merge"];
66
- for (const _ of skipTargets) {
67
- next = advancePhase(next);
68
- }
69
- return {
70
- status: "complete",
71
- nextPhase: "11-baseline",
72
- state: next,
73
- };
74
- }
75
- const mapper = state.outputs["3-mapper"];
76
- const globs = mapper
77
- ? {
78
- route_handler_globs: mapper.output.route_handler_globs,
79
- dto_globs: mapper.output.dto_globs,
80
- generator_source_globs: mapper.output.generator_source_globs,
81
- high_stakes_globs: mapper.output.high_stakes_globs,
82
- off_limits: mapper.output.off_limits_globs,
83
- }
84
- : {};
85
- const pilotOut = state.outputs["5-pilot"];
86
- const pilotModule = typeof pilotOut?.picked === "string" && pilotOut.picked.length > 0
87
- ? pilotOut.picked
88
- : undefined;
89
- const sharedDecIds = scanExistingDecisionIds(state.repoRoot);
90
- const sharedInvIds = scanExistingInvariantIds(state.repoRoot);
91
- log.info({
92
- preScannedDecIds: sharedDecIds.size,
93
- preScannedInvIds: sharedInvIds.size,
94
- }, "parallel-8910 starting");
95
- // Run the three phases sequentially. v0.5.0 ground-state files
96
- // (topic-index, anchor-map, sot-bindings, sot-cache) are the shared
97
- // mutable surface; serializing 8 → 9 → 10 removes the last-writer-
98
- // wins race that Promise.allSettled had under v0.4.x.
99
- const t0 = performance.now();
100
- const startedAt = Date.now();
101
- // Phase 8 now runs the staged ingest pipeline:
102
- // Stage 3 marker scan (0 Haiku) → Stage 1 file-purpose binary filter
103
- // (batch=30, concurrency=5) → Stage 2 section-level batch classifier
104
- // (batch=30, concurrency=5) → Stage 4 emit drafts to `_inbox/`. Each
105
- // completed batch fires `onChunkProgress` with the active stage label
106
- // so the statusline can render the right ETA window.
107
- const docsRes = await runPhaseSafely("docs-ingest-failed", async () => runDocsIngestion({
108
- repoRoot: state.repoRoot,
109
- existingDecIds: sharedDecIds,
110
- onChunkProgress: (row) => writeProgress(state.repoRoot, {
111
- phase: `8-docs-ingest:${row.stage}`,
112
- batch: row.entriesDone,
113
- total: row.totalEntries,
114
- startedAt,
115
- }),
116
- }));
117
- if ("error" in docsRes) {
118
- clearProgress(state.repoRoot);
119
- return { status: "error", error: docsRes.error, state };
120
- }
121
- const srcRes = await runPhaseSafely("source-comments-failed", async () => runSourceCommentsIngestion({
122
- repoRoot: state.repoRoot,
123
- ...(pilotModule !== undefined ? { pilotModule } : {}),
124
- dryRun: false,
125
- }));
126
- if ("error" in srcRes) {
127
- clearProgress(state.repoRoot);
128
- return { status: "error", error: srcRes.error, state };
129
- }
130
- const rulesRes = await runPhaseSafely("rules-merge-failed", async () => runRulesMerge({
131
- repoRoot: state.repoRoot,
132
- dryRun: false,
133
- }));
134
- if ("error" in rulesRes) {
135
- clearProgress(state.repoRoot);
136
- return { status: "error", error: rulesRes.error, state };
137
- }
138
- const durationMs = Math.round(performance.now() - t0);
139
- clearProgress(state.repoRoot);
140
- writeSourceCommentsWalkFile(state.repoRoot, srcRes.value);
141
- const persistedSrc = to7bResultPersisted(srcRes.value);
142
- const outputs = {
143
- "8-docs-ingest": docsRes.value,
144
- "9-source-comments": persistedSrc,
145
- "10-rules-merge": rulesRes.value,
146
- };
147
- // Advance the state machine all the way past 10 so the next phase
148
- // tool the skill calls is 11-baseline.
149
- let next = {
150
- ...state,
151
- outputs: {
152
- ...state.outputs,
153
- ...outputs,
154
- },
155
- };
156
- const skipTargets = ["8-docs-ingest", "9-source-comments", "10-rules-merge"];
157
- for (const _ of skipTargets) {
158
- next = advancePhase(next);
159
- }
160
- // Stamp aggregate duration for ETA-audit telemetry.
161
- for (const id of skipTargets) {
162
- const out = next.outputs[id];
163
- if (typeof out === "object" && out !== null) {
164
- if (!("duration_ms" in out)) {
165
- // Approximate per-phase duration via the wall-clock divided
166
- // among the three phases — until each ingest function reports
167
- // its own duration, this is the best we can do.
168
- Object.assign(out, { duration_ms: durationMs });
169
- }
170
- }
171
- }
172
- log.info({
173
- durationMs,
174
- decsAfter: sharedDecIds.size,
175
- invsAfter: sharedInvIds.size,
176
- }, "parallel-8910 complete");
177
- return {
178
- status: "complete",
179
- nextPhase: next.currentPhase,
180
- state: next,
181
- };
182
- }
183
- async function runPhaseSafely(code, fn) {
184
- try {
185
- return { value: await fn() };
186
- }
187
- catch (err) {
188
- const detail = err instanceof Error ? err.stack ?? err.message : String(err);
189
- const message = code === "docs-ingest-failed"
190
- ? "Docs ingestion failed"
191
- : code === "source-comments-failed"
192
- ? "Source-comment ingestion failed"
193
- : "Rules merge failed";
194
- return { error: { code, message, detail } };
195
- }
196
- }
197
- //# sourceMappingURL=parallel-8910.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parallel-8910.js","sourceRoot":"","sources":["../../../src/init/phases/parallel-8910.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAwB,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAA4B,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,OAAO,EACL,mBAAmB,EACnB,2BAA2B,GAE5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGnE,MAAM,GAAG,GAAG,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAQhD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAiB;IAEjB,iEAAiE;IACjE,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,KAAK,CAAC,YAAY,KAAK,eAAe,EAAE,CAAC;QAC3C,OAAO;YACL,MAAM,EAAE,OAAO;YACf,KAAK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E,UAAU;QAClB,SAAS,EAAE,IAAI,CAAC,YAAY;QAC5B,KAAK,EAAE,IAAI;KACZ,CAAC;AACJ,CAAC;AAQD,KAAK,UAAU,cAAc,CAC3B,IAAY,EACZ,EAAoB;IAEpB,IAAI,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,GACV,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChE,MAAM,OAAO,GACX,IAAI,KAAK,oBAAoB;YAC3B,CAAC,CAAC,uBAAuB;YACzB,CAAC,CAAC,IAAI,KAAK,wBAAwB;gBACjC,CAAC,CAAC,iCAAiC;gBACnC,CAAC,CAAC,oBAAoB,CAAC;QAC7B,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IAC9C,CAAC;AACH,CAAC"}
@@ -1,89 +0,0 @@
1
- /**
2
- * Side-file persistence for the heavy Phase 9 output.
3
- *
4
- * `IngestSourceCommentsResult` carries the full walk (every comment block's
5
- * raw text + prose) and the matching classifications. On a busy monorepo
6
- * this crosses ~1.7 MB — far above what the MCP transport can echo back
7
- * in a tool result. Mirrors the v0.3.5 mapper-output spillover: write the
8
- * full payload to `.cairn/init/source-comments-walk.json` and persist a
9
- * lightweight projection (counts, paths, ledger-relevant lists) into
10
- * `init-state.json`.
11
- *
12
- * Downstream phases consume only the lightweight projection — the
13
- * heavy walk + per-block classifications already live in
14
- * `.cairn/baseline/source-comments-<ISO>.yaml` (the audit YAML), which
15
- * the strip-replace stage and any later debug tools already read.
16
- */
17
- import type { IngestSourceCommentsResult } from "../source-comments/index.js";
18
- import type { CommentClassKind } from "../source-comments/classify.js";
19
- /** Filename relative to repoRoot. */
20
- export declare const SOURCE_COMMENTS_WALK_PATH: string;
21
- export declare function sourceCommentsWalkAbsPath(repoRoot: string): string;
22
- /**
23
- * Atomically write the full Phase 9 result. Creates `.cairn/init/`
24
- * if needed.
25
- */
26
- export declare function writeSourceCommentsWalkFile(repoRoot: string, full: IngestSourceCommentsResult): string;
27
- /**
28
- * Read the full Phase 9 result from `.cairn/init/source-comments-walk.json`.
29
- * Returns null if missing or unreadable. Available for debug tooling and
30
- * post-hoc inspection — phase consumers prefer the lightweight projection
31
- * stored on state.
32
- */
33
- export declare function readSourceCommentsWalkFile(repoRoot: string): IngestSourceCommentsResult | null;
34
- /** Phase was skipped because the repo is the Cairn source repo itself. */
35
- export interface IngestSourceCommentsSkippedResult {
36
- readonly skipped: "self-adopt";
37
- }
38
- /**
39
- * Lightweight projection persisted into `init-state.json` outputs. Drops
40
- * `walk.blocks` and `classifications` (the heavy fields); keeps ledger /
41
- * triage references that downstream phases + the cairn-adopt summary
42
- * skill query directly.
43
- */
44
- export interface IngestSourceCommentsRunResult {
45
- /** Repo-relative path to the spilled full result, or null when not written. */
46
- walkPath: string;
47
- walkSummary: {
48
- files: number;
49
- blocks: number;
50
- bytesScanned: number;
51
- fileCountByLang: Record<string, number>;
52
- filesAvailable: number;
53
- truncatedAtFileCap: boolean;
54
- };
55
- decsWritten: {
56
- id: string;
57
- path: string;
58
- sourceFile: string;
59
- slug: string;
60
- status: "accepted";
61
- }[];
62
- invsWritten: {
63
- id: string;
64
- path: string;
65
- sourceFile: string;
66
- slug: string;
67
- status: "accepted";
68
- }[];
69
- citesEmitted: {
70
- id: string;
71
- sourceFile: string;
72
- lineRange: [number, number];
73
- slug: string;
74
- }[];
75
- stripFilesModified: number;
76
- stripItemsApplied: number;
77
- stripItemsSkipped: number;
78
- stripError: string | null;
79
- auditPath: string;
80
- auditRelPath: string;
81
- inputTokens: number;
82
- outputTokens: number;
83
- batchesRun: number;
84
- batchesFailed: number;
85
- kindCounts: Record<CommentClassKind, number>;
86
- }
87
- export type IngestSourceCommentsResultPersisted = IngestSourceCommentsRunResult | IngestSourceCommentsSkippedResult;
88
- /** Strip the heavy fields from a fresh ingest result for state persistence. */
89
- export declare function to7bResultPersisted(full: IngestSourceCommentsResult): IngestSourceCommentsRunResult;
@@ -1,81 +0,0 @@
1
- /**
2
- * Side-file persistence for the heavy Phase 9 output.
3
- *
4
- * `IngestSourceCommentsResult` carries the full walk (every comment block's
5
- * raw text + prose) and the matching classifications. On a busy monorepo
6
- * this crosses ~1.7 MB — far above what the MCP transport can echo back
7
- * in a tool result. Mirrors the v0.3.5 mapper-output spillover: write the
8
- * full payload to `.cairn/init/source-comments-walk.json` and persist a
9
- * lightweight projection (counts, paths, ledger-relevant lists) into
10
- * `init-state.json`.
11
- *
12
- * Downstream phases consume only the lightweight projection — the
13
- * heavy walk + per-block classifications already live in
14
- * `.cairn/baseline/source-comments-<ISO>.yaml` (the audit YAML), which
15
- * the strip-replace stage and any later debug tools already read.
16
- */
17
- import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync, } from "node:fs";
18
- import { dirname, join } from "node:path";
19
- /** Filename relative to repoRoot. */
20
- export const SOURCE_COMMENTS_WALK_PATH = join(".cairn", "init", "source-comments-walk.json");
21
- export function sourceCommentsWalkAbsPath(repoRoot) {
22
- return join(repoRoot, SOURCE_COMMENTS_WALK_PATH);
23
- }
24
- /**
25
- * Atomically write the full Phase 9 result. Creates `.cairn/init/`
26
- * if needed.
27
- */
28
- export function writeSourceCommentsWalkFile(repoRoot, full) {
29
- const abs = sourceCommentsWalkAbsPath(repoRoot);
30
- mkdirSync(dirname(abs), { recursive: true });
31
- const tmp = `${abs}.tmp`;
32
- writeFileSync(tmp, JSON.stringify(full, null, 2), "utf8");
33
- renameSync(tmp, abs);
34
- return abs;
35
- }
36
- /**
37
- * Read the full Phase 9 result from `.cairn/init/source-comments-walk.json`.
38
- * Returns null if missing or unreadable. Available for debug tooling and
39
- * post-hoc inspection — phase consumers prefer the lightweight projection
40
- * stored on state.
41
- */
42
- export function readSourceCommentsWalkFile(repoRoot) {
43
- const abs = sourceCommentsWalkAbsPath(repoRoot);
44
- if (!existsSync(abs))
45
- return null;
46
- try {
47
- return JSON.parse(readFileSync(abs, "utf8"));
48
- }
49
- catch {
50
- return null;
51
- }
52
- }
53
- /** Strip the heavy fields from a fresh ingest result for state persistence. */
54
- export function to7bResultPersisted(full) {
55
- return {
56
- walkPath: SOURCE_COMMENTS_WALK_PATH,
57
- walkSummary: {
58
- files: full.walk.files.length,
59
- blocks: full.walk.blocks.length,
60
- bytesScanned: full.walk.bytesScanned,
61
- fileCountByLang: full.walk.fileCountByLang,
62
- filesAvailable: full.walk.filesAvailable,
63
- truncatedAtFileCap: full.walk.truncatedAtFileCap,
64
- },
65
- decsWritten: full.decsWritten,
66
- invsWritten: full.invsWritten,
67
- citesEmitted: full.citesEmitted,
68
- stripFilesModified: full.stripFilesModified,
69
- stripItemsApplied: full.stripItemsApplied,
70
- stripItemsSkipped: full.stripItemsSkipped,
71
- stripError: full.stripError,
72
- auditPath: full.auditPath,
73
- auditRelPath: full.auditRelPath,
74
- inputTokens: full.inputTokens,
75
- outputTokens: full.outputTokens,
76
- batchesRun: full.batchesRun,
77
- batchesFailed: full.batchesFailed,
78
- kindCounts: full.kindCounts,
79
- };
80
- }
81
- //# sourceMappingURL=source-comments-output-io.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-comments-output-io.js","sourceRoot":"","sources":["../../../src/init/phases/source-comments-output-io.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAI1C,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAC3C,QAAQ,EACR,MAAM,EACN,2BAA2B,CAC5B,CAAC;AAEF,M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AC,IAAI,CAAC,eAAe;YAC1C,cAAc,EAAE,IAAI,CAAC,IAAI,CAAC,cAAc;YACxC,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB;SACjD;QACD,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;QAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC"}
@@ -1,29 +0,0 @@
1
- # MCP servers registered alongside Cairn in .mcp.json.
2
- #
3
- # WHAT THIS FILE IS
4
- #
5
- # Inventory of the OTHER MCP servers this project uses (not cairn
6
- # itself — cairn auto-registers via the plugin bundle). Includes
7
- # server name + one-line capability summary. Read at SessionStart
8
- # so the agent knows what tools it can reach without re-listing
9
- # every tool exhaustively.
10
- #
11
- # WHEN TO FILL IT IN
12
- #
13
- # Operator-paced. Add an entry every time you wire up a new MCP
14
- # server (Notion, Stripe, internal tools, etc.). Flip an entry's
15
- # status when the server's capabilities shift.
16
- #
17
- # FORMAT
18
- #
19
- # Two examples to anchor on:
20
- #
21
- # mcp_tools:
22
- # - name: stripe
23
- # description: Stripe payments + customers + subscriptions. Use when the agent needs to look up a charge by id or check a customer's billing state.
24
- # status: accepted
25
- # - name: notion
26
- # description: Read-only Notion workspace query. Use for cross-referencing PRDs that live in Notion, never for writes.
27
- # status: accepted
28
-
29
- mcp_tools: []
@@ -1,25 +0,0 @@
1
- # Installed skill packs available in this session.
2
- #
3
- # WHAT THIS FILE IS
4
- #
5
- # Inventory of project-level skills the agent can invoke (the
6
- # `.claude/skills/` directory of the host project). Each entry is
7
- # name + one-line trigger description. Adoption seeds entries from
8
- # whatever's already in `.claude/skills/`; operator extends.
9
- #
10
- # WHEN TO FILL IT IN
11
- #
12
- # Auto-populated at adoption + on `cairn fix` re-scans. Edit by
13
- # hand only when adding a new project-local skill or removing one.
14
- #
15
- # FORMAT
16
- #
17
- # Two examples to anchor on:
18
- #
19
- # skills:
20
- # - name: deploy-staging
21
- # description: Push current branch to the staging GKE cluster + run smoke tests. Auto-invoke on "deploy", "ship", "push to staging".
22
- # - name: db-migrate
23
- # description: Generate + apply a Drizzle migration with backup snapshot. Auto-invoke when schema changes are mentioned.
24
-
25
- skills: []