audit-tools 0.55.5 → 0.55.7

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 (266) hide show
  1. package/dist/audit/cli/auditStep.d.ts +15 -1
  2. package/dist/audit/cli/auditStep.d.ts.map +1 -1
  3. package/dist/audit/cli/auditStep.js +24 -11
  4. package/dist/audit/cli/auditStep.js.map +1 -1
  5. package/dist/audit/cli/cleanup.d.ts.map +1 -1
  6. package/dist/audit/cli/cleanup.js +26 -2
  7. package/dist/audit/cli/cleanup.js.map +1 -1
  8. package/dist/audit/cli/conceptualDispatch.d.ts +2 -0
  9. package/dist/audit/cli/conceptualDispatch.d.ts.map +1 -1
  10. package/dist/audit/cli/conceptualDispatch.js +29 -8
  11. package/dist/audit/cli/conceptualDispatch.js.map +1 -1
  12. package/dist/audit/cli/dispatch/hostHandoff.d.ts +37 -3
  13. package/dist/audit/cli/dispatch/hostHandoff.d.ts.map +1 -1
  14. package/dist/audit/cli/dispatch/hostHandoff.js +185 -16
  15. package/dist/audit/cli/dispatch/hostHandoff.js.map +1 -1
  16. package/dist/audit/cli/fanoutLanes.d.ts +30 -0
  17. package/dist/audit/cli/fanoutLanes.d.ts.map +1 -1
  18. package/dist/audit/cli/fanoutLanes.js +76 -8
  19. package/dist/audit/cli/fanoutLanes.js.map +1 -1
  20. package/dist/audit/cli/lineIndex.d.ts.map +1 -1
  21. package/dist/audit/cli/lineIndex.js +19 -41
  22. package/dist/audit/cli/lineIndex.js.map +1 -1
  23. package/dist/audit/cli/nextStepCommand.d.ts +3 -0
  24. package/dist/audit/cli/nextStepCommand.d.ts.map +1 -1
  25. package/dist/audit/cli/nextStepCommand.js +109 -68
  26. package/dist/audit/cli/nextStepCommand.js.map +1 -1
  27. package/dist/audit/cli/nextStepHelpers.d.ts +55 -20
  28. package/dist/audit/cli/nextStepHelpers.d.ts.map +1 -1
  29. package/dist/audit/cli/nextStepHelpers.js +215 -196
  30. package/dist/audit/cli/nextStepHelpers.js.map +1 -1
  31. package/dist/audit/cli/reviewRun.d.ts +4 -0
  32. package/dist/audit/cli/reviewRun.d.ts.map +1 -1
  33. package/dist/audit/cli/reviewRun.js +1 -1
  34. package/dist/audit/cli/reviewRun.js.map +1 -1
  35. package/dist/audit/cli/semanticReviewStep.d.ts +2 -0
  36. package/dist/audit/cli/semanticReviewStep.d.ts.map +1 -1
  37. package/dist/audit/cli/semanticReviewStep.js +5 -50
  38. package/dist/audit/cli/semanticReviewStep.js.map +1 -1
  39. package/dist/audit/cli/validateResultsCommand.d.ts.map +1 -1
  40. package/dist/audit/cli/validateResultsCommand.js +3 -1
  41. package/dist/audit/cli/validateResultsCommand.js.map +1 -1
  42. package/dist/audit/extractors/disposition.d.ts.map +1 -1
  43. package/dist/audit/extractors/disposition.js +14 -38
  44. package/dist/audit/extractors/disposition.js.map +1 -1
  45. package/dist/audit/extractors/fsIntake.d.ts +13 -0
  46. package/dist/audit/extractors/fsIntake.d.ts.map +1 -1
  47. package/dist/audit/extractors/fsIntake.js +11 -1
  48. package/dist/audit/extractors/fsIntake.js.map +1 -1
  49. package/dist/audit/extractors/readFileText.d.ts.map +1 -1
  50. package/dist/audit/extractors/readFileText.js +34 -5
  51. package/dist/audit/extractors/readFileText.js.map +1 -1
  52. package/dist/audit/io/artifacts.d.ts +35 -9
  53. package/dist/audit/io/artifacts.d.ts.map +1 -1
  54. package/dist/audit/io/artifacts.js +84 -67
  55. package/dist/audit/io/artifacts.js.map +1 -1
  56. package/dist/audit/io/rollover.d.ts +18 -0
  57. package/dist/audit/io/rollover.d.ts.map +1 -0
  58. package/dist/audit/io/rollover.js +152 -0
  59. package/dist/audit/io/rollover.js.map +1 -0
  60. package/dist/audit/io/runSnapshot.d.ts +149 -0
  61. package/dist/audit/io/runSnapshot.d.ts.map +1 -0
  62. package/dist/audit/io/runSnapshot.js +710 -0
  63. package/dist/audit/io/runSnapshot.js.map +1 -0
  64. package/dist/audit/orchestrator/acquisitionExecutor.d.ts +5 -2
  65. package/dist/audit/orchestrator/acquisitionExecutor.d.ts.map +1 -1
  66. package/dist/audit/orchestrator/acquisitionExecutor.js +28 -22
  67. package/dist/audit/orchestrator/acquisitionExecutor.js.map +1 -1
  68. package/dist/audit/orchestrator/advanceTypes.d.ts +11 -0
  69. package/dist/audit/orchestrator/advanceTypes.d.ts.map +1 -1
  70. package/dist/audit/orchestrator/autoFixExecutor.d.ts +9 -0
  71. package/dist/audit/orchestrator/autoFixExecutor.d.ts.map +1 -1
  72. package/dist/audit/orchestrator/autoFixExecutor.js +22 -2
  73. package/dist/audit/orchestrator/autoFixExecutor.js.map +1 -1
  74. package/dist/audit/orchestrator/charterExtractionExecutor.d.ts.map +1 -1
  75. package/dist/audit/orchestrator/charterExtractionExecutor.js +18 -3
  76. package/dist/audit/orchestrator/charterExtractionExecutor.js.map +1 -1
  77. package/dist/audit/orchestrator/charterPackets.d.ts +11 -1
  78. package/dist/audit/orchestrator/charterPackets.d.ts.map +1 -1
  79. package/dist/audit/orchestrator/charterPackets.js +13 -0
  80. package/dist/audit/orchestrator/charterPackets.js.map +1 -1
  81. package/dist/audit/orchestrator/designReviewPrompt.d.ts +9 -0
  82. package/dist/audit/orchestrator/designReviewPrompt.d.ts.map +1 -1
  83. package/dist/audit/orchestrator/designReviewPrompt.js +69 -31
  84. package/dist/audit/orchestrator/designReviewPrompt.js.map +1 -1
  85. package/dist/audit/orchestrator/designReviewSnapshot.d.ts +1 -0
  86. package/dist/audit/orchestrator/designReviewSnapshot.d.ts.map +1 -1
  87. package/dist/audit/orchestrator/designReviewSnapshot.js +2 -1
  88. package/dist/audit/orchestrator/designReviewSnapshot.js.map +1 -1
  89. package/dist/audit/orchestrator/executorRunners.d.ts.map +1 -1
  90. package/dist/audit/orchestrator/executorRunners.js +13 -4
  91. package/dist/audit/orchestrator/executorRunners.js.map +1 -1
  92. package/dist/audit/orchestrator/intakeExecutors.d.ts +8 -1
  93. package/dist/audit/orchestrator/intakeExecutors.d.ts.map +1 -1
  94. package/dist/audit/orchestrator/intakeExecutors.js +13 -4
  95. package/dist/audit/orchestrator/intakeExecutors.js.map +1 -1
  96. package/dist/audit/orchestrator/obligationPolicy.d.ts.map +1 -1
  97. package/dist/audit/orchestrator/obligationPolicy.js +4 -1
  98. package/dist/audit/orchestrator/obligationPolicy.js.map +1 -1
  99. package/dist/audit/orchestrator/planningExecutors.d.ts +1 -1
  100. package/dist/audit/orchestrator/planningExecutors.d.ts.map +1 -1
  101. package/dist/audit/orchestrator/planningExecutors.js +40 -6
  102. package/dist/audit/orchestrator/planningExecutors.js.map +1 -1
  103. package/dist/audit/orchestrator/reviewPacketSizing.d.ts +4 -4
  104. package/dist/audit/orchestrator/reviewPacketSizing.d.ts.map +1 -1
  105. package/dist/audit/orchestrator/reviewPacketSizing.js +5 -5
  106. package/dist/audit/orchestrator/reviewPacketSizing.js.map +1 -1
  107. package/dist/audit/orchestrator/reviewPackets.d.ts.map +1 -1
  108. package/dist/audit/orchestrator/reviewPackets.js +10 -5
  109. package/dist/audit/orchestrator/reviewPackets.js.map +1 -1
  110. package/dist/audit/orchestrator/runtimeCommand.d.ts +9 -2
  111. package/dist/audit/orchestrator/runtimeCommand.d.ts.map +1 -1
  112. package/dist/audit/orchestrator/runtimeCommand.js +14 -22
  113. package/dist/audit/orchestrator/runtimeCommand.js.map +1 -1
  114. package/dist/audit/orchestrator/scopeIndexBaseline.d.ts.map +1 -1
  115. package/dist/audit/orchestrator/scopeIndexBaseline.js +7 -29
  116. package/dist/audit/orchestrator/scopeIndexBaseline.js.map +1 -1
  117. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts +6 -2
  118. package/dist/audit/orchestrator/selectiveDeepening/conflict.d.ts.map +1 -1
  119. package/dist/audit/orchestrator/selectiveDeepening/conflict.js +45 -4
  120. package/dist/audit/orchestrator/selectiveDeepening/conflict.js.map +1 -1
  121. package/dist/audit/orchestrator/selectiveDeepening/index.d.ts.map +1 -1
  122. package/dist/audit/orchestrator/selectiveDeepening/index.js +4 -4
  123. package/dist/audit/orchestrator/selectiveDeepening/index.js.map +1 -1
  124. package/dist/audit/orchestrator/systemicChallengeExecutor.d.ts.map +1 -1
  125. package/dist/audit/orchestrator/systemicChallengeExecutor.js +4 -1
  126. package/dist/audit/orchestrator/systemicChallengeExecutor.js.map +1 -1
  127. package/dist/audit/orchestrator/taskBuilder.d.ts +20 -0
  128. package/dist/audit/orchestrator/taskBuilder.d.ts.map +1 -1
  129. package/dist/audit/orchestrator/taskBuilder.js +80 -18
  130. package/dist/audit/orchestrator/taskBuilder.js.map +1 -1
  131. package/dist/audit/systemic/reviewFileMap.d.ts +72 -21
  132. package/dist/audit/systemic/reviewFileMap.d.ts.map +1 -1
  133. package/dist/audit/systemic/reviewFileMap.js +96 -45
  134. package/dist/audit/systemic/reviewFileMap.js.map +1 -1
  135. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts +7 -0
  136. package/dist/audit/systemic/secondOrderAdversaryPrompt.d.ts.map +1 -1
  137. package/dist/audit/systemic/secondOrderAdversaryPrompt.js +39 -8
  138. package/dist/audit/systemic/secondOrderAdversaryPrompt.js.map +1 -1
  139. package/dist/remediate/phases/close.d.ts.map +1 -1
  140. package/dist/remediate/phases/close.js +29 -11
  141. package/dist/remediate/phases/close.js.map +1 -1
  142. package/dist/remediate/phases/closeAcceptance.d.ts.map +1 -1
  143. package/dist/remediate/phases/closeAcceptance.js +2 -0
  144. package/dist/remediate/phases/closeAcceptance.js.map +1 -1
  145. package/dist/remediate/phases/closeVerifyAnalyzerLeads.d.ts +2 -1
  146. package/dist/remediate/phases/closeVerifyAnalyzerLeads.d.ts.map +1 -1
  147. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js +10 -9
  148. package/dist/remediate/phases/closeVerifyAnalyzerLeads.js.map +1 -1
  149. package/dist/remediate/phases/triage.d.ts +2 -1
  150. package/dist/remediate/phases/triage.d.ts.map +1 -1
  151. package/dist/remediate/phases/triage.js +46 -25
  152. package/dist/remediate/phases/triage.js.map +1 -1
  153. package/dist/remediate/phases/triageConformance.d.ts +14 -0
  154. package/dist/remediate/phases/triageConformance.d.ts.map +1 -0
  155. package/dist/remediate/phases/triageConformance.js +189 -0
  156. package/dist/remediate/phases/triageConformance.js.map +1 -0
  157. package/dist/remediate/state/decisionConsumption.d.ts +110 -0
  158. package/dist/remediate/state/decisionConsumption.d.ts.map +1 -0
  159. package/dist/remediate/state/decisionConsumption.js +122 -0
  160. package/dist/remediate/state/decisionConsumption.js.map +1 -0
  161. package/dist/remediate/state/dirtyBaseline.d.ts +10 -0
  162. package/dist/remediate/state/dirtyBaseline.d.ts.map +1 -0
  163. package/dist/remediate/state/dirtyBaseline.js +18 -0
  164. package/dist/remediate/state/dirtyBaseline.js.map +1 -0
  165. package/dist/remediate/state/store.d.ts +8 -4
  166. package/dist/remediate/state/store.d.ts.map +1 -1
  167. package/dist/remediate/state/store.js +24 -0
  168. package/dist/remediate/state/store.js.map +1 -1
  169. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts +9 -0
  170. package/dist/remediate/steps/dispatch/contractConformanceReview.d.ts.map +1 -1
  171. package/dist/remediate/steps/dispatch/contractConformanceReview.js +32 -14
  172. package/dist/remediate/steps/dispatch/contractConformanceReview.js.map +1 -1
  173. package/dist/remediate/steps/dispatch/hostCorroboration.d.ts.map +1 -1
  174. package/dist/remediate/steps/dispatch/hostCorroboration.js +34 -82
  175. package/dist/remediate/steps/dispatch/hostCorroboration.js.map +1 -1
  176. package/dist/remediate/steps/dispatch/hostHandoff.d.ts.map +1 -1
  177. package/dist/remediate/steps/dispatch/hostHandoff.js +10 -1
  178. package/dist/remediate/steps/dispatch/hostHandoff.js.map +1 -1
  179. package/dist/remediate/steps/finalGate.d.ts.map +1 -1
  180. package/dist/remediate/steps/finalGate.js +11 -5
  181. package/dist/remediate/steps/finalGate.js.map +1 -1
  182. package/dist/remediate/steps/gateCommands.d.ts +1 -0
  183. package/dist/remediate/steps/gateCommands.d.ts.map +1 -1
  184. package/dist/remediate/steps/gateCommands.js +13 -63
  185. package/dist/remediate/steps/gateCommands.js.map +1 -1
  186. package/dist/remediate/steps/nextStep.d.ts +7 -0
  187. package/dist/remediate/steps/nextStep.d.ts.map +1 -1
  188. package/dist/remediate/steps/nextStep.js +93 -33
  189. package/dist/remediate/steps/nextStep.js.map +1 -1
  190. package/dist/shared/analyzers/acquisitionEngine.d.ts +12 -5
  191. package/dist/shared/analyzers/acquisitionEngine.d.ts.map +1 -1
  192. package/dist/shared/analyzers/acquisitionEngine.js +86 -38
  193. package/dist/shared/analyzers/acquisitionEngine.js.map +1 -1
  194. package/dist/shared/analyzers/binaryAcquisition.d.ts +17 -41
  195. package/dist/shared/analyzers/binaryAcquisition.d.ts.map +1 -1
  196. package/dist/shared/analyzers/binaryAcquisition.js +260 -227
  197. package/dist/shared/analyzers/binaryAcquisition.js.map +1 -1
  198. package/dist/shared/analyzers/binaryFetcher.d.ts +4 -0
  199. package/dist/shared/analyzers/binaryFetcher.d.ts.map +1 -0
  200. package/dist/shared/analyzers/binaryFetcher.js +79 -0
  201. package/dist/shared/analyzers/binaryFetcher.js.map +1 -0
  202. package/dist/shared/analyzers/binaryVersions.d.ts +5 -0
  203. package/dist/shared/analyzers/binaryVersions.d.ts.map +1 -0
  204. package/dist/shared/analyzers/binaryVersions.js +31 -0
  205. package/dist/shared/analyzers/binaryVersions.js.map +1 -0
  206. package/dist/shared/analyzers/candidates.d.ts +3 -3
  207. package/dist/shared/analyzers/candidates.d.ts.map +1 -1
  208. package/dist/shared/analyzers/candidates.js +35 -12
  209. package/dist/shared/analyzers/candidates.js.map +1 -1
  210. package/dist/shared/contentKey.d.ts +3 -2
  211. package/dist/shared/contentKey.d.ts.map +1 -1
  212. package/dist/shared/contentKey.js +3 -2
  213. package/dist/shared/contentKey.js.map +1 -1
  214. package/dist/shared/decompose/charterExtraction.d.ts +189 -1
  215. package/dist/shared/decompose/charterExtraction.d.ts.map +1 -1
  216. package/dist/shared/decompose/charterExtraction.js +17 -2
  217. package/dist/shared/decompose/charterExtraction.js.map +1 -1
  218. package/dist/shared/git.d.ts +58 -2
  219. package/dist/shared/git.d.ts.map +1 -1
  220. package/dist/shared/git.js +214 -56
  221. package/dist/shared/git.js.map +1 -1
  222. package/dist/shared/gitTrackedPaths.d.ts +39 -0
  223. package/dist/shared/gitTrackedPaths.d.ts.map +1 -0
  224. package/dist/shared/gitTrackedPaths.js +29 -0
  225. package/dist/shared/gitTrackedPaths.js.map +1 -0
  226. package/dist/shared/index.d.ts +4 -2
  227. package/dist/shared/index.d.ts.map +1 -1
  228. package/dist/shared/index.js +4 -2
  229. package/dist/shared/index.js.map +1 -1
  230. package/dist/shared/io/sourcePath.d.ts +8 -0
  231. package/dist/shared/io/sourcePath.d.ts.map +1 -0
  232. package/dist/shared/io/sourcePath.js +38 -0
  233. package/dist/shared/io/sourcePath.js.map +1 -0
  234. package/dist/shared/loopCorePaths.d.ts.map +1 -1
  235. package/dist/shared/loopCorePaths.js +2 -0
  236. package/dist/shared/loopCorePaths.js.map +1 -1
  237. package/dist/shared/prompts.d.ts +2 -0
  238. package/dist/shared/prompts.d.ts.map +1 -1
  239. package/dist/shared/prompts.js +8 -2
  240. package/dist/shared/prompts.js.map +1 -1
  241. package/dist/shared/submission/ingestReport.d.ts.map +1 -1
  242. package/dist/shared/submission/ingestReport.js +19 -1
  243. package/dist/shared/submission/ingestReport.js.map +1 -1
  244. package/dist/shared/tooling/exec.d.ts +1 -0
  245. package/dist/shared/tooling/exec.d.ts.map +1 -1
  246. package/dist/shared/tooling/exec.js +20 -4
  247. package/dist/shared/tooling/exec.js.map +1 -1
  248. package/dist/shared/tooling/resolveExecutable.d.ts +10 -0
  249. package/dist/shared/tooling/resolveExecutable.d.ts.map +1 -0
  250. package/dist/shared/tooling/resolveExecutable.js +46 -0
  251. package/dist/shared/tooling/resolveExecutable.js.map +1 -0
  252. package/dist/shared/types/charter.d.ts +9 -0
  253. package/dist/shared/types/charter.d.ts.map +1 -1
  254. package/dist/shared/types/charter.js +7 -0
  255. package/dist/shared/types/charter.js.map +1 -1
  256. package/dist/shared/validation/citationGrounding.d.ts +1 -1
  257. package/dist/shared/validation/citationGrounding.d.ts.map +1 -1
  258. package/dist/shared/validation/citationGrounding.js +24 -11
  259. package/dist/shared/validation/citationGrounding.js.map +1 -1
  260. package/dist/shared/validation/findingGrounding.d.ts +1 -1
  261. package/dist/shared/validation/findingGrounding.d.ts.map +1 -1
  262. package/dist/shared/validation/findingGrounding.js +11 -23
  263. package/dist/shared/validation/findingGrounding.js.map +1 -1
  264. package/docs/audit-pkg/contracts.md +6 -2
  265. package/docs/audit-pkg/operator-guide.md +13 -4
  266. package/package.json +2 -1
@@ -7,19 +7,20 @@ import { validateAuditArguments, NEXT_STEP_ARGUMENTS } from "./argumentContract.
7
7
  import { functionalPreflightStep } from "./functionalPreflight.js";
8
8
  import { SEMANTIC_REVIEW_DEMAND } from "../../shared/types/stepContract.js";
9
9
  import { INDEPENDENT_CONTEXT, SEPARATE_CONTEXT_OR_SELF } from "../../shared/prompts.js";
10
- // sites-pinned: tests/audit/next-step-helpers.test.ts, tests/audit/charter-emit-order.test.ts, tests/audit/executor-registry-sync.test.ts, tests/audit/pipeline-integration.test.ts
10
+ // sites-pinned: tests/audit/next-step-helpers.test.ts, tests/audit/charter-emit-order.test.ts, tests/audit/executor-registry-sync.test.ts, tests/audit/pipeline-integration.test.ts, tests/audit/review-file-map-context.test.ts, tests/audit/artifacts-dir-rollover.test.ts
11
11
  import { mkdir, readFile, writeFile } from "node:fs/promises";
12
12
  import { join, resolve } from "node:path";
13
- import { loadAnalyzerPolicy, loadSessionIntent, applyGuidanceFile, applyGuidanceText, runWithBlockedStepBackstop, writeBlockedStepContract, laneAssetsDir, hostScratchDir, renderFanoutExecutionLines, writeTextFile, writeJsonFile, toPromptPathToken, AUDIT_FINDINGS_FILENAME, } from "audit-tools/shared";
13
+ import { loadAnalyzerPolicy, loadSessionIntent, applyGuidanceFile, applyGuidanceText, runWithBlockedStepBackstop, writeBlockedStepContract, laneAssetsDir, hostScratchDir, renderFanoutExecutionLines, writeJsonFile, toPromptPathToken, AUDIT_FINDINGS_FILENAME, } from "audit-tools/shared";
14
14
  // The ONE shared table-driven step-emission scaffold. Imported by relative path
15
15
  // like every other cross-area shared module this area reaches for.
16
16
  import { createStepEmissionScaffold } from "../../shared/steps/stepEmissionScaffold.js";
17
17
  import { cleanupStaleArtifactsDir } from "./cleanup.js";
18
+ import { rollOverFinishedRun } from "../io/rollover.js";
18
19
  import { materializeFanoutLanes } from "./fanoutLanes.js";
19
- import { AUDIT_GATE_SUBMISSION_SCOPE, GATE_LANES, charterExtractionCoverageFilename, charterExtractionLane, charterExtractionPacketFilename, laneSubmissionPath, mergeLaneShortfalls, recordExpectedLanes, renderLaneShortfallLines, systemicChallengeLane, } from "./laneSubmissions.js";
20
- import { buildCharterPacketManifest, materializeCharterPacket, } from "../orchestrator/charterPackets.js";
20
+ import { AUDIT_GATE_SUBMISSION_SCOPE, GATE_LANES, charterExtractionLane, laneSubmissionPath, mergeLaneShortfalls, recordExpectedLanes, renderLaneShortfallLines, systemicChallengeLane, } from "./laneSubmissions.js";
21
+ import { carriedCharterLane } from "../orchestrator/charterPackets.js";
21
22
  import { buildEdgeReasoningPrompt, edgeReasoningContentHash, } from "../orchestrator/edgeReasoning.js";
22
- import { renderContractReviewPrompt, } from "../orchestrator/designReviewPrompt.js";
23
+ import { designReviewFileMapContext, renderContractReviewPrompt, } from "../orchestrator/designReviewPrompt.js";
23
24
  import { resolveIntentLensSelection } from "../orchestrator/lensSelection.js";
24
25
  import { prepareConceptualDispatch, resolveConceptualReviewSettings, } from "./conceptualDispatch.js";
25
26
  import { buildDesignReReviewSection } from "../orchestrator/designReviewSnapshot.js";
@@ -33,12 +34,13 @@ import { renderCharterComparisonPrompt } from "./charterComparisonPrompt.js";
33
34
  import { renderCharterFidelityPrompt } from "./charterFidelityPrompt.js";
34
35
  import { buildCharterFidelityPacket } from "../orchestrator/charterFidelityPacket.js";
35
36
  import { renderCharterClarificationPrompt } from "./charterClarificationPrompt.js";
36
- import { renderSecondOrderAdversaryPrompt } from "../systemic/secondOrderAdversaryPrompt.js";
37
+ import { adversaryFileMapContext, renderSecondOrderAdversaryPrompt, } from "../systemic/secondOrderAdversaryPrompt.js";
37
38
  import { aggregateMetricsDigest } from "../systemic/aggregateMetricsDigest.js";
38
39
  import { resolveCharterCeiling } from "../orchestrator/charterExtractionExecutor.js";
39
40
  import { ensureSupervisorDirs } from "../io/runArtifacts.js";
40
41
  import { persistConfigErrorHandoff, } from "./reviewRun.js";
41
42
  import { renderSemanticReviewStep, prepareSemanticReviewWorkload } from "./semanticReviewStep.js";
43
+ import { lookupRunSince } from "../io/runSnapshot.js";
42
44
  import { renderConfirmIntentPrompt } from "./confirmIntentStep.js";
43
45
  import { writeCurrentStep, STEP_CONTRACT_VERSION } from "./steps.js";
44
46
  import { nextStepCommand, renderAnalyzerConsentPrompt, renderAnalyzerInstallPrompt, renderEdgeReasoningDispatchPrompt, renderPresentReportPrompt, } from "./prompts.js";
@@ -46,7 +48,7 @@ import { getArtifactsDir, getFlag, hasFlag, getRootDir, getTimeoutMs, warnIfNotG
46
48
  // Import the helpers used locally, then re-export the full helper surface so
47
49
  // existing imports remain valid (an `export … from` clause creates no local
48
50
  // bindings, so the locally-used names must be imported explicitly).
49
- import { runDeterministicForNextStep, renderDesignReviewRejectionNotice, renderEdgeReasoningRejectionNotice, } from "./nextStepHelpers.js";
51
+ import { runDeterministicForNextStep, renderDesignReviewRejectionNotice, renderEdgeReasoningRejectionNotice, writeCharterLaneAssets, } from "./nextStepHelpers.js";
50
52
  export { tryConsumeSubmission, consumeArraySubmission, consumeObjectSubmission, renderDesignReviewRejectionNotice, renderEdgeReasoningRejectionNotice, buildTerminalStep, handleGraphEnrichmentBranch, handleDesignReviewBranch, handleSynthesisNarrativeBranch, executeAndRecord, checkFinalizationCycle, checkNoProgressBeforeDispatch, runDeterministicForNextStep, } from "./nextStepHelpers.js";
51
53
  /**
52
54
  * The two host-facing notices every design-review pass prepends to its prompt:
@@ -76,10 +78,11 @@ async function designReviewNotesSection(artifactsDir, bundle, pass) {
76
78
  * packet it prepares first. Settings therefore stay an INPUT here rather than
77
79
  * being resolved inside, which keeps each branch's write ordering unchanged.
78
80
  */
79
- async function prepareConceptualPass(artifactsDir, bundle, settings) {
81
+ async function prepareConceptualPass(artifactsDir, sourceRoot, bundle, settings) {
80
82
  const notesSection = await designReviewNotesSection(artifactsDir, bundle, "conceptual");
81
83
  return prepareConceptualDispatch({
82
84
  artifactsDir,
85
+ sourceRoot,
83
86
  bundle,
84
87
  settings,
85
88
  ...notesSection,
@@ -109,8 +112,13 @@ async function prepareContractDispatch(opts) {
109
112
  // it is told which lenses the operator selected, from the ONE resolution every
110
113
  // draw reads.
111
114
  const lenses = resolveIntentLensSelection(opts.bundle.intent_checkpoint?.lens_selection);
115
+ const reviewOptions = {
116
+ max_units: opts.maxUnits,
117
+ ...(lenses === undefined ? {} : { lenses }),
118
+ };
112
119
  const fanout = await materializeFanoutLanes({
113
120
  artifactsDir: opts.artifactsDir,
121
+ sourceRoot: opts.sourceRoot,
114
122
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
115
123
  lanes: [
116
124
  {
@@ -120,14 +128,14 @@ async function prepareContractDispatch(opts) {
120
128
  ...SEMANTIC_REVIEW_DEMAND,
121
129
  label: "Contract review (adversarial)",
122
130
  promptFilename: "design-review-contract-prompt.md",
131
+ // The prompt carries the call-site map's summary; the complete map is
132
+ // this read-only, bound file.
133
+ generatedContext: [designReviewFileMapContext(opts.bundle, reviewOptions).contextFile],
123
134
  // No results-path section here: `materializeFanoutLanes` appends the one
124
135
  // canonical footer (bound path + the read-only-executor alternative) to
125
136
  // every lane prompt it writes.
126
137
  promptText: [
127
- renderContractReviewPrompt(opts.bundle, {
128
- max_units: opts.maxUnits,
129
- ...(lenses === undefined ? {} : { lenses }),
130
- }),
138
+ renderContractReviewPrompt(opts.bundle, reviewOptions),
131
139
  ...[notesSection.reReviewSection, notesSection.rejectionNotice]
132
140
  .filter((section) => Boolean(section))
133
141
  .flatMap((section) => ["", section]),
@@ -142,7 +150,7 @@ async function prepareContractDispatch(opts) {
142
150
  contract_prompt: promptPath,
143
151
  contract_results: resultsPath,
144
152
  },
145
- readPaths: [promptPath],
153
+ readPaths: [promptPath, ...fanout.lanes[0].generatedContextPaths],
146
154
  writePaths: [resultsPath],
147
155
  shortfall: fanout.shortfall,
148
156
  };
@@ -188,16 +196,20 @@ export async function cmdNextStep(argv) {
188
196
  }));
189
197
  }
190
198
  async function cmdNextStepBody(argv, root, artifactsDir) {
199
+ // Rollover (owner decision 2026-10-08, "keep the artifacts dir"): a run that
200
+ // ENDED — its terminal step presented a promoted report — becomes this run's
201
+ // starting point: its derived work stays for the staleness DAG to judge, and
202
+ // everything that belonged to it goes. A run whose report was never promoted
203
+ // has no run-ended marker; the fold's terminal step presents and promotes it,
204
+ // so it is not rolled over. Must run BEFORE the sweep, the mkdir and applyGuidanceFile
205
+ // below (fresh guidance must never be swept), and before the fold loads the
206
+ // bundle (a retained `complete` state would short-circuit every derivation).
207
+ await rollOverFinishedRun(artifactsDir);
191
208
  // Pre-run sweep (docs-14; one rule, 74c89b226ab9b9cd): clear a stale working
192
209
  // dir so the fresh run starts clean — one whose run is `not_started` (junk
193
- // from a run that never got going) or `complete` with its promotion already
194
- // finished (a leftover from an rm that failed). The rule is the same one the
195
- // `cleanup` verb applies; a `complete` dir with work left is a live
196
- // continuation the fold's terminal step presents and promotes, so it survives
197
- // entry. Must run BEFORE the mkdir below and BEFORE applyGuidanceFile (fresh
198
- // guidance must never be swept). Inside the backstop, a malformed
199
- // audit_state.json re-throw becomes a blocked-step contract rather than a raw
200
- // crash.
210
+ // from a run that never got going). The rule is the same one the `cleanup`
211
+ // verb applies. Inside the backstop, a malformed audit_state.json re-throw
212
+ // becomes a blocked-step contract rather than a raw crash.
201
213
  await cleanupStaleArtifactsDir(artifactsDir);
202
214
  // Inside the backstop (AGY review catch): a supervisor-dir IO failure must
203
215
  // yield a blocked step too. The backstop's own writer needs no pre-created
@@ -248,18 +260,21 @@ async function cmdNextStepBody(argv, root, artifactsDir) {
248
260
  await NEXT_STEP_EMISSION.emitPlan(currentStepPlan(preflight));
249
261
  return;
250
262
  }
263
+ const timeoutMs = getTimeoutMs(argv);
264
+ const deadline = { at: Date.now() + timeoutMs };
251
265
  const result = await runDeterministicForNextStep({
252
266
  root,
253
267
  artifactsDir,
254
268
  selfCliPath: resolve(argv[1] ?? process.argv[1] ?? ""),
255
- timeoutMs: getTimeoutMs(argv),
269
+ timeoutMs,
270
+ deadline,
256
271
  narrativeEnabled: true,
257
272
  analyzers: analyzerPolicy.analyzers,
258
273
  // Slice D: enable external-analyzer acquisition on the real CLI path (default-on;
259
274
  // session config can opt out). The executor builds its own global-`fetch`
260
275
  // adapter when no fetcher is injected. The unit/integration suite never reaches
261
276
  // here, so acquisition stays a hermetic no-op in tests.
262
- externalAcquisition: buildExternalAcquisitionOptions(analyzerPolicy),
277
+ externalAcquisition: { ...buildExternalAcquisitionOptions(analyzerPolicy), deadline },
263
278
  autoFix: {
264
279
  ...(hasFlag(argv, "--auto-fix") ? { enabled: true } : {}),
265
280
  dryRun: hasFlag(argv, "--dry-run"),
@@ -274,6 +289,7 @@ async function cmdNextStepBody(argv, root, artifactsDir) {
274
289
  advisoryNotice: result.advisoryNotice,
275
290
  argv,
276
291
  root,
292
+ sourceRoot: result.sourceRoot,
277
293
  artifactsDir,
278
294
  analyzerPolicy,
279
295
  result,
@@ -355,7 +371,7 @@ async function withReadyInspection(plan, ctx) {
355
371
  if (plan.via !== "current" || !ctx || !inspectionRun)
356
372
  return plan;
357
373
  const { handoff, resultPaths } = await prepareSemanticReviewWorkload({
358
- root: ctx.root, artifactsDir: ctx.artifactsDir,
374
+ root: ctx.root, sourceRoot: ctx.sourceRoot, artifactsDir: ctx.artifactsDir,
359
375
  bundle: ctx.result.bundle, activeReviewRun: inspectionRun,
360
376
  });
361
377
  return {
@@ -396,27 +412,23 @@ async function writeAuditStep(plan) {
396
412
  }
397
413
  }
398
414
  /**
399
- * Insert the fold's drained advisory lines just under a prompt's first line —
400
- * its `# <title>` heading — where session-scoped advisories belong: before the
401
- * instructions they qualify.
415
+ * The task above can end with "run next-step and follow only the new prompt",
416
+ * and the carry is stated on one step only, so the lead tells the reader to act
417
+ * on the report first.
418
+ */
419
+ const CARRIED_REPORT_LEAD = "Before you run next-step, read the report below on results from earlier work.";
420
+ /**
421
+ * Append the fold's drained advisory lines AFTER a prompt's own instructions.
402
422
  *
403
- * A prompt that does not start with a heading (or has no second line) is
404
- * returned unchanged rather than spliced somewhere meaningless. Every audit
405
- * plan's prompt opens with its heading — each row is a literal template
406
- * starting with `# ` — so this is the degenerate-input arm, not the norm.
423
+ * The lines report on OTHER work — the results of an earlier review step — so
424
+ * they do not qualify this step's instructions, and the step states its own
425
+ * task first (owner, 2026-10-06, after the 2026-10-05 dogfood run put hundreds
426
+ * of carried lines between a design-review heading and its instructions).
407
427
  */
408
428
  function withAdvisoryNoticeInPrompt(prompt, advisoryNotice) {
409
429
  if (advisoryNotice === undefined || advisoryNotice.length === 0)
410
430
  return prompt;
411
- const headingEnd = prompt.indexOf("\n");
412
- if (!prompt.startsWith("# ") || headingEnd < 0)
413
- return prompt;
414
- return [
415
- prompt.slice(0, headingEnd),
416
- "",
417
- ...advisoryNotice,
418
- prompt.slice(headingEnd + 1),
419
- ].join("\n");
431
+ return [prompt.trimEnd(), "", CARRIED_REPORT_LEAD, "", ...advisoryNotice].join("\n");
420
432
  }
421
433
  /**
422
434
  * Apply the fold's drained advisory lines to a step plan.
@@ -523,7 +535,7 @@ function renderIgnoredReviewNoticeLines(settings) {
523
535
  ? [settings.ignored_review_notice, ""]
524
536
  : [];
525
537
  }
526
- const emitDesignReviewParallel = emissionRow(async ({ root, artifactsDir }, result) => {
538
+ const emitDesignReviewParallel = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
527
539
  // Both passes are unsatisfied — dispatch the contract pass and the
528
540
  // conceptual pass simultaneously. The conceptual pass is shallow (one agent)
529
541
  // or deep (N independent perspective lanes + an independent judge),
@@ -532,10 +544,11 @@ const emitDesignReviewParallel = emissionRow(async ({ root, artifactsDir }, resu
532
544
  const conceptualSettings = resolveConceptualReviewSettings(result.bundle);
533
545
  const contract = await prepareContractDispatch({
534
546
  artifactsDir,
547
+ sourceRoot,
535
548
  bundle: result.bundle,
536
549
  maxUnits: conceptualSettings.max_units,
537
550
  });
538
- const conceptual = await prepareConceptualPass(artifactsDir, result.bundle, conceptualSettings);
551
+ const conceptual = await prepareConceptualPass(artifactsDir, sourceRoot, result.bundle, conceptualSettings);
539
552
  const shortfall = mergeLaneShortfalls([
540
553
  contract.shortfall,
541
554
  conceptual.shortfall,
@@ -574,7 +587,7 @@ const emitDesignReviewParallel = emissionRow(async ({ root, artifactsDir }, resu
574
587
  submissionShortfall: shortfall,
575
588
  });
576
589
  });
577
- const emitDesignReviewContract = emissionRow(async ({ root, artifactsDir }, result) => {
590
+ const emitDesignReviewContract = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
578
591
  // Only the contract pass remains — dispatched exactly as in the parallel
579
592
  // branch. This branch is reached whenever the conceptual pass is already
580
593
  // done, i.e. late in a run the host itself drove, which is precisely when
@@ -584,6 +597,7 @@ const emitDesignReviewContract = emissionRow(async ({ root, artifactsDir }, resu
584
597
  const conceptualSettings = resolveConceptualReviewSettings(result.bundle);
585
598
  const contract = await prepareContractDispatch({
586
599
  artifactsDir,
600
+ sourceRoot,
587
601
  bundle: result.bundle,
588
602
  maxUnits: conceptualSettings.max_units,
589
603
  });
@@ -616,13 +630,13 @@ const emitDesignReviewContract = emissionRow(async ({ root, artifactsDir }, resu
616
630
  submissionShortfall: contract.shortfall,
617
631
  });
618
632
  });
619
- const emitDesignReviewConceptual = emissionRow(async ({ root, artifactsDir }, result) => {
633
+ const emitDesignReviewConceptual = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
620
634
  // Only the conceptual pass remains — shallow (one agent) or deep (N
621
635
  // independent perspective lanes + an independent judge), resolved JIT
622
636
  // from the user-confirmed checkpoint / session config.
623
637
  const continueCommand = nextStepCommand(root, artifactsDir);
624
638
  const conceptualSettings = resolveConceptualReviewSettings(result.bundle);
625
- const conceptual = await prepareConceptualPass(artifactsDir, result.bundle, conceptualSettings);
639
+ const conceptual = await prepareConceptualPass(artifactsDir, sourceRoot, result.bundle, conceptualSettings);
626
640
  const prompt = [
627
641
  "# Design review — conceptual pass",
628
642
  "",
@@ -656,7 +670,7 @@ const emitDesignReviewConceptual = emissionRow(async ({ root, artifactsDir }, re
656
670
  submissionShortfall: conceptual.shortfall,
657
671
  });
658
672
  });
659
- const emitCharterExtraction = emissionRow(async ({ root, artifactsDir }, result) => {
673
+ const emitCharterExtraction = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
660
674
  // Phase C charter layer (conceptual, teleological): one blind, materialized
661
675
  // LANE per charter kind (design resolution 2 — independence is the shape of
662
676
  // the artifacts, not a merge instruction); the tool merges the per-kind
@@ -672,23 +686,28 @@ const emitCharterExtraction = emissionRow(async ({ root, artifactsDir }, result)
672
686
  // lane's evidence current.
673
687
  // Promise.all retains `kinds` order. The materializer derives the packet
674
688
  // read paths from that ordered lane list, never from IO completion order.
675
- const laneSpecs = await Promise.all(kinds.map(async (kind) => {
689
+ // A kind whose packet is unchanged since the previous register's lane was
690
+ // written is CARRIED by the merge (`carriedCharterLane`): no lane is asked
691
+ // to re-author it. Its packet and coverage are still written — the merge
692
+ // checks the carried lane's citations against them.
693
+ const laneResults = (await Promise.all(kinds.map(async (kind) => {
676
694
  const lane = charterExtractionLane(kind);
677
695
  const submissionPath = laneSubmissionPath(artifactsDir, lane);
678
- const packetPath = join(laneAssetsDir(artifactsDir), charterExtractionPacketFilename(kind));
679
- const packet = await materializeCharterPacket({
680
- root,
681
- bundle: result.bundle,
682
- kind,
683
- });
684
- await writeTextFile(packetPath, packet.markdown);
685
696
  // The manifest the lane reads, persisted for the ingest pass: coverage
686
697
  // folds into the register and the delivered line runs are what a
687
698
  // citation is checked against.
688
- await writeJsonFile(join(laneAssetsDir(artifactsDir), charterExtractionCoverageFilename(kind)), buildCharterPacketManifest(kind, packet.excerpts, packet.coverage));
699
+ const { packetPath, packet, digest } = await writeCharterLaneAssets({
700
+ sourceRoot,
701
+ artifactsDir,
702
+ bundle: result.bundle,
703
+ kind,
704
+ });
705
+ if (carriedCharterLane(result.bundle, kind, digest) !== undefined) {
706
+ return undefined;
707
+ }
689
708
  return {
690
709
  id: lane,
691
- semanticInputRevision: hashContent(packet.markdown),
710
+ semanticInputRevision: digest,
692
711
  fileCount: new Set(packet.excerpts.map(excerpt => excerpt.source_path)).size,
693
712
  ...SEMANTIC_REVIEW_DEMAND,
694
713
  contextPaths: [packetPath],
@@ -700,9 +719,12 @@ const emitCharterExtraction = emissionRow(async ({ root, artifactsDir }, result)
700
719
  packetPath,
701
720
  }),
702
721
  };
703
- }));
722
+ })));
723
+ const carriedKinds = kinds.filter((_, index) => laneResults[index] === undefined);
724
+ const laneSpecs = laneResults.filter((spec) => spec !== undefined);
704
725
  const fanout = await materializeFanoutLanes({
705
726
  artifactsDir,
727
+ sourceRoot,
706
728
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
707
729
  lanes: laneSpecs,
708
730
  });
@@ -732,6 +754,12 @@ const emitCharterExtraction = emissionRow(async ({ root, artifactsDir }, result)
732
754
  })),
733
755
  }),
734
756
  "",
757
+ ...(carriedKinds.length > 0
758
+ ? [
759
+ `Carried from the previous extraction (their evidence packet is unchanged — no lane is asked to re-author them): ${carriedKinds.join(", ")}.`,
760
+ "",
761
+ ]
762
+ : []),
735
763
  ...(completedLanes.length > 0
736
764
  ? [
737
765
  `Already complete (results on disk — do NOT redo these lanes): ${completedLanes
@@ -756,7 +784,7 @@ const emitCharterExtraction = emissionRow(async ({ root, artifactsDir }, result)
756
784
  submissionShortfall: fanout.shortfall,
757
785
  });
758
786
  });
759
- const emitCharterComparison = emissionRow(async ({ root, artifactsDir }, result) => {
787
+ const emitCharterComparison = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
760
788
  // Steps 2–3 of the charter layer: the comparison reader (it authored none of
761
789
  // the three lane DAGs) confirms the tool's correspondence candidates and
762
790
  // records the typed differences; the tool assembles, routes and pre-checks at
@@ -778,6 +806,7 @@ const emitCharterComparison = emissionRow(async ({ root, artifactsDir }, result)
778
806
  const lanePrompt = renderCharterComparisonPrompt(result.bundle, { submissionPath, laneGraphPaths });
779
807
  const fanout = await materializeFanoutLanes({
780
808
  artifactsDir,
809
+ sourceRoot,
781
810
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
782
811
  lanes: [
783
812
  {
@@ -829,7 +858,7 @@ const emitCharterComparison = emissionRow(async ({ root, artifactsDir }, result)
829
858
  submissionShortfall: fanout.shortfall,
830
859
  });
831
860
  });
832
- const emitCharterFidelity = emissionRow(async ({ root, artifactsDir }, result) => {
861
+ const emitCharterFidelity = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
833
862
  // Step 4 of the charter layer: a SEPARATE lane judges, per finding candidate,
834
863
  // whether the sources genuinely differ. Blind by input: the tool materializes
835
864
  // a packet holding the accounts, their citations and the source slices at
@@ -837,11 +866,12 @@ const emitCharterFidelity = emissionRow(async ({ root, artifactsDir }, result) =
837
866
  const continueCommand = nextStepCommand(root, artifactsDir);
838
867
  const submissionPath = laneSubmissionPath(artifactsDir, GATE_LANES.charter_fidelity);
839
868
  const packetPath = join(laneAssetsDir(artifactsDir), "charter-fidelity-packet.md");
840
- const fidelityPacket = await buildCharterFidelityPacket(result.bundle, root);
869
+ const fidelityPacket = await buildCharterFidelityPacket(result.bundle, sourceRoot);
841
870
  await writeFile(packetPath, fidelityPacket, "utf8");
842
871
  const lanePrompt = renderCharterFidelityPrompt({ submissionPath, packetPath });
843
872
  const fanout = await materializeFanoutLanes({
844
873
  artifactsDir,
874
+ sourceRoot,
845
875
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
846
876
  lanes: [
847
877
  {
@@ -926,8 +956,8 @@ const emitCharterClarification = emissionRow(async ({ root, artifactsDir }, resu
926
956
  submissionShortfall: shortfall,
927
957
  });
928
958
  });
929
- // sites-pinned: tests/audit/systemic-round-identity.test.ts
930
- const emitSystemicChallenge = emissionRow(async ({ root, artifactsDir }, result) => {
959
+ // sites-pinned: tests/audit/systemic-round-identity.test.ts, tests/audit/review-file-map-context.test.ts
960
+ const emitSystemicChallenge = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
931
961
  // Phase E second-order adversary (loop-until-dry): the tool has opened the loop
932
962
  // and computed the language-neutral aggregate-metrics digest. The host dispatches
933
963
  // a SEPARATE adversary agent whose mandate is optimization/better-way; it writes
@@ -956,6 +986,7 @@ const emitSystemicChallenge = emissionRow(async ({ root, artifactsDir }, result)
956
986
  // FILE — the adversary is a SEPARATE agent by lane class, on every host.
957
987
  const fanout = await materializeFanoutLanes({
958
988
  artifactsDir,
989
+ sourceRoot,
959
990
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
960
991
  roundId: lane,
961
992
  lanes: [
@@ -965,6 +996,7 @@ const emitSystemicChallenge = emissionRow(async ({ root, artifactsDir }, result)
965
996
  fileCount: result.bundle.repo_manifest?.files.length ?? 0,
966
997
  ...SEMANTIC_REVIEW_DEMAND,
967
998
  contextPaths: evidencePaths,
999
+ generatedContext: [adversaryFileMapContext(result.bundle).contextFile],
968
1000
  label: "Second-order adversary (improvement-seeking challenge)",
969
1001
  promptFilename: "systemic-challenge-prompt.md",
970
1002
  promptText: adversaryPrompt,
@@ -1015,10 +1047,13 @@ const emitSystemicChallenge = emissionRow(async ({ root, artifactsDir }, result)
1015
1047
  submissionShortfall: fanout.shortfall,
1016
1048
  });
1017
1049
  });
1018
- const emitConfirmIntent = emissionRow(async ({ root, artifactsDir, argv }, result) => {
1050
+ const emitConfirmIntent = emissionRow(async ({ root, sourceRoot, artifactsDir, argv }, result) => {
1019
1051
  const intentCheckpointPath = join(artifactsDir, "intent_checkpoint.json");
1020
1052
  const continueCommand = nextStepCommand(root, artifactsDir);
1021
- const preDigest = await computeScopePreDigest(result.bundle, root, getFlag(argv, "--since"));
1053
+ // The `--since` commit the fold resolved and recorded for this run, so the
1054
+ // pre-digest names the same delta the planning draw uses.
1055
+ const sinceFlag = getFlag(argv, "--since");
1056
+ const preDigest = await computeScopePreDigest(result.bundle, sourceRoot, sinceFlag === undefined ? undefined : await lookupRunSince(artifactsDir, sinceFlag));
1022
1057
  let bootstrappedGuidance;
1023
1058
  if (!result.bundle.intent_checkpoint) {
1024
1059
  try {
@@ -1103,7 +1138,7 @@ const emitAnalyzerInstall = emissionRow(async ({ root, artifactsDir, analyzerPol
1103
1138
  submissionShortfall: shortfall,
1104
1139
  });
1105
1140
  });
1106
- const emitEdgeReasoning = emissionRow(async ({ root, artifactsDir }, result) => {
1141
+ const emitEdgeReasoning = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
1107
1142
  const edgeReasoningResultsPath = laneSubmissionPath(artifactsDir, GATE_LANES.edge_reasoning);
1108
1143
  const continueCommand = nextStepCommand(root, artifactsDir);
1109
1144
  const basePrompt = buildEdgeReasoningPrompt(result.candidates);
@@ -1130,6 +1165,7 @@ const emitEdgeReasoning = emissionRow(async ({ root, artifactsDir }, result) =>
1130
1165
  // step so the K-of-N/result-exists semantics stay single-sourced.
1131
1166
  const fanout = await materializeFanoutLanes({
1132
1167
  artifactsDir,
1168
+ sourceRoot,
1133
1169
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
1134
1170
  lanes: [
1135
1171
  {
@@ -1260,7 +1296,7 @@ const emitIntentEquivalence = emissionRow(async ({ root, artifactsDir }, result)
1260
1296
  submissionShortfall: shortfall,
1261
1297
  });
1262
1298
  });
1263
- const emitCriticalFlowFallback = emissionRow(async ({ root, artifactsDir }, result) => {
1299
+ const emitCriticalFlowFallback = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
1264
1300
  const fallbackResultsPath = laneSubmissionPath(artifactsDir, GATE_LANES.critical_flow_fallback);
1265
1301
  const continueCommand = nextStepCommand(root, artifactsDir);
1266
1302
  const manifestPath = toPromptPathToken(join(artifactsDir, "critical_flows.json"));
@@ -1273,6 +1309,7 @@ const emitCriticalFlowFallback = emissionRow(async ({ root, artifactsDir }, resu
1273
1309
  const lanePrompt = basePrompt;
1274
1310
  const fanout = await materializeFanoutLanes({
1275
1311
  artifactsDir,
1312
+ sourceRoot,
1276
1313
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
1277
1314
  lanes: [
1278
1315
  {
@@ -1320,7 +1357,7 @@ const emitCriticalFlowFallback = emissionRow(async ({ root, artifactsDir }, resu
1320
1357
  submissionShortfall: fanout.shortfall,
1321
1358
  });
1322
1359
  });
1323
- const emitSynthesisNarrative = emissionRow(async ({ root, artifactsDir }, result) => {
1360
+ const emitSynthesisNarrative = emissionRow(async ({ root, sourceRoot, artifactsDir }, result) => {
1324
1361
  const narrativeResultsPath = laneSubmissionPath(artifactsDir, GATE_LANES.synthesis_narrative);
1325
1362
  const continueCommand = nextStepCommand(root, artifactsDir);
1326
1363
  // The complete findings report, named in the prompt AND granted below. The
@@ -1339,6 +1376,7 @@ const emitSynthesisNarrative = emissionRow(async ({ root, artifactsDir }, result
1339
1376
  const lanePrompt = basePrompt;
1340
1377
  const fanout = await materializeFanoutLanes({
1341
1378
  artifactsDir,
1379
+ sourceRoot,
1342
1380
  runId: AUDIT_GATE_SUBMISSION_SCOPE,
1343
1381
  lanes: [
1344
1382
  {
@@ -1430,6 +1468,7 @@ const NEXT_STEP_EMISSION = createStepEmissionScaffold({
1430
1468
  const result = ctx.result;
1431
1469
  return semanticReviewPlan({
1432
1470
  root: ctx.root,
1471
+ sourceRoot: ctx.sourceRoot,
1433
1472
  artifactsDir: ctx.artifactsDir,
1434
1473
  activeReviewRun: result.activeReviewRun,
1435
1474
  bundle: result.bundle,
@@ -1441,7 +1480,9 @@ const NEXT_STEP_EMISSION = createStepEmissionScaffold({
1441
1480
  },
1442
1481
  // The drained advisory lines decorate the PLAN inside the one writer, so
1443
1482
  // they reach every row (and the fallback) without a second splice per row.
1444
- write: async (plan, ctx) => writeAuditStep(await withReadyInspection(withAdvisoryNotice(plan, ctx?.advisoryNotice), ctx)),
1483
+ // They decorate LAST: the ready-inspection section is part of this step's
1484
+ // own task, and the carried report follows the whole task.
1485
+ write: async (plan, ctx) => writeAuditStep(withAdvisoryNotice(await withReadyInspection(plan, ctx), ctx?.advisoryNotice)),
1445
1486
  // The tool's only externally-observable per-invocation contract.
1446
1487
  log: (step) => {
1447
1488
  console.log(JSON.stringify(step, null, 2));