@@ -390,6 +390,143 @@ After each task completes, mentally note its category based on the work done:
390390- Don't add hints if categories have been diverse
391391- The planner will adjust priorities based on the hint
392392
393+ ## Recovery Flow Examples
394+
395+ These examples show the exact flow of commands and decisions when handling common failure modes.
396+
397+ ### Example 1: Task Fails Mid-Execution
398+
399+ A builder reports it cannot complete a task due to missing dependencies or prerequisites.
400+
401+ ```
402+ [CYCLE 3, Task 3 of 5]
403+
404+ > @opencoder-builder Execute this task: Add input validation
405+
406+ Add zod schemas to validate API request bodies.
407+ Files: src/api/users.ts, src/schemas/user.ts
408+ Done when: Invalid requests return 400 with error details
409+
410+ < Builder response:
411+ ## Blocked: Add input validation
412+ **Reason:** zod package not installed
413+ **Attempted:** Tried to import zod, checked package.json
414+ **Suggestion:** Run `bun add zod` first
415+ **Status:** READY_FOR_NEXT_TASK
416+
417+ > Decision: Task blocked, no changes made
418+ > Log: "Task 3 blocked - missing zod dependency"
419+ > Action: Skip commit (nothing to commit), proceed to Task 4
420+
421+ > @opencoder-builder Execute this task: Update error messages...
422+
423+ [After cycle completes]
424+ > Pass blocker context to planner in next cycle:
425+ @opencoder-planner Analyze the codebase. Note: Task "Add input validation"
426+ was blocked due to missing zod dependency. Consider adding dependency
427+ installation as a prerequisite task.
428+ ```
429+
430+ ** Key decisions:**
431+ - No commit for blocked tasks (no changes were made)
432+ - Continue to next task immediately
433+ - Pass blocker context to planner for next cycle
434+
435+ ### Example 2: Git Push Fails Requiring Rebase
436+
437+ Remote has new commits that must be integrated before pushing.
438+
439+ ```
440+ [End of Cycle 4]
441+
442+ > git push
443+ < error: failed to push some refs to 'origin/main'
444+ hint: Updates were rejected because the remote contains work that you do
445+ hint: not have locally. This is usually caused by another repository pushing
446+ hint: to the same ref. You may want to first integrate the remote changes
447+
448+ > Recovery sequence:
449+ > git pull --rebase
450+ < Successfully rebased and updated refs/heads/main.
451+ First, rewinding head to replay your work on top of it...
452+ Applying: fix: resolve null pointer in user service
453+ Applying: feat: add input validation
454+ Applying: test: add unit tests for validation
455+
456+ > git push
457+ < To github.com:user/repo.git
458+ abc123..def456 main -> main
459+
460+ > Success - continue to next cycle
461+ > /clear
462+ > "Cycle 4 complete: Fixed null pointer, added validation and tests"
463+
464+ [CYCLE 5]
465+ > @opencoder-planner Analyze the codebase...
466+ ```
467+
468+ ** Key decisions:**
469+ - Use ` git pull --rebase ` to preserve linear history
470+ - Retry push exactly once after successful rebase
471+ - If rebase has conflicts, resolve them before retrying
472+ - Continue to next cycle after successful push
473+
474+ ### Example 3: Planner Returns No Actionable Tasks
475+
476+ Planner returns fewer than 3 tasks or claims the codebase needs no improvements.
477+
478+ ```
479+ [CYCLE 7]
480+
481+ > @opencoder-planner Analyze the codebase and create a development plan with 3-7 prioritized tasks.
482+
483+ < Planner response:
484+ ## Development Plan
485+
486+ The codebase is well-maintained with good test coverage.
487+ I found only minor improvements:
488+
489+ ### Task 1: Update copyright year
490+ **Priority:** P3
491+ **Complexity:** Low
492+ **Description:** Update copyright to 2026
493+
494+ (Only 1 task returned)
495+
496+ > FORBIDDEN: Planner must return 3-7 tasks
497+ > Re-invoke with explicit guidance:
498+
499+ > @opencoder-planner Analyze the codebase. You MUST return 3-7 tasks.
500+ The previous response only contained 1 task, which is insufficient.
501+
502+ Consider these often-overlooked areas:
503+ - Error message quality and user-friendliness
504+ - Edge case handling in core functions
505+ - Test coverage depth (not just breadth)
506+ - Documentation freshness and accuracy
507+ - Performance optimizations (caching, lazy loading)
508+ - Security hardening (input sanitization, auth checks)
509+ - Developer experience (logging, debugging support)
510+ - Accessibility improvements
511+ - Code consistency across modules
512+
513+ < Planner returns 5 tasks:
514+ ### Task 1: Improve error messages in API handlers
515+ ### Task 2: Add edge case tests for date parsing
516+ ### Task 3: Cache expensive database queries
517+ ### Task 4: Add request logging middleware
518+ ### Task 5: Standardize error response format
519+
520+ > Continue normally with 5-task plan
521+ > @opencoder-builder Execute this task: Improve error messages in API handlers...
522+ ```
523+
524+ ** Key decisions:**
525+ - Never accept "codebase looks good" - there is ALWAYS room for improvement
526+ - Re-invoke planner with explicit category suggestions
527+ - Provide the list of improvement areas to guide the planner
528+ - Only proceed once 3-7 actionable tasks are returned
529+
393530## Git Operations
394531
395532### After Each Task Completes
0 commit comments