@kbediako/codex-orchestrator 0.1.38 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/README.md +46 -317
  3. package/bin/codex-orchestrator.js +161 -0
  4. package/codex.orchestrator.json +149 -13
  5. package/dist/bin/codex-orchestrator.js +797 -1154
  6. package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +50 -0
  7. package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +22 -4
  8. package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +3 -3
  9. package/dist/orchestrator/src/cli/adapters/CommandTester.js +2 -2
  10. package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +295 -11
  11. package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
  12. package/dist/orchestrator/src/cli/coStatusCliShell.js +451 -0
  13. package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
  14. package/dist/orchestrator/src/cli/codexCliShell.js +119 -0
  15. package/dist/orchestrator/src/cli/codexDefaultsSetup.js +265 -36
  16. package/dist/orchestrator/src/cli/config/delegationConfig.js +317 -5
  17. package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +2 -3
  18. package/dist/orchestrator/src/cli/config/userConfig.js +28 -13
  19. package/dist/orchestrator/src/cli/control/authenticatedControlRouteGate.js +69 -0
  20. package/dist/orchestrator/src/cli/control/authenticatedRouteComposition.js +267 -0
  21. package/dist/orchestrator/src/cli/control/authenticatedRouteController.js +5 -0
  22. package/dist/orchestrator/src/cli/control/authenticatedRouteDispatcher.js +41 -0
  23. package/dist/orchestrator/src/cli/control/compatibilityIssuePresenter.js +1035 -0
  24. package/dist/orchestrator/src/cli/control/confirmationApproveController.js +62 -0
  25. package/dist/orchestrator/src/cli/control/confirmationCreateController.js +69 -0
  26. package/dist/orchestrator/src/cli/control/confirmationIssueConsumeController.js +43 -0
  27. package/dist/orchestrator/src/cli/control/confirmationListController.js +22 -0
  28. package/dist/orchestrator/src/cli/control/confirmationValidateController.js +58 -0
  29. package/dist/orchestrator/src/cli/control/confirmations.js +25 -3
  30. package/dist/orchestrator/src/cli/control/controlActionCancelConfirmation.js +65 -0
  31. package/dist/orchestrator/src/cli/control/controlActionController.js +77 -0
  32. package/dist/orchestrator/src/cli/control/controlActionControllerSequencing.js +161 -0
  33. package/dist/orchestrator/src/cli/control/controlActionExecution.js +142 -0
  34. package/dist/orchestrator/src/cli/control/controlActionFinalization.js +43 -0
  35. package/dist/orchestrator/src/cli/control/controlActionOutcome.js +60 -0
  36. package/dist/orchestrator/src/cli/control/controlActionPreflight.js +476 -0
  37. package/dist/orchestrator/src/cli/control/controlAuthenticatedRouteHandoff.js +57 -0
  38. package/dist/orchestrator/src/cli/control/controlBootstrapAssembly.js +39 -0
  39. package/dist/orchestrator/src/cli/control/controlBootstrapMetadataPersistence.js +16 -0
  40. package/dist/orchestrator/src/cli/control/controlEventTransport.js +49 -0
  41. package/dist/orchestrator/src/cli/control/controlExpiryLifecycle.js +102 -0
  42. package/dist/orchestrator/src/cli/control/controlHostOwnership.js +480 -0
  43. package/dist/orchestrator/src/cli/control/controlHostSupervision.js +630 -0
  44. package/dist/orchestrator/src/cli/control/controlOversightFacade.js +8 -0
  45. package/dist/orchestrator/src/cli/control/controlOversightReadContract.js +1 -0
  46. package/dist/orchestrator/src/cli/control/controlOversightReadService.js +16 -0
  47. package/dist/orchestrator/src/cli/control/controlOversightUpdateContract.js +1 -0
  48. package/dist/orchestrator/src/cli/control/controlPersistenceFiles.js +6 -0
  49. package/dist/orchestrator/src/cli/control/controlQuestionChildResolution.js +18 -0
  50. package/dist/orchestrator/src/cli/control/controlRequestContext.js +42 -0
  51. package/dist/orchestrator/src/cli/control/controlRequestController.js +9 -0
  52. package/dist/orchestrator/src/cli/control/controlRequestPredispatch.js +17 -0
  53. package/dist/orchestrator/src/cli/control/controlRequestRouteDispatch.js +44 -0
  54. package/dist/orchestrator/src/cli/control/controlRuntime.js +1003 -0
  55. package/dist/orchestrator/src/cli/control/controlServer.js +23 -1456
  56. package/dist/orchestrator/src/cli/control/controlServerAuditAndErrorHelpers.js +115 -0
  57. package/dist/orchestrator/src/cli/control/controlServerAuthenticatedRouteBranch.js +29 -0
  58. package/dist/orchestrator/src/cli/control/controlServerBootstrapLifecycle.js +30 -0
  59. package/dist/orchestrator/src/cli/control/controlServerBootstrapStartSequence.js +21 -0
  60. package/dist/orchestrator/src/cli/control/controlServerOwnedRuntimeLifecycle.js +67 -0
  61. package/dist/orchestrator/src/cli/control/controlServerPublicLifecycle.js +756 -0
  62. package/dist/orchestrator/src/cli/control/controlServerPublicRouteHelpers.js +86 -0
  63. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceLifecycle.js +25 -0
  64. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceStartup.js +18 -0
  65. package/dist/orchestrator/src/cli/control/controlServerRequestBodyHelpers.js +37 -0
  66. package/dist/orchestrator/src/cli/control/controlServerRequestShell.js +40 -0
  67. package/dist/orchestrator/src/cli/control/controlServerRequestShellBinding.js +17 -0
  68. package/dist/orchestrator/src/cli/control/controlServerSeedLoading.js +27 -0
  69. package/dist/orchestrator/src/cli/control/controlServerSeededRuntimeAssembly.js +186 -0
  70. package/dist/orchestrator/src/cli/control/controlServerStartupInputPreparation.js +31 -0
  71. package/dist/orchestrator/src/cli/control/controlServerStartupSequence.js +49 -0
  72. package/dist/orchestrator/src/cli/control/controlState.js +233 -2
  73. package/dist/orchestrator/src/cli/control/controlStatusDashboard.js +1904 -0
  74. package/dist/orchestrator/src/cli/control/controlTelegramBridgeBootstrapLifecycle.js +22 -0
  75. package/dist/orchestrator/src/cli/control/controlTelegramBridgeLifecycle.js +67 -0
  76. package/dist/orchestrator/src/cli/control/controlTelegramBridgeOversightFacadeFactory.js +8 -0
  77. package/dist/orchestrator/src/cli/control/controlTelegramCommandController.js +49 -0
  78. package/dist/orchestrator/src/cli/control/controlTelegramDispatchRead.js +40 -0
  79. package/dist/orchestrator/src/cli/control/controlTelegramPollingController.js +89 -0
  80. package/dist/orchestrator/src/cli/control/controlTelegramProjectionNotificationController.js +29 -0
  81. package/dist/orchestrator/src/cli/control/controlTelegramPushState.js +63 -0
  82. package/dist/orchestrator/src/cli/control/controlTelegramQuestionRead.js +13 -0
  83. package/dist/orchestrator/src/cli/control/controlTelegramReadController.js +216 -0
  84. package/dist/orchestrator/src/cli/control/controlTelegramUpdateHandler.js +63 -0
  85. package/dist/orchestrator/src/cli/control/controlWatcher.js +73 -5
  86. package/dist/orchestrator/src/cli/control/delegationRegisterController.js +35 -0
  87. package/dist/orchestrator/src/cli/control/dynamicToolBridgePolicy.js +139 -0
  88. package/dist/orchestrator/src/cli/control/eventsSseController.js +12 -0
  89. package/dist/orchestrator/src/cli/control/linearBudgetState.js +1789 -0
  90. package/dist/orchestrator/src/cli/control/linearDispatchSource.js +1137 -0
  91. package/dist/orchestrator/src/cli/control/linearGraphqlClient.js +150 -0
  92. package/dist/orchestrator/src/cli/control/linearRateLimit.js +102 -0
  93. package/dist/orchestrator/src/cli/control/linearWebhookController.js +499 -0
  94. package/dist/orchestrator/src/cli/control/liveLinearAdvisoryRuntime.js +70 -0
  95. package/dist/orchestrator/src/cli/control/observabilityApiController.js +173 -0
  96. package/dist/orchestrator/src/cli/control/observabilityReadModel.js +500 -0
  97. package/dist/orchestrator/src/cli/control/observabilitySurface.js +284 -0
  98. package/dist/orchestrator/src/cli/control/observabilityUpdateNotifier.js +22 -0
  99. package/dist/orchestrator/src/cli/control/operatorDashboardPresenter.js +252 -0
  100. package/dist/orchestrator/src/cli/control/providerAgentCapacity.js +70 -0
  101. package/dist/orchestrator/src/cli/control/providerControlHostFreshnessGauge.js +1068 -0
  102. package/dist/orchestrator/src/cli/control/providerIntakeState.js +473 -0
  103. package/dist/orchestrator/src/cli/control/providerIssueHandoff.js +6811 -0
  104. package/dist/orchestrator/src/cli/control/providerIssueObservability.js +1348 -0
  105. package/dist/orchestrator/src/cli/control/providerIssueRetryQueue.js +84 -0
  106. package/dist/orchestrator/src/cli/control/providerLinearRuntimeProof.js +588 -0
  107. package/dist/orchestrator/src/cli/control/providerLinearScreenshotProof.js +473 -0
  108. package/dist/orchestrator/src/cli/control/providerLinearWorkerTruth.js +383 -0
  109. package/dist/orchestrator/src/cli/control/providerLinearWorkflowAudit.js +254 -0
  110. package/dist/orchestrator/src/cli/control/providerLinearWorkflowFacade.js +5573 -0
  111. package/dist/orchestrator/src/cli/control/providerLinearWorkflowStates.js +115 -0
  112. package/dist/orchestrator/src/cli/control/providerMergeCloseout.js +1868 -0
  113. package/dist/orchestrator/src/cli/control/providerOperatorAutopilot.js +1580 -0
  114. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLifecycle.js +154 -0
  115. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLocalRolloutExecution.js +1006 -0
  116. package/dist/orchestrator/src/cli/control/providerPollingHealth.js +435 -0
  117. package/dist/orchestrator/src/cli/control/providerTerminalCleanup.js +516 -0
  118. package/dist/orchestrator/src/cli/control/providerWorkerHosts.js +191 -0
  119. package/dist/orchestrator/src/cli/control/providerWorkflowConfigStore.js +515 -0
  120. package/dist/orchestrator/src/cli/control/questionChildResolutionAdapter.js +361 -0
  121. package/dist/orchestrator/src/cli/control/questionQueueController.js +181 -0
  122. package/dist/orchestrator/src/cli/control/questionReadRetryDeduplication.js +9 -0
  123. package/dist/orchestrator/src/cli/control/questionReadSequence.js +10 -0
  124. package/dist/orchestrator/src/cli/control/securityViolationController.js +27 -0
  125. package/dist/orchestrator/src/cli/control/selectedRunProjection.js +1885 -0
  126. package/dist/orchestrator/src/cli/control/telegramOversightApiClient.js +48 -0
  127. package/dist/orchestrator/src/cli/control/telegramOversightBridge.js +180 -0
  128. package/dist/orchestrator/src/cli/control/telegramOversightBridgeProjectionDeliveryQueue.js +25 -0
  129. package/dist/orchestrator/src/cli/control/telegramOversightBridgeRuntimeLifecycle.js +45 -0
  130. package/dist/orchestrator/src/cli/control/telegramOversightBridgeStateStore.js +77 -0
  131. package/dist/orchestrator/src/cli/control/telegramOversightControlActionApiClient.js +45 -0
  132. package/dist/orchestrator/src/cli/control/trackerDispatchPilot.js +439 -0
  133. package/dist/orchestrator/src/cli/control/uiDataController.js +34 -0
  134. package/dist/orchestrator/src/cli/control/uiSessionController.js +100 -0
  135. package/dist/orchestrator/src/cli/controlHostCliShell.js +860 -0
  136. package/dist/orchestrator/src/cli/controlHostFreshnessGaugeCliShell.js +129 -0
  137. package/dist/orchestrator/src/cli/controlHostSupervisionCliShell.js +2127 -0
  138. package/dist/orchestrator/src/cli/delegationCliShell.js +62 -0
  139. package/dist/orchestrator/src/cli/delegationServer.js +567 -678
  140. package/dist/orchestrator/src/cli/delegationServerCliShell.js +52 -0
  141. package/dist/orchestrator/src/cli/delegationServerQuestionFlowShell.js +228 -0
  142. package/dist/orchestrator/src/cli/delegationServerToolDispatchShell.js +411 -0
  143. package/dist/orchestrator/src/cli/delegationServerTransport.js +274 -0
  144. package/dist/orchestrator/src/cli/delegationSetup.js +51 -171
  145. package/dist/orchestrator/src/cli/devtoolsCliShell.js +34 -0
  146. package/dist/orchestrator/src/cli/doctor.js +678 -164
  147. package/dist/orchestrator/src/cli/doctorCliRequestShell.js +72 -0
  148. package/dist/orchestrator/src/cli/doctorCliShell.js +138 -0
  149. package/dist/orchestrator/src/cli/doctorUsage.js +119 -15
  150. package/dist/orchestrator/src/cli/exec/experience.js +16 -2
  151. package/dist/orchestrator/src/cli/exec/summary.js +3 -0
  152. package/dist/orchestrator/src/cli/execCliShell.js +51 -0
  153. package/dist/orchestrator/src/cli/flowCliRequestShell.js +44 -0
  154. package/dist/orchestrator/src/cli/flowCliShell.js +239 -0
  155. package/dist/orchestrator/src/cli/frontendTestCliRequestShell.js +80 -0
  156. package/dist/orchestrator/src/cli/frontendTestCliShell.js +41 -0
  157. package/dist/orchestrator/src/cli/init.js +95 -1
  158. package/dist/orchestrator/src/cli/initCliShell.js +50 -0
  159. package/dist/orchestrator/src/cli/linearCliShell.js +1200 -0
  160. package/dist/orchestrator/src/cli/mcpEnableCliShell.js +132 -0
  161. package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +3 -2
  162. package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +56 -0
  163. package/dist/orchestrator/src/cli/orchestrator.js +66 -1376
  164. package/dist/orchestrator/src/cli/planCliShell.js +19 -0
  165. package/dist/orchestrator/src/cli/prCliShell.js +41 -0
  166. package/dist/orchestrator/src/cli/providerLinearChildLanePhaseContract.js +204 -0
  167. package/dist/orchestrator/src/cli/providerLinearChildLaneRunner.js +1835 -0
  168. package/dist/orchestrator/src/cli/providerLinearChildLaneShell.js +2420 -0
  169. package/dist/orchestrator/src/cli/providerLinearChildStreamShell.js +385 -0
  170. package/dist/orchestrator/src/cli/providerLinearWorkerRunner.js +6834 -0
  171. package/dist/orchestrator/src/cli/resumeCliShell.js +14 -0
  172. package/dist/orchestrator/src/cli/reviewCliLaunchShell.js +72 -0
  173. package/dist/orchestrator/src/cli/rlm/alignment.js +3 -3
  174. package/dist/orchestrator/src/cli/rlm/context.js +94 -7
  175. package/dist/orchestrator/src/cli/rlm/rlmCodexRuntimeShell.js +546 -0
  176. package/dist/orchestrator/src/cli/rlm/symbolic.js +4 -2
  177. package/dist/orchestrator/src/cli/rlmCliRequestShell.js +42 -0
  178. package/dist/orchestrator/src/cli/rlmCompletionCliShell.js +46 -0
  179. package/dist/orchestrator/src/cli/rlmLaunchCliShell.js +51 -0
  180. package/dist/orchestrator/src/cli/rlmRunner.js +83 -523
  181. package/dist/orchestrator/src/cli/run/blockMemory.js +500 -0
  182. package/dist/orchestrator/src/cli/run/manifest.js +410 -73
  183. package/dist/orchestrator/src/cli/run/manifestPersister.js +45 -14
  184. package/dist/orchestrator/src/cli/run/runMemoryController.js +216 -0
  185. package/dist/orchestrator/src/cli/run/source0.js +690 -0
  186. package/dist/orchestrator/src/cli/run/workspacePath.js +101 -0
  187. package/dist/orchestrator/src/cli/runtime/mode.js +2 -1
  188. package/dist/orchestrator/src/cli/runtime/provider.js +39 -2
  189. package/dist/orchestrator/src/cli/selfCheckCliShell.js +12 -0
  190. package/dist/orchestrator/src/cli/services/commandRunner.js +698 -18
  191. package/dist/orchestrator/src/cli/services/execRuntime.js +66 -1
  192. package/dist/orchestrator/src/cli/services/orchestratorAutoScoutEvidenceRecorder.js +71 -0
  193. package/dist/orchestrator/src/cli/services/orchestratorCloudBranchResolution.js +8 -0
  194. package/dist/orchestrator/src/cli/services/orchestratorCloudEnvironmentResolution.js +22 -0
  195. package/dist/orchestrator/src/cli/services/orchestratorCloudExecutionLifecycleShell.js +39 -0
  196. package/dist/orchestrator/src/cli/services/orchestratorCloudPromptBuilder.js +37 -0
  197. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteFallbackContract.js +45 -0
  198. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteShell.js +36 -0
  199. package/dist/orchestrator/src/cli/services/orchestratorCloudTargetExecutor.js +277 -0
  200. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycle.js +98 -0
  201. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycleShell.js +54 -0
  202. package/dist/orchestrator/src/cli/services/orchestratorExecutionLifecycle.js +112 -0
  203. package/dist/orchestrator/src/cli/services/orchestratorExecutionModePolicy.js +27 -0
  204. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteAdapterShell.js +59 -0
  205. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteDecisionShell.js +57 -0
  206. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteState.js +21 -0
  207. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouter.js +2 -0
  208. package/dist/orchestrator/src/cli/services/orchestratorLocalPipelineExecutor.js +149 -0
  209. package/dist/orchestrator/src/cli/services/orchestratorLocalRouteShell.js +63 -0
  210. package/dist/orchestrator/src/cli/services/orchestratorPlanShell.js +54 -0
  211. package/dist/orchestrator/src/cli/services/orchestratorPlanTargetTracker.js +16 -0
  212. package/dist/orchestrator/src/cli/services/orchestratorResumePreparationShell.js +84 -0
  213. package/dist/orchestrator/src/cli/services/orchestratorResumeTokenValidation.js +15 -0
  214. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleCompletion.js +31 -0
  215. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleExecutionRegistration.js +37 -0
  216. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleOrchestrationShell.js +83 -0
  217. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleTaskManagerShell.js +37 -0
  218. package/dist/orchestrator/src/cli/services/orchestratorRuntimeManifestMutation.js +20 -0
  219. package/dist/orchestrator/src/cli/services/orchestratorStartPreparationShell.js +56 -0
  220. package/dist/orchestrator/src/cli/services/orchestratorStatusShell.js +70 -0
  221. package/dist/orchestrator/src/cli/services/pipelineResolver.js +7 -3
  222. package/dist/orchestrator/src/cli/services/plannerMemory.js +119 -0
  223. package/dist/orchestrator/src/cli/services/runPreparation.js +7 -3
  224. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +9 -0
  225. package/dist/orchestrator/src/cli/setupBootstrapShell.js +114 -0
  226. package/dist/orchestrator/src/cli/setupCliShell.js +51 -0
  227. package/dist/orchestrator/src/cli/skillsCliShell.js +56 -0
  228. package/dist/orchestrator/src/cli/startCliRequestShell.js +53 -0
  229. package/dist/orchestrator/src/cli/startCliShell.js +68 -0
  230. package/dist/orchestrator/src/cli/statusCliShell.js +22 -0
  231. package/dist/orchestrator/src/cli/utils/authProvenanceFingerprint.js +27 -0
  232. package/dist/orchestrator/src/cli/utils/cloudPreflight.js +285 -7
  233. package/dist/orchestrator/src/cli/utils/codexFeatures.js +60 -0
  234. package/dist/orchestrator/src/cli/utils/delegationConfigParser.js +250 -0
  235. package/dist/orchestrator/src/cli/utils/delegationMcpHealth.js +1382 -0
  236. package/dist/orchestrator/src/cli/utils/devtools.js +2 -54
  237. package/dist/orchestrator/src/cli/utils/mcpServerEntry.js +53 -0
  238. package/dist/orchestrator/src/cli/utils/packageProgramResolver.js +151 -0
  239. package/dist/orchestrator/src/cli/utils/providerOverrideEnv.js +71 -0
  240. package/dist/orchestrator/src/cli/utils/trailingJsonObject.js +59 -0
  241. package/dist/orchestrator/src/learning/crystalizer.js +2 -2
  242. package/dist/orchestrator/src/manager.js +74 -4
  243. package/dist/orchestrator/src/persistence/ExperienceStore.js +233 -49
  244. package/dist/orchestrator/src/persistence/TaskStateStore.js +6 -6
  245. package/dist/orchestrator/src/persistence/lockFile.js +70 -4
  246. package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +39 -0
  247. package/dist/orchestrator/src/sync/createCloudSyncWorker.js +3 -2
  248. package/dist/orchestrator/src/utils/atomicWrite.js +17 -2
  249. package/dist/packages/orchestrator/src/exec/unified-exec.js +99 -6
  250. package/dist/packages/orchestrator/src/instructions/promptPacks.js +150 -19
  251. package/dist/packages/sdk-node/src/orchestrator.js +137 -13
  252. package/dist/packages/shared/config/designConfig.js +8 -1
  253. package/dist/packages/shared/streams/stdio.js +1 -1
  254. package/dist/scripts/design/pipeline/permit.js +15 -0
  255. package/dist/scripts/lib/docs-catalog.js +399 -0
  256. package/dist/scripts/lib/docs-helpers.js +87 -5
  257. package/dist/scripts/lib/pr-watch-merge.js +1088 -80
  258. package/dist/scripts/lib/provider-run-contract.js +26 -0
  259. package/dist/scripts/lib/review-command-intent-classification.js +532 -0
  260. package/dist/scripts/lib/review-command-probe-classification.js +385 -0
  261. package/dist/scripts/lib/review-execution-boundary-preflight.js +279 -0
  262. package/dist/scripts/lib/review-execution-runtime.js +753 -0
  263. package/dist/scripts/lib/review-execution-state.js +1144 -0
  264. package/dist/scripts/lib/review-execution-telemetry.js +215 -0
  265. package/dist/scripts/lib/review-inspection-target-parsing.js +78 -0
  266. package/dist/scripts/lib/review-launch-attempt.js +601 -0
  267. package/dist/scripts/lib/review-meta-surface-boundary-analysis.js +300 -0
  268. package/dist/scripts/lib/review-meta-surface-normalization.js +746 -0
  269. package/dist/scripts/lib/review-non-interactive-handoff.js +61 -0
  270. package/dist/scripts/lib/review-prompt-context.js +376 -0
  271. package/dist/scripts/lib/review-scope-advisory.js +286 -0
  272. package/dist/scripts/lib/review-scope-paths.js +123 -0
  273. package/dist/scripts/lib/review-shell-command-parser.js +389 -0
  274. package/dist/scripts/lib/review-shell-env-interpreter.js +340 -0
  275. package/dist/scripts/lib/run-manifests.js +192 -36
  276. package/dist/scripts/lib/spark-policy-classifier.js +593 -0
  277. package/dist/scripts/run-review.js +507 -1777
  278. package/docs/README.md +43 -20
  279. package/docs/book/README.md +19 -0
  280. package/docs/book/codex-cli-0124-adoption.md +68 -0
  281. package/docs/book/local-hook-impact.md +73 -0
  282. package/docs/book/operations.md +60 -0
  283. package/docs/book/public-posture.md +34 -0
  284. package/docs/book/setup.md +91 -0
  285. package/docs/book/skills.md +11 -0
  286. package/docs/guides/codex-version-policy.md +104 -0
  287. package/docs/public/downstream-setup.md +113 -0
  288. package/docs/public/provider-onboarding.md +173 -0
  289. package/package.json +23 -10
  290. package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
  291. package/plugins/codex-orchestrator/.mcp.json +13 -0
  292. package/plugins/codex-orchestrator/launcher.mjs +361 -0
  293. package/schemas/manifest.json +411 -0
  294. package/skills/README.md +26 -0
  295. package/skills/collab-subagents-first/SKILL.md +1 -1
  296. package/skills/delegation-usage/DELEGATION_GUIDE.md +30 -12
  297. package/skills/delegation-usage/SKILL.md +25 -14
  298. package/skills/land/SKILL.md +77 -0
  299. package/skills/linear/SKILL.md +255 -0
  300. package/skills/release/SKILL.md +47 -3
  301. package/skills/standalone-review/SKILL.md +6 -1
  302. package/templates/README.md +4 -2
  303. package/templates/codex/.codex/agents/awaiter-high.toml +2 -2
  304. package/templates/codex/.codex/agents/worker-complex.toml +1 -1
  305. package/templates/codex/.codex/config.toml +3 -4
  306. package/templates/codex/.codex/providers/README.md +13 -0
  307. package/templates/codex/.codex/providers/control.example.json +18 -0
  308. package/templates/codex/.codex/providers/provider.env.example +15 -0
  309. package/templates/codex/AGENTS.md +15 -8
  310. package/templates/codex/mcp-client.json +5 -1
  311. package/docs/assets/setup.gif +0 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "codex-orchestrator",
3
+ "interface": {
4
+ "displayName": "Codex Orchestrator"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "codex-orchestrator",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "./plugins/codex-orchestrator"
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_INSTALL"
16
+ },
17
+ "category": "Productivity"
18
+ }
19
+ ]
20
+ }
package/README.md CHANGED
@@ -1,352 +1,81 @@
1
1
  # Codex Orchestrator
2
2
 
3
- ![Setup demo](docs/assets/setup.gif)
3
+ Codex Orchestrator (CO) is a CLI and runtime for Codex-driven pipelines, auditable manifests, delegation workflows, and downstream repo bootstrapping.
4
4
 
5
- Codex Orchestrator is the CLI + runtime that coordinates Codex-driven runs, pipelines, and delegation MCP tooling. The npm release focuses on running pipelines locally, emitting auditable manifests, and hosting the delegation server.
5
+ ## Release Posture
6
6
 
7
- ## Install
8
-
9
- - Global install (recommended for CLI use):
10
- ```bash
11
- npm i -g @kbediako/codex-orchestrator
12
- ```
13
- - After install, use either `codex-orchestrator` or the short alias `codex-orch`:
14
- ```bash
15
- codex-orchestrator --version
16
- ```
17
- - Or run via npx:
18
- ```bash
19
- npx @kbediako/codex-orchestrator --version
20
- ```
21
-
22
- Node.js >= 20 is required.
23
-
24
- ## Quick start
25
-
26
- 1. Run a pipeline with a task id so artifacts are grouped under `.runs/<task-id>/`:
27
- ```bash
28
- codex-orch start diagnostics --format json --task <task-id>
29
- ```
30
- The command prints the `run_id` plus the manifest path under `.runs/<task-id>/cli/<run-id>/manifest.json`.
31
- 2. Watch status:
32
- ```bash
33
- codex-orch status --run <run-id> --watch --interval 10
34
- ```
35
- 3. Resume if needed:
36
- ```bash
37
- codex-orch resume --run <run-id>
38
- ```
39
- > Tip: if you prefer `npx`, replace `codex-orch` with `npx @kbediako/codex-orchestrator`.
40
- > Tip: for multiple commands, you can also `export MCP_RUNNER_TASK_ID=<task-id>` once.
41
-
42
- ## Runtime + Execution Modes
43
-
44
- - Mode semantics are orthogonal:
45
- - `executionMode=mcp|cloud` controls where stages execute.
46
- - `runtimeMode=cli|appserver` controls local runtime provider selection.
47
- - Local default runtime is `appserver`; preserve `--runtime-mode cli` as break-glass.
48
- - `--execution-mode cloud --runtime-mode appserver` is intentionally unsupported and fails fast with actionable errors.
49
- - `js_repl` is enabled by default globally. For deterministic cloud contracts, run explicit feature lanes (`CODEX_CLOUD_ENABLE_FEATURES=js_repl` and separate `CODEX_CLOUD_DISABLE_FEATURES=js_repl` runs). Use `CODEX_CLOUD_DISABLE_FEATURES=js_repl` for task-scoped cloud break-glass; reserve `codex features disable js_repl` for global emergency toggles and re-enable with `codex features enable js_repl`.
50
- - `memories` remains scoped to explicit eval lanes (legacy alias `memory_tool` is compatibility-only).
7
+ This README tracks the current `main` branch. Published-package users should follow the README and docs for the tag or release they installed.
51
8
 
52
- ## Downstream init (recommended)
9
+ - Latest package docs: [GitHub releases](https://github.com/Kbediako/CO/releases/latest)
10
+ - Older `v0.2.0` package docs: [README for `v0.2.0`](https://github.com/Kbediako/CO/blob/v0.2.0/README.md)
11
+ - Detailed source-head docs: [docs/book/README.md](docs/book/README.md)
53
12
 
54
- Use this when you want Codex to drive work inside another repo with the CO defaults.
55
-
56
- 1. Install templates:
57
- ```bash
58
- codex-orchestrator init codex --cwd /path/to/repo
59
- ```
60
- One-shot (templates + optional CO-managed Codex CLI install):
61
- ```bash
62
- codex-orchestrator init codex --codex-cli --yes
63
- ```
64
- This seeds `AGENTS.md`, `mcp-client.json`, and downstream .codex/config.toml + .codex/agents/* role files (sourced from `templates/codex/.codex/*`), plus `codex.orchestrator.json`.
65
- 2. Register the delegation MCP server (one-time per machine):
66
- ```bash
67
- codex mcp add delegation -- codex-orchestrator delegate-server --repo /path/to/repo
68
- ```
69
- 3. Optional (managed/pinned CLI path): set up a CO-managed Codex CLI:
70
- ```bash
71
- codex-orchestrator codex setup
72
- ```
73
- Use this when you want a pinned binary, build-from-source behavior, or a custom fork.
74
- Stock/global `codex` is still the default selection; activate managed binary routing with:
75
- ```bash
76
- export CODEX_CLI_USE_MANAGED=1
77
- ```
78
- 4. Optional (additive global defaults in `~/.codex/config.toml`):
79
- ```bash
80
- codex-orchestrator codex defaults
81
- codex-orchestrator codex defaults --yes
82
- ```
83
- This updates only the CO baseline keys/role wiring and preserves unrelated config entries.
84
- 5. Optional (fast refresh helper for downstream users):
85
- ```bash
86
- scripts/codex-cli-refresh.sh --repo /path/to/codex --align-only
87
- ```
88
- Repo-only helper (not included in npm package). Add `--no-push` when you only want local alignment and do not want to update `origin/main`. To refresh the CO-managed CLI, run a separate command with `--force-rebuild` (without `--align-only`). Set `CODEX_REPO` or `CODEX_CLI_SOURCE` to avoid passing `--repo` each time.
89
-
90
- ## Delegation MCP server
91
-
92
- Run the delegation MCP server over stdio:
93
- ```bash
94
- codex-orchestrator delegate-server --repo /path/to/repo
95
- ```
96
- Optional: add `--mode question_only` to disable `delegate.spawn/pause/cancel`, keeping only `delegate.question.*` + `delegate.status` in the delegate namespace. GitHub tools remain available when GitHub integration is enabled.
13
+ ## Install
97
14
 
98
- Register it with Codex once. Delegation MCP is enabled by default (the only MCP enabled by default). To override the default or re-enable after disabling:
99
15
  ```bash
100
- codex mcp add delegation -- codex-orchestrator delegate-server --repo /path/to/repo
101
- codex -c 'mcp_servers.delegation.enabled=true' ...
102
- ```
103
- `delegate-server` is the canonical name; `delegation-server` is supported as an alias (older docs may use it).
104
-
105
- ## Agent role defaults (recommended)
106
-
107
- Codex built-ins are `default`, `explorer`, `worker`, and `awaiter`. `researcher` is user-defined.
108
- - `spawn_agent` defaults to `default` when `agent_type` is omitted, so always set `agent_type` explicitly.
109
- - Multi-turn loops are supported (`spawn_agent` -> `send_input` -> `wait`/`resume_agent` -> `close_agent`), so subagents can iterate before parent synthesis.
110
- - Keep `fork_context` off by default for bounded subagent streams; set `fork_context=true` only when the subagent must inherit prior thread history.
111
-
112
- In Codex CLI `0.105.0`, built-in `explorer` no longer pins an older model profile; it inherits top-level defaults unless you attach a role `config_file`.
113
- CO now ships this downstream starter config via `init codex` (source template: `templates/codex/.codex/config.toml`; installed as .codex/config.toml in target repos):
114
-
115
- ```toml
116
- model = "gpt-5.3-codex"
117
- model_reasoning_effort = "xhigh"
118
-
119
- [agents]
120
- max_threads = 12
121
- max_depth = 4
122
- max_spawn_depth = 4
123
-
124
- [agents.explorer_fast]
125
- description = "Fast explorer (spark text-only)."
126
- config_file = "./agents/explorer-fast.toml"
127
-
128
- [agents.worker_complex]
129
- description = "Complex worker role."
130
- config_file = "./agents/worker-complex.toml"
131
-
132
- [agents.awaiter]
133
- description = "Awaiter override (keeps awaiter behavior with latest codex/high reasoning)."
134
- config_file = "./agents/awaiter-high.toml"
135
- ```
136
-
137
- ```toml
138
- # .codex/agents/explorer-fast.toml
139
- model = "gpt-5.3-codex-spark"
140
- model_reasoning_effort = "xhigh"
141
- ```
142
-
143
- ```toml
144
- # .codex/agents/worker-complex.toml
145
- model = "gpt-5.3-codex"
146
- model_reasoning_effort = "xhigh"
147
- ```
148
-
149
- `init codex` also writes downstream .codex/agents/awaiter-high.toml from `templates/codex/.codex/agents/awaiter-high.toml` so CO users can keep awaiter semantics while meeting a high-reasoning minimum.
150
-
151
- Caveats:
152
- - `gpt-5.3-codex-spark` is text-only (no image inputs). Keep it for fast search/synthesis.
153
- - Leave `agents.explorer` undefined unless you intentionally want to override built-in explorer behavior.
154
- - Keep RLM/collab built-ins-first by default; add specialist custom roles only when a measured benefit justifies ongoing maintenance.
155
- - `max_threads = 12`, `max_depth = 4`, and `max_spawn_depth = 4` are CO's standard multi-agent baseline.
156
- - Fallbacks are contingency-only: use `8/2/2` on constrained hosts or deterministic high-risk lanes; use `6/1/1` only as break-glass under severe contention.
157
- - Awaiter triage: long waits are expected for long-running jobs; treat it as stuck only after multiple polling windows with no status/progress movement.
158
- - `codex review` delegates with collab tools disabled in review threads; keep review expectations single-agent even when multi-agent is enabled elsewhere.
159
-
160
- Delegation guard profile:
161
- - `CODEX_ORCHESTRATOR_GUARD_PROFILE=auto` (default): strict in CO-style repos, warn in lightweight repos.
162
- - Set `CODEX_ORCHESTRATOR_GUARD_PROFILE=warn` for ad-hoc/no-task-id runs.
163
- - Set `CODEX_ORCHESTRATOR_GUARD_PROFILE=strict` to enforce full delegation evidence checks.
164
-
165
- ## Delegation + RLM flow
166
-
167
- RLM (Recursive Language Model) is the long-horizon loop used by the `rlm` pipeline (`codex-orchestrator rlm "<goal>"` or `codex-orchestrator start rlm --goal "<goal>"`). Delegated runs only enter RLM when the child is launched with the `rlm` pipeline (or the rlm runner directly). In auto mode it resolves to symbolic only when context is large (`RLM_SYMBOLIC_MIN_BYTES`) and an explicit context signal is present (`RLM_CONTEXT_PATH` or delegated run); otherwise it stays iterative. The runner writes state to `.runs/<task-id>/cli/<run-id>/rlm/state.json` and stops when the validator passes or budgets are exhausted.
168
- For symbolic mode, the Option 2 alignment checker is enabled by default (`RLM_ALIGNMENT_CHECKER=1`) and writes append-only alignment artifacts under `.runs/<task-id>/cli/<run-id>/rlm/alignment/` (ledger + projection). Rollback toggle: set `RLM_ALIGNMENT_CHECKER=0`. Enforcement is opt-in via `RLM_ALIGNMENT_CHECKER_ENFORCE=1`.
169
- Symbolic subcalls can optionally use collab tools. Fast path: `codex-orchestrator rlm --multi-agent auto "<goal>"` (legacy alias: `--collab auto`; sets `RLM_SYMBOLIC_MULTI_AGENT=1` plus legacy `RLM_SYMBOLIC_COLLAB=1` for compatibility, and implies symbolic mode). Collab requires `multi_agent=true` in `codex features list` (`collab` remains a legacy alias). Collab tool calls parsed from `codex exec --json --enable multi_agent` are stored in `manifest.collab_tool_calls` (bounded by `CODEX_ORCHESTRATOR_COLLAB_MAX_EVENTS`, set to `0` to disable); when present in events, `spawn_agent.fork_context` is captured for observability and surfaced in `codex-orchestrator doctor --usage` fork-context counters. For auditable role routing, prefix spawned prompts with `[agent_type:<role>]` and set `spawn_agent.agent_type` when supported; lifecycle validation enforces prompt-role evidence and validates `agent_type` when present (`RLM_SYMBOLIC_MULTI_AGENT_ROLE_POLICY=warn|off`, legacy alias `RLM_COLLAB_ROLE_POLICY`; `RLM_SYMBOLIC_MULTI_AGENT_ALLOW_DEFAULT_ROLE=1`, legacy alias `RLM_COLLAB_ALLOW_DEFAULT_ROLE`). `codex-orchestrator codex setup` remains available when you want a managed/pinned CLI path (opt-in via `CODEX_CLI_USE_MANAGED=1`).
170
- For batch fan-out jobs, prefer native `spawn_agents_on_csv` before building custom orchestration wrappers.
171
-
172
- ### Delegation flow
173
- ```mermaid
174
- flowchart TB
175
- A["Parent run<br/>(delegation MCP enabled)"]
176
- C["Delegation MCP server"]
177
- D["delegate.spawn"]
178
- E["Child run<br/>(pipeline resolved)"]
179
- N{Pipeline = rlm?}
180
- P["Standard pipeline<br/>(plan/build/test/review)"]
181
- RLM["RLM pipeline<br/>(see next chart)"]
182
-
183
- A --> C --> D --> E --> N
184
- N -- yes --> RLM
185
- N -- no --> P
186
- E -. optional .-> Q["delegate.question.enqueue/poll"] -.-> A
16
+ npm i -g @kbediako/codex-orchestrator
17
+ codex-orchestrator --version
187
18
  ```
188
19
 
189
- ### RLM loop
190
- ```mermaid
191
- flowchart TB
192
- F["Resolve mode<br/>(auto -> iterative/symbolic)"]
193
- G{Symbolic?}
194
- H["Context store<br/>(chunk + search)"]
195
- I["Planner JSON<br/>(select subcalls)"]
196
- J["Subcalls<br/>(tool + edits, collab optional)"]
197
- K["Validator<br/>(test command)"]
198
- L["State + artifacts<br/>.runs/&lt;task-id&gt;/cli/&lt;run-id&gt;/rlm/state.json"]
199
- M["Exit status"]
20
+ Node.js `>=20` is required. npm remains the supported baseline install path.
200
21
 
201
- F --> G
202
- G -- yes --> H --> I --> J --> K
203
- G -- no --> J
204
- J --> K
205
- K --> L --> M
206
- K -- fail & budget left --> F
207
- ```
208
-
209
- ## Skills (bundled)
22
+ ## Current Posture
210
23
 
211
- Recommended one-shot bootstrap (skills + delegation + DevTools wiring):
212
- ```bash
213
- codex-orchestrator setup --yes
214
- # Optional: overwrite existing bundled skills in $CODEX_HOME/skills
215
- # codex-orchestrator setup --yes --refresh-skills
216
- ```
217
-
218
- The release ships skills under `skills/` for downstream packaging. If you already have global skills installed, treat those as the primary reference and use bundled skills as the shipped fallback. Install bundled skills into `$CODEX_HOME/skills`:
219
- ```bash
220
- codex-orchestrator skills install
221
- ```
24
+ - Current CO-local Codex CLI `0.125.0` ChatGPT-auth/appserver posture
25
+ - Current model posture: `gpt-5.5` / `xhigh` when available in ChatGPT-auth Codex sessions
26
+ - Portable packaged/generated defaults keep `gpt-5.4` / `xhigh` as fallback values when `gpt-5.5`, API, or cloud portability is unavailable
27
+ - Local default runtime: `appserver`
28
+ - Unsupported combination: `executionMode=cloud` with explicit `runtimeMode=appserver`
222
29
 
223
- Options:
224
- - `--force` overwrites existing files.
225
- - `--only <skills>` installs only selected skills (comma-separated). Combine with `--force` to overwrite only those.
226
- - `--codex-home <path>` targets a different Codex home directory.
30
+ The full version and model policy lives in [docs/guides/codex-version-policy.md](docs/guides/codex-version-policy.md).
227
31
 
228
- Bundled skills (may vary by release):
229
- - `codex-orchestrator`
230
- - `collab-subagents-first`
231
- - `chrome-devtools`
232
- - `delegation-usage`
233
- - `standalone-review`
234
- - `elegance-review`
235
- - `docs-first`
236
- - `collab-evals`
237
- - `collab-deliberation`
238
- - `long-poll-wait`
239
- - `release`
240
- - `agent-first-adoption-steering`
241
- - `delegate-early` (compatibility alias; use `delegation-usage`)
32
+ ## Quickstart
242
33
 
243
- ## DevTools readiness
244
-
245
- Check readiness (deps + capability wiring):
246
34
  ```bash
35
+ codex-orchestrator init codex --cwd /path/to/repo
36
+ cd /path/to/repo
37
+ codex-orchestrator setup --yes --repo /path/to/repo
38
+ codex login
39
+ codex-orchestrator flow --task <task-id>
247
40
  codex-orchestrator doctor --format json
248
41
  ```
249
42
 
250
- Auto-fix wiring (delegation + DevTools):
251
- ```bash
252
- codex-orchestrator doctor --apply --yes
253
- ```
43
+ Use `codex login --device-auth` when browser login is not available.
254
44
 
255
- Usage snapshot (scans local `.runs/`):
256
- ```bash
257
- codex-orchestrator doctor --usage
258
- ```
259
- `doctor --usage` prints adoption KPIs (advanced/cloud/rlm/collab/delegation coverage), and per-run `run-summary.json` now includes a `usageKpi` section plus cloud fallback metadata when preflight downgrades to MCP.
260
- `doctor` also includes a codex-defaults advisory section (model/reasoning/agent baseline drift) and points to additive remediation via `codex-orchestrator codex defaults --yes`.
45
+ ## Plugin Install
261
46
 
262
- Issue bundle logging (downstream dogfooding / repro handoff):
263
- ```bash
264
- codex-orchestrator doctor --issue-log --issue-title "Observed failure" --issue-notes "what happened"
265
- ```
266
- `doctor --issue-log` appends `docs/codex-orchestrator-issues.md` (override via `--issue-log-path`) and writes a JSON bundle under `out/<resolved-task>/doctor/issue-bundles/` with doctor/cloud context (latest run context is included when available).
47
+ The npm CLI install is the baseline. Codex plugin marketplace setup is additive for Codex releases that expose plugin flows. Current Codex CLI `0.125.0` keeps marketplace management under `codex plugin marketplace ...`:
267
48
 
268
- Auto-capture issue bundles when runs fail:
269
49
  ```bash
270
- codex-orchestrator start <pipeline> --auto-issue-log
271
- codex-orchestrator flow --task <task-id> --auto-issue-log
272
- ```
273
- This captures both post-manifest run failures and setup failures that occur before a run manifest is created (for example strict repo-config enforcement).
50
+ # Codex 0.121.0 accepts either command.
51
+ codex marketplace add "$(npm root -g)/@kbediako/codex-orchestrator"
274
52
 
275
- Cloud preflight check (without starting a pipeline):
276
- ```bash
277
- codex-orchestrator doctor --cloud-preflight
53
+ # Codex 0.122.0+ uses the plugin command.
54
+ codex plugin marketplace add "$(npm root -g)/@kbediako/codex-orchestrator"
278
55
  ```
279
56
 
280
- ## Downstream usage cheatsheet (agent-first)
57
+ For local checkout installs, pass the repository root instead of the npm install directory. For Git-backed installs, pass `owner/repo[@ref]`, an HTTPS Git URL, or an SSH Git URL. Use `codex plugin marketplace upgrade codex-orchestrator` to refresh a Git-backed marketplace checkout and `codex plugin marketplace remove codex-orchestrator` to remove the marketplace registration. Then open `/plugins` in Codex, install `Codex Orchestrator`, and restart Codex if the plugin is not picked up immediately. More local checkout, Git-backed, and rollback details are in [docs/book/setup.md](docs/book/setup.md).
281
58
 
282
- - Bootstrap + wire everything: `codex-orchestrator setup --yes` (non-destructive for existing skills by default; add `--refresh-skills` to overwrite)
283
- - Enable required MCP servers with least privilege: `codex-orchestrator mcp enable --servers delegation --yes` (plan with `--format json`; omit `--servers` only when you intentionally want all disabled servers enabled; env/secret values are redacted in displayed command lines)
284
- - Low-friction docs->implementation guardrails: `codex-orchestrator flow --task <task-id>`
285
- - Validate + measure adoption locally: `codex-orchestrator doctor --usage --format json`
286
- - Run docs relevance as an advisory lane (non-blocking): `codex-orchestrator start docs-relevance-advisory --task <task-id>`
287
- - Capture reproducible downstream failures: `codex-orchestrator doctor --issue-log --issue-title "<title>" --issue-notes "<notes>"`
288
- - Auto-capture failed run issue bundles: `codex-orchestrator start <pipeline> --auto-issue-log` or `codex-orchestrator flow --auto-issue-log`
289
- - Active PR watch-resolve-merge loop: `codex-orchestrator pr resolve-merge --pr <number> --quiet-minutes <window>` (add `--auto-merge` when approved; exits early when author action is required).
290
- - Passive PR monitor loop: `codex-orchestrator pr watch-merge --pr <number> --quiet-minutes <window>` (monitor-only behavior; keeps waiting unless terminal/timeout).
291
- - Review checkpoints (npm-only safe): `NOTES="Goal: ... | Summary: ... | Risks: ..." codex-orchestrator review --task <task-id>` for manifest-backed standalone review wrapper behavior (auto-skips repo-only diff-budget script when unavailable in downstream installs); use `codex review "<focus>"` for quick prompt-only checks; use `codex-orchestrator start implementation-gate --task <task-id> --format json` when you want a full gate run.
292
- - Downstream simulation before shipping wrapper/skill changes: `npm run pack:smoke` (packaged CLI in temp mock repo; validates `review` artifacts and `long-poll-wait` install path; spot-check gate). Use `npm run pack:audit` for full tarball inventory validation.
293
- - Delegation: `codex-orchestrator doctor --apply --yes`, then enable for a Codex run with: `codex -c 'mcp_servers.delegation.enabled=true' ...`
294
- - Collab (symbolic RLM subagents): `codex-orchestrator rlm --multi-agent auto "<goal>"` (legacy alias: `--collab auto`; requires Codex `features.multi_agent=true`)
295
- - Cloud: set `CODEX_CLOUD_ENV_ID` (and optional `CODEX_CLOUD_BRANCH`), then run: `codex-orchestrator start <pipeline> --cloud --target <stage-id>`
296
- - Cloud fail-fast (avoid fallback reliance): set `CODEX_ORCHESTRATOR_CLOUD_FALLBACK=deny`
297
- - Repo-config fail-fast (deny packaged config fallback): set `CODEX_ORCHESTRATOR_REPO_CONFIG_REQUIRED=1` or pass `--repo-config-required`
298
- - Cloud status retry tuning (optional): `CODEX_CLOUD_STATUS_RETRY_LIMIT`, `CODEX_CLOUD_STATUS_RETRY_BACKOFF_MS`
59
+ ## Common Commands
299
60
 
300
- Print DevTools MCP setup guidance:
301
61
  ```bash
302
- codex-orchestrator devtools setup
62
+ codex-orchestrator flow --task <task-id>
63
+ codex-orchestrator start diagnostics --task <task-id> --format json
64
+ codex-orchestrator status --run <run-id> --watch --interval 10
65
+ codex-orchestrator review
66
+ codex-orchestrator linear issue-context --issue-id <linear-uuid>
303
67
  ```
304
68
 
305
- ## Common commands
306
-
307
- - `codex-orchestrator start <pipeline>` — run a pipeline (add `--auto-issue-log` for automatic failure bundle capture; add `--repo-config-required` for strict repo-local config mode).
308
- - `codex-orchestrator flow --task <task-id>` — run `docs-review` then `implementation-gate` in sequence (supports `--auto-issue-log` and `--repo-config-required`).
309
- - `codex-orchestrator start docs-relevance-advisory --task <task-id>` — run non-blocking docs relevance signals (warn-mode freshness + advisory review lane).
310
- - `NOTES="Goal: ... | Summary: ... | Risks: ..." codex-orchestrator review --task <task-id>` — run standalone review wrapper with manifest-backed evidence (supports run-review flags/env).
311
- - `codex-orchestrator plan <pipeline>` — preview pipeline stages.
312
- - `codex-orchestrator exec <cmd>` — run a one-off command with the exec runtime.
313
- - `codex-orchestrator init codex` — install starter templates (`mcp-client.json`, `AGENTS.md`, downstream .codex/config.toml + .codex/agents/* role files sourced from `templates/codex/.codex/*`, `codex.orchestrator.json`) into a repo.
314
- - `codex-orchestrator setup --yes` — install bundled skills and configure delegation + DevTools wiring (add `--refresh-skills` to overwrite existing skills in `$CODEX_HOME/skills`).
315
- - `codex-orchestrator init codex --codex-cli --yes --codex-source <path>` — optionally provision a CO-managed Codex CLI binary (build-from-source default; set `CODEX_CLI_SOURCE` to avoid passing `--codex-source` every time, and `CODEX_CLI_USE_MANAGED=1` to route runs to it).
316
- - `codex-orchestrator init codex --codex-cli --yes --codex-download-url <url> --codex-download-sha256 <sha>` — opt-in to a prebuilt Codex CLI download.
317
- - `codex-orchestrator codex setup` — plan/apply a CO-managed Codex CLI install (optional managed/pinned path; use `--download-url` + `--download-sha256` for prebuilts; activate with `CODEX_CLI_USE_MANAGED=1`).
318
- - `codex-orchestrator codex defaults` — plan/apply additive global defaults in `~/.codex/config.toml` and `~/.codex/agents/*.toml` (`--yes` applies, `--force` allows role file overwrite).
319
- - `codex-orchestrator delegation setup --yes` — configure delegation MCP server wiring.
320
- - `codex-orchestrator mcp enable --servers <csv> --yes` — enable specific disabled MCP servers from existing Codex config entries.
321
- - `codex-orchestrator self-check --format json` — JSON health payload.
322
- - `codex-orchestrator mcp serve` — Codex MCP stdio server.
323
- - `npm run pack:smoke` — maintainer smoke gate for packaged downstream behavior (tarball install + review/skill checks). Core lane runs it on downstream-facing diffs; `.github/workflows/pack-smoke-backstop.yml` runs a weekly `main` backstop.
324
-
325
- ## What ships in the npm release
326
-
327
- - CLI + built-in pipelines
328
- - Delegation MCP server (`delegate-server`)
329
- - Bundled skills under `skills/`
330
- - Schemas and templates needed by the CLI
331
-
332
- ## Repository + contributor guide
69
+ Run artifacts live under `.runs/<task-id>/` and summaries under `out/<task-id>/`.
333
70
 
334
- Repo internals, development workflows, and deeper architecture notes (contributor/internal) live in the GitHub repository:
335
- - `docs/README.md`
336
- - `docs/diagnostics-prompt-guide.md` (first-run diagnostics prompt + expected outputs)
337
- - `docs/guides/collab-vs-mcp.md` (agent-first decision guide)
338
- - `docs/guides/rlm-recursion-v2.md` (RLM recursion reference)
339
- - `docs/guides/cloud-mode-preflight.md` (cloud-mode preflight + fallback guidance)
340
- - `docs/guides/review-artifacts.md` (where `codex-orchestrator review` / `npm run review` write prompt/output artifacts)
341
- - `docs/standalone-review-guide.md` (repo-local wrapper behavior + downstream-safe review alternatives)
71
+ ## Downstream Setup
342
72
 
343
- ## RLM benchmark graphs
73
+ - [Book index](docs/book/README.md): setup, operations, skills, public posture, and CO-345 evidence notes
74
+ - [Bundled skills](skills/README.md): shipped skill roster and install behavior
75
+ - [Downstream setup](docs/public/downstream-setup.md): install, repo bootstrap, machine setup, and first run
76
+ - [Provider onboarding](docs/public/provider-onboarding.md): Linear and provider-worker setup
77
+ - [Docs index](docs/README.md): repo-local documentation map
344
78
 
345
- Seeded OOLONG accuracy curves (Wilson 95% CI, runs=5). In these runs, the baseline accuracy degrades as context length grows, while RLM stays near the ceiling across the tested lengths.
79
+ ## Contributing
346
80
 
347
- <table>
348
- <tr>
349
- <td><img src="docs/assets/oolong-baseline-seeded-wilson95-runs5.png" alt="Baseline OOLONG seeded Wilson 95% CI" width="420"></td>
350
- <td><img src="docs/assets/oolong-rlm-seeded-wilson95-runs5.png" alt="RLM OOLONG seeded Wilson 95% CI" width="420"></td>
351
- </tr>
352
- </table>
81
+ Contributor and repo-internal guidance lives in [docs/README.md](docs/README.md).
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from 'node:child_process'
4
+ import { createRequire } from 'node:module'
5
+ import { existsSync, writeSync } from 'node:fs'
6
+ import { join, normalize } from 'node:path'
7
+ import process from 'node:process'
8
+ import { fileURLToPath } from 'node:url'
9
+
10
+ const FORWARDABLE_SIGNALS = ['SIGINT', 'SIGTERM', 'SIGHUP']
11
+
12
+ function main() {
13
+ const packageRoot = resolvePackageRoot()
14
+ const sourceEntry = join(packageRoot, 'bin', 'codex-orchestrator.ts')
15
+ const distEntry = join(packageRoot, 'dist', 'bin', 'codex-orchestrator.js')
16
+ const sourceLoader = existsSync(sourceEntry) ? resolveTsNodeLoader(packageRoot) : null
17
+
18
+ let args
19
+ if (sourceLoader) {
20
+ args = ['--no-warnings', '--loader', sourceLoader, sourceEntry, ...process.argv.slice(2)]
21
+ } else if (existsSync(distEntry)) {
22
+ args = [distEntry, ...process.argv.slice(2)]
23
+ if (existsSync(sourceEntry)) {
24
+ writeWarning(
25
+ [
26
+ 'Source checkout fallback: ts-node/esm is unavailable, so execution is using the built dist artifact instead of the live source entrypoint.',
27
+ `source=${sourceEntry}`,
28
+ `dist=${distEntry}`,
29
+ 'Fresh merged TypeScript changes may remain stale until dist is rebuilt.'
30
+ ].join(' ')
31
+ )
32
+ }
33
+ } else if (existsSync(sourceEntry)) {
34
+ throw new Error(
35
+ `Unable to run ${sourceEntry} because ts-node/esm is unavailable, and fallback dist artifact ${distEntry} is missing.`
36
+ )
37
+ } else {
38
+ throw new Error(`Unable to locate CLI entrypoint. Expected ${distEntry}.`)
39
+ }
40
+
41
+ const env = {
42
+ ...process.env,
43
+ CODEX_ORCHESTRATOR_PACKAGE_ROOT: packageRoot
44
+ }
45
+ if (sourceLoader) {
46
+ env.TS_NODE_PROJECT = join(packageRoot, 'tsconfig.json')
47
+ }
48
+
49
+ const child = spawn(process.execPath, [...process.execArgv, ...args], {
50
+ env,
51
+ stdio: 'inherit'
52
+ })
53
+ let forwardedStopSignal = null
54
+ const disposeSignalForwarding = installSignalForwarding(child, (signal) => {
55
+ forwardedStopSignal ??= signal
56
+ })
57
+ child.once('error', (error) => {
58
+ disposeSignalForwarding()
59
+ writeWarning(error instanceof Error ? error.message : String(error))
60
+ process.exitCode = 1
61
+ })
62
+ child.once('close', (code, signal) => {
63
+ disposeSignalForwarding()
64
+ if (forwardedStopSignal) {
65
+ reemitSignal(forwardedStopSignal)
66
+ return
67
+ }
68
+ if (signal) {
69
+ reemitSignal(signal)
70
+ return
71
+ }
72
+ process.exitCode = typeof code === 'number' ? code : 1
73
+ })
74
+ }
75
+
76
+ function resolvePackageRoot() {
77
+ const selfPath = fileURLToPath(import.meta.url)
78
+ const selfRoot = normalize(join(selfPath, '..', '..'))
79
+ const configured = normalizeOptionalString(process.env.CODEX_ORCHESTRATOR_PACKAGE_ROOT)
80
+ if (configured && pathsEqual(configured, selfRoot)) {
81
+ return normalize(configured)
82
+ }
83
+ return selfRoot
84
+ }
85
+
86
+ function resolveTsNodeLoader(packageRoot) {
87
+ try {
88
+ return createRequire(join(packageRoot, 'package.json')).resolve('ts-node/esm')
89
+ } catch {
90
+ return null
91
+ }
92
+ }
93
+
94
+ function normalizeOptionalString(value) {
95
+ if (typeof value !== 'string') {
96
+ return null
97
+ }
98
+ const trimmed = value.trim()
99
+ return trimmed.length > 0 ? trimmed : null
100
+ }
101
+
102
+ function pathsEqual(leftPath, rightPath) {
103
+ return normalize(leftPath) === normalize(rightPath)
104
+ }
105
+
106
+ function writeWarning(message) {
107
+ const line = `${message}\n`
108
+ const stderrFd = process.stderr.fd
109
+ if (typeof stderrFd === 'number') {
110
+ try {
111
+ writeSync(stderrFd, line)
112
+ return
113
+ } catch {
114
+ // Fall through to process.stderr when direct fd writes are unavailable.
115
+ }
116
+ }
117
+ process.stderr.write(line)
118
+ }
119
+
120
+ function installSignalForwarding(child, onForwardedSignal) {
121
+ const handlers = new Map()
122
+ for (const signal of FORWARDABLE_SIGNALS) {
123
+ const handler = () => {
124
+ onForwardedSignal(signal)
125
+ forwardSignal(child, signal)
126
+ }
127
+ process.on(signal, handler)
128
+ handlers.set(signal, handler)
129
+ }
130
+ return () => {
131
+ for (const [signal, handler] of handlers) {
132
+ process.off(signal, handler)
133
+ }
134
+ }
135
+ }
136
+
137
+ function forwardSignal(child, signal) {
138
+ if (child.exitCode !== null || child.signalCode !== null) {
139
+ return
140
+ }
141
+ try {
142
+ child.kill(signal)
143
+ } catch {
144
+ // Ignore forwarding races when the child exits between checks.
145
+ }
146
+ }
147
+
148
+ function reemitSignal(signal) {
149
+ try {
150
+ process.kill(process.pid, signal)
151
+ } catch {
152
+ process.exitCode = 1
153
+ }
154
+ }
155
+
156
+ try {
157
+ main()
158
+ } catch (error) {
159
+ writeWarning(error instanceof Error ? error.message : String(error))
160
+ process.exitCode = 1
161
+ }