@sandrinio/vbounce 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +107 -0
  2. package/bin/vbounce.mjs +165 -0
  3. package/brains/AGENTS.md +129 -0
  4. package/brains/CLAUDE.md +146 -0
  5. package/brains/GEMINI.md +134 -0
  6. package/brains/SETUP.md +180 -0
  7. package/brains/claude-agents/architect.md +140 -0
  8. package/brains/claude-agents/developer.md +69 -0
  9. package/brains/claude-agents/devops.md +219 -0
  10. package/brains/claude-agents/qa.md +112 -0
  11. package/brains/claude-agents/scribe.md +141 -0
  12. package/brains/cursor-rules/vbounce-docs.mdc +41 -0
  13. package/brains/cursor-rules/vbounce-process.mdc +45 -0
  14. package/brains/cursor-rules/vbounce-rules.mdc +26 -0
  15. package/package.json +40 -0
  16. package/skills/agent-team/SKILL.md +425 -0
  17. package/skills/doc-manager/SKILL.md +278 -0
  18. package/skills/lesson/SKILL.md +90 -0
  19. package/skills/react-best-practices/SKILL.md +3014 -0
  20. package/skills/react-best-practices/rules/_sections.md +46 -0
  21. package/skills/react-best-practices/rules/_template.md +28 -0
  22. package/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
  23. package/skills/react-best-practices/rules/advanced-init-once.md +42 -0
  24. package/skills/react-best-practices/rules/advanced-use-latest.md +39 -0
  25. package/skills/react-best-practices/rules/async-api-routes.md +38 -0
  26. package/skills/react-best-practices/rules/async-defer-await.md +80 -0
  27. package/skills/react-best-practices/rules/async-dependencies.md +51 -0
  28. package/skills/react-best-practices/rules/async-parallel.md +28 -0
  29. package/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
  30. package/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
  31. package/skills/react-best-practices/rules/bundle-conditional.md +31 -0
  32. package/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
  33. package/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
  34. package/skills/react-best-practices/rules/bundle-preload.md +50 -0
  35. package/skills/react-best-practices/rules/client-event-listeners.md +74 -0
  36. package/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
  37. package/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
  38. package/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
  39. package/skills/react-best-practices/rules/js-batch-dom-css.md +107 -0
  40. package/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
  41. package/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
  42. package/skills/react-best-practices/rules/js-cache-storage.md +70 -0
  43. package/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
  44. package/skills/react-best-practices/rules/js-early-exit.md +50 -0
  45. package/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
  46. package/skills/react-best-practices/rules/js-index-maps.md +37 -0
  47. package/skills/react-best-practices/rules/js-length-check-first.md +49 -0
  48. package/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
  49. package/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
  50. package/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
  51. package/skills/react-best-practices/rules/rendering-activity.md +26 -0
  52. package/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
  53. package/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
  54. package/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
  55. package/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
  56. package/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
  57. package/skills/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
  58. package/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
  59. package/skills/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
  60. package/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
  61. package/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
  62. package/skills/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
  63. package/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
  64. package/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
  65. package/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
  66. package/skills/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
  67. package/skills/react-best-practices/rules/rerender-memo.md +44 -0
  68. package/skills/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
  69. package/skills/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
  70. package/skills/react-best-practices/rules/rerender-transitions.md +40 -0
  71. package/skills/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
  72. package/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
  73. package/skills/react-best-practices/rules/server-auth-actions.md +96 -0
  74. package/skills/react-best-practices/rules/server-cache-lru.md +41 -0
  75. package/skills/react-best-practices/rules/server-cache-react.md +76 -0
  76. package/skills/react-best-practices/rules/server-dedup-props.md +65 -0
  77. package/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
  78. package/skills/react-best-practices/rules/server-serialization.md +38 -0
  79. package/skills/vibe-code-review/SKILL.md +70 -0
  80. package/skills/vibe-code-review/references/deep-audit.md +259 -0
  81. package/skills/vibe-code-review/references/pr-review.md +234 -0
  82. package/skills/vibe-code-review/references/quick-scan.md +178 -0
  83. package/skills/vibe-code-review/references/report-template.md +189 -0
  84. package/skills/vibe-code-review/references/trend-check.md +224 -0
  85. package/skills/vibe-code-review/scripts/generate-snapshot.sh +89 -0
  86. package/skills/vibe-code-review/scripts/pr-analyze.sh +180 -0
  87. package/skills/write-skill/SKILL.md +133 -0
  88. package/templates/charter.md +144 -0
  89. package/templates/delivery_plan.md +188 -0
  90. package/templates/epic.md +200 -0
  91. package/templates/hotfix.md +57 -0
  92. package/templates/risk_registry.md +89 -0
  93. package/templates/roadmap.md +176 -0
  94. package/templates/sprint_report.md +151 -0
  95. package/templates/story.md +150 -0
@@ -0,0 +1,425 @@
1
+ ---
2
+ name: agent-team
3
+ description: "Use when you need to delegate implementation tasks to specialized agents (Developer, QA, Architect, DevOps, Scribe) as the Team Lead. Activates when orchestrating the Bounce phase — delegating stories, monitoring reports, merging completed work, consolidating sprint results, and generating product documentation. Uses git worktrees for story isolation. Works with Claude Code subagents natively; file-based handoffs for other tools."
4
+ ---
5
+
6
+ # Agent Team Orchestration
7
+
8
+ ## Overview
9
+
10
+ This skill defines how the Team Lead delegates work to specialized agents during Phase 2: The Bounce. Each story is isolated in a **git worktree** to prevent cross-contamination. Agents communicate exclusively through structured report files.
11
+
12
+ **Core principle:** The Team Lead plans and coordinates. It never writes implementation code itself.
13
+
14
+ ## When to Use
15
+
16
+ - When executing the Bounce phase of a sprint.
17
+ - When delegating stories to Developer, QA, Architect, or DevOps agents.
18
+ - When consolidating agent reports into a Sprint Report.
19
+ - When a story needs to be bounced between agents.
20
+ - When merging completed stories or releasing sprints (delegate to DevOps).
21
+ - When generating or updating product documentation (delegate to Scribe).
22
+
23
+ ## Agent Roster
24
+
25
+ | Agent | Config File | Role | Tools | Skills |
26
+ |-------|------------|------|-------|--------|
27
+ | Developer | `.claude/agents/developer.md` | Feature implementation and debugging | Read, Edit, Write, Bash, Glob, Grep | react-best-practices, lesson |
28
+ | QA | `.claude/agents/qa.md` | Adversarial testing and validation | Read, Bash, Glob, Grep | vibe-code-review (Quick Scan, PR Review), lesson |
29
+ | Architect | `.claude/agents/architect.md` | Structural integrity and standards | Read, Glob, Grep, Bash | vibe-code-review (Deep Audit, Trend Check), lesson |
30
+ | DevOps | `.claude/agents/devops.md` | Git operations, merges, deploys, infra | Read, Edit, Write, Bash, Glob, Grep | lesson |
31
+ | Scribe | `.claude/agents/scribe.md` | Product documentation generation | Read, Write, Bash, Glob, Grep | lesson |
32
+
33
+ ---
34
+
35
+ ## Git Worktree Strategy
36
+
37
+ Every story gets its own worktree. This isolates code changes so a failed fix on Story 01 never contaminates Story 02.
38
+
39
+ ### Branch Model
40
+
41
+ ```
42
+ main ← production
43
+ └── sprint/S-01 ← sprint branch (cut from main)
44
+ ├── story/STORY-001-01 ← story branch (worktree)
45
+ ├── story/STORY-001-02 ← story branch (worktree)
46
+ └── story/STORY-001-03 ← story branch (worktree)
47
+ ```
48
+
49
+ ### Directory Layout
50
+
51
+ ```
52
+ repo/ ← main working directory
53
+ ├── .worktrees/ ← worktree root (GITIGNORED)
54
+ │ ├── STORY-001-01/ ← isolated worktree for story
55
+ │ │ ├── (full codebase checkout)
56
+ │ │ └── .bounce/ ← reports live here during bounce
57
+ │ │ ├── tasks/
58
+ │ │ └── reports/
59
+ │ └── STORY-001-02/
60
+ │ └── ...
61
+
62
+ └── .bounce/
63
+ ├── reports/ ← active working reports (GITIGNORED)
64
+ ├── sprint-report.md ← current sprint report (GITIGNORED)
65
+ └── archive/ ← completed sprint history (COMMITTED TO GIT)
66
+ └── S-01/
67
+ ├── STORY-001-01/ ← all agent reports for this story
68
+ ├── sprint-report.md ← final sprint report
69
+ └── sprint-devops.md ← release report
70
+ ```
71
+
72
+ ### V-Bounce State → Git Operations
73
+
74
+ | V-Bounce State | Git Operation |
75
+ |---------------|---------------|
76
+ | Sprint starts | `git checkout -b sprint/S-01 main` |
77
+ | Ready to Bounce | `git worktree add .worktrees/STORY-{ID} -b story/STORY-{ID} sprint/S-01` |
78
+ | Bouncing | All work happens inside `.worktrees/STORY-{ID}/` |
79
+ | Done | Merge story branch → sprint branch, `git worktree remove` |
80
+ | Sprint Review → Done | Merge sprint branch → main |
81
+ | Escalated | Worktree kept but frozen (no new commits) |
82
+ | Parking Lot | Worktree removed, branch preserved unmerged |
83
+
84
+ ### Worktree Commands
85
+
86
+ ```bash
87
+ # Sprint initialization
88
+ git checkout -b sprint/S-01 main
89
+
90
+ # Create worktree for a story
91
+ git worktree add .worktrees/STORY-001-01 -b story/STORY-001-01 sprint/S-01
92
+ mkdir -p .worktrees/STORY-001-01/.bounce/{tasks,reports}
93
+
94
+ # List active worktrees
95
+ git worktree list
96
+
97
+ # Merge completed story into sprint branch
98
+ git checkout sprint/S-01
99
+ git merge story/STORY-001-01 --no-ff -m "Merge STORY-001-01: {Story Name}"
100
+
101
+ # Remove worktree after merge
102
+ git worktree remove .worktrees/STORY-001-01
103
+ git branch -d story/STORY-001-01
104
+
105
+ # Merge sprint into main
106
+ git checkout main
107
+ git merge sprint/S-01 --no-ff -m "Sprint S-01: {Sprint Goal}"
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Orchestration Patterns
113
+
114
+ ### Pattern 1: Claude Code Subagents (Primary)
115
+
116
+ The Team Lead spawns agents using Claude Code's Task tool. Each subagent works inside the story's worktree.
117
+
118
+ **Critical:** Always set the working directory to the worktree when delegating:
119
+ ```
120
+ Lead: "Use the developer subagent. Working directory: .worktrees/STORY-001-01/
121
+ Read the story spec at product_plans/{delivery}/EPIC-001_{name}/STORY-001-01.md
122
+ and implement it.
123
+ Write the implementation report to .bounce/reports/STORY-001-01-dev.md"
124
+ ```
125
+
126
+ **Parallel delegation (independent stories in separate worktrees):**
127
+ ```
128
+ Lead: "Use the developer subagent in .worktrees/STORY-001-01/"
129
+ AND "Use the developer subagent in .worktrees/STORY-001-02/"
130
+ (safe — each worktree is fully isolated)
131
+ ```
132
+
133
+ **Background delegation:**
134
+ Press Ctrl+B for long-running agent tasks. Background agents auto-deny unknown permissions.
135
+
136
+ ### Pattern 2: Agent Teams (Experimental)
137
+
138
+ For sustained parallel coordination with inter-agent messaging. Enable with `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`. Each teammate works in a dedicated worktree.
139
+
140
+ ### Pattern 3: File-Based Handoffs (Cross-Tool Fallback)
141
+
142
+ For tools without native subagent support (Cursor, Codex, Gemini, Antigravity):
143
+
144
+ 1. Lead writes a task file to `.worktrees/STORY-{ID}/.bounce/tasks/STORY-{ID}-{agent}.md`
145
+ 2. Open the worktree directory in the target tool (Cursor, Antigravity, etc.)
146
+ 3. Agent reads the task file, executes, writes report to `.bounce/reports/`
147
+ 4. Lead monitors reports from the main repo
148
+
149
+ ---
150
+
151
+ ## The Report Buffer (Hybrid Model)
152
+
153
+ **During bounce:** Reports live INSIDE the story's worktree at `.worktrees/STORY-{ID}/.bounce/reports/`. This keeps reports co-located with the code they describe.
154
+
155
+ **After story completes:** Reports are archived to the shared `.bounce/archive/S-{XX}/STORY-{ID}/` in the main repo before the worktree is removed.
156
+
157
+ **Sprint Report:** Always written to `.bounce/sprint-report.md` in the main repo (not in any worktree).
158
+
159
+ ### Report File Naming
160
+
161
+ `STORY-{EpicID}-{StoryID}-{agent}[-bounce{N}].md`
162
+
163
+ Examples:
164
+ - `STORY-001-01-dev.md` — first Dev report
165
+ - `STORY-001-01-qa-bounce1.md` — first QA report (found bugs)
166
+ - `STORY-001-01-dev-bounce2.md` — Dev's fix after QA bounce
167
+ - `STORY-001-01-qa-bounce2.md` — second QA report (passed)
168
+ - `STORY-001-01-arch.md` — Architect audit
169
+ - `STORY-001-01-devops.md` — DevOps merge report
170
+ - `STORY-001-01-conflict.md` — Spec conflict (if any)
171
+ - `sprint-S-01-devops.md` — Sprint release report
172
+ - `sprint-S-01-scribe.md` — Documentation generation report
173
+
174
+ ---
175
+
176
+ ## The Bounce Sequence
177
+
178
+ ### Step 0: Sprint Setup
179
+ ```
180
+ 1. Cut sprint branch from main:
181
+ git checkout -b sprint/S-01 main
182
+ mkdir -p .bounce/archive
183
+
184
+ 2. Read RISK_REGISTRY.md — check for open risks relevant to this sprint's stories.
185
+ If high-severity risks affect planned stories, flag to human before proceeding.
186
+
187
+ 3. Read DELIVERY_PLAN.md — check §5 Open Questions.
188
+ If unresolved questions block stories in this sprint, flag to human.
189
+ Do NOT start bouncing stories with unresolved blocking questions.
190
+
191
+ 4. If product_documentation/_manifest.json exists, read it.
192
+ Understand what's already documented — this informs which stories
193
+ may require doc updates after the sprint.
194
+
195
+ 5. Triage Requests: If an incoming task is an L1 Trivial change (1-2 files),
196
+ use the **Hotfix Path**:
197
+ a. Create `HOTFIX-{Date}-{Name}.md` using the template.
198
+ b. Delegate to Developer (no worktree needed if acting on active branch).
199
+ c. Developer runs `hotfix_manager.sh ledger "{Title}" "{Description}"` after implementation.
200
+ d. Human/Lead verifies manually.
201
+ e. DevOps runs `hotfix_manager.sh sync` to update any active story worktrees.
202
+ f. Update Delivery Plan Status to "Done".
203
+
204
+ 6. Update DELIVERY_PLAN.md: Sprint Status → "Active"
205
+ ```
206
+
207
+ ### Step 1: Story Initialization
208
+ For each story with V-Bounce State "Ready to Bounce":
209
+ ```bash
210
+ # Create isolated worktree
211
+ git worktree add .worktrees/STORY-{ID} -b story/STORY-{ID} sprint/S-01
212
+ mkdir -p .worktrees/STORY-{ID}/.bounce/{tasks,reports}
213
+ ```
214
+ - Read the full Story spec
215
+ - Read LESSONS.md
216
+ - Check RISK_REGISTRY.md for risks tagged to this story or its Epic
217
+ - If `product_documentation/_manifest.json` exists, identify docs relevant to this story's scope (match against manifest descriptions/tags). Include relevant doc references in the task file so the Developer has product context.
218
+ - Create task file in `.worktrees/STORY-{ID}/.bounce/tasks/`
219
+ - Update DELIVERY_PLAN.md: V-Bounce State → "Bouncing"
220
+
221
+ ### Step 2: Developer Pass
222
+ ```
223
+ 1. Spawn developer subagent in .worktrees/STORY-{ID}/ with:
224
+ - Story §1 The Spec + §3 Implementation Guide
225
+ - LESSONS.md
226
+ - Relevant react-best-practices rules
227
+ 2. Developer writes code and Implementation Report to .bounce/reports/
228
+ 3. Lead reads report, verifies completeness
229
+ ```
230
+
231
+ ### Step 3: QA Pass
232
+ ```
233
+ 1. Spawn qa subagent in .worktrees/STORY-{ID}/ with:
234
+ - Developer Implementation Report
235
+ - Story §2 The Truth (acceptance criteria)
236
+ - LESSONS.md
237
+ 2. QA validates against Gherkin scenarios, runs vibe-code-review
238
+ 3. If FAIL:
239
+ - QA writes Bug Report (STORY-{ID}-qa-bounce{N}.md)
240
+ - Increment bounce counter
241
+ - If QA bounce count >= 3 → V-Bounce State → "Escalated", STOP
242
+ - Else → Return to Step 2 with Bug Report as input
243
+ 4. If PASS:
244
+ - QA writes Validation Report
245
+ - V-Bounce State → "QA Passed"
246
+ ```
247
+
248
+ ### Step 4: Architect Pass
249
+ ```
250
+ 1. Spawn architect subagent in .worktrees/STORY-{ID}/ with:
251
+ - All reports for this story
252
+ - Full Story spec + Roadmap §3 ADRs
253
+ - LESSONS.md
254
+ 2. If FAIL:
255
+ - Increment Architect bounce counter
256
+ - If Architect bounce count >= 3 → V-Bounce State → "Escalated", STOP
257
+ - Else → Return to Step 2 with Architect feedback as input
258
+ 3. If PASS:
259
+ - V-Bounce State → "Architect Passed"
260
+ ```
261
+
262
+ ### Step 5: Story Merge (DevOps)
263
+ ```
264
+ 1. Spawn devops subagent with:
265
+ - Story ID and sprint branch name
266
+ - All gate reports (QA PASS + Architect PASS)
267
+ - LESSONS.md
268
+ 2. DevOps performs:
269
+ - Pre-merge checks (worktree clean, gate reports verified)
270
+ - Archive reports to .bounce/archive/S-{XX}/STORY-{ID}/
271
+ - Merge story branch into sprint branch (--no-ff)
272
+ - Post-merge validation (tests + build on sprint branch)
273
+ - Worktree removal and story branch cleanup
274
+ 3. DevOps writes Merge Report to .bounce/archive/S-{XX}/STORY-{ID}/STORY-{ID}-devops.md
275
+ 4. If merge conflicts:
276
+ - Simple (imports, whitespace): DevOps resolves directly
277
+ - Complex (logic): DevOps writes Conflict Report, Lead creates fix story
278
+ 5. If post-merge tests fail: DevOps reverts merge, reports failure to Lead
279
+ ```
280
+ Update DELIVERY_PLAN.md: V-Bounce State → "Done"
281
+
282
+ ### Step 6: Sprint Integration Audit
283
+ After ALL stories are merged into `sprint/S-01`:
284
+ ```
285
+ 1. Spawn architect subagent on sprint/S-01 branch
286
+ 2. First, Architect runs `./scripts/hotfix_manager.sh audit` to check for hotfix drift. If it fails, perform deep audit on flagged files.
287
+ 3. Run Sprint Integration Audit — Deep Audit on combined changes
288
+ 4. Check for: duplicate routes, competing state, overlapping migrations
289
+ 5. If issues found → create new stories to fix, bounce individually
290
+ ```
291
+
292
+ ### Step 7: Sprint Consolidation
293
+ ```
294
+ 1. Read all archived reports in .bounce/archive/S-{XX}/
295
+ 2. Generate Sprint Report to .bounce/sprint-report.md
296
+ 3. V-Bounce State → "Sprint Review" for all stories
297
+ 4. Present Sprint Report to human
298
+ 5. After approval → Spawn devops subagent for Sprint Release:
299
+ - Merge sprint/S-01 → main (--no-ff)
300
+ - Tag release: v{VERSION}
301
+ - Run full test suite + build + lint on main
302
+ - Sprint branch cleanup
303
+ - Environment verification (if applicable)
304
+ - DevOps writes Sprint Release Report to .bounce/archive/S-{XX}/sprint-devops.md
305
+ 6. Lead finalizes:
306
+ - Move sprint-report.md to .bounce/archive/S-{XX}/
307
+ - Record lessons (with user approval)
308
+ - Update DELIVERY_PLAN.md
309
+ 7. Product Documentation check (runs on `main` after sprint merge):
310
+ - If sprint delivered 3+ features, or if any Developer report flagged
311
+ stale product docs → offer to run vdoc to generate/update
312
+ product_documentation/
313
+ - If user approves → spawn scribe subagent on `main` branch with:
314
+ - Sprint Report (what was built)
315
+ - Dev reports that flagged affected product docs
316
+ - Current _manifest.json (if exists)
317
+ - Mode: "audit" (if docs exist) or "init" (if first time)
318
+ - Scribe generates/updates docs and writes Scribe Report
319
+ - Documentation is post-implementation — it reflects what was built
320
+ - Scribe commits documentation as a follow-up commit on `main`
321
+ ```
322
+
323
+ ---
324
+
325
+ ## Cleanup Process
326
+
327
+ ### After Each Story Completes (DevOps handles via Step 5)
328
+ 1. Archive reports to `.bounce/archive/S-{XX}/STORY-{ID}/`
329
+ 2. Merge story branch into sprint branch (--no-ff)
330
+ 3. Validate tests/build on sprint branch
331
+ 4. Remove worktree: `git worktree remove .worktrees/STORY-{ID}`
332
+ 5. Delete story branch: `git branch -d story/STORY-{ID}`
333
+ 6. Write DevOps Merge Report
334
+
335
+ ### After Sprint Completes (DevOps handles via Step 7)
336
+ 1. Merge sprint branch into main (--no-ff)
337
+ 2. Tag release: `git tag -a v{VERSION}`
338
+ 3. Run full validation (tests + build + lint)
339
+ 4. Delete sprint branch: `git branch -d sprint/S-{XX}`
340
+ 5. Verify `.worktrees/` is empty (all worktrees removed)
341
+ 6. Write Sprint Release Report
342
+ 7. Lead updates DELIVERY_PLAN.md: move sprint to §6 Completed Sprints
343
+
344
+ ### After Delivery Completes (Team Lead handles)
345
+ When ALL sprints in a delivery (release) are done:
346
+ 1. Verify all stories in the delivery are "Done" in the Delivery Plan
347
+ 2. Move the entire delivery folder to archive:
348
+ ```bash
349
+ mv product_plans/D-{NN}_{release_name}/ product_plans/archive/D-{NN}_{release_name}/
350
+ ```
351
+ 3. Add a **Delivery Log** entry to the Roadmap (§7):
352
+ - Delivery ID, date, release tag
353
+ - Release Notes — summarize all sprint reports from this delivery
354
+ - Key metrics (stories delivered, bounce ratio, correction tax averages)
355
+ 4. Update Roadmap §2 Release Plan: set the release status to "Delivered"
356
+
357
+ ### Retention
358
+ - `.bounce/archive/` is **committed to git** — full sprint history, all agent reports, audit trail
359
+ - `.bounce/reports/` and `.bounce/sprint-report.md` are **gitignored** — active working files only
360
+ - `product_plans/archive/` retains completed deliveries with all their epics, stories, and delivery plans
361
+ - `.worktrees/` is **gitignored** — ephemeral, exists only during active bouncing
362
+ - Story branches are deleted after merge
363
+ - Sprint branches are deleted after merge to main
364
+
365
+ ---
366
+
367
+ ## Delivery Plan Sync
368
+
369
+ The Team Lead MUST update DELIVERY_PLAN.md at every state transition. This is the source of truth.
370
+
371
+ | Action | Delivery Plan Update |
372
+ |--------|---------------------|
373
+ | Worktree created | §3 Active Sprint: V-Bounce State → "Bouncing" |
374
+ | Dev report written | No update (still "Bouncing") |
375
+ | QA passes | §3 Active Sprint: V-Bounce State → "QA Passed" |
376
+ | Architect passes | §3 Active Sprint: V-Bounce State → "Architect Passed" |
377
+ | DevOps merges story | §3 Active Sprint: V-Bounce State → "Done" |
378
+ | Escalated | §4 Backlog → Escalated table |
379
+ | DevOps merges sprint | §6 Completed Sprints: add summary row |
380
+
381
+ ---
382
+
383
+ ## Edge Case Handling
384
+
385
+ ### Spec Conflict
386
+ Developer writes a Spec Conflict Report. Lead pauses the bounce:
387
+ - Remove worktree (preserve branch for reference)
388
+ - Return story to Refinement in DELIVERY_PLAN.md
389
+ - After spec is fixed, recreate worktree and restart bounce
390
+
391
+ ### Escalated Stories
392
+ When QA bounce count >= 3 OR Architect bounce count >= 3:
393
+ - Worktree is kept but frozen (no new work)
394
+ - Lead writes Escalation Report to `.bounce/archive/S-{XX}/STORY-{ID}/escalation.md`
395
+ - Human decides: rewrite spec → Refinement, descope → split, kill → Parking Lot
396
+ - **If returned to Refinement:** The spec has been rewritten. You MUST reset the QA and Architect bounce counters to 0 for this story.
397
+ - If killed: `git worktree remove`, branch preserved unmerged
398
+
399
+ ### Mid-Sprint Charter Changes
400
+ Charter and Roadmap are **frozen** during active sprints. Changes queued in `CHANGE_QUEUE.md`, applied at sprint boundaries. Critical risks trigger Emergency Sprint Review.
401
+
402
+ ### Merge Conflicts
403
+ If merging story branch into sprint branch creates conflicts:
404
+ - DevOps resolves simple conflicts (import ordering, adjacent edits, whitespace)
405
+ - Complex conflicts (logic changes, competing implementations): DevOps writes a Merge Conflict Report, Lead creates a new story to resolve through the normal bounce flow
406
+
407
+ ---
408
+
409
+ ## Critical Rules
410
+
411
+ - **The Lead never writes code.** It plans, delegates, monitors, and consolidates.
412
+ - **One story = one worktree.** Never mix stories in a single worktree.
413
+ - **Reports are the only handoff.** No agent communicates with another directly.
414
+ - **One bounce = one report.** Every agent pass produces exactly one report file.
415
+ - **Archive before remove.** Always copy reports to shared archive before removing a worktree.
416
+ - **Sync the Delivery Plan.** Update V-Bounce state at EVERY transition. The Delivery Plan is the source of truth.
417
+ - **Track bounce counts.** QA and Architect bounces are tracked separately per story.
418
+ - **Git tracking rules.** `.worktrees/`, `.bounce/reports/`, and `.bounce/sprint-report.md` are gitignored (ephemeral). `.bounce/archive/` is **committed to git** (permanent audit trail).
419
+ - **Check risks before bouncing.** Read RISK_REGISTRY.md at sprint start. Flag high-severity risks that affect planned stories.
420
+ - **Resolve open questions first.** Read DELIVERY_PLAN.md §5 Open Questions at sprint start. Do not bounce stories with unresolved blocking questions.
421
+ - **Know what's documented.** If `product_documentation/_manifest.json` exists, read it at sprint start. Pass relevant doc references to agents. Offer documentation updates after sprints that deliver new features.
422
+
423
+ ## Keywords
424
+
425
+ delegate, orchestrate, subagent, agent team, bounce, sprint, report, worktree, git, isolation, merge, branch, cleanup, archive, delivery plan