Execute
Execute Task Master tasks from a completed epic to implement the planned features.
# Execute Epic Tasks
Execute Task Master tasks from a completed epic to implement the planned features.
## Usage
```bash
/epic:execute <EPIC_FOLDER> [TASK_ID|MODE] [MAX_SUBAGENTS]
Arguments:
EPIC_FOLDER(required): Path to epic folder (e.g.,agent/epics/diagram-refactoring)TASK_ID|MODE(optional): Task ID number, "next", "all" (default), or "interactive"MAX_SUBAGENTS(optional): Maximum parallel agents (default: 9)
🚨 PARAMOUNT: PARALLEL EXECUTION MANDATE 🚨
THIS IS ABSOLUTELY CRITICAL AND MUST BE FOLLOWED AT ALL TIMES:
- ALWAYS run as many parallel agents as task dependencies allow
- NEVER run tasks sequentially when they can be parallelized
- Monitor dependency graph continuously to launch new agents as tasks complete
- Respect MAX_SUBAGENTS limit but push to that limit whenever possible
- Parallel execution is NOT optional - it is MANDATORY for performance
The system MUST maximize parallel agent deployment up to MAX_SUBAGENTS (default: 9) at all times when dependencies allow.
Examples
# Execute all pending tasks (default)
/epic:execute agent/epics/diagram-refactoring
# Execute next available task
/epic:execute agent/epics/diagram-refactoring next
# Execute specific task
/epic:execute agent/epics/diagram-refactoring 3
# Interactive task selection
/epic:execute agent/epics/diagram-refactoring interactive
Progress Tracking
This command follows the standard epic progress tracking system defined in .claude/epic/progress-tracking.md.
Execution Workflow Steps:
- Load Epic Configuration
- Validate Task Dependencies
- Deploy Task Orchestrator
- Execute Tasks in Parallel
- Monitor Agent Progress
- Handle Task Completions
- Deploy New Agents for Available Tasks
- Validate Task Results
- Update Task Status
- Generate Execution Report
Implementation
Step 1: Load Epic Configuration
Load epic state and switch to Task Master tag:
- Read
workflow-state.jsonfrom epic folder - Extract epic name and tag name
- Initialize execution tracking in workflow state
- Switch to the epic's Task Master tag using
task-master use-tag - Verify tasks exist in the tag
- Update progress: Step 1 → Step 2
# Update state for execution start
jq --arg timestamp "$(date -Iseconds)" '
.current_step = 1 |
.execution.parallel_agents_active = 0 |
.execution.tasks_in_progress = [] |
.last_updated = $timestamp' \
agent/epics/[EPIC-NAME]/workflow-state.json > tmp.json && \
mv tmp.json agent/epics/[EPIC-NAME]/workflow-state.json
echo "[$(date -Iseconds)] [info] Starting task execution for $EPIC_NAME" >> agent/epics/[EPIC-NAME]/workflow.log
Step 2: Execute Tasks
Execute tasks based on mode parameter:
Mode "all" (default):
- CRITICAL: Only the main Claude instance can deploy agents - subagents CANNOT deploy other subagents
- COORDINATOR ROLE: The main Claude instance acts as the coordinator, not a subagent
- Analyze dependency graph to identify tasks that can run immediately (no dependencies)
- Launch maximum possible parallel Task tool calls (up to MAX_SUBAGENTS) for available tasks
- IMPORTANT: Each Task tool call launches ONE specialized agent for ONE specific task
- Continuously monitor task completions to launch new agents as dependencies are satisfied
- Update task status to "in-progress" when launching agent, then "done" when agent completes
- Maintain maximum parallel deployment until no more tasks available
Parallel Execution Pattern:
- Identify all tasks with satisfied dependencies
- Launch multiple Task tool calls simultaneously (one per available task)
- Wait for agents to complete and return results
- Update task status and identify newly available tasks
- Repeat until all tasks completed
# Track agent deployment for each task
for TASK_ID in $AVAILABLE_TASKS; do
# Update state: deploy agent
jq --arg task_id "$TASK_ID" --arg timestamp "$(date -Iseconds)" '
.execution.tasks_in_progress += [$task_id] |
.execution.parallel_agents_active += 1 |
.current_step = 4 |
.last_updated = $timestamp' \
agent/epics/[EPIC-NAME]/workflow-state.json > tmp.json && \
mv tmp.json agent/epics/[EPIC-NAME]/workflow-state.json
echo "[$(date -Iseconds)] [agent] Deployed task-executor for task $TASK_ID" >> agent/epics/[EPIC-NAME]/workflow.log
done
# Track task completion
function complete_task() {
local TASK_ID=$1
jq --arg task_id "$TASK_ID" --arg timestamp "$(date -Iseconds)" '
.execution.tasks_in_progress -= [$task_id] |
.execution.tasks_completed += [$task_id] |
.execution.parallel_agents_active -= 1 |
.execution.last_task_completion = $timestamp |
.last_updated = $timestamp' \
agent/epics/[EPIC-NAME]/workflow-state.json > tmp.json && \
mv tmp.json agent/epics/[EPIC-NAME]/workflow-state.json
echo "[$(date -Iseconds)] [success] Task $TASK_ID completed" >> agent/epics/[EPIC-NAME]/workflow.log
}
Mode "next":
- Get and execute single next available task
- Update task status appropriately
Mode "3" (specific task ID):
- Get task details using
task-master get-task --id=3 - Execute that specific task
- Update task status
Mode "interactive":
- Show pending tasks using
task-master get-tasks --status=pending - Prompt user to select task ID
- Execute selected task
Step 3: Report Results
Show execution summary with progress tracking:
- Update workflow state to completion
- Display total tasks completed
- Show any remaining pending tasks
- Generate final execution report
- Archive workflow state
- Provide next steps guidance
# Mark execution complete
jq --arg timestamp "$(date -Iseconds)" '
.current_step = 10 |
.completed_steps += [9] |
.status = "execution_completed" |
.completed_at = $timestamp |
.last_updated = $timestamp' \
agent/epics/[EPIC-NAME]/workflow-state.json > tmp.json && \
mv tmp.json agent/epics/[EPIC-NAME]/work
Maintain Execute?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Execute on getagentictools](https://getagentictools.com/loops/svallory-execute-epic-tasks?ref=badge)