- Nx 22.7 monorepo (pnpm 11.1, TypeScript 5.9, Node 24) - apps/api: NestJS 11 (CJS conforme CODING-RULES.md PGD-DB-004) - apps/web: React 19 + Vite 8 (ESM) - libs/shared/api-interface: Zod contract base - Docker Compose dev: Postgres 18, Valkey 8, MinIO, Mailpit - WDS artifacts: - design-artifacts/A-Product-Brief/ (5 docs canônicos + 16 dialogs) - design-artifacts/B-Trigger-Map/ (hub + 4 personas + feature impact) - Stack canon: STACK.md v2.2 + CODING-RULES.md v2.0 + brand.md - AGENTS.md + README.md como entrada para devs/agentes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.5 KiB
3.5 KiB
Stop Hook Recovery
You are reading this because the Stop hook blocked your attempt to stop.
Decision Matrix
Find your scenario and follow the action exactly:
| Scenario | Action | Why |
|---|---|---|
| Just finished a story, more in queue | CONTINUE → Process next story | Stopping between stories wastes progress |
| Session completed successfully | CONTINUE → Check state, process output | Session done ≠ orchestration done |
| Session failed/errored | CONTINUE → Follow retry/fallback strategy | Retries not exhausted yet |
| Feeling uncertain what to do | CONTINUE → Check state document, follow step instructions | Uncertainty is not a blocker |
| Want to "check in" with user | CONTINUE → User will interrupt if needed | User doesn't want status updates |
| Waiting at a menu for user input | DECIDE → Use sub-agent to gather context, make informed decision | Don't block on user, keep moving |
| Multiple valid paths forward | DECIDE → Pick the path most likely to finish stories in order | Your job is to finish, not ask |
| Unrecoverable error (all retries exhausted) | STOP → Follow stop procedure below | Cannot proceed without intervention |
| External dependency down (API, service) | RETRY → Sleep with increasing delay (1m, 2m, 4m, 8m, 16m), max 5 attempts | Often recovers on its own |
| User explicitly requested stop earlier | STOP → Follow stop procedure below | Honoring user intent |
Quick Reference
CONTINUE (Most Scenarios)
- Read your state document
- Check
currentStep,storyQueue,currentStoryId - Resume execution from where you left off
- Process the next story in queue
DECIDE (Autonomous Decision Required)
- Spawn sub-agent to analyze current context
- Gather: state document, recent session output, story requirements
- Make the decision most likely to complete stories in order
- Document decision in state log, then execute
- Never wait for user - your job is to keep moving
RETRY (External Dependency Issues)
- Log the failure with timestamp
- Sleep with exponential backoff: 1m → 2m → 4m → 8m → 16m
- Retry the operation after each sleep
- After 5 failed attempts → treat as unrecoverable → STOP
STOP (Genuinely Unrecoverable)
- Update state document status to
STOPPED - Delete marker using the installed helper:
orchestrator-helper marker remove - Log WHY you stopped (be specific)
- Exit cleanly
Stop Hook Messages ≠ User Input
The stop hook fires when Claude pauses, not just when explicitly stopping.
If you see this while at a decision point:
- This message is NOT telling you what to choose
- Use a sub-agent to gather context and DECIDE autonomously
- Do NOT wait for user - make the call yourself
Core Principle
Your job is to finish every story in the correct order.
Do whatever it takes. Make autonomous decisions. Only stop when genuinely unrecoverable (all retries exhausted, user explicitly requested stop).
Common Mistakes to Avoid
| Mistake | Correct Behavior |
|---|---|
| Stopping to report progress | Continue silently, user sees state doc |
| Stopping after one story completes | Continue to next story |
| Stopping because session errored | Follow retry strategy first |
| Waiting for user at decision points | Decide autonomously, keep moving |
| Stopping on first API/service failure | Retry with exponential backoff (5 attempts) |
| Asking user which path to take | Pick the path that finishes stories in order |