cook. - Workflow loops for Claude Code, Codex, and OpenCode
Summary
Cook is a composable workflow DSL for AI coding agents (Claude Code, Codex, OpenCode) that adds review loops, sequential passes, parallel racing, and task-list progression on top of single-shot agent calls. It enables multi-pass iteration, quality gates, and branch-and-pick patterns without manual orchestration.
Key Insight
The key value is in the composition model - three categories of tokens that wrap left to right:
- Loop operators for iteration quality:
xN- run N sequential passes, each seeing previous output (refinement)review- adds a review-then-gate loop with customizable prompts and max iterationsralph- outer gate for task-list progression (reads project state, advances through a plan)
- Composition operators for exploring solution space:
vN/race N- run N identical cooks in parallel git worktreesvs- run two different approaches in parallel worktrees- Resolvers:
pick(choose winner),merge(synthesize),compare(write comparison doc)
- Per-step agent/model control - different agents for different steps (e.g., Codex for work, Claude for review), configured via CLI flags or
.cook/config.json.
The ralph pattern is particularly powerful for autonomous task execution: the agent reads a plan file, works on the next task, passes through review, then ralph decides whether to advance or stop. This is a structured version of the “loop until done” pattern that keeps agents on track.
Sandbox modes: agent-native (default, no Docker) or Docker with restricted network. OpenCode only works in Docker mode.