valent-pipeline 0.2.26 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/package.json +1 -1
  2. package/pipeline/docs/design/provider-adapter-guide.md +173 -0
  3. package/pipeline/docs/design/refactor-checklist.md +16 -0
  4. package/pipeline/docs/index.md +3 -0
  5. package/pipeline/docs/pipeline-state-schema.md +19 -1
  6. package/pipeline/prompts/bend.md +6 -6
  7. package/pipeline/prompts/critic.md +7 -4
  8. package/pipeline/prompts/data.md +4 -4
  9. package/pipeline/prompts/docgen.md +4 -4
  10. package/pipeline/prompts/embed.md +3 -3
  11. package/pipeline/prompts/fend.md +6 -6
  12. package/pipeline/prompts/iac.md +6 -6
  13. package/pipeline/prompts/judge.md +4 -4
  14. package/pipeline/prompts/knowledge.md +14 -8
  15. package/pipeline/prompts/lead.md +31 -39
  16. package/pipeline/prompts/libdev.md +4 -4
  17. package/pipeline/prompts/mcp-dev.md +4 -4
  18. package/pipeline/prompts/mobile.md +6 -6
  19. package/pipeline/prompts/pm.md +2 -2
  20. package/pipeline/prompts/pmcp.md +3 -3
  21. package/pipeline/prompts/qa-a.md +3 -3
  22. package/pipeline/prompts/qa-b.md +3 -3
  23. package/pipeline/prompts/readiness.md +4 -4
  24. package/pipeline/prompts/reqs.md +3 -3
  25. package/pipeline/prompts/uxa.md +3 -3
  26. package/pipeline/providers/claude-code/knowledge-spawn.template.md +17 -0
  27. package/pipeline/providers/claude-code/spawn.template.md +16 -0
  28. package/pipeline/providers/codex/cloud-task-prompts/grooming.md +40 -0
  29. package/pipeline/providers/codex/cloud-task-prompts/implementation.md +40 -0
  30. package/pipeline/providers/codex/cloud-task-prompts/qa-validation.md +40 -0
  31. package/pipeline/providers/codex/cloud-task-prompts/retrospective.md +35 -0
  32. package/pipeline/providers/codex/cloud-task-prompts/rework.md +43 -0
  33. package/pipeline/providers/codex/cloud-task-protocol.md +165 -0
  34. package/pipeline/providers/codex/codex-project-files/.codex/agents/code-worker.toml +14 -0
  35. package/pipeline/providers/codex/codex-project-files/.codex/agents/knowledge-service.toml +14 -0
  36. package/pipeline/providers/codex/codex-project-files/.codex/agents/review-explorer.toml +14 -0
  37. package/pipeline/providers/codex/codex-project-files/.codex/agents/spec-explorer.toml +14 -0
  38. package/pipeline/providers/codex/codex-project-files/.codex/agents/test-worker.toml +14 -0
  39. package/pipeline/providers/codex/codex-project-files/.codex/config.toml +15 -0
  40. package/pipeline/providers/codex/codex-project-files/.codex/setup.sh +44 -0
  41. package/pipeline/providers/codex/codex-project-files/.github/workflows/codex-sprint.yaml +188 -0
  42. package/pipeline/providers/codex/knowledge-spawn.template.md +19 -0
  43. package/pipeline/providers/codex/runtime.md +22 -2
  44. package/pipeline/providers/codex/spawn.template.md +18 -0
  45. package/pipeline/spawn-templates/pipeline-context.template.md +3 -0
  46. package/pipeline/steps/bend/handoff.md +1 -1
  47. package/pipeline/steps/bend/read-inputs.md +4 -1
  48. package/pipeline/steps/bend/write-tests.md +4 -3
  49. package/pipeline/steps/common/agent-protocol.md +17 -3
  50. package/pipeline/steps/common/no-api-passthrough.md +1 -1
  51. package/pipeline/steps/common/no-ui-passthrough.md +1 -1
  52. package/pipeline/steps/critic/write-verdict.md +7 -7
  53. package/pipeline/steps/data/handoff.md +1 -1
  54. package/pipeline/steps/data/read-inputs.md +4 -1
  55. package/pipeline/steps/docgen/handoff.md +1 -1
  56. package/pipeline/steps/docgen/read-inputs.md +4 -1
  57. package/pipeline/steps/fend/handoff.md +1 -1
  58. package/pipeline/steps/fend/read-inputs.md +4 -1
  59. package/pipeline/steps/fend/write-tests.md +4 -3
  60. package/pipeline/steps/iac/handoff.md +1 -1
  61. package/pipeline/steps/iac/implement.md +1 -1
  62. package/pipeline/steps/iac/read-inputs.md +4 -1
  63. package/pipeline/steps/iac/write-tests.md +3 -2
  64. package/pipeline/steps/judge/bug-review.md +1 -1
  65. package/pipeline/steps/judge/ship-decision.md +3 -3
  66. package/pipeline/steps/libdev/handoff.md +1 -1
  67. package/pipeline/steps/libdev/read-inputs.md +4 -1
  68. package/pipeline/steps/mcp-dev/handoff.md +1 -1
  69. package/pipeline/steps/mcp-dev/read-inputs.md +4 -1
  70. package/pipeline/steps/mobile/handoff.md +2 -2
  71. package/pipeline/steps/mobile/read-inputs.md +4 -1
  72. package/pipeline/steps/mobile/write-tests.md +4 -3
  73. package/pipeline/steps/orchestration/adopt-lead-and-create-team.md +25 -39
  74. package/pipeline/steps/orchestration/sprint-groom.md +1 -1
  75. package/pipeline/steps/orchestration/sprint-pm-teardown.md +1 -1
  76. package/pipeline/steps/qa-a/read-inputs.md +4 -1
  77. package/pipeline/steps/qa-a/write-spec.md +1 -1
  78. package/pipeline/steps/qa-b/execute-tests.md +1 -1
  79. package/pipeline/steps/qa-b/file-bugs.md +1 -1
  80. package/pipeline/steps/qa-b/write-report.md +4 -4
  81. package/pipeline/steps/readiness/sprint-review.md +3 -3
  82. package/pipeline/steps/readiness/standalone-review.md +8 -9
  83. package/pipeline/steps/reqs/read-inputs.md +4 -1
  84. package/pipeline/steps/reqs/write-output.md +1 -1
  85. package/pipeline/steps/retrospective/embed-instructions.md +1 -1
  86. package/pipeline/steps/uxa/read-inputs.md +4 -1
  87. package/pipeline/steps/uxa/write-output.md +1 -1
  88. package/skills/valent-run-epic/SKILL.md +8 -8
  89. package/skills/valent-run-story/SKILL.md +3 -4
  90. package/src/commands/init.js +68 -12
  91. package/src/commands/upgrade.js +28 -0
  92. package/src/lib/config-schema.js +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valent-pipeline",
3
- "version": "0.2.26",
3
+ "version": "0.3.1",
4
4
  "description": "v3 multi-agent AI pipeline for software development lifecycle",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,173 @@
1
+ # Provider Adapter Guide
2
+
3
+ > How the multi-provider pattern works, how to keep providers in sync, and how to add provider-specific behavior.
4
+
5
+ ---
6
+
7
+ ## Architecture Overview
8
+
9
+ **Shared logic in shared files. Runtime-specific operations in provider-specific files.**
10
+
11
+ The pipeline logic (what agents do, in what order, with what quality gates) is provider-agnostic. The runtime mechanics (how agents are spawned, how signals are delivered, how tasks are tracked) are provider-specific.
12
+
13
+ ```
14
+ pipeline/
15
+ prompts/lead.md ← SHARED — orchestration logic (WHEN/WHY)
16
+ steps/orchestration/*.md ← SHARED — kickoff, monitoring, teardown logic
17
+ prompts/*.md ← SHARED — agent expertise (WHAT to do)
18
+ steps/**/*.md ← SHARED — domain procedures (HOW to do it)
19
+ agents-manifest.yaml ← SHARED — agent roster, dependencies, models
20
+ templates/*.md ← SHARED — handoff document formats
21
+ docs/communication-standard.md ← SHARED — message formats (runtime-agnostic)
22
+ spawn-templates/ ← SHARED — runtime-agnostic context template
23
+ providers/
24
+ claude-code/
25
+ runtime.md ← PROVIDER — Claude Code runtime operations
26
+ spawn.template.md ← PROVIDER — Claude Code spawn template
27
+ knowledge-spawn.template.md ← PROVIDER — Claude Code knowledge spawn
28
+ codex/
29
+ runtime.md ← PROVIDER — Codex runtime operations
30
+ spawn.template.md ← PROVIDER — Codex spawn template
31
+ knowledge-spawn.template.md ← PROVIDER — Codex knowledge spawn
32
+ AGENTS.md ← PROVIDER — Codex repo-level instructions
33
+ cloud-task-protocol.md ← PROVIDER — Codex cloud execution protocol
34
+ cloud-task-prompts/ ← PROVIDER — Codex cloud task templates
35
+ codex-project-files/ ← PROVIDER — Files deployed to target project
36
+ ```
37
+
38
+ ---
39
+
40
+ ## How Delegation Works
41
+
42
+ 1. **At init:** `pipeline-config.yaml` sets `runtime.provider` to `claude-code` or `codex`
43
+ 2. **At kick-off:** Lead reads its provider's runtime adapter: `.valent-pipeline/providers/{provider}/runtime.md`
44
+ 3. **During execution:** Lead follows the runtime adapter for all runtime-specific operations (spawn, signal, monitor, teardown)
45
+ 4. **Agent awareness:** Each agent reads `signal_delivery` and `execution_mode` from `pipeline-context.md` to know how to communicate
46
+
47
+ Lead's prompt (`lead.md`) defines WHEN and WHY. The runtime adapter defines HOW.
48
+
49
+ ---
50
+
51
+ ## Provider File Inventory
52
+
53
+ ### Required for Every Provider
54
+
55
+ | File | Purpose |
56
+ |------|---------|
57
+ | `runtime.md` | All runtime operations: initialization, task registry, agent spawning, signal delivery, monitoring, teardown |
58
+ | `spawn.template.md` | Agent spawn prompt template — what each agent instance receives at startup |
59
+ | `knowledge-spawn.template.md` | Knowledge agent spawn template — knowledge-specific initialization |
60
+
61
+ ### Codex-Only Files
62
+
63
+ | File | Purpose |
64
+ |------|---------|
65
+ | `AGENTS.md` | Codex repo-level instructions (equivalent to CLAUDE.md) — deployed to project root |
66
+ | `cloud-task-protocol.md` | Commit/push protocol for cloud execution |
67
+ | `cloud-task-prompts/*.md` | Per-phase prompt templates for multi-task cloud mode |
68
+ | `codex-project-files/.codex/` | Codex CLI configuration files deployed to target project |
69
+ | `codex-project-files/.github/` | GitHub Action workflow for cloud orchestration |
70
+
71
+ ---
72
+
73
+ ## Classification Rule
74
+
75
+ Every file in the pipeline falls into exactly one category:
76
+
77
+ | Category | Location | Change Protocol |
78
+ |----------|----------|----------------|
79
+ | **Shared** | `prompts/`, `steps/` (non-orchestration), `templates/`, `agents-manifest.yaml`, `docs/` | Change once. Both providers get it automatically. |
80
+ | **Provider-specific** | `providers/{provider}/` | Change in one provider. Manually add equivalent to the other. |
81
+ | **Orchestration** | `steps/orchestration/`, `lead.md` | Shared logic stays. Runtime calls delegate to provider adapter. |
82
+
83
+ ---
84
+
85
+ ## Adding a New Agent
86
+
87
+ Follow the [Refactor Checklist](refactor-checklist.md) for all locations. The provider-specific additions are:
88
+
89
+ | Step | Shared | Claude Code | Codex |
90
+ |------|--------|-------------|-------|
91
+ | Define agent | `agents-manifest.yaml` | — | — |
92
+ | Write prompt | `prompts/{agent}.md` | — | — |
93
+ | Write steps | `steps/{agent}/*.md` | — | — |
94
+ | Write template | `templates/{agent}-*.md` | — | — |
95
+ | Add to spawn wave | — | `providers/claude-code/runtime.md` | `providers/codex/runtime.md` |
96
+ | Update model map | — | `pipeline-config.yaml` (models) | `pipeline-config.yaml` (codex.model_map) |
97
+
98
+ Additionally if the agent has special communication patterns:
99
+ - `steps/common/agent-protocol.md` — update inbox protocol if new message types
100
+ - `docs/communication-standard.md` — document new message types
101
+ - `providers/codex/AGENTS.md` — update if agent introduces new repo-level conventions
102
+ - `providers/codex/codex-project-files/.codex/agents/` — assign agent to a TOML type or create new one
103
+
104
+ 5 shared changes, 2-4 provider-specific changes. The provider-specific changes are mechanical.
105
+
106
+ ---
107
+
108
+ ## Adding a New Communication Pattern
109
+
110
+ | Step | Shared | Claude Code | Codex |
111
+ |------|--------|-------------|-------|
112
+ | Define format | `docs/communication-standard.md` | — | — |
113
+ | Add to lead inbox protocol | `lead.md` (when/why) | `providers/claude-code/runtime.md` (how) | `providers/codex/runtime.md` (how) |
114
+ | Add to agent prompts | `prompts/*.md` (reference protocol) | — | — |
115
+
116
+ The pattern in agent prompts is:
117
+ ```markdown
118
+ If signal_delivery is sendmessage: send [NEW-SIGNAL] to {target} via SendMessage.
119
+ ```
120
+
121
+ For Codex, the agent writes output to disk. Lead reads it and steers the target thread.
122
+
123
+ ---
124
+
125
+ ## Adding a New Quality Gate
126
+
127
+ Entirely shared. Quality gates are orchestration logic (when to reject, where to route), not runtime operations. No provider-specific changes needed.
128
+
129
+ ---
130
+
131
+ ## Adding a Third Provider
132
+
133
+ 1. Create `providers/{new-provider}/` with:
134
+ - `runtime.md` — all runtime operations for the new provider
135
+ - `spawn.template.md` — spawn template adapted for the provider's agent model
136
+ - `knowledge-spawn.template.md` — knowledge spawn adapted
137
+
138
+ 2. Update `src/lib/config-schema.js`:
139
+ - Add new provider to `validProviders` array
140
+ - Add validation for provider-specific config fields
141
+
142
+ 3. Update `src/commands/init.js`:
143
+ - Add new provider to wizard choices
144
+ - Add deployment step for provider-specific project files (if any)
145
+ - Add config generation for provider-specific YAML section
146
+
147
+ 4. Update agent prompts if the new provider has a different signal delivery model:
148
+ - Add new `signal_delivery` value
149
+ - Add conditional blocks in agent prompts: `If signal_delivery is {new_mode}:`
150
+
151
+ 5. Update `scripts/validate-provider-sync.js` to include the new provider.
152
+
153
+ 6. Update this guide and the refactor checklist.
154
+
155
+ ---
156
+
157
+ ## CI Validation
158
+
159
+ The `scripts/validate-provider-sync.js` script runs in CI before every publish. It checks:
160
+
161
+ 1. **Template parity** — `spawn.template.md` and `knowledge-spawn.template.md` exist in both provider directories
162
+ 2. **Agent coverage** — Both runtime.md files reference the same set of agents from `agents-manifest.yaml`
163
+ 3. **Structural consistency** — Both runtime.md files have the same major sections (Initialization, Task Registry, Agent Spawning, Signal Delivery, Monitoring, Teardown)
164
+
165
+ If any check fails, the publish is blocked. Fix the discrepancy, then re-push.
166
+
167
+ ---
168
+
169
+ ## Further Reading
170
+
171
+ - [Codex Provider Support](codex-provider-support.md) — detailed Codex design, thread model, cloud execution
172
+ - [Refactor Checklist](refactor-checklist.md) — full list of locations to update for any pipeline change
173
+ - [Communication Standard](../communication-standard.md) — message formats and handoff protocol
@@ -93,6 +93,22 @@ When making design changes to the pipeline (new agents, renamed agents, new conf
93
93
 
94
94
  ---
95
95
 
96
+ ## Provider Sync
97
+
98
+ After any pipeline change, verify:
99
+ - [ ] `providers/claude-code/runtime.md` — does the change affect runtime operations?
100
+ - [ ] `providers/codex/runtime.md` — does the change affect runtime operations?
101
+ - [ ] If a new agent was added: both provider spawn lists updated
102
+ - [ ] If a new signal type was added: both provider signal delivery sections updated
103
+ - [ ] If task tracking changed: both provider task registry sections updated
104
+ - [ ] `pipeline-config.yaml` schema — new provider-specific settings documented
105
+ - [ ] If spawn template changed: both `providers/{provider}/spawn.template.md` updated
106
+ - [ ] If knowledge spawn changed: both `providers/{provider}/knowledge-spawn.template.md` updated
107
+ - [ ] `providers/codex/AGENTS.md` — does it need new conventions for this change?
108
+ - [ ] `providers/codex/codex-project-files/.codex/agents/` — does this change require a new agent type TOML?
109
+
110
+ ---
111
+
96
112
  ## Verification
97
113
 
98
114
  After all changes, run these greps to catch stragglers:
@@ -35,6 +35,7 @@ Design documents for pipeline extensions and architectural decisions.
35
35
  |---|---|
36
36
  | [Refactor Checklist](design/refactor-checklist.md) | Every location to update when changing agents, config, tables, statuses, or phases |
37
37
  | [Codex Provider Support](design/codex-provider-support.md) | Multi-provider architecture: Codex runtime adapter, sync strategy, phased implementation plan |
38
+ | [Provider Adapter Guide](design/provider-adapter-guide.md) | How the provider adapter pattern works, how to add provider-specific behavior, sync protocol |
38
39
 
39
40
  ## Quick Navigation
40
41
 
@@ -43,6 +44,7 @@ Design documents for pipeline extensions and architectural decisions.
43
44
  - **New to the pipeline?** Start with [Pipeline Overview](pipeline-overview.md), then [Agent Reference](agent-reference.md)
44
45
  - **Configuring a project?** See the [README](../../README.md) configuration section, then [NPX Packaging](npx-packaging.md)
45
46
  - **Adding or changing agents?** Read [Refactor Checklist](design/refactor-checklist.md) first, then [Agent Reference](agent-reference.md) and [Task Graph Specification](task-graph.md)
47
+ - **Adding provider support?** Read [Provider Adapter Guide](design/provider-adapter-guide.md), then [Codex Provider Support](design/codex-provider-support.md)
46
48
  - **Debugging a stuck pipeline?** Check [Lead Lifecycle](lead-lifecycle.md) sections on stall detection, rejection loops, and crash recovery
47
49
  - **Understanding the knowledge system?** Read [Knowledge System](knowledge-system.md) for correction directives, curation, and RAG assessment
48
50
  - **Writing or modifying templates?** Consult [Template Skeleton](template-skeleton.md) for the universal structure
@@ -59,3 +61,4 @@ Design documents for pipeline extensions and architectural decisions.
59
61
  | `task-graphs/*.yaml` | [Task Graph Specification](task-graph.md) |
60
62
  | `steps/**/*.md` | Individual agent prompts reference their step files |
61
63
  | `knowledge/` | [Knowledge System](knowledge-system.md) |
64
+ | `providers/**/*` | [Provider Adapter Guide](design/provider-adapter-guide.md) |
@@ -37,7 +37,23 @@ Defines the JSON schema for `pipeline-state.json`, the Lead agent's persistent s
37
37
  ],
38
38
  "stories_completed_since_retro": 3,
39
39
  "last_retrospective_batch": 2,
40
- "total_stories_completed": 12
40
+ "total_stories_completed": 12,
41
+ "execution_mode": "cli",
42
+ "cloud_task": null
43
+ }
44
+ ```
45
+
46
+ When `execution_mode` is `cloud-single` or `cloud-multi`, the `cloud_task` field tracks cloud-specific state:
47
+
48
+ ```json
49
+ {
50
+ "cloud_task": {
51
+ "task_name": "implementation",
52
+ "task_sequence": 2,
53
+ "task_total": 5,
54
+ "started_at": "2026-04-06T14:30:00Z",
55
+ "last_checkpoint_commit": "abc1234"
56
+ }
41
57
  }
42
58
  ```
43
59
 
@@ -56,6 +72,8 @@ Defines the JSON schema for `pipeline-state.json`, the Lead agent's persistent s
56
72
  | `last_retrospective_batch` | integer | Batch number of the most recent retrospective run | Lead (to compute next retro trigger) | Retrospective Agent (on completion) |
57
73
  | `total_stories_completed` | integer | Lifetime counter of all stories completed in this pipeline | Lead (for reporting) | Lead (incremented on story completion) |
58
74
  | `blocked_stories` | array | Stories blocked during this pipeline run, with escalation metadata. Used for crash recovery (quickly reconstruct blocked set without scanning backlog) and resume protocol. | Lead (on startup, resume) | Lead (when escalation occurs) |
75
+ | `execution_mode` | enum | `cli` (default), `cloud-single`, or `cloud-multi`. Determines commit/push behavior and cloud task protocol. | Lead (on startup, teardown) | Lead (on init, set from pipeline context) |
76
+ | `cloud_task` | object\|null | Cloud task metadata. `null` for CLI mode. Tracks task name, sequence position, and last checkpoint commit for recovery. | Lead (on startup in cloud mode) | Lead (on cloud task start, after each checkpoint commit) |
59
77
 
60
78
  ### `blocked_stories[]` Entry Fields
61
79
 
@@ -10,10 +10,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
10
10
  You are spawned at story kick-off but do NOT begin work immediately.
11
11
 
12
12
  - **Wait for:** `[READINESS-APPROVAL]` (Pass 1) from READINESS
13
- - **On completion:** Send `[HANDOFF]` to CRITIC. CC Lead. If FEND is active, CRITIC waits for both -- send your handoff; CRITIC starts when it has both.
14
- - **On rejection received (from CRITIC):** Read rejection at critic-review.md. Fix code. Re-send `[HANDOFF]` to CRITIC.
15
- - **On bug received (from QA-B):** Fix bug. Notify QA-B when fixed.
16
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
13
+ - **On completion:** Write handoff file with verdict. If signal_delivery is sendmessage: also send `[HANDOFF]` to CRITIC and CC Lead via inbox. If FEND is active, CRITIC waits for both -- send your handoff; CRITIC starts when it has both.
14
+ - **On rejection (from CRITIC, via inbox or Lead steering):** Read rejection at critic-review.md. Fix code. Write updated handoff. If signal_delivery is sendmessage: re-send `[HANDOFF]` to CRITIC via inbox.
15
+ - **On bug (from QA-B, via inbox or Lead steering):** Fix bug. If signal_delivery is sendmessage: notify QA-B via inbox when fixed.
16
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
17
17
 
18
18
  ## Context
19
19
 
@@ -46,9 +46,9 @@ Additional BEND-specific standards:
46
46
 
47
47
  ## Coordination with FEND
48
48
 
49
- You and FEND work on the same branch. When touching shared files (types, constants, config, shared utilities), coordinate via inbox: `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.`
49
+ You and FEND work on the same branch. When touching shared files (types, constants, config, shared utilities), coordinate: if `signal_delivery` is `sendmessage`: send `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.` via inbox. If `signal_delivery` is `thread`: write shared file details to your handoff frontmatter. Lead relays via steering.
50
50
 
51
- FEND may ask what you named an endpoint or what shape a response takes. Answer promptly via inbox with a pointer to `bend-handoff.md#api-endpoints-implemented`.
51
+ FEND may ask what you named an endpoint or what shape a response takes. If `signal_delivery` is `sendmessage`: answer promptly via inbox with a pointer to `bend-handoff.md#api-endpoints-implemented`. If `signal_delivery` is `thread`: write API details to your handoff file; Lead relays.
52
52
 
53
53
  ## Step Sequence
54
54
 
@@ -12,9 +12,9 @@ Additional frontmatter field: `review_depth`.
12
12
  You are spawned at story kick-off but do NOT begin work immediately.
13
13
 
14
14
  - **Wait for:** `[HANDOFF]` from BEND (and FEND if active). If both are active, wait for BOTH before starting review.
15
- - **On approval:** Send `[CRITIC-APPROVED]` to QA-B. Send `[DONE]` to Lead. Mark your task completed. This unblocks QA-B.
16
- - **On rejection:** Send `[CRITIC-REJECTION]` to BEND or FEND (whichever owns the finding) AND to Lead. Do NOT send `[DONE]`. Do NOT mark your task completed. Your task stays `in_progress` — this keeps QA-B blocked. After dev fixes and re-sends `[HANDOFF]`, perform delta review (only changed files). Re-evaluate verdict.
17
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
15
+ - **On approval:** Write critic-review.md with verdict: APPROVED. If signal_delivery is sendmessage: also send `[CRITIC-APPROVED]` to QA-B and `[DONE]` to Lead via inbox. Mark your task completed. This unblocks QA-B.
16
+ - **On rejection:** Write critic-review.md with verdict and rejection_target in frontmatter. If signal_delivery is sendmessage: also send `[CRITIC-REJECTION]` to BEND or FEND (whichever owns the finding) AND to Lead via inbox. Do NOT send `[DONE]`. Do NOT mark your task completed. Your task stays in_progress — this keeps QA-B blocked. After dev fixes and re-sends `[HANDOFF]` (via inbox or Lead steering), perform delta review (only changed files). Re-evaluate verdict.
17
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
18
18
 
19
19
  ## Context Variables
20
20
 
@@ -63,7 +63,10 @@ After triage-depth, execute only the passes indicated by your selected depth lev
63
63
  Read ALL changed files. Categorize into production code vs test code. Note file count and line count for the Review Scope section.
64
64
 
65
65
  ### Step 2b: Query Knowledge Agent (Conditional)
66
- If a Knowledge Agent is available, send: `[KNOWLEDGE-QUERY] What recurring code quality issues, known anti-patterns, and correction directives should I apply during review? Context: I am CRITIC reviewing code for {story_id}.` If no response within a reasonable time, proceed without.
66
+ If a Knowledge Agent is available:
67
+ - If signal_delivery is sendmessage: send `[KNOWLEDGE-QUERY] What recurring code quality issues, known anti-patterns, and correction directives should I apply during review? Context: I am CRITIC reviewing code for {story_id}.` to Knowledge via inbox.
68
+ - If signal_delivery is thread: write query to `{story_output_dir}/knowledge-queries/critic-1.md`. Continue without waiting.
69
+ - If no response within a reasonable time or no Knowledge Agent is spawned, proceed without.
67
70
 
68
71
  ### Step 3b: Load Profile Steps for Edge Case Hunt (Conditional)
69
72
  For edge-case-hunt, also read profile-specific step files based on `{testing_profiles}`: `.valent-pipeline/steps/critic/api.md`, `ui.md`, `data-pipeline.md`, `mcp-server.md`, `library.md`, `document-generation.md`, `iac.md`. If a profile step file does not exist, note it and proceed. Apply domain-specific focus areas alongside the generic ones.
@@ -10,10 +10,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
10
10
  You are spawned at story kick-off but do NOT begin work immediately.
11
11
 
12
12
  - **Wait for:** `[READINESS-APPROVAL]` (Pass 1) from READINESS
13
- - **On completion:** Send `[HANDOFF]` to CRITIC. CC Lead.
14
- - **On rejection received (from CRITIC):** Read rejection at critic-review.md. Fix code. Re-send `[HANDOFF]` to CRITIC.
15
- - **On bug received (from QA-B):** Fix bug. Notify QA-B when fixed.
16
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
13
+ - **On completion:** Write handoff file with verdict. If signal_delivery is sendmessage: also send `[HANDOFF]` to CRITIC and CC Lead via inbox.
14
+ - **On rejection (from CRITIC, via inbox or Lead steering):** Read rejection at critic-review.md. Fix code. Write updated handoff. If signal_delivery is sendmessage: re-send `[HANDOFF]` to CRITIC via inbox.
15
+ - **On bug (from QA-B, via inbox or Lead steering):** Fix bug. If signal_delivery is sendmessage: notify QA-B via inbox when fixed.
16
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
17
17
 
18
18
  ## Context
19
19
 
@@ -10,10 +10,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
10
10
  You are spawned at story kick-off but do NOT begin work immediately.
11
11
 
12
12
  - **Wait for:** `[READINESS-APPROVAL]` (Pass 1) from READINESS
13
- - **On completion:** Send `[HANDOFF]` to CRITIC. CC Lead.
14
- - **On rejection received (from CRITIC):** Read rejection at critic-review.md. Fix code. Re-send `[HANDOFF]` to CRITIC.
15
- - **On bug received (from QA-B):** Fix bug. Notify QA-B when fixed.
16
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
13
+ - **On completion:** Write handoff file with verdict. If signal_delivery is sendmessage: also send `[HANDOFF]` to CRITIC and CC Lead via inbox.
14
+ - **On rejection (from CRITIC, via inbox or Lead steering):** Read rejection at critic-review.md. Fix code. Write updated handoff. If signal_delivery is sendmessage: re-send `[HANDOFF]` to CRITIC via inbox.
15
+ - **On bug (from QA-B, via inbox or Lead steering):** Fix bug. If signal_delivery is sendmessage: notify QA-B via inbox when fixed.
16
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
17
17
 
18
18
  ## Context
19
19
 
@@ -23,7 +23,7 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
23
23
  ## Execution Steps
24
24
 
25
25
  ### Step 1: Validate Inputs
26
- Verify `{story_output_dir}/embed-instructions.md` exists. If missing, send `[BLOCKER]` to lead and terminate.
26
+ Verify `{story_output_dir}/embed-instructions.md` exists. If missing: If signal_delivery is sendmessage: send `[BLOCKER]` to lead. If thread: write status: blocked to output frontmatter. Terminate.
27
27
 
28
28
  ### Step 2: Run Embed Script
29
29
 
@@ -50,7 +50,7 @@ npx tsx .valent-pipeline/scripts/embed.ts {story_output_dir}/embed-instructions.
50
50
  ### Step 3: Verify and Report
51
51
  Check the script's exit code: Exit 0 = success, Exit 1 = errors (details in stderr).
52
52
 
53
- Send inbox message to lead: `[EMBED-COMPLETE] Indexed {count} items.` (or `[EMBED-PARTIAL]` if errors occurred). Agent terminates.
53
+ If signal_delivery is sendmessage: Send inbox message to lead: `[EMBED-COMPLETE] Indexed {count} items.` (or `[EMBED-PARTIAL]` if errors occurred). Agent terminates.
54
54
 
55
55
  ## Boundaries
56
56
 
@@ -61,7 +61,7 @@ Send inbox message to lead: `[EMBED-COMPLETE] Indexed {count} items.` (or `[EMBE
61
61
 
62
62
  ## Error Handling
63
63
 
64
- - If embed-instructions.md is missing: send `[BLOCKER]` to lead, terminate.
64
+ - If embed-instructions.md is missing: If signal_delivery is sendmessage: send `[BLOCKER]` to lead. If thread: write status: blocked to output frontmatter. Terminate.
65
65
  - If SQLite database is missing: it will be auto-created on first write. If the DB file cannot be created, skip DB instructions and index curated files only.
66
66
  - If ChromaDB connection fails (legacy mode): skip ChromaDB instructions, index curated files only, report partial completion.
67
67
  - If a curated file write fails: log the failure, continue to next instruction, report in completion message.
@@ -10,10 +10,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
10
10
  You are spawned at story kick-off but do NOT begin work immediately.
11
11
 
12
12
  - **Wait for:** `[READINESS-APPROVAL]` (Pass 1) from READINESS
13
- - **On completion:** Send `[HANDOFF]` to CRITIC. CC Lead. CRITIC waits for both BEND and FEND -- send your handoff; CRITIC starts when it has both.
14
- - **On rejection received (from CRITIC):** Read rejection at critic-review.md. Fix code. Re-send `[HANDOFF]` to CRITIC.
15
- - **On bug received (from QA-B):** Fix bug. Notify QA-B when fixed.
16
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
13
+ - **On completion:** Write handoff file with verdict. If signal_delivery is sendmessage: also send `[HANDOFF]` to CRITIC and CC Lead via inbox. CRITIC waits for both BEND and FEND -- send your handoff; CRITIC starts when it has both.
14
+ - **On rejection (from CRITIC, via inbox or Lead steering):** Read rejection at critic-review.md. Fix code. Write updated handoff. If signal_delivery is sendmessage: re-send `[HANDOFF]` to CRITIC via inbox.
15
+ - **On bug (from QA-B, via inbox or Lead steering):** Fix bug. If signal_delivery is sendmessage: notify QA-B via inbox when fixed.
16
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
17
17
 
18
18
  ## Context
19
19
 
@@ -64,9 +64,9 @@ Component names must match uxa-spec.md component specifications exactly. Do not
64
64
 
65
65
  ## Coordination with BEND
66
66
 
67
- You and BEND work on the same branch. When touching shared files, coordinate via inbox: `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.`
67
+ You and BEND work on the same branch. When touching shared files, coordinate: if `signal_delivery` is `sendmessage`: send `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.` via inbox. If `signal_delivery` is `thread`: write shared file details to your handoff frontmatter. Lead relays via steering.
68
68
 
69
- If you need endpoint or response shape info, ask BEND via inbox. Use `bend-handoff.md#integration-notes-for-fend` as your primary reference for API contracts once BEND has published it.
69
+ If you need endpoint or response shape info: if `signal_delivery` is `sendmessage`: ask BEND via inbox. If `signal_delivery` is `thread`: read `bend-handoff.md#integration-notes-for-fend` directly. Use that file as your primary reference for API contracts once BEND has published it.
70
70
 
71
71
  ## Step Sequence
72
72
 
@@ -10,10 +10,10 @@ Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standar
10
10
  You are spawned at story kick-off but do NOT begin work immediately.
11
11
 
12
12
  - **Wait for:** `[READINESS-APPROVAL]` (Pass 1) from READINESS
13
- - **On completion:** Send `[HANDOFF]` to CRITIC. CC Lead. CRITIC waits for all active dev agents -- send your handoff; CRITIC starts when it has all.
14
- - **On rejection received (from CRITIC):** Read rejection at critic-review.md. Fix code. Re-send `[HANDOFF]` to CRITIC.
15
- - **On bug received (from QA-B):** Fix bug. Notify QA-B when fixed.
16
- - **Escalate to:** Lead -- for `[BLOCKER]`, `[ESCALATION]`, or any issue you cannot resolve peer-to-peer.
13
+ - **On completion:** Write handoff file with verdict. If signal_delivery is sendmessage: also send `[HANDOFF]` to CRITIC and CC Lead via inbox. CRITIC waits for all active dev agents -- send your handoff; CRITIC starts when it has all.
14
+ - **On rejection (from CRITIC, via inbox or Lead steering):** Read rejection at critic-review.md. Fix code. Write updated handoff. If signal_delivery is sendmessage: re-send `[HANDOFF]` to CRITIC via inbox.
15
+ - **On bug (from QA-B, via inbox or Lead steering):** Fix bug. If signal_delivery is sendmessage: notify QA-B via inbox when fixed.
16
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
17
17
 
18
18
  ## Context
19
19
 
@@ -52,9 +52,9 @@ Additional IAC-specific standards:
52
52
 
53
53
  ## Coordination with Other Dev Agents
54
54
 
55
- You and BEND/FEND/DATA/etc work on the same branch. When touching shared config (env vars, secrets, connection strings), coordinate via inbox: `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.`
55
+ You and BEND/FEND/DATA/etc work on the same branch. When touching shared config (env vars, secrets, connection strings), coordinate: if `signal_delivery` is `sendmessage`: send `[SHARED-FILE] I'm modifying {file}. Changes: {brief description}.` via inbox. If `signal_delivery` is `thread`: write shared config details to your handoff frontmatter. Lead relays via steering.
56
56
 
57
- Other dev agents may ask what environment variables or connection strings you provisioned. Answer promptly via inbox with a pointer to `iac-handoff.md#environment-configuration`.
57
+ Other dev agents may ask what environment variables or connection strings you provisioned. If `signal_delivery` is `sendmessage`: answer promptly via inbox with a pointer to `iac-handoff.md#environment-configuration`. If `signal_delivery` is `thread`: write details to your handoff file; other agents read directly.
58
58
 
59
59
  ## Step Sequence
60
60
 
@@ -14,10 +14,10 @@ You are spawned when CRITIC starts reviewing (wave 3) but do NOT begin work imme
14
14
 
15
15
  - **Wait for:** `[HANDOFF]` from QA-B. Do NOT begin if CRITIC task is still `in_progress` (rejection/bug cycle ongoing).
16
16
  - **On bug review approval (no reclassifications to P1-P3):** Proceed directly to evidence review. No external message needed — this is an internal transition.
17
- - **On bug reclassification (P4 escalated to P1-P3):** Send `[JUDGE-RECLASS]` to the responsible dev (BEND or FEND per root cause) AND to Lead. Do NOT proceed to evidence review until bugs are fixed and QA-B re-runs.
18
- - **On SHIP verdict:** Send `[JUDGE-SHIP]` to Lead. Mark task completed. Lead owns ship/teardown.
19
- - **On REJECT verdict:** Send `[JUDGE-REJECT]` to Lead. Mark task completed. Lead owns JUDGE rejection routing — this is non-routine.
20
- - **Escalate to:** Lead for `[BLOCKER]` or any issue you cannot resolve.
17
+ - **On bug reclassification (P4 escalated to P1-P3):** Write reclassification to judge-review.md. If signal_delivery is sendmessage: also send `[JUDGE-RECLASS]` to the responsible dev AND to Lead via inbox. Do NOT proceed to evidence review until bugs are fixed and QA-B re-runs.
18
+ - **On SHIP verdict:** Write judge-decision.md with verdict: SHIP. If signal_delivery is sendmessage: also send `[JUDGE-SHIP]` to Lead via inbox. Mark task completed.
19
+ - **On REJECT verdict:** Write judge-decision.md with verdict: REJECT. If signal_delivery is sendmessage: also send `[JUDGE-REJECT]` to Lead via inbox. Mark task completed.
20
+ - **Escalate to:** Lead. If signal_delivery is sendmessage: send `[BLOCKER]` or `[ESCALATION]` via inbox. If thread: write status: blocked to output frontmatter.
21
21
 
22
22
  ## Output
23
23
 
@@ -2,16 +2,22 @@
2
2
 
3
3
  <!-- Prompt version: 1.1 | Model: Haiku | Lifecycle: per-story -->
4
4
 
5
- You are **KNOWLEDGE**, the knowledge retrieval agent. You answer queries from teammates by searching persistent data sources: correction directives, curated knowledge files, and the knowledge database (SQLite or ChromaDB). You produce no file output -- all responses go via inbox.
5
+ You are **KNOWLEDGE**, the knowledge retrieval agent. You answer queries from teammates by searching persistent data sources: correction directives, curated knowledge files, and the knowledge database (SQLite or ChromaDB). When `signal_delivery` is `sendmessage`: respond via inbox only, no file output. When `signal_delivery` is `thread`: write responses to `{story_output_dir}/knowledge-responses/` only.
6
6
 
7
7
  Read `.valent-pipeline/steps/common/agent-protocol.md` for Communication Standard and Inbox Protocol.
8
8
 
9
- **Inbox specifics for KNOWLEDGE:**
10
- - Incoming: `[KNOWLEDGE-QUERY] {question}`
11
- - Response: `[KNOWLEDGE-RESPONSE] {answer}. Source: {source reference}.`
12
- - No match: `[KNOWLEDGE-RESPONSE] No relevant knowledge found for: {query summary}`
9
+ **When `signal_delivery` is `sendmessage` (Claude Code):**
10
+ - Incoming: `[KNOWLEDGE-QUERY] {question}` via inbox
11
+ - Response: `[KNOWLEDGE-RESPONSE] {answer}. Source: {source reference}.` via inbox
12
+ - No match: `[KNOWLEDGE-RESPONSE] No relevant knowledge found for: {query summary}` via inbox
13
13
 
14
- **Context Discipline:** Message budget applies (under 500 tokens). No unsolicited messages -- only respond to `[KNOWLEDGE-QUERY]` messages.
14
+ **When `signal_delivery` is `thread` (Codex):**
15
+ - Incoming: Lead steers you with a query file path in `{story_output_dir}/knowledge-queries/`
16
+ - Response: Write to `{story_output_dir}/knowledge-responses/{agent}-{n}.md`
17
+ - No match: Write "No relevant knowledge found for: {query summary}" to response file
18
+ - Do NOT use SendMessage or inbox messaging.
19
+
20
+ **Context Discipline:** Message budget applies (under 500 tokens for inbox, or equivalent file size). No unsolicited messages or files -- only respond to queries.
15
21
 
16
22
  ## Context Variables
17
23
 
@@ -69,12 +75,12 @@ Cross-reference BOTH correction directives and curated files for convention/patt
69
75
 
70
76
  ## Story Reset Protocol (Epic Mode)
71
77
 
72
- On `[STORY-RESET] story_id={new_story_id}, pipeline_context={new_pipeline_context_path}`:
78
+ On story reset (via `[STORY-RESET]` inbox message or Lead steering):
73
79
  1. Update `{story_id}` to new value
74
80
  2. Read new `pipeline-context.md`
75
81
  3. Re-read `{correction_directives}` and `{curated_files_path}`
76
82
  4. Refresh database connection if connected
77
- 5. Send `[KNOWLEDGE-READY]` to Lead
83
+ 5. If `signal_delivery` is `sendmessage`: send `[KNOWLEDGE-READY]` to Lead via inbox. If `signal_delivery` is `thread`: write `{story_output_dir}/knowledge-ready.md` as ready signal.
78
84
 
79
85
  ## Flakiness Awareness
80
86