multi-codex-orchestration
Use when the user explicitly wants multiple Codex agents or a virtual team, the work can be decomposed into safe parallel roles, and tgtool should coordinate a Ruflo-backed orchestration path.
SKILL.mdskills/multi-codex-orchestration/SKILL.md
GitHubMulti-Codex Orchestration
Overview
Use this skill when a task should be executed by multiple Codex agents under a single routed session.
This skill does not replace tgtool. It provides the Ruflo-backed orchestration method that tgtool can route into.
Default backend:
ruflo
When to Use
Use when all of these are true:
- the user explicitly wants multiple Codex agents, a virtual team, or parallel agent execution
- the task can be decomposed into 2+ relatively independent roles
- safe ownership boundaries can be defined
- sequential single-agent execution would be materially worse
Prefer a token-aware role set:
- start with only
operatoras the active role - keep
criticdormant until a failure, stage transition, or explicit review/feedback demand appears - do not send the same long context to multiple workers unless the output is genuinely different
Typical role set:
operatorcritic- optional extra specialist only when the task truly needs one
Do Not Use
Do not use when any of these are true:
- the task is tiny or obviously faster in one session
- write ownership would overlap in unsafe ways
- the work is pure read-only diagnosis without real parallel value
- strict read-only mode leaves no meaningful orchestration path
- the task is so coupled that role splitting would be artificial
Ruflo Backend
Helper assets included in this skill:
scripts/ensure_ruflo_init.pyto detect or initializerufloCodex/runtime statescripts/bootstrap_ruflo_backend.pyto automatically chain init and swarm bootstrap forrufloscripts/probe_ruflo_execution.pyto shell-check thatruflocan create a swarm, spawn an agent, create a task, and assign itscripts/launch_explicit_tmux.pyto launch visible2 paneorchestration (operator + critic) and auto-try foreground popup
Supporting References
For implementation details, also see:
docs/ruflo-init-playbook.mddocs/ruflo-runtime-bootstrap-playbook.mddocs/ruflo-execution-playbook.mdscripts/ensure_ruflo_init.pyscripts/bootstrap_ruflo_backend.pyscripts/probe_ruflo_execution.pyscripts/launch_explicit_tmux.py
Process
1. Confirm orchestration eligibility
Before spawning any role, confirm:
- the task really benefits from parallel work
- the role split is meaningful
- write scopes can be kept disjoint
- the selected mode and safety boundaries still allow orchestration
If not, fall back instead of forcing orchestration.
2. Choose the smallest safe role set
Use the smallest role set that can safely move the task forward.
Conservative default:
- one active
operator - one dormant
critic - add an extra specialist only when discovery or review cannot be covered by that pair
3. Define ownership explicitly
For each role, state:
- what it owns
- what it must not edit
- what output it must return
Reject orchestration if ownership cannot be made clear enough.
4. Bootstrap the selected backend automatically
When the user explicitly wants a ruflo backend or asks to initialize orchestration runtime state:
- run
scripts/bootstrap_ruflo_backend.pyfirst - let it ensure Codex integration if missing
- let it ensure runtime state if missing
- let it initialize a swarm through
ruflo swarm init --v3-mode - keep daemon startup optional instead of making it part of the default chain
- after bootstrap, prefer the current session's
claude_floworchestration tools for actual execution:- initialize the working swarm
- start with only
operatoras the default active role - let
operatorown concrete execution - keep
criticpassive by default - wake
criticonly on failure, stage transition, or explicit review/feedback demand - spawn additional roles only when the task actually needs them
- create tasks
- assign tasks
- monitor swarm/task/agent status
- treat raw
rufloCLI execution as a bootstrap and shell-side probe layer; do not rely onruflo swarm startalone to mean real work is already being driven inside the current Codex session - use
scripts/probe_ruflo_execution.pywhen you need a local shell sanity check that therufloCLI path can at least create the basic swarm/agent/task primitives cleanly
5. Execute through the Ruflo backend when explicitly selected
If the user explicitly selects ruflo:
- bootstrap runtime state first
- then execute the live orchestration through the current session's
claude_flowtools instead of stopping at CLI initialization - prefer this minimal execution chain:
- initialize swarm
- spawn only
operatorby default - keep
criticdormant until failure, phase change, or explicit review/feedback demand - let
operatorexecute and letcriticact as an on-demand planning/verification/feedback role - wake extra roles only if a real branch appears that cannot be covered by that policy
- create tracked tasks
- assign tasks to those agents
- poll task/agent/swarm status until the main session can summarize progress
- only use the shell probe script to validate the local CLI boundary, not as the main long-running worker path
6. Normalize results
Collect per-role outputs into a stable result shape:
- orchestration session id
- backend used
- roles spawned
- per-role status
- blockers
- merged summary
- fallback recommendation if needed
Return the merged result back into the active tgtool session.
7. Visible tmux mode (explicit execution)
When the user asks for explicit execution:
- default to
2 paneonly:operatorpane: active executioncriticpane: dormant by default, wake on failure/stage switch/review demand
- do not create
verifier/reviewerpanes unless explicitly requested - run:
python3 scripts/launch_explicit_tmux.py --session tgtool-visible --cwd <project-dir>
- treat explicit mode as:
- auto-try foreground popup in a terminal emulator
- if popup is not possible (no GUI/display), report fallback
tmux attach -t <session>
Fallback Order
If orchestration should not continue, fall back in this order:
subagent-driven-developmentdispatching-parallel-agents- ordinary
using-superpowersrouting - single-session execution
Common Mistakes
- Spawning too many roles before ownership is clear
- Using two writing roles on the same files
- Treating
revieweras a hidden second implementer - Forcing orchestration when the task is too small
- Treating the external framework as the top-level router instead of
tgtool
Remember
tgtoolstays the entrypoint- explicit
ruflobackend requests may first runscripts/bootstrap_ruflo_backend.pyto initialize Codex/runtime state and a swarm automatically - prefer fewer roles over unsafe parallelism