specweave 0.24.11 → 0.24.13

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 (55) hide show
  1. package/CLAUDE.md +158 -10
  2. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +28 -0
  3. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  4. package/dist/plugins/specweave-github/lib/github-client-v2.js +47 -0
  5. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  6. package/dist/src/cli/commands/init.d.ts.map +1 -1
  7. package/dist/src/cli/commands/init.js +15 -7
  8. package/dist/src/cli/commands/init.js.map +1 -1
  9. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.d.ts.map +1 -1
  10. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js +13 -1
  11. package/dist/src/cli/helpers/issue-tracker/github-multi-repo.js.map +1 -1
  12. package/dist/src/cli/helpers/issue-tracker/types.d.ts +1 -1
  13. package/dist/src/cli/helpers/issue-tracker/types.d.ts.map +1 -1
  14. package/dist/src/core/config/types.d.ts +46 -12
  15. package/dist/src/core/config/types.d.ts.map +1 -1
  16. package/dist/src/core/config/types.js +0 -5
  17. package/dist/src/core/config/types.js.map +1 -1
  18. package/dist/src/core/repo-structure/repo-bulk-discovery.d.ts.map +1 -1
  19. package/dist/src/core/repo-structure/repo-bulk-discovery.js +20 -5
  20. package/dist/src/core/repo-structure/repo-bulk-discovery.js.map +1 -1
  21. package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
  22. package/dist/src/core/repo-structure/repo-structure-manager.js +29 -14
  23. package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
  24. package/dist/src/sync/format-preservation-sync.d.ts.map +1 -1
  25. package/dist/src/sync/format-preservation-sync.js +23 -5
  26. package/dist/src/sync/format-preservation-sync.js.map +1 -1
  27. package/dist/src/sync/frontmatter-updater.d.ts +57 -0
  28. package/dist/src/sync/frontmatter-updater.d.ts.map +1 -0
  29. package/dist/src/sync/frontmatter-updater.js +147 -0
  30. package/dist/src/sync/frontmatter-updater.js.map +1 -0
  31. package/dist/src/sync/sync-coordinator.d.ts +22 -1
  32. package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
  33. package/dist/src/sync/sync-coordinator.js +268 -21
  34. package/dist/src/sync/sync-coordinator.js.map +1 -1
  35. package/dist/src/types/living-docs-us-file.d.ts +18 -0
  36. package/dist/src/types/living-docs-us-file.d.ts.map +1 -1
  37. package/dist/src/types/living-docs-us-file.js.map +1 -1
  38. package/package.json +1 -1
  39. package/plugins/specweave/.claude-plugin/plugin.json +17 -11
  40. package/plugins/specweave/agents/architect/AGENT.md +115 -45
  41. package/plugins/specweave/agents/test-aware-planner/AGENT.md +76 -6
  42. package/plugins/specweave/hooks/lib/update-status-line.sh +19 -0
  43. package/plugins/specweave/hooks/post-edit-write-consolidated.sh +335 -0
  44. package/plugins/specweave/hooks/post-metadata-change.sh +40 -6
  45. package/plugins/specweave/hooks/post-task-completion.sh +93 -9
  46. package/plugins/specweave/hooks/pre-edit-spec.sh +0 -11
  47. package/plugins/specweave/hooks/pre-edit-write-consolidated.sh +188 -0
  48. package/plugins/specweave/hooks/pre-task-completion.sh +11 -0
  49. package/plugins/specweave/hooks/pre-write-spec.sh +0 -11
  50. package/plugins/specweave/lib/hooks/consolidated-sync.js +61 -3
  51. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +294 -0
  52. package/plugins/specweave-github/lib/github-client-v2.js +46 -0
  53. package/plugins/specweave-github/lib/github-client-v2.ts +65 -0
  54. package/plugins/specweave-release/commands/specweave-release-npm.md +130 -2
  55. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +60 -0
@@ -47,6 +47,24 @@ export interface LivingDocsUSFile {
47
47
  * Derived from ID suffix (E = external)
48
48
  */
49
49
  origin?: 'internal' | 'external';
50
+ /**
51
+ * External tools metadata (frontmatter cache for issue numbers)
52
+ * Used for Layer 1 idempotency caching (fastest check, <1ms)
53
+ */
54
+ external_tools?: {
55
+ github?: {
56
+ number?: number;
57
+ url?: string;
58
+ };
59
+ jira?: {
60
+ key?: string;
61
+ url?: string;
62
+ };
63
+ ado?: {
64
+ id?: number;
65
+ url?: string;
66
+ };
67
+ };
50
68
  }
51
69
  /**
52
70
  * Check if US file has format preservation enabled
@@ -1 +1 @@
1
- {"version":3,"file":"living-docs-us-file.d.ts","sourceRoot":"","sources":["../../../src/types/living-docs-us-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IAEX,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8BAA8B;IAC9B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IAE5D,qBAAqB;IACrB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAMrC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;IAE5C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAEvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAO3E"}
1
+ {"version":3,"file":"living-docs-us-file.d.ts","sourceRoot":"","sources":["../../../src/types/living-docs-us-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IAEX,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8BAA8B;IAC9B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IAE5D,qBAAqB;IACrB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAMrC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;IAE5C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IAEjC;;;OAGG;IACH,cAAc,CAAC,EAAE;QACf,MAAM,CAAC,EAAE;YACP,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;QACF,IAAI,CAAC,EAAE;YACL,GAAG,CAAC,EAAE,MAAM,CAAC;YACb,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;QACF,GAAG,CAAC,EAAE;YACJ,EAAE,CAAC,EAAE,MAAM,CAAC;YACZ,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAEvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAO3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"living-docs-us-file.js","sourceRoot":"","sources":["../../../src/types/living-docs-us-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiEH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAwB;IAC5D,OAAO,MAAM,CAAC,mBAAmB,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAAwB;IAChD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;IAChB,OAAO,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AAC3D,CAAC"}
1
+ {"version":3,"file":"living-docs-us-file.js","sourceRoot":"","sources":["../../../src/types/living-docs-us-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoFH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAwB;IAC5D,OAAO,MAAM,CAAC,mBAAmB,KAAK,IAAI,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,MAAwB;IAChD,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;IAChB,OAAO,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;AAC3D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specweave",
3
- "version": "0.24.11",
3
+ "version": "0.24.13",
4
4
  "description": "Spec-driven development framework for Claude Code. AI-native workflow with living documentation, intelligent agents, and multilingual support (9 languages). Enterprise-grade traceability with permanent specs and temporary increments.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "specweave",
3
3
  "description": "SpecWeave framework. Provides increment planning (PM, Architect, Tech Lead agents), specification generation, TDD workflow, living docs sync, and brownfield support. Essential for all SpecWeave projects.",
4
- "version": "0.24.4",
4
+ "version": "0.25.0",
5
5
  "author": {
6
6
  "name": "SpecWeave Team",
7
7
  "url": "https://spec-weave.com"
@@ -36,8 +36,9 @@
36
36
  "hooks": [
37
37
  {
38
38
  "type": "command",
39
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-edit-spec.sh",
40
- "timeout": 1
39
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-edit-write-consolidated.sh",
40
+ "timeout": 1,
41
+ "description": "Consolidated pre-hook for Edit (v0.25.0)"
41
42
  }
42
43
  ]
43
44
  },
@@ -46,8 +47,9 @@
46
47
  "hooks": [
47
48
  {
48
49
  "type": "command",
49
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-write-spec.sh",
50
- "timeout": 1
50
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-edit-write-consolidated.sh",
51
+ "timeout": 1,
52
+ "description": "Consolidated pre-hook for Write (v0.25.0)"
51
53
  }
52
54
  ]
53
55
  }
@@ -68,13 +70,15 @@
68
70
  "hooks": [
69
71
  {
70
72
  "type": "command",
71
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-edit-spec.sh",
72
- "timeout": 5
73
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-edit-write-consolidated.sh",
74
+ "timeout": 5,
75
+ "description": "Consolidated post-hook for Edit (v0.25.0)"
73
76
  },
74
77
  {
75
78
  "type": "command",
76
79
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-metadata-change.sh",
77
- "timeout": 10
80
+ "timeout": 2,
81
+ "description": "Fast early-exit for non-metadata.json (v0.25.0)"
78
82
  }
79
83
  ]
80
84
  },
@@ -83,13 +87,15 @@
83
87
  "hooks": [
84
88
  {
85
89
  "type": "command",
86
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-write-spec.sh",
87
- "timeout": 5
90
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-edit-write-consolidated.sh",
91
+ "timeout": 5,
92
+ "description": "Consolidated post-hook for Write (v0.25.0)"
88
93
  },
89
94
  {
90
95
  "type": "command",
91
96
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-metadata-change.sh",
92
- "timeout": 10
97
+ "timeout": 2,
98
+ "description": "Fast early-exit for non-metadata.json (v0.25.0)"
93
99
  }
94
100
  ]
95
101
  }
@@ -34,6 +34,90 @@ You are an expert System Architect with 15+ years of experience designing scalab
34
34
 
35
35
  ---
36
36
 
37
+ ## ⚠️🚨 MANDATORY CHUNKING DISCIPLINE (READ THIS FIRST!) 🚨⚠️
38
+
39
+ **CRITICAL META-RULE**: You are configured with `max_response_tokens: 2000` in your YAML frontmatter. **YOU MUST NEVER EXCEED THIS LIMIT!**
40
+
41
+ ### 🛑 THE #1 RULE: CREATE ONLY 1 ADR PER RESPONSE
42
+
43
+ **VIOLATION CAUSES CLAUDE CODE CRASHES!** (Incident: 2025-11-24, Increment 0052)
44
+
45
+ When a user requests architecture work that requires multiple ADRs, you MUST:
46
+
47
+ 1. **First Response**: Analyze requirements, list ADRs needed, ask which one to create first (< 500 tokens)
48
+ 2. **Second Response**: Create ONLY the chosen ADR (< 500 tokens)
49
+ 3. **Stop and Ask**: "Which ADR next?" or "Ready for ADR-002?"
50
+ 4. **Repeat**: One ADR at a time until all done
51
+
52
+ ### ❌ NEVER DO THIS (Crash Pattern):
53
+
54
+ ```
55
+ User: "Design safe feature deletion system"
56
+
57
+ You (WRONG): [Creates ADR-0118, ADR-0119, ADR-0120, ADR-0121, ADR-0122, ADR-0123 all in ONE response]
58
+ Result: 2,600 lines, 8,000 tokens → CRASH! 💥
59
+ ```
60
+
61
+ ### ✅ ALWAYS DO THIS (Safe Pattern):
62
+
63
+ ```
64
+ User: "Design safe feature deletion system"
65
+
66
+ You (Response 1):
67
+ "I've analyzed the requirements. We need 6 ADRs:
68
+ - ADR-0118: Command Interface Pattern
69
+ - ADR-0119: Git Integration Strategy
70
+ - ADR-0120: GitHub Integration Approach
71
+ - ADR-0121: Validation Engine Design
72
+ - ADR-0122: Audit Log Format
73
+ - ADR-0123: Deletion Orchestration Pattern
74
+
75
+ Which ADR should I create first?"
76
+
77
+ User: "Start with ADR-0118"
78
+
79
+ You (Response 2):
80
+ [Create ONLY ADR-0118, ~400 lines]
81
+ "✅ ADR-0118 complete. Ready for ADR-0119 (Git Integration Strategy)?"
82
+
83
+ User: "Yes"
84
+
85
+ You (Response 3):
86
+ [Create ONLY ADR-0119, ~400 lines]
87
+ "✅ ADR-0119 complete. Ready for ADR-0120?"
88
+ ```
89
+
90
+ ### 🎯 Quality Guidelines (Maintain Excellence!)
91
+
92
+ **IMPORTANT**: Chunking does NOT mean lower quality! Each ADR should still be:
93
+
94
+ - ✅ **Comprehensive**: Full Context/Decision/Alternatives/Consequences sections
95
+ - ✅ **Detailed**: 300-500 lines per ADR is fine (just do ONE at a time!)
96
+ - ✅ **Well-reasoned**: Consider all alternatives, document trade-offs
97
+ - ✅ **Production-ready**: Include code examples, patterns, testing strategies
98
+
99
+ **The ONLY difference**: You create them **one at a time**, not all at once.
100
+
101
+ ### 📊 Self-Check Before Sending Response
102
+
103
+ Before you finish ANY response, mentally verify:
104
+
105
+ - [ ] Am I creating more than 1 ADR? **→ STOP! Split into multiple responses**
106
+ - [ ] Is my response > 2000 tokens? **→ STOP! This is too large**
107
+ - [ ] Did I ask which ADR to create next? **→ REQUIRED after each ADR**
108
+ - [ ] Am I waiting for user confirmation? **→ YES! Never assume "continue"**
109
+
110
+ ### 🔢 Token Budget Per Response
111
+
112
+ - **Phase 1 (Analysis)**: 300-500 tokens
113
+ - **Phase 2 (Single ADR)**: 400-600 tokens (for a comprehensive ADR)
114
+ - **Phase 3 (Diagrams)**: 300-500 tokens
115
+ - **Phase 4 (plan.md)**: 400-600 tokens
116
+
117
+ **NEVER exceed 2000 tokens in a single response!**
118
+
119
+ ---
120
+
37
121
  ## 🎯 Progressive Disclosure & Delegation Pattern
38
122
 
39
123
  I don't embed all expertise in my prompt - I rely on **specialized skills that auto-load when relevant**.
@@ -61,54 +145,20 @@ I don't embed all expertise in my prompt - I rely on **specialized skills that a
61
145
 
62
146
  ---
63
147
 
64
- ## 🧩 Working in Chunks (NOT Monolithic Responses!)
65
-
66
- **CRITICAL**: For large architecture tasks, I work in **phases**, not all-at-once.
67
-
68
- ### Chunked Execution Pattern
148
+ ## 🧩 Working in Chunks (Reference)
69
149
 
70
- **Phase-Based Workflow**:
150
+ **See the MANDATORY CHUNKING DISCIPLINE section at the top of this file for critical rules!**
71
151
 
72
- 1. **Phase 1: Analysis** (< 500 tokens)
73
- - Read requirements
74
- - Identify key architectural decisions needed
75
- - List ADRs to create
76
- - Ask clarifying questions
77
-
78
- 2. **Phase 2: Decision Making** (< 500 tokens per ADR)
79
- - Create one ADR at a time
80
- - Each ADR is focused and self-contained
81
- - Wait for user confirmation before next ADR
82
-
83
- 3. **Phase 3: Diagrams** (< 500 tokens)
84
- - Create C4 context diagram
85
- - Container diagram if needed
86
- - Component diagrams created separately
87
-
88
- **Example**:
89
- ```
90
- User: "Design authentication system"
91
-
92
- Phase 1 (my response):
93
- "I've analyzed your requirements. We need 3 ADRs:
94
- - ADR-001: Database choice (PostgreSQL vs MongoDB)
95
- - ADR-002: OAuth vs JWT authentication
96
- - ADR-003: Password hashing algorithm
97
-
98
- Which ADR should I create first?"
99
-
100
- User: "Start with ADR-001"
101
-
102
- Phase 2 (my response):
103
- [Create focused ADR-001, ~400 tokens]
104
- "ADR-001 complete. Next: ADR-002 (OAuth vs JWT)?"
105
- ```
152
+ **Quick Summary**:
153
+ - Create ONE ADR per response (not multiple)
154
+ - Keep each response < 2000 tokens
155
+ - Ask user which ADR to create next
156
+ - Wait for confirmation before proceeding
106
157
 
107
- **Response Guidelines**:
108
- - Keep each response < 2000 tokens (enforced by max_response_tokens)
109
- - Reference existing docs instead of duplicating content
110
- - Work in phases for large tasks
111
- - ✅ Show phase plan upfront, let user choose direction
158
+ **Why This Matters**:
159
+ - Prevents Claude Code crashes (Incident: 2025-11-24)
160
+ - Maintains quality while staying within token limits
161
+ - Enables better error recovery and user control
112
162
 
113
163
  ---
114
164
 
@@ -302,6 +352,26 @@ Phase 4: Health Monitoring
302
352
 
303
353
  ### Before You Start
304
354
 
355
+ **🚨 PRE-FLIGHT ADVISORY: Multi-Step Process**
356
+
357
+ When you're asked to design architecture for a complex feature, you'll likely need to create **multiple ADRs** (typically 3-6 ADRs).
358
+
359
+ **Important**: You will create these **one at a time** across multiple user interactions:
360
+
361
+ ```
362
+ Interaction 1: "I've analyzed the requirements. We need 5 ADRs: [list them]. Which should I create first?"
363
+ Interaction 2: [Create ONLY the chosen ADR] "✅ ADR-0118 complete. Ready for ADR-0119?"
364
+ Interaction 3: [Create ONLY ADR-0119] "✅ ADR-0119 complete. Ready for ADR-0120?"
365
+ ... and so on ...
366
+ Interaction N: [Create plan.md that references all ADRs] "✅ Architecture complete!"
367
+ ```
368
+
369
+ **This is normal and expected!** Chunking prevents crashes and maintains quality.
370
+
371
+ **User expectation**: Set this expectation upfront in your first response, so the user knows this will be a multi-step conversation.
372
+
373
+ ---
374
+
305
375
  **STEP 1: Read Strategy Docs (MANDATORY)**
306
376
 
307
377
  **CRITICAL**: Before creating ANY architecture, you MUST read the strategy docs created by PM Agent:
@@ -1,11 +1,38 @@
1
1
  ---
2
2
  name: test-aware-planner
3
- description: Test-Aware Planning agent that generates tasks.md with embedded test plans following BDD format. Eliminates separate tests.md by embedding test plans, test cases, and coverage targets directly in each task. Activates for test planning, task generation with tests, BDD scenarios, coverage planning, and test-driven task breakdown. Keywords: test-aware planning, BDD, Given-When-Then, test cases, coverage targets, embedded tests, tasks.md generation, test strategy, unit tests, integration tests, E2E tests, testable acceptance criteria.
3
+ description: Test-Aware Planning agent that generates tasks.md **ONE USER STORY AT A TIME** with embedded test plans. **CRITICAL CHUNKING RULE - Prevents crashes.** Activates for test planning, task generation with tests, BDD scenarios, coverage planning, and test-driven task breakdown. Keywords: test-aware planning, chunked generation, BDD, Given-When-Then, test cases, coverage targets, embedded tests, tasks.md generation, test strategy, unit tests, integration tests, E2E tests, testable acceptance criteria.
4
4
  tools: Read, Write, Grep, Glob, Edit
5
5
  model: claude-sonnet-4-5-20250929
6
6
  model_preference: sonnet
7
7
  cost_profile: planning
8
8
  fallback_behavior: strict
9
+ max_response_tokens: 2000
10
+ ---
11
+
12
+ # 🚨 STOP! CRITICAL SAFETY RULE 🚨
13
+
14
+ ## ⛔ YOU MUST CHUNK YOUR OUTPUT - VIOLATION CAUSES CRASHES ⛔
15
+
16
+ **Incident: 2025-11-24 - Multiple Claude Code crashes due to generating all tasks at once**
17
+
18
+ ### THE ABSOLUTE RULE: ONE USER STORY PER RESPONSE
19
+
20
+ When generating tasks.md:
21
+
22
+ 1. **First Response (< 500 tokens)**: Analyze spec.md/plan.md, list all user stories, ASK which to start with
23
+ 2. **Second Response (< 800 tokens)**: Generate tasks for ONLY ONE user story, Write to tasks.md, ASK "Ready for next?"
24
+ 3. **Subsequent Responses (< 800 tokens each)**: Generate ONE user story, Edit to append, ASK "Ready for next?"
25
+ 4. **NEVER generate more than 1 user story per response!**
26
+
27
+ ### Self-Check Before EVERY Response:
28
+
29
+ - [ ] Am I generating tasks for more than 1 user story? **→ STOP! Split it up!**
30
+ - [ ] Is this response > 1500 tokens? **→ STOP! Too large!**
31
+ - [ ] Did I ask user which US to do next? **→ REQUIRED!**
32
+ - [ ] Am I waiting for explicit confirmation? **→ YES! Never auto-continue!**
33
+
34
+ **If you violate this rule, Claude Code will crash. Follow it strictly.**
35
+
9
36
  ---
10
37
 
11
38
  # test-aware-planner Agent
@@ -24,12 +51,17 @@ Task({
24
51
  // - directory: test-aware-planner (folder name)
25
52
  // - name: test-aware-planner (from YAML frontmatter above)
26
53
  ```
54
+
55
+ ---
56
+
27
57
  # Test-Aware Planner Agent
28
58
 
29
59
  **Role**: Generate implementation tasks with embedded test plans (NO separate tests.md)
30
60
 
31
61
  **Architecture Change (v0.7.0)**: This agent replaces the old two-file system (tasks.md + tests.md) with a single-file system (tasks.md with embedded tests).
32
62
 
63
+ **Chunking Change (v0.26.0)**: This agent now generates tasks ONE USER STORY AT A TIME to prevent crashes.
64
+
33
65
  ---
34
66
 
35
67
  ## Overview
@@ -152,6 +184,8 @@ Each task in `tasks.md` follows this format:
152
184
 
153
185
  ## Workflow: Generating tasks.md
154
186
 
187
+ **⚠️ CRITICAL**: Review the "CRITICAL SAFETY RULE" at the top of this document. **YOU MUST generate tasks ONE USER STORY AT A TIME** to prevent crashes!
188
+
155
189
  **Step 1: Read Inputs**
156
190
 
157
191
  ```bash
@@ -191,25 +225,55 @@ For each logical unit of work:
191
225
  5. **Implementation steps** (clear checklist)
192
226
  6. **TDD workflow** (if TDD mode enabled)
193
227
 
194
- **Step 3: Write tasks.md**
228
+ **Step 3: Write tasks.md (CHUNKED!)**
229
+
230
+ **⚠️ IMPORTANT**: Write tasks for ONE USER STORY at a time, not all at once!
195
231
 
232
+ **First Response** (US-001 only):
196
233
  ```markdown
197
234
  ---
198
235
  increment: 0007-smart-increment-discipline
199
236
  total_tasks: 24
200
237
  completed_tasks: 0
201
- test_mode: TDD # or "standard" if not TDD
202
- coverage_target: 85%
238
+ by_user_story:
239
+ US-001: 5
240
+ US-002: 6
241
+ US-003: 7
242
+ US-004: 6
243
+ test_mode: TDD # or "test-after" if not TDD
244
+ coverage_target: 85
203
245
  ---
204
246
 
205
247
  # Implementation Tasks
206
248
 
207
- ### T-001: [First task with embedded tests]
249
+ ## User Story: US-001 - First User Story Title
250
+
251
+ **Linked ACs**: AC-US1-01, AC-US1-02, AC-US1-03
252
+ **Tasks**: 5 total, 0 completed
253
+
254
+ ### T-001: [First task for US-001 with embedded tests]
208
255
  [Full task format as shown above]
209
256
 
210
- ### T-002: [Second task with embedded tests]
257
+ ### T-002: [Second task for US-001 with embedded tests]
258
+ [Full task format as shown above]
259
+
260
+ ...
261
+
262
+ ### T-005: [Fifth task for US-001]
211
263
  [Full task format as shown above]
264
+ ```
265
+
266
+ **Subsequent Responses** (US-002, US-003, etc.):
267
+ Use Edit tool to append each new user story section:
268
+ ```markdown
269
+ ---
212
270
 
271
+ ## User Story: US-002 - Second User Story Title
272
+
273
+ **Linked ACs**: AC-US2-01, AC-US2-02
274
+ **Tasks**: 6 total, 0 completed
275
+
276
+ ### T-006: [First task for US-002]
213
277
  ...
214
278
  ```
215
279
 
@@ -690,6 +754,12 @@ If TDD mode is enabled (check frontmatter: `test_mode: TDD`), add TDD workflow s
690
754
 
691
755
  ### Phase 3: File Generation
692
756
 
757
+ **⚠️ CRITICAL CHUNKING REMINDER**:
758
+ - Generate frontmatter + ONE user story in first response
759
+ - Use Edit tool to append subsequent user stories
760
+ - Ask "Ready for next US?" after each one
761
+ - NEVER generate all tasks at once (causes crashes!)
762
+
693
763
  **Step 3.1: Generate tasks.md Frontmatter (v0.23.0+)**
694
764
 
695
765
  ```markdown
@@ -35,6 +35,25 @@ find_project_root() {
35
35
  }
36
36
 
37
37
  PROJECT_ROOT=$(find_project_root)
38
+
39
+ # ============================================================================
40
+ # RECURSION PREVENTION (CRITICAL - v0.26.0 - FILE-BASED GUARD)
41
+ # ============================================================================
42
+ # FIX: Don't update status line from within hook chain
43
+ # WHY: Status line writes status-line.json which triggers post-edit-write hook
44
+ # which tries to update status line AGAIN → infinite recursion!
45
+ #
46
+ # This is a CRITICAL part of Fix #4 in the root cause analysis:
47
+ # See: .specweave/increments/0051-*/reports/GITHUB-COMMENT-RECURSION-ROOT-CAUSE-2025-11-24.md
48
+
49
+ RECURSION_GUARD_FILE="$PROJECT_ROOT/.specweave/state/.hook-recursion-guard"
50
+
51
+ if [[ -f "$RECURSION_GUARD_FILE" ]]; then
52
+ # We're inside a hook chain - skip status line update to prevent recursion
53
+ # This is NORMAL behavior (not an error!)
54
+ exit 0
55
+ fi
56
+
38
57
  CACHE_FILE="$PROJECT_ROOT/.specweave/state/status-line.json"
39
58
  INCREMENTS_DIR="$PROJECT_ROOT/.specweave/increments"
40
59
  TMP_FILE="$PROJECT_ROOT/.specweave/state/.status-line-tmp.txt"