@kbediako/codex-orchestrator 0.1.31 → 0.1.33

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 (32) hide show
  1. package/README.md +79 -9
  2. package/dist/bin/codex-orchestrator.js +671 -66
  3. package/dist/orchestrator/src/cli/codexCliSetup.js +1 -0
  4. package/dist/orchestrator/src/cli/doctor.js +186 -7
  5. package/dist/orchestrator/src/cli/doctorUsage.js +150 -8
  6. package/dist/orchestrator/src/cli/init.js +1 -1
  7. package/dist/orchestrator/src/cli/mcpEnable.js +392 -0
  8. package/dist/orchestrator/src/cli/orchestrator.js +161 -2
  9. package/dist/orchestrator/src/cli/rlmRunner.js +289 -35
  10. package/dist/orchestrator/src/cli/run/manifest.js +31 -6
  11. package/dist/orchestrator/src/cli/services/commandRunner.js +10 -2
  12. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +35 -0
  13. package/dist/orchestrator/src/cli/skills.js +3 -8
  14. package/dist/orchestrator/src/cli/utils/advancedAutopilot.js +114 -0
  15. package/dist/orchestrator/src/cli/utils/codexCli.js +21 -0
  16. package/dist/orchestrator/src/cli/utils/delegationGuardRunner.js +85 -8
  17. package/dist/orchestrator/src/cli/utils/specGuardRunner.js +79 -19
  18. package/dist/orchestrator/src/cloud/CodexCloudTaskExecutor.js +25 -6
  19. package/dist/orchestrator/src/control-plane/request-builder.js +9 -8
  20. package/dist/scripts/lib/pr-watch-merge.js +493 -4
  21. package/docs/README.md +7 -5
  22. package/package.json +1 -1
  23. package/schemas/manifest.json +27 -0
  24. package/skills/collab-deliberation/SKILL.md +6 -0
  25. package/skills/collab-evals/SKILL.md +4 -0
  26. package/skills/collab-subagents-first/SKILL.md +29 -7
  27. package/skills/delegation-usage/DELEGATION_GUIDE.md +31 -5
  28. package/skills/delegation-usage/SKILL.md +29 -4
  29. package/skills/elegance-review/SKILL.md +14 -3
  30. package/skills/standalone-review/SKILL.md +8 -2
  31. package/templates/README.md +1 -1
  32. package/templates/codex/AGENTS.md +12 -1
package/README.md CHANGED
@@ -47,7 +47,7 @@ Use this when you want Codex to drive work inside another repo with the CO defau
47
47
  ```bash
48
48
  codex-orchestrator init codex --cwd /path/to/repo
49
49
  ```
50
- One-shot (templates + CO-managed Codex CLI):
50
+ One-shot (templates + optional CO-managed Codex CLI install):
51
51
  ```bash
52
52
  codex-orchestrator init codex --codex-cli --yes
53
53
  ```
@@ -59,7 +59,11 @@ Use this when you want Codex to drive work inside another repo with the CO defau
59
59
  ```bash
60
60
  codex-orchestrator codex setup
61
61
  ```
62
- Use this when you want a pinned binary, build-from-source behavior, or a custom fork. Stock `codex` works for default flows.
62
+ Use this when you want a pinned binary, build-from-source behavior, or a custom fork.
63
+ Stock/global `codex` is still the default selection; activate managed binary routing with:
64
+ ```bash
65
+ export CODEX_CLI_USE_MANAGED=1
66
+ ```
63
67
  4. Optional (fast refresh helper for downstream users):
64
68
  ```bash
65
69
  scripts/codex-cli-refresh.sh --repo /path/to/codex --align-only
@@ -81,6 +85,58 @@ codex -c 'mcp_servers.delegation.enabled=true' ...
81
85
  ```
82
86
  `delegate-server` is the canonical name; `delegation-server` is supported as an alias (older docs may use it).
83
87
 
88
+ ## Agent role defaults (recommended)
89
+
90
+ Codex built-ins are `default`, `explorer`, and `worker`. `researcher` is user-defined.
91
+ - `spawn_agent` defaults to `default` when `agent_type` is omitted, so always set `agent_type` explicitly when using collab subagents.
92
+
93
+ Built-in `explorer` in Codex currently uses `gpt-5.1-codex-mini` with `medium` reasoning unless you override it. If you want latest-codex defaults end-to-end, add role overrides in `~/.codex/config.toml`:
94
+
95
+ ```toml
96
+ model = "gpt-5.3-codex"
97
+ model_reasoning_effort = "xhigh"
98
+
99
+ [agents]
100
+ max_threads = 8
101
+
102
+ [agents.explorer]
103
+ description = "Explorer role override (no config_file): keep built-in explorer on top-level model defaults."
104
+
105
+ [agents.explorer_fast]
106
+ description = "Fast explorer (spark text-only)."
107
+ config_file = "/absolute/path/to/.codex/agents/explorer-fast.toml"
108
+
109
+ [agents.explorer_detailed]
110
+ description = "Detailed explorer."
111
+ config_file = "/absolute/path/to/.codex/agents/explorer-detailed.toml"
112
+
113
+ [agents.worker_complex]
114
+ description = "Complex worker role."
115
+ config_file = "/absolute/path/to/.codex/agents/worker-complex.toml"
116
+ ```
117
+
118
+ ```toml
119
+ # ~/.codex/agents/explorer-fast.toml
120
+ model = "gpt-5.3-codex-spark"
121
+ model_reasoning_effort = "xhigh"
122
+ ```
123
+
124
+ ```toml
125
+ # ~/.codex/agents/explorer-detailed.toml
126
+ model = "gpt-5.3-codex"
127
+ model_reasoning_effort = "high"
128
+ ```
129
+
130
+ ```toml
131
+ # ~/.codex/agents/worker-complex.toml
132
+ model = "gpt-5.3-codex"
133
+ model_reasoning_effort = "xhigh"
134
+ ```
135
+
136
+ Caveats:
137
+ - `gpt-5.3-codex-spark` is text-only (no image inputs). Keep it for fast search/synthesis.
138
+ - Use `max_threads = 8` as a balanced default; only move to `12` after verifying your machine/tooling stays stable under higher concurrency.
139
+
84
140
  Delegation guard profile:
85
141
  - `CODEX_ORCHESTRATOR_GUARD_PROFILE=auto` (default): strict in CO-style repos, warn in lightweight repos.
86
142
  - Set `CODEX_ORCHESTRATOR_GUARD_PROFILE=warn` for ad-hoc/no-task-id runs.
@@ -88,8 +144,8 @@ Delegation guard profile:
88
144
 
89
145
  ## Delegation + RLM flow
90
146
 
91
- 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 when delegated, when `RLM_CONTEXT_PATH` is set, or when the context exceeds `RLM_SYMBOLIC_MIN_BYTES`; 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.
92
- Symbolic subcalls can optionally use collab tools. Fast path: `codex-orchestrator rlm --collab auto "<goal>"` (sets `RLM_SYMBOLIC_COLLAB=1` and implies symbolic mode). Collab requires `collab=true` in `codex features list`. Collab tool calls parsed from `codex exec --json --enable collab` are stored in `manifest.collab_tool_calls` (bounded by `CODEX_ORCHESTRATOR_COLLAB_MAX_EVENTS`, set to `0` to disable). `codex-orchestrator codex setup` remains available when you want a managed/pinned CLI path.
147
+ 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.
148
+ 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). 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`).
93
149
 
94
150
  ### Delegation flow
95
151
  ```mermaid
@@ -133,6 +189,8 @@ flowchart TB
133
189
  Recommended one-shot bootstrap (skills + delegation + DevTools wiring):
134
190
  ```bash
135
191
  codex-orchestrator setup --yes
192
+ # Optional: overwrite existing bundled skills in $CODEX_HOME/skills
193
+ # codex-orchestrator setup --yes --refresh-skills
136
194
  ```
137
195
 
138
196
  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`:
@@ -172,14 +230,24 @@ Usage snapshot (scans local `.runs/`):
172
230
  ```bash
173
231
  codex-orchestrator doctor --usage
174
232
  ```
233
+ `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.
234
+
235
+ Cloud preflight check (without starting a pipeline):
236
+ ```bash
237
+ codex-orchestrator doctor --cloud-preflight
238
+ ```
175
239
 
176
240
  ## Downstream usage cheatsheet (agent-first)
177
241
 
178
- - Bootstrap + wire everything: `codex-orchestrator setup --yes`
242
+ - Bootstrap + wire everything: `codex-orchestrator setup --yes` (non-destructive for existing skills by default; add `--refresh-skills` to overwrite)
243
+ - 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)
244
+ - Low-friction docs->implementation guardrails: `codex-orchestrator flow --task <task-id>`
179
245
  - Validate + measure adoption locally: `codex-orchestrator doctor --usage --format json`
180
246
  - Delegation: `codex-orchestrator doctor --apply --yes`, then enable for a Codex run with: `codex -c 'mcp_servers.delegation.enabled=true' ...`
181
- - Collab (symbolic RLM subagents): `codex-orchestrator rlm --collab auto "<goal>"` (requires collab feature enabled in Codex)
247
+ - Collab (symbolic RLM subagents): `codex-orchestrator rlm --multi-agent auto "<goal>"` (legacy alias: `--collab auto`; requires Codex `features.multi_agent=true`)
182
248
  - Cloud: set `CODEX_CLOUD_ENV_ID` (and optional `CODEX_CLOUD_BRANCH`), then run: `codex-orchestrator start <pipeline> --cloud --target <stage-id>`
249
+ - Cloud fail-fast (avoid fallback reliance): set `CODEX_ORCHESTRATOR_CLOUD_FALLBACK=deny`
250
+ - Cloud status retry tuning (optional): `CODEX_CLOUD_STATUS_RETRY_LIMIT`, `CODEX_CLOUD_STATUS_RETRY_BACKOFF_MS`
183
251
 
184
252
  Print DevTools MCP setup guidance:
185
253
  ```bash
@@ -189,14 +257,16 @@ codex-orchestrator devtools setup
189
257
  ## Common commands
190
258
 
191
259
  - `codex-orchestrator start <pipeline>` — run a pipeline.
260
+ - `codex-orchestrator flow --task <task-id>` — run `docs-review` then `implementation-gate` in sequence.
192
261
  - `codex-orchestrator plan <pipeline>` — preview pipeline stages.
193
262
  - `codex-orchestrator exec <cmd>` — run a one-off command with the exec runtime.
194
263
  - `codex-orchestrator init codex` — install starter templates (`mcp-client.json`, `AGENTS.md`) into a repo.
195
- - `codex-orchestrator setup --yes` — install bundled skills and configure delegation + DevTools wiring.
196
- - `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).
264
+ - `codex-orchestrator setup --yes` — install bundled skills and configure delegation + DevTools wiring (add `--refresh-skills` to overwrite existing skills in `$CODEX_HOME/skills`).
265
+ - `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).
197
266
  - `codex-orchestrator init codex --codex-cli --yes --codex-download-url <url> --codex-download-sha256 <sha>` — opt-in to a prebuilt Codex CLI download.
198
- - `codex-orchestrator codex setup` — plan/apply a CO-managed Codex CLI install (optional managed/pinned path; use `--download-url` + `--download-sha256` for prebuilts).
267
+ - `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`).
199
268
  - `codex-orchestrator delegation setup --yes` — configure delegation MCP server wiring.
269
+ - `codex-orchestrator mcp enable --servers <csv> --yes` — enable specific disabled MCP servers from existing Codex config entries.
200
270
  - `codex-orchestrator self-check --format json` — JSON health payload.
201
271
  - `codex-orchestrator mcp serve` — Codex MCP stdio server.
202
272