murmur8 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/.blueprint/agents/AGENT_BA_CASS.md +239 -0
  2. package/.blueprint/agents/AGENT_DEVELOPER_CODEY.md +308 -0
  3. package/.blueprint/agents/AGENT_SPECIFICATION_ALEX.md +183 -0
  4. package/.blueprint/agents/AGENT_TESTER_NIGEL.md +159 -0
  5. package/.blueprint/agents/GUARDRAILS.md +83 -0
  6. package/.blueprint/agents/TEAM_MANIFESTO.md +91 -0
  7. package/.blueprint/features/.gitkeep +0 -0
  8. package/.blueprint/features/feature_adaptive-retry/FEATURE_SPEC.md +239 -0
  9. package/.blueprint/features/feature_adaptive-retry/IMPLEMENTATION_PLAN.md +48 -0
  10. package/.blueprint/features/feature_adaptive-retry/story-prompt-modification.md +85 -0
  11. package/.blueprint/features/feature_adaptive-retry/story-retry-config.md +89 -0
  12. package/.blueprint/features/feature_adaptive-retry/story-should-retry.md +98 -0
  13. package/.blueprint/features/feature_adaptive-retry/story-strategy-recommendation.md +85 -0
  14. package/.blueprint/features/feature_agent-guardrails/FEATURE_SPEC.md +328 -0
  15. package/.blueprint/features/feature_agent-guardrails/IMPLEMENTATION_PLAN.md +90 -0
  16. package/.blueprint/features/feature_agent-guardrails/story-citation-requirements.md +50 -0
  17. package/.blueprint/features/feature_agent-guardrails/story-confidentiality.md +50 -0
  18. package/.blueprint/features/feature_agent-guardrails/story-escalation-protocol.md +55 -0
  19. package/.blueprint/features/feature_agent-guardrails/story-source-restrictions.md +50 -0
  20. package/.blueprint/features/feature_compressed-feedback/FEATURE_SPEC.md +136 -0
  21. package/.blueprint/features/feature_compressed-feedback/IMPLEMENTATION_PLAN.md +40 -0
  22. package/.blueprint/features/feature_feedback-loop/FEATURE_SPEC.md +347 -0
  23. package/.blueprint/features/feature_feedback-loop/IMPLEMENTATION_PLAN.md +71 -0
  24. package/.blueprint/features/feature_feedback-loop/story-feedback-collection.md +63 -0
  25. package/.blueprint/features/feature_feedback-loop/story-feedback-config.md +61 -0
  26. package/.blueprint/features/feature_feedback-loop/story-feedback-insights.md +63 -0
  27. package/.blueprint/features/feature_feedback-loop/story-quality-gates.md +57 -0
  28. package/.blueprint/features/feature_interactive-alex/FEATURE_SPEC.md +263 -0
  29. package/.blueprint/features/feature_interactive-alex/IMPLEMENTATION_PLAN.md +69 -0
  30. package/.blueprint/features/feature_interactive-alex/handoff-alex.md +19 -0
  31. package/.blueprint/features/feature_interactive-alex/handoff-cass.md +21 -0
  32. package/.blueprint/features/feature_interactive-alex/handoff-nigel.md +19 -0
  33. package/.blueprint/features/feature_interactive-alex/story-flag-routing.md +54 -0
  34. package/.blueprint/features/feature_interactive-alex/story-iterative-drafting.md +65 -0
  35. package/.blueprint/features/feature_interactive-alex/story-pipeline-integration.md +66 -0
  36. package/.blueprint/features/feature_interactive-alex/story-session-lifecycle.md +75 -0
  37. package/.blueprint/features/feature_interactive-alex/story-system-spec-creation.md +57 -0
  38. package/.blueprint/features/feature_lazy-business-context/FEATURE_SPEC.md +140 -0
  39. package/.blueprint/features/feature_lazy-business-context/IMPLEMENTATION_PLAN.md +54 -0
  40. package/.blueprint/features/feature_model-native-features/FEATURE_SPEC.md +174 -0
  41. package/.blueprint/features/feature_model-native-features/IMPLEMENTATION_PLAN.md +45 -0
  42. package/.blueprint/features/feature_parallel-abort/FEATURE_SPEC.md +117 -0
  43. package/.blueprint/features/feature_parallel-confirm/FEATURE_SPEC.md +90 -0
  44. package/.blueprint/features/feature_parallel-features/FEATURE_SPEC.md +291 -0
  45. package/.blueprint/features/feature_parallel-features/IMPLEMENTATION_PLAN.md +73 -0
  46. package/.blueprint/features/feature_parallel-lock/FEATURE_SPEC.md +119 -0
  47. package/.blueprint/features/feature_parallel-logging/FEATURE_SPEC.md +105 -0
  48. package/.blueprint/features/feature_parallel-preflight/FEATURE_SPEC.md +141 -0
  49. package/.blueprint/features/feature_pipeline-history/FEATURE_SPEC.md +239 -0
  50. package/.blueprint/features/feature_pipeline-history/IMPLEMENTATION_PLAN.md +71 -0
  51. package/.blueprint/features/feature_pipeline-history/story-clear-history.md +73 -0
  52. package/.blueprint/features/feature_pipeline-history/story-display-history.md +75 -0
  53. package/.blueprint/features/feature_pipeline-history/story-record-execution.md +76 -0
  54. package/.blueprint/features/feature_pipeline-history/story-show-statistics.md +85 -0
  55. package/.blueprint/features/feature_pipeline-insights/FEATURE_SPEC.md +288 -0
  56. package/.blueprint/features/feature_pipeline-insights/IMPLEMENTATION_PLAN.md +65 -0
  57. package/.blueprint/features/feature_pipeline-insights/story-anomaly-detection.md +71 -0
  58. package/.blueprint/features/feature_pipeline-insights/story-bottleneck-analysis.md +75 -0
  59. package/.blueprint/features/feature_pipeline-insights/story-failure-patterns.md +75 -0
  60. package/.blueprint/features/feature_pipeline-insights/story-json-output.md +75 -0
  61. package/.blueprint/features/feature_pipeline-insights/story-trend-analysis.md +78 -0
  62. package/.blueprint/features/feature_shared-guardrails/FEATURE_SPEC.md +119 -0
  63. package/.blueprint/features/feature_shared-guardrails/IMPLEMENTATION_PLAN.md +34 -0
  64. package/.blueprint/features/feature_shared-guardrails/story-extract-guardrails.md +60 -0
  65. package/.blueprint/features/feature_shared-guardrails/story-update-init-commands.md +63 -0
  66. package/.blueprint/features/feature_slim-agent-prompts/FEATURE_SPEC.md +145 -0
  67. package/.blueprint/features/feature_slim-agent-prompts/IMPLEMENTATION_PLAN.md +87 -0
  68. package/.blueprint/features/feature_slim-agent-prompts/story-create-runtime-prompt-template.md +59 -0
  69. package/.blueprint/features/feature_slim-agent-prompts/story-create-slim-agent-prompts.md +65 -0
  70. package/.blueprint/features/feature_slim-agent-prompts/story-skill-integration.md +53 -0
  71. package/.blueprint/features/feature_smart-story-routing/FEATURE_SPEC.md +147 -0
  72. package/.blueprint/features/feature_smart-story-routing/IMPLEMENTATION_PLAN.md +73 -0
  73. package/.blueprint/features/feature_template-extraction/FEATURE_SPEC.md +134 -0
  74. package/.blueprint/features/feature_template-extraction/IMPLEMENTATION_PLAN.md +46 -0
  75. package/.blueprint/features/feature_upstream-summaries/FEATURE_SPEC.md +150 -0
  76. package/.blueprint/features/feature_upstream-summaries/IMPLEMENTATION_PLAN.md +70 -0
  77. package/.blueprint/features/feature_validate-command/FEATURE_SPEC.md +209 -0
  78. package/.blueprint/features/feature_validate-command/IMPLEMENTATION_PLAN.md +59 -0
  79. package/.blueprint/features/feature_validate-command/story-failure-output.md +61 -0
  80. package/.blueprint/features/feature_validate-command/story-node-version-check.md +52 -0
  81. package/.blueprint/features/feature_validate-command/story-run-validation.md +59 -0
  82. package/.blueprint/features/feature_validate-command/story-success-output.md +50 -0
  83. package/.blueprint/prompts/TEMPLATE.md +65 -0
  84. package/.blueprint/prompts/alex-runtime.md +49 -0
  85. package/.blueprint/prompts/cass-runtime.md +46 -0
  86. package/.blueprint/prompts/codey-implement-runtime.md +52 -0
  87. package/.blueprint/prompts/codey-plan-runtime.md +47 -0
  88. package/.blueprint/prompts/nigel-runtime.md +47 -0
  89. package/.blueprint/system_specification/.gitkeep +0 -0
  90. package/.blueprint/system_specification/SYSTEM_SPEC.md +248 -0
  91. package/.blueprint/templates/FEATURE_SPEC.md +125 -0
  92. package/.blueprint/templates/STORY_TEMPLATE.md +96 -0
  93. package/.blueprint/templates/SYSTEM_SPEC.md +128 -0
  94. package/.blueprint/templates/TEST_TEMPLATE.md +76 -0
  95. package/.blueprint/ways_of_working/DEVELOPMENT_RITUAL.md +178 -0
  96. package/.business_context/README.md +27 -0
  97. package/LICENSE +21 -0
  98. package/README.md +564 -0
  99. package/SKILL.md +840 -0
  100. package/bin/cli.js +388 -0
  101. package/package.json +36 -0
  102. package/src/business-context.js +91 -0
  103. package/src/classifier.js +173 -0
  104. package/src/feedback.js +201 -0
  105. package/src/handoff.js +148 -0
  106. package/src/history.js +306 -0
  107. package/src/index.js +170 -0
  108. package/src/init.js +139 -0
  109. package/src/insights.js +504 -0
  110. package/src/interactive.js +338 -0
  111. package/src/orchestrator.js +217 -0
  112. package/src/parallel.js +1544 -0
  113. package/src/retry.js +274 -0
  114. package/src/stack.js +320 -0
  115. package/src/tools/index.js +27 -0
  116. package/src/tools/prompts.js +45 -0
  117. package/src/tools/schemas.js +38 -0
  118. package/src/tools/validation.js +83 -0
  119. package/src/update.js +112 -0
  120. package/src/validate.js +172 -0
package/SKILL.md ADDED
@@ -0,0 +1,840 @@
1
+ ---
2
+ name: implement-feature
3
+ description: Run the Alex → Cass → Nigel → Codey pipeline using Task tool sub-agents
4
+ ---
5
+
6
+ # Implement Feature Skill
7
+
8
+ ## Paths
9
+
10
+ | Var | Path |
11
+ |-----|------|
12
+ | `{SYS_SPEC}` | `.blueprint/system_specification/SYSTEM_SPEC.md` |
13
+ | `{FEAT_DIR}` | `.blueprint/features/feature_{slug}` |
14
+ | `{FEAT_SPEC}` | `{FEAT_DIR}/FEATURE_SPEC.md` |
15
+ | `{STORIES}` | `{FEAT_DIR}/story-*.md` |
16
+ | `{TEST_DIR}` | `./test/artifacts/feature_{slug}` |
17
+ | `{TEST_SPEC}` | `{TEST_DIR}/test-spec.md` |
18
+ | `{TEST_FILE}` | `./test/feature_{slug}.test.js` |
19
+ | `{PLAN}` | `{FEAT_DIR}/IMPLEMENTATION_PLAN.md` |
20
+ | `{QUEUE}` | `.claude/implement-queue.json` |
21
+ | `{HISTORY}` | `.claude/pipeline-history.json` |
22
+ | `{RETRY_CONFIG}` | `.claude/retry-config.json` |
23
+ | `{FEEDBACK_CONFIG}` | `.claude/feedback-config.json` |
24
+ | `{HANDOFF_ALEX}` | `{FEAT_DIR}/handoff-alex.md` |
25
+ | `{HANDOFF_CASS}` | `{FEAT_DIR}/handoff-cass.md` |
26
+ | `{HANDOFF_NIGEL}` | `{FEAT_DIR}/handoff-nigel.md` |
27
+
28
+ ## Invocation
29
+
30
+ ```bash
31
+ /implement-feature # Interactive slug prompt
32
+ /implement-feature "user-auth" # New feature
33
+ /implement-feature "user-auth" --interactive # Force interactive spec creation
34
+ /implement-feature "user-auth" --pause-after=alex|cass|nigel|codey-plan
35
+ /implement-feature "user-auth" --no-commit
36
+ /implement-feature "user-auth" --no-feedback # Skip feedback collection
37
+ /implement-feature "user-auth" --no-validate # Skip pre-flight validation
38
+ /implement-feature "user-auth" --no-history # Skip history recording
39
+ ```
40
+
41
+ ## Pipeline Overview
42
+
43
+ ```
44
+ /implement-feature "slug"
45
+
46
+
47
+ ┌─────────────────────────────────────────┐
48
+ │ 0. Pre-flight validation (validate.js) │
49
+ │ 1. Parse args, get slug │
50
+ │ 2. Check system spec exists (gate) │
51
+ │ 3. Show insights preview (insights.js) │
52
+ │ 4. Initialize queue + history entry │
53
+ │ 5. Route based on flags/state │
54
+ └─────────────────────────────────────────┘
55
+
56
+
57
+ ALEX → [feedback] → CASS → [feedback] → NIGEL → [feedback] → CODEY
58
+ │ │
59
+ └──────────── Record timing in history.js ──────────────────┘
60
+ │ │
61
+ └──────────── On failure: retry.js strategy ────────────────┘
62
+
63
+
64
+ AUTO-COMMIT → Record completion in history
65
+ ```
66
+
67
+ ## Output Constraints (CRITICAL)
68
+
69
+ **All agents MUST follow these rules to avoid token limit errors:**
70
+
71
+ 1. **Write files incrementally** - Write each file separately, never combine multiple files in one response
72
+ 2. **Keep summaries brief** - Final completion summaries should be 5-10 bullet points max
73
+ 3. **Reference, don't repeat** - Use file paths instead of quoting content from other artifacts
74
+ 4. **One concern per file** - Don't merge unrelated content into single large files
75
+ 5. **Chunk large files** - If a file would exceed ~200 lines, split into logical parts
76
+
77
+ ---
78
+
79
+ ## Step 0: Pre-flight Validation (NEW)
80
+
81
+ **Module:** `src/validate.js`
82
+
83
+ Unless `--no-validate` flag is set:
84
+
85
+ ```bash
86
+ # Run validation checks
87
+ node bin/cli.js validate
88
+ ```
89
+
90
+ **Checks performed:**
91
+ - Required directories exist (`.blueprint/`, `.business_context/`)
92
+ - System spec exists
93
+ - All 4 agent spec files present
94
+ - Business context has content
95
+ - Skills installed
96
+ - Node.js version >= 18
97
+
98
+ **On validation failure:**
99
+ - Show which checks failed with fix suggestions
100
+ - Ask user: "Fix issues and retry?" or "Continue anyway?" or "Abort"
101
+
102
+ **On validation success:** Continue to Step 1
103
+
104
+ ---
105
+
106
+ ## Steps 1-5: Setup
107
+
108
+ ### Step 1: Parse Arguments
109
+ Extract: `{slug}`, pause gates (`--pause-after`), `--no-commit`
110
+
111
+ ### Step 2: Get Feature Slug
112
+ If not provided: Ask user, convert to slug format (lowercase, hyphens), confirm.
113
+
114
+ ### Step 3: System Spec Gate
115
+ Check `{SYS_SPEC}` exists. If not: run Alex to create it, then **stop for review**.
116
+
117
+ ### Step 3a: Interactive Mode Detection
118
+
119
+ **Module:** `src/interactive.js`
120
+
121
+ The pipeline automatically enters interactive mode when:
122
+ 1. `--interactive` flag is explicitly passed
123
+ 2. System spec (`{SYS_SPEC}`) is missing - creates system spec interactively
124
+ 3. Feature spec (`{FEAT_SPEC}`) is missing - creates feature spec interactively
125
+
126
+ **Interactive Session Flow:**
127
+ ```
128
+ idle → gathering → questioning → drafting → finalizing
129
+ ```
130
+
131
+ **Available Commands During Session:**
132
+ | Command | Action |
133
+ |---------|--------|
134
+ | `/approve` or `yes` | Mark section complete, proceed to next |
135
+ | `/change <feedback>` | Revise current section with feedback |
136
+ | `/skip` | Mark section TBD, proceed to next |
137
+ | `/restart` | Discard draft, restart current section |
138
+ | `/abort` | Exit without writing spec |
139
+ | `/done` | Finalize spec (if min sections complete) |
140
+
141
+ **Minimum Required Sections:**
142
+ - Feature spec: Intent, Scope, Actors
143
+ - System spec: Purpose, Actors, Boundaries
144
+
145
+ **On Interactive Completion:**
146
+ - Writes spec to appropriate path
147
+ - Generates `handoff-alex.md` with session metrics
148
+ - Records `mode: "interactive"` in history entry
149
+
150
+ ### Step 3.5: Insights Preview (NEW)
151
+
152
+ **Module:** `src/insights.js`
153
+
154
+ Unless `--no-history` flag is set, show pipeline insights:
155
+
156
+ ```bash
157
+ node bin/cli.js insights --json 2>/dev/null
158
+ ```
159
+
160
+ **Display to user:**
161
+ - Recent success rate (e.g., "Last 10 runs: 85% success")
162
+ - Estimated duration (e.g., "Estimated: ~12 min based on history")
163
+ - Any warnings (e.g., "Note: Nigel stage has 30% failure rate recently")
164
+
165
+ If no history exists, skip this step silently.
166
+
167
+ ### Step 4: Route
168
+ - Slug exists at `{FEAT_DIR}` → ask: continue from last state or restart
169
+ - No slug → new feature pipeline
170
+
171
+ ### Step 5: Initialize
172
+ Create/read `{QUEUE}`. Ensure dirs exist: `mkdir -p {FEAT_DIR} {TEST_DIR}`
173
+
174
+ **History Integration (NEW):**
175
+
176
+ Unless `--no-history` flag is set, start a history entry:
177
+
178
+ ```javascript
179
+ // Conceptual - orchestrator tracks this in memory
180
+ historyEntry = {
181
+ slug: "{slug}",
182
+ startedAt: new Date().toISOString(),
183
+ stages: {},
184
+ feedback: {}
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Step 6: Spawn Alex Agent
191
+
192
+ **History:** Record `stages.alex.startedAt` before spawning.
193
+
194
+ **Runtime prompt:** `.blueprint/prompts/alex-runtime.md`
195
+
196
+ Use the Task tool with `subagent_type="general-purpose"`:
197
+
198
+ **Prompt:**
199
+ ```
200
+ You are Alex, the System Specification Agent.
201
+
202
+ ## Task
203
+
204
+ Create a feature specification for "{slug}" that translates system intent into a bounded, reviewable unit.
205
+
206
+ ## Inputs (read these files)
207
+ - System Spec: .blueprint/system_specification/SYSTEM_SPEC.md
208
+ - Template: .blueprint/templates/FEATURE_SPEC.md
209
+ - Business Context: .business_context/
210
+
211
+ ## Outputs (write these files)
212
+ 1. Write the feature spec to: {FEAT_DIR}/FEATURE_SPEC.md
213
+ 2. Write handoff summary to: {FEAT_DIR}/handoff-alex.md
214
+
215
+ ## Handoff Summary Format
216
+ ```markdown
217
+ ## Handoff Summary
218
+ **For:** Cass
219
+ **Feature:** {slug}
220
+
221
+ ### Key Decisions
222
+ - (1-5 bullets: key architectural/scope decisions)
223
+
224
+ ### Files Created
225
+ - {FEAT_DIR}/FEATURE_SPEC.md
226
+
227
+ ### Open Questions
228
+ - (List any unresolved questions, or "None")
229
+
230
+ ### Critical Context
231
+ (Brief context Cass needs to write stories effectively)
232
+ ```
233
+
234
+ ## Rules
235
+ - Write feature spec FIRST, then write handoff summary
236
+ - Reference system spec by path, do not repeat its content
237
+ - Keep Change Log to 1-2 entries max
238
+ - Flag ambiguities explicitly rather than guessing
239
+ - Ensure feature aligns with system boundaries
240
+ - Make inferred interpretations explicit
241
+ - Handoff summary must be under 30 lines
242
+
243
+ ## Completion
244
+ Brief summary (5 bullets max): intent, key behaviours, scope, story themes, tensions
245
+
246
+ ## Reference
247
+ For detailed guidance, see: .blueprint/agents/AGENT_SPECIFICATION_ALEX.md
248
+ ```
249
+
250
+ **On completion:**
251
+ 1. Verify `{FEAT_SPEC}` and `{FEAT_DIR}/handoff-alex.md` exist
252
+ 2. **Record history:** `stages.alex = { completedAt, durationMs, status: "success" }`
253
+ 3. Update queue: move feature to `cassQueue`
254
+ 4. If `--pause-after=alex`: Show output path, ask user to continue
255
+
256
+ **On failure:** See [Error Handling with Retry](#error-handling-with-smart-retry)
257
+
258
+ ---
259
+
260
+ ## Step 6.5: Cass Feedback on Alex (NEW)
261
+
262
+ **Module:** `src/feedback.js`
263
+
264
+ Unless `--no-feedback` flag is set, collect feedback before Cass writes stories:
265
+
266
+ **Prompt addition to Cass:**
267
+ ```
268
+ FEEDBACK FIRST: Rate Alex's spec 1-5, list issues (e.g., unclear-scope), recommend proceed|pause|revise.
269
+ Format: FEEDBACK: {"rating":N,"issues":["..."],"rec":"proceed|pause|revise"}
270
+ Then continue with your task.
271
+ ```
272
+
273
+ **Quality Gate Check:**
274
+ - If rating < minRatingThreshold (default 3.0) OR recommendation = "pause"
275
+ - Ask user: "Cass rated Alex's spec {N}/5. Issues: {issues}. Continue anyway?"
276
+ - Options: Continue / Review spec / Abort
277
+
278
+ **Store feedback:** `feedback.cass = { about: "alex", rating, issues, recommendation }`
279
+
280
+ ---
281
+
282
+ ## Step 7: Spawn Cass Agent
283
+
284
+ **History:** Record `stages.cass.startedAt` before spawning.
285
+
286
+ **Runtime prompt:** `.blueprint/prompts/cass-runtime.md`
287
+
288
+ Use the Task tool with `subagent_type="general-purpose"`:
289
+
290
+ **Prompt:**
291
+ ```
292
+ You are Cass, the Story Writer Agent.
293
+
294
+ ## Task
295
+
296
+ Create user stories for feature "{slug}" with explicit, testable acceptance criteria.
297
+
298
+ ## Inputs (read these files)
299
+ - Handoff Summary: {FEAT_DIR}/handoff-alex.md (read FIRST for quick context)
300
+ - Feature Spec: {FEAT_DIR}/FEATURE_SPEC.md (full details if needed)
301
+ - System Spec: .blueprint/system_specification/SYSTEM_SPEC.md
302
+
303
+ ## Outputs (write these files)
304
+ 1. Create one markdown file per user story in {FEAT_DIR}/:
305
+ - story-{story-slug}.md (e.g., story-login.md, story-logout.md)
306
+ 2. Write handoff summary to: {FEAT_DIR}/handoff-cass.md
307
+
308
+ Each story must include:
309
+ - User story in standard format (As a... I want... so that...)
310
+ - Acceptance criteria (Given/When/Then) - max 5-7 per story
311
+ - Out of scope items (brief list)
312
+
313
+ ## Handoff Summary Format
314
+ ```markdown
315
+ ## Handoff Summary
316
+ **For:** Nigel
317
+ **Feature:** {slug}
318
+
319
+ ### Key Decisions
320
+ - (1-5 bullets: story structure decisions, AC approach)
321
+
322
+ ### Files Created
323
+ - {FEAT_DIR}/story-*.md (list each file)
324
+
325
+ ### Open Questions
326
+ - (List any unresolved questions, or "None")
327
+
328
+ ### Critical Context
329
+ (Brief context Nigel needs to write tests effectively)
330
+ ```
331
+
332
+ ## Rules
333
+ - Read Alex's handoff summary FIRST for quick orientation
334
+ - Write ONE story file at a time, then move to next
335
+ - Write handoff summary LAST after all stories complete
336
+ - Keep each story focused - split large stories into multiple files
337
+ - Make routing explicit (Previous, Continue, conditional paths)
338
+ - Reference feature spec by path for shared context
339
+ - Do not guess policy detail without flagging assumptions
340
+ - Avoid implicit behaviour - all routes must be explicit
341
+ - Handoff summary must be under 30 lines
342
+
343
+ ## Completion
344
+ Brief summary: story count, filenames, behaviours covered (5 bullets max)
345
+
346
+ ## Reference
347
+ For detailed guidance, see: .blueprint/agents/AGENT_BA_CASS.md
348
+ ```
349
+
350
+ **On completion:**
351
+ 1. Verify at least one `story-*.md` exists in `{FEAT_DIR}`
352
+ 2. Verify `{FEAT_DIR}/handoff-cass.md` exists
353
+ 2. **Record history:** `stages.cass = { completedAt, durationMs, status: "success" }`
354
+ 3. Update queue: move feature to `nigelQueue`
355
+ 4. If `--pause-after=cass`: Show story paths, ask user to continue
356
+
357
+ **On failure:** See [Error Handling with Retry](#error-handling-with-smart-retry)
358
+
359
+ ---
360
+
361
+ ## Step 7.5: Nigel Feedback on Cass (NEW)
362
+
363
+ **Module:** `src/feedback.js`
364
+
365
+ Unless `--no-feedback` flag is set:
366
+
367
+ **Prompt addition to Nigel:**
368
+ ```
369
+ FEEDBACK FIRST: Rate Cass's stories 1-5, list issues (e.g., ambiguous-ac), recommend proceed|pause|revise.
370
+ Format: FEEDBACK: {"rating":N,"issues":["..."],"rec":"proceed|pause|revise"}
371
+ Then continue with your task.
372
+ ```
373
+
374
+ **Quality Gate Check:** Same as Step 6.5
375
+
376
+ **Store feedback:** `feedback.nigel = { about: "cass", rating, issues, recommendation }`
377
+
378
+ ---
379
+
380
+ ## Step 8: Spawn Nigel Agent
381
+
382
+ **History:** Record `stages.nigel.startedAt` before spawning.
383
+
384
+ **Runtime prompt:** `.blueprint/prompts/nigel-runtime.md`
385
+
386
+ Use the Task tool with `subagent_type="general-purpose"`:
387
+
388
+ **Prompt:**
389
+ ```
390
+ You are Nigel, the Tester Agent.
391
+
392
+ ## Task
393
+
394
+ Create tests for feature "{slug}" that expose ambiguities and provide a stable contract for implementation.
395
+
396
+ ## Inputs (read these files)
397
+ - Handoff Summary: {FEAT_DIR}/handoff-cass.md (read FIRST for quick context)
398
+ - Stories: {FEAT_DIR}/story-*.md (full details)
399
+ - Feature Spec: {FEAT_DIR}/FEATURE_SPEC.md (if additional context needed)
400
+
401
+ ## Outputs (write these files IN ORDER)
402
+
403
+ Step 1: Write {TEST_DIR}/test-spec.md containing:
404
+ - Brief understanding (5-10 lines)
405
+ - AC to Test ID mapping table (compact)
406
+ - Key assumptions (bullet list)
407
+
408
+ Step 2: Write {TEST_FILE} containing:
409
+ - Executable tests (Jest or Node test runner)
410
+ - One describe block per story
411
+ - One test per acceptance criterion
412
+
413
+ Step 3: Write handoff summary to: {FEAT_DIR}/handoff-nigel.md
414
+
415
+ ## Handoff Summary Format
416
+ ```markdown
417
+ ## Handoff Summary
418
+ **For:** Codey
419
+ **Feature:** {slug}
420
+
421
+ ### Key Decisions
422
+ - (1-5 bullets: test approach, mocking strategy, coverage focus)
423
+
424
+ ### Files Created
425
+ - {TEST_DIR}/test-spec.md
426
+ - {TEST_FILE}
427
+
428
+ ### Open Questions
429
+ - (List any unresolved questions, or "None")
430
+
431
+ ### Critical Context
432
+ (Brief context Codey needs to implement effectively)
433
+ ```
434
+
435
+ ## Rules
436
+ - Read Cass's handoff summary FIRST for quick orientation
437
+ - Write test-spec.md FIRST, then write test file, then handoff summary LAST
438
+ - Keep test-spec.md under 100 lines using table format
439
+ - Tests should be self-documenting with minimal comments
440
+ - Reference story files by path in test descriptions
441
+ - Make failure states meaningful
442
+ - Focus on externally observable behaviour
443
+ - Handoff summary must be under 30 lines
444
+
445
+ ## Completion
446
+ Brief summary: test count, AC coverage %, assumptions (5 bullets max)
447
+
448
+ ## Reference
449
+ For detailed guidance, see: .blueprint/agents/AGENT_TESTER_NIGEL.md
450
+ ```
451
+
452
+ **On completion:**
453
+ 1. Verify `{TEST_SPEC}`, `{TEST_FILE}`, and `{FEAT_DIR}/handoff-nigel.md` exist
454
+ 2. **Record history:** `stages.nigel = { completedAt, durationMs, status: "success" }`
455
+ 3. Update queue: move feature to `codeyQueue`
456
+ 4. If `--pause-after=nigel`: Show test paths, ask user to continue
457
+
458
+ **On failure:** See [Error Handling with Retry](#error-handling-with-smart-retry)
459
+
460
+ ---
461
+
462
+ ## Step 8.5: Codey Feedback on Nigel (NEW)
463
+
464
+ **Module:** `src/feedback.js`
465
+
466
+ Unless `--no-feedback` flag is set:
467
+
468
+ **Prompt addition to Codey (Plan phase):**
469
+ ```
470
+ FEEDBACK FIRST: Rate Nigel's tests 1-5, list issues (e.g., over-mocked), recommend proceed|pause|revise.
471
+ Format: FEEDBACK: {"rating":N,"issues":["..."],"rec":"proceed|pause|revise"}
472
+ Then continue with your task.
473
+ ```
474
+
475
+ **Quality Gate Check:** Same as Step 6.5
476
+
477
+ **Store feedback:** `feedback.codey = { about: "nigel", rating, issues, recommendation }`
478
+
479
+ ---
480
+
481
+ ## Step 9: Spawn Codey Agent (Plan)
482
+
483
+ **History:** Record `stages.codeyPlan.startedAt` before spawning.
484
+
485
+ **Runtime prompt:** `.blueprint/prompts/codey-plan-runtime.md`
486
+
487
+ Use the Task tool with `subagent_type="general-purpose"`:
488
+
489
+ **Prompt:**
490
+ ```
491
+ You are Codey, the Developer Agent.
492
+
493
+ ## Task
494
+
495
+ Create an implementation plan for feature "{slug}". Do NOT implement yet - planning only.
496
+
497
+ ## Inputs (read these files)
498
+ - Handoff Summary: {FEAT_DIR}/handoff-nigel.md (read FIRST for quick context)
499
+ - Test Spec: {TEST_DIR}/test-spec.md
500
+ - Tests: {TEST_FILE}
501
+ - Feature Spec: {FEAT_DIR}/FEATURE_SPEC.md (if additional context needed)
502
+ - Stories: {FEAT_DIR}/story-*.md (if additional context needed)
503
+
504
+ ## Outputs (write this file)
505
+ Write implementation plan to: {FEAT_DIR}/IMPLEMENTATION_PLAN.md
506
+
507
+ Plan structure (aim for under 80 lines total):
508
+ - Summary (2-3 sentences)
509
+ - Files to Create/Modify (table: path | action | purpose)
510
+ - Implementation Steps (numbered, max 10 steps)
511
+ - Risks/Questions (bullet list, only if non-obvious)
512
+
513
+ ## Rules
514
+ - Read Nigel's handoff summary FIRST for quick orientation
515
+ - Do NOT write implementation code in this phase
516
+ - Keep plan concise and actionable
517
+ - Order steps to make tests pass incrementally
518
+ - Identify which tests each step addresses
519
+ - Prefer editing existing files over creating new ones
520
+
521
+ ## Completion
522
+ Brief summary: files planned, step count, identified risks
523
+
524
+ ## Reference
525
+ For detailed guidance, see: .blueprint/agents/AGENT_DEVELOPER_CODEY.md
526
+ ```
527
+
528
+ **On completion:**
529
+ 1. Verify `{PLAN}` exists
530
+ 2. **Record history:** `stages.codeyPlan = { completedAt, durationMs, status: "success" }`
531
+ 3. If `--pause-after=codey-plan`: Show plan path, ask user to continue
532
+
533
+ **On failure:** See [Error Handling with Retry](#error-handling-with-smart-retry)
534
+
535
+ ---
536
+
537
+ ## Step 10: Spawn Codey Agent (Implement)
538
+
539
+ **History:** Record `stages.codeyImplement.startedAt` before spawning.
540
+
541
+ **Runtime prompt:** `.blueprint/prompts/codey-implement-runtime.md`
542
+
543
+ Use the Task tool with `subagent_type="general-purpose"`:
544
+
545
+ **Prompt:**
546
+ ```
547
+ You are Codey, the Developer Agent.
548
+
549
+ ## Task
550
+
551
+ Implement feature "{slug}" according to the plan. Work incrementally, making tests pass one group at a time.
552
+
553
+ ## Inputs (read these files)
554
+ - Handoff Summary: {FEAT_DIR}/handoff-nigel.md (read FIRST for quick context)
555
+ - Implementation Plan: {FEAT_DIR}/IMPLEMENTATION_PLAN.md
556
+ - Tests: {TEST_FILE}
557
+
558
+ ## Process (INCREMENTAL - one file at a time)
559
+ 1. Read Nigel's handoff summary for orientation
560
+ 2. Run tests first: node --test {TEST_FILE}
561
+ 3. For each failing test group:
562
+ a. Identify the minimal code needed
563
+ b. Write or edit ONE file
564
+ c. Run tests again
565
+ d. Repeat until group passes
566
+ 3. Move to next test group
567
+
568
+ ## Rules
569
+ - Write ONE source file at a time
570
+ - Run tests after each file write
571
+ - Keep functions small (under 30 lines)
572
+ - Code should be self-documenting, minimal comments
573
+ - Do NOT commit changes
574
+ - Do NOT modify test assertions unless they contain bugs
575
+
576
+ ## Completion
577
+ Brief summary: files changed (list), test status (X/Y passing), blockers if any
578
+
579
+ ## Reference
580
+ For detailed guidance, see: .blueprint/agents/AGENT_DEVELOPER_CODEY.md
581
+ ```
582
+
583
+ **On completion:**
584
+ 1. Run `npm test` to verify
585
+ 2. **Record history:** `stages.codeyImplement = { completedAt, durationMs, status: "success" }`
586
+ 3. Update queue: move feature to `completed`
587
+ 4. Proceed to auto-commit (unless `--no-commit`)
588
+
589
+ **On failure:** See [Error Handling with Retry](#error-handling-with-smart-retry)
590
+
591
+ ---
592
+
593
+ ## Step 11: Auto-commit
594
+
595
+ If not `--no-commit`:
596
+
597
+ ```bash
598
+ git add {FEAT_DIR}/ {TEST_DIR}/ {TEST_FILE}
599
+ # Add any implementation files created by Codey
600
+ git status --short
601
+ ```
602
+
603
+ Commit message:
604
+ ```
605
+ feat({slug}): Add {slug} feature
606
+
607
+ Artifacts:
608
+ - Feature spec by Alex
609
+ - User stories by Cass
610
+ - Tests by Nigel
611
+ - Implementation by Codey
612
+
613
+ Co-Authored-By: Claude <noreply@anthropic.com>
614
+ ```
615
+
616
+ ---
617
+
618
+ ## Step 12: Report Status & Finalize History (ENHANCED)
619
+
620
+ **Module:** `src/history.js`
621
+
622
+ Unless `--no-history` flag is set, finalize the history entry:
623
+
624
+ ```javascript
625
+ historyEntry.status = "success";
626
+ historyEntry.completedAt = new Date().toISOString();
627
+ historyEntry.totalDurationMs = completedAt - startedAt;
628
+ historyEntry.commitHash = "{hash}";
629
+ // Save to .claude/pipeline-history.json
630
+ ```
631
+
632
+ **Display summary:**
633
+ ```
634
+ ## Completed
635
+ - feature_{slug}
636
+ - Stories: N
637
+ - Tests: N (all passing)
638
+ - Duration: X min (avg: Y min)
639
+ - Commit: {hash}
640
+
641
+ ## Feedback Summary
642
+ - Alex spec: rated 4/5 by Cass
643
+ - Cass stories: rated 5/5 by Nigel
644
+ - Nigel tests: rated 4/5 by Codey
645
+
646
+ ## Next Action
647
+ Pipeline complete. Run `npm test` to verify or `/implement-feature` for next feature.
648
+ ```
649
+
650
+ ---
651
+
652
+ ## Error Handling with Smart Retry (ENHANCED)
653
+
654
+ **Modules:** `src/retry.js`, `src/feedback.js`, `src/insights.js`
655
+
656
+ After each agent spawn, if the Task tool returns an error or output validation fails:
657
+
658
+ ### 1. Analyze Failure Context
659
+
660
+ **Check feedback chain for clues:**
661
+ ```
662
+ If Cass flagged "unclear-scope" on Alex's spec
663
+ → Likely root cause identified
664
+ → Recommend: "add-context" strategy
665
+ ```
666
+
667
+ **Check history for patterns:**
668
+ ```bash
669
+ node bin/cli.js insights --failures --json
670
+ ```
671
+ - If this stage has >20% failure rate, suggest alternative strategy
672
+ - If this specific issue pattern correlates with failures, mention it
673
+
674
+ ### 2. Get Retry Strategy Recommendation
675
+
676
+ **Module:** `src/retry.js`
677
+
678
+ ```
679
+ Strategy recommendation based on:
680
+ - Stage: {stage}
681
+ - Attempt: {attemptNumber}
682
+ - Failure rate: {rate}%
683
+ - Feedback issues: {issues}
684
+
685
+ Recommended: {strategy}
686
+ ```
687
+
688
+ **Available strategies:**
689
+ | Strategy | Effect |
690
+ |----------|--------|
691
+ | `retry` | Simple retry with same prompt |
692
+ | `simplify-prompt` | Reduce scope: "Focus only on core happy path" |
693
+ | `add-context` | Include more output from previous stages |
694
+ | `reduce-stories` | Ask for fewer, more focused stories |
695
+ | `simplify-tests` | Ask for fewer, essential tests only |
696
+ | `incremental` | Implement one test at a time |
697
+
698
+ ### 3. Ask User with Recommendation
699
+
700
+ ```
701
+ ## Stage Failed: {stage}
702
+
703
+ Feedback context: Cass flagged "unclear-scope" on Alex's spec
704
+ History: This stage fails 25% of the time
705
+ Recommended strategy: add-context
706
+
707
+ Options:
708
+ 1. Retry with "add-context" strategy (recommended)
709
+ 2. Retry with simple retry
710
+ 3. Skip this stage (warning: missing artifacts)
711
+ 4. Abort pipeline
712
+ ```
713
+
714
+ ### 4. Apply Strategy and Retry
715
+
716
+ If user selects a retry strategy, modify the agent prompt:
717
+
718
+ **Example: add-context strategy**
719
+ ```
720
+ [Original prompt]
721
+
722
+ ## Additional Context (added due to retry)
723
+ Previous stage feedback indicated: "unclear-scope"
724
+ Here is additional context from earlier stages:
725
+ - System spec key points: [summary]
726
+ - Feature spec key decisions: [summary]
727
+ ```
728
+
729
+ ### 5. Record Failure in History
730
+
731
+ ```javascript
732
+ historyEntry.stages[stage] = {
733
+ status: "failed",
734
+ failedAt: "...",
735
+ attempts: N,
736
+ lastStrategy: "add-context",
737
+ feedbackContext: ["unclear-scope"]
738
+ };
739
+ ```
740
+
741
+ **On abort:** Update queue `failed` array with:
742
+ ```json
743
+ {
744
+ "slug": "{slug}",
745
+ "stage": "{stage}",
746
+ "reason": "{error message}",
747
+ "feedbackContext": ["issues from feedback chain"],
748
+ "attemptCount": N,
749
+ "timestamp": "{ISO timestamp}"
750
+ }
751
+ ```
752
+
753
+ ---
754
+
755
+ ## Queue Structure
756
+
757
+ Location: `.claude/implement-queue.json`
758
+
759
+ ```json
760
+ {
761
+ "lastUpdated": "2025-02-01T12:00:00Z",
762
+ "current": {
763
+ "slug": "user-auth",
764
+ "stage": "cass",
765
+ "startedAt": "2025-02-01T11:55:00Z"
766
+ },
767
+ "alexQueue": [],
768
+ "cassQueue": [{ "slug": "user-auth", "featureSpec": "..." }],
769
+ "nigelQueue": [],
770
+ "codeyQueue": [],
771
+ "completed": [{ "slug": "...", "testCount": 5, "commitHash": "abc123" }],
772
+ "failed": []
773
+ }
774
+ ```
775
+
776
+ ---
777
+
778
+ ## Recovery
779
+
780
+ Run `/implement-feature` again - reads queue and resumes from `current.stage`.
781
+
782
+ ---
783
+
784
+ ## Agent References
785
+
786
+ | Agent | File |
787
+ |-------|------|
788
+ | Alex | `.blueprint/agents/AGENT_SPECIFICATION_ALEX.md` |
789
+ | Cass | `.blueprint/agents/AGENT_BA_CASS.md` |
790
+ | Nigel | `.blueprint/agents/AGENT_TESTER_NIGEL.md` |
791
+ | Codey | `.blueprint/agents/AGENT_DEVELOPER_CODEY.md` |
792
+
793
+ ---
794
+
795
+ ## Module Integration Summary (NEW)
796
+
797
+ The pipeline integrates these murmur8 modules:
798
+
799
+ | Module | File | Integration Points |
800
+ |--------|------|-------------------|
801
+ | **validate** | `src/validate.js` | Step 0: Pre-flight checks |
802
+ | **history** | `src/history.js` | Steps 5-12: Record timing, finalize entry |
803
+ | **insights** | `src/insights.js` | Step 3.5: Preview, On failure: Analysis |
804
+ | **feedback** | `src/feedback.js` | Steps 6.5, 7.5, 8.5: Quality gates |
805
+ | **retry** | `src/retry.js` | On failure: Strategy recommendation |
806
+
807
+ ### CLI Commands Available
808
+
809
+ ```bash
810
+ # Pre-flight validation
811
+ npx murmur8 validate
812
+
813
+ # History management
814
+ npx murmur8 history
815
+ npx murmur8 history --stats
816
+ npx murmur8 history --all
817
+
818
+ # Pipeline insights
819
+ npx murmur8 insights
820
+ npx murmur8 insights --feedback
821
+ npx murmur8 insights --bottlenecks
822
+ npx murmur8 insights --failures
823
+
824
+ # Retry configuration
825
+ npx murmur8 retry-config
826
+ npx murmur8 retry-config set maxRetries 5
827
+
828
+ # Feedback configuration
829
+ npx murmur8 feedback-config
830
+ npx murmur8 feedback-config set minRatingThreshold 3.5
831
+ ```
832
+
833
+ ### Data Files Created
834
+
835
+ | File | Purpose |
836
+ |------|---------|
837
+ | `.claude/pipeline-history.json` | Execution history with timing and feedback |
838
+ | `.claude/retry-config.json` | Retry strategies and thresholds |
839
+ | `.claude/feedback-config.json` | Feedback quality gate thresholds |
840
+ | `.claude/implement-queue.json` | Pipeline queue state (existing) |