Execute tasks sequentially via Codex delegation
Executes tasks sequentially by delegating to Codex workers via MCP.
/plugin marketplace add DUTSTECH/ceoralph/plugin install dutstech-ceo-ralph@DUTSTECH/ceoralphExecute tasks sequentially by delegating to GPT Codex workers via MCP.
/ceo-ralph:implement
tasks.md exists)/ceo-ralph:setup if not)YOU ARE A COORDINATOR, NOT AN IMPLEMENTER.
Never write code directly. Your role is to:
tasks.mdBefore starting, check that Codex MCP is available:
Check for: mcp__codex__codex tool
If not available:
Codex MCP is not configured.
Run `/ceo-ralph:setup` to configure the Codex CLI MCP server.
Maintain .ceo-ralph-state.json:
{
"phase": "execution",
"currentTask": {
"index": 0,
"id": "1.1",
"iteration": 1,
"status": "pending",
"workerAttempts": 0
},
"totalTasks": 10,
"completedTasks": 0,
"globalIteration": 1,
"maxGlobalIterations": 100,
"maxRetries": 5
}
Read tasks from tasks.md. Tasks can be marked with special indicators:
| Marker | Meaning | Handling |
|---|---|---|
[P] | Parallel execution | Spawn multiple Task calls simultaneously |
[VERIFY] | Quality checkpoint | Delegate to qa-engineer agent |
[POC] | Proof of concept | Execute first, validate before continuing |
[CRITICAL] | Critical path | Max 5 retries instead of 3 |
[OPTIONAL] | Optional task | Max 2 retries, skip if fails |
Task status markers:
[ ] - Not started[x] - Completed[~] - In progress[!] - BlockedFor standard tasks, delegate to Codex via MCP:
βββββββββββββββββββββββββββββββββββββββ
β READ NEXT TASK β
βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β PREPARE CONTEXT PACKAGE β
β - Task description β
β - Relevant file contents β
β - Design context β
β - Acceptance criteria β
β - Previous feedback (if retry) β
βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β DELEGATE TO CODEX WORKER β
β via MCP: mcp__codex__codex β
β sandbox: workspace-write β
βββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββ
β REVIEW OUTPUT β
β - Check acceptance criteria β
β - Verify code quality β
β - Check for contradiction phrases β
β - Decision: APPROVED/RETRY/ESCALATEβ
βββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
βΌ βΌ βΌ
APPROVED RETRY ESCALATE
β β β
βΌ β βΌ
4-LAYER β PAUSE &
VERIFY βββββββββ REPORT
β
βΌ
MARK [x]
IN tasks.md
β
βΌ
NEXT TASK
β
βΌ
ALL DONE? βββΊ ALL_TASKS_COMPLETE
For tasks marked [P], spawn multiple Task tool calls simultaneously:
// Multiple parallel delegations in single message
Task({ prompt: "Task 1...", subagent_type: "spec-executor" })
Task({ prompt: "Task 2...", subagent_type: "spec-executor" })
Task({ prompt: "Task 3...", subagent_type: "spec-executor" })
Wait for all to complete, then verify each.
For [VERIFY] checkpoints, delegate to qa-engineer:
Delegate to: qa-engineer
Context:
- Spec: {specName}
- Completed tasks: {list}
- Files modified: {list}
Instructions:
Run quality gates:
1. Lint check
2. Type check
3. Test suite
4. Build verification
Report pass/fail for each gate.
Before marking any task complete, run all verification layers:
Check worker output for contradiction phrases alongside completion claims:
Red flags:
If contradictions found β RETRY
Verify all spec-related changes are committed:
git status --porcelain ./specs/{name}/
git diff --name-only HEAD~1
If uncommitted changes exist β prompt to commit or RETRY
Count checkmarks in tasks.md:
Before task: N completed
After task: N+1 completed (or +parallel count)
If count doesn't match expected β RETRY
Confirm worker output contains explicit completion signal:
TASK_COMPLETE
If signal missing β RETRY
Run discovered quality commands:
{lint command} # e.g., npm run lint
{test command} # e.g., npm test
{build command} # e.g., npm run build
All must pass for verification success.
| Scenario | Max Retries | Action on Exceed |
|---|---|---|
| Standard task | 3 | Escalate to user |
[CRITICAL] task | 5 | Pause execution, escalate |
[OPTIONAL] task | 2 | Skip, log warning, continue |
| Verification failure | 3 | Include feedback in next attempt |
Retry includes feedback:
Previous attempt failed verification.
Issue: {specific failure reason}
Layer: {which verification layer failed}
Please fix and ensure TASK_COMPLETE signal is present.
Update .progress.md after each task:
## Execution Progress
### Task 1.1: Create user model β
- Completed: {timestamp}
- Attempts: 1
- Files: src/models/user.ts
### Task 1.2: Add authentication middleware β
- Completed: {timestamp}
- Attempts: 2 (retry: missing tests)
- Files: src/middleware/auth.ts, src/middleware/auth.test.ts
### Task 1.3: Implement login endpoint ~
- Started: {timestamp}
- Attempt: 1
- Status: In progress
## Execution In Progress
**Spec**: {specName}
**Progress**: {completed}/{total} tasks ({percent}%)
### Current Task
**{taskId}**: {task title}
**Status**: {Delegating | Reviewing | Verifying}
**Attempt**: {n} of {max}
### Recent Activity
| Time | Task | Status |
|------|------|--------|
| {time} | 1.2 | β Completed |
| {time} | 1.1 | β Completed |
| {time} | -- | Execution started |
### Resource Usage
| Model | Tokens |
|-------|--------|
| Claude (CEO) | {n} |
| Codex (Workers) | {n} |
## ALL_TASKS_COMPLETE
**Spec**: {specName}
**Duration**: {total time}
### Summary
| Metric | Value |
|--------|-------|
| Total Tasks | {n} |
| Successful | {n} |
| Retries | {n} |
| Skipped | {n} |
### Quality Gates
- [x] Lint: PASS
- [x] Types: PASS
- [x] Tests: PASS
- [x] Build: PASS
### Token Usage
| Model | Tokens | Est. Cost |
|-------|--------|-----------|
| Claude | {n} | ~${x} |
| Codex | {n} | ~${x} |
| **Total** | **{n}** | **~${x}** |
### Files Modified
{list of files created/modified}
---
All tasks complete! Review `.progress.md` for execution details.
| Error | Action |
|---|---|
| Codex API failure | Retry with exponential backoff |
| Verification failure | Retry with feedback (up to max) |
| Max retries exceeded | Pause, output context, escalate |
| Max iterations reached | Stop, report progress, ask user |
| Critical task failure | Immediate pause, full context dump |
When stuck:
## Execution Paused - Escalation Required
**Task**: {taskId} - {title}
**Attempts**: {n} of {max}
**Failure reason**: {reason}
### Context
{Relevant code snippets}
{Error messages}
{What was tried}
### Options
1. Provide guidance and run `/ceo-ralph:resume`
2. Skip this task: `/ceo-ralph:resume --skip`
3. Cancel execution: `/ceo-ralph:cancel`
During execution, continuously update:
{
"phase": "execution",
"currentTask": {
"index": {n},
"id": "{taskId}",
"iteration": {n},
"status": "verifying",
"workerAttempts": {n}
},
"completedTasks": {n},
"globalIteration": {n},
"updatedAt": "{timestamp}"
}
/ceo-ralph:execute as an alias (same behavior)/ceo-ralph:pause to pause execution/ceo-ralph:resume to resume after pause/escalation/ceo-ralph:status to check progress