# Codex Dynamic Workflows
[Codex Dynamic Workflows](https://github.com/DannyMac180/skills/tree/main/codex-dynamic-workflows) is a [[Codex CLI]] skill by [DannyMac180](https://github.com/DannyMac180) that turns large, ambiguous tasks into supervised AI-agent work. Instead of executing directly, the skill forces planning, delegation, and verification before anything risky happens.
## What it does
The skill kicks in when a task benefits from explicit orchestration rather than one-shot execution. Triggers include parallel tracks (research, coding, QA, docs), high-risk operations (deploys, secrets, large repo changes), the need for a separate verification pass, or an explicit user ask for swarm / subagents / dynamic workflows. Small tasks are deliberately left alone.
## How it works
A run goes through seven stages:
1. Planning: restate goals, success criteria, and risks.
2. Orchestration: create a workflow artifact describing the strategy.
3. Delegation: split work into disjoint packets, each with clear ownership.
4. Execution: run packets sequentially or spawn subagents for parallel work.
5. Integration: synthesize results, resolve conflicts.
6. Verification: checks scaled to task risk.
7. Archival: save reusable recipes for the next similar job.
## Key mechanics
- Workflow artifacts live in `.workflow/<slug>/` and hold state, plans, and results.
- Work packets are self-contained units with objective, context, owner, and success metric.
- Approval gates pause before destructive, external, or high-risk steps.
- Goal mode enables sustained multi-turn execution when the runner supports it.
- Subagent simulation falls back to sequential packet processing when no real runner is available.
## Why it's interesting
It treats agentic work as a contract, with explicit packets, owners, gates, and verification. The same shape maps onto how OSK already handles agent chains, panels, and councils, and it's a useful reference for designing reusable skill pipelines.
## Related — Pi implementation
[Michaelliv](https://github.com/Michaelliv) is exploring the same pattern inside [[Pi Mono]] with [pi-dynamic-workflows](https://github.com/Michaelliv/pi-dynamic-workflows). The Pi extension lets the model write a JavaScript workflow script that the `workflow` tool runs in a sandboxed Node VM, spawning isolated Pi subagent sessions via `agent()` calls. It provides `parallel()` and `pipeline()` for concurrent fan-out, JSON-Schema-validated structured output, live phase tracking, Esc-to-abort, and determinism safeguards (no `Date.now()`, `Math.random()`, `require`, or template interpolation). The extension is still a prototype (no persisted or resumable runs yet), and does on Pi what the Codex skill does in Codex.
## References
- [DannyMac180/skills — codex-dynamic-workflows](https://github.com/DannyMac180/skills/tree/main/codex-dynamic-workflows)
- [Michaelliv/pi-dynamic-workflows](https://github.com/Michaelliv/pi-dynamic-workflows)
- [[Codex CLI]]
- [[Pi Mono]]