Execute pending tasks for a feature — TDD-driven implementation with sub-agent isolation and progress tracking. Use when starting to build, implement, or code a planned feature, resuming partially completed work, or running the next task in a code-forge plan.
Execute pending implementation tasks for a feature, following the plan generated by /code-forge:plan.
state.json + tasks/ directory) ready for execution/code-forge:impl user-auth # Execute tasks for user-auth feature
/code-forge:impl # Auto-detect pending feature
Locate Feature → Confirm Execution → Task Loop (sub-agents) → Verify → Complete
Step 3 dispatches a dedicated sub-agent for each task, so code changes from one task don't pollute the context of the next. The main context only handles coordination: reading state, dispatching sub-agents, and updating status.
@../shared/configuration.md
Before executing tasks, ensure the project context is understood:
@../shared/project-analysis.md
Execute PA.1 (Project Profile), PA.3 (Language-Specific Deep Scan for the feature's modules), and PA.5 (Existing Test Assessment). This context is passed to each task sub-agent so they:
If the user provided a feature name (e.g., /code-forge:impl user-auth):
{output_dir}/{feature_name}/state.json{output_dir}/*/state.json for a feature whose feature field matchesoutput_dir, also search .code-forge/tmp/{feature_name}/state.json and .code-forge/tmp/*/state.json (plan may have been created with --tmp)/code-forge:status to see available features."If found in .code-forge/tmp/, set output_dir to .code-forge/tmp/ and tmp_mode to true for the rest of the session.
If no feature name is provided:
{output_dir}/*/state.json and .code-forge/tmp/*/state.json for all featuresstatus = "pending" or "in_progress" (exclude "completed")/code-forge:plan to create one."[tmp] suffix) and use AskUserQuestion to let user selectAfter locating the feature:
state.jsontasks array is non-emptytasks/ directory exist"completed": "All tasks already completed. Run /code-forge:review {feature} to review."Use AskUserQuestion:
/code-forge:impl {feature})assignee, sync state.jsonEach task is executed by a dedicated sub-agent to prevent cross-task context accumulation. The main context only handles coordination: reading state, dispatching sub-agents, and updating status.
state.jsonexecution_order that is "pending" with no unmet dependencies"in_progress" in state.jsonAskUserQuestion: "Is the task completed?"
"completed", continue loop"in_progress", exit loop"skipped", continue loopSpawn an Agent tool call with:
subagent_type: "general-purpose"description: "Execute task: {task_id}"Sub-agent prompt must include:
{output_dir}/{feature_name}/tasks/{task_id}.md (sub-agent reads it)@../shared/coding-standards.md
Sub-agent executes:
Sub-agent must return a concise execution summary:
STATUS: completed | partial | blocked
FILES_CHANGED:
- path/to/file.ext (created | modified)
- ...
TEST_RESULTS: X passed, Y failed
SUMMARY: <1-2 sentence description of what was done>
ISSUES: <any blockers or concerns, or "none">
Main context retains: Only the execution summary (~0.5-1KB per task). All code changes, test outputs, and file reads stay in the sub-agent's context and are discarded.
When multiple pending tasks have no mutual dependencies (none depends on another), they may be dispatched as parallel sub-agents using multiple Agent tool calls in a single message. Each sub-agent works in isolation on its own task.
Use parallel execution only when:
depends on the other)After all parallel sub-agents complete, review each summary and update state.json for all completed tasks before continuing the loop.
Before completion summary, verify all generated files:
Checks:
overview.md, plan.md, state.jsontasks/ directory exists and contains .md files with descriptive namesstate.json is valid JSON with required fields (feature, status, tasks, execution_order); task count matches task files; all IDs in execution_order match tasks entriesplan.md contains: title heading, ## Goal, ## Task Breakdown, ## Acceptance Criteriaoverview.md contains ## Task Execution Order tableOn pass: Show checklist with all items passing, continue.
On error (missing required files): Show what's missing. Attempt auto-fix:
overview.md → generate template from plan datatasks/ → create directorystate.json → generate initial state from task files found
Then re-verify.On warnings (count mismatch, missing optional section): Show warnings, continue by default.
After all tasks are completed:
state.json with final status{output_dir}/overview.md)Feature implementation completed!
Completed tasks: {completed}/{total}
Location: {output_dir}/{feature_name}/
Total time: {actual_time}
Next steps:
/code-forge:review {feature_name} Review code quality
/code-forge:verify Verify all tests pass
/code-forge:finish {feature_name} Merge / create PR