@kbediako/codex-orchestrator 0.1.12 → 0.1.14-alpha.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 (38) hide show
  1. package/LICENSE +19 -5
  2. package/README.md +47 -2
  3. package/dist/bin/codex-orchestrator.js +93 -0
  4. package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +27 -3
  5. package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +17 -1
  6. package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +36 -1
  7. package/dist/orchestrator/src/cli/adapters/CommandTester.js +28 -0
  8. package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +45 -0
  9. package/dist/orchestrator/src/cli/codexCliSetup.js +294 -0
  10. package/dist/orchestrator/src/cli/init.js +3 -0
  11. package/dist/orchestrator/src/cli/mcp.js +4 -2
  12. package/dist/orchestrator/src/cli/orchestrator.js +298 -28
  13. package/dist/orchestrator/src/cli/rlm/context.js +31 -3
  14. package/dist/orchestrator/src/cli/rlm/symbolic.js +152 -15
  15. package/dist/orchestrator/src/cli/rlmRunner.js +59 -5
  16. package/dist/orchestrator/src/cli/run/manifest.js +3 -0
  17. package/dist/orchestrator/src/cli/services/commandRunner.js +87 -0
  18. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +24 -0
  19. package/dist/orchestrator/src/cli/skills.js +1 -1
  20. package/dist/orchestrator/src/cli/utils/codexCli.js +94 -0
  21. package/dist/orchestrator/src/cli/utils/codexPaths.js +13 -0
  22. package/dist/orchestrator/src/cli/utils/devtools.js +9 -12
  23. package/dist/orchestrator/src/cloud/CodexCloudTaskExecutor.js +255 -0
  24. package/dist/orchestrator/src/learning/crystalizer.js +2 -1
  25. package/dist/orchestrator/src/manager.js +1 -0
  26. package/dist/orchestrator/src/sync/CloudSyncWorker.js +37 -7
  27. package/dist/scripts/design/pipeline/context.js +3 -2
  28. package/dist/scripts/lib/run-manifests.js +14 -0
  29. package/docs/README.md +22 -2
  30. package/package.json +6 -2
  31. package/schemas/manifest.json +83 -0
  32. package/skills/collab-deliberation/SKILL.md +21 -0
  33. package/skills/collab-evals/SKILL.md +32 -0
  34. package/skills/delegate-early/SKILL.md +47 -0
  35. package/skills/delegation-usage/DELEGATION_GUIDE.md +5 -4
  36. package/skills/delegation-usage/SKILL.md +11 -5
  37. package/skills/docs-first/SKILL.md +2 -1
  38. package/templates/README.md +4 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: delegate-early
3
+ description: Spawn subagents early and often to conserve context and parallelize research, review, and planning.
4
+ ---
5
+
6
+ # Delegate Early
7
+
8
+ Use this skill when a task can be split into parallel streams or when the main context risks ballooning. The top-level Codex remains the lead; subagents are assistants.
9
+
10
+ ## Goals
11
+ - Conserve primary context by offloading research/review/planning.
12
+ - Improve throughput with parallel subagent streams.
13
+ - Capture delegation evidence for auditability.
14
+
15
+ ## When to spawn
16
+ - Before deep reading/analysis to avoid bloating context.
17
+ - When new ambiguity appears or scope changes.
18
+ - For independent streams (research, review, planning, edge cases).
19
+
20
+ ## Task slicing heuristic
21
+ - Identify 2–4 independent streams with minimal shared context.
22
+ - Prefer streams like: `research`, `review`, `spec-check`, `edge-cases`.
23
+
24
+ ## Required conventions
25
+ - Use `MCP_RUNNER_TASK_ID=<task-id>-<stream>` for subagents.
26
+ - Record manifest paths and summarize findings in the main run.
27
+ - Run `node scripts/delegation-guard.mjs` before review handoff to verify delegation evidence.
28
+
29
+ ## Minimal delegation workflow
30
+ 1) Name streams and write 1–2 sentence goals for each.
31
+ 2) Spawn subagents with clear, bounded prompts.
32
+ 3) Wait for subagent completion; retrieve manifest evidence and summarize findings into the main plan.
33
+ 4) Proceed with implementation.
34
+
35
+ ## Prompt patterns
36
+ - Research: “Find X, cite Y, return 3 bullets + risks.”
37
+ - Review: “Inspect files A/B for regressions; list issues by severity.”
38
+ - Planning: “Draft a 3–5-step plan, call out unknowns.”
39
+
40
+ ## Escalation rules
41
+ - If delegation is impossible, set `DELEGATION_GUARD_OVERRIDE_REASON` and document it in the task checklist.
42
+
43
+ ## Subagent summary format
44
+ - **Findings**: Key results and conclusions from the subagent run
45
+ - **Risks**: Issues, blockers, or concerns
46
+ - **Open questions**: Unresolved items requiring follow-up
47
+ - **Evidence**: Manifest path (e.g., `.runs/<task-id>-<stream>/cli/<timestamp>/manifest.json`)
@@ -8,6 +8,7 @@ Use this guide for deeper context on delegation behavior, tool surfaces, and tro
8
8
  - It does **not** provide general tools itself; it only exposes `delegate.*` + optional `github.*` tools.
9
9
  - Child runs get tools based on `delegate.mode` + `delegate.tool_profile` + repo caps.
10
10
  - Delegation MCP stays enabled by default (only MCP on by default); disable it only when required by safety constraints.
11
+ - Collab multi-agent mode is separate from delegation; for symbolic RLM subcalls, set `RLM_SYMBOLIC_COLLAB=1` and ensure a collab-capable Codex CLI. Collab tool calls are recorded in `manifest.collab_tool_calls`. If collab tools are unavailable in your CLI build, skip collab steps; delegation still works independently.
11
12
 
12
13
  ## Background-run pattern (preferred)
13
14
 
@@ -105,12 +106,12 @@ If you need delegation to respect a repo’s `.codex/orchestrator.toml` (e.g., s
105
106
 
106
107
  ## Version guard (JSONL handshake)
107
108
 
108
- Delegation MCP expects JSONL. Use `codex-orchestrator >= 0.1.8`.
109
+ Delegation MCP expects JSONL. Use `codex-orchestrator` 0.1.12 or newer.
109
110
 
110
111
  - Check: `codex-orchestrator --version`
111
- - Update global: `npm i -g @kbediako/codex-orchestrator@0.1.8`
112
- - Or pin via npx: `npx -y @kbediako/codex-orchestrator@0.1.8 delegate-server`
113
- - If your installed CLI is behind the docs (e.g., 0.1.11 while docs target a newer release), use the pinned `npx` version or upgrade after the release ships.
112
+ - Update global: `npm i -g @kbediako/codex-orchestrator@0.1.12`
113
+ - Or pin via npx: `npx -y @kbediako/codex-orchestrator@0.1.12 delegate-server`
114
+ - If your installed CLI is behind 0.1.12, prefer upgrading or pinning to the docs’ minimum.
114
115
 
115
116
  ## Common failures
116
117
 
@@ -9,6 +9,8 @@ description: Use when operating the Codex delegation MCP server and tools (deleg
9
9
 
10
10
  Use this skill to operate delegation MCP tools with delegation enabled by default (the only MCP on by default). Disable it only when required by safety constraints, and keep other MCPs off unless they are relevant to the task.
11
11
 
12
+ Collab multi-agent mode is separate from delegation. For symbolic RLM subcalls that use collab tools, set `RLM_SYMBOLIC_COLLAB=1` and ensure a collab-capable Codex CLI; collab tool calls are recorded in `manifest.collab_tool_calls`. If collab tools are unavailable in your CLI build, skip collab steps; delegation still works independently.
13
+
12
14
  ## Quick-start workflow (canned)
13
15
 
14
16
  Use this when delegation tools are missing in the current run (MCP disabled) and you want a background Codex run to handle delegation:
@@ -62,11 +64,12 @@ For runner + delegation coordination (short `--task` flow), see `docs/delegation
62
64
 
63
65
  ### 0a) Version guard (JSONL handshake)
64
66
 
65
- - Delegation MCP uses JSONL; ensure the server binary is **0.1.8+**:
66
- - `codex-orchestrator --version` should be `>= 0.1.8`
67
- - If not, update global install: `npm i -g @kbediako/codex-orchestrator@0.1.8`
68
- - Alternative: pin the MCP server to `npx -y @kbediako/codex-orchestrator@0.1.8` for deterministic behavior.
69
- - Note: if your installed CLI is older than the docs (e.g., 0.1.11 while docs target a newer release), use the pinned `npx` version or upgrade after the release ships.
67
+ - Delegation MCP uses JSONL; ensure the server binary meets the docs’ minimum version (0.1.12):
68
+ - `codex-orchestrator --version` should be `>= 0.1.12`.
69
+ - If not, update global install: `npm i -g @kbediako/codex-orchestrator@0.1.12`
70
+ - Alternative: pin the MCP server to `npx -y @kbediako/codex-orchestrator@0.1.12` for deterministic behavior.
71
+ - Note: if your installed CLI is older than 0.1.12, prefer upgrading or pinning to the docs’ minimum.
72
+ - Keep the version pins in this section in sync with the docs’ minimum (currently 0.1.12).
70
73
 
71
74
  ### 0b) Background terminal bootstrap (required when MCP is disabled)
72
75
 
@@ -83,6 +86,7 @@ Guidance for background runs:
83
86
  - Use `--json` for JSONL events, or `-o <path>` to write the final message to a file while still printing to stdout.
84
87
  - If you need a multi-step run, use `codex exec resume --last "<follow-up>"` to continue the same session.
85
88
  - Non-interactive runs can still hit `confirmation_required`; approvals happen via the UI/TUI and the run resumes after approval.
89
+ - Use this only for non-manifest evidence; for manifest-required workflows, use `codex-orchestrator start ...`.
86
90
  - `codex exec` does **not** create an orchestrator manifest. If the child must call `delegate.question.*` or `delegate.status/pause/cancel`, pass a real `.runs/<task>/cli/<run>/manifest.json` via `parent_manifest_path`/`manifest_path` (e.g., run `codex-orch start diagnostics --format json --task <task-id>` to get one; or use `export MCP_RUNNER_TASK_ID=<task-id>` if you prefer env vars).
87
91
  - Setting `MCP_RUNNER_TASK_ID` does not cause `codex exec` to emit `.runs/**` manifests; use `codex-orchestrator start <pipeline> --task <id>` when manifest evidence is required.
88
92
 
@@ -106,6 +110,7 @@ Guidance for background runs:
106
110
  - If the repo omits `delegate.allowed_tool_servers`, the cap defaults to `[]` and extra tools are ignored.
107
111
  - Names must match `^[A-Za-z0-9_-]+$`; invalid entries (e.g., `;`, `/`, `\n`, `=`) are ignored.
108
112
  - `github.*` tools are not gated by `delegate.tool_profile`; they are controlled by repo GitHub allowlists.
113
+ - If the child cannot access expected tools, recheck repo `delegate.allowed_tool_servers` (it may have changed).
109
114
  - Keep `delegate.tool_profile` minimal; avoid networked tools unless required.
110
115
  - Nested delegation is off by default; only use `full` when `delegate.allow_nested=true` and you intend recursion.
111
116
  - **Important:** `delegate.mode` (server tool surface) is different from `delegate_mode` (input to `delegate.spawn` for the *child* run).
@@ -153,6 +158,7 @@ repeat:
153
158
 
154
159
  - **Long waits:** `wait_ms` never blocks longer than 10s per call; use polling.
155
160
  - **Long-running delegate.spawn:** Prefer `start_only=true` (default) to avoid tool-call timeouts. If you must use `start_only=false`, keep runs short or run long jobs outside delegation (no question queue).
161
+ - **Cloud run branch mismatch:** cloud-mode orchestration against a local-only branch can fail with `couldn't find remote ref ...`; set `CODEX_CLOUD_BRANCH` to a pushed branch (typically `main`) before cloud execution.
156
162
  - **Tool profile mismatch:** child tool profile must be allowed by repo policy; invalid or unsafe names are ignored.
157
163
  - **Confirmation misuse:** never pass `confirm_nonce` from model/tool input; it is runner‑injected only.
158
164
  - **Secrets exposure:** never include secrets/tokens/PII in delegate prompts or files.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: docs-first
3
- description: Use when a task requires a spec-driven workflow: draft/refresh PRD + TECH_SPEC + ACTION_PLAN + tasks, link TECH_SPEC in tasks/index.json, and run docs-review before implementation.
3
+ description: "Use when a task requires a spec-driven workflow: draft/refresh PRD + TECH_SPEC + ACTION_PLAN + tasks, link TECH_SPEC in tasks/index.json, and run docs-review before implementation."
4
4
  ---
5
5
 
6
6
  # Docs-First (Spec-Driven)
@@ -25,6 +25,7 @@ Use this skill when a task needs a spec-driven workflow. The objective is to cre
25
25
 
26
26
  3) Run docs-review before implementation
27
27
  - `npx codex-orchestrator start docs-review --format json --no-interactive --task <task-id>`
28
+ - If running in cloud mode, ensure the branch exists on remote. For local-only branches, set `CODEX_CLOUD_BRANCH=main` (or another pushed branch).
28
29
  - Link the manifest path in the checklists.
29
30
 
30
31
  4) Implement and validate
@@ -10,3 +10,7 @@ initializer:
10
10
 
11
11
  The initializer copies the contents of templates/codex/ into your working
12
12
  repository and will not overwrite files unless you pass --force.
13
+
14
+ Next steps (recommended):
15
+ codex mcp add delegation -- codex-orchestrator delegate-server --repo /path/to/repo
16
+ codex-orchestrator codex setup # optional: CO-managed Codex CLI for collab JSONL