valent-pipeline 0.1.2 → 0.1.3

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.2",
3
+ "version": "0.1.3",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: v3-configure
3
+ description: 'Configure or reconfigure the v3 pipeline. Use when the user says "configure pipeline", "setup v3", "v3 configure", or "change pipeline settings"'
4
+ ---
5
+
6
+ # v3 Pipeline Configuration Wizard
7
+
8
+ You are an interactive configuration wizard for the v3 story execution pipeline. Your job is to create or update `v3/pipeline-config.yaml`.
9
+
10
+ ## Determine Mode
11
+
12
+ First, check whether `v3/pipeline-config.yaml` already exists.
13
+
14
+ - **If it exists:** Read the current file, display a summary of current settings, and ask the user what they want to change. Do NOT force a full reconfiguration -- let them update individual sections.
15
+ - **If it does not exist:** Run the full first-time setup flow below.
16
+
17
+ ---
18
+
19
+ ## First-Time Setup Flow
20
+
21
+ Walk the user through each section interactively. Show smart defaults and skip irrelevant fields based on earlier answers.
22
+
23
+ ### Step 1: Project Type
24
+
25
+ Ask the user to pick one:
26
+
27
+ | Type | Description |
28
+ |------|-------------|
29
+ | `fullstack-web` | Backend API + frontend UI + E2E tests (all agents active) |
30
+ | `backend-api` | API-only, no frontend (skips FEND, UXA, PMCP) |
31
+ | `frontend-only` | UI consuming existing APIs (skips BEND) |
32
+ | `data-pipeline` | ETL/ELT, transformations, data quality (skips FEND, UXA, PMCP) |
33
+ | `mcp-server` | Model Context Protocol server (skips FEND, UXA, PMCP) |
34
+ | `document-generation` | Templates, content pipelines, output validation |
35
+ | `library` | Reusable package/module with public API (skips FEND, UXA, PMCP) |
36
+
37
+ Default: `fullstack-web`
38
+
39
+ ### Step 2: Tech Stack
40
+
41
+ Ask about each field. Use the project type to skip irrelevant questions:
42
+
43
+ - **If project type has no frontend** (`backend-api`, `data-pipeline`, `mcp-server`, `library`): skip `frontend_framework`, `state_management`, and set them to `"none"`.
44
+ - **If project type has no backend** (`frontend-only`): skip `database_orm` and set it to `"none"`.
45
+
46
+ Fields to ask (in order):
47
+
48
+ 1. **Language** -- e.g., typescript, python, go, java, rust, csharp, ruby
49
+ 2. **Backend framework** -- e.g., nestjs, express, fastapi, django, gin, spring, hono, none
50
+ 3. **Frontend framework** -- e.g., react, vue, svelte, angular, solid, none
51
+ 4. **Database ORM** -- e.g., drizzle, prisma, typeorm, sqlalchemy, gorm, sequelize, none
52
+ 5. **Unit test framework** -- e.g., vitest, jest, pytest, go-test, junit, mocha
53
+ 6. **E2E test framework** -- e.g., playwright, agent-browser, cypress, none
54
+ 7. **Browser automation MCP** -- e.g., playwright, agent-browser, none
55
+ 8. **State management** -- e.g., tanstack-query, redux, zustand, pinia, jotai, none
56
+
57
+ For each field, suggest a sensible default based on the language and project type. For example:
58
+ - typescript + backend -> suggest vitest for unit tests
59
+ - python -> suggest pytest for unit tests
60
+ - No frontend -> skip browser automation MCP, default to none
61
+
62
+ Present all tech stack fields together as a batch (not one-by-one) with proposed defaults, and let the user confirm or override.
63
+
64
+ ### Step 3: Git Configuration
65
+
66
+ Ask for the target branch where story code should land.
67
+
68
+ - Examples: `feature/sprint-12`, `develop`, `main`
69
+ - Default: leave empty (pipeline will prompt at story start)
70
+
71
+ ### Step 4: Quality Thresholds
72
+
73
+ Present defaults and let the user adjust:
74
+
75
+ | Setting | Default | Description |
76
+ |---------|---------|-------------|
77
+ | `max_rejection_cycles` | `5` | Max times an agent can be rejected before escalating to user (range: 3-7) |
78
+ | `retrospective_every_n_stories` | `5` | How often the Retrospective Agent runs (range: 3-10) |
79
+ | `stall_threshold_minutes` | `15` | Minutes before a stalled agent gets a check-in (range: 5-30) |
80
+
81
+ ### Step 5: Knowledge Store Mode
82
+
83
+ Ask the user to pick one:
84
+
85
+ | Mode | Description |
86
+ |------|-------------|
87
+ | `sqlite` | Local SQLite + FTS5. Zero infrastructure, no Docker needed. **(recommended)** |
88
+ | `none` | Curated files only. Zero dependencies. |
89
+ | `local-docker` | Local ChromaDB via Docker (legacy). Pipeline provides a docker-compose file. |
90
+ | `connect-to-existing` | Remote/hosted ChromaDB instance for shared team knowledge (legacy). |
91
+
92
+ **If `sqlite`:** Set `sqlite_db_path` to `./v3/pipeline.db` (default). Inform the user to run `valent-pipeline db init` to create the database, or it will be created automatically on first story run.
93
+
94
+ Also show the `knowledge_base_path` setting:
95
+ - Default: `"./knowledge"`
96
+ - Let the user change the path if desired.
97
+
98
+ **If `local-docker`:** Inform the user that a `docker-compose.chromadb.yml` file will be created at `v3/docker-compose.chromadb.yml`. They can start it with:
99
+ ```
100
+ docker compose -f v3/docker-compose.chromadb.yml up -d
101
+ ```
102
+
103
+ **If `connect-to-existing`:** Ask for:
104
+ - ChromaDB host URL (e.g., `http://chromadb.internal:8000`)
105
+ - Collection prefix (e.g., `my-project-`) to namespace collections
106
+
107
+ ### Step 6: Model Assignments
108
+
109
+ Show the default agent-to-model-tier assignments:
110
+
111
+ | Tier | Agents | Rationale |
112
+ |------|--------|-----------|
113
+ | **opus** | bend, fend, critic | Complex code generation and deep review |
114
+ | **sonnet** | reqs, uxa, qa_a, qa_b, judge_g1, judge_g2, pmcp, retrospective | Analysis, spec writing, coordination |
115
+ | **haiku** | knowledge, embed, help | Mechanical retrieval and indexing |
116
+
117
+ Ask the user if they want to adjust any assignments. Common adjustments:
118
+ - Move `critic` to sonnet to save cost
119
+ - Move `reqs` or `qa_a` to opus for higher quality specs/tests
120
+ - Move all agents to sonnet for a budget-friendly setup
121
+
122
+ Note: agents that were skipped due to project type (e.g., FEND for backend-api) should still appear in the model list -- they are inactive but remain configured.
123
+
124
+ ---
125
+
126
+ ## Writing the Config File
127
+
128
+ After collecting all answers, generate the complete `v3/pipeline-config.yaml` file. Use the existing file at `v3/pipeline-config.yaml` as the canonical template -- preserve its structure, section headers, and comments exactly. Only change the values based on user input.
129
+
130
+ When writing the knowledge section, handle fields based on the selected mode:
131
+ - When mode is `sqlite`: set `sqlite_db_path` to `./v3/pipeline.db`. Leave ChromaDB fields commented out.
132
+ - When mode is `none`: leave `sqlite_db_path`, `chromadb_host`, and `chromadb_collection_prefix` commented out.
133
+ - When mode is `local-docker`: uncomment and set `chromadb_host` to `http://localhost:8000`. Leave `chromadb_collection_prefix` commented out (or set to default if user specifies).
134
+ - When mode is `connect-to-existing`: uncomment and populate both `chromadb_host` and `chromadb_collection_prefix` with user-provided values.
135
+
136
+ Read the existing template file before writing to ensure you preserve its exact format.
137
+
138
+ **If `local-docker` was selected for knowledge mode**, also create `v3/docker-compose.chromadb.yml`:
139
+
140
+ ```yaml
141
+ version: "3.8"
142
+ services:
143
+ chromadb:
144
+ image: chromadb/chroma:latest
145
+ ports:
146
+ - "8000:8000"
147
+ volumes:
148
+ - ./knowledge/chromadb-data:/chroma/chroma
149
+ environment:
150
+ - ANONYMIZED_TELEMETRY=false
151
+ - PERSIST_DIRECTORY=/chroma/chroma
152
+ ```
153
+
154
+ ## After Writing
155
+
156
+ 1. Read back the generated file to verify it is valid YAML.
157
+ 2. Print a summary of the configuration to the user.
158
+ 3. If knowledge mode is `local-docker`, remind them to run the docker-compose command.
159
+ 4. If knowledge mode is `connect-to-existing`, remind them to verify ChromaDB connectivity.
160
+
161
+ ---
162
+
163
+ ## Reconfiguration Mode
164
+
165
+ When the config file already exists and the user wants to change settings:
166
+
167
+ 1. Read the current `v3/pipeline-config.yaml`.
168
+ 2. Show a summary of all current settings grouped by section.
169
+ 3. Ask what the user wants to change. Accept natural language like "switch to python", "change the test framework to pytest", "move critic to sonnet".
170
+ 4. Apply only the requested changes, preserving everything else.
171
+ 5. Write the updated file and show a diff of what changed.
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: v3-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"'
4
+ argument-hint: '<epic-id>'
5
+ ---
6
+
7
+ # v3-run-epic
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.
10
+
11
+ ## Arguments
12
+
13
+ The user provides an epic ID (e.g., `KANBAN-MVP`). This is matched against the `epic` field on backlog items.
14
+
15
+ If no argument is provided, ask the user for the epic ID.
16
+
17
+ ## Context Window Advisory
18
+
19
+ Use the standard 200k context window. Per `pipeline-config.yaml` `orchestration.recommended_context_window`, 200k provides 93-98% MRCR v2 retrieval accuracy vs 76% at 1M. Auto-compression fires every 2-3 stories, keeping context clean. The PostCompact hook re-injects state from disk.
20
+
21
+ ## Execution Steps
22
+
23
+ ### Step 1: Load Pipeline Config
24
+
25
+ Read and follow `v3/steps/orchestration/load-pipeline-config.md`.
26
+
27
+ Set `{epic_id}` from the user's argument.
28
+
29
+ ### Step 2: Validate Epic
30
+
31
+ Read `{backlog_path}`. Filter items where `epic` field matches `{epic_id}`.
32
+
33
+ - If no items match, stop: "No backlog items found for epic `{epic_id}`. Add `epic: {epic_id}` to stories in `{backlog_path}`."
34
+ - 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?"
36
+ - If some stories are already shipped (resume scenario), note which are complete.
37
+
38
+ ### Step 3: Initialize or Resume Epic Progress
39
+
40
+ Read `{epic_progress_path}`.
41
+
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?"
43
+
44
+ **If the file does not exist or `epic_id` differs:** Create initial `epic-progress.md`:
45
+
46
+ ```markdown
47
+ ---
48
+ epic_id: {epic_id}
49
+ stories_completed: []
50
+ stories_remaining: [{pending story IDs from backlog, filtered by epic}]
51
+ current_story: null
52
+ stories_since_retro: 0
53
+ total_completed: 0
54
+ last_updated: {ISO-8601}
55
+ ---
56
+
57
+ ## Story Outcomes (compact — max 2 lines per story)
58
+ ```
59
+
60
+ ### Step 4: Story Loop
61
+
62
+ Loop until all epic stories are shipped, blocked, or cancelled.
63
+
64
+ #### 4a. Re-read State from Disk
65
+
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.
67
+
68
+ #### 4b. Resolve Next Story
69
+
70
+ Read and follow `v3/steps/orchestration/resolve-next-work-item.md`.
71
+
72
+ Set `{epic_filter}` = `{epic_id}` to scope backlog scanning to this epic.
73
+
74
+ If no unblocked stories remain in this epic, exit the loop and go to Step 5.
75
+
76
+ #### 4c. Resolve Story Path
77
+
78
+ Read and follow `v3/steps/orchestration/resolve-story-path.md`.
79
+
80
+ #### 4d. Validate Story Inputs
81
+
82
+ Read and follow `v3/steps/orchestration/validate-story-inputs.md`.
83
+
84
+ On validation failure: mark story `blocked-on-user` in backlog, update `epic-progress.md`, continue to next iteration (Step 4a).
85
+
86
+ #### 4e. Load Agents Manifest
87
+
88
+ Read and follow `v3/steps/orchestration/load-agents-manifest.md`.
89
+
90
+ #### 4f. Adopt Lead and Run Story
91
+
92
+ Read and follow `v3/steps/orchestration/adopt-lead-and-create-team.md`.
93
+
94
+ Set `{is_epic_run}` = true. This enables Phase 3 Step 5b (epic progress checkpoint) in `lead.md`.
95
+
96
+ Enter monitoring mode — follow `v3/prompts/lead.md` through story completion (Phase 2 monitor, Phase 3 ship/teardown).
97
+
98
+ #### 4g. Update Epic Progress
99
+
100
+ After the story ships (or is cancelled/blocked), update `{epic_progress_path}`:
101
+ - 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
105
+
106
+ #### 4h. Update Backlog
107
+
108
+ Read and follow `v3/steps/orchestration/update-backlog-status.md`.
109
+
110
+ #### 4i. Retrospective Check (BLOCKING)
111
+
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`
118
+
119
+ #### 4j. Continue Loop
120
+
121
+ Return to Step 4a. Context compression may fire here — that is expected. The PostCompact hook re-injects `epic-progress.md`, `pipeline-state.json`, and `pipeline-backlog.yaml`.
122
+
123
+ ### Step 5: Epic Complete
124
+
125
+ When all stories in the epic are shipped (or remaining are all blocked/cancelled):
126
+
127
+ #### 5a. Write Epic Report
128
+
129
+ Write `epic-report.md` adjacent to `{epic_progress_path}`:
130
+ - Epic ID, total stories, shipped count, blocked count, cancelled count
131
+ - Aggregate metrics: total bugs filed, total rejection cycles, total escalations
132
+ - Per-story one-line summaries (from `epic-progress.md`)
133
+ - Cross-epic bugs: list any conditional bugs from shipped stories that are still pending
134
+
135
+ #### 5b. Report to User
136
+
137
+ Present the epic completion summary. If any stories are blocked or cancelled, list them with reasons.
138
+
139
+ ## Error Recovery
140
+
141
+ ### Mid-Story Failure
142
+ 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.
143
+
144
+ ### Context Compression
145
+ 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.
146
+
147
+ ### Full Conversation Reset
148
+ If the conversation dies entirely, the user re-runs `/v3-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.
149
+
150
+ ## Notes
151
+
152
+ - You are the Lead for each story. The lead prompt (`v3/prompts/lead.md`) is YOUR operating manual — read and follow it directly.
153
+ - **Do NOT read agent output files.** Quality is JUDGE gates' and CRITIC's job.
154
+ - **Always read from disk, never from memory** at the top of each loop iteration. This is the compression survival rule.
155
+ - **Epic-progress.md is the crash recovery substrate.** Keep it under 50 lines. It must be readable standalone.
156
+ - **Retrospectives run BLOCKING** during epic loops to ensure correction directives are applied to subsequent stories.
157
+ - **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.
158
+ - **Shutdown must be sent individually, not broadcast.** Send a separate `shutdown_request` to each teammate by name.
159
+ - Correction directives may not exist yet for new pipelines — proceed without them gracefully.
160
+
161
+ ### Knowledge Agent Persistence
162
+
163
+ The Knowledge Agent persists across stories during epic runs to avoid respawn overhead (~15-20k tokens per story).
164
+
165
+ **Team lifecycle:**
166
+ - Use team name `v3-{epic_id}` (e.g., `v3-kanban-mvp`) for the entire epic, NOT `v3-{story_id}` per story.
167
+ - At story teardown (Phase 3, Step 4): send `shutdown_request` to all per-story teammates EXCEPT Knowledge. Do NOT call `TeamDelete` between stories.
168
+ - At the start of each new story: Knowledge is already alive. Send `[STORY-RESET]` instead of spawning (see `v3/steps/orchestration/adopt-lead-and-create-team.md`). Wait for `[KNOWLEDGE-READY]` before spawning other agents.
169
+ - At epic completion (Step 5): tear down Knowledge, then call `TeamDelete` to clean up the team.
170
+
171
+ **First story in epic:** Knowledge is spawned normally (no existing teammate to reset). All subsequent stories use the reset protocol.
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: v3-run-retrospective
3
+ description: 'Run a batch retrospective over recent stories. Use when the user says "run retrospective", "analyze recent stories", or "v3 retro"'
4
+ argument-hint: '[count]'
5
+ ---
6
+
7
+ # v3 Run Retrospective
8
+
9
+ Manually trigger a retrospective analysis over the last N completed stories.
10
+
11
+ ## Steps
12
+
13
+ ### 1. Load Configuration
14
+
15
+ Read `v3/pipeline-config.yaml` and extract:
16
+ - `quality.retrospective_every_n_stories` (default count, typically 5)
17
+ - `project.story_output_directory` (pattern: `./stories/{story-id}/output`)
18
+ - `project.knowledge_base_path`
19
+ - `knowledge.mode`
20
+ - `knowledge.curated_files_path`
21
+ - `knowledge.correction_directives_path`
22
+
23
+ ### 2. Determine Count
24
+
25
+ If the user provided a count argument, use that. Otherwise default to the `retrospective_every_n_stories` value from config.
26
+
27
+ ### 3. Find Completed Story Output Directories
28
+
29
+ Scan the story output directory pattern from config. Convert the `{story-id}` placeholder in the pattern to `*` for globbing (e.g., `./stories/{story-id}/output` becomes `./stories/*/output`). A story is "completed" if its output directory contains a `story-report.md` OR `judge-g2-decision.md` file (fallback for older stories that predate story-report.md generation).
30
+
31
+ Sort by the `date` field in the `story-report.md` YAML frontmatter (most recent first). If story-report.md is absent, fall back to the `date` or `lastCheckpoint` in `judge-g2-decision.md` frontmatter, or the git commit date. Take the last N.
32
+
33
+ ### 4. Validate
34
+
35
+ - If fewer than 2 completed stories exist, stop and inform the user: "Retrospective requires at least 2 completed stories. Found {count}."
36
+ - List the stories that will be included and confirm with the user before proceeding.
37
+
38
+ ### 5. Determine Batch Number
39
+
40
+ Check for existing `retrospective-batch-*.md` files in `{knowledge_base_path}` to determine the next batch number. If none exist, start at batch 1.
41
+
42
+ ### 6. Spawn Retrospective Agent
43
+
44
+ Use the Agent tool to spawn an ephemeral Sonnet-tier subagent with the Retrospective prompt (`v3/prompts/retrospective.md`).
45
+
46
+ Provide these context variables:
47
+ - `batch_number` -- the next batch sequence number
48
+ - `story_output_dirs` -- array of absolute paths to each story's output directory
49
+ - `story_ids` -- array of story identifiers extracted from directory names
50
+ - `correction_directives_path` -- resolved absolute path to `correction-directives.yaml`
51
+ - `curated_files_path` -- resolved absolute path to curated knowledge directory
52
+ - `knowledge_mode` -- value from config (`none`, `local-docker`, or `connect-to-existing`)
53
+
54
+ The Retrospective Agent will:
55
+ - Analyze all story outputs for patterns
56
+ - Update correction directives
57
+ - Write the retrospective report
58
+ - Generate embed instructions if applicable
59
+
60
+ **Note:** When the lead auto-triggers retrospectives during normal pipeline operation, it spawns the Retrospective Agent as a teammate with team context, so inbox messaging to the lead works. This skill spawns it as a standalone Agent subagent without team context, so inbox messaging is not available. The retrospective prompt handles this conditionally -- the agent skips inbox reporting when spawned standalone, and this skill handles reporting to the user in Step 8.
61
+
62
+ ### 7. Post-Retrospective: Embed Agent (Conditional)
63
+
64
+ After the Retrospective Agent completes, check the `knowledge.mode` from config:
65
+ - If `none` -- skip embedding, retrospective is complete.
66
+ - If `local-docker` or `connect-to-existing` -- spawn the Embed Agent (`v3/prompts/embed.md`) with the `embed-instructions.md` file produced by the Retrospective Agent.
67
+
68
+ ### 8. Update Pipeline State
69
+
70
+ Read `pipeline-state.json` and update:
71
+ - Set `stories_completed_since_retro` to `0`
72
+ - Set `last_retrospective_batch` to the batch number used in this retrospective
73
+
74
+ This step is critical — without it, the lead's auto-trigger threshold (`retrospective_every_n_stories`) will never reset, causing the retro to appear perpetually overdue.
75
+
76
+ ### 9. Report Completion
77
+
78
+ Inform the user that the retrospective is complete and summarize:
79
+ - Which stories were analyzed
80
+ - Path to the retrospective report
81
+ - Whether correction directives were updated
82
+ - Whether embed instructions were generated (and if Embed Agent was triggered)
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: v3-run-story
3
+ description: 'Run a story through the v3 pipeline. Use when the user says "run story", "execute story", or "v3 run"'
4
+ argument-hint: '<story-id or path>'
5
+ ---
6
+
7
+ # v3-run-story
8
+
9
+ Run a single story through the v3 multiagent pipeline by validating inputs, resolving config, adopting the Lead persona, and orchestrating teammates directly.
10
+
11
+ ## Arguments
12
+
13
+ The user provides a story ID or path as the argument:
14
+ - Story ID: `STORY-042` (resolved to `{story_directory}/STORY-042`)
15
+ - Relative path: `./stories/STORY-042` (used directly)
16
+
17
+ If no argument is provided, resolve the next work item from the backlog (see Step 1b).
18
+
19
+ ## Execution Steps
20
+
21
+ ### Step 1: Load Pipeline Config
22
+
23
+ Read and follow `v3/steps/orchestration/load-pipeline-config.md`.
24
+
25
+ ### Step 1b: Resolve Next Work Item (when no argument provided)
26
+
27
+ Read and follow `v3/steps/orchestration/resolve-next-work-item.md`.
28
+
29
+ Do NOT set `{epic_filter}` — standalone story runs use the full backlog.
30
+
31
+ ### Step 2: Resolve Story Path
32
+
33
+ Read and follow `v3/steps/orchestration/resolve-story-path.md`.
34
+
35
+ ### Step 3: Validate Story Inputs
36
+
37
+ Read and follow `v3/steps/orchestration/validate-story-inputs.md`.
38
+
39
+ ### Step 4: Load Agents Manifest
40
+
41
+ Read and follow `v3/steps/orchestration/load-agents-manifest.md`.
42
+
43
+ ### Step 5: Adopt Lead Persona and Create Team
44
+
45
+ Read and follow `v3/steps/orchestration/adopt-lead-and-create-team.md`.
46
+
47
+ Set `{is_epic_run}` = false. This is a standalone story run.
48
+
49
+ Enter monitoring mode — follow `v3/prompts/lead.md` for monitoring, exception handling, and ship/teardown.
50
+
51
+ ## Notes
52
+
53
+ - You are the Lead. The lead prompt (`v3/prompts/lead.md`) is YOUR operating manual — read and follow it directly.
54
+ - **Do NOT read agent output files.** Quality is JUDGE gates' and CRITIC's job. When you see a task complete or receive a `[STATUS]` CC, that's sufficient. Do NOT read the handoff document.
55
+ - **Spawn Knowledge first, then all others in parallel.** Knowledge is spawned in Wave 1 so it's ready for queries. All remaining roster agents are spawned together in Wave 2. They self-trigger via their Trigger Protocol (inbox messages between peers).
56
+ - Correction directives may not exist yet for new pipelines — that is expected. Pass the path regardless; proceed without directives gracefully.
57
+ - **Agent lifecycle — do NOT shut down agents early.** All per-story teammates stay alive until Phase 3 teardown (after JUDGE-G2 approves). Agents communicate peer-to-peer via inbox: CRITIC sends rejections directly to BEND/FEND, QA-B routes bugs directly to devs, any agent can message any other living teammate. Premature shutdown breaks this communication. Only send `shutdown_request` during Phase 3, Step 4 ("Tear Down Teammates") when the story is complete or cancelled.
58
+ - **Team cleanup at teardown is mandatory.** After all teammates have been shut down in Phase 3, call `TeamDelete` to remove the team. This prevents stale team errors on the next pipeline run. The Lead prompt's Phase 3 Step 4 ("Tear Down Teammates") must end with `TeamDelete`.
59
+ - **Shutdown must be sent individually, not broadcast.** `SendMessage` with `to: "*"` does not support structured `shutdown_request` messages — only plain text. Send a separate `shutdown_request` to each teammate by name during Phase 3 teardown.