lazycodex-ai 5.0.0-beta.34 → 5.0.0-beta.36

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 (189) hide show
  1. package/README.ja.md +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/README.ru.md +1 -1
  5. package/README.zh-cn.md +1 -1
  6. package/dist/cli/index.js +48341 -48541
  7. package/dist/cli-node/index.js +49016 -49216
  8. package/package.json +1 -6
  9. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -3
  10. package/packages/omo-codex/plugin/.mcp.json +0 -6
  11. package/packages/omo-codex/plugin/AGENTS.md +5 -5
  12. package/packages/omo-codex/plugin/README.md +1 -1
  13. package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +1 -15
  14. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  15. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  16. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  17. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  18. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  19. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  20. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  21. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  22. package/packages/omo-codex/plugin/components/lcx/skills/lcx-doctor/SKILL.md +1 -1
  23. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  24. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  25. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  26. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  27. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  28. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  29. package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
  30. package/packages/omo-codex/plugin/components/teammode/test/thread-title-hook.test.ts +1 -1
  31. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  32. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  33. package/packages/omo-codex/plugin/components/ultrawork/dist/cli.js +2 -2
  34. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  35. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  36. package/packages/omo-codex/plugin/components/ultrawork/skills/ulw-plan/SKILL.md +0 -1
  37. package/packages/omo-codex/plugin/components/ultrawork/src/directive-content.ts +1 -1
  38. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +2 -2
  39. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  40. package/packages/omo-codex/plugin/components/ulw-loop/README.md +11 -1
  41. package/packages/omo-codex/plugin/components/ulw-loop/directive.md +2 -2
  42. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.d.ts +12 -0
  43. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-codex-validation.js +45 -0
  44. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.d.ts +1 -0
  45. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-reconciliation.js +5 -0
  46. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint-template.js +10 -3
  47. package/packages/omo-codex/plugin/components/ulw-loop/dist/checkpoint.js +35 -38
  48. package/packages/omo-codex/plugin/components/ulw-loop/dist/cli.js +278 -193
  49. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.d.ts +5 -0
  50. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-aggregate.js +7 -51
  51. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-artifacts.js +39 -22
  52. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.d.ts +13 -1
  53. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-fields.js +64 -8
  54. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate-verdicts.js +5 -1
  55. package/packages/omo-codex/plugin/components/ulw-loop/dist/quality-gate.js +37 -18
  56. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +4 -4
  57. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  58. package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +2 -1
  59. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-codex-validation.ts +81 -0
  60. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-reconciliation.ts +6 -0
  61. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint-template.ts +10 -3
  62. package/packages/omo-codex/plugin/components/ulw-loop/src/checkpoint.ts +32 -63
  63. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-aggregate.ts +7 -53
  64. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-artifacts.ts +50 -31
  65. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-fields.ts +67 -14
  66. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate-verdicts.ts +6 -1
  67. package/packages/omo-codex/plugin/components/ulw-loop/src/quality-gate.ts +36 -17
  68. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-final.test.ts +26 -0
  69. package/packages/omo-codex/plugin/components/ulw-loop/test/checkpoint-template.test.ts +47 -2
  70. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate-basics.test.ts +258 -0
  71. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-cap-and-dedupe.test.ts +22 -0
  72. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-poisoning-cascades.test.ts +97 -0
  73. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-single-report.test.ts +241 -0
  74. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  75. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  76. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  77. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  78. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  79. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  80. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  81. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  82. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  83. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  84. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  85. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  86. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  87. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  88. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  89. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  90. package/packages/omo-codex/plugin/hooks/subagent-stop-checking-ulw-execute-continuation.json +1 -1
  91. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  92. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  93. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  94. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  95. package/packages/omo-codex/plugin/package-lock.json +12 -146
  96. package/packages/omo-codex/plugin/package.json +1 -2
  97. package/packages/omo-codex/plugin/scripts/AGENTS.md +0 -1
  98. package/packages/omo-codex/plugin/scripts/auto-update-plan.mjs +0 -1
  99. package/packages/omo-codex/plugin/scripts/auto-update.mjs +0 -9
  100. package/packages/omo-codex/plugin/scripts/hook-status-message.mjs +0 -1
  101. package/packages/omo-codex/plugin/shared/src/config-loader.ts +2 -102
  102. package/packages/omo-codex/plugin/shared/src/config-migration.ts +0 -1
  103. package/packages/omo-codex/plugin/shared/test/config-loader.test.ts +41 -130
  104. package/packages/omo-codex/plugin/skills/init-deep/SKILL.md +13 -13
  105. package/packages/omo-codex/plugin/skills/lcx-doctor/SKILL.md +1 -1
  106. package/packages/omo-codex/plugin/skills/ultrawork/SKILL.md +2 -2
  107. package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +11 -19
  108. package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +2 -1
  109. package/packages/omo-codex/plugin/skills/ulw-plan/SKILL.md +0 -1
  110. package/packages/omo-codex/plugin/test/AGENTS.md +2 -2
  111. package/packages/omo-codex/plugin/test/aggregate-hooks.test.mjs +2 -21
  112. package/packages/omo-codex/plugin/test/aggregate-manifest.test.mjs +1 -2
  113. package/packages/omo-codex/plugin/test/aggregate-mcp.test.mjs +2 -7
  114. package/packages/omo-codex/plugin/test/auto-update.test.mjs +0 -25
  115. package/packages/omo-codex/plugin/test/bootstrap-setup.test.mjs +0 -31
  116. package/packages/omo-codex/plugin/test/component-bundled-cli.test.mjs +0 -50
  117. package/packages/omo-codex/plugin/test/hook-status-message.test.mjs +0 -1
  118. package/packages/omo-codex/plugin/test/mcp-research-servers.test.mjs +1 -3
  119. package/packages/omo-codex/scripts/install-dist/install-local.mjs +227 -435
  120. package/packages/prompts-core/prompts/ultrawork/codex.md +2 -2
  121. package/packages/shared-skills/skills/init-deep/SKILL.md +13 -13
  122. package/packages/shared-skills/skills/ulw-execute/SKILL.md +9 -9
  123. package/packages/shared-skills/skills/ulw-plan/SKILL.md +0 -1
  124. package/packages/omo-codex/plugin/components/codegraph/AGENTS.md +0 -58
  125. package/packages/omo-codex/plugin/components/codegraph/LICENSE +0 -21
  126. package/packages/omo-codex/plugin/components/codegraph/NODE-RUNTIME-LICENSES.md +0 -2951
  127. package/packages/omo-codex/plugin/components/codegraph/NOTICE +0 -16
  128. package/packages/omo-codex/plugin/components/codegraph/dist/cli.js +0 -12326
  129. package/packages/omo-codex/plugin/components/codegraph/dist/serve.js +0 -9908
  130. package/packages/omo-codex/plugin/components/codegraph/package.json +0 -33
  131. package/packages/omo-codex/plugin/components/codegraph/src/cache-gc.ts +0 -29
  132. package/packages/omo-codex/plugin/components/codegraph/src/cli.ts +0 -79
  133. package/packages/omo-codex/plugin/components/codegraph/src/hook-input.ts +0 -33
  134. package/packages/omo-codex/plugin/components/codegraph/src/hook-sweep.ts +0 -25
  135. package/packages/omo-codex/plugin/components/codegraph/src/hook-types.ts +0 -131
  136. package/packages/omo-codex/plugin/components/codegraph/src/hook.ts +0 -258
  137. package/packages/omo-codex/plugin/components/codegraph/src/mcp-bridge.ts +0 -310
  138. package/packages/omo-codex/plugin/components/codegraph/src/mcp-unavailable.ts +0 -92
  139. package/packages/omo-codex/plugin/components/codegraph/src/post-tool-use-hook.ts +0 -34
  140. package/packages/omo-codex/plugin/components/codegraph/src/serve-invocation.ts +0 -29
  141. package/packages/omo-codex/plugin/components/codegraph/src/serve.ts +0 -263
  142. package/packages/omo-codex/plugin/components/codegraph/src/session-start-command.ts +0 -106
  143. package/packages/omo-codex/plugin/components/codegraph/src/session-start-cooldown.ts +0 -145
  144. package/packages/omo-codex/plugin/components/codegraph/src/session-start-hook-runtime.ts +0 -22
  145. package/packages/omo-codex/plugin/components/codegraph/src/session-start-lock.ts +0 -139
  146. package/packages/omo-codex/plugin/components/codegraph/src/session-start-outcome.ts +0 -15
  147. package/packages/omo-codex/plugin/components/codegraph/src/session-start-paths.ts +0 -32
  148. package/packages/omo-codex/plugin/components/codegraph/src/session-start-project.ts +0 -109
  149. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker-result.ts +0 -148
  150. package/packages/omo-codex/plugin/components/codegraph/src/session-start-worker.ts +0 -175
  151. package/packages/omo-codex/plugin/components/codegraph/src/sweep-cli.ts +0 -81
  152. package/packages/omo-codex/plugin/components/codegraph/test/cache-gc.test.ts +0 -34
  153. package/packages/omo-codex/plugin/components/codegraph/test/hook-exclusion.test.ts +0 -112
  154. package/packages/omo-codex/plugin/components/codegraph/test/hook-registration.test.ts +0 -26
  155. package/packages/omo-codex/plugin/components/codegraph/test/hook-session-start-guard.test.ts +0 -160
  156. package/packages/omo-codex/plugin/components/codegraph/test/hook-store-upgrade.test.ts +0 -50
  157. package/packages/omo-codex/plugin/components/codegraph/test/hook-sweep.test.ts +0 -29
  158. package/packages/omo-codex/plugin/components/codegraph/test/hook.test.ts +0 -320
  159. package/packages/omo-codex/plugin/components/codegraph/test/mcp-bridge-fixtures.ts +0 -172
  160. package/packages/omo-codex/plugin/components/codegraph/test/package-runtime.test.ts +0 -91
  161. package/packages/omo-codex/plugin/components/codegraph/test/provisioned-node-guard.test.ts +0 -100
  162. package/packages/omo-codex/plugin/components/codegraph/test/serve-built-wrapper.test.ts +0 -76
  163. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge-lifecycle.test.ts +0 -133
  164. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-bridge.test.ts +0 -245
  165. package/packages/omo-codex/plugin/components/codegraph/test/serve-mcp-facade.test.ts +0 -69
  166. package/packages/omo-codex/plugin/components/codegraph/test/serve-node-support.test.ts +0 -43
  167. package/packages/omo-codex/plugin/components/codegraph/test/serve-provision.test.ts +0 -147
  168. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable-idle.test.ts +0 -47
  169. package/packages/omo-codex/plugin/components/codegraph/test/serve-unavailable.test.ts +0 -175
  170. package/packages/omo-codex/plugin/components/codegraph/test/serve.test.ts +0 -385
  171. package/packages/omo-codex/plugin/components/codegraph/test/session-start-node-support.test.ts +0 -206
  172. package/packages/omo-codex/plugin/components/codegraph/test/session-start-project.test.ts +0 -58
  173. package/packages/omo-codex/plugin/components/codegraph/test/session-start-state.test.ts +0 -104
  174. package/packages/omo-codex/plugin/components/codegraph/test/session-start-trust-boundary.test.ts +0 -65
  175. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-availability.test.ts +0 -106
  176. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-cooldown.test.ts +0 -116
  177. package/packages/omo-codex/plugin/components/codegraph/test/session-start-worker-flow.test.ts +0 -258
  178. package/packages/omo-codex/plugin/components/codegraph/test/sweep-cli.test.ts +0 -56
  179. package/packages/omo-codex/plugin/components/codegraph/tsconfig.build.json +0 -13
  180. package/packages/omo-codex/plugin/components/codegraph/tsconfig.json +0 -25
  181. package/packages/omo-codex/plugin/components/ulw-loop/test/quality-gate-aggregate.test.ts +0 -101
  182. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-codegraph-init-guidance.json +0 -18
  183. package/packages/omo-codex/plugin/hooks/session-start-checking-codegraph-bootstrap.json +0 -17
  184. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/editor.mjs +0 -125
  185. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/jsonc.mjs +0 -43
  186. package/packages/omo-codex/plugin/scripts/migrate-omo-sot/scaffold.mjs +0 -29
  187. package/packages/omo-codex/plugin/scripts/migrate-omo-sot.mjs +0 -121
  188. package/packages/omo-codex/plugin/test/component-codegraph-mcp-smoke.test.mjs +0 -76
  189. package/packages/omo-codex/plugin/test/migrate-omo-sot.test.mjs +0 -179
@@ -21,7 +21,17 @@ Every subcommand below is implemented. Pass `--json` where supported for machine
21
21
  | `omo-agent-toolkit ulw-loop record-evidence` | Record observable evidence for one criterion. |
22
22
  | `omo-agent-toolkit ulw-loop record-review-blockers` | Mark a goal as review-blocked and add follow-up work from final-review findings. |
23
23
 
24
- The final quality gate parsed by `checkpoint` validates `codeReview`, `manualQa`, `gateReview`, `iteration`, and `criteriaCoverage`. `criteriaCoverage` records the original intent, desired outcome, user-facing outcome review, pass counts, and covered adversarial classes.
24
+ The final quality gate parsed by `checkpoint` validates `codeReview`, `manualQa`, `gateReview`, `iteration`, and `criteriaCoverage`, reporting all defects together in one invocation. `criteriaCoverage` records the original intent, desired outcome, user-facing outcome review, pass counts, and covered adversarial classes. The companion `codex-goal-json` must contain `goal.objective` equal to the plan's `codexObjective` verbatim.
25
+
26
+ A complete passing checkpoint uses both payloads:
27
+
28
+ ```json
29
+ {"goal":{"objective":"Ship the requested behavior","status":"complete"}}
30
+ ```
31
+
32
+ ```json
33
+ {"gateReview":{"by":"lazycodex-gate-reviewer","recommendation":"APPROVE","reportPath":".omo/evidence/gate-review.md","evidence":"Gate review passed.","blockers":[],"notes":[]},"manualQa":{"by":"lazycodex-qa-executor","status":"passed","evidence":"Manual QA passed.","surfaceEvidence":[{"id":"cli","criterionRef":"C1","surface":"cli","invocation":"omo-agent-toolkit ulw-loop checkpoint --json","verdict":"passed","artifactRefs":["cli-artifact"]}],"adversarialCases":[{"id":"malformed","criterionRef":"C2","scenario":"Malformed input","expectedBehavior":"Rejected","verdict":"not_applicable","reason":"Not triggered","artifactRefs":["cli-artifact"]}],"artifactRefs":[{"id":"cli-artifact","kind":"cli-transcript","description":"Passing CLI transcript","path":".omo/evidence/cli.txt"}]},"codeReview":{"by":"lazycodex-code-reviewer","recommendation":"APPROVE","codeQualityStatus":"CLEAR","reportPath":".omo/evidence/code-review.md","evidence":"Code review passed.","blockers":[]},"iteration":{"fullRerun":true,"status":"passed","rerunCommands":["bun test"],"evidence":"Full rerun passed."},"criteriaCoverage":{"totalCriteria":2,"passCount":2,"originalIntent":"Ship the requested behavior","desiredOutcome":"The behavior works for users.","userOutcomeReview":"The result matches the requested outcome.","adversarialClassesCovered":["malformed_input"]}}
34
+ ```
25
35
 
26
36
  Validation batches are optional review boundaries declared at plan creation with `--validation-batch-json '[{"batchId":"VB001","memberIds":[...],"finalGoalId":"..."}]'`. The batch-final goal cannot complete until every other member is complete or superseded-resolved, every member criterion is pass, and a quality gate's coverage counts match the recomputed member criteria. Steering split/supersede mutations keep batch membership consistent and record `batch_updated`.
27
37
 
@@ -229,8 +229,8 @@ and utility functions to batch commands and reduce output. Keep direct calls
229
229
  when one result chooses the next action, outputs are already small, semantic
230
230
  judgment is required between calls, approval or side effects are involved,
231
231
  or native artifacts / citations must be preserved.
232
- - Architecture / flow / blast radius → `codegraph_explore` first when
233
- `codegraph_*` exists; if unavailable, continue with repo tools and LSP.
232
+ - Architecture / flow / blast radius → explore agents plus LSP references
233
+ and impact; do not guess from conventions.
234
234
  - **SYMBOLS REQUIRE LSP** — definitions, references, rename impact,
235
235
  workspace symbols, and diagnostics use the available `lsp_*` tools, not
236
236
  text search. Run diagnostics after edits and treat errors as blocking.
@@ -0,0 +1,12 @@
1
+ import type { UlwLoopScope } from "./paths.js";
2
+ import type { UlwLoopItem, UlwLoopPlan } from "./types.js";
3
+ import { UlwLoopError } from "./types.js";
4
+ export declare function validateCheckpointCodexGoal(input: {
5
+ readonly repoRoot: string;
6
+ readonly plan: UlwLoopPlan;
7
+ readonly goal: UlwLoopItem;
8
+ readonly raw: string | undefined;
9
+ readonly evidence: string;
10
+ readonly scope?: UlwLoopScope;
11
+ }): Promise<unknown>;
12
+ export declare function combineCheckpointValidationErrors(codexError: UlwLoopError, gateError: UlwLoopError): UlwLoopError;
@@ -0,0 +1,45 @@
1
+ import { canReconcileActiveFinalTaskScopedAggregateSnapshot, canReconcileCompletedTaskScopedAggregateSnapshot, codexSnapshotMismatchError, } from "./checkpoint-reconciliation.js";
2
+ import { readCodexGoalSnapshotInput, reconcileCodexGoalSnapshot } from "./codex-goal-snapshot.js";
3
+ import { codexGoalMode, compatibleCodexObjectives, expectedCodexObjective, isFinalRunCompletionCandidate, } from "./goal-status.js";
4
+ import { UlwLoopError } from "./types.js";
5
+ function normalizeObjective(value) {
6
+ return value.replace(/\s+/g, " ").trim();
7
+ }
8
+ export async function validateCheckpointCodexGoal(input) {
9
+ const aggregate = codexGoalMode(input.plan) === "aggregate";
10
+ const final = isFinalRunCompletionCandidate(input.plan, input.goal);
11
+ const snapshot = await readCodexGoalSnapshotInput(input.raw, input.repoRoot);
12
+ const expectedObjective = expectedCodexObjective(input.plan, input.goal);
13
+ const reconciliation = reconcileCodexGoalSnapshot(snapshot, {
14
+ expectedObjective,
15
+ ...(aggregate ? { acceptedObjectives: compatibleCodexObjectives(input.plan) } : {}),
16
+ allowedStatuses: aggregate ? (final ? ["complete"] : ["active"]) : ["complete"],
17
+ requireSnapshot: true,
18
+ requireComplete: !aggregate || final,
19
+ });
20
+ if (reconciliation.ok)
21
+ return reconciliation.snapshot.raw;
22
+ const objective = snapshot?.objective;
23
+ const mismatchedTaskObjective = snapshot?.available === true &&
24
+ objective !== undefined &&
25
+ normalizeObjective(objective) !== normalizeObjective(expectedObjective);
26
+ const completedTaskScoped = mismatchedTaskObjective &&
27
+ snapshot.status === "complete" &&
28
+ (await canReconcileCompletedTaskScopedAggregateSnapshot(input.repoRoot, input.plan, input.goal, objective, input.evidence, input.scope));
29
+ const activeFinalTaskScoped = mismatchedTaskObjective &&
30
+ snapshot.status === "active" &&
31
+ (await canReconcileActiveFinalTaskScopedAggregateSnapshot(input.repoRoot, input.plan, input.goal, objective, input.evidence, input.scope));
32
+ if (completedTaskScoped || activeFinalTaskScoped)
33
+ return reconciliation.snapshot.raw;
34
+ throw codexSnapshotMismatchError({
35
+ reconciliation,
36
+ snapshot,
37
+ expectedObjective,
38
+ taskScopedHint: { goal: input.goal, aggregate, final },
39
+ });
40
+ }
41
+ export function combineCheckpointValidationErrors(codexError, gateError) {
42
+ return new UlwLoopError(`${codexError.message}\n${gateError.message}`, "ULW_LOOP_QUALITY_GATE_INVALID", {
43
+ details: { ...(codexError.details ?? {}), ...(gateError.details ?? {}) },
44
+ });
45
+ }
@@ -13,6 +13,7 @@ export interface CodexSnapshotMismatchInput {
13
13
  readonly final: boolean;
14
14
  };
15
15
  }
16
+ export declare function combineCheckpointValidationErrors(codexError: UlwLoopError, gateError: UlwLoopError): UlwLoopError;
16
17
  export declare function codexSnapshotMismatchError(input: CodexSnapshotMismatchInput): UlwLoopError;
17
18
  export declare function canReconcileCompletedTaskScopedAggregateSnapshot(repoRoot: string, plan: UlwLoopPlan, goal: UlwLoopItem, snapshotObjective: string, evidence: string, scope?: UlwLoopScope): Promise<boolean>;
18
19
  export declare function canReconcileActiveFinalTaskScopedAggregateSnapshot(repoRoot: string, plan: UlwLoopPlan, goal: UlwLoopItem, snapshotObjective: string, evidence: string, scope?: UlwLoopScope): Promise<boolean>;
@@ -4,6 +4,11 @@ import { codexGoalMismatchRecovery, formatCodexGoalReconciliation } from "./code
4
4
  import { codexGoalMode, isFinalRunCompletionCandidate } from "./goal-status.js";
5
5
  import { ulwLoopBriefPath } from "./paths.js";
6
6
  import { ULW_LOOP_DIR, ULW_LOOP_GOALS, ULW_LOOP_LEDGER, UlwLoopError } from "./types.js";
7
+ export function combineCheckpointValidationErrors(codexError, gateError) {
8
+ return new UlwLoopError(`${codexError.message}\n${gateError.message}`, "ULW_LOOP_QUALITY_GATE_INVALID", {
9
+ details: { ...(codexError.details ?? {}), ...(gateError.details ?? {}) },
10
+ });
11
+ }
7
12
  export function codexSnapshotMismatchError(input) {
8
13
  const { reconciliation, snapshot, taskScopedHint } = input;
9
14
  const hint = taskScopedHint?.aggregate === true && snapshot?.status === "complete" && snapshot.objective !== undefined
@@ -63,6 +63,7 @@ function gateTemplate(surface, base) {
63
63
  reportPath: artifactPath(base, "gate-review.md"),
64
64
  evidence: "<replace:gate review evidence>",
65
65
  blockers: [],
66
+ notes: [],
66
67
  },
67
68
  iteration: {
68
69
  fullRerun: true,
@@ -101,13 +102,19 @@ export async function checkpointTemplate(repoRoot, scope, goalId) {
101
102
  throw new UlwLoopError(`Unknown ulw-loop id: ${goalId}.`, "ULW_LOOP_GOAL_NOT_FOUND", { details: { goalId } });
102
103
  const hasAttempt = plan.evidenceLayoutVersion === 2 && active !== undefined;
103
104
  const attemptDir = hasAttempt ? ulwLoopAttemptEvidenceDir(active.id, active.attempt, scope) : ".omo/evidence";
105
+ const guidance = [
106
+ "codex-goal-json requires goal.objective to equal the plan's codexObjective verbatim; do not paraphrase it.",
107
+ "Fill every <replace:...> value with plausible non-empty evidence and use real, non-empty artifact files.",
108
+ 'Passing codex-goal-json example: {"goal":{"objective":"<plan codexObjective verbatim>","status":"complete"}}.',
109
+ 'Passing quality-gate-json example requires gateReview {"by":"category:deep","recommendation":"APPROVE","evidence":"review passed","reportPath":"<attemptDir>/gate-review.md","blockers":[],"notes":[]}, manualQa.artifactRefs objects, iteration, and criteriaCoverage.',
110
+ ...(hasAttempt ? [] : ["This plan is evidence-layout v1; artifacts go under .omo/evidence/."]),
111
+ ].join(" ");
104
112
  return {
105
113
  qualityGateTemplate: gateTemplate(resolveToolkitSurface(), attemptDir),
106
114
  codexGoalTemplate: {
107
115
  goal: { objective: plan.codexObjective ?? "<replace:codex objective>", status: "complete" },
108
116
  },
109
- ...(hasAttempt
110
- ? { attemptDir }
111
- : { guidance: "This plan is evidence-layout v1; artifacts go under .omo/evidence/." }),
117
+ guidance,
118
+ ...(hasAttempt ? { attemptDir } : {}),
112
119
  };
113
120
  }
@@ -2,10 +2,9 @@
2
2
  import { existsSync, statSync } from "node:fs";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
- import { canReconcileActiveFinalTaskScopedAggregateSnapshot, canReconcileCompletedTaskScopedAggregateSnapshot, codexSnapshotMismatchError, } from "./checkpoint-reconciliation.js";
6
- import { readCodexGoalSnapshotInput, reconcileCodexGoalSnapshot } from "./codex-goal-snapshot.js";
5
+ import { combineCheckpointValidationErrors, validateCheckpointCodexGoal, } from "./checkpoint-codex-validation.js";
7
6
  import { requireAllCriteriaPass, requireAllPlanCriteriaPass, requireEssentialCriteriaPass } from "./evidence.js";
8
- import { codexGoalMode, compatibleCodexObjectives, expectedCodexObjective, isFinalRunCompletionCandidate, } from "./goal-status.js";
7
+ import { codexGoalMode, isFinalRunCompletionCandidate } from "./goal-status.js";
9
8
  import { ulwLoopAttemptEvidenceDir } from "./paths.js";
10
9
  import { appendLedger, readUlwLoopPlan, withUlwLoopMutationLock, writePlan } from "./plan-io.js";
11
10
  import { classifyExternalAuthorizationBlocker, clearGoalBlockerFields, sameBlockerOccurrences, validateQualityGate, } from "./quality-gate.js";
@@ -16,9 +15,6 @@ const QUALITY_GATE_FS = { existsSync, statSync };
16
15
  function ulwLoopFail(message, code) {
17
16
  throw new UlwLoopError(message, code);
18
17
  }
19
- function normalizeObjective(value) {
20
- return value.replace(/\s+/g, " ").trim();
21
- }
22
18
  function nonEmptyEvidence(value) {
23
19
  const trimmed = value.trim();
24
20
  return trimmed || ulwLoopFail("Evidence must be a non-empty string.", "ulw_loop_evidence_required");
@@ -127,29 +123,21 @@ export async function checkpointUlwLoop(repoRoot, args, scope) {
127
123
  requireEssentialCriteriaPass(goal);
128
124
  else
129
125
  requireAllCriteriaPass(goal);
130
- const snapshot = await readCodexGoalSnapshotInput(args.codexGoalJson, repoRoot);
131
- const reconciliation = reconcileCodexGoalSnapshot(snapshot, {
132
- expectedObjective: expectedCodexObjective(plan, goal),
133
- ...(aggregate ? { acceptedObjectives: compatibleCodexObjectives(plan) } : {}),
134
- allowedStatuses: aggregate ? (final ? ["complete"] : ["active"]) : ["complete"],
135
- requireSnapshot: true,
136
- requireComplete: !aggregate || final,
137
- });
138
- codexGoal = reconciliation.snapshot.raw;
139
- if (!reconciliation.ok) {
140
- const objective = snapshot?.objective;
141
- const mismatchedTaskObjective = snapshot?.available === true &&
142
- objective !== undefined &&
143
- normalizeObjective(objective) !== normalizeObjective(expectedCodexObjective(plan, goal));
144
- const completedTaskScoped = mismatchedTaskObjective &&
145
- snapshot.status === "complete" &&
146
- (await canReconcileCompletedTaskScopedAggregateSnapshot(repoRoot, plan, goal, objective, evidence, scope));
147
- const activeFinalTaskScoped = mismatchedTaskObjective &&
148
- snapshot.status === "active" &&
149
- (await canReconcileActiveFinalTaskScopedAggregateSnapshot(repoRoot, plan, goal, objective, evidence, scope));
150
- const taskScoped = completedTaskScoped || activeFinalTaskScoped;
151
- if (!taskScoped)
152
- throw codexSnapshotMismatchError({ reconciliation, snapshot, expectedObjective: expectedCodexObjective(plan, goal), taskScopedHint: { goal, aggregate, final } });
126
+ let codexValidationError;
127
+ try {
128
+ codexGoal = await validateCheckpointCodexGoal({
129
+ repoRoot,
130
+ plan,
131
+ goal,
132
+ raw: args.codexGoalJson,
133
+ evidence,
134
+ ...(scope === undefined ? {} : { scope }),
135
+ });
136
+ }
137
+ catch (error) {
138
+ if (!(error instanceof UlwLoopError))
139
+ throw error;
140
+ codexValidationError = error;
153
141
  }
154
142
  if (closesBatch)
155
143
  requireBatchFinalReady(plan, goal);
@@ -158,16 +146,25 @@ export async function checkpointUlwLoop(repoRoot, args, scope) {
158
146
  if (final)
159
147
  aggregateCompletion = makeAggregateCompletion(now, evidence, codexGoal);
160
148
  if (final || aggregateCompletion !== undefined || closesBatch) {
161
- qualityGate = validateQualityGate(await readJsonInput(args.qualityGateJson, repoRoot), {
162
- repoRoot,
163
- fs: QUALITY_GATE_FS,
164
- reviewerSurface: resolveToolkitSurface(),
165
- ...(plan.evidenceLayoutVersion === 2
166
- ? { currentAttemptDir: ulwLoopAttemptEvidenceDir(goal.id, goal.attempt, scope) }
167
- : {}),
168
- });
169
- requireBatchGate(plan, goal, qualityGate);
149
+ try {
150
+ qualityGate = validateQualityGate(await readJsonInput(args.qualityGateJson, repoRoot), {
151
+ repoRoot,
152
+ fs: QUALITY_GATE_FS,
153
+ reviewerSurface: resolveToolkitSurface(),
154
+ ...(plan.evidenceLayoutVersion === 2
155
+ ? { currentAttemptDir: ulwLoopAttemptEvidenceDir(goal.id, goal.attempt, scope) }
156
+ : {}),
157
+ });
158
+ requireBatchGate(plan, goal, qualityGate);
159
+ }
160
+ catch (error) {
161
+ if (!(error instanceof UlwLoopError) || codexValidationError === undefined)
162
+ throw error;
163
+ throw combineCheckpointValidationErrors(codexValidationError, error);
164
+ }
170
165
  }
166
+ if (codexValidationError !== undefined)
167
+ throw codexValidationError;
171
168
  goal.status = "complete";
172
169
  goal.completedAt = now;
173
170
  goal.evidence = evidence;