valent-pipeline 0.2.1 → 0.2.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valent-pipeline",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: valent-run-epic
3
- description: 'Run all stories in an epic through the v3 pipeline sequentially. Use when the user says "run epic", "execute epic", or "v3 epic"'
3
+ description: 'Run all stories in an epic through the v3 pipeline with sprint planning. Use when the user says "run epic", "execute epic", or "v3 epic"'
4
4
  argument-hint: '<epic-id>'
5
5
  ---
6
6
 
7
7
  # valent-run-epic
8
8
 
9
- Run all stories tagged with an epic sequentially through the v3 multiagent pipeline. The epic orchestrator is stateless between stories all state lives on disk.
9
+ Run all stories tagged with an epic through the v3 multiagent pipeline using sprint-based planning and execution. Stories are groomed, sized with Fibonacci points, packed into sprints by velocity, and executed sequentially. Each sprint ends with a retrospective that calibrates future estimates.
10
10
 
11
11
  ## Arguments
12
12
 
@@ -25,6 +25,8 @@ Use the standard 200k context window. Per `pipeline-config.yaml` `orchestration.
25
25
  Read and follow `.valent-pipeline/steps/orchestration/load-pipeline-config.md`.
26
26
 
27
27
  Set `{epic_id}` from the user's argument.
28
+ Set `{is_sprint_mode}` = true (always true for epic runs when `sprint.auto_plan` is true in config).
29
+ Set `{is_epic_run}` = true.
28
30
 
29
31
  ### Step 2: Validate Epic
30
32
 
@@ -32,14 +34,14 @@ Read `{backlog_path}`. Filter items where `epic` field matches `{epic_id}`.
32
34
 
33
35
  - If no items match, stop: "No backlog items found for epic `{epic_id}`. Add `epic: {epic_id}` to stories in `{backlog_path}`."
34
36
  - Count total, pending, shipped, blocked, and cancelled items for this epic.
35
- - Present summary to the user and confirm: "Epic `{epic_id}`: {total} stories ({pending} pending, {shipped} shipped, {blocked} blocked). Start from first pending story?"
37
+ - Present summary to the user and confirm: "Epic `{epic_id}`: {total} stories ({pending} pending, {shipped} shipped, {blocked} blocked). Start sprint planning?"
36
38
  - If some stories are already shipped (resume scenario), note which are complete.
37
39
 
38
40
  ### Step 3: Initialize or Resume Epic Progress
39
41
 
40
42
  Read `{epic_progress_path}`.
41
43
 
42
- **If the file exists and `epic_id` matches:** This is a **resume**. Display prior progress (stories completed, stories remaining). Confirm with the user: "Resuming epic `{epic_id}` — {completed} stories done, {remaining} remaining. Continue?"
44
+ **If the file exists and `epic_id` matches:** This is a **resume**. Display prior progress (stories completed, stories remaining, current sprint). Confirm with the user: "Resuming epic `{epic_id}` — {completed} stories done, {remaining} remaining. Continue?"
43
45
 
44
46
  **If the file does not exist or `epic_id` differs:** Create initial `epic-progress.md`:
45
47
 
@@ -57,68 +59,73 @@ last_updated: {ISO-8601}
57
59
  ## Story Outcomes (compact — max 2 lines per story)
58
60
  ```
59
61
 
60
- ### Step 4: Story Loop
62
+ ### Step 4: Sprint Loop
61
63
 
62
- Loop until all epic stories are shipped, blocked, or cancelled.
64
+ Loop sprints until all epic stories are shipped, blocked, or cancelled. Each sprint follows the cycle: **groom → size → plan → execute → review → retro**.
63
65
 
64
66
  #### 4a. Re-read State from Disk
65
67
 
66
- **ALWAYS** read `{epic_progress_path}` and `{backlog_path}` from disk at the top of each iteration. **NEVER** rely on in-context memory of prior stories. Context compression may have fired — disk is the source of truth.
68
+ **ALWAYS** read `{epic_progress_path}`, `{backlog_path}`, and `pipeline-state.json` from disk at the top of each sprint. **NEVER** rely on in-context memory. Context compression may have fired — disk is the source of truth.
67
69
 
68
- #### 4b. Resolve Next Story
70
+ #### 4b. Check for Remaining Work
69
71
 
70
- Read and follow `.valent-pipeline/steps/orchestration/resolve-next-work-item.md`.
72
+ Read `{backlog_path}` filtered by `{epic_id}`. If no `pending` stories remain with met dependencies, exit the loop and go to Step 5.
71
73
 
72
- Set `{epic_filter}` = `{epic_id}` to scope backlog scanning to this epic.
74
+ #### 4c. Sprint Initialization
73
75
 
74
- If no unblocked stories remain in this epic, exit the loop and go to Step 5.
76
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-init.md`.
75
77
 
76
- #### 4c. Resolve Story Path
78
+ Sprint IDs use format `{epic_id}-sprint-{n}` (e.g., `kanban-mvp-sprint-1`).
79
+ Set `{epic_filter}` = `{epic_id}` to scope story resolution to this epic.
77
80
 
78
- Read and follow `.valent-pipeline/steps/orchestration/resolve-story-path.md`.
81
+ #### 4d. Sprint Grooming
79
82
 
80
- #### 4d. Validate Story Inputs
83
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-groom.md`.
81
84
 
82
- Read and follow `.valent-pipeline/steps/orchestration/validate-story-inputs.md`.
85
+ Phase 1 agents (REQS, UXA, QA-A, READINESS) stay alive across the grooming batch. Stories are processed sequentially through the grooming pipeline with READINESS performing cross-story checks.
83
86
 
84
- On validation failure: mark story `blocked-on-user` in backlog, update `epic-progress.md`, continue to next iteration (Step 4a).
87
+ #### 4e. Sprint Sizing
85
88
 
86
- #### 4e. Load Agents Manifest
89
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-size.md`.
87
90
 
88
- Read and follow `.valent-pipeline/steps/orchestration/load-agents-manifest.md`.
91
+ BEND/FEND estimate Fibonacci points per story. Kill estimation agents after sizing.
89
92
 
90
- #### 4f. Adopt Lead and Run Story
93
+ #### 4f. Sprint Planning
91
94
 
92
- Read and follow `.valent-pipeline/steps/orchestration/adopt-lead-and-create-team.md`.
95
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-plan.md`.
93
96
 
94
- Set `{is_epic_run}` = true. This enables Phase 3 Step 5b (epic progress checkpoint) in `lead.md`.
97
+ Pack stories into sprint capacity by priority. Write `sprint-{n}-plan.md` and `sprint-{n}-status.yaml`. Kill Phase 1 agents (except Knowledge).
95
98
 
96
- Enter monitoring mode — follow `.valent-pipeline/prompts/lead.md` through story completion (Phase 2 monitor, Phase 3 ship/teardown).
99
+ #### 4g. Sprint Execution
97
100
 
98
- #### 4g. Update Epic Progress
101
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-execute.md`.
99
102
 
100
- After the story ships (or is cancelled/blocked), update `{epic_progress_path}`:
103
+ For each sprint story sequentially:
104
+ 1. Adopt Lead role — read and follow `.valent-pipeline/prompts/lead.md` through story completion
105
+ 2. Set `{is_epic_run}` = true, `{is_sprint_mode}` = true
106
+ 3. Phase 2 agents (BEND, FEND, CRITIC, QA-B, JUDGE) spawn fresh per story, killed after each
107
+ 4. Lead checks time budget before each story start
108
+ 5. Update `sprint-{n}-status.yaml` at each phase transition
109
+
110
+ After each story ships, update `{epic_progress_path}`:
101
111
  - Move the story from `stories_remaining` to `stories_completed`
102
- - Add a compact outcome line (~2 lines max): `{STORY-ID}: SHIPPED {date}. {one-line summary}. {test counts}. {bug count}. {clean|conditional}.`
103
- - Update `total_completed`, `stories_since_retro`, `last_updated`
104
- - **Keep the file under 50 lines total** regardless of story count
112
+ - Add a compact outcome line: `{STORY-ID}: SHIPPED {date}. {one-line summary}. {test counts}. {bug count}. {clean|conditional}.`
113
+ - Update `total_completed`, `last_updated`
114
+ - **Keep the file under 50 lines total**
115
+
116
+ Read and follow `.valent-pipeline/steps/orchestration/update-backlog-status.md` after each story.
105
117
 
106
- #### 4h. Update Backlog
118
+ #### 4h. Sprint Review + Retrospective
107
119
 
108
- Read and follow `.valent-pipeline/steps/orchestration/update-backlog-status.md`.
120
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-review.md`.
109
121
 
110
- #### 4i. Retrospective Check (BLOCKING)
122
+ This step diffs planned vs actuals, records calibration data, triggers the retrospective (blocking), and checks for next sprint.
111
123
 
112
- If `stories_since_retro >= {retrospective_every_n_stories}`:
113
- 1. Spawn the Retrospective Agent with the last N story reports
114
- 2. **Wait for the retrospective to complete** (blocking — do not start the next story)
115
- 3. The retrospective updates correction directives, which feed into subsequent stories
116
- 4. Reset `stories_since_retro` to 0
117
- 5. Update `pipeline-state.json`
124
+ **Retrospective is mandatory** at the end of every sprint — this replaces the story-count-based retro trigger. The sprint structure guarantees at least one retro per epic.
118
125
 
119
- #### 4j. Continue Loop
126
+ #### 4i. Continue Sprint Loop
120
127
 
121
- Return to Step 4a. **Do NOT ask the user for permission to continue** — the epic loop is fully autonomous. Proceed to the next story immediately after the current story ships (or after a retrospective completes). The user opted into the full epic run at Step 2; no further confirmation is needed between stories.
128
+ Return to Step 4a. **Do NOT ask the user for permission to continue** — the epic loop is fully autonomous. Proceed to the next sprint immediately after the current sprint's retro completes. The user opted into the full epic run at Step 2; no further confirmation is needed between sprints.
122
129
 
123
130
  Context compression may fire here — that is expected. The PostCompact hook re-injects `epic-progress.md`, `pipeline-state.json`, and `pipeline-backlog.yaml`.
124
131
 
@@ -130,43 +137,49 @@ When all stories in the epic are shipped (or remaining are all blocked/cancelled
130
137
 
131
138
  Write `epic-report.md` adjacent to `{epic_progress_path}`:
132
139
  - Epic ID, total stories, shipped count, blocked count, cancelled count
140
+ - Sprint summary: sprints run, total points shipped, final velocity (SMA-5)
133
141
  - Aggregate metrics: total bugs filed, total rejection cycles, total escalations
142
+ - Estimation accuracy: average min/point, variance trend across sprints
134
143
  - Per-story one-line summaries (from `epic-progress.md`)
135
144
  - Cross-epic bugs: list any conditional bugs from shipped stories that are still pending
136
145
 
137
146
  #### 5b. Report to User
138
147
 
139
- Present the epic completion summary. If any stories are blocked or cancelled, list them with reasons.
148
+ Present the epic completion summary. If any stories are blocked or cancelled, list them with reasons. Include sprint velocity trend and estimation accuracy.
140
149
 
141
150
  ## Error Recovery
142
151
 
143
152
  ### Mid-Story Failure
144
- If a story fails (circuit breaker exhausted, user cancels): mark it `cancelled` in the backlog, update `epic-progress.md`, continue to the next story. Do not abort the entire epic for a single story failure.
153
+ If a story fails (circuit breaker exhausted, user cancels): mark it `cancelled` in the backlog, update `epic-progress.md`, continue to the next sprint story. Do not abort the entire sprint or epic for a single story failure.
154
+
155
+ ### Mid-Sprint Failure
156
+ If an entire sprint cannot proceed (all remaining stories blocked): roll over unexecuted stories, run the retro on what shipped, then check if the next sprint has unblocked work.
145
157
 
146
158
  ### Context Compression
147
159
  Expected behavior during multi-story runs. The PostCompact hook re-injects state files. After compression, Step 4a re-reads ALL state from disk before continuing. No in-context memory is trusted.
148
160
 
149
161
  ### Full Conversation Reset
150
- If the conversation dies entirely, the user re-runs `/valent-run-epic {epic_id}`. Step 3 detects the existing `epic-progress.md` and resumes from where it left off. Shipped stories are not re-run.
162
+ If the conversation dies entirely, the user re-runs `/valent-run-epic {epic_id}`. Step 3 detects the existing `epic-progress.md` and resumes. `pipeline-state.json` `current_sprint` indicates which sprint phase to resume from. Shipped stories are not re-run.
151
163
 
152
164
  ## Notes
153
165
 
154
- - You are the Lead for each story. The lead prompt (`.valent-pipeline/prompts/lead.md`) is YOUR operating manual — read and follow it directly.
166
+ - You are the Lead for each story during execution. The lead prompt (`.valent-pipeline/prompts/lead.md`) is YOUR operating manual — read and follow it directly.
155
167
  - **Do NOT read agent output files.** Quality is JUDGE gates' and CRITIC's job.
156
168
  - **Always read from disk, never from memory** at the top of each loop iteration. This is the compression survival rule.
157
169
  - **Epic-progress.md is the crash recovery substrate.** Keep it under 50 lines. It must be readable standalone.
158
- - **Retrospectives run BLOCKING** during epic loops to ensure correction directives are applied to subsequent stories.
170
+ - **Retrospectives run BLOCKING** at the end of every sprint to ensure calibration directives are applied to subsequent sprints.
159
171
  - **Agent lifecycle — do NOT shut down agents early.** All per-story teammates stay alive until Phase 3 teardown. Only send `shutdown_request` during Phase 3, Step 4.
160
172
  - **Shutdown must be sent individually, not broadcast.** Send a separate `shutdown_request` to each teammate by name.
161
173
  - Correction directives may not exist yet for new pipelines — proceed without them gracefully.
174
+ - Sprint orchestration step files are in `.valent-pipeline/steps/orchestration/sprint-*.md`.
162
175
 
163
176
  ### Knowledge Agent Persistence
164
177
 
165
- The Knowledge Agent persists across stories during epic runs to avoid respawn overhead (~15-20k tokens per story).
178
+ The Knowledge Agent persists across stories AND sprints during epic runs to avoid respawn overhead.
166
179
 
167
180
  **Team lifecycle:**
168
- - Use team name `valent-{epic_id}` (e.g., `valent-kanban-mvp`) for the entire epic, NOT `valent-{story_id}` per story.
169
- - At story teardown (Phase 3, Step 4): send `shutdown_request` to all per-story teammates EXCEPT Knowledge. Do NOT call `TeamDelete` between stories.
181
+ - Use team name `valent-{epic_id}` (e.g., `valent-kanban-mvp`) for the entire epic, NOT per story or per sprint.
182
+ - At story teardown (Phase 3, Step 4): send `shutdown_request` to all per-story teammates EXCEPT Knowledge. Do NOT call `TeamDelete` between stories or sprints.
170
183
  - At the start of each new story: Knowledge is already alive. Send `[STORY-RESET]` instead of spawning (see `.valent-pipeline/steps/orchestration/adopt-lead-and-create-team.md`). Wait for `[KNOWLEDGE-READY]` before spawning other agents.
171
184
  - At epic completion (Step 5): tear down Knowledge, then call `TeamDelete` to clean up the team.
172
185
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: valent-run-project
3
- description: 'Run all stories across all epics, ordered by dependencies, until everything ships or is blocked. Use when the user says "run project", "run all stories", "valent run project", or "execute project"'
3
+ description: 'Run all stories across all epics with sprint planning, ordered by dependencies, until everything ships or is blocked. Use when the user says "run project", "run all stories", "valent run project", or "execute project"'
4
4
  ---
5
5
 
6
6
  # valent-run-project
7
7
 
8
- Run every pending story in the backlog, across all epics, in dependency order. Stories are picked by priority with cross-epic dependency resolution a story from Epic B can run before Epic A finishes if its dependencies are met. The loop continues until all stories are shipped, blocked, or cancelled.
8
+ Run every pending story in the backlog, across all epics, using sprint-based planning and execution. Stories are groomed, sized with Fibonacci points, packed into sprints by velocity, and executed sequentially. Cross-epic dependency resolution ensures stories from any epic can run when their dependencies are met. Each sprint ends with a retrospective that calibrates future estimates.
9
9
 
10
10
  ## Context Window Advisory
11
11
 
@@ -17,6 +17,9 @@ Use the standard 200k context window. Auto-compression fires every 2-3 stories.
17
17
 
18
18
  Read and follow `.valent-pipeline/steps/orchestration/load-pipeline-config.md`.
19
19
 
20
+ Set `{is_sprint_mode}` = true (always true for project runs when `sprint.auto_plan` is true in config).
21
+ Set `{is_epic_run}` = true.
22
+
20
23
  ### Step 2: Build Cross-Epic Dependency Map
21
24
 
22
25
  Read `{backlog_path}`. Load ALL items (not filtered by epic).
@@ -34,24 +37,22 @@ Project: {N} stories across {M} epics
34
37
  Pending: {count}
35
38
  Blocked: {count}
36
39
 
37
- Execution order (by dependency + priority):
38
- 1. {STORY-ID} (Epic: {epic}) no dependencies
39
- 2. {STORY-ID} (Epic: {epic}) depends on: {ids}
40
- 3. {STORY-ID} (Epic: {epic}) — depends on: {ids}
41
- ...
40
+ Sprint planning will groom, size, and pack stories into sprints.
41
+ Velocity: {initial or current} points per sprint.
42
+ Duration: {sprint_duration_minutes} minutes per sprint.
42
43
 
43
44
  Cross-epic dependencies:
44
45
  - {STORY-ID} (Epic B) depends on {STORY-ID} (Epic A)
45
46
  ...
46
47
  ```
47
48
 
48
- Ask: "Run all {N} pending stories in this order? (Stories will be picked dynamically as dependencies resolve.)"
49
+ Ask: "Run all {N} pending stories with sprint planning? (Stories will be groomed, sized, and packed into sprints dynamically.)"
49
50
 
50
51
  ### Step 3: Initialize or Resume Project Progress
51
52
 
52
53
  Read `{epic_progress_path}`.
53
54
 
54
- **If the file exists and `epic_id` is `"project"`:** This is a **resume**. Display prior progress. Confirm: "Resuming project run — {completed} stories done, {remaining} remaining. Continue?"
55
+ **If the file exists and `epic_id` is `"project"`:** This is a **resume**. Display prior progress and current sprint state. Confirm: "Resuming project run — {completed} stories done, {remaining} remaining. Continue?"
55
56
 
56
57
  **If the file does not exist or `epic_id` differs:** Create initial progress file:
57
58
 
@@ -69,76 +70,80 @@ last_updated: {ISO-8601}
69
70
  ## Story Outcomes (compact — max 2 lines per story)
70
71
  ```
71
72
 
72
- ### Step 4: Story Loop
73
+ ### Step 4: Sprint Loop
73
74
 
74
- Loop until all stories are shipped, blocked, or cancelled.
75
+ Loop sprints until all stories are shipped, blocked, or cancelled. Each sprint follows the cycle: **groom → size → plan → execute → review → retro**.
75
76
 
76
77
  #### 4a. Re-read State from Disk
77
78
 
78
- **ALWAYS** read `{epic_progress_path}` and `{backlog_path}` from disk at the top of each iteration. **NEVER** rely on in-context memory. Context compression may have fired — disk is the source of truth.
79
-
80
- #### 4b. Resolve Next Story (Cross-Epic)
81
-
82
- Read and follow `.valent-pipeline/steps/orchestration/resolve-next-work-item.md`.
79
+ **ALWAYS** read `{epic_progress_path}`, `{backlog_path}`, and `pipeline-state.json` from disk at the top of each sprint. **NEVER** rely on in-context memory. Context compression may have fired — disk is the source of truth.
83
80
 
84
- **Do NOT set `{epic_filter}`.** Scan the entire backlog across all epics. The first `pending` item whose:
85
- - `depends_on` are all `shipped`
86
- - `blocked_by_bugs` are all `shipped` or `cancelled`
81
+ #### 4b. Check for Remaining Work
87
82
 
88
- ...is the next work item, regardless of which epic it belongs to.
89
-
90
- **If no unblocked stories remain:** Check why.
83
+ Read `{backlog_path}`. If no `pending` stories remain with met dependencies across any epic, check why:
91
84
  - If ALL remaining stories are `shipped` or `cancelled` → project complete, go to Step 5
92
85
  - If remaining stories are `blocked` or `blocked-on-user` → report the blocked stories and their blockers to the user, go to Step 5
93
86
  - If remaining stories are `pending` but all have unmet `depends_on` → circular dependency or missing prerequisite. Report and stop.
94
87
 
95
- #### 4c. Resolve Story Path
88
+ #### 4c. Sprint Initialization
89
+
90
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-init.md`.
91
+
92
+ Sprint IDs use format `project-sprint-{n}` (e.g., `project-sprint-1`).
93
+ Do NOT set `{epic_filter}` — sprint planning pulls from the full cross-epic backlog with dependency resolution.
96
94
 
97
- Read and follow `.valent-pipeline/steps/orchestration/resolve-story-path.md`.
95
+ #### 4d. Sprint Grooming
98
96
 
99
- #### 4d. Validate Story Inputs
97
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-groom.md`.
100
98
 
101
- Read and follow `.valent-pipeline/steps/orchestration/validate-story-inputs.md`.
99
+ Phase 1 agents (REQS, UXA, QA-A, READINESS) stay alive across the grooming batch. Stories are processed sequentially through the grooming pipeline with READINESS performing cross-story checks.
102
100
 
103
- On validation failure: mark story `blocked-on-user` in backlog, update progress file, continue to next iteration (Step 4a). Do not stop the project — pick the next unblocked story.
101
+ #### 4e. Sprint Sizing
104
102
 
105
- #### 4e. Load Agents Manifest
103
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-size.md`.
106
104
 
107
- Read and follow `.valent-pipeline/steps/orchestration/load-agents-manifest.md`.
105
+ BEND/FEND estimate Fibonacci points per story. Kill estimation agents after sizing.
108
106
 
109
- #### 4f. Adopt Lead and Run Story
107
+ #### 4f. Sprint Planning
110
108
 
111
- Read and follow `.valent-pipeline/steps/orchestration/adopt-lead-and-create-team.md`.
109
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-plan.md`.
112
110
 
113
- Set `{is_epic_run}` = true. Set `{epic_id}` = `"project"`.
111
+ Pack stories into sprint capacity by priority (cross-epic). Write `sprint-{n}-plan.md` and `sprint-{n}-status.yaml`. Kill Phase 1 agents (except Knowledge).
114
112
 
115
- Enter monitoring mode — follow `.valent-pipeline/prompts/lead.md` through story completion.
113
+ #### 4g. Sprint Execution
116
114
 
117
- #### 4g. Update Progress
115
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-execute.md`.
118
116
 
119
- After the story ships (or is cancelled/blocked), update `{epic_progress_path}`:
117
+ For each sprint story sequentially:
118
+ 1. Adopt Lead role — read and follow `.valent-pipeline/prompts/lead.md` through story completion
119
+ 2. Set `{is_epic_run}` = true, `{is_sprint_mode}` = true, `{epic_id}` = `"project"`
120
+ 3. Phase 2 agents (BEND, FEND, CRITIC, QA-B, JUDGE) spawn fresh per story, killed after each
121
+ 4. Lead checks time budget before each story start
122
+ 5. Update `sprint-{n}-status.yaml` at each phase transition
123
+
124
+ After each story ships, update `{epic_progress_path}`:
120
125
  - Move the story from `stories_remaining` to `stories_completed`
121
126
  - Add a compact outcome line: `{STORY-ID} ({epic}): SHIPPED {date}. {one-line summary}. {test counts}. {bug count}.`
122
- - Update `total_completed`, `stories_since_retro`, `last_updated`
123
- - **FIFO at 80 lines:** When the outcomes section exceeds 80 lines, remove the oldest outcome at the top to make room for the new one at the bottom. Recent context is most valuable after compression; older outcomes live in individual story reports.
127
+ - Update `total_completed`, `last_updated`
128
+ - **FIFO at 80 lines:** When the outcomes section exceeds 80 lines, remove the oldest at the top.
129
+
130
+ Read and follow `.valent-pipeline/steps/orchestration/update-backlog-status.md` after each story.
131
+
132
+ **After updating:** Re-check if any previously blocked stories are now unblocked (their `depends_on` or `blocked_by_bugs` may have been resolved by the story that just shipped). These become eligible for the next sprint's grooming.
124
133
 
125
- #### 4h. Update Backlog
134
+ #### 4h. Sprint Review + Retrospective
126
135
 
127
- Read and follow `.valent-pipeline/steps/orchestration/update-backlog-status.md`.
136
+ Read and follow `.valent-pipeline/steps/orchestration/sprint-review.md`.
128
137
 
129
- **After updating:** Re-check if any previously blocked stories are now unblocked (their `depends_on` or `blocked_by_bugs` may have been resolved by the story that just shipped). These become eligible for the next iteration.
138
+ This step diffs planned vs actuals, records calibration data, triggers the retrospective (blocking), and checks for next sprint.
130
139
 
131
- #### 4i. Retrospective Check (BLOCKING)
140
+ **Retrospective is mandatory** at the end of every sprint — this replaces the story-count-based retro trigger.
132
141
 
133
- If `stories_since_retro >= {retrospective_every_n_stories}`:
134
- 1. Spawn the Retrospective Agent with the last N story reports
135
- 2. **Wait for the retrospective to complete** (blocking)
136
- 3. Reset `stories_since_retro` to 0
137
- 4. Update `pipeline-state.json`
142
+ #### 4i. Continue Sprint Loop
138
143
 
139
- #### 4j. Continue Loop
144
+ Return to Step 4a. **Do NOT ask the user for permission to continue** — the project loop is fully autonomous. Proceed to the next sprint immediately after the current sprint's retro completes.
140
145
 
141
- Return to Step 4a.
146
+ Context compression may fire here — that is expected. The PostCompact hook re-injects state files.
142
147
 
143
148
  ### Step 5: Project Complete
144
149
 
@@ -156,16 +161,27 @@ Write `project-report.md` adjacent to `{epic_progress_path}`:
156
161
  - Shipped: {count}
157
162
  - Blocked: {count} {list with reasons}
158
163
  - Cancelled: {count}
164
+ - Sprints run: {count}
165
+ - Total points shipped: {sum}
166
+ - Final velocity (SMA-5): {velocity}
159
167
  - Bugs filed: {total across all stories}
160
168
  - Retrospectives run: {count}
161
169
 
170
+ ## Sprint History
171
+ ### Sprint {n} ({sprint_id})
172
+ - Planned: {points} points, {count} stories
173
+ - Shipped: {points} points, {count} stories
174
+ - Velocity: {points_shipped}
175
+
162
176
  ## Per-Epic Summary
163
177
  ### {Epic ID}
164
178
  - Stories: {shipped}/{total}
165
179
  - {one-line per story from progress file}
166
180
 
167
- ### {Epic ID}
168
- - ...
181
+ ## Estimation Accuracy
182
+ - Average min/point: {value}
183
+ - Min/point range: {min}-{max}
184
+ - Trend: {tightening | widening | stable}
169
185
 
170
186
  ## Blocked Stories
171
187
  {For each blocked story: ID, epic, what it's blocked on, and recommended action}
@@ -179,18 +195,22 @@ Write `project-report.md` adjacent to `{epic_progress_path}`:
179
195
  Present the project completion summary. Highlight:
180
196
  - Any blocked stories and what they need
181
197
  - Any pending bugs from conditional ships
198
+ - Sprint velocity trend and estimation accuracy
182
199
  - Retrospective summary if any ran
183
200
 
184
201
  ## Error Recovery
185
202
 
186
203
  ### Mid-Story Failure
187
- If a story fails (circuit breaker exhausted, user cancels): mark it `cancelled` in the backlog, update progress, **continue to the next unblocked story**. A single story failure does not stop the project. Stories that depend on the cancelled story become blocked — report them but keep working on anything else that's unblocked.
204
+ If a story fails (circuit breaker exhausted, user cancels): mark it `cancelled` in the backlog, update progress, **continue to the next sprint story**. A single story failure does not stop the project. Stories that depend on the cancelled story become blocked — report them but keep working on anything else that's unblocked.
205
+
206
+ ### Mid-Sprint Failure
207
+ If an entire sprint cannot proceed (all remaining stories blocked): roll over unexecuted stories, run the retro on what shipped, then check if the next sprint has unblocked work.
188
208
 
189
209
  ### Context Compression
190
210
  Expected. The PostCompact hook re-injects state files. Step 4a re-reads everything from disk.
191
211
 
192
212
  ### Full Conversation Reset
193
- User re-runs `/valent-run-project`. Step 3 detects existing progress file with `epic_id: "project"` and resumes. Shipped stories are not re-run.
213
+ User re-runs `/valent-run-project`. Step 3 detects existing progress file with `epic_id: "project"` and resumes. `pipeline-state.json` `current_sprint` indicates which sprint phase to resume from. Shipped stories are not re-run.
194
214
 
195
215
  ### All Stories Blocked
196
216
  If the loop finds no unblocked stories but pending stories remain:
@@ -200,17 +220,18 @@ If the loop finds no unblocked stories but pending stories remain:
200
220
 
201
221
  ## Notes
202
222
 
203
- - You are the Lead for each story. The lead prompt (`.valent-pipeline/prompts/lead.md`) is YOUR operating manual.
223
+ - You are the Lead for each story during execution. The lead prompt (`.valent-pipeline/prompts/lead.md`) is YOUR operating manual.
204
224
  - **Do NOT read agent output files.** Quality is JUDGE gates' and CRITIC's job.
205
225
  - **Always read from disk, never from memory** at the top of each loop iteration.
206
226
  - **Progress file is the crash recovery substrate.** FIFO queue — cap outcomes at 80 lines, evict oldest.
207
- - **Retrospectives run BLOCKING.**
227
+ - **Retrospectives run BLOCKING** at the end of every sprint.
208
228
  - **Shutdown must be sent individually, not broadcast.**
209
229
  - Correction directives may not exist yet for new pipelines — proceed without them.
230
+ - Sprint orchestration step files are in `.valent-pipeline/steps/orchestration/sprint-*.md`.
210
231
 
211
232
  ### Knowledge Agent Persistence
212
233
 
213
- Same as `valent-run-epic`: Knowledge persists across all stories in the project run.
234
+ Same as `valent-run-epic`: Knowledge persists across all stories and sprints in the project run.
214
235
 
215
236
  **Team lifecycle:**
216
237
  - Use team name `valent-project` for the entire run.