@kbediako/codex-orchestrator 0.1.38 → 0.2.0

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 (299) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/README.md +70 -301
  3. package/bin/codex-orchestrator.js +161 -0
  4. package/codex.orchestrator.json +149 -13
  5. package/dist/bin/codex-orchestrator.js +795 -1154
  6. package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +22 -4
  7. package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +3 -3
  8. package/dist/orchestrator/src/cli/adapters/CommandTester.js +2 -2
  9. package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +183 -11
  10. package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
  11. package/dist/orchestrator/src/cli/coStatusCliShell.js +429 -0
  12. package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
  13. package/dist/orchestrator/src/cli/codexCliShell.js +72 -0
  14. package/dist/orchestrator/src/cli/codexDefaultsSetup.js +49 -11
  15. package/dist/orchestrator/src/cli/config/delegationConfig.js +317 -5
  16. package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +2 -3
  17. package/dist/orchestrator/src/cli/config/userConfig.js +28 -13
  18. package/dist/orchestrator/src/cli/control/authenticatedControlRouteGate.js +69 -0
  19. package/dist/orchestrator/src/cli/control/authenticatedRouteComposition.js +267 -0
  20. package/dist/orchestrator/src/cli/control/authenticatedRouteController.js +5 -0
  21. package/dist/orchestrator/src/cli/control/authenticatedRouteDispatcher.js +41 -0
  22. package/dist/orchestrator/src/cli/control/compatibilityIssuePresenter.js +1035 -0
  23. package/dist/orchestrator/src/cli/control/confirmationApproveController.js +62 -0
  24. package/dist/orchestrator/src/cli/control/confirmationCreateController.js +69 -0
  25. package/dist/orchestrator/src/cli/control/confirmationIssueConsumeController.js +43 -0
  26. package/dist/orchestrator/src/cli/control/confirmationListController.js +22 -0
  27. package/dist/orchestrator/src/cli/control/confirmationValidateController.js +58 -0
  28. package/dist/orchestrator/src/cli/control/confirmations.js +25 -3
  29. package/dist/orchestrator/src/cli/control/controlActionCancelConfirmation.js +65 -0
  30. package/dist/orchestrator/src/cli/control/controlActionController.js +77 -0
  31. package/dist/orchestrator/src/cli/control/controlActionControllerSequencing.js +161 -0
  32. package/dist/orchestrator/src/cli/control/controlActionExecution.js +142 -0
  33. package/dist/orchestrator/src/cli/control/controlActionFinalization.js +43 -0
  34. package/dist/orchestrator/src/cli/control/controlActionOutcome.js +60 -0
  35. package/dist/orchestrator/src/cli/control/controlActionPreflight.js +476 -0
  36. package/dist/orchestrator/src/cli/control/controlAuthenticatedRouteHandoff.js +57 -0
  37. package/dist/orchestrator/src/cli/control/controlBootstrapAssembly.js +39 -0
  38. package/dist/orchestrator/src/cli/control/controlBootstrapMetadataPersistence.js +16 -0
  39. package/dist/orchestrator/src/cli/control/controlEventTransport.js +49 -0
  40. package/dist/orchestrator/src/cli/control/controlExpiryLifecycle.js +102 -0
  41. package/dist/orchestrator/src/cli/control/controlHostOwnership.js +480 -0
  42. package/dist/orchestrator/src/cli/control/controlHostSupervision.js +608 -0
  43. package/dist/orchestrator/src/cli/control/controlOversightFacade.js +8 -0
  44. package/dist/orchestrator/src/cli/control/controlOversightReadContract.js +1 -0
  45. package/dist/orchestrator/src/cli/control/controlOversightReadService.js +16 -0
  46. package/dist/orchestrator/src/cli/control/controlOversightUpdateContract.js +1 -0
  47. package/dist/orchestrator/src/cli/control/controlPersistenceFiles.js +6 -0
  48. package/dist/orchestrator/src/cli/control/controlQuestionChildResolution.js +18 -0
  49. package/dist/orchestrator/src/cli/control/controlRequestContext.js +42 -0
  50. package/dist/orchestrator/src/cli/control/controlRequestController.js +9 -0
  51. package/dist/orchestrator/src/cli/control/controlRequestPredispatch.js +17 -0
  52. package/dist/orchestrator/src/cli/control/controlRequestRouteDispatch.js +44 -0
  53. package/dist/orchestrator/src/cli/control/controlRuntime.js +992 -0
  54. package/dist/orchestrator/src/cli/control/controlServer.js +23 -1456
  55. package/dist/orchestrator/src/cli/control/controlServerAuditAndErrorHelpers.js +115 -0
  56. package/dist/orchestrator/src/cli/control/controlServerAuthenticatedRouteBranch.js +29 -0
  57. package/dist/orchestrator/src/cli/control/controlServerBootstrapLifecycle.js +30 -0
  58. package/dist/orchestrator/src/cli/control/controlServerBootstrapStartSequence.js +21 -0
  59. package/dist/orchestrator/src/cli/control/controlServerOwnedRuntimeLifecycle.js +67 -0
  60. package/dist/orchestrator/src/cli/control/controlServerPublicLifecycle.js +756 -0
  61. package/dist/orchestrator/src/cli/control/controlServerPublicRouteHelpers.js +86 -0
  62. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceLifecycle.js +25 -0
  63. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceStartup.js +18 -0
  64. package/dist/orchestrator/src/cli/control/controlServerRequestBodyHelpers.js +37 -0
  65. package/dist/orchestrator/src/cli/control/controlServerRequestShell.js +40 -0
  66. package/dist/orchestrator/src/cli/control/controlServerRequestShellBinding.js +17 -0
  67. package/dist/orchestrator/src/cli/control/controlServerSeedLoading.js +27 -0
  68. package/dist/orchestrator/src/cli/control/controlServerSeededRuntimeAssembly.js +186 -0
  69. package/dist/orchestrator/src/cli/control/controlServerStartupInputPreparation.js +31 -0
  70. package/dist/orchestrator/src/cli/control/controlServerStartupSequence.js +49 -0
  71. package/dist/orchestrator/src/cli/control/controlState.js +233 -2
  72. package/dist/orchestrator/src/cli/control/controlStatusDashboard.js +1899 -0
  73. package/dist/orchestrator/src/cli/control/controlTelegramBridgeBootstrapLifecycle.js +22 -0
  74. package/dist/orchestrator/src/cli/control/controlTelegramBridgeLifecycle.js +67 -0
  75. package/dist/orchestrator/src/cli/control/controlTelegramBridgeOversightFacadeFactory.js +8 -0
  76. package/dist/orchestrator/src/cli/control/controlTelegramCommandController.js +49 -0
  77. package/dist/orchestrator/src/cli/control/controlTelegramDispatchRead.js +40 -0
  78. package/dist/orchestrator/src/cli/control/controlTelegramPollingController.js +89 -0
  79. package/dist/orchestrator/src/cli/control/controlTelegramProjectionNotificationController.js +29 -0
  80. package/dist/orchestrator/src/cli/control/controlTelegramPushState.js +63 -0
  81. package/dist/orchestrator/src/cli/control/controlTelegramQuestionRead.js +13 -0
  82. package/dist/orchestrator/src/cli/control/controlTelegramReadController.js +216 -0
  83. package/dist/orchestrator/src/cli/control/controlTelegramUpdateHandler.js +63 -0
  84. package/dist/orchestrator/src/cli/control/controlWatcher.js +73 -5
  85. package/dist/orchestrator/src/cli/control/delegationRegisterController.js +35 -0
  86. package/dist/orchestrator/src/cli/control/dynamicToolBridgePolicy.js +139 -0
  87. package/dist/orchestrator/src/cli/control/eventsSseController.js +12 -0
  88. package/dist/orchestrator/src/cli/control/linearBudgetState.js +1789 -0
  89. package/dist/orchestrator/src/cli/control/linearDispatchSource.js +1137 -0
  90. package/dist/orchestrator/src/cli/control/linearGraphqlClient.js +150 -0
  91. package/dist/orchestrator/src/cli/control/linearRateLimit.js +102 -0
  92. package/dist/orchestrator/src/cli/control/linearWebhookController.js +499 -0
  93. package/dist/orchestrator/src/cli/control/liveLinearAdvisoryRuntime.js +70 -0
  94. package/dist/orchestrator/src/cli/control/observabilityApiController.js +173 -0
  95. package/dist/orchestrator/src/cli/control/observabilityReadModel.js +500 -0
  96. package/dist/orchestrator/src/cli/control/observabilitySurface.js +284 -0
  97. package/dist/orchestrator/src/cli/control/observabilityUpdateNotifier.js +22 -0
  98. package/dist/orchestrator/src/cli/control/operatorDashboardPresenter.js +252 -0
  99. package/dist/orchestrator/src/cli/control/providerAgentCapacity.js +70 -0
  100. package/dist/orchestrator/src/cli/control/providerControlHostFreshnessGauge.js +1068 -0
  101. package/dist/orchestrator/src/cli/control/providerIntakeState.js +473 -0
  102. package/dist/orchestrator/src/cli/control/providerIssueHandoff.js +6811 -0
  103. package/dist/orchestrator/src/cli/control/providerIssueObservability.js +1348 -0
  104. package/dist/orchestrator/src/cli/control/providerIssueRetryQueue.js +84 -0
  105. package/dist/orchestrator/src/cli/control/providerLinearRuntimeProof.js +588 -0
  106. package/dist/orchestrator/src/cli/control/providerLinearScreenshotProof.js +473 -0
  107. package/dist/orchestrator/src/cli/control/providerLinearWorkerTruth.js +383 -0
  108. package/dist/orchestrator/src/cli/control/providerLinearWorkflowAudit.js +254 -0
  109. package/dist/orchestrator/src/cli/control/providerLinearWorkflowFacade.js +5573 -0
  110. package/dist/orchestrator/src/cli/control/providerLinearWorkflowStates.js +115 -0
  111. package/dist/orchestrator/src/cli/control/providerMergeCloseout.js +1868 -0
  112. package/dist/orchestrator/src/cli/control/providerOperatorAutopilot.js +1580 -0
  113. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLifecycle.js +154 -0
  114. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLocalRolloutExecution.js +1006 -0
  115. package/dist/orchestrator/src/cli/control/providerPollingHealth.js +435 -0
  116. package/dist/orchestrator/src/cli/control/providerTerminalCleanup.js +516 -0
  117. package/dist/orchestrator/src/cli/control/providerWorkerHosts.js +191 -0
  118. package/dist/orchestrator/src/cli/control/providerWorkflowConfigStore.js +515 -0
  119. package/dist/orchestrator/src/cli/control/questionChildResolutionAdapter.js +361 -0
  120. package/dist/orchestrator/src/cli/control/questionQueueController.js +181 -0
  121. package/dist/orchestrator/src/cli/control/questionReadRetryDeduplication.js +9 -0
  122. package/dist/orchestrator/src/cli/control/questionReadSequence.js +10 -0
  123. package/dist/orchestrator/src/cli/control/securityViolationController.js +27 -0
  124. package/dist/orchestrator/src/cli/control/selectedRunProjection.js +1838 -0
  125. package/dist/orchestrator/src/cli/control/telegramOversightApiClient.js +48 -0
  126. package/dist/orchestrator/src/cli/control/telegramOversightBridge.js +180 -0
  127. package/dist/orchestrator/src/cli/control/telegramOversightBridgeProjectionDeliveryQueue.js +25 -0
  128. package/dist/orchestrator/src/cli/control/telegramOversightBridgeRuntimeLifecycle.js +45 -0
  129. package/dist/orchestrator/src/cli/control/telegramOversightBridgeStateStore.js +77 -0
  130. package/dist/orchestrator/src/cli/control/telegramOversightControlActionApiClient.js +45 -0
  131. package/dist/orchestrator/src/cli/control/trackerDispatchPilot.js +439 -0
  132. package/dist/orchestrator/src/cli/control/uiDataController.js +34 -0
  133. package/dist/orchestrator/src/cli/control/uiSessionController.js +100 -0
  134. package/dist/orchestrator/src/cli/controlHostCliShell.js +860 -0
  135. package/dist/orchestrator/src/cli/controlHostFreshnessGaugeCliShell.js +129 -0
  136. package/dist/orchestrator/src/cli/controlHostSupervisionCliShell.js +2127 -0
  137. package/dist/orchestrator/src/cli/delegationCliShell.js +62 -0
  138. package/dist/orchestrator/src/cli/delegationServer.js +567 -678
  139. package/dist/orchestrator/src/cli/delegationServerCliShell.js +52 -0
  140. package/dist/orchestrator/src/cli/delegationServerQuestionFlowShell.js +228 -0
  141. package/dist/orchestrator/src/cli/delegationServerToolDispatchShell.js +411 -0
  142. package/dist/orchestrator/src/cli/delegationServerTransport.js +274 -0
  143. package/dist/orchestrator/src/cli/delegationSetup.js +51 -171
  144. package/dist/orchestrator/src/cli/devtoolsCliShell.js +34 -0
  145. package/dist/orchestrator/src/cli/doctor.js +542 -122
  146. package/dist/orchestrator/src/cli/doctorCliRequestShell.js +72 -0
  147. package/dist/orchestrator/src/cli/doctorCliShell.js +138 -0
  148. package/dist/orchestrator/src/cli/doctorUsage.js +119 -15
  149. package/dist/orchestrator/src/cli/exec/experience.js +16 -2
  150. package/dist/orchestrator/src/cli/exec/summary.js +3 -0
  151. package/dist/orchestrator/src/cli/execCliShell.js +51 -0
  152. package/dist/orchestrator/src/cli/flowCliRequestShell.js +44 -0
  153. package/dist/orchestrator/src/cli/flowCliShell.js +239 -0
  154. package/dist/orchestrator/src/cli/frontendTestCliRequestShell.js +80 -0
  155. package/dist/orchestrator/src/cli/frontendTestCliShell.js +41 -0
  156. package/dist/orchestrator/src/cli/init.js +1 -0
  157. package/dist/orchestrator/src/cli/initCliShell.js +50 -0
  158. package/dist/orchestrator/src/cli/linearCliShell.js +1200 -0
  159. package/dist/orchestrator/src/cli/mcpEnableCliShell.js +132 -0
  160. package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +3 -2
  161. package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +56 -0
  162. package/dist/orchestrator/src/cli/orchestrator.js +66 -1376
  163. package/dist/orchestrator/src/cli/planCliShell.js +19 -0
  164. package/dist/orchestrator/src/cli/prCliShell.js +41 -0
  165. package/dist/orchestrator/src/cli/providerLinearChildLanePhaseContract.js +204 -0
  166. package/dist/orchestrator/src/cli/providerLinearChildLaneRunner.js +1772 -0
  167. package/dist/orchestrator/src/cli/providerLinearChildLaneShell.js +2420 -0
  168. package/dist/orchestrator/src/cli/providerLinearChildStreamShell.js +385 -0
  169. package/dist/orchestrator/src/cli/providerLinearWorkerRunner.js +5738 -0
  170. package/dist/orchestrator/src/cli/resumeCliShell.js +14 -0
  171. package/dist/orchestrator/src/cli/reviewCliLaunchShell.js +72 -0
  172. package/dist/orchestrator/src/cli/rlm/alignment.js +3 -3
  173. package/dist/orchestrator/src/cli/rlm/context.js +94 -7
  174. package/dist/orchestrator/src/cli/rlm/rlmCodexRuntimeShell.js +546 -0
  175. package/dist/orchestrator/src/cli/rlm/symbolic.js +4 -2
  176. package/dist/orchestrator/src/cli/rlmCliRequestShell.js +42 -0
  177. package/dist/orchestrator/src/cli/rlmCompletionCliShell.js +46 -0
  178. package/dist/orchestrator/src/cli/rlmLaunchCliShell.js +51 -0
  179. package/dist/orchestrator/src/cli/rlmRunner.js +83 -523
  180. package/dist/orchestrator/src/cli/run/blockMemory.js +500 -0
  181. package/dist/orchestrator/src/cli/run/manifest.js +410 -73
  182. package/dist/orchestrator/src/cli/run/manifestPersister.js +45 -14
  183. package/dist/orchestrator/src/cli/run/runMemoryController.js +216 -0
  184. package/dist/orchestrator/src/cli/run/source0.js +690 -0
  185. package/dist/orchestrator/src/cli/run/workspacePath.js +101 -0
  186. package/dist/orchestrator/src/cli/runtime/mode.js +2 -1
  187. package/dist/orchestrator/src/cli/runtime/provider.js +39 -2
  188. package/dist/orchestrator/src/cli/selfCheckCliShell.js +12 -0
  189. package/dist/orchestrator/src/cli/services/commandRunner.js +667 -18
  190. package/dist/orchestrator/src/cli/services/execRuntime.js +66 -1
  191. package/dist/orchestrator/src/cli/services/orchestratorAutoScoutEvidenceRecorder.js +71 -0
  192. package/dist/orchestrator/src/cli/services/orchestratorCloudBranchResolution.js +8 -0
  193. package/dist/orchestrator/src/cli/services/orchestratorCloudEnvironmentResolution.js +22 -0
  194. package/dist/orchestrator/src/cli/services/orchestratorCloudExecutionLifecycleShell.js +39 -0
  195. package/dist/orchestrator/src/cli/services/orchestratorCloudPromptBuilder.js +37 -0
  196. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteFallbackContract.js +45 -0
  197. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteShell.js +36 -0
  198. package/dist/orchestrator/src/cli/services/orchestratorCloudTargetExecutor.js +277 -0
  199. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycle.js +98 -0
  200. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycleShell.js +54 -0
  201. package/dist/orchestrator/src/cli/services/orchestratorExecutionLifecycle.js +112 -0
  202. package/dist/orchestrator/src/cli/services/orchestratorExecutionModePolicy.js +27 -0
  203. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteAdapterShell.js +59 -0
  204. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteDecisionShell.js +57 -0
  205. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteState.js +21 -0
  206. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouter.js +2 -0
  207. package/dist/orchestrator/src/cli/services/orchestratorLocalPipelineExecutor.js +149 -0
  208. package/dist/orchestrator/src/cli/services/orchestratorLocalRouteShell.js +63 -0
  209. package/dist/orchestrator/src/cli/services/orchestratorPlanShell.js +54 -0
  210. package/dist/orchestrator/src/cli/services/orchestratorPlanTargetTracker.js +16 -0
  211. package/dist/orchestrator/src/cli/services/orchestratorResumePreparationShell.js +84 -0
  212. package/dist/orchestrator/src/cli/services/orchestratorResumeTokenValidation.js +15 -0
  213. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleCompletion.js +31 -0
  214. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleExecutionRegistration.js +37 -0
  215. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleOrchestrationShell.js +83 -0
  216. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleTaskManagerShell.js +37 -0
  217. package/dist/orchestrator/src/cli/services/orchestratorRuntimeManifestMutation.js +20 -0
  218. package/dist/orchestrator/src/cli/services/orchestratorStartPreparationShell.js +56 -0
  219. package/dist/orchestrator/src/cli/services/orchestratorStatusShell.js +70 -0
  220. package/dist/orchestrator/src/cli/services/pipelineResolver.js +7 -3
  221. package/dist/orchestrator/src/cli/services/plannerMemory.js +119 -0
  222. package/dist/orchestrator/src/cli/services/runPreparation.js +7 -3
  223. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +9 -0
  224. package/dist/orchestrator/src/cli/setupBootstrapShell.js +114 -0
  225. package/dist/orchestrator/src/cli/setupCliShell.js +51 -0
  226. package/dist/orchestrator/src/cli/skillsCliShell.js +56 -0
  227. package/dist/orchestrator/src/cli/startCliRequestShell.js +53 -0
  228. package/dist/orchestrator/src/cli/startCliShell.js +68 -0
  229. package/dist/orchestrator/src/cli/statusCliShell.js +22 -0
  230. package/dist/orchestrator/src/cli/utils/authProvenanceFingerprint.js +27 -0
  231. package/dist/orchestrator/src/cli/utils/cloudPreflight.js +83 -1
  232. package/dist/orchestrator/src/cli/utils/delegationConfigParser.js +250 -0
  233. package/dist/orchestrator/src/cli/utils/delegationMcpHealth.js +1382 -0
  234. package/dist/orchestrator/src/cli/utils/devtools.js +2 -54
  235. package/dist/orchestrator/src/cli/utils/mcpServerEntry.js +53 -0
  236. package/dist/orchestrator/src/cli/utils/packageProgramResolver.js +151 -0
  237. package/dist/orchestrator/src/cli/utils/providerOverrideEnv.js +71 -0
  238. package/dist/orchestrator/src/cli/utils/trailingJsonObject.js +59 -0
  239. package/dist/orchestrator/src/learning/crystalizer.js +2 -2
  240. package/dist/orchestrator/src/persistence/ExperienceStore.js +233 -49
  241. package/dist/orchestrator/src/persistence/TaskStateStore.js +6 -6
  242. package/dist/orchestrator/src/persistence/lockFile.js +70 -4
  243. package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +39 -0
  244. package/dist/orchestrator/src/sync/createCloudSyncWorker.js +3 -2
  245. package/dist/orchestrator/src/utils/atomicWrite.js +17 -2
  246. package/dist/packages/orchestrator/src/exec/unified-exec.js +99 -6
  247. package/dist/packages/orchestrator/src/instructions/promptPacks.js +150 -19
  248. package/dist/packages/sdk-node/src/orchestrator.js +137 -13
  249. package/dist/packages/shared/config/designConfig.js +8 -1
  250. package/dist/packages/shared/streams/stdio.js +1 -1
  251. package/dist/scripts/design/pipeline/permit.js +15 -0
  252. package/dist/scripts/lib/docs-catalog.js +365 -0
  253. package/dist/scripts/lib/docs-helpers.js +87 -5
  254. package/dist/scripts/lib/pr-watch-merge.js +1088 -80
  255. package/dist/scripts/lib/provider-run-contract.js +26 -0
  256. package/dist/scripts/lib/review-command-intent-classification.js +532 -0
  257. package/dist/scripts/lib/review-command-probe-classification.js +385 -0
  258. package/dist/scripts/lib/review-execution-boundary-preflight.js +279 -0
  259. package/dist/scripts/lib/review-execution-runtime.js +753 -0
  260. package/dist/scripts/lib/review-execution-state.js +1144 -0
  261. package/dist/scripts/lib/review-execution-telemetry.js +215 -0
  262. package/dist/scripts/lib/review-inspection-target-parsing.js +78 -0
  263. package/dist/scripts/lib/review-launch-attempt.js +601 -0
  264. package/dist/scripts/lib/review-meta-surface-boundary-analysis.js +300 -0
  265. package/dist/scripts/lib/review-meta-surface-normalization.js +746 -0
  266. package/dist/scripts/lib/review-non-interactive-handoff.js +61 -0
  267. package/dist/scripts/lib/review-prompt-context.js +376 -0
  268. package/dist/scripts/lib/review-scope-advisory.js +286 -0
  269. package/dist/scripts/lib/review-scope-paths.js +123 -0
  270. package/dist/scripts/lib/review-shell-command-parser.js +389 -0
  271. package/dist/scripts/lib/review-shell-env-interpreter.js +340 -0
  272. package/dist/scripts/lib/run-manifests.js +192 -36
  273. package/dist/scripts/lib/spark-policy-classifier.js +593 -0
  274. package/dist/scripts/run-review.js +507 -1777
  275. package/docs/public/downstream-setup.md +106 -0
  276. package/docs/public/provider-onboarding.md +173 -0
  277. package/package.json +20 -10
  278. package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
  279. package/plugins/codex-orchestrator/.mcp.json +13 -0
  280. package/plugins/codex-orchestrator/launcher.mjs +359 -0
  281. package/schemas/manifest.json +394 -0
  282. package/skills/collab-subagents-first/SKILL.md +1 -1
  283. package/skills/delegation-usage/DELEGATION_GUIDE.md +24 -11
  284. package/skills/delegation-usage/SKILL.md +19 -13
  285. package/skills/land/SKILL.md +77 -0
  286. package/skills/linear/SKILL.md +255 -0
  287. package/skills/release/SKILL.md +47 -3
  288. package/skills/standalone-review/SKILL.md +6 -1
  289. package/templates/README.md +4 -2
  290. package/templates/codex/.codex/agents/awaiter-high.toml +2 -2
  291. package/templates/codex/.codex/agents/worker-complex.toml +1 -1
  292. package/templates/codex/.codex/config.toml +3 -4
  293. package/templates/codex/.codex/providers/README.md +13 -0
  294. package/templates/codex/.codex/providers/control.example.json +18 -0
  295. package/templates/codex/.codex/providers/provider.env.example +15 -0
  296. package/templates/codex/AGENTS.md +12 -7
  297. package/templates/codex/mcp-client.json +5 -1
  298. package/docs/README.md +0 -310
  299. 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,121 @@
1
1
  # Codex Orchestrator
2
2
 
3
- ![Setup demo](docs/assets/setup.gif)
3
+ Codex Orchestrator is a CLI and runtime for Codex-driven pipelines, auditable manifests, delegation MCP 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
+
7
+ This README tracks the current `main` branch. When `main` moves ahead of the latest published package, published-package users should follow the README and docs that match the tag or release they actually installed instead of assuming every source-head guide below is already shipped.
8
+
9
+ - Release-safe docs for the current published package: [latest GitHub release](https://github.com/Kbediako/CO/releases/latest)
10
+ - If you are pinned to the older `v0.1.38` package, use the matching [README for `v0.1.38`](https://github.com/Kbediako/CO/blob/v0.1.38/README.md)
11
+ - Source-head guidance in this checkout includes the marketplace/plugin flow below plus `docs/public/downstream-setup.md` and `docs/public/provider-onboarding.md`
6
12
 
7
13
  ## Install
8
14
 
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
- ```
15
+ npm remains the supported baseline because it is the simplest way to install the CO CLI.
21
16
 
22
- Node.js >= 20 is required.
17
+ ```bash
18
+ npm i -g @kbediako/codex-orchestrator
19
+ codex-orchestrator --version
20
+ ```
23
21
 
24
- ## Quick start
22
+ Node.js `>=20` is required.
25
23
 
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.
24
+ CO currently targets Codex CLI `0.123.0`; newer candidates stay evidence-gated in `docs/guides/codex-version-policy.md`.
25
+ The source-head marketplace/plugin guidance keeps the CO-196 packaging boundary: npm remains the release-safe baseline, while Codex plugin marketplace registration is an additive path for newer Codex CLI command surfaces.
26
+
27
+ ### Source-head marketplace/plugin setup
41
28
 
42
- ## Runtime + Execution Modes
29
+ The marketplace/plugin flow below reflects the current source tree. Published-package users, especially anyone pinned to older tags such as `v0.1.38`, should keep following the matching tagged README or release docs instead of assuming the latest source-head marketplace surfaces are already shipped. Only use the marketplace/plugin steps below when you are on `main` or on a tag or release that already includes `plugins/codex-orchestrator` and the related public docs.
43
30
 
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).
31
+ For newer Codex releases that expose `codex plugin marketplace`, CO also ships a repo marketplace entry plus plugin manifests under `plugins/codex-orchestrator`. You can add the packaged or repo-root marketplace source and install the plugin from Codex:
51
32
 
52
- ## Downstream init (recommended)
33
+ ```bash
34
+ codex plugin marketplace add "$(npm root -g)/@kbediako/codex-orchestrator"
35
+ ```
36
+
37
+ For a local checkout, add the repository root instead of the npm install directory. For a Git-backed install, pass a Git identifier or URL such as `owner/repo[@ref]`, an HTTPS Git URL, or an SSH Git URL. Those source-driven installs can include unreleased changes; pinning an older tag such as `v0.1.38` keeps you on the pre-marketplace behavior, so use the steps below only on `main` or on a newer ref that already contains the plugin manifests and public docs mentioned here. The marketplace entry points at the packaged `plugins/codex-orchestrator` directory, and the installed plugin uses a small `node` launcher to resolve the marketplace runtime root from `${CODEX_HOME:-~/.codex}/config.toml`: local-directory sources run from the recorded source path, while Git-backed sources run from Codex's installed checkout under `${CODEX_HOME:-~/.codex}/.tmp/marketplaces/codex-orchestrator`. That keeps the MCP registration path independent of a second `codex-orchestrator` PATH entry. If you move or replace a local-directory source, or remove Codex's installed marketplace checkout, re-run `codex plugin marketplace add ...` before using the plugin again. Then open `/plugins` in Codex, install `Codex Orchestrator`, and restart Codex if it does not pick up the plugin immediately. Use the plugin browser's uninstall action to remove the plugin, `codex plugin marketplace remove codex-orchestrator` to remove the marketplace registration, or set the plugin entry in `${CODEX_HOME:-~/.codex}/config.toml` to `enabled = false` to turn it off without uninstalling.
53
38
 
54
- Use this when you want Codex to drive work inside another repo with the CO defaults.
39
+ ## 2-minute quickstart (current `main`)
55
40
 
56
- 1. Install templates:
41
+ 1. Install the downstream repo templates:
57
42
  ```bash
58
43
  codex-orchestrator init codex --cwd /path/to/repo
59
44
  ```
60
- One-shot (templates + optional CO-managed Codex CLI install):
45
+ 2. Configure bundled skills plus delegation and DevTools wiring once per machine:
61
46
  ```bash
62
- codex-orchestrator init codex --codex-cli --yes
47
+ codex-orchestrator setup --yes
63
48
  ```
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):
49
+ 3. Log in to Codex. If browser login is not available, use device auth:
66
50
  ```bash
67
- codex mcp add delegation -- codex-orchestrator delegate-server --repo /path/to/repo
51
+ codex login
52
+ # Fallback
53
+ codex login --device-auth
68
54
  ```
69
- 3. Optional (managed/pinned CLI path): set up a CO-managed Codex CLI:
55
+ 4. Run the default docs-first flow inside your repo:
70
56
  ```bash
71
- codex-orchestrator codex setup
57
+ codex-orchestrator flow --task <task-id>
72
58
  ```
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:
59
+ 5. Check local readiness:
75
60
  ```bash
76
- export CODEX_CLI_USE_MANAGED=1
61
+ codex-orchestrator doctor --format json
77
62
  ```
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.
97
63
 
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
- ```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
- ```
64
+ ## Downstream setup
136
65
 
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.
66
+ These guides are current source-head docs in this checkout. Readers pinned to older releases such as `v0.1.38` should treat them as source-head-only unless they are reading a matching newer tag or source ref that already includes these files.
164
67
 
165
- ## Delegation + RLM flow
68
+ - [docs/public/downstream-setup.md](docs/public/downstream-setup.md): install, repo bootstrap, machine setup, and first-run flow
69
+ - [docs/public/provider-onboarding.md](docs/public/provider-onboarding.md): Linear and Telegram onboarding, env vars, policy examples, readiness, and smoke flow
166
70
 
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.
71
+ `init codex` also seeds provider examples under `.codex/providers/` so fresh repos do not need to hand-author the first env and policy files from scratch.
171
72
 
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
187
- ```
188
-
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"]
73
+ ## Common commands
200
74
 
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
75
+ ```bash
76
+ codex-orchestrator flow --task <task-id>
77
+ codex-orchestrator review --task <task-id>
78
+ codex-orchestrator doctor --usage --window-days 30
79
+ codex-orchestrator start diagnostics --task <task-id> --format json
80
+ codex-orchestrator co-status
81
+ codex-orchestrator control-host supervise status --format json
207
82
  ```
208
83
 
209
84
  ## Skills (bundled)
210
85
 
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
- ```
86
+ Install bundled skills into `$CODEX_HOME/skills`:
217
87
 
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
88
  ```bash
220
89
  codex-orchestrator skills install
221
90
  ```
222
91
 
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.
92
+ Bundled skills:
227
93
 
228
- Bundled skills (may vary by release):
94
+ - `agent-first-adoption-steering`
95
+ - `chrome-devtools`
229
96
  - `codex-orchestrator`
97
+ - `collab-deliberation`
98
+ - `collab-evals`
230
99
  - `collab-subagents-first`
231
- - `chrome-devtools`
100
+ - `delegate-early`
232
101
  - `delegation-usage`
233
- - `standalone-review`
234
- - `elegance-review`
235
102
  - `docs-first`
236
- - `collab-evals`
237
- - `collab-deliberation`
103
+ - `elegance-review`
104
+ - `land`
105
+ - `linear`
238
106
  - `long-poll-wait`
239
107
  - `release`
240
- - `agent-first-adoption-steering`
241
- - `delegate-early` (compatibility alias; use `delegation-usage`)
242
-
243
- ## DevTools readiness
244
-
245
- Check readiness (deps + capability wiring):
246
- ```bash
247
- codex-orchestrator doctor --format json
248
- ```
249
-
250
- Auto-fix wiring (delegation + DevTools):
251
- ```bash
252
- codex-orchestrator doctor --apply --yes
253
- ```
254
-
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`.
261
-
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).
267
-
268
- Auto-capture issue bundles when runs fail:
269
- ```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).
274
-
275
- Cloud preflight check (without starting a pipeline):
276
- ```bash
277
- codex-orchestrator doctor --cloud-preflight
278
- ```
279
-
280
- ## Downstream usage cheatsheet (agent-first)
281
-
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`
299
-
300
- Print DevTools MCP setup guidance:
301
- ```bash
302
- codex-orchestrator devtools setup
303
- ```
304
-
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
108
+ - `standalone-review`
333
109
 
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)
110
+ ## Public posture
342
111
 
343
- ## RLM benchmark graphs
112
+ - Current Codex CLI target: `0.123.0`
113
+ - Current model posture: `gpt-5.4`
114
+ - `explorer_fast` remains the explicit `gpt-5.3-codex-spark` file/codebase search-only exception
115
+ - Local default runtime: `appserver`
116
+ - `executionMode=cloud` with explicit `runtimeMode=appserver` remains unsupported
344
117
 
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.
118
+ ## Contributing
346
119
 
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>
120
+ Contributor and repo-internal guidance lives in the source repository:
121
+ [docs/README.md](https://github.com/Kbediako/CO/blob/main/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
+ }