valent-pipeline 0.1.7 → 0.1.9

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.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -451,12 +451,16 @@ Tear down all per-story teammates. Send `shutdown_request` to each individually.
451
451
  - Update `pipeline-state.json`
452
452
  - **Update `{backlog_path}`:**
453
453
  1. Set the current item's `status` to `shipped` and add `shipped_at` date
454
- 2. If JUDGE G2 issued a conditional ship with bugs, add each bug as a new `bug` type entry in the backlog with:
454
+ 2. If JUDGE G2 issued a conditional ship with bugs (P2-P3), add each bug as a new `bug` type entry in the backlog with:
455
455
  - `status: pending`
456
456
  - `priority`: one above the next pending story (bugs get worked before new stories by default)
457
457
  - `severity`, `source_story`, `affects`, `description`, `file_ref` from the G2 decision and QA-B bug report
458
- 3. Add the bug IDs to the shipped story's `conditional_bugs` list
459
- 4. For any pending stories whose `blocked_by_bugs` referenced bugs that are now `shipped`, those blockers are resolved — the story becomes unblocked if all other dependencies are also met
458
+ 3. Add P4 bugs from `{story_output_dir}/bugs.md` to the backlog at the **lowest priority** (highest priority number). These are worked only when no other stories or bugs are unblocked — the pipeline always has something to do.
459
+ - `status: pending`
460
+ - `priority`: max existing priority + 1 (per bug, incrementing)
461
+ - `severity: P4`, `source_story`, `description`, `file_ref` from QA-B bug report
462
+ 4. Add the conditional bug IDs (P2-P3) to the shipped story's `conditional_bugs` list. P4 bugs are not conditional — they don't block anything.
463
+ 5. For any pending stories whose `blocked_by_bugs` referenced bugs that are now `shipped`, those blockers are resolved — the story becomes unblocked if all other dependencies are also met
460
464
 
461
465
  ### Step 5b: Write Epic Progress Checkpoint
462
466
 
@@ -0,0 +1,219 @@
1
+ ---
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"'
4
+ ---
5
+
6
+ # valent-run-project
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.
9
+
10
+ ## Context Window Advisory
11
+
12
+ Use the standard 200k context window. Auto-compression fires every 2-3 stories. The PostCompact hook re-injects state from disk. All state is read from disk at loop top — never trust in-context memory.
13
+
14
+ ## Execution Steps
15
+
16
+ ### Step 1: Load Pipeline Config
17
+
18
+ Read and follow `.valent-pipeline/steps/orchestration/load-pipeline-config.md`.
19
+
20
+ ### Step 2: Build Cross-Epic Dependency Map
21
+
22
+ Read `{backlog_path}`. Load ALL items (not filtered by epic).
23
+
24
+ **Build the dependency graph:**
25
+ 1. For each item, record its `depends_on` list and `blocked_by_bugs` list
26
+ 2. Identify cross-epic dependencies (story in Epic A depends on story in Epic B)
27
+ 3. Validate: check for circular dependencies. If found, report to user and stop.
28
+
29
+ **Present the execution plan:**
30
+
31
+ ```
32
+ Project: {N} stories across {M} epics
33
+ Shipped: {count}
34
+ Pending: {count}
35
+ Blocked: {count}
36
+
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
+ ...
42
+
43
+ Cross-epic dependencies:
44
+ - {STORY-ID} (Epic B) depends on {STORY-ID} (Epic A)
45
+ ...
46
+ ```
47
+
48
+ Ask: "Run all {N} pending stories in this order? (Stories will be picked dynamically as dependencies resolve.)"
49
+
50
+ ### Step 3: Initialize or Resume Project Progress
51
+
52
+ Read `{epic_progress_path}`.
53
+
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
+
56
+ **If the file does not exist or `epic_id` differs:** Create initial progress file:
57
+
58
+ ```markdown
59
+ ---
60
+ epic_id: "project"
61
+ stories_completed: []
62
+ stories_remaining: [{all pending story IDs from backlog}]
63
+ current_story: null
64
+ stories_since_retro: 0
65
+ total_completed: 0
66
+ last_updated: {ISO-8601}
67
+ ---
68
+
69
+ ## Story Outcomes (compact — max 2 lines per story)
70
+ ```
71
+
72
+ ### Step 4: Story Loop
73
+
74
+ Loop until all stories are shipped, blocked, or cancelled.
75
+
76
+ #### 4a. Re-read State from Disk
77
+
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`.
83
+
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`
87
+
88
+ ...is the next work item, regardless of which epic it belongs to.
89
+
90
+ **If no unblocked stories remain:** Check why.
91
+ - If ALL remaining stories are `shipped` or `cancelled` → project complete, go to Step 5
92
+ - If remaining stories are `blocked` or `blocked-on-user` → report the blocked stories and their blockers to the user, go to Step 5
93
+ - If remaining stories are `pending` but all have unmet `depends_on` → circular dependency or missing prerequisite. Report and stop.
94
+
95
+ #### 4c. Resolve Story Path
96
+
97
+ Read and follow `.valent-pipeline/steps/orchestration/resolve-story-path.md`.
98
+
99
+ #### 4d. Validate Story Inputs
100
+
101
+ Read and follow `.valent-pipeline/steps/orchestration/validate-story-inputs.md`.
102
+
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.
104
+
105
+ #### 4e. Load Agents Manifest
106
+
107
+ Read and follow `.valent-pipeline/steps/orchestration/load-agents-manifest.md`.
108
+
109
+ #### 4f. Adopt Lead and Run Story
110
+
111
+ Read and follow `.valent-pipeline/steps/orchestration/adopt-lead-and-create-team.md`.
112
+
113
+ Set `{is_epic_run}` = true. Set `{epic_id}` = `"project"`.
114
+
115
+ Enter monitoring mode — follow `.valent-pipeline/prompts/lead.md` through story completion.
116
+
117
+ #### 4g. Update Progress
118
+
119
+ After the story ships (or is cancelled/blocked), update `{epic_progress_path}`:
120
+ - Move the story from `stories_remaining` to `stories_completed`
121
+ - 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.
124
+
125
+ #### 4h. Update Backlog
126
+
127
+ Read and follow `.valent-pipeline/steps/orchestration/update-backlog-status.md`.
128
+
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.
130
+
131
+ #### 4i. Retrospective Check (BLOCKING)
132
+
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`
138
+
139
+ #### 4j. Continue Loop
140
+
141
+ Return to Step 4a.
142
+
143
+ ### Step 5: Project Complete
144
+
145
+ When all stories are shipped (or remaining are all blocked/cancelled):
146
+
147
+ #### 5a. Write Project Report
148
+
149
+ Write `project-report.md` adjacent to `{epic_progress_path}`:
150
+
151
+ ```markdown
152
+ # Project Report
153
+
154
+ ## Summary
155
+ - Total stories: {N}
156
+ - Shipped: {count}
157
+ - Blocked: {count} {list with reasons}
158
+ - Cancelled: {count}
159
+ - Bugs filed: {total across all stories}
160
+ - Retrospectives run: {count}
161
+
162
+ ## Per-Epic Summary
163
+ ### {Epic ID}
164
+ - Stories: {shipped}/{total}
165
+ - {one-line per story from progress file}
166
+
167
+ ### {Epic ID}
168
+ - ...
169
+
170
+ ## Blocked Stories
171
+ {For each blocked story: ID, epic, what it's blocked on, and recommended action}
172
+
173
+ ## Cross-Epic Bugs
174
+ {Conditional bugs from shipped stories that are still pending}
175
+ ```
176
+
177
+ #### 5b. Report to User
178
+
179
+ Present the project completion summary. Highlight:
180
+ - Any blocked stories and what they need
181
+ - Any pending bugs from conditional ships
182
+ - Retrospective summary if any ran
183
+
184
+ ## Error Recovery
185
+
186
+ ### 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.
188
+
189
+ ### Context Compression
190
+ Expected. The PostCompact hook re-injects state files. Step 4a re-reads everything from disk.
191
+
192
+ ### 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.
194
+
195
+ ### All Stories Blocked
196
+ If the loop finds no unblocked stories but pending stories remain:
197
+ 1. List each blocked story with its unmet dependencies
198
+ 2. Ask the user: "All remaining stories are blocked. Options: (1) Fix blockers and re-run, (2) Cancel blocked stories, (3) Override a dependency"
199
+ 3. Do NOT loop forever waiting for blockers to resolve
200
+
201
+ ## Notes
202
+
203
+ - You are the Lead for each story. The lead prompt (`.valent-pipeline/prompts/lead.md`) is YOUR operating manual.
204
+ - **Do NOT read agent output files.** Quality is JUDGE gates' and CRITIC's job.
205
+ - **Always read from disk, never from memory** at the top of each loop iteration.
206
+ - **Progress file is the crash recovery substrate.** FIFO queue — cap outcomes at 80 lines, evict oldest.
207
+ - **Retrospectives run BLOCKING.**
208
+ - **Shutdown must be sent individually, not broadcast.**
209
+ - Correction directives may not exist yet for new pipelines — proceed without them.
210
+
211
+ ### Knowledge Agent Persistence
212
+
213
+ Same as `valent-run-epic`: Knowledge persists across all stories in the project run.
214
+
215
+ **Team lifecycle:**
216
+ - Use team name `valent-project` for the entire run.
217
+ - At story teardown: shut down all per-story teammates EXCEPT Knowledge.
218
+ - At project completion (Step 5): tear down Knowledge, then `TeamDelete`.
219
+ - First story spawns Knowledge normally. All subsequent stories use `[STORY-RESET]`.