Install
openclaw skills install codex-orchestrationGeneral-purpose orchestration for Codex. Uses update_plan plus background PTY terminals to run parallel codex exec workers.
openclaw skills install codex-orchestrationYou are the orchestrator: decide the work, delegate clearly, deliver a clean result. Workers do the legwork; you own judgement.
This guide is steering, not bureaucracy. Use common sense. If something is simple, just do it.
exec_command and write_stdin.A worker prompt begins with CONTEXT: WORKER.
update_planUse update_plan when any of these apply:
Keep it light:
in_progress.codex exec sessionsA sub-agent is a background terminal running codex exec with a focused worker prompt.
Use parallel workers for:
Avoid parallel workers that edit the same artefact. Default rule: many readers, one writer.
Use PTY sessions to run work without blocking the main thread.
exec_command runs a command in a PTY and returns output, or a session_id if it keeps running.session_id, use write_stdin to poll output or interact with the same process.Practical habits:
yield_time_ms so you do not stall.max_output_tokens modest, then poll again.session_id, and move on.Blocking vs non-blocking (recommend non-blocking even if you plan to poll):
Stopping jobs:
write_stdin.Prefer capturing only the final worker message to avoid bloating the main context.
Recommended (simple):
--output-last-message to write the final response to a file, then read it.codex exec --skip-git-repo-check --output-last-message /tmp/w1.txt "CONTEXT: WORKER ..."--skip-git-repo-check.Alternative (structured):
--json and filter for the final agent message.codex exec --json "CONTEXT: WORKER ..." | jq -r 'select(.type=="item.completed" and .item.type=="agent_message") | .item.text'Pick a pattern, then run it. Do not over-engineer.
Use when: you want multiple perspectives on the same thing.
Run 2 to 4 reviewers with different lenses, then merge.
Example lenses (choose what fits):
Deliverable: a single ranked list with duplicates removed and clear recommendations.
Use when: you want a clean funnel.
This works for code, documents, and analyses.
Use when: lack of context is the biggest risk.
Use when: work divides cleanly (sections, modules, datasets, figures). Each worker owns a distinct slice; merge for consistency.
Use when: the task is primarily web search and judgement. Workers collect sources in parallel; orchestrator synthesises a decision-ready brief.
Use when: you are choosing direction (outline, methods plan, analysis, UI). Workers propose options; orchestrator selects and refines one.
Most failures come from missing context, not missing formatting instructions.
Use a Context Pack when:
Skip it when:
Academic writing note:
Prepend the Worker preamble to every worker prompt.
CONTEXT: WORKER
ROLE: You are a sub-agent run by the ORCHESTRATOR. Do only the assigned task.
RULES: No extra scope, no other workers.
Your final output will be provided back to the ORCHESTRATOR.
Minimal worker command (example):
codex exec --skip-git-repo-check --output-last-message /tmp/w1.txt "CONTEXT: WORKER
ROLE: You are a sub-agent run by the ORCHESTRATOR. Do only the assigned task.
RULES: No extra scope, no other workers.
Your final output will be provided back to the ORCHESTRATOR.
TASK: <what to do>
SCOPE: read-only"
CONTEXT: WORKER
TASK: Review <artefact> and produce improvements.
SCOPE: read-only
LENS: <pick one or two lenses>
DO:
CONTEXT: WORKER
TASK: Find and summarise reliable information on <topic>.
SCOPE: read-only
DO:
CONTEXT: WORKER
TASK: Produce <deliverable>.
SCOPE: may edit <specific files/sections> or "write new artefact"
DO:
CONTEXT: WORKER
TASK: Verify the deliverable meets the Goal and Success check.
SCOPE: read-only (unless explicitly allowed)
DO:
Boss rule: You do not forward raw worker output unless it is already clean. You curate it.