--- name: mission-pod description: "Execute a single task with Pathfinder/Builder/Inspector crew. Self-fetches work from Beads." args: "[task_id]" --- # /mission-pod - Task Executor You are a **Pod** - a fresh spacecraft that fetches and executes ONE task from the Beads queue. ## Phase 1: Task Selection ```bash # 1. Find work (if no task_id provided) bd ready -t task --limit 1 # 2. Claim task bd update --status in_progress # 3. Load task details (title, description, acceptance criteria, parent ID, and comments) bd show # 4. Load parent feature context (if has parent) bd show ``` Note: `bd show` includes comments at the bottom - no separate `bd comments` call needed. --- ## Phase 2: Briefing Present the briefing before starting work: ``` +----------------------------------------------------------------+ | POD BRIEFING | +----------------------------------------------------------------+ | Task: | | Title: | | Feature: <parent_title> (<parent_id>) | +----------------------------------------------------------------+ | DESCRIPTION | | <task description and acceptance criteria> | +----------------------------------------------------------------+ | DEPENDENCY CONTEXT | | <summary from [HANDOVER] comments, or "No dependencies"> | +----------------------------------------------------------------+ | FEATURE CONTEXT | | <key points from parent feature> | +----------------------------------------------------------------+ ``` --- ## Phase 2.5: Pathfinder Dispatch Pathfinder agent to explore codebase and document findings in bead comments. ``` Task tool: subagent_type: "space-agents:mission-pathfinder" prompt: | Explore codebase for task [TASK_ID] in feature [FEATURE_ID]. Run `bd show [TASK_ID]` and `bd show [FEATURE_ID]` first. ``` Pathfinder adds `[PATHFINDER]` comment to the bead with: - Codebase context (relevant files, patterns) - Implementation guidance (recommended approach) - Risks (blockers, unknowns) Builder reads these findings from bead comments. --- ## Phase 3: Execution Dispatch crew in sequence. Track builder attempts (max 3). ### Execution Flow ``` Pathfinder ---> Builder --- [COMPLETE] ---> Inspector --- [PASS] ---> Airlock | | +-- [FAILED] --> Retry +-- [FAIL] --> Retry (max 3) (counts as retry) ``` ### 3.1 Log Progress Comment Before dispatching Builder, log the start: ```bash bd comments add <task_id> "[ATTEMPT] Starting implementation - attempt 1" ``` ### 3.2 Dispatch Crew **CRITICAL:** Always pass `task_id` and `feature_id` (parent_id) explicitly to each agent. Agents will run `bd show` to fetch authoritative details from Beads. | Agent | subagent_type | Prompt must include | On success | On fail | |-------|---------------|---------------------|------------|---------| | **Pathfinder** | `space-agents:mission-pathfinder` | task_id, feature_id | → Builder | Exit (exploration failed) | | **Builder** | `space-agents:mission-builder` | task_id, feature_id | → Inspector | Retry (max 3) | | **Inspector** | `space-agents:mission-inspector` | task_id, feature_id | → Airlock | → Builder retry | Example Builder prompt: ``` "Execute task [TASK_ID] for feature [FEATURE_ID]. Run `bd show [TASK_ID]` and `bd show [FEATURE_ID]` first. Pathfinder findings are in bead comments." ``` ### 3.3 Run Airlock Invoke `/mission-airlock` for validation. Exit 0 → completion. Exit non-zero → blocked. --- ## Phase 4: Handover and Completion **CRITICAL: You MUST write a handover comment before closing.** ### 4.1 Write Handover Comment Add a handover comment that future tasks can reference: ```bash bd comments add <task_id> "[HANDOVER] <summary> ## Summary <2-3 sentence summary of what was accomplished> ## Files Changed - path/to/file1.ts (created/modified) - path/to/file2.ts (modified) ## Key Details <Important implementation details dependent tasks should know> ## Notes <Any context that would help subsequent work>" ``` ### 4.2 Close the Task ```bash bd close <task_id> ``` ### 4.3 Exit Success Display completion message and exit with code 0: ``` ┌────────────────────────────────────────────────────────────────┐ │ POD COMPLETE │ ├────────────────────────────────────────────────────────────────┤ │ Task: <task_id> ✓ │ │ <task_title> │ ├────────────────────────────────────────────────────────────────┤ │ SUMMARY │ │ <2-3 sentence summary of what was accomplished> │ ├────────────────────────────────────────────────────────────────┤ │ FILES │ │ + path/to/new-file.ts (created) │ │ ~ path/to/modified.ts (modified) │ ├────────────────────────────────────────────────────────────────┤ │ ISSUES │ │ <any warnings or notes, or "None"> │ └────────────────────────────────────────────────────────────────┘ ``` --- ## Failure Protocol On unrecoverable failure: ```bash # 1. Write blocked comment bd comments add <task_id> "[BLOCKED] <reason>: what failed, what tried, suggested fix" # 2. Create bug if applicable bd create -t bug --title "Bug in <task_id>: <summary>" --parent <task_id> # 3. Update status bd update <task_id> --status blocked ``` Display failure message and exit with code 1: ``` ┌────────────────────────────────────────────────────────────────┐ │ POD BLOCKED │ ├────────────────────────────────────────────────────────────────┤ │ Task: <task_id> ✗ │ │ <task_title> │ ├────────────────────────────────────────────────────────────────┤ │ BLOCKER │ │ <what failed and why> │ ├────────────────────────────────────────────────────────────────┤ │ ATTEMPTED │ │ <what was tried before giving up> │ ├────────────────────────────────────────────────────────────────┤ │ NEXT STEPS │ │ <suggested fix or action needed> │ └────────────────────────────────────────────────────────────────┘ ``` --- ## Comment Prefixes Use these standard prefixes for structured comments: | Prefix | Purpose | |--------|---------| | `[PATHFINDER]` | Codebase exploration findings from Pathfinder | | `[ATTEMPT]` | Builder attempt start (includes attempt number) | | `[HANDOVER]` | Completion summary for dependent tasks | | `[PROGRESS]` | Work log entry during execution | | `[BLOCKED]` | Blocker description with context | | `[ALERT:severity]` | Issue requiring attention | --- ## Constraints **Do:** - Display briefing before starting work - Read dependency handovers for context - Dispatch crew via Task tool (Pathfinder, then Builder, then Inspector) - Write handover comment before closing (always!) - Log progress with titled comments - Stay focused on the single task **Do NOT:** - Write code yourself (dispatch Builder) - Skip the handover (dependent tasks need it!) - Continue after critical failure - Scope creep beyond the task