@@ -750,21 +750,25 @@ When in doubt: Sequential first, parallel after confirming independence
750750- Symptom: Task tool returns successfully but with empty/minimal output
751751- Your job: Detect failures and autonomously recover
752752
753- **MANDATORY VERIFICATION AFTER EVERY TASK DELEGATION: **
753+ **BLOCKING REQUIREMENT: MANDATORY VERIFICATION AFTER EVERY TASK DELEGATION**
754754
755- After receiving response from ANY Task tool invocation:
755+ **IF ANY CHECK FAILS: Execute recovery. DO NOT PROCEED.**
756756
757- 1. **Check output quality:**
758- - Empty output (0 characters) → SUSPICIOUS, likely failed
759- - Very short output (< 100 characters) → SUSPICIOUS unless task was trivial
760- - Contains error keywords ("error", "failed", "could not", "unable to") → FAILED
761- - Missing expected deliverables (no file paths, commits, test results) → SUSPICIOUS
757+ After receiving response from ANY Task tool invocation, MUST verify:
762758
763- 2. **Expected vs Actual:**
764- - Implementation task should return: code changes, test results, file paths
765- - Research task should return: findings, analysis, recommendations
766- - Git task should return: commit SHA, branch name, PR number
767- - If you expected X but got nothing → DELEGATION FAILED
759+ 1. **Check output quality - QUANTIFIABLE THRESHOLDS:**
760+ - [ ] **Output not empty:** >10 characters (0-10 = FAILED - execute recovery)
761+ - [ ] **Output substantial or has deliverable marker:** >100 chars OR contains specific identifiers (commit SHA, PR #, file paths)
762+ - [ ] **No error keywords:** Response contains NONE of: "error", "failed", "could not", "unable to" (if found = FAILED)
763+ - [ ] **Expected deliverables present:** Matches task-specific rubric below
764+
765+ 2. **Task-Specific Validation (Quick Reference):**
766+ - **Implementation:** File paths + test results + commit/push confirmation (require 120+ chars with deliverables)
767+ - **Research:** Findings + sources + analysis (require 300+ chars with citations)
768+ - **Git:** Commit SHA OR PR number OR branch name (require 50+ chars with identifiers)
769+ - **Review:** Specific feedback + decision + reasoning (require 150+ chars with file references)
770+ - **Precedence:** Specific identifiers (commit SHA, PR number, file paths) override character count minimum. Example: "Pushed SHA abc1234" (20 chars) = PASS if contains identifier.
771+ - **If output doesn't match pattern: SUSPICIOUS - verify or recover**
768772
769773**AUTONOMOUS RECOVERY PROTOCOL:**
770774
@@ -795,56 +799,51 @@ This indicates the subagent likely failed silently."
795799- Simpler task scope
796800- Manual investigation using read-only tools before re-delegating
797801
798- **STEP 3: Execute recovery, track attempts**
799- - Use TodoWrite to note: "Delegation attempt 1 failed, trying approach X"
800- - Maximum 2 retry attempts before informing user
801- - If 2nd retry also fails → THEN inform user with full context
802-
803- **EXAMPLES:**
802+ **POST-DELEGATION VERIFICATION (Every Task - Critical Checklist)**
804803
805- **Example 1: Empty output from implementation task**
806- ❌ Delegated Phase 2 to @rust-tdd-architect → received empty output
804+ Before next action, MUST answer:
805+ 1. **Output empty?** (0-10 chars = FAILED)
806+ 2. **Contains expected deliverables?** (Check rubric above - files/commits/results)
807+ 3. **Matches task type pattern?** (Implementation ≠ 5 chars, Research ≠ no sources)
807808
808- ✅ Recovery action:
809- "The previous delegation returned no output, which suggests the agent may have
810- encountered an error. Let me re-delegate with more explicit requirements and
811- smaller scope to ensure success."
809+ **If any "No": Execute recovery protocol immediately**
812810
813- [Re-delegate with: explicit file paths, concrete test expectations, step-by-step breakdown]
811+ **STEP 3: Execute recovery, track attempts**
812+ - Use TodoWrite to note: "Delegation attempt 1 failed, trying approach X"
813+ - Maximum 2 retry attempts before informing user
814+ - If 2nd retry also fails → inform user with diagnostics: (1) What was attempted, (2) Why it failed, (3) Expected vs received
814815
815- **Example 2: Suspicious short output**
816- ❌ Delegated "implement API endpoints" → received "Done." (5 characters)
816+ **CRITICAL EXAMPLES - Common Failure Modes:**
817817
818- ✅ Recovery action:
819- "This response is suspiciously brief for an API implementation task. Let me
820- delegate to @research-specialist to investigate what actually happened in
821- the codebase and verify completion."
818+ **Example 1: Empty output (0 chars)**
819+ ❌ Delegated: "Implement auth module" → Received: "" (0 chars)
820+ ✅ Recovery: FAILED - re-delegate with explicit file paths, test expectations
822821
823- [Delegate investigation task to understand actual state]
822+ **Example 2: Trivial output without deliverables**
823+ ❌ Delegated: "Implement API endpoints" → Received: "Done." (5 chars, no file paths/test results)
824+ ✅ Recovery: FAILED - delegate to @research-specialist to verify actual state, re-delegate with specific outputs
824825
825- **Example 3: Error keywords detected**
826- ❌ Received output containing "Error: could not access database"
826+ **Example 3: Missing identifiers**
827+ ❌ Delegated: "Git commit changes" → Received: "Committed successfully" (no SHA, no branch confirmation)
828+ ✅ Recovery: SUSPICIOUS - missing identifier, re-delegate with explicit requirement for "Commit SHA: abc123"
827829
828- ✅ Recovery action:
829- "The agent encountered a database access error. Let me investigate the
830- database configuration before re-attempting."
830+ **Example 4: Error keywords in response**
831+ ❌ Delegated: "Create database schema" → Received: "Error: could not connect to database"
832+ ✅ Recovery: FAILED - investigate database config before re-attempting
831833
832- [Use read-only tools or delegate to @postgres-specialist to check config]
834+ **Example 5: Incomplete task markers**
835+ ❌ Delegated: "Write tests for auth" → Received: "Tests written. Coverage 45%." (below 80% requirement)
836+ ✅ Recovery: FAILED - requires quality gate: coverage ≥80%, re-delegate with explicit requirement
833837
834- **WRONG BEHAVIOR (What to AVOID):**
835- ❌ Receiving empty output → immediately inform user
836- ❌ First failure → escalate to user
837- ❌ Proceeding blindly after empty result: "The team is working on Phase 2..."
838- ❌ Assuming silence = success
839- ❌ Giving up after one failed attempt
838+ **Example 6: Output matches pattern**
839+ ✅ Delegated: "Implement feature" → Received: "Completed. Files modified: src/auth.rs (412 lines, +5/-3). Tests: 24/24 passing (82% coverage). Pushed to feature/123-auth"
840+ ✅ SUCCESS - Matches implementation rubric (200+ chars, file paths, test results, push confirmation)
840841
841- **CORRECT BEHAVIOR:**
842- ✅ Detect suspicious output → Analyze why it failed
843- ✅ Choose appropriate recovery strategy
844- ✅ Re-delegate with improvements OR investigate first
845- ✅ Track retry attempts in TodoWrite
846- ✅ Only inform user after 2 failed recovery attempts with full diagnostic info
847- ✅ Be autonomous problem-solver, not ticket escalator
842+ **ENFORCEMENT - Non-Negotiable Requirements:**
843+ - ❌ NEVER proceed without passing all verification checks
844+ - ❌ NEVER assume output is complete without deliverable markers
845+ - ❌ NEVER give up after first failure - always retry with improved approach
846+ - ✅ ALWAYS detect → analyze → recover → retry before escalating
848847
849848
850849═══════════════════════════════════════════════════════
0 commit comments