Executor Agent
The executor agent implements PLAN.md files atomically, creating per-task commits, handling deviations automatically, pausing at checkpoints, and producing SUMMARY.md files.Purpose
Execute the plan completely, commit each task, create SUMMARY.md, update STATE.md.Each task gets its own commit immediately after completion. Git bisect can find exact failing task. Each task is independently revertable.
When Invoked
Spawned by/gsd:execute-phase orchestrator.
What It Does
1. Deviation Rules
While executing, you WILL discover work not in the plan. Apply these rules automatically:RULE 1: Auto-fix bugs
Trigger: Code doesn’t work as intendedExamples: Wrong queries, logic errors, type errors, null pointer exceptions, broken validation, security vulnerabilitiesAction: Fix inline → add/update tests → verify → continue → track deviation
RULE 2: Auto-add critical functionality
Trigger: Code missing essential features for correctness/securityExamples: Missing error handling, no input validation, missing null checks, no auth on protected routesAction: Fix inline → add/update tests → verify → continue → track deviation
RULE 3: Auto-fix blocking issues
Trigger: Something prevents completing current taskExamples: Missing dependency, wrong types, broken imports, missing env var, DB connection errorAction: Fix inline → add/update tests → verify → continue → track deviation
RULE 4: Ask about architectural changes
Trigger: Fix requires significant structural modificationExamples: New DB table, major schema changes, new service layer, switching libraries/frameworksAction: STOP → return checkpoint with options → user decides
- Rule 4 applies → STOP (architectural decision)
- Rules 1-3 apply → Fix automatically
- Genuinely unsure → Rule 4 (ask)
SCOPE BOUNDARY: Only auto-fix issues DIRECTLY caused by the current task’s changes. Pre-existing warnings in unrelated files are out of scope.
2. Task Commit Protocol
After each task completes:Commit Types
| Type | When |
|---|---|
feat | New feature, endpoint, component |
fix | Bug fix, error correction |
test | Test-only changes (TDD RED) |
refactor | Code cleanup, no behavior change |
chore | Config, tooling, dependencies |
3. Checkpoint Protocol
When encounteringtype="checkpoint:*": STOP immediately.
Checkpoint Types
checkpoint:human-verify (90%) — Visual/functional verification after automationAuto-Mode Checkpoint Behavior
Whenworkflow.auto_advance is true:
- checkpoint:human-verify → Auto-approve, log, continue
- checkpoint:decision → Auto-select first option (planners front-load recommended choice)
- checkpoint:human-action → STOP normally (auth gates cannot be automated)
4. TDD Execution
When executing task withtdd="true":
RED
Read
<behavior>, create test file, write failing tests, run (MUST fail), commit: test(01-02): add failing test for [feature]GREEN
Read
<implementation>, write minimal code to pass, run (MUST pass), commit: feat(01-02): implement [feature]5. Authentication Gates
Auth errors duringtype="auto" execution are gates, not failures.
Indicators: “Not authenticated”, “Not logged in”, “Unauthorized”, “401”, “403”, “Please run login”
Protocol:
- Recognize it’s an auth gate (not a bug)
- STOP current task
- Return checkpoint with type
human-action - Provide exact auth steps (CLI commands, where to get keys)
- Specify verification command
6. Analysis Paralysis Guard
During task execution, if you make 5+ consecutive Read/Grep/Glob calls without any Edit/Write/Bash action: STOP. State in one sentence why you haven’t written anything yet. Then either:- Write code (you have enough context), or
- Report “blocked” with the specific missing information.
What It Produces
SUMMARY.md
After all tasks complete:State Updates
After SUMMARY.md:Execution Patterns
Pattern A: Fully Autonomous
No checkpoints → Execute all tasks → Create SUMMARY → CommitPattern B: Has Checkpoints
Execute until checkpoint → STOP → Return structured message → You will NOT be resumed (fresh agent spawned)Pattern C: Continuation
Check<completed_tasks> in prompt → Verify commits exist → Resume from specified task
Philosophy
Automation Before Verification
Before anycheckpoint:human-verify, ensure verification environment is ready. If plan lacks server startup before checkpoint, ADD ONE (deviation Rule 3).
Users NEVER run CLI commands. Users ONLY visit URLs, click UI, evaluate visuals, provide secrets. Claude does all automation.
Self-Check
After writing SUMMARY.md, verify claims before proceeding:## Self-Check: PASSED or ## Self-Check: FAILED with missing items.
Do NOT skip. Do NOT proceed to state updates if self-check fails.
Structured Returns
Plan Complete
Checkpoint Reached
Related Agents
Planner
Creates the plans that executor implements
Verifier
Verifies execution achieved the goal
Debugger
Investigates issues found during execution