بنقرة واحدة
implement
Use when a spec has tasks.md and should enter autonomous task execution.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when a spec has tasks.md and should enter autonomous task execution.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when starting curdx-flow, creating a spec, resuming work, or routing intent.
Use when handling curdx-flow flags, state files, delegation, execution loops, or skill entrypoint rules.
Use when curdx-flow needs user decisions after codebase facts are discovered.
Use when a spec has design.md and needs implementation tasks.
Use when showing curdx-flow slash skills, options, workflow, or troubleshooting.
Fixture help skill
| name | implement |
| description | Use when a spec has tasks.md and should enter autonomous task execution. |
| argument-hint | [--max-task-iterations 5] [--max-global-iterations 30] [--goal-turns 30] [--manual] [--quick] [--recovery-mode] |
| allowed-tools | Read Write Edit Agent Bash Skill |
| disallowed-tools | AskUserQuestion |
| disable-model-invocation | true |
You are starting the task execution loop.
Complete these coordination steps in order; do not create user-facing implementation tasks from this checklist:
Resolve:
curdx-flow snapshot --spec "$ARGUMENTS" when $ARGUMENTS begins with a spec name; otherwise run curdx-flow snapshot.snapshot.active is false, error: "No active spec. Run /curdx-flow:new first."$SPEC_PATH to snapshot.spec.fsPath.Validate:
snapshot.artifacts.tasks.exists. If false: error "Tasks not found. Run /curdx-flow:tasks first."$SPEC_PATH to the resolved spec directory path. All references use this variable.From $ARGUMENTS:
--max-task-iterations 10.--max-global-iterations 100 to opt back into legacy cap. Mirrors --max-task-iterations parse pattern: flag value propagates into state.maxGlobalIterations at init./goal turns before reporting an incomplete blocker (default: same as --max-global-iterations)./goal; run one coordinator turn and leave a resumable status. Use only when /goal is unavailable because hooks are disabled or managed policy disallows it.references/branch-management.md § Quick Mode: on the default branch auto-create a feature branch in place without prompting; on a non-default branch stay put. Quick mode also short-circuits review approval prompts in earlier phases (research, requirements, design, tasks) and trusts autoPolicy.reviewCadence to gate verification. Use for CI, scripted runs, or experienced users who want minimum interruption.references/verification-layers.md rules regardless of this flag.Read existing .curdx-state.json::autoPolicy before applying defaults:
--max-task-iterations, use autoPolicy.maxTaskIterations when present, else 5.--max-global-iterations, use autoPolicy.maxGlobalIterations when present, else 30.--goal-turns, use the parsed max-global value./goal is the default execution driver.Count tasks using the runtime CLI:
TASKS_JSON=$(curdx-flow tasks count "$SPEC_PATH/tasks.md")
TOTAL=$(printf '%s' "$TASKS_JSON" | node -e 'let s="";process.stdin.on("data",c=>s+=c);process.stdin.on("end",()=>process.stdout.write(String(JSON.parse(s).total)))')
COMPLETED=$(printf '%s' "$TASKS_JSON" | node -e 'let s="";process.stdin.on("data",c=>s+=c);process.stdin.on("end",()=>process.stdout.write(String(JSON.parse(s).completed)))')
FIRST_INCOMPLETE=$((COMPLETED))
CRITICAL: Merge into existing state -- do NOT overwrite the file.
Read the existing .curdx-state.json first, then merge the execution fields into it.
This preserves fields set by earlier phases (e.g., source, name, basePath, commitSpec, relatedSpecs).
Update .curdx-state.json by merging these fields into the existing object:
{
"phase": "execution",
"taskIndex": "<first incomplete>",
"totalTasks": "<count>",
"taskIteration": 1,
"maxTaskIterations": "<parsed from --max-task-iterations or default 5>",
"recoveryMode": "<true if --recovery-mode flag present, false otherwise>",
"maxFixTasksPerOriginal": 3,
"maxFixTaskDepth": 3,
"globalIteration": 1,
"maxGlobalIterations": "<parsed from --max-global-iterations or default 30 (FR-D1; legacy 100 preserved on existing state files per FR-C1)>",
"fixTaskMap": {},
"modificationMap": {},
"maxModificationsPerTask": 3,
"maxModificationDepth": 2,
"awaitingApproval": false,
"executionDriver": "<'manual' when --manual is present, otherwise 'goal'>",
"nativeTaskMap": {},
"nativeSyncEnabled": true,
"nativeSyncFailureCount": 0
}
Use the merge-state lib to preserve existing fields (atomic deep-merge, cross-platform):
PATCH=$(FIRST_INCOMPLETE="$FIRST_INCOMPLETE" TOTAL="$TOTAL" MAX_TASK_ITER="$MAX_TASK_ITER" RECOVERY_MODE="$RECOVERY_MODE" MAX_GLOBAL_ITER="$MAX_GLOBAL_ITER" MANUAL_MODE="$MANUAL_MODE" node -e '
const bool = (name) => /^(1|true|yes)$/i.test(process.env[name] || "");
const num = (name, fallback) => {
const raw = process.env[name];
if (raw === undefined || raw === "") return fallback;
const value = Number(raw);
return Number.isFinite(value) ? value : fallback;
};
console.log(JSON.stringify({
phase: "execution",
taskIndex: num("FIRST_INCOMPLETE", 0),
totalTasks: num("TOTAL", 0),
taskIteration: 1,
maxTaskIterations: num("MAX_TASK_ITER", 5),
recoveryMode: bool("RECOVERY_MODE"),
maxFixTasksPerOriginal: 3,
maxFixTaskDepth: 3,
globalIteration: 1,
maxGlobalIterations: num("MAX_GLOBAL_ITER", 30),
fixTaskMap: {},
modificationMap: {},
maxModificationsPerTask: 3,
maxModificationDepth: 2,
awaitingApproval: false,
executionDriver: bool("MANUAL_MODE") ? "manual" : "goal",
nativeTaskMap: {},
nativeSyncEnabled: true,
nativeSyncFailureCount: 0
}));
')
curdx-flow state merge "$SPEC_PATH/.curdx-state.json" "$PATCH"
Where $FIRST_INCOMPLETE and $TOTAL come from the task count command, and $MAX_TASK_ITER, $RECOVERY_MODE, $MAX_GLOBAL_ITER, and $MANUAL_MODE come from parsed arguments (Step 2). The merge-state lib handles atomic write internally — no tmp+mv needed.
Preserved fields (set by earlier phases, must NOT be removed):
source, name, basePath, commitSpec, relatedSpecsState v2 policy: New execution state uses version: 2. If a legacy state blocks execution, reinitialize with /curdx-flow:start --fresh or rerun this skill after replacing the state file; do not silently migrate malformed state.
After writing the state file, compile the native Claude Code /goal bridge:
curdx-flow goal --cwd "$PWD" --spec "$SPEC_PATH" --max-turns "$GOAL_TURNS"
Treat the JSON as the execution driver contract:
slashCommand is the exact native /goal condition to run for unattended multi-turn execution.readiness says whether native /goal is actually available in this Claude Code environment. Only recommend native /goal when recommendedDriver is native-goal.conditionLength must be within the Claude Code limit; if it is compressed, keep the warning visible so the user knows the condition was shortened.condition is transcript-verifiable. Claude must surface every proof needed by the goal evaluator; the evaluator will not run commands or read files by itself.evidenceProtocol lists the proof that must appear before ALL_TASKS_COMPLETE.warnings explains fallback cases such as disableAllHooks, managed allowManagedHooksOnly, update-needed Claude Code versions, or condition compression.Default path:
recommendedDriver is native-goal, show the slashCommand prominently before the coordinator prompt./goal drives follow-up turns. Do not claim unattended continuation unless that slash command is active and readiness is available.Manual fallback:
--manual is present or recommendedDriver is manual-resume, run only the current coordinator turn..curdx-state.json resumable and print the next action instead of relying on any Stop-hook continuation.Before dispatching the first task, run:
curdx-flow last-mile --cwd "$PWD" --spec "$SPEC_PATH" --record
Treat the JSON as the execution autopilot contract:
phase tells whether the coordinator is planning, implementing, verifying, recovering, or releasing.problemTypes tells what is currently risky: missing context, UI quality, browser evidence, repeated failure, release risk, verification gap, scope drift, or missing dependency.capabilityPlan tells when to use dependency wheels. Use claude-mem, pua, ui-ux-pro-max, or Chrome DevTools MCP only when their availabilityState is available/expected; if missing, follow fallbackWhenMissing and do not reimplement the wheel inside curdx-flow.evidenceRequired and blockingGates are completion gates. Do not output ALL_TASKS_COMPLETE while they are unsatisfied.coordinatorInstruction is the next action for this loop iteration.Output this prompt directly to start execution:
You are the execution COORDINATOR for spec: $spec
Then Read and follow these references in order. They contain the complete coordinator logic:
Core delegation pattern: Read ${CLAUDE_PLUGIN_ROOT}/references/coordinator-pattern.md and follow it.
This covers: role definition, integrity rules, reading state, checking completion, parsing tasks, parallel group detection, task delegation (sequential, parallel, [VERIFY] tasks), modification request handling, verification layers, state updates, progress merge, completion signal, and PR lifecycle loop.
Last-mile autopilot: Read ${CLAUDE_PLUGIN_ROOT}/references/last-mile-autopilot.md and follow it.
This covers automatic phase detection, capability routing, dependency plugin use, evidence gates, and recovery escalation.
Failure handling: Read ${CLAUDE_PLUGIN_ROOT}/references/failure-recovery.md and follow it.
This covers: parsing failure output, fix task generation, fix task limits and depth checks, iterative recovery orchestrator, fix task insertion into tasks.md, fixTaskMap state tracking, and progress logging for fix chains.
Verification after each task: Read ${CLAUDE_PLUGIN_ROOT}/references/verification-layers.md and follow it.
This covers: 3 layers (contradiction detection, TASK_COMPLETE signal, periodic artifact review via spec-reviewer). All must pass before advancing.
Phase-specific behavior: Read ${CLAUDE_PLUGIN_ROOT}/references/phase-rules.md and follow it.
This covers: POC-first workflow (Phase 1-4), phase distribution, quality checkpoints, and phase-specific constraints.
Commit conventions: Read ${CLAUDE_PLUGIN_ROOT}/references/commit-discipline.md and follow it.
This covers: one commit per task, commit message format, spec file staging, and when to commit.
Before dispatching any task, read .curdx-state.json::autoPolicy and obey:
executionDriver: goal means native /goal owns follow-up turns; manual means return a resumable status after the current turn.subagentPolicy: no implementation subagent for none; on-demand delegation for on-demand; one focused subagent per vertical slice for per-slice.reviewCadence: artifact review only at the cadence selected by policy.verificationLevel: targeted/standard/strict verification depth.CRITICAL: At the top of every iteration loop body, immediately after reading .curdx-state.json and BEFORE any Agent(...) delegation call, the coordinator MUST evaluate the cost-runaway caps. This is the coordinator-side enforcement of maxGlobalIterations / maxTaskIterations (spec-cost-runaway-guards FR-E1 / US-1 / US-2 / AC-1.1 / AC-2.2). The stop-watcher hook is the last-mile safety net; this pre-check is the first-line defense and avoids burning a dispatch round-trip when the cap is already breached.
Step A: Read caps from state
After reading .curdx-state.json, extract:
globalIter = state.globalIteration (default 1 if missing)maxGlobal = state.maxGlobalIterations (default 30 per FR-D1; legacy state files may store 100 — preserve as-is)taskIter = state.taskIteration (default 1 if missing)maxTask = state.maxTaskIterations (default 5)Step B: Global cap pre-check (halts loop entirely)
If globalIteration >= maxGlobalIterations:
Do NOT delegate. Do NOT call Agent(...). Do NOT advance taskIndex.
Output the D4 cost-runaway STOP message verbatim (mirrors buildCostRunawayBlock in src/hooks/stop-watcher.ts so user sees identical wording from either surface):
Cost runaway guard tripped: globalIteration={globalIter} >= maxGlobalIterations={maxGlobal}.
Loop blocked. Either:
- Investigate why your loop ran {globalIter} iterations (check .progress.md)
- Override with: /curdx-flow:implement --max-global-iterations <higher-cap>
- Reset by editing {state-file-path}: set globalIteration to a lower value
Spec: {specName} Phase: implement
Halt the coordinator loop. Do NOT output ALL_TASKS_COMPLETE (tasks remain incomplete). Do NOT output TASK_COMPLETE.
Step C: Task-level cap pre-check (fails current task, breaks retry loop)
Else if taskIteration >= maxTaskIterations:
Do NOT delegate the current task again. Mark the current task as failed in .progress.md (append a Learnings entry: Task ${taskIndex} hit taskIteration cap (${taskIter} >= ${maxTask}) — marked failed, retry loop broken).
Output the task-level D4 message variant verbatim:
Cost runaway guard tripped: taskIteration={taskIter} >= maxTaskIterations={maxTask}.
Loop blocked. Either:
- Investigate why your loop ran {taskIter} iterations (check .progress.md)
- Override with: /curdx-flow:implement --max-task-iterations <higher-cap>
- Reset by editing {state-file-path}: set taskIteration to a lower value
Spec: {specName} Phase: implement
Break the per-task retry loop. Do not advance taskIndex automatically — surface the failure so the user can decide whether to override the cap, fix the underlying problem, or accept the partial completion. Do NOT output ALL_TASKS_COMPLETE.
Step D: Caps OK → proceed to standard delegation
Only when both globalIteration < maxGlobalIterations AND taskIteration < maxTaskIterations, fall through to the standard task-delegation flow defined in coordinator-pattern.md (Parse Current Task → Parallel Group Detection → Task Delegation).
Defense-in-depth note: The stop-watcher hook re-evaluates the same condition via
buildCostRunawayBlock(state)and emits the identical message string. If this coordinator pre-check is somehow skipped (e.g., manual override of state mid-iteration), the hook still blocks. Both surfaces use the same template so the user never sees split error wording.
When all tasks complete (taskIndex >= totalTasks):
**Verify** command from tasks.md:
curdx-flow verify run --phase execution --command "$VERIFY_CMD" --spec "$SPEC_PATH"
This command actually executes the verification and writes .curdx-state.json::verificationBlocks.execution with the command, exit code, timestamp, and source mtime. If it exits non-zero, do not continue to completion; fix the issue and rerun verification.COMPLETED_AT=$(node -e "process.stdout.write(new Date().toISOString())")
curdx-flow state merge "$SPEC_PATH/.curdx-state.json" "{\"completed\":true,\"completedAt\":\"$COMPLETED_AT\",\"awaitingApproval\":false}"
find "$SPEC_PATH" -name ".progress-task-*.md" -mmin +60 -delete 2>/dev/null || truenode "${CLAUDE_PLUGIN_ROOT}/hooks/scripts/update-spec-index.mjs" --quietgit add "$SPEC_PATH/tasks.md" "$SPEC_PATH/.progress.md" "$SPEC_PATH/.curdx-state.json" ./specs/.index/
git diff --cached --quiet || git commit -m "chore(spec): final progress update for $spec"
gh pr view --json url -q .url 2>/dev/nullStarting execution for '$spec'
Tasks: $completed/$total completed
Starting from task $taskIndex
The execution loop will:
- Execute one task at a time
- Continue until all tasks complete or max iterations reached
Beginning execution...