codex-workflow-v2 2.0.0-beta.13.8 → 2.0.0-beta.14

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 (281) hide show
  1. package/README.md +27 -388
  2. package/dist/reviewer-runtime-build.json +96 -32
  3. package/dist/src/alpha6/adoption.d.ts +2 -0
  4. package/dist/src/alpha6/adoption.js +22 -0
  5. package/dist/src/alpha6/adoption.js.map +1 -1
  6. package/dist/src/alpha6/captured-check-evidence.d.ts +51 -0
  7. package/dist/src/alpha6/captured-check-evidence.js +152 -0
  8. package/dist/src/alpha6/captured-check-evidence.js.map +1 -0
  9. package/dist/src/alpha6/component-owner.d.ts +15 -1
  10. package/dist/src/alpha6/component-owner.js +44 -2
  11. package/dist/src/alpha6/component-owner.js.map +1 -1
  12. package/dist/src/alpha6/corrective-decision-boundary.d.ts +4 -0
  13. package/dist/src/alpha6/corrective-decision-boundary.js +47 -0
  14. package/dist/src/alpha6/corrective-decision-boundary.js.map +1 -0
  15. package/dist/src/alpha6/downstream-proof.d.ts +1 -25
  16. package/dist/src/alpha6/downstream-proof.js +0 -171
  17. package/dist/src/alpha6/downstream-proof.js.map +1 -1
  18. package/dist/src/alpha6/failed-step-planning-recovery.d.ts +10 -0
  19. package/dist/src/alpha6/failed-step-planning-recovery.js +93 -0
  20. package/dist/src/alpha6/failed-step-planning-recovery.js.map +1 -0
  21. package/dist/src/alpha6/literal-test-invocation.d.ts +2 -0
  22. package/dist/src/alpha6/literal-test-invocation.js +106 -0
  23. package/dist/src/alpha6/literal-test-invocation.js.map +1 -0
  24. package/dist/src/alpha6/milestone.d.ts +2 -0
  25. package/dist/src/alpha6/milestone.js +10 -1
  26. package/dist/src/alpha6/milestone.js.map +1 -1
  27. package/dist/src/alpha6/navigation-dirty-carryover.d.ts +11 -0
  28. package/dist/src/alpha6/navigation-dirty-carryover.js +130 -0
  29. package/dist/src/alpha6/navigation-dirty-carryover.js.map +1 -0
  30. package/dist/src/alpha6/plan-integrity.js +7 -5
  31. package/dist/src/alpha6/plan-integrity.js.map +1 -1
  32. package/dist/src/alpha6/plan-risk.d.ts +2 -0
  33. package/dist/src/alpha6/plan-risk.js +10 -3
  34. package/dist/src/alpha6/plan-risk.js.map +1 -1
  35. package/dist/src/alpha6/remediation.d.ts +6 -21
  36. package/dist/src/alpha6/remediation.js +161 -476
  37. package/dist/src/alpha6/remediation.js.map +1 -1
  38. package/dist/src/alpha6/root-cause-replan-carryover.d.ts +4 -1
  39. package/dist/src/alpha6/root-cause-replan-carryover.js +29 -5
  40. package/dist/src/alpha6/root-cause-replan-carryover.js.map +1 -1
  41. package/dist/src/beta1/project-transaction.d.ts +3 -1
  42. package/dist/src/beta1/project-transaction.js +6 -2
  43. package/dist/src/beta1/project-transaction.js.map +1 -1
  44. package/dist/src/checks/runner.d.ts +26 -0
  45. package/dist/src/checks/runner.js +223 -0
  46. package/dist/src/checks/runner.js.map +1 -0
  47. package/dist/src/checks/task-sync.d.ts +10 -0
  48. package/dist/src/checks/task-sync.js +41 -0
  49. package/dist/src/checks/task-sync.js.map +1 -0
  50. package/dist/src/checks/worker.d.ts +1 -0
  51. package/dist/src/checks/worker.js +154 -0
  52. package/dist/src/checks/worker.js.map +1 -0
  53. package/dist/src/cli-actions.d.ts +2 -2
  54. package/dist/src/cli-actions.js +3 -15
  55. package/dist/src/cli-actions.js.map +1 -1
  56. package/dist/src/cli.js +14 -98
  57. package/dist/src/cli.js.map +1 -1
  58. package/dist/src/contracts.d.ts +35 -32
  59. package/dist/src/dependency-provenance.d.ts +2 -2
  60. package/dist/src/dependency-provenance.js +12 -69
  61. package/dist/src/dependency-provenance.js.map +1 -1
  62. package/dist/src/domain/base-sync-conflict.d.ts +13 -0
  63. package/dist/src/domain/base-sync-conflict.js +32 -0
  64. package/dist/src/domain/base-sync-conflict.js.map +1 -0
  65. package/dist/src/domain/step-start-admission.d.ts +4 -0
  66. package/dist/src/domain/step-start-admission.js +9 -0
  67. package/dist/src/domain/step-start-admission.js.map +1 -0
  68. package/dist/src/domain/virgin-registration.d.ts +3 -0
  69. package/dist/src/domain/virgin-registration.js +65 -0
  70. package/dist/src/domain/virgin-registration.js.map +1 -0
  71. package/dist/src/errors.d.ts +1 -1
  72. package/dist/src/errors.js.map +1 -1
  73. package/dist/src/gateway-handshake.js +0 -8
  74. package/dist/src/gateway-handshake.js.map +1 -1
  75. package/dist/src/git.d.ts +3 -1
  76. package/dist/src/git.js +41 -14
  77. package/dist/src/git.js.map +1 -1
  78. package/dist/src/graph.js +25 -3
  79. package/dist/src/graph.js.map +1 -1
  80. package/dist/src/index.d.ts +1 -0
  81. package/dist/src/lifecycle/corrective-replan.js +3 -3
  82. package/dist/src/lifecycle/corrective-replan.js.map +1 -1
  83. package/dist/src/navigation-actions.d.ts +9 -0
  84. package/dist/src/navigation-actions.js +72 -0
  85. package/dist/src/navigation-actions.js.map +1 -0
  86. package/dist/src/navigation-update-artifact.d.ts +5 -0
  87. package/dist/src/navigation-update-artifact.js +227 -0
  88. package/dist/src/navigation-update-artifact.js.map +1 -0
  89. package/dist/src/navigation-update.d.ts +39 -0
  90. package/dist/src/navigation-update.js +82 -0
  91. package/dist/src/navigation-update.js.map +1 -0
  92. package/dist/src/observation.js +52 -29
  93. package/dist/src/observation.js.map +1 -1
  94. package/dist/src/observed-routes.js +5 -6
  95. package/dist/src/observed-routes.js.map +1 -1
  96. package/dist/src/pending-review-update.d.ts +0 -13
  97. package/dist/src/pending-review-update.js +1 -6
  98. package/dist/src/pending-review-update.js.map +1 -1
  99. package/dist/src/reviewer.d.ts +1 -1
  100. package/dist/src/reviewer.js +20 -17
  101. package/dist/src/reviewer.js.map +1 -1
  102. package/dist/src/runtime.d.ts +3 -0
  103. package/dist/src/runtime.js +6 -0
  104. package/dist/src/runtime.js.map +1 -0
  105. package/dist/src/state/corrective-replan-executor.d.ts +10 -0
  106. package/dist/src/state/corrective-replan-executor.js +37 -1
  107. package/dist/src/state/corrective-replan-executor.js.map +1 -1
  108. package/dist/src/state/corrective-replan-public-schema.js +15 -2
  109. package/dist/src/state/corrective-replan-public-schema.js.map +1 -1
  110. package/dist/src/state/corrective-replan-public.js +6 -5
  111. package/dist/src/state/corrective-replan-public.js.map +1 -1
  112. package/dist/src/state/corrective-replan-transaction.d.ts +1 -0
  113. package/dist/src/state/corrective-replan-transaction.js +12 -11
  114. package/dist/src/state/corrective-replan-transaction.js.map +1 -1
  115. package/dist/src/state/corrective-yield-executor.js +2 -2
  116. package/dist/src/state/corrective-yield-executor.js.map +1 -1
  117. package/dist/src/state/corrective-yield-transaction.d.ts +1 -0
  118. package/dist/src/state/corrective-yield-transaction.js +11 -10
  119. package/dist/src/state/corrective-yield-transaction.js.map +1 -1
  120. package/dist/src/state/lock.d.ts +4 -0
  121. package/dist/src/state/lock.js +21 -0
  122. package/dist/src/state/lock.js.map +1 -1
  123. package/dist/src/version.d.ts +1 -1
  124. package/dist/src/version.js +1 -1
  125. package/dist/src/version.js.map +1 -1
  126. package/dist/src/workflow-blocker-route.d.ts +8 -0
  127. package/dist/src/workflow-blocker-route.js +106 -0
  128. package/dist/src/workflow-blocker-route.js.map +1 -0
  129. package/dist/src/workflow.d.ts +48 -63
  130. package/dist/src/workflow.js +698 -1470
  131. package/dist/src/workflow.js.map +1 -1
  132. package/docs/autonomy-guardrails.md +26 -304
  133. package/docs/decisions.md +14 -112
  134. package/docs/development-flow.md +35 -238
  135. package/docs/project-memory.md +31 -50
  136. package/docs/release-app-evidence.md +190 -0
  137. package/docs/release.md +95 -363
  138. package/docs/updating-existing-project.md +19 -717
  139. package/package.json +11 -13
  140. package/plugins/codex-workflow-gateway/.codex-plugin/plugin.json +2 -2
  141. package/plugins/codex-workflow-gateway/references/chat-dispatch.md +73 -197
  142. package/plugins/codex-workflow-gateway/references/codebase-memory-routing.md +57 -0
  143. package/plugins/codex-workflow-gateway/references/protocol.md +42 -445
  144. package/plugins/codex-workflow-gateway/scripts/chat-dispatch.mjs +7 -1
  145. package/plugins/codex-workflow-gateway/scripts/chat-model-policy.mjs +10 -8
  146. package/plugins/codex-workflow-gateway/scripts/chat-registry.mjs +23 -5
  147. package/plugins/codex-workflow-gateway/skills/codex-workflow-gateway/SKILL.md +66 -740
  148. package/references/state-machine.md +4 -4
  149. package/roles/technical-planner.md +1 -1
  150. package/schemas/corrective-decision-event.schema.json +3 -1
  151. package/schemas/project-knowledge-map.schema.json +3 -1
  152. package/schemas/remediation-event.schema.json +10 -1
  153. package/schemas/task.schema.json +46 -2
  154. package/schemas/transition-payloads.schema.json +16 -1
  155. package/src/alpha6/adoption.ts +1123 -0
  156. package/src/alpha6/captured-check-evidence.ts +132 -0
  157. package/src/alpha6/check-support-anchor.ts +128 -0
  158. package/src/alpha6/component-owner.ts +168 -0
  159. package/src/alpha6/corrective-decision-boundary.ts +39 -0
  160. package/src/alpha6/downstream-proof.ts +520 -0
  161. package/src/alpha6/failed-step-planning-recovery.ts +88 -0
  162. package/src/alpha6/handoff.ts +1443 -0
  163. package/src/alpha6/journal.ts +473 -0
  164. package/src/alpha6/literal-test-invocation.ts +84 -0
  165. package/src/alpha6/mechanical-feasibility.ts +488 -0
  166. package/src/alpha6/milestone.ts +2192 -0
  167. package/src/alpha6/navigation-dirty-carryover.ts +154 -0
  168. package/src/alpha6/npm-check-contract.ts +47 -0
  169. package/src/alpha6/plan-integrity.ts +298 -0
  170. package/src/alpha6/plan-risk.ts +1480 -0
  171. package/src/alpha6/preexecution-replan.ts +187 -0
  172. package/src/alpha6/remediation-cause.ts +98 -0
  173. package/src/alpha6/remediation.ts +2438 -0
  174. package/src/alpha6/review.ts +1198 -0
  175. package/src/alpha6/root-cause-replan-carryover.ts +491 -0
  176. package/src/alpha6/store-sidecars.ts +335 -0
  177. package/src/alpha7/autonomy.ts +411 -0
  178. package/src/alpha7/corrective-recovery.ts +1332 -0
  179. package/src/artifacts.ts +130 -0
  180. package/src/beta1/project-transaction.ts +355 -0
  181. package/src/change-explanation.ts +153 -0
  182. package/src/checks/runner.ts +245 -0
  183. package/src/checks/task-sync.ts +41 -0
  184. package/src/checks/worker.ts +149 -0
  185. package/src/cli-actions.ts +107 -0
  186. package/src/cli.ts +1457 -0
  187. package/src/contracts.ts +1494 -0
  188. package/src/credential-output.ts +89 -0
  189. package/src/credential-transport.ts +215 -0
  190. package/src/delegation.ts +190 -0
  191. package/src/dependency-provenance.ts +472 -0
  192. package/src/diagnostics.ts +93 -0
  193. package/src/domain/base-sync-conflict.ts +35 -0
  194. package/src/domain/completed-step-carryover.ts +76 -0
  195. package/src/domain/discovery.ts +27 -0
  196. package/src/domain/plan-semantics.ts +58 -0
  197. package/src/domain/step-start-admission.ts +10 -0
  198. package/src/domain/validation.ts +177 -0
  199. package/src/domain/virgin-registration.ts +46 -0
  200. package/src/errors.ts +24 -0
  201. package/src/fs-utils.ts +61 -0
  202. package/src/gateway-handshake.ts +95 -0
  203. package/src/git.ts +183 -0
  204. package/src/graph.ts +342 -0
  205. package/src/historical-step-provenance.ts +136 -0
  206. package/src/index.ts +23 -0
  207. package/src/lifecycle/canonical-hash.ts +28 -0
  208. package/src/lifecycle/catalog.ts +202 -0
  209. package/src/lifecycle/compiler-inspection.ts +29 -0
  210. package/src/lifecycle/core-static-readiness.ts +132 -0
  211. package/src/lifecycle/corrective-replan-authority.ts +136 -0
  212. package/src/lifecycle/corrective-replan-binding-manifest.ts +51 -0
  213. package/src/lifecycle/corrective-replan-credential-core.ts +408 -0
  214. package/src/lifecycle/corrective-replan-credential-schema.ts +54 -0
  215. package/src/lifecycle/corrective-replan-credentials.ts +48 -0
  216. package/src/lifecycle/corrective-replan.ts +843 -0
  217. package/src/lifecycle/evaluator.ts +48 -0
  218. package/src/lifecycle/fingerprint.ts +488 -0
  219. package/src/lifecycle/immutable.ts +8 -0
  220. package/src/lifecycle/implementation-table.ts +118 -0
  221. package/src/lifecycle/index.ts +8 -0
  222. package/src/lifecycle/schema-artifact.ts +263 -0
  223. package/src/lifecycle/semantic-registry.ts +572 -0
  224. package/src/lifecycle/types.ts +838 -0
  225. package/src/memory.ts +273 -0
  226. package/src/migration.ts +161 -0
  227. package/src/navigation-actions.ts +70 -0
  228. package/src/navigation-update-artifact.ts +198 -0
  229. package/src/navigation-update.ts +121 -0
  230. package/src/observation.ts +225 -0
  231. package/src/observed-routes.ts +660 -0
  232. package/src/operational-contract.ts +125 -0
  233. package/src/pending-review-update.ts +175 -0
  234. package/src/repository.ts +99 -0
  235. package/src/reviewer.ts +1879 -0
  236. package/src/runtime.ts +6 -0
  237. package/src/state/corrective-replan-executor.ts +818 -0
  238. package/src/state/corrective-replan-public-schema.ts +83 -0
  239. package/src/state/corrective-replan-public.ts +908 -0
  240. package/src/state/corrective-replan-transaction.ts +949 -0
  241. package/src/state/corrective-yield-executor.ts +327 -0
  242. package/src/state/corrective-yield-transaction.ts +730 -0
  243. package/src/state/lock.ts +902 -0
  244. package/src/state/store.ts +567 -0
  245. package/src/transition-core.ts +330 -0
  246. package/src/ulid.ts +24 -0
  247. package/src/version.ts +2 -0
  248. package/src/workflow-blocker-route.ts +109 -0
  249. package/src/workflow.ts +10172 -0
  250. package/docs/alpha7.1-implementation-brief.md +0 -268
  251. package/docs/alpha7.2-corrective-context-refresh-brief.md +0 -484
  252. package/docs/alpha7.2.1-remediation-recovery-brief.md +0 -86
  253. package/docs/beta1-stabilization-brief.md +0 -165
  254. package/docs/beta11-plan-integrity-recovery-brief.md +0 -38
  255. package/docs/beta13.2-signal-review-recovery.md +0 -38
  256. package/docs/beta2-initial-assembly-navigation-brief.md +0 -616
  257. package/docs/change-model.md +0 -118
  258. package/docs/delegated-approval.md +0 -254
  259. package/docs/lifecycle/state-machine-stabilization.md +0 -641
  260. package/docs/pdf/README.md +0 -24
  261. package/docs/pdf/codex-workflow-v2-architecture-ru.pdf +0 -0
  262. package/docs/pdf/codex-workflow-v2-chat-only-guide-ru.pdf +0 -0
  263. package/docs/pdf/codex-workflow-v2-technical-reference-ru.pdf +0 -0
  264. package/docs/pdf/requirements.txt +0 -1
  265. package/docs/pdf/sources/codex-workflow-v2-architecture-ru.md +0 -478
  266. package/docs/pdf/sources/codex-workflow-v2-chat-only-guide-ru.md +0 -508
  267. package/docs/pdf/sources/codex-workflow-v2-technical-reference-ru.md +0 -778
  268. package/docs/pending-review-update.md +0 -15
  269. package/docs/problem-briefs/01-pre-implementation-integrity.md +0 -482
  270. package/docs/problem-briefs/02-minimal-step-integrity.md +0 -411
  271. package/docs/problem-briefs/03-minimal-agent-context-integrity.md +0 -358
  272. package/docs/problem-briefs/04-task-dependency-and-structural-replacement-integrity.md +0 -573
  273. package/docs/problem-briefs/BRIEF-TEMPLATE.md +0 -56
  274. package/docs/problem-briefs/README.md +0 -120
  275. package/docs/problem-briefs/evidence/p01-mechanical-feasibility-corpus.md +0 -90
  276. package/docs/problem-briefs/evidence/signal-v4-pre-m3-replay.md +0 -246
  277. package/docs/split-required-recovery.md +0 -47
  278. package/docs/stable-release-defect-register.md +0 -730
  279. package/docs/validation-report.md +0 -182
  280. package/scripts/generate-pdf-docs.py +0 -524
  281. package/scripts/run-pdf-docs.mjs +0 -62
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-workflow-v2",
3
- "version": "2.0.0-beta.13.8",
3
+ "version": "2.0.0-beta.14",
4
4
  "description": "Requirements-first Codex development workflow with local state and explicit Git ownership.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "access": "public"
17
17
  },
18
18
  "engines": {
19
- "node": ">=22"
19
+ "node": "24.17.0"
20
20
  },
21
21
  "bin": {
22
22
  "codex-workflow": "dist/src/cli.js"
@@ -28,36 +28,35 @@
28
28
  },
29
29
  "files": [
30
30
  "dist",
31
+ "src",
31
32
  "schemas",
32
33
  "templates",
33
34
  "roles",
34
35
  "references",
35
36
  "plugins",
36
37
  "docs/*.md",
37
- "docs/lifecycle",
38
- "docs/pdf",
39
- "docs/problem-briefs",
40
- "scripts/generate-pdf-docs.py",
41
- "scripts/run-pdf-docs.mjs",
42
38
  "README.md"
43
39
  ],
44
40
  "scripts": {
45
41
  "clean": "node --eval \"import('node:fs').then(({rmSync}) => { rmSync('dist', {recursive:true, force:true}); rmSync('.test-dist', {recursive:true, force:true}); })\"",
46
- "build": "npm run clean && tsc -p tsconfig.build.json && node scripts/mark-cli-executable.mjs",
42
+ "build": "node scripts/with-validation-lock.mjs build",
47
43
  "typecheck": "tsc -p tsconfig.json --noEmit",
48
44
  "test": "node scripts/with-validation-lock.mjs test",
49
45
  "test:signal-t04-recovery": "node scripts/with-validation-lock.mjs test-signal-t04",
50
46
  "test:signal-t03-replan-e2e": "node scripts/with-validation-lock.mjs test-signal-t03-replan",
51
47
  "test:signal-remediation-e2e": "node scripts/with-validation-lock.mjs test-signal-remediation-topology",
52
48
  "test:signal-t10-check-support-e2e": "node scripts/with-validation-lock.mjs test-signal-t10-check-support",
53
- "validate": "npm run typecheck && npm test",
54
- "pack:check": "npm run build && npm pack --dry-run",
55
- "smoke:downstream": "npm run build && node scripts/downstream-smoke.mjs",
49
+ "validate": "node scripts/with-validation-lock.mjs validate",
50
+ "pack:check": "node scripts/with-validation-lock.mjs pack",
51
+ "smoke:downstream": "node scripts/with-validation-lock.mjs smoke",
56
52
  "plugin:check": "node scripts/validate-plugin.mjs",
57
53
  "docs:pdf": "node scripts/run-pdf-docs.mjs",
58
54
  "docs:pdf:check": "node scripts/run-pdf-docs.mjs --check",
59
55
  "release:check": "node scripts/release-check.mjs",
60
- "publish:release": "node scripts/publish.mjs"
56
+ "publish:release": "node scripts/publish.mjs",
57
+ "release:verify": "node scripts/release-passport.mjs verify",
58
+ "release:passport": "node scripts/release-passport.mjs attach",
59
+ "prepublishOnly": "node scripts/block-direct-publish.mjs"
61
60
  },
62
61
  "dependencies": {
63
62
  "ajv": "8.20.0",
@@ -68,7 +67,6 @@
68
67
  },
69
68
  "devDependencies": {
70
69
  "@types/node": "24.10.1",
71
- "codex-workflow-source-beta136": "npm:codex-workflow-v2@2.0.0-beta.13.6",
72
70
  "typescript": "5.9.3"
73
71
  },
74
72
  "license": "MIT"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-workflow-gateway",
3
- "version": "0.1.0+codex.20260830183000",
3
+ "version": "0.1.0+codex.20260910143746",
4
4
  "description": "Thin personal Codex gateway for exact project-local Codex Workflow V2 packages and codebase-memory-mcp.",
5
5
  "author": {
6
6
  "name": "Codex Workflow Maintainers"
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "defaultPrompt": [
26
26
  "Show the next valid Codex Workflow V2 action.",
27
- "Refresh the project code graph for planning.",
27
+ "Check the installed workflow graph.",
28
28
  "Check project memory and workflow readiness."
29
29
  ],
30
30
  "brandColor": "#2563EB"
@@ -1,204 +1,80 @@
1
- # Durable App dispatch and explicit model selection
1
+ # Authorized App dispatch
2
2
 
3
- This is an App orchestration journal, not Workflow authority. It does not call the App, approve
4
- Git writes, renew grants, mint credentials, or replace Core status/next. All commands below use
5
- `node <exact-package>/plugins/codex-workflow-gateway/scripts/chat-registry.mjs` and the existing
6
- 24-hex Workflow `--project-id`. The App project ID is a separate field.
3
+ Use the exact package's `scripts/chat-registry.mjs` under this plugin for reservations, titles,
4
+ creation receipts and supervision. Workflow `projectId` and App `appProjectId` are distinct.
5
+ The journal supplies routing evidence; it grants no App, Git, credential or approval authority.
6
+ Use the script's command contract for arguments rather than reimplementing title/model logic.
7
7
 
8
- ## One reservation, one creation attempt
9
-
10
- `allocate` reuses the same non-abandoned role/entity/membership/attempt reservation. Task and
11
- Coordinator allocations also reuse it when a caller changes the attempt number. Review attempts
12
- advance only after the actual Workflow review cycle advances. Never invent a new attempt or
13
- reservation to bypass unresolved creation. Existing v1 registries remain readable; legacy bound
14
- threads remain usable with explicit model/thinking arguments from the same policy; `model-select`
15
- and `supervision-record` currently require a tracked dispatch and do not retrofit legacy evidence.
16
- Legacy unbound reservations may have already created a chat: reconcile
17
- those using real App/source evidence before using the new dispatch flow.
18
-
19
- 1. Save the closed context packet to a private local file. Do not include bearer credentials,
20
- parent transcript, or approval narratives. Prepare a private dispatch request JSON:
21
-
22
- ```json
23
- {
24
- "repositoryRoot": "/absolute/canonical/repository",
25
- "appProjectId": "project-id-from-list-projects",
26
- "hostId": "local",
27
- "promptFile": "/private/tmp/task-context.txt",
28
- "modelRequest": {
29
- "phase": "planning",
30
- "complexity": "standard",
31
- "highRisk": false,
32
- "rationale": "New multi-file implementation plan with established requirements.",
33
- "availableModels": [
34
- {"id": "gpt-5.6-sol", "reasoningEfforts": ["low", "medium", "high", "xhigh", "max", "ultra"]}
35
- ]
36
- }
37
- }
38
- ```
39
-
40
- Populate `availableModels` from the destination App tool's actual model/effort contract, not
41
- this example, the parent's settings, API pricing pages, or a guessed alias. Explicit user
42
- authorization to select models is required; journal input is not user authorization.
43
- 2. Run `dispatch-begin --reservation-id ID --file request.json` **before** `create_thread`.
44
- Save its complete output to a mode-600 file. It atomically persists a creation marker, packet
45
- hashes, repository binding and requested model selection, then returns `createAllowed:true`
46
- and exact `createArgs` including `model` and App field `thinking`.
47
- 3. Only the process receiving that one permission may make **one** `create_thread(createArgs)`
48
- call. A second begin, even after restart or timeout, returns `createAllowed:false` and no
49
- create arguments. Do not reissue the external call after a lost/ambiguous response. The marker
50
- prepended to the packet is routing provenance, not parent history.
51
- 4. Save the full App result locally, normalize its successful tool text JSON to
52
- `{"result":{"clientThreadId":"client-new-thread:...","hostId":"local"}}` or
53
- `{"result":{"threadId":"actual-uuid","hostId":"local"}}`, and run `dispatch-result`.
54
- Preserve raw evidence separately. Never parse truncated displayed stdout as the full receipt.
55
- Invalid JSON cannot change the journal. A pending client ID is never a usable thread ID.
56
- 5. Use `dispatch-status` to resume. Missing `list_threads` results are not proof of failure.
57
- If the actual ID is unavailable, identify candidate rollout files from creation-time/worktree
58
- evidence and run `dispatch-discover --file candidates.json`, where the file is
59
- `{"sessionFiles":["/absolute/rollout.jsonl"]}`. The helper reads only supplied files, checks
60
- actual session metadata, exact original dispatched prompt (including the App's routing XML),
61
- and the Git common directory. It ignores guardian/subagent sessions and unrelated prompts.
62
- It prints candidate IDs/paths only, never transcripts or reasoning. Use bounded candidate
63
- lists, not vault searches. Malformed, oversized or partially written files need a later fresh
64
- read; they never authorize another creation.
65
- 6. Confirm a correlated candidate using `read_thread`. Save its full response as
66
- `{"observation": <parsed read_thread JSON>}` and run `dispatch-observe`. It checks actual UUID,
67
- host, repository/worktree and App project when supplied. One candidate still requires App
68
- readback; several candidates produce a duplicate conflict and require explicit disposition,
69
- not arbitrary selection. After confirming one canonical child, inspect every other candidate,
70
- reconcile any work it performed, and archive only idle duplicates. Record
71
- `dispatch-resolve-duplicates` with `canonicalThreadId` and `dispositions`, one object per duplicate:
72
- `{threadId, observation: <read_thread JSON>, archiveResult: {threadId, archived: true}}`.
73
- Preserve the actual archive tool receipt; never fabricate it. Repeat canonical readback and bind.
74
- Candidate history is retained and no creation permit is restored. This is a local evidence
75
- check, not independent App attestation.
76
- 7. Run ordinary title `readback`/rename until exact match. After any rename, repeat
77
- `dispatch-observe` with fresh App readback, then `readback` and `bind`. Binding a tracked
78
- dispatch requires the same actual ID, host and observed title. Rebinding it to another child,
79
- binding a client ID or sharing one child between reservations is rejected.
80
- 8. Run `supervision-record --file report.json` with `threadId`, `ownerThreadId`, `state`
81
- (`active|attention|completed`), `cursor` and `nextAction`. Persist significant wait boundaries;
82
- only that supervisor waits for this child. The journal stores routing state, not a Workflow
83
- verdict. Do not put secrets, CREFs or confirmation codes in it. On restart, read the child and
84
- fresh Core status/next before continuing. Worker reports stay local; the coordinator pulls.
85
-
86
- A crash between durable begin and actual submission is deliberately ambiguous. There is no
87
- App idempotency-key API here, so this provides **at most one create permit per reservation**,
88
- not an exactly-once guarantee. Never clear the marker, abandon it, or expire it by time to retry.
89
- If no positive creation evidence can be found, report that exact unresolved App operation. A
90
- permission denial is a separate real gate; do not reroute it through another chat. Fresh user
91
- approval does not establish that an ambiguous prior creation never happened.
92
-
93
- ## Model matrix
94
-
95
- The versioned policy is `scripts/chat-model-policy.mjs`. It expresses a conservative relative
96
- cost/latency preference, not measured savings or guaranteed account availability:
97
-
98
- | Work | Preferred model | App thinking | Compatible fallback |
99
- | --- | --- | --- | --- |
100
- | Routine mechanical transitions, formatting, retrieval | gpt-5.4-mini | low | gpt-5.6-luna / low |
101
- | Coordinator supervision; small implementation | gpt-5.6-luna | medium | gpt-5.6-terra / medium |
102
- | Standard implementation | gpt-5.6-terra | medium | gpt-5.6-sol / medium |
103
- | Task planning | gpt-5.6-sol | medium | gpt-6-astra / medium |
104
- | Routine Step review | gpt-5.6-terra | medium | gpt-5.6-sol / medium |
105
- | Standard Step review, final review, plan/corrective audit | gpt-5.6-sol | high | gpt-6-astra / high |
106
- | Complex work or high risk, any role | gpt-6-astra | high | gpt-5.6-sol / high |
107
-
108
- `routine` means a small, well-specified change or mechanical action with an existing check;
109
- `standard` is ordinary multi-file work; `complex` covers new architecture, unresolved concurrency,
110
- recovery/provenance or distributed state. Mark `highRisk` for authorization, security-sensitive
111
- paths, data-loss exposure or irreversible migrations. The coordinator records the concrete
112
- rationale; classification is a human/agent judgment, not an automatic risk detector. Unknown
113
- complexity is not routine. Review/audit role floors override a falsely mechanical phase. No
114
- automatic xhigh/max/ultra, and no escalation merely because a review failed or a tool timed out.
8
+ ## Closed packets
115
9
 
116
- The policy chooses only a listed supported pair. If neither preferred nor fallback pair is
117
- available, stop selection rather than silently inheriting the coordinator or lowering the review
118
- floor. API docs explain the reasoning/latency tradeoff, while App availability and accepted field
119
- names come from the live App tool contract:
120
- https://developers.openai.com/api/docs/guides/latest-model
10
+ A Task packet contains only canonical repository/package identity; Milestone membership ordinal;
11
+ Task ID/revision/title; objective and requirement/acceptance IDs; Brief/Plan hashes; scope/checks;
12
+ and actors/grant IDs required by fresh routing. Exclude credentials, confirmation codes, parent
13
+ transcripts, reasoning, sibling Plans and approval narratives. A host `codex_delegation` routing
14
+ envelope is acceptable only when its input remains that exact packet.
121
15
 
122
- For a phase change in an existing bound chat, call `model-select` with its same `threadId` and
123
- fresh `modelRequest`; copy the returned `followUpArgs` into `send_message_to_thread` with the
124
- closed follow-up prompt. For example, planning uses Sol/medium, implementation Terra/medium,
125
- then mechanical lifecycle work Mini/low. Do not create another Task just to switch model.
126
- Keep the previous selection unless the phase/risk/scope changes materially. The journal records
127
- requested settings; tool acceptance/runtime readback, when available, is required to claim the
128
- actual model used. A model change never changes role, scope, credentials or approval authority.
16
+ Require startup through repository instructions, local gateway/handshake, `status`, then
17
+ `next --task <exact Task ID>`. Stop if another Task is returned. The task continues through its
18
+ advertised planning/execution/review/merge routes until terminal or a real gate/blocker.
19
+ Its non-secret result report identifies Task revision/status, outcome, next action, user-decision
20
+ need and check/commit/review evidence. The receiver verifies those claims against Core.
129
21
 
130
- ## Execution context before product writes
22
+ Reviewer/auditor packets carry the immutable commit/packet/seal or audit-request and read-only role,
23
+ not Worker history. Verify canonical evidence before reading and before returning a result.
24
+ Read-only review does not require switching a detached checkout to the Task branch. Save a requested
25
+ report only outside repository checkouts under actual permissions; zero-write instructions forbid it.
131
26
 
132
- `dispatch-begin` accepts optional `executionMode: "local" | "worktree"` (default `worktree`).
133
- Choose local only for an explicit user request to execute in the saved checkout. The observed
134
- child checkout, not an absolute path copied from the parent's prompt, is the write destination.
135
- `dispatch-observe` records it and refuses silent movement of a bound child.
136
-
137
- Before the first write, and after any branch/cwd change, use read-only `dispatch-context-check`
138
- with a fresh App observation, `writeRoot`, and `expectedBranch` from the current Core Task.
139
- Require `matched=true`, then refresh Core next and writer authority. Mismatch means reconcile the
140
- same Worker context; it never permits another create, an indirect write or an automatic handoff.
141
- A matched context does not authorize external operations. See packaged `docs/change-model.md`.
142
-
143
- ### Existing legacy bindings
144
-
145
- `dispatch-context-check` also accepts an already bound legacy entry with no dispatch marker.
146
- Supply the exact current Task `repositoryRoot` in addition to the fresh actual Worker observation,
147
- `writeRoot`, and `expectedBranch`. The check verifies the bound thread/host, common Git repository,
148
- actual checkout/write root and Task branch without changing the registry. It reports
149
- `contextBinding=legacy-current-observation` and `historicalCheckoutVerified=false`: no historical
150
- creation marker or checkout provenance is invented. It never enables another create permit.
151
- This observation does not move a chat, authorize a write or reconcile a tracked dispatch whose
152
- previous checkout changed; those remain explicit App/context operations followed by fresh checks.
153
-
154
- ### Explicit App handoff reconciliation
155
-
156
- An App handoff can return a new destination thread ID while retaining the task history.
157
- `bind` still rejects replacing a bound child. After the App operation succeeds, use the
158
- separate `dispatch-handoff-reconcile --reservation-id ... --file ... --project-id ...` route:
159
-
160
- ```json
161
- {
162
- "sourceThreadId": "actual-source-thread-uuid-from-the-handoff-call",
163
- "sourceHostId": "local",
164
- "repositoryRoot": "/absolute/repository-from-fresh-Task",
165
- "expectedBranch": "exact-task-branch",
166
- "receipt": {
167
- "operationId": "actual-operation-id",
168
- "revision": 12,
169
- "status": "success",
170
- "destinationThreadId": "actual-destination-thread-uuid",
171
- "destinationHostId": "local",
172
- "destinationCwd": "/absolute/destination-checkout",
173
- "threadTitle": "exact-current-bound-title"
174
- },
175
- "observation": { "thread": {
176
- "id": "actual-destination-thread-uuid",
177
- "hostId": "local",
178
- "kind": "codex",
179
- "cwd": "/absolute/destination-checkout",
180
- "title": "exact-current-bound-title"
181
- } }
182
- }
183
- ```
184
-
185
- Copy the complete successful `get_handoff_status` receipt, including any extra returned fields,
186
- and obtain a fresh destination `read_thread`. Preserve the source `handoff_thread` tool call:
187
- its source ID is supplied separately because the result need not contain it. Pending, failed,
188
- cancelled or inconsistent results cannot change the registry. The destination must match the
189
- bound title, actual Git repository and current Task branch, and cannot belong to another entry.
190
-
191
- This route changes only the existing reservation's current thread/host and, for tracked dispatch,
192
- current execution context. An append-only `handoffHistory` retains the receipt, source and prior
193
- dispatch snapshot; the original creation marker is never fabricated for legacy entries. Existing
194
- observations and selection history are preserved. A tracked supervisor's old cursor is cleared
195
- so it must observe the destination again. No create permit, grant, Task claim or lifecycle
196
- transition is issued. Ordinary `dispatch-observe` still rejects an unexplained checkout change.
197
- An exact retry of the latest handoff leaves registry bytes unchanged; changed receipts or replay
198
- of a superseded handoff are rejected. Refresh Core status/next and writer authority after handoff.
27
+ ## One reservation, one creation attempt
199
28
 
200
- These caller-supplied App results are coherence evidence, not cryptographic proof of origin or
201
- external write authority. The coordinator must obtain genuine tool results and independently
202
- check retained history and the safe writer boundary. The package does not execute a handoff,
203
- verify arbitrary transcript continuity, or authorize writes merely because reconciliation passes.
204
- Only destinations readable on the checking host with the same Git common directory are supported.
29
+ 1. `allocate` for the exact role/entity/membership/review attempt. Use its title verbatim.
30
+ Reuse the existing matching reservation; neither a new number nor a missing App listing proves
31
+ an earlier creation failed. Review attempt numbers come from the Workflow review cycle.
32
+ 2. Prepare a private request with repositoryRoot, appProjectId, hostId, promptFile and modelRequest.
33
+ Populate the destination's supported models/efforts from its current App tool contract.
34
+ Model overrides require user authorization; policy data does not supply it. When authorized,
35
+ let `scripts/chat-model-policy.mjs` select the pair; do not copy a stale matrix or guess aliases.
36
+ 3. Run `dispatch-begin` before the App call. Only `createAllowed=true` permits one
37
+ `create_thread` using its exact `createArgs`; save the complete receipt privately.
38
+ 4. Record `dispatch-result` from the actual App result. A pending client ID is not a thread ID.
39
+ Resume with `dispatch-status`; after lost/ambiguous results never repeat creation.
40
+ 5. Resolve candidates with genuine App/source evidence. `dispatch-discover` accepts a bounded
41
+ `sessionFiles` list, not a transcript/vault search. Confirm with `read_thread`, then
42
+ `dispatch-observe`. Missing listings are not negative proof. Multiple candidates require
43
+ explicit duplicate disposition with actual readback/archive receipts before binding.
44
+ 6. Use registry `readback`, its returned rename/fallback, fresh observation and `bind` to verify
45
+ exact title, actual thread ID, host and execution context. Never truncate entity IDs or bind
46
+ another child over an existing one. Unresolved evidence stops dispatch, not all diagnosis.
47
+
48
+ This is at most one create permit per reservation, not guaranteed exactly-once App delivery.
49
+ Do not clear, expire or abandon an ambiguous marker to obtain another permit. Source discovery
50
+ ignores guardian/subagent sessions; such sessions are not proof of the requested App creation.
51
+
52
+ ## Execution context and supervision
53
+
54
+ Before a product write and after any branch/cwd change, run `dispatch-context-check` using fresh
55
+ App observation, the actual `writeRoot` and expected Task branch. Require `matched=true`, then
56
+ refresh Core/writer authority. A match does not grant filesystem access. Reconcile the same child
57
+ on mismatch; do not silently write into the canonical checkout or create a replacement chat.
58
+
59
+ Use worktree execution unless the user requests the saved checkout. After an explicit App handoff,
60
+ use `dispatch-handoff-reconcile` with the successful full receipt, original source ID and fresh
61
+ destination readback. Ordinary bind cannot replace a child; reconciliation creates no new permit
62
+ or writer authority. Obtain genuine tool receipts; caller-supplied JSON is not independent proof.
63
+
64
+ Persist one owner, Task-to-thread mapping, cursor and next action with `supervision-record`.
65
+ Use bounded `wait_threads` with `afterCursor`; a timeout does not authorize another writer.
66
+ On attention/completion, read the full child report, then fresh sequential Core `status` and `next`.
67
+ If the same nonterminal Task has a permitted continuation, send it only the fresh route and changed
68
+ bindings. Continue supervising; a finished chat does not implicitly resume its coordinator or
69
+ prove Task completion. On restart reconcile App readback, saved cursors and Core before dispatch.
70
+
71
+ The Task chat supervises its independent reviewers; the Milestone coordinator supervises its Task
72
+ chats. Use fresh `task show` and `milestone progress` for progress, preserving cancelled/replacement
73
+ membership identities. After required Tasks merge, follow Milestone validation and acceptance.
74
+ A user checkpoint or real permission/human/integrity/infrastructure blocker may end supervision;
75
+ report the exact pending Task and route so resumption does not create duplicates.
76
+
77
+ For a material phase change, authorized `model-select` returns settings for the same bound chat.
78
+ It changes neither role nor authority. Keep settings otherwise; do not escalate model or retries
79
+ because a review failed. A workflow incident is a bounded diagnostic packet, not authorization to
80
+ publish or message a patch chat. Obtain the required user authorization before external dispatch.
@@ -0,0 +1,57 @@
1
+ # Workflow codebase-memory routing
2
+
3
+ Knowledge Map records approved project knowledge; `codebase-memory-mcp` indexes code structure.
4
+ Neither an approved source nor a similarly named MCP project establishes the correct code graph.
5
+
6
+ ## Select the exact source
7
+
8
+ | Investigation | Source authority |
9
+ | --- | --- |
10
+ | Installed workflow behavior | Fresh local `graph status --kind workflow --mode full` request's `sourceRoot` |
11
+ | Workflow implementation/release | Exact requested workflow Git checkout, HEAD and dirty state |
12
+
13
+ Match normalized absolute roots against `list_projects[].root_path`. Zero matches requires
14
+ indexing that root; multiple exact matches require resolving ambiguity. Never choose by basename,
15
+ project name or an earlier checkout. Do not index or bind product code through this gateway.
16
+
17
+ Call `index_status`; use full indexing with `persistence: false` when missing or stale. Reuse a
18
+ ready immutable installed-package index whose version/manifest match; do not reindex each chat.
19
+ For source work, check HEAD and changes affecting the queried files, including uncommitted edits.
20
+ Refresh stale evidence or record the exact files absent from the index as fallback evidence.
21
+
22
+ For installed workflow, bind provider evidence through the local Core:
23
+
24
+ 1. Obtain `graph refresh-request --kind workflow --mode full` and retain it unchanged.
25
+ 2. Index/check that exact root; obtain the actual provider project key, counts and observation time.
26
+ 3. Pipe `{ "request": ..., "evidence": ... }` to `graph bind --stdin`, passing the current binding
27
+ revision when present. Evidence copies requestId, rootFingerprint, indexedHead, packageVersion,
28
+ manifestHash and mode from the verified request, with provider `codebase-memory-mcp`, actual
29
+ projectKey, status `ready`, nodeCount, edgeCount and observedAt. Never invent provider evidence.
30
+ 4. If request bindings changed, obtain a new request and evidence before binding.
31
+
32
+ Source development uses its source index directly; it does not create consumer lifecycle state.
33
+
34
+ ## Search and fallback
35
+
36
+ Use architecture, graph search and traces to locate symbols, then fetch selected snippets.
37
+ Narrow broad results before considering filesystem search.
38
+
39
+ Direct filesystem discovery requires a recorded reason: MCP unavailable after a bounded retry,
40
+ index/refresh failure, stale bindings that cannot be refreshed, or an exact new/generated/ignored
41
+ artifact absent from the graph. Record operation, source root and failure; installed use also
42
+ records `graph fallback --kind workflow --mode full --reason ...` when permitted.
43
+ Git status, exact package resolution and specifically named authority artifacts remain ordinary
44
+ filesystem operations. A zero-write instruction forbids index/binding writes too: use existing
45
+ immutable evidence and disclose the resulting freshness limitation.
46
+
47
+ ## Product graph: inactive
48
+
49
+ Product graph indexing is not used by the active workflow. Do not request its refresh or binding.
50
+ Absent or stale product bindings do not gate next, Plans, Knowledge approval or context refresh.
51
+ Existing bindings remain readable through explicit diagnostic commands; they are not Knowledge authority.
52
+ Project Knowledge Map continues to use deterministic repository file scanning and its existing approval contract.
53
+ Keep the Plan schema field `graphUse`; use `not-applicable` for new product Plans. Existing `code-aware`
54
+ values do not require an index or a new Knowledge approval. No product refresh owner or schedule is introduced.
55
+
56
+ The installed-workflow graph indexes the exact installed package. The maintainer graph indexes the
57
+ exact workflow development checkout. Neither is the product graph or a replacement for Knowledge Map.