@sandrinio/vbounce 1.9.0 → 2.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.
package/README.md CHANGED
@@ -8,9 +8,162 @@ V-Bounce Engine turns AI assistants — Claude Code, Cursor, Gemini, Copilot, Co
8
8
 
9
9
  ---
10
10
 
11
- ## How It Works
11
+ ## The Problem
12
12
 
13
- V-Bounce Engine is built around a **Context Loop** a closed feedback system that makes agents smarter with each sprint.
13
+ AI coding agents are powerfulbut without structure, they create expensive chaos:
14
+
15
+ - **No accountability.** The agent writes code, but nobody reviews it against requirements before it ships. Bugs that a junior engineer would catch survive to production.
16
+ - **Invisible progress.** You ask "how's the feature going?" and the only answer is "the agent is still running." No milestones, no intermediate artifacts, no way to course-correct mid-sprint.
17
+ - **No institutional memory.** Every session starts from zero. The agent makes the same architectural mistake it made last week because nothing captures what went wrong.
18
+ - **Rework cycles.** Without quality gates, bad code compounds. A missed requirement discovered late costs 10x more to fix than one caught early.
19
+ - **Risk blindness.** There's no structured way to assess what could go wrong before the agent starts building.
20
+
21
+ V-Bounce Engine solves this by wrapping AI agents in the same discipline that makes human engineering teams reliable: planning documents, role-based reviews, automated gates, and a learning loop that compounds knowledge across sprints.
22
+
23
+ ---
24
+
25
+ ## Built-in Guardrails
26
+
27
+ Every risk that keeps you up at night has a specific mechanism that catches it:
28
+
29
+ | Risk | What catches it |
30
+ |------|----------------|
31
+ | Agent ships code that doesn't match requirements | **QA gate** — validates every story against acceptance criteria before merge |
32
+ | Architectural drift over time | **Architect gate** — audits against your ADRs and safe-zone rules on every story |
33
+ | One bad story breaks everything | **Git worktrees** — every story is isolated; failures can't contaminate other work |
34
+ | Agent gets stuck in a loop | **3-bounce escalation** — after 3 failed attempts, the story surfaces to a human |
35
+ | Scope creep on "quick fixes" | **Hotfix hard-stop** — Developer must stop if a fix touches more than 2 files |
36
+ | Same mistakes keep happening | **LESSONS.md** — agents read accumulated mistakes before writing future code |
37
+ | Silent regressions | **Root cause tagging** — every failure is tagged and tracked across sprints |
38
+ | Framework itself becomes stale | **Self-improvement skill** — analyzes friction patterns and proposes changes (with your approval) |
39
+
40
+ ---
41
+
42
+ ## Planning With V-Bounce
43
+
44
+ V-Bounce separates planning into two layers: **what to build** and **how to ship it**. The AI is your planning partner — not a tool you invoke with commands.
45
+
46
+ ### Product Planning — What to Build
47
+
48
+ Just talk to the AI. Say "plan a feature for X" or "create an epic for payments" and it handles the rest — reading upstream documents, researching your codebase, and drafting planning documents.
49
+
50
+ A document hierarchy that mirrors how product teams already think:
51
+
52
+ ```
53
+ Charter (WHY — vision, principles, constraints)
54
+ → Roadmap (WHAT/WHEN — releases, milestones, architecture decisions)
55
+ → Epic (scoped WHAT — a feature with clear boundaries)
56
+ → Story (HOW — implementation spec with acceptance criteria)
57
+ ```
58
+
59
+ **You write the top levels. The AI builds the bottom — informed by your actual codebase.**
60
+
61
+ When creating Epics, the AI researches your codebase to fill Technical Context with real file paths and verified dependencies — not guesses. When decomposing Epics into Stories, the AI reads affected files, explores architecture patterns, and creates small, focused stories by deliverable (vertical slices), not by layer.
62
+
63
+ Every document includes an **ambiguity score**:
64
+ - 🔴 High — requirements unclear, blocked from development
65
+ - 🟡 Medium — tech TBD but logic is clear, safe to plan
66
+ - 🟢 Low — fully specified, ready to build
67
+
68
+ No level can be skipped. This prevents the most common AI failure mode: building the wrong thing because requirements were vague.
69
+
70
+ ### Execution Planning — How to Ship It
71
+
72
+ Once you know *what* to build, three documents govern *how* it gets delivered:
73
+
74
+ | Document | Scope | Who uses it | What it tracks |
75
+ |----------|-------|-------------|----------------|
76
+ | **Delivery Plan** | A full release (multiple sprints) | PM | Which Epics are included, project window (start/end dates), high-level backlog prioritization, escalated/parked stories |
77
+ | **Sprint Plan** | One sprint (typically 1 week) | Team Lead + PM | Active story scope, context pack readiness checklists, execution strategy (parallel vs sequential phases), dependency chains, risk flags, and a live execution log |
78
+ | **Risk Registry** | Cross-cutting (all levels) | PM + Architect | Active risks with likelihood/impact scoring, phase-stamped analysis log, mitigations, and resolution history |
79
+
80
+ **How they connect:**
81
+
82
+ ```
83
+ Delivery Plan (the milestone — "we're shipping auth + payments by March 30")
84
+ → Sprint Plan (this week — "stories 01-03 in parallel, 04 depends on 01")
85
+
86
+ Risk Registry (cross-cutting — reviewed at every sprint boundary)
87
+ ```
88
+
89
+ The **Delivery Plan** is updated only at sprint boundaries. The **Sprint Plan** is the single source of truth during active execution — every story state transition is recorded there. At sprint end, the Sprint Plan's execution log becomes the skeleton for the Sprint Report automatically.
90
+
91
+ The **Sprint Plan** also includes a **Context Pack Readiness** checklist for each story — a preflight check ensuring the spec is complete, acceptance criteria are defined, and ambiguity is low before any code is written. If a story isn't ready, it stays in Refinement.
92
+
93
+ ---
94
+
95
+ ## Reports and Visibility
96
+
97
+ V-Bounce generates structured reports at every stage — designed to answer stakeholder questions without requiring anyone to read code:
98
+
99
+ | Report | When it's generated | What it answers |
100
+ |--------|-------------------|-----------------|
101
+ | **Implementation Report** | After each story is built | What was built? What decisions were made? What tests were added? |
102
+ | **QA Report** | After validation | Does the implementation match the acceptance criteria? What failed? |
103
+ | **Architect Report** | After audit | Does this align with our architecture? Any ADR violations? |
104
+ | **Sprint Report** | End of sprint | What shipped? What bounced? What's the correction tax? Lessons learned? |
105
+ | **Release Report** | After merge | What went to production? Environment changes? Post-merge validations? |
106
+ | **Scribe Report** | After documentation pass | What product docs were created, updated, or flagged as stale? |
107
+
108
+ **You don't need to read code to manage the sprint.** The reports surface exactly what a PM or PO needs to make decisions.
109
+
110
+ ---
111
+
112
+ ## What You Can Measure
113
+
114
+ V-Bounce tracks metrics that map directly to product and delivery health:
115
+
116
+ | Metric | What it tells you | Action when it's bad |
117
+ |--------|------------------|---------------------|
118
+ | **Bounce Rate (QA)** | How often code fails acceptance criteria | Stories may have vague requirements — tighten acceptance criteria |
119
+ | **Bounce Rate (Architect)** | How often code violates architecture rules | ADRs may be unclear, or the agent needs better context |
120
+ | **Correction Tax** | 0% = agent delivered autonomously, 100% = human rewrote everything | High tax means the agent needs better guidance (Charter, Roadmap, or Skills) |
121
+ | **Root Cause Distribution** | Why things fail — `missing_tests`, `adr_violation`, `spec_ambiguity`, etc. | Invest in the category that fails most often |
122
+ | **Escalation Rate** | How often stories hit the 3-bounce limit | Chronic escalation signals structural issues in planning docs |
123
+ | **Sprint Velocity** | Stories completed per sprint | Track trend over time — should improve as LESSONS.md grows |
124
+
125
+ Run `vbounce trends` to see cross-sprint analysis. Run `vbounce suggest` for AI-generated improvement recommendations.
126
+
127
+ ---
128
+
129
+ ## How a Sprint Flows
130
+
131
+ Here's what a sprint looks like from the product side — no terminal commands, no code:
132
+
133
+ **Phase 1 — Planning**
134
+ You talk to the AI about what to build. The AI creates Epics and Stories by reading upstream documents and researching your codebase. Ambiguity, risks, and open questions are surfaced and discussed collaboratively.
135
+
136
+ **Phase 2 — Sprint Planning**
137
+ You and the AI decide what goes into the sprint together. The AI reads the backlog, proposes scope, and surfaces blockers — open questions, unresolved ambiguity, dependency risks, edge cases. You discuss, adjust, and confirm. **No sprint starts without your explicit confirmation.** The Sprint Plan is mandatory.
138
+
139
+ **Phase 3 — The Bounce**
140
+ The AI team works autonomously. For each Story:
141
+ 1. The **Developer** builds the feature in isolation (with E2E tests, not just unit tests)
142
+ 2. The **QA agent** checks: does the code meet the acceptance criteria?
143
+ 3. The **Architect agent** checks: does the code follow our architecture rules?
144
+ 4. If either check fails, the work "bounces" back to the Developer with a tagged reason
145
+ 5. After 3 bounces, the story escalates — the AI presents root causes and options (re-scope, split, spike, or remove), and you decide
146
+
147
+ Lessons are recorded **immediately** after each story merges, not deferred to sprint close.
148
+
149
+ **Phase 4 — Review**
150
+ The Sprint Report lands. It tells you:
151
+ - What shipped and what didn't
152
+ - How many bounces each story took (and why)
153
+ - The correction tax (how much human intervention was needed)
154
+ - Test counts per story
155
+ - Lessons already captured during the sprint
156
+ - Recommendations for process improvements
157
+
158
+ You review, approve the release, and the sprint archives itself. The next sprint starts smarter because the agents now carry forward everything they learned.
159
+
160
+ ---
161
+
162
+ ## Continuous Improvement
163
+
164
+ Most AI coding setups are stateless — every session starts from scratch. V-Bounce is the opposite.
165
+
166
+ The **Context Loop** is a closed feedback system that makes your AI team measurably better over time:
14
167
 
15
168
  ```
16
169
  Plan ──> Build ──> Bounce ──> Document ──> Learn
@@ -22,15 +175,121 @@ Plan ──> Build ──> Bounce ──> Document ──> Learn
22
175
  Next sprint reads it all
23
176
  ```
24
177
 
25
- **Plan.** The Team Lead writes requirements using structured templates (Charter, Epic, Story) before any code is written.
178
+ After each sprint:
179
+ - **LESSONS.md** captures every mistake — agents read this before writing future code
180
+ - **Trend analysis** spots recurring patterns (e.g., "auth-related stories bounce 3x more than average")
181
+ - **Self-improvement pipeline** analyzes friction and proposes concrete framework changes
182
+ - **Scribe** keeps product documentation in sync with actual code
183
+
184
+ Sprint 1 might have a 40% bounce rate. By Sprint 5, that number drops — because the agents have accumulated context about your codebase, your architecture decisions, and your team's standards.
185
+
186
+ ### The Self-Improvement Pipeline
187
+
188
+ When a sprint closes (`vbounce sprint close`), an automated pipeline analyzes what went wrong and proposes how to fix the framework itself:
189
+
190
+ ```
191
+ Sprint Close
192
+
193
+ ├── Trend Analysis → Cross-sprint bounce patterns
194
+
195
+ ├── Retro Parser → Reads §5 Framework Self-Assessment tables
196
+ │ from the Sprint Report
197
+
198
+ ├── Lesson Analyzer → Classifies LESSONS.md rules by what they
199
+ │ can become: gate checks, scripts, template
200
+ │ fields, or permanent agent rules
201
+
202
+ ├── Recurrence Detector → Cross-references archived sprint reports
203
+ │ to find findings that keep coming back
204
+
205
+ ├── Effectiveness Checker → Did last sprint's improvements actually
206
+ │ resolve their target findings?
207
+
208
+ └── Improvement Suggestions → Human-readable proposals with impact levels
209
+ ```
210
+
211
+ Every proposal gets an **impact level** so you know what to fix first:
212
+
213
+ | Level | Label | Meaning | When to fix |
214
+ |-------|-------|---------|-------------|
215
+ | **P0** | Critical | Blocks agent work or causes incorrect output | Before next sprint |
216
+ | **P1** | High | Causes rework — bounces, wasted tokens, repeated manual steps | This improvement cycle |
217
+ | **P2** | Medium | Friction that slows agents but doesn't block | Within 2 sprints |
218
+ | **P3** | Low | Polish — nice-to-have | Batch when convenient |
219
+
220
+ ### Lessons Become Automation
26
221
 
27
- **Build.** The Developer agent implements each Story in an isolated git worktree and submits an Implementation Report.
222
+ The pipeline doesn't just track lessons it classifies each one by what it can become:
28
223
 
29
- **Bounce.** The QA agent validates against acceptance criteria. The Architect agent audits against your architecture rules. If either fails, the work bounces back to the Developer — up to 3 times before escalating to you. Every failure is tagged with a root cause (`missing_tests`, `adr_violation`, `spec_ambiguity`, etc.) for trend analysis.
224
+ | Lesson pattern | Becomes | Example |
225
+ |---------------|---------|---------|
226
+ | "Always check X", "Never use Y" | **Gate check** — automated grep/lint rule | "Never import from internal modules" → pre-gate grep pattern |
227
+ | "Run X before Y" | **Script** — validation step | "Run type-check before QA" → added to pre_gate_runner.sh |
228
+ | "Include X in the story" | **Template field** — required section | "Include rollback plan" → new field in story template |
229
+ | General behavioral rules (3+ sprints old) | **Agent config** — permanent brain rule | "Always check for N+1 queries" → graduated to Architect config |
30
230
 
31
- **Document.** After merge, the Scribe agent maps the actual codebase into semantic product documentation using [vdoc](https://github.com/sandrinio/vdoc) (optional).
231
+ This means your framework evolves organically: agents report friction, the pipeline classifies it, you approve the fix, and the next sprint runs smoother. No manual analysis required.
32
232
 
33
- **Learn.** Sprint mistakes are recorded in `LESSONS.md`. All agents read it before writing future code. The framework also tracks its own performance — bounce rates, correction tax, recurring failure patterns — and suggests improvements to its own templates and skills.
233
+ Run `vbounce improve S-XX` anytime to trigger the pipeline on demand.
234
+
235
+ ---
236
+
237
+ ## Is V-Bounce Right For You?
238
+
239
+ **Best fit:**
240
+ - Teams using AI agents for production code (not just prototypes)
241
+ - Projects with clear requirements that can be expressed as acceptance criteria
242
+ - Codebases where architectural consistency matters
243
+ - Teams that want to scale AI usage without losing quality control
244
+
245
+ **Less ideal for:**
246
+ - One-off scripts or throwaway prototypes (overkill)
247
+ - Exploratory research with no defined requirements
248
+ - Projects where the entire team is deeply embedded in every code change anyway
249
+
250
+ **Minimum setup:** One person who can run `npx` commands + one person who can write a Charter and Epics. That's it.
251
+
252
+ ---
253
+
254
+ ## Roles and Responsibilities
255
+
256
+ ### Human
257
+
258
+ You own the planning and the final say. The agents never ship without your approval.
259
+
260
+ | Responsibility | What it involves |
261
+ |---------------|-----------------|
262
+ | **Set vision and constraints** | Write the Charter and Roadmap — define what to build and what's off-limits |
263
+ | **Define requirements** | Break Roadmap into Epics and Stories with acceptance criteria |
264
+ | **Review and approve** | Read sprint reports, approve releases, intervene on escalations |
265
+ | **Tune agent performance** | Adjust brain files, skills, and ADRs based on trend data and bounce patterns |
266
+ | **Install and configure** | Run the installer, verify setup with `vbounce doctor` |
267
+
268
+ ### Agent — Team Lead (Orchestrator)
269
+
270
+ The Team Lead reads your planning documents and coordinates the entire sprint. It never writes code — it delegates, tracks state, and generates reports.
271
+
272
+ | Responsibility | What it involves |
273
+ |---------------|-----------------|
274
+ | **Sprint orchestration** | Assigns stories, manages state transitions, enforces the bounce loop |
275
+ | **Agent delegation** | Spawns Developer, QA, Architect, DevOps, and Scribe agents as needed |
276
+ | **Report routing** | Reads each agent's output and decides the next step (pass, bounce, escalate) |
277
+ | **Escalation** | Surfaces stories to the human after 3 failed bounces |
278
+ | **Sprint reporting** | Consolidates execution data into Sprint Reports and Release Reports |
279
+
280
+ ### Agent — Specialists (Developer, QA, Architect, DevOps, Scribe)
281
+
282
+ Five specialist agents, each with a single job and strict boundaries:
283
+
284
+ | Agent | What it does | Constraints |
285
+ |-------|-------------|-------------|
286
+ | **Developer** | Implements stories in isolated worktrees, submits implementation reports | Works only in its assigned worktree |
287
+ | **QA** | Validates code against acceptance criteria | Read-only — cannot modify code |
288
+ | **Architect** | Audits against ADRs, architecture rules, and safe-zone boundaries | Read-only — cannot modify code |
289
+ | **DevOps** | Merges passing stories into the sprint branch | Only acts after both gates pass |
290
+ | **Scribe** | Generates and maintains product documentation from the actual codebase | Only runs after merge |
291
+
292
+ One person can fill the entire human side. The framework scales to the team you have.
34
293
 
35
294
  ---
36
295
 
@@ -198,6 +457,7 @@ vbounce validate ready STORY-ID # Pre-bounce readiness gate
198
457
  # Self-improvement
199
458
  vbounce trends # Cross-sprint trend analysis
200
459
  vbounce suggest S-01 # Generate improvement suggestions
460
+ vbounce improve S-01 # Full self-improvement pipeline
201
461
 
202
462
  # Health check
203
463
  vbounce doctor # Verify setup
@@ -220,7 +480,9 @@ product_plans/ # Created when you start planning
220
480
  .bounce/ # Created on first sprint init
221
481
  state.json # Machine-readable sprint state (crash recovery)
222
482
  reports/ # QA and Architect bounce reports
223
- improvement-log.md # Tracked improvement suggestions
483
+ improvement-manifest.json # Machine-readable improvement proposals (auto-generated)
484
+ improvement-suggestions.md # Human-readable suggestions with impact levels (auto-generated)
485
+ improvement-log.md # Applied/rejected/deferred improvement tracking
224
486
 
225
487
  .worktrees/ # Git worktrees for isolated story branches
226
488
 
@@ -229,18 +491,28 @@ LESSONS.md # Accumulated mistakes — agents read this bef
229
491
 
230
492
  ---
231
493
 
232
- ## End-of-Sprint Reports
233
-
234
- When a sprint concludes, V-Bounce Engine generates three structured reports:
235
-
236
- - **Sprint Report** what was delivered, execution metrics (tokens, cost, bounce rates), story results, lessons learned, and a retrospective.
237
- - **Release Report** the DevOps agent's merge log, environment changes, and post-merge validations.
238
- - **Scribe Report** which product documentation was created, updated, or flagged as stale.
494
+ ## Glossary
495
+
496
+ | Term | Definition |
497
+ |------|-----------|
498
+ | **Bounce** | When a story fails a quality gate (QA or Architect) and gets sent back to the Developer for fixes |
499
+ | **Bounce Rate** | Percentage of stories that fail a gate on the first attempt |
500
+ | **Context Loop** | The closed feedback cycle: Plan Build Bounce → Document → Learn → next sprint |
501
+ | **Correction Tax** | How much human intervention a story needed — 0% is fully autonomous, 100% means a human rewrote it |
502
+ | **Escalation** | When a story hits the 3-bounce limit and surfaces to a human for intervention |
503
+ | **Gate** | An automated quality checkpoint — QA validates requirements, Architect validates structure |
504
+ | **Hotfix Path** | A fast track for trivial (L1) changes: 1-2 files, no QA/Architect gates, human verifies directly |
505
+ | **L1–L4** | Complexity labels: L1 Trivial, L2 Standard, L3 Complex, L4 Strategic |
506
+ | **Root Cause Tag** | A label on every bounce failure (e.g., `missing_tests`, `adr_violation`) used for trend analysis |
507
+ | **Scribe** | The documentation agent that maps code into semantic product docs |
508
+ | **Sprint Report** | End-of-sprint summary: what shipped, metrics, bounce analysis, lessons, retrospective |
509
+ | **Worktree** | An isolated git checkout where a single story is implemented — prevents cross-story interference |
239
510
 
240
511
  ---
241
512
 
242
513
  ## Documentation
243
514
 
515
+ - [System Overview with diagrams](OVERVIEW.md)
244
516
  - [Epic template and structure](templates/epic.md)
245
517
  - [Hotfix edge cases](docs/HOTFIX_EDGE_CASES.md)
246
518
  - [vdoc integration](https://github.com/sandrinio/vdoc)
package/bin/vbounce.mjs CHANGED
@@ -86,6 +86,7 @@ Usage:
86
86
  vbounce docs check <sprintId> Detect stale vdocs and generate Scribe task
87
87
  vbounce trends Cross-sprint trend analysis
88
88
  vbounce suggest <sprintId> Generate improvement suggestions
89
+ vbounce improve <sprintId> Run full self-improvement pipeline
89
90
  vbounce doctor Validate all configs and state files
90
91
 
91
92
  Install Platforms:
@@ -195,6 +196,26 @@ if (command === 'suggest') {
195
196
  runScript('suggest_improvements.mjs', args.slice(1));
196
197
  }
197
198
 
199
+ // -- improve --
200
+ if (command === 'improve') {
201
+ rl.close();
202
+ // Full pipeline: analyze → trends → suggest
203
+ const sprintArg = args[1];
204
+ if (!sprintArg) {
205
+ console.error('Usage: vbounce improve S-XX');
206
+ process.exit(1);
207
+ }
208
+ // Run trends first
209
+ const trendsPath = path.join(pkgRoot, 'scripts', 'sprint_trends.mjs');
210
+ if (fs.existsSync(trendsPath)) {
211
+ console.log('Step 1/2: Running cross-sprint trend analysis...');
212
+ spawnSync(process.execPath, [trendsPath], { stdio: 'inherit', cwd: process.cwd() });
213
+ }
214
+ // Run suggest (which internally runs post_sprint_improve.mjs)
215
+ console.log('\nStep 2/2: Running improvement analyzer + suggestions...');
216
+ runScript('suggest_improvements.mjs', [sprintArg]);
217
+ }
218
+
198
219
  // -- docs --
199
220
  if (command === 'docs') {
200
221
  rl.close();
package/brains/AGENTS.md CHANGED
@@ -4,7 +4,11 @@
4
4
 
5
5
  ## Identity
6
6
 
7
- You are an AI coding agent operating within **V-Bounce Engine** — a structured system for planning, implementing, and validating software using AI agents. You work as part of a team: Team Lead, Developer, QA, Architect, DevOps, and Scribe agents collaborate through structured reports.
7
+ You are an AI operating within **V-Bounce Engine** — a structured system for planning, implementing, and validating software.
8
+
9
+ You have two roles depending on the phase:
10
+ - **During Planning (Phase 1 & 2):** You work directly with the human. You are their planning partner — you create documents, research the codebase, surface risks, and discuss trade-offs. No subagents are involved.
11
+ - **During Execution (Phase 3):** You are the Team Lead orchestrating specialist agents (Developer, QA, Architect, DevOps, Scribe) through structured reports.
8
12
 
9
13
  You MUST follow the V-Bounce process. Deviating from it — skipping validation, ignoring LESSONS.md, or writing code without reading the Story spec — is a defect, not a shortcut.
10
14
 
@@ -24,34 +28,51 @@ Skills are in the `skills/` directory. Each skill has a `SKILL.md` with instruct
24
28
 
25
29
  ## The V-Bounce Process
26
30
 
27
- ### Phase 1: Verification (Planning)
28
- Documents are created in strict hierarchy — no level can be skipped:
31
+ The process has four phases. You determine which phase to operate in based on what the human is asking for.
32
+
33
+ ### Phase 1: Planning (AI + Human — No Subagents)
34
+
35
+ **When to enter:** The human talks about what to build, asks to create or modify planning documents, discusses features, priorities, or asks about work status. This is a direct conversation — no subagents.
36
+
37
+ Read `skills/doc-manager/SKILL.md` and follow its workflows.
38
+
39
+ **Document hierarchy** — no level can be skipped:
29
40
  Charter (why) → Roadmap (strategic what/when) → Epic (detailed what) → Story (how) → Delivery Plan (execution) → Risk Registry (risks)
30
41
 
31
- ### Pre-Bounce Checks
32
- Before starting any sprint, the Team Lead MUST:
33
- - **Triage the Request**: Is this an L1 Trivial change (1-2 files, cosmetic/minor)?
34
- - If YES Use the **Hotfix Path** (create a Hotfix document, bypass Epic/Story).
35
- - If NOUse the **Standard Path** (create/find Epic, Story).
36
- - **Determine Execution Mode**: Full Bounce vs Fast Track.
37
- - **Dependency Check**: Stories with `Depends On:` must execute sequentially.
38
- - Read RISK_REGISTRY.md — flag high-severity risks that affect planned stories.
39
- - Read `sprint-{XX}.md` §2 Sprint Open Questionsdo not bounce stories with unresolved blocking questions.
40
- - If `vdocs/_manifest.json` exists, read it.
41
- - **Strategic Freeze**: Charter/Roadmap frozen during sprints. Use **Impact Analysis Protocol** if emergency changes occur. Evaluate active stories against new strategy. Pause until human approval.
42
-
43
- ### Phase 2: The Bounce (Implementation)
42
+ **Your responsibilities during planning:**
43
+ 1. **Creating documents:** Read upstream documents, research the codebase, draft the document. Follow doc-manager's CREATE and DECOMPOSE workflows.
44
+ 2. **Surfacing problems:** Assess ambiguity, open questions, edge cases, and risks. Present these clearly to the human — this is collaborative.
45
+ 3. **Answering status questions:** Read `product_plans/` to understand current state (backlog/, sprints/, archive/, strategy/).
46
+ 4. **Triaging requests:** L1 Trivial Hotfix Path. Everything else → Standard Path (Epic Story → Sprint).
47
+
48
+ ### Phase 2: Sprint Planning (AI + Human Collaborative Gate)
49
+
50
+ **When to enter:** The human wants to start executing work "let's start a sprint", "what should we work on next?"
51
+
52
+ **Hard rule: No bounce can start without a finalized, human-confirmed Sprint Plan.**
53
+
54
+ 1. Read backlog, archive, Risk Registry, vdocs manifest
55
+ 2. Propose sprint scope based on priority, dependencies, complexity
56
+ 3. Surface blockers: open questions, 🔴 ambiguity, missing prerequisites, risks, edge cases
57
+ 4. Discuss and refine with human
58
+ 5. Create Sprint Plan from `templates/sprint.md` — fill §0 Readiness Gate, §1 Active Scope, §2 Execution Strategy, §3 Open Questions
59
+ 6. **Gate:** Human confirms the Sprint Plan. Only then set status to "Active"
60
+
61
+ **Strategic Freeze:** Charter/Roadmap frozen during sprints. Use **Impact Analysis Protocol** if emergency changes occur. Pause until human approval.
62
+
63
+ ### Phase 3: The Bounce (Execution)
44
64
  **Standard Path (L2-L4 Stories):**
45
65
  0. **Orient via state**: Read `.bounce/state.json` (`vbounce state show`) for instant context. Run `vbounce prep sprint S-{XX}` to generate a fresh context pack.
46
66
  1. Team Lead sends Story context pack to Developer.
47
67
  2. Developer reads LESSONS.md and the Story context pack, implements code, writes Implementation Report. CLI Orchestrator must run `./scripts/validate_report.mjs` on the report to enforce YAML strictness.
48
68
  3. **Pre-QA Gate Scan:** Team Lead runs `./scripts/pre_gate_runner.sh qa` to catch mechanical failures before spawning QA. If trivial issues → return to Dev.
49
69
  4. QA runs Quick Scan + PR Review (skipping pre-scanned checks), validates against Story §2 The Truth. If fail → Bug Report to Dev. CLI Orchestrator must run `./scripts/validate_report.mjs` on the QA report.
50
- 5. Dev fixes and resubmits. 3+ failures → Escalated.
70
+ 5. Dev fixes and resubmits. 3+ failures → Escalated (see Escalation Recovery below).
51
71
  6. **Pre-Architect Gate Scan:** Team Lead runs `./scripts/pre_gate_runner.sh arch` to catch structural issues before spawning Architect. If mechanical failures → return to Dev.
52
72
  7. Architect runs Deep Audit + Trend Check (skipping pre-scanned checks), validates Safe Zone compliance and ADR adherence.
53
73
  8. DevOps merges story branch into sprint branch, validates post-merge (tests + lint + build), handles release tagging.
54
- 9. Team Lead consolidates reports into Sprint Report.
74
+ 9. **Record lessons immediately**: After DevOps merge, check Dev and QA reports for `lessons_flagged`. Record to LESSONS.md now — do not wait for sprint close.
75
+ 10. Team Lead consolidates reports into Sprint Report.
55
76
 
56
77
  **Hotfix Path (L1 Trivial Tasks):**
57
78
  1. Team Lead evaluates request and creates `HOTFIX-{Date}-{Name}.md`.
@@ -61,10 +82,27 @@ Before starting any sprint, the Team Lead MUST:
61
82
  5. Hotfix is merged directly into the active branch.
62
83
  6. DevOps (or Team Lead) runs `./scripts/hotfix_manager.sh sync` to update active worktrees.
63
84
 
64
- ### Phase 3: Review
65
- Sprint Report Human review Delivery Plan updated → Lessons recorded → Next sprint.
85
+ **Escalation Recovery (3+ bounce failures):**
86
+ 1. Mark story as "Escalated" in Sprint Plan
87
+ 2. Present to human: what failed, root causes from bounce reports, pattern analysis
88
+ 3. Propose options: re-scope the story, split into smaller stories, create a spike, or remove from sprint
89
+ 4. Human decides. Execute the decision.
90
+
91
+ ### Phase 4: Review
92
+ Sprint Report → Human review → Delivery Plan updated (at boundary only) → Lessons recorded → Next sprint.
66
93
  If sprint delivered new features or Dev reports flagged stale product docs → spawn Scribe agent to generate/update vdocs/ via vdoc.
67
94
 
95
+ **Self-Improvement Pipeline** (auto-runs on `vbounce sprint close`):
96
+ 1. `sprint_trends.mjs` → cross-sprint trend analysis → `.bounce/trends.md`
97
+ 2. `post_sprint_improve.mjs` → parses §5 retro tables + LESSONS.md automation candidates + recurring patterns + effectiveness checks → `.bounce/improvement-manifest.json`
98
+ 3. `suggest_improvements.mjs` → generates human-readable suggestions with impact levels → `.bounce/improvement-suggestions.md`
99
+ 4. Human reviews suggestions → approve/reject/defer each item
100
+ 5. Run `/improve` to apply approved changes with brain-file sync
101
+
102
+ **Impact Levels:** P0 Critical (blocks agents), P1 High (causes rework), P2 Medium (friction), P3 Low (polish). See `/improve` skill for details.
103
+
104
+ On-demand: `vbounce improve S-{XX}` runs the full pipeline.
105
+
68
106
  ## Story States
69
107
 
70
108
  Draft → Refinement → Ready to Bounce → Bouncing → QA Passed → Architect Passed → Sprint Review → Done
@@ -101,7 +139,7 @@ Bouncing → Escalated (3+ failures)
101
139
  10. One source of truth. Reference upstream documents, don't duplicate.
102
140
  11. Change Logs are mandatory on every document modification.
103
141
  12. Agent Reports MUST use YAML Frontmatter. Every `.bounce/report/` generated must start with a strict `---` YAML block containing the core status and metrics before the Markdown body.
104
- 13. Framework Integrity. Any modification to a `brains/` or `skills/` file MUST be recorded in `brains/CHANGELOG.md`.
142
+ 13. Framework Integrity. Any modification to a `brains/`, `skills/`, `templates/`, or `scripts/` file MUST be recorded in `brains/CHANGELOG.md` and reflected in `MANIFEST.md`.
105
143
 
106
144
  ## Framework Structure
107
145
 
@@ -3,6 +3,28 @@
3
3
  This log tracks modifications to the core agentic framework (e.g., `brains/`, `skills/`).
4
4
  Per **Rule 13: Framework Integrity**, anytime an entry is made here, all tool-specific brain files must be reviewed for consistency.
5
5
 
6
+ ## [2026-03-13] — Discovery Phase: Structured Spike System
7
+
8
+ ### Spike Template (New)
9
+ - **Added**: `templates/spike.md` — spike document template with YAML frontmatter (spike_id, parent_epic_ref, status, ambiguity_before, time_box), 8 sections (Question, Constraints, Approach, Findings, Decision, Residual Risk, Affected Documents checklist, Change Log). Hierarchy Level 3.5 — child of Epic, sibling of Story. Output location: `product_plans/backlog/EPIC-{NNN}_{name}/SPIKE-{EpicID}-{NNN}-{topic}.md`.
10
+
11
+ ### Discovery Reference (New)
12
+ - **Added**: `skills/agent-team/references/discovery.md` — spike execution protocol. Covers: when discovery triggers, spike lifecycle (Open → Investigating → Findings Ready → Validated → Closed), 4-step execution protocol (Create → Investigate → Validate → Close & Propagate), timing rules, integration with bounce sequence.
13
+
14
+ ### Doc-Manager Skill (Modified)
15
+ - **Modified**: `skills/doc-manager/SKILL.md` — added Spike row to Template Locations table; added spike file to folder structure diagram; added spike information flows (Epic §8 → Spike §1, Spike §4 → Epic §4, Spike §5 → Roadmap §3, Spike §6 → Risk Registry); added Spike pre-read requirements; added spike cascade rules; added spike transition gates (Probing/Spiking → Refinement, Spike → Validated, Spike → Closed); updated Developer and Architect agent integration rows with spike ownership; added Ambiguity Assessment Rubric section with 🔴/🟡/🟢 signal definitions and spike creation trigger.
16
+
17
+ ### Agent-Team Skill (Modified)
18
+ - **Modified**: `skills/agent-team/SKILL.md` — added Step 0.5: Discovery Check between Sprint Setup and Story Initialization; added critical rule "Resolve discovery before bouncing" requiring L4/🔴 stories to complete spikes before entering bounce sequence.
19
+
20
+ ### Claude Brain (Modified)
21
+ - **Modified**: `brains/CLAUDE.md` — added Discovery Check to Pre-Bounce Checks; expanded L4 complexity label with spike creation and validation requirements; updated Story States diagram to show spike sub-flow (Dev investigates → Arch validates → docs updated).
22
+
23
+ ### Sync Notes
24
+ - Other brain files (`GEMINI.md`, `AGENTS.md`, `cursor-rules/`) not yet updated — should be synced in a follow-up change.
25
+
26
+ ---
27
+
6
28
  ## [2026-03-12] — LanceDB Removal
7
29
 
8
30
  - **Removed**: `scripts/vbounce_ask.mjs` — LanceDB semantic query tool. Replaced by direct `LESSONS.md` reads.