specweave 0.17.16 → 0.18.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 (161) hide show
  1. package/CLAUDE.md +405 -2495
  2. package/README.md +92 -2
  3. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  4. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +188 -36
  5. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  6. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +54 -0
  7. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -0
  8. package/dist/plugins/specweave-ado/lib/ado-status-sync.js +86 -0
  9. package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -0
  10. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +139 -0
  11. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/duplicate-detector.js +389 -0
  13. package/dist/plugins/specweave-github/lib/duplicate-detector.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +26 -0
  15. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +249 -0
  17. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/github-client.d.ts +1 -1
  19. package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -1
  20. package/dist/plugins/specweave-github/lib/github-client.js +25 -13
  21. package/dist/plugins/specweave-github/lib/github-client.js.map +1 -1
  22. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +83 -0
  23. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -0
  24. package/dist/plugins/specweave-github/lib/github-epic-sync.js +451 -0
  25. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -0
  26. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +43 -0
  27. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -0
  28. package/dist/plugins/specweave-github/lib/github-status-sync.js +82 -0
  29. package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -0
  30. package/dist/plugins/specweave-github/lib/task-sync.d.ts +5 -0
  31. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  32. package/dist/plugins/specweave-github/lib/task-sync.js +38 -2
  33. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  34. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts +66 -0
  35. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts.map +1 -0
  36. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js +274 -0
  37. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js.map +1 -0
  38. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +56 -0
  39. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -0
  40. package/dist/plugins/specweave-jira/lib/jira-status-sync.js +93 -0
  41. package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -0
  42. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  43. package/dist/src/cli/helpers/issue-tracker/index.js +48 -3
  44. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  45. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +142 -0
  46. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -0
  47. package/dist/src/core/living-docs/hierarchy-mapper.js +453 -0
  48. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -0
  49. package/dist/src/core/living-docs/index.d.ts +10 -84
  50. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  51. package/dist/src/core/living-docs/index.js +10 -164
  52. package/dist/src/core/living-docs/index.js.map +1 -1
  53. package/dist/src/core/living-docs/spec-distributor.d.ts +106 -0
  54. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -0
  55. package/dist/src/core/living-docs/spec-distributor.js +823 -0
  56. package/dist/src/core/living-docs/spec-distributor.js.map +1 -0
  57. package/dist/src/core/living-docs/types.d.ts +201 -0
  58. package/dist/src/core/living-docs/types.d.ts.map +1 -0
  59. package/dist/src/core/living-docs/types.js +15 -0
  60. package/dist/src/core/living-docs/types.js.map +1 -0
  61. package/dist/src/core/logging/prompt-logger.d.ts +70 -0
  62. package/dist/src/core/logging/prompt-logger.d.ts.map +1 -0
  63. package/dist/src/core/logging/prompt-logger.js +247 -0
  64. package/dist/src/core/logging/prompt-logger.js.map +1 -0
  65. package/dist/src/core/status-line/status-line-manager.d.ts +15 -24
  66. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  67. package/dist/src/core/status-line/status-line-manager.js +33 -70
  68. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  69. package/dist/src/core/status-line/types.d.ts +19 -31
  70. package/dist/src/core/status-line/types.d.ts.map +1 -1
  71. package/dist/src/core/status-line/types.js +5 -9
  72. package/dist/src/core/status-line/types.js.map +1 -1
  73. package/dist/src/core/sync/conflict-resolver.d.ts +66 -0
  74. package/dist/src/core/sync/conflict-resolver.d.ts.map +1 -0
  75. package/dist/src/core/sync/conflict-resolver.js +108 -0
  76. package/dist/src/core/sync/conflict-resolver.js.map +1 -0
  77. package/dist/src/core/sync/enhanced-content-builder.d.ts +77 -0
  78. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -0
  79. package/dist/src/core/sync/enhanced-content-builder.js +199 -0
  80. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -0
  81. package/dist/src/core/sync/label-detector.d.ts +66 -0
  82. package/dist/src/core/sync/label-detector.d.ts.map +1 -0
  83. package/dist/src/core/sync/label-detector.js +211 -0
  84. package/dist/src/core/sync/label-detector.js.map +1 -0
  85. package/dist/src/core/sync/retry-logic.d.ts +64 -0
  86. package/dist/src/core/sync/retry-logic.d.ts.map +1 -0
  87. package/dist/src/core/sync/retry-logic.js +165 -0
  88. package/dist/src/core/sync/retry-logic.js.map +1 -0
  89. package/dist/src/core/sync/spec-increment-mapper.d.ts +100 -0
  90. package/dist/src/core/sync/spec-increment-mapper.d.ts.map +1 -0
  91. package/dist/src/core/sync/spec-increment-mapper.js +424 -0
  92. package/dist/src/core/sync/spec-increment-mapper.js.map +1 -0
  93. package/dist/src/core/sync/status-cache.d.ts +91 -0
  94. package/dist/src/core/sync/status-cache.d.ts.map +1 -0
  95. package/dist/src/core/sync/status-cache.js +140 -0
  96. package/dist/src/core/sync/status-cache.js.map +1 -0
  97. package/dist/src/core/sync/status-mapper.d.ts +69 -0
  98. package/dist/src/core/sync/status-mapper.d.ts.map +1 -0
  99. package/dist/src/core/sync/status-mapper.js +90 -0
  100. package/dist/src/core/sync/status-mapper.js.map +1 -0
  101. package/dist/src/core/sync/status-sync-engine.d.ts +162 -0
  102. package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -0
  103. package/dist/src/core/sync/status-sync-engine.js +347 -0
  104. package/dist/src/core/sync/status-sync-engine.js.map +1 -0
  105. package/dist/src/core/sync/sync-event-logger.d.ts +99 -0
  106. package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -0
  107. package/dist/src/core/sync/sync-event-logger.js +103 -0
  108. package/dist/src/core/sync/sync-event-logger.js.map +1 -0
  109. package/dist/src/core/sync/workflow-detector.d.ts +95 -0
  110. package/dist/src/core/sync/workflow-detector.d.ts.map +1 -0
  111. package/dist/src/core/sync/workflow-detector.js +175 -0
  112. package/dist/src/core/sync/workflow-detector.js.map +1 -0
  113. package/dist/src/core/types/config.d.ts.map +1 -1
  114. package/dist/src/core/types/config.js +31 -0
  115. package/dist/src/core/types/config.js.map +1 -1
  116. package/dist/src/utils/github-url.d.ts +53 -0
  117. package/dist/src/utils/github-url.d.ts.map +1 -0
  118. package/dist/src/utils/github-url.js +90 -0
  119. package/dist/src/utils/github-url.js.map +1 -0
  120. package/dist/src/utils/spec-parser.d.ts +145 -0
  121. package/dist/src/utils/spec-parser.d.ts.map +1 -0
  122. package/dist/src/utils/spec-parser.js +640 -0
  123. package/dist/src/utils/spec-parser.js.map +1 -0
  124. package/package.json +1 -1
  125. package/plugins/specweave/agents/pm/AGENT.md +1 -1
  126. package/plugins/specweave/agents/pm/templates/increment-spec.md +158 -0
  127. package/plugins/specweave/agents/pm/templates/living-docs-spec.md +113 -0
  128. package/plugins/specweave/commands/specweave-done.md +163 -0
  129. package/plugins/specweave/hooks/lib/update-status-line.sh +79 -111
  130. package/plugins/specweave/hooks/post-increment-planning.sh +107 -35
  131. package/plugins/specweave/lib/hooks/sync-living-docs.js +139 -34
  132. package/plugins/specweave/lib/hooks/sync-living-docs.ts +234 -38
  133. package/plugins/specweave/skills/SKILLS-INDEX.md +4 -24
  134. package/plugins/specweave/skills/increment-planner/SKILL.md +94 -0
  135. package/plugins/specweave/skills/increment-work-router/SKILL.md +466 -0
  136. package/plugins/specweave-ado/lib/ado-status-sync.js +80 -0
  137. package/plugins/specweave-ado/lib/ado-status-sync.ts +121 -0
  138. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +205 -0
  139. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +248 -0
  140. package/plugins/specweave-github/lib/duplicate-detector.js +370 -0
  141. package/plugins/specweave-github/lib/duplicate-detector.ts +525 -0
  142. package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
  143. package/plugins/specweave-github/lib/enhanced-github-sync.ts +322 -0
  144. package/plugins/specweave-github/lib/github-client.js +21 -10
  145. package/plugins/specweave-github/lib/github-client.ts +27 -16
  146. package/plugins/specweave-github/lib/github-epic-sync.js +489 -0
  147. package/plugins/specweave-github/lib/github-epic-sync.ts +690 -0
  148. package/plugins/specweave-github/lib/github-status-sync.js +71 -0
  149. package/plugins/specweave-github/lib/github-status-sync.ts +107 -0
  150. package/plugins/specweave-github/lib/task-sync.js +33 -2
  151. package/plugins/specweave-github/lib/task-sync.ts +44 -2
  152. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +267 -0
  153. package/plugins/specweave-jira/lib/enhanced-jira-sync.ts.disabled +222 -0
  154. package/plugins/specweave-jira/lib/jira-epic-sync.js +304 -0
  155. package/plugins/specweave-jira/lib/jira-epic-sync.ts +459 -0
  156. package/plugins/specweave-jira/lib/jira-status-sync.js +79 -0
  157. package/plugins/specweave-jira/lib/jira-status-sync.ts +139 -0
  158. package/src/templates/AGENTS.md.template +88 -1
  159. package/src/templates/CLAUDE.md.template +49 -0
  160. package/plugins/specweave/skills/increment-quality-judge/SKILL.md +0 -524
  161. package/plugins/specweave/skills/plugin-installer/SKILL.md +0 -353
package/CLAUDE.md CHANGED
@@ -48,14 +48,7 @@ Users receive a different CLAUDE.md via the template system.
48
48
  └── 0006-deep-analysis.md # ✅ Architecture decisions
49
49
  ```
50
50
 
51
- ### Why This Matters
52
-
53
- - ✅ **Complete traceability** - Know which increment created which files
54
- - ✅ **Easy cleanup** - Delete increment folder = delete all files
55
- - ✅ **Clear context** - All files for a feature in one place
56
- - ✅ **No root clutter** - Project root stays clean and professional
57
- - ✅ **Better git history** - Changes grouped by increment
58
- - ✅ **Status line works correctly** - Parses tasks.md without confusion from extra .md files
51
+ **Why**: Traceability, easy cleanup, clear context. See [File Organization Guide](https://spec-weave.com/docs/learn/file-organization).
59
52
 
60
53
  ### ⚠️ CRITICAL: reports/ Folder is MANDATORY!
61
54
 
@@ -86,13 +79,7 @@ Users receive a different CLAUDE.md via the template system.
86
79
  └── SESSION-SUMMARY.md # ❌ NO! Should be in reports/
87
80
  ```
88
81
 
89
- **Why reports/ folder matters for status line**:
90
- - Status line parses `tasks.md` to count progress
91
- - Extra `.md` files in root can confuse the parser
92
- - Files MUST be in `reports/` subfolder for clean parsing
93
- - **Without proper structure → Status line shows nothing!**
94
-
95
- **Rule**: Only 3 core files allowed in increment root: `spec.md`, `plan.md`, `tasks.md`. Everything else → subfolders!
82
+ **Rule**: Only 3 core files in increment root: `spec.md`, `plan.md`, `tasks.md`. Everything else → subfolders (reports/, scripts/, logs/). Required for status line parsing.
96
83
 
97
84
  ### What IS Allowed in Root?
98
85
 
@@ -116,38 +103,9 @@ These should NEVER be committed:
116
103
 
117
104
  ---
118
105
 
119
- ## Why Claude Code is Best-in-Class
120
-
121
- **CRITICAL**: SpecWeave is designed for Claude Code FIRST. Other tools are supported but with reduced capabilities.
122
-
123
- ### Anthropic Sets the Standards
124
-
125
- Claude Code isn't just another AI coding assistant - **Anthropic defines the industry standards**:
126
-
127
- 1. **MCP (Model Context Protocol)** - Industry standard for context management
128
- 2. **Skills** - Proven pattern for auto-activating capabilities
129
- 3. **Agents** - Proven pattern for role-based, isolated workflows
130
- 4. **Hooks** - Proven pattern for lifecycle automation
131
-
132
- ### Why SpecWeave + Claude Code = 10x Better
133
-
134
- | Feature | Claude Code (Native) | Cursor 2.0 | Other (Copilot, ChatGPT, etc.) |
135
- |---------|---------------------|------------|-------------------------------|
136
- | **Living Docs** | ✅ Auto-sync via hooks | ❌ Manual | ❌ Manual |
137
- | **Skills** | ✅ Auto-activate | 🟡 Must @mention | ❌ None |
138
- | **Commands** | ✅ Plugin-based `/specweave:*` | 🟡 Team commands | ❌ None |
139
- | **Hooks** | ✅ Pre/Post lifecycle | ❌ No hooks | ❌ No hooks |
140
- | **Agents** | ✅ Isolated contexts | 🟡 Shared (8 parallel) | ❌ None |
141
- | **Context** | ✅ MCP + 60-80% reduction | 🟡 @ shortcuts | ❌ High usage |
142
- | **Quality** | ⭐⭐⭐⭐⭐ 100% Reliable | ⭐⭐⭐ 60% Less reliable | ⭐⭐ 40% Manual workflow |
106
+ ## Tool Support
143
107
 
144
- **Quick Comparison**:
145
-
146
- **Claude Code** - Full automation with native hooks, MCP protocol, plugin system, isolated agent contexts. **ONLY fully reliable option.**
147
- **Cursor 2.0** - Partial support (AGENTS.md compilation, team commands, @ shortcuts) but no hooks, no agent isolation, less reliable than Claude
148
- **Other (Copilot, ChatGPT, Gemini)** - Manual workflow, high context usage, AGENTS.md support but no automation, least reliable
149
-
150
- **The Key Differentiator**: Only Claude Code supports **automated living docs** via native hooks. After EVERY task completion, docs sync automatically - zero manual intervention. This is why SpecWeave is designed Claude Code-first, though it gracefully degrades to other tools.
108
+ Claude Code-first (native hooks, plugins, MCP). See [Why Claude Code?](https://spec-weave.com/docs/overview/why-claude-code).
151
109
 
152
110
  ---
153
111
 
@@ -158,523 +116,186 @@ Claude Code isn't just another AI coding assistant - **Anthropic defines the ind
158
116
  **Format**: `####-descriptive-kebab-case-name`
159
117
 
160
118
  **Examples**:
161
- - ✅ `0001-core-framework`
162
- - ✅ `0002-core-enhancements`
163
- - `0003-intelligent-model-selection`
164
- - ❌ `0003` (too generic, rejected)
165
- - ❌ `0004` (no description, rejected)
166
-
167
- **Rationale**:
168
- - **Clear intent at a glance** - "0003-intelligent-model-selection" tells you exactly what it does
169
- - **Easy to reference** - "the model selection increment" vs "increment 3"
170
- - **Better git history** - Commit messages naturally include feature name
171
- - **Searchable by feature** - `git log --grep="model-selection"` works
172
- - **Self-documenting** - Increment folders are readable without opening files
173
-
174
- **When Creating Increments**:
175
- ```bash
176
- # ❌ Wrong
177
- /specweave:increment "0004"
119
+ - ✅ `0001-core-framework` ← Clear what it does
120
+ - ✅ `0003-intelligent-model-selection` ← Searchable
121
+ - `0003` ← Too generic (rejected!)
178
122
 
179
- # Correct
180
- /specweave:increment "0004-cost-optimization"
181
- /specweave:increment "0005-github-sync-enhancements"
182
- ```
123
+ **Why**: Clear intent, better git history, searchable, self-documenting.
183
124
 
184
- **Enforcement**:
185
- - `/specweave:increment` command validates naming (rejects bare numbers)
186
- - Code review requirement (descriptive names mandatory)
187
- - This document serves as the source of truth
188
-
189
- **Quick Reference**:
190
- - `####` = Zero-padded 4-digit number (0001, 0002, 0003, ...)
191
- - `-descriptive-name` = Kebab-case description (lowercase, hyphens)
192
- - Max 50 chars total (for readability)
193
- - No special characters except hyphens
125
+ **For complete naming rules**: See `increment-planner` skill (auto-loads when using `/specweave:increment`)
194
126
 
195
127
  ---
196
128
 
197
129
  ## Increment Discipline
198
130
 
199
- ### Core Philosophy: **ONE Active Increment = Maximum Focus**
131
+ **⛔ THE IRON RULE**: You CANNOT start increment N+1 until increment N is DONE.
200
132
 
201
- Simplified from complex per-type limits to **focus-first architecture**:
133
+ **Core Philosophy**:
202
134
  - ✅ **Default**: 1 active increment (maximum productivity)
203
135
  - ✅ **Emergency ceiling**: 2 active max (hotfix/bug can interrupt)
204
136
  - ✅ **Hard cap**: Never >2 active (enforced)
205
137
 
206
- **Why 1?** Research shows:
207
- - 1 task = 100% productivity
208
- - 2 tasks = 20% slower (context switching cost)
209
- - 3+ tasks = 40% slower + more bugs
210
-
211
- ### What is an Increment?
138
+ **Why**: Focus = Quality. Research shows 1 task = 100% productivity, 2 tasks = 20% slower, 3+ = 40% slower + more bugs.
212
139
 
213
- **An increment can be any type of work**, not just features. SpecWeave supports six increment types:
140
+ **For complete discipline rules**: See [Increment Lifecycle Guide](.specweave/docs/internal/delivery/guides/increment-lifecycle.md#increment-discipline-the-iron-rule)
214
141
 
215
- | Type | Description | Use When | Can Interrupt? | Examples |
216
- |------|-------------|----------|----------------|----------|
217
- | **feature** | Standard feature development | Adding new functionality | No | User authentication, payment integration, real-time chat |
218
- | **hotfix** | Critical production fixes | Production is broken | ✅ Yes (emergency) | Security patch, critical bug causing downtime |
219
- | **bug** | Production bugs with SRE investigation | Bug requires root cause analysis | ✅ Yes (emergency) | Memory leak investigation, performance degradation |
220
- | **change-request** | Stakeholder requests | Business requirements change | No | UI redesign per stakeholder feedback, API contract changes |
221
- | **refactor** | Code improvement | Technical debt, code quality | No | Extract service layer, migrate to TypeScript, improve test coverage |
222
- | **experiment** | POC/spike work | Exploring options, prototypes | No* | Evaluate GraphQL vs REST, test new library, architecture spike |
142
+ This guide auto-loads when using increment commands (progressive disclosure pattern).
223
143
 
224
- **Notes**:
225
- - **Experiments auto-abandon** after 14 days of inactivity (prevents accumulation of stale POCs)
226
- - **Types are for tracking**, not separate limits (git log shows hotfixes vs features)
227
- - **Single simple rule**: 1 active, allow 2 for emergencies only
228
-
229
- **Key Insight**: The increment structure (spec.md, plan.md, tasks.md) works for ALL types. A bug investigation still needs:
230
- - **spec.md**: What's broken? Why? What's the expected behavior?
231
- - **plan.md**: How to investigate? What tools? What hypothesis?
232
- - **tasks.md**: Investigation steps, fix implementation, verification tests
233
-
234
- ### WIP Limits
235
-
236
- **Configuration** (`.specweave/config.json`):
237
- ```json
238
- {
239
- "limits": {
240
- "maxActiveIncrements": 1, // Default: 1 active (focus)
241
- "hardCap": 2, // Emergency ceiling (never exceeded)
242
- "allowEmergencyInterrupt": true, // hotfix/bug can interrupt
243
- "typeBehaviors": {
244
- "canInterrupt": ["hotfix", "bug"], // Emergency types
245
- "autoAbandonDays": {
246
- "experiment": 14 // Auto-abandon stale experiments
247
- }
248
- }
249
- }
250
- }
251
- ```
252
-
253
- **Enforcement**:
254
- - **0 active** → Create new (no warnings)
255
- - **1 active** → Warn about context switching (allow with confirmation)
256
- - **2 active** → HARD BLOCK (must complete or pause one first)
257
-
258
- **Exception**: Hotfix/bug can interrupt to start 2nd active (emergency only)
259
-
260
- **Multiple hotfixes?** Combine into ONE increment:
261
- ```bash
262
- # ❌ Wrong: Multiple hotfix increments
263
- 0009-sql-injection-fix
264
- 0010-xss-vulnerability-fix
265
- 0011-csrf-token-fix
266
-
267
- # ✅ Right: Combined hotfix increment
268
- 0009-security-fixes (SQL + XSS + CSRF)
269
- ```
270
-
271
- **⛔ THE IRON RULE: You CANNOT start increment N+1 until increment N is DONE**
272
-
273
- This is **NOT negotiable**. It is a **hard enforcement** to prevent chaos, scope creep, and stale documentation.
274
-
275
- ### Why This Rule Exists
276
-
277
- **The Problem**:
278
- - Multiple incomplete increments piling up (0002, 0003, 0006 all in progress)
279
- - No clear source of truth ("which increment are we working on?")
280
- - Living docs become stale (sync doesn't know what's current)
281
- - Scope creep (jumping between features without finishing)
282
- - Quality degradation (tests not run, docs not updated)
283
-
284
- **The Solution**:
285
- - ✅ **Hard block** on `/specweave:increment` if previous increments incomplete
286
- - ✅ **Helper commands** to close increments properly
287
- - ✅ **Clear guidance** on how to resolve incomplete work
288
- - ✅ **Force discipline** = force quality
289
-
290
- ### What "DONE" Means
291
-
292
- An increment is DONE if **ONE** of the following is true:
293
-
294
- 1. **All tasks completed**: All tasks in `tasks.md` marked `[x] Completed`
295
- 2. **Completion report exists**: `COMPLETION-SUMMARY.md` with "✅ COMPLETE" status
296
- 3. **Explicit closure**: Closed via `/specweave:close` with documentation
297
-
298
- ### The Enforcement
299
-
300
- **When you try to start a new increment**:
301
-
302
- ```bash
303
- /specweave:increment "new feature"
304
- ```
305
-
306
- **If previous increments are incomplete, you'll see**:
307
-
308
- ```
309
- ❌ Cannot create new increment!
310
-
311
- Previous increments are incomplete:
312
-
313
- 📋 Increment 0002-core-enhancements
314
- Status: 73% complete (11/15 tasks)
315
- Pending:
316
- - T-008: Migrate DIAGRAM-CONVENTIONS.md content
317
- - T-010: Create context-manifest.yaml
318
- - T-012: Test agent invocation manually
319
- - T-013: Run skill test suite
320
- - T-015: Create PR when increment complete
144
+ **Quick Reference**:
145
+ - Complete work: `/specweave:do`
146
+ - Close increments: `/specweave:close` (3 options: adjust scope, move scope, extend)
147
+ - Check status: `/specweave:status`
148
+ - Emergency bypass: `--force` (use sparingly!)
321
149
 
322
- 📋 Increment 0003-intelligent-model-selection
323
- Status: 50% complete (11/22 tasks)
324
- Pending: 11 tasks
150
+ **What "DONE" means**: All P1 tasks completed OR completion report exists OR explicit closure via `/specweave:done`.
325
151
 
326
- 💡 What would you like to do?
152
+ ---
327
153
 
328
- 1️⃣ Close incomplete increments:
329
- /specweave:close
154
+ ## Test-Aware Planning
330
155
 
331
- 2️⃣ Check status:
332
- /specweave:status
156
+ Tests embedded in tasks.md (no separate tests.md).
333
157
 
334
- 3️⃣ Force create (DANGEROUS - violates discipline!):
335
- Add --force flag to bypass this check
158
+ **Architecture**:
159
+ - **spec.md**: User stories with AC-IDs (AC-US1-01, AC-US1-02)
160
+ - **plan.md**: Technical design + test strategy
161
+ - **tasks.md**: Tasks with embedded test plans (BDD format)
336
162
 
337
- ⚠️ The discipline exists for a reason:
338
- - Prevents scope creep
339
- - Ensures completions are tracked
340
- - Maintains living docs accuracy
341
- - Keeps work focused
342
- ```
163
+ **Example Task with Tests**:
164
+ ```markdown
165
+ ## T-001: Implement Authentication Service
343
166
 
344
- ### How to Resolve Incomplete Increments
167
+ **AC**: AC-US1-01, AC-US1-02, AC-US1-03
345
168
 
346
- #### Option 1: Complete the Work (Recommended)
169
+ **Test Plan** (BDD):
170
+ - **Given** valid credentials → **When** login → **Then** receive JWT token
347
171
 
348
- ```bash
349
- # Continue working on incomplete increment
350
- /specweave:do
172
+ **Test Cases**:
173
+ - Unit (`auth.test.ts`): validLogin, invalidPassword → 90% coverage
174
+ - Integration (`auth-flow.test.ts`): loginEndpoint → 85% coverage
351
175
 
352
- # Once all tasks done, it's automatically complete
353
- /specweave:increment "new feature" # ✅ Now works!
176
+ **Implementation**: AuthService.ts, bcrypt, JWT, Redis rate limiting
354
177
  ```
355
178
 
356
- #### Option 2: Close Interactively
179
+ **Key Benefits**:
180
+ - ✅ Single source of truth (no sync issues)
181
+ - ✅ AC-ID traceability (spec → tasks → tests)
182
+ - ✅ BDD format (Given/When/Then - clear intent)
183
+ - ✅ TDD support (set `test_mode: TDD` in frontmatter)
184
+ - ✅ Realistic coverage (80-90%, not 100%)
357
185
 
358
- ```bash
359
- # Interactive closure with options
360
- /specweave:close
361
-
362
- # You'll be asked to choose:
363
- # - Force complete (mark all tasks done)
364
- # - Move tasks to next increment (defer work)
365
- # - Reduce scope (mark tasks as won't-do)
366
- # - Create completion report (manual close)
367
- ```
186
+ **For complete workflow**: The `increment-planner` skill contains comprehensive test-aware planning guide (auto-loads when using `/specweave:increment`)
368
187
 
369
- #### Option 3: Check Status First
188
+ **Validation**: `/specweave:check-tests` shows AC-ID coverage and missing tests
370
189
 
371
- ```bash
372
- # See all incomplete increments
373
- /specweave:status
374
-
375
- # Output shows:
376
- # ✅ 0001-core-framework
377
- # ✅ 0004-plugin-architecture
378
- # ⏳ 0002-core-enhancements (73% complete)
379
- # ⏳ 0003-intelligent-model-selection (50% complete)
380
- ```
190
+ ---
381
191
 
382
- #### Option 4: Force Create (Emergency Only!)
192
+ ## Bidirectional Task User Story Linking
383
193
 
384
- ```bash
385
- # Bypass the check (USE SPARINGLY!)
386
- /specweave:increment "urgent-hotfix" --force
194
+ **CRITICAL FEATURE**: SpecWeave automatically creates bidirectional links between tasks and user stories during living docs sync.
387
195
 
388
- # This is logged and should be explained in the next standup/PR
389
- ```
390
-
391
- ### The Three Options for Closing
196
+ ### How It Works
392
197
 
393
- When using `/specweave:close`, you get **THREE options**:
198
+ **AC-ID Based Mapping**: Uses acceptance criteria IDs from tasks to map back to user stories.
394
199
 
395
- #### 1. **Adjust Scope** (Simplest - Recommended)
200
+ **Example Task** (WITH bidirectional link):
201
+ ```markdown
202
+ ### T-001: Implement Authentication Service
396
203
 
397
- Remove parts from `spec.md`, regenerate `plan.md` and `tasks.md` to match reduced scope:
204
+ **User Story**: [US-001: User Authentication](../../docs/internal/specs/default/auth-service/us-001-user-authentication.md)
398
205
 
399
- ```bash
400
- # 1. Edit spec.md - remove features you're not doing
401
- # 2. Delete plan.md and tasks.md
402
- # 3. Regenerate from spec
403
- /specweave:increment "same increment" --regenerate
206
+ **AC**: AC-US1-01, AC-US1-02, AC-US1-03
404
207
 
405
- # Now tasks match reduced scope → 100% complete!
208
+ **Test Plan** (BDD):
209
+ - **Given** valid credentials → **When** login → **Then** receive JWT token
406
210
  ```
407
211
 
408
- #### 2. **Move Scope to Next Increment**
409
-
410
- Transfer incomplete tasks to the new increment:
212
+ ### Traceability Flow
411
213
 
412
- ```bash
413
- # Via /specweave:close
414
- # Select "Move tasks to next increment"
415
- # Tasks are migrated with documentation
416
- # Old increment closed, new increment gets the work
214
+ **Complete Bidirectional Navigation**:
417
215
  ```
418
-
419
- #### 3. **Extend Existing Increment** (Merge Work)
420
-
421
- Simplest option: **Don't start a new increment**. Just extend the current one:
422
-
423
- ```bash
424
- # Instead of creating 0003, extend 0002:
425
- # 1. Update spec.md to include new features
426
- # 2. Update plan.md with new implementation details
427
- # 3. Add new tasks to tasks.md
428
- # 4. Minimize tests if needed (focus on critical paths)
429
-
430
- # Work on combined scope in ONE increment
431
- /specweave:do
216
+ User Story (US-001) ←――――――――――┐
217
+ ↓ |
218
+ ↓ Links to Tasks (forward) | Link to User Story (reverse)
219
+ ↓ |
220
+ Tasks (T-001, T-002, T-003) ――┘
432
221
  ```
433
222
 
434
- ### Helper Commands
435
-
436
- | Command | Purpose |
437
- |---------|---------|
438
- | `/specweave:status` | Show all increments and their completion status |
439
- | `/specweave:close` | Interactive closure of incomplete increments |
440
- | `/specweave:force-close <id>` | Mark all tasks complete (dangerous!) |
223
+ **Forward Links** (US → Tasks):
224
+ - User story files contain **Implementation** section
225
+ - Lists all tasks that implement the user story
226
+ - Example: `[T-001: Implement Auth](../../../../../increments/0031/tasks.md#t-001-implement-auth)`
441
227
 
442
- ### Enforcement Points
228
+ **Reverse Links** (Tasks → US) - **AUTOMATIC**:
229
+ - Added during living docs sync (`/specweave:done` or manual distribution)
230
+ - Uses AC-IDs from **AC**: field to map task → user story
231
+ - Mapping: `AC-US1-01` → `US-001` → User story file
232
+ - Injected as `**User Story**: [US-XXX: Title](path)` after task heading
443
233
 
444
- 1. **`/specweave:increment` command** - Hard block (Step 0A)
445
- 2. **PM agent** - Pre-flight validation before planning
446
- 3. **CI/CD** (future) - Prevent PR merges with incomplete increments
234
+ ### Multi-Project Support
447
235
 
448
- ### Philosophy: Discipline = Quality
449
-
450
- **Why enforce this strictly?**
451
-
452
- - **Focus**: Work on ONE thing at a time
453
- - **Completion**: Finish before starting new
454
- - **Quality**: Tests run, docs updated, code reviewed
455
- - **Clarity**: Everyone knows what's current
456
- - **Velocity**: Actually shipping > endless WIP
457
-
458
- **Old Way (suggest)**:
459
- ```
460
- User: "Just let me start the new feature, I'll come back to this"
461
- Result: 5 incomplete increments, nothing ships
462
- ```
463
-
464
- **New Way (enforce)**:
465
- ```
466
- Framework: "Close this first, then start new"
467
- User: *closes increment properly*
468
- Result: Clean increments, clear progress, shipping regularly
469
- ```
470
-
471
- ### Real-World Example
472
-
473
- **Scenario**: You have 0002 at 73% complete, want to start 0006.
236
+ **Project Detection** (automatic):
237
+ ```typescript
238
+ // Detects from config or path
239
+ projectId = "default" | "backend" | "frontend" | "mobile" | ...
474
240
 
475
- **Old approach** (broken):
476
- ```bash
477
- /specweave:increment "0006-i18n"
478
- # ✅ Creates 0006 (no check)
479
- # Result: 0002, 0003, 0006 all incomplete
241
+ // Paths adapt automatically
242
+ ../../docs/internal/specs/${projectId}/${featureFolder}/us-001-*.md
480
243
  ```
481
244
 
482
- **Current approach** (disciplined):
483
- ```bash
484
- /specweave:increment "0006-i18n"
485
- # Blocked! "Close 0002 and 0003 first"
486
-
487
- # Check status
488
- /specweave:status
489
- # Shows: 0002 (73%), 0003 (50%) incomplete
245
+ **Example Paths**:
246
+ - **Default**: `../../docs/internal/specs/default/auth-service/us-001-*.md`
247
+ - **Backend**: `../../docs/internal/specs/backend/auth-service/us-001-*.md`
248
+ - **Frontend**: `../../docs/internal/specs/frontend/dashboard/us-001-*.md`
490
249
 
491
- # Close them
492
- /specweave:close
493
- # Select 0002 → Force complete (work was done, just not marked)
494
- # Select 0003 → Move tasks to 0007 (defer work)
250
+ ### When Links Are Created
495
251
 
496
- # Now can proceed
497
- /specweave:increment "0006-i18n"
498
- # Works! Clean slate, disciplined workflow
499
- ```
500
-
501
- ### Exception: The `--force` Flag
502
-
503
- For **emergencies only** (hotfixes, urgent features):
252
+ **Automatic** (during living docs sync):
253
+ 1. Complete increment: `/specweave:done 0031`
254
+ 2. System automatically:
255
+ - Extracts user stories from spec.md
256
+ - Writes user story files with forward links (US → Tasks)
257
+ - Parses tasks.md for **AC**: fields
258
+ - Creates task → user story mapping
259
+ - **Injects reverse links** (Tasks US) into tasks.md
504
260
 
261
+ **Manual** (if needed):
505
262
  ```bash
506
- /specweave:increment "urgent-security-fix" --force
263
+ node -e "import('./dist/src/core/living-docs/spec-distributor.js').then(async ({ SpecDistributor }) => {
264
+ const dist = new SpecDistributor(process.cwd());
265
+ await dist.distribute('0031-external-tool-status-sync');
266
+ });"
507
267
  ```
508
268
 
509
- **This bypasses the check** but:
510
- - ✅ Logs the force creation
511
- - ✅ Warns in CLI output
512
- - ✅ Should be explained in PR/standup
513
- - ✅ Should close previous increments ASAP
269
+ ### Requirements for Bidirectional Links
514
270
 
515
- **Use sparingly!** The discipline exists for a reason.
516
-
517
- ---
518
-
519
- **Summary**: Close previous increments before starting new ones. Use `/specweave:status` and `/specweave:close` to maintain discipline. This isn't bureaucracy—it's quality enforcement.
520
-
521
- ---
271
+ **Must Have**:
272
+ - ✅ **AC**: field in tasks with AC-IDs (e.g., `AC-US1-01, AC-US1-02`)
273
+ - ✅ User stories in spec.md with matching IDs (e.g., `### US-001:` or `#### US-001:`)
274
+ - ✅ Living docs sync enabled
522
275
 
523
- ## Test-Aware Planning
524
-
525
- **MAJOR ARCHITECTURE CHANGE**: Tests are now embedded in tasks.md instead of separate tests.md file.
526
-
527
- ### Why the Change?
528
-
529
- **OLD Format**:
530
- - ❌ Separate tests.md file (duplication, sync issues)
531
- - ❌ Manual TC-ID management (TC-001, TC-002, etc.)
532
- - ❌ No BDD format (hard to understand test intent)
533
- - ❌ Tests disconnected from tasks (traceability gaps)
534
-
535
- **NEW Format**:
536
- - ✅ Tests embedded in tasks.md (single source of truth)
537
- - ✅ BDD format (Given/When/Then - clear intent)
538
- - ✅ AC-ID traceability (spec.md → tasks.md → tests)
539
- - ✅ Test-first workflow (TDD supported naturally)
540
- - ✅ Coverage targets per task (realistic 80-90%, not 100%)
541
-
542
- ### Quick Workflow Example
543
-
544
- **Step 1: Create increment** → PM agent generates spec.md with user stories and AC-IDs:
545
-
546
- ```bash
547
- /specweave:increment "Add user authentication" # → generates spec.md with AC-US1-01, AC-US1-02, etc.
548
- ```
549
-
550
- **spec.md excerpt** (acceptance criteria with AC-IDs):
551
-
552
- ### US1: Basic Login Flow
553
- **Acceptance Criteria**:
554
- - [ ] **AC-US1-01**: User can log in with valid email/password (P1, testable)
555
- - [ ] **AC-US1-02**: Invalid credentials show error (P1, testable)
556
- - [ ] **AC-US1-03**: 5 failed attempts lock account 15min (P2, testable)
557
- ```
276
+ **Optional**:
277
+ - No configuration needed (works out of the box)
278
+ - Can disable with `livingDocs.intelligent.bidirectionalLinks: false`
558
279
 
559
- **Step 2: Architect creates plan.md** with architecture and test strategy (85% unit, 80% integration, 100% E2E critical path)
560
-
561
- **Step 3: test-aware-planner generates tasks.md** with embedded tests:
562
-
563
- ```markdown
564
- ---
565
- increment: 0008-user-authentication
566
- total_tasks: 5
567
- test_mode: TDD
568
- coverage_target: 85%
569
- ---
570
-
571
- # Tasks for Increment 0008: User Authentication
572
-
573
- ## T-001: Implement Authentication Service (FULL EXAMPLE)
574
-
575
- **AC**: AC-US1-01, AC-US1-02, AC-US1-03
576
-
577
- **Test Plan** (BDD format):
578
- - **Given** user with valid credentials → **When** login → **Then** receive JWT token + timestamp update
579
-
580
- **Test Cases**:
581
- - Unit (`auth.test.ts`): validLogin, invalidPassword, nonexistentUser, rateLimiting → 90% coverage
582
- - Integration (`auth-flow.test.ts`): loginEndpoint, lockedAccount → 85% coverage
583
- - **Overall: 87% coverage**
584
-
585
- **Implementation**: AuthService.ts, password hashing (bcrypt), JWT generation, rate limiting (Redis), TDD tests
586
-
587
- ---
588
-
589
- ## T-002 through T-005 (Abbreviated)
590
-
591
- - **T-002**: Session Manager (AC-US2-01, AC-US2-02) - session persistence, "Remember Me", 85% coverage, deps: T-001
592
- - **T-003**: Login API Endpoint (AC-US1-01, AC-US1-02) - REST API, validation, rate limiting, 85% coverage, deps: T-001, T-002
593
- - **T-004**: Update Documentation - API docs, flow diagram, user guide (validation: manual review, link checker, build check)
594
- - **T-005**: Security Audit (AC-US1-03) - OWASP scan, password/JWT verification, 90% coverage, deps: T-001, T-002, T-003
595
- ```
596
-
597
- **Step 4: Validate** → `/specweave:check-tests 0008` shows per-task coverage, AC-ID coverage, missing tests, recommendations
598
-
599
- **AC-ID Format**: `AC-US{story}-{number}` (e.g., AC-US1-01) enables traceability from spec.md → tasks.md → tests
600
-
601
- ### Agent Invocation (increment-planner skill)
602
-
603
- The `increment-planner` skill automatically invokes the `test-aware-planner` agent:
604
-
605
- ```markdown
606
- STEP 4: Invoke Test-Aware Planner Agent (🚨 MANDATORY - USE TASK TOOL)
607
-
608
- Task(
609
- subagent_type: "test-aware-planner",
610
- description: "Generate tasks with embedded tests",
611
- prompt: "Create tasks.md with embedded test plans for: [user feature description]
612
-
613
- FIRST, read the increment files:
614
- - .specweave/increments/0008-user-authentication/spec.md
615
- - .specweave/increments/0008-user-authentication/plan.md
616
-
617
- Generate tasks.md with:
618
- - Test Plan (Given/When/Then in BDD format)
619
- - Test Cases (unit/integration/E2E with file paths)
620
- - Coverage Targets (80-90% overall)
621
- - Implementation steps
622
- - Ensure all AC-IDs from spec.md are covered"
623
- )
624
- ```
625
-
626
- ### TDD Workflow Mode
627
-
628
- When `test_mode: TDD` in tasks.md frontmatter:
629
-
630
- **Red → Green → Refactor**:
631
- 1. **Red**: Write failing test first
632
- 2. **Green**: Implement minimal code to pass test
633
- 3. **Refactor**: Improve code while keeping tests green
634
-
635
- **Example**:
636
- ```bash
637
- # 1. RED - Write failing test
638
- vim tests/unit/services/auth.test.ts
639
- npm test # ❌ Fails (expected)
640
-
641
- # 2. GREEN - Implement feature
642
- vim src/services/auth/AuthService.ts
643
- npm test # ✅ Passes
644
-
645
- # 3. REFACTOR - Improve code
646
- vim src/services/auth/AuthService.ts
647
- npm test # ✅ Still passes
648
- ```
649
-
650
- ### Migration from OLD Format
280
+ ### Key Benefits
651
281
 
652
- **If you have increments with tests.md**:
282
+ - ✅ **Complete Traceability**: Navigate from tasks to user stories and back
283
+ - ✅ **LLM-Friendly**: AI can understand relationships bidirectionally
284
+ - ✅ **Zero Manual Work**: Links created automatically during sync
285
+ - ✅ **Multi-Project Aware**: Paths adapt to project structure
286
+ - ✅ **Idempotent**: Safe to run sync multiple times
653
287
 
654
- ```bash
655
- # Option 1: Keep old format (works, but deprecated)
656
- # No action needed - old increments continue to work
657
-
658
- # Option 2: Migrate to new format (recommended)
659
- # 1. Extract tests from tests.md
660
- # 2. Embed them in tasks.md for each task
661
- # 3. Delete tests.md
662
- # 4. Run /specweave:check-tests to validate
663
- ```
288
+ ### Implementation Details
664
289
 
665
- **Note**: New increments ONLY use tasks.md format. Backward compatibility removed per user feedback (greenfield product).
290
+ **Code**: `src/core/living-docs/spec-distributor.ts`
291
+ - `updateTasksWithUserStoryLinks()` - Adds links to tasks.md
292
+ - `mapTasksToUserStories()` - Creates AC-ID based mapping
666
293
 
667
- ### Quick Reference
294
+ **Pattern Support**:
295
+ - Task headings: Both `## T-001:` and `### T-001:`
296
+ - User story headings: Both `### US-001:` and `#### US-001:`
668
297
 
669
- | Aspect | OLD (tests.md) | NEW (tasks.md) |
670
- |--------|---------------|----------------|
671
- | **File** | Separate tests.md | Embedded in tasks.md |
672
- | **Format** | TC-IDs (TC-001) | Function names + BDD |
673
- | **Traceability** | Manual | Automatic (AC-IDs) |
674
- | **BDD** | No | Yes (Given/When/Then) |
675
- | **Sync Issues** | Yes (tasks ↔ tests) | No (single file) |
676
- | **Coverage** | Per test case | Per task + overall |
677
- | **TDD Support** | Limited | Native (test_mode: TDD) |
298
+ **For complete technical details**: See `.specweave/increments/0030-intelligent-living-docs/reports/BIDIRECTIONAL-LINKING-COMPLETE.md`
678
299
 
679
300
  ---
680
301
 
@@ -707,205 +328,17 @@ my-project/
707
328
 
708
329
  ### Why Root-Level Only?
709
330
 
710
- **Single Source of Truth**:
711
- - ✅ One central location for all specs, increments, architecture
712
- - ✅ No duplication or fragmentation
713
- - ✅ Clear ownership and responsibility
714
- - ✅ Simplified living docs sync (one place to update)
715
-
716
- **Cross-Cutting Features**:
717
- - ✅ Increments often span multiple modules (frontend + backend + infra)
718
- - ✅ Architecture decisions (ADRs) apply system-wide
719
- - ✅ Strategy docs are project-level, not module-level
720
- - ✅ Living docs sync works best with one central location
721
-
722
- **Plugin Installation**:
723
- - ✅ ALL plugins installed automatically during `specweave init`
724
- - ✅ No selective loading or detection needed
725
- - ✅ Full capabilities available immediately
726
-
727
- **Prevents Chaos**:
728
- - ❌ Nested folders cause: Which is the source of truth?
729
- - ❌ Duplication: Same increment in multiple places?
730
- - ❌ Conflicts: Different modules with same increment numbers?
731
- - ❌ Complexity: Where do cross-cutting features live?
331
+ Single source of truth, cross-cutting features, simpler sync. Prevents duplication and conflicts. See [Multi-Repo Setup Guide](https://spec-weave.com/docs/learn/multi-repo-setup).
732
332
 
733
333
  ### Multi-Repo & Microservices Pattern
734
334
 
735
- **Problem**: "My project has multiple repos, microservices, or complex architecture"
736
-
737
- **Solution**: Create a **parent folder** with ONE root-level `.specweave/`
738
-
739
- SpecWeave supports **THREE approaches** for multi-repo projects:
740
-
741
- **Option 2: Parent Repo on GitHub** (✅ Recommended for teams)
742
- - Parent folder is a GitHub repository
743
- - Team can clone and collaborate on specs/docs
744
- - Full version control for .specweave/
745
- - Works with CI/CD pipelines
746
-
747
- **Option 3: Local Parent Folder** (✅ Recommended for solo developers)
748
- - Parent folder stays on your machine (NOT pushed to GitHub)
749
- - .specweave/ is gitignored (local only)
750
- - Implementation repos still on GitHub
751
- - Lighter setup, less overhead
752
-
753
- **Option 4: Each Repo Has .specweave/** (❌ NOT RECOMMENDED)
754
- - Each repo maintains its own .specweave/ folder
755
- - Leads to fragmentation and duplication
756
- - Difficult to manage cross-cutting features
757
- - Only use if you absolutely must
758
-
759
- The pattern is the same whether you have:
760
- - Multiple git repos (polyrepo architecture)
761
- - Microservices (separate service directories)
762
- - Monorepo with multiple modules
763
-
764
- ```
765
- microservices-project/ ← Create parent folder
766
- ├── .specweave/ ← ONE source of truth for entire system
767
- │ ├── increments/
768
- │ │ ├── 0001-add-service-mesh/ ← Cross-cutting
769
- │ │ ├── 0002-user-svc-v2/ ← Single service
770
- │ │ └── 0003-checkout-flow/ ← Multi-service
771
- │ ├── docs/
772
- │ │ ├── internal/
773
- │ │ │ ├── strategy/ ← System-wide strategy
774
- │ │ │ ├── architecture/
775
- │ │ │ │ ├── service-mesh.md ← System-wide
776
- │ │ │ │ ├── api-contracts.md ← Cross-service
777
- │ │ │ │ └── adr/
778
- │ │ │ │ └── 0001-service-mesh-choice.md
779
- │ │ │ └── ...
780
- │ │ └── public/
781
- │ └── logs/
782
-
783
- ├── services/
784
- │ ├── user-service/ ← Can be separate git repos
785
- │ ├── order-service/ ← Or monorepo subdirectories
786
- │ ├── payment-service/
787
- │ └── notification-service/
788
-
789
- ├── infrastructure/
790
- │ ├── k8s/
791
- │ └── terraform/
792
-
793
- └── shared/
794
- └── api-contracts/
795
- ```
796
-
797
- **How to Set Up**:
798
-
799
- ```bash
800
- # APPROACH 1: Parent Repo on GitHub (Option 2)
801
- # Step 1: Run specweave init and select "Option 2: Multiple repos WITH parent repo (GitHub)"
802
- mkdir microservices-project && cd microservices-project
803
- npx specweave init .
804
- # → Select: "2️⃣ Multiple repos WITH parent repo (GitHub)"
805
- # → Creates .specweave/ and pushes to GitHub
806
-
807
- # Step 2: Clone implementation repos
808
- git clone https://github.com/myorg/user-service.git services/user-service
809
- git clone https://github.com/myorg/order-service.git services/order-service
810
-
811
- # APPROACH 2: Local Parent Folder (Option 3) - NEW!
812
- # Step 1: Run specweave init and select "Option 3: Local parent folder"
813
- mkdir my-parent-folder && cd my-parent-folder
814
- npx specweave init .
815
- # → Select: "3️⃣ Multiple repos WITH parent folder (LOCAL only)"
816
- # → Creates .specweave/ (gitignored, local only)
817
-
818
- # Step 2: Clone implementation repos
819
- git clone https://github.com/myorg/frontend.git frontend
820
- git clone https://github.com/myorg/backend.git backend
821
-
822
- # .specweave/ stays on your machine, NOT synced to GitHub!
823
-
824
- # APPROACH 3: Monorepo (services in same repo)
825
- mkdir microservices-project && cd microservices-project
826
- git init && npx specweave init .
827
- # → Select: "1️⃣ Single repository" OR "5️⃣ Monorepo"
828
- mkdir -p services/{user,order,payment}
829
-
830
- # Work normally - SpecWeave sees all services
831
- /specweave:increment "0001-add-service-mesh"
832
- # Creates: .specweave/increments/0001-add-service-mesh/
833
- # Can reference: services/user-service/, infrastructure/k8s/, etc.
834
- ```
835
-
836
- **Benefits**:
335
+ Create parent folder with ONE `.specweave/`. Three options: GitHub parent (teams), local parent (solo), or per-repo (not recommended). Works for polyrepo, microservices, monorepo. See [Multi-Repo Setup Guide](https://spec-weave.com/docs/learn/multi-repo-setup).
837
336
 
838
- **All approaches**:
839
- - ✅ One `.specweave/` for entire system (no duplication)
840
- - ✅ Each repo maintains its own git history (if using polyrepo)
841
- - ✅ Cross-service increments are natural (e.g., checkout flow)
842
- - ✅ System-wide architecture docs in one place
843
- - ✅ Living docs cover all services
844
-
845
- **Option 2 (GitHub Parent) specific**:
846
- - ✅ Team can collaborate on specs/docs
847
- - ✅ Full version control history for .specweave/
848
- - ✅ Works with CI/CD pipelines
849
- - ✅ Can enforce code reviews for specs
850
-
851
- **Option 3 (Local Parent) specific**:
852
- - ✅ Lighter setup (no GitHub repo for parent)
853
- - ✅ No extra repository to manage
854
- - ✅ Perfect for solo developers
855
- - ✅ .specweave/ stays private on your machine
337
+ **Setup**: `mkdir parent && cd parent && npx specweave init .` → Select option during init. See guide for full examples.
856
338
 
857
339
  ### Enforcement
858
340
 
859
- **Validation in `init.ts`**:
860
-
861
- ```typescript
862
- // Check for parent .specweave/
863
- function detectNestedSpecweave(targetDir: string): string | null {
864
- let currentDir = path.dirname(targetDir);
865
- const root = path.parse(currentDir).root;
866
-
867
- while (currentDir !== root) {
868
- const specweavePath = path.join(currentDir, '.specweave');
869
- if (fs.existsSync(specweavePath)) {
870
- return currentDir; // Found parent .specweave/
871
- }
872
- currentDir = path.dirname(currentDir);
873
- }
874
-
875
- return null;
876
- }
877
-
878
- // Prevent nested initialization
879
- const parentSpecweave = detectNestedSpecweave(targetDir);
880
- if (parentSpecweave) {
881
- console.error('❌ Nested .specweave/ folders are not supported!');
882
- console.error(` Found parent .specweave/ at: ${parentSpecweave}`);
883
- console.error(` Use the parent folder for all increments.`);
884
- process.exit(1);
885
- }
886
- ```
887
-
888
- **Detection Rules**:
889
- - ❌ Prevent `specweave init` in subdirectories if parent `.specweave/` exists
890
- - ✅ Suggest using parent folder instead
891
- - ✅ Provide clear error messages with path to parent
892
-
893
- **Code Review**:
894
- - ❌ Reject PRs with nested `.specweave/` folders
895
- - ✅ Enforce via linting/validation scripts
896
-
897
- ### Summary
898
-
899
- | Aspect | Root-Level Only | Nested (NOT Supported) |
900
- |--------|----------------|------------------------|
901
- | **Source of Truth** | ✅ One central location | ❌ Multiple conflicting sources |
902
- | **Cross-Cutting Features** | ✅ Natural | ❌ Complex coordination |
903
- | **Living Docs Sync** | ✅ Simple | ❌ Merge conflicts |
904
- | **Plugin Detection** | ✅ Works | ❌ Ambiguous |
905
- | **Multi-Repo** | ✅ Parent folder | ❌ Fragmented |
906
- | **Complexity** | ✅ Simple | ❌ High |
907
-
908
- **Bottom Line**: Root-level `.specweave/` only. For multi-repo projects, create a parent folder. No exceptions.
341
+ `init.ts` detects parent `.specweave/` and prevents nested init. Code review rejects nested folders.
909
342
 
910
343
  ---
911
344
 
@@ -943,39 +376,8 @@ if (parentSpecweave) {
943
376
  - Commands: create-issue, sync, close-issue, status
944
377
  - Auto-detects: `.git/`, `github.com` remote, `GITHUB_TOKEN`
945
378
 
946
- **Planned Plugins** (future releases):
947
-
948
- | Plugin | Skills | Agents | Commands | Use When |
949
- |--------|--------|--------|----------|----------|
950
- | **frontend-stack** | 5 | 1 | 0 | React, Next.js, design systems |
951
- | **kubernetes** | 3 | 1 | 2 | Deploying to K8s, Helm |
952
-
953
- **Domain Plugins**:
954
-
955
- | Plugin | Skills | Agents | Commands | Use When |
956
- |--------|--------|--------|----------|----------|
957
- | **ml-ops** | 3 | 3 | 1 | Machine learning, TensorFlow, PyTorch |
958
- | **observability** | 4 | 4 | 2 | Prometheus, Grafana, monitoring |
959
- | **payment-processing** | 4 | 1 | 0 | Stripe, billing, subscriptions |
960
- | **e2e-testing** | 1 | 0 | 0 | Playwright, E2E browser automation, visual regression |
961
- | **figma-ecosystem** | 5 | 2 | 0 | Design integration, Figma API |
962
- | **security** | 3 | 1 | 0 | Security scanning, best practices |
963
- | **diagrams** | 2 | 1 | 0 | C4 diagrams, Mermaid |
964
-
965
- **Backend Stacks**:
966
-
967
- | Plugin | Skills | Agents | Commands | Use When |
968
- |--------|--------|--------|----------|----------|
969
- | **nodejs-backend** | 1 | 1 | 0 | Express, Fastify, NestJS |
970
- | **python-backend** | 1 | 1 | 0 | FastAPI, Django, Flask |
971
- | **dotnet-backend** | 1 | 1 | 0 | ASP.NET Core, EF Core |
972
-
973
- **Enterprise Sync** (Alternative to GitHub):
974
-
975
- | Plugin | Skills | Agents | Commands | Use When |
976
- |--------|--------|--------|----------|----------|
977
- | **jira-sync** | 1 | 1 | 2 | JIRA project tracking |
978
- | **ado-sync** | 1 | 1 | 2 | Azure DevOps tracking |
379
+ **Available Plugins**: See `plugins/` directory or `/plugin list --installed`
380
+ **Plugin Roadmap**: See [Roadmap](https://spec-weave.com/docs/overview/roadmap) for planned plugins and release timeline
979
381
 
980
382
  ### Context Efficiency
981
383
 
@@ -1121,246 +523,35 @@ No per-project installation needed!
1121
523
 
1122
524
  ---
1123
525
 
1124
- ## Project Architecture
526
+ ## Project Structure
1125
527
 
1126
528
  ### Source of Truth Principle
1127
529
 
1128
530
  **CRITICAL**: SpecWeave follows a strict source-of-truth pattern:
1129
531
 
1130
532
  ```
1131
- src/ SOURCE OF TRUTH (TypeScript code only)
1132
- ├── core/ Core framework logic (TypeScript utilities)
1133
- ├── plugin-loader.ts
1134
- │ ├── config-manager.ts
1135
- │ ├── types/ TypeScript type definitions
1136
- │ └── schemas/ ← JSON schemas
1137
- ├── cli/ ← CLI commands
1138
- ├── hooks/ ← TypeScript utilities for hooks
1139
- │ └── lib/ ← Hook helper functions
1140
- ├── adapters/ ← Tool adapters (legacy)
1141
- ├── templates/ ← Templates for user projects
1142
- └── utils/ ← Utility functions
1143
-
1144
- plugins/ ← ROOT: All plugins (version controlled)
1145
- ├── specweave/ ← CORE PLUGIN (framework essentials)
1146
- │ ├── .claude-plugin/ ← plugin.json (Claude native)
1147
- │ ├── skills/ ← Core skills (9 total)
1148
- │ │ ├── spec-generator/
1149
- │ │ ├── increment-planner/
1150
- │ │ ├── tdd-workflow/
1151
- │ │ └── ...
1152
- │ ├── agents/ ← Core agents (3 core + 19 specialized)
1153
- │ │ ├── pm/
1154
- │ │ ├── architect/
1155
- │ │ ├── tech-lead/
1156
- │ │ └── ...
1157
- │ ├── commands/ ← Core commands (7 core + 15 specialized)
1158
- │ │ ├── inc.md
1159
- │ │ ├── do.md
1160
- │ │ └── ...
1161
- │ ├── hooks/ ← Lifecycle hooks (8 total)
1162
- │ │ ├── post-task-completion.sh
1163
- │ │ ├── pre-implementation.sh
1164
- │ │ └── ...
1165
- │ └── lib/ ← TypeScript utilities (optional)
1166
-
1167
- └── specweave-{name}/ ← Other plugins (GitHub, Figma, etc.)
1168
- ├── .claude-plugin/ ← plugin.json (Claude native)
1169
- ├── skills/ ← Plugin skills
1170
- ├── agents/ ← Plugin agents
1171
- ├── commands/ ← Plugin commands
1172
- └── lib/ ← TypeScript utilities (optional)
1173
-
1174
- .claude/ ← INSTALLED (gitignored in user projects)
1175
- ├── agents/ ← Installed from plugins/*/agents/
1176
- ├── commands/ ← Installed from plugins/*/commands/
1177
- ├── hooks/ ← Installed from plugins/*/hooks/
1178
- └── skills/ ← Installed from plugins/*/skills/
1179
-
1180
- .specweave/ ← FRAMEWORK DATA (always present)
1181
- ├── increments/ ← Feature development
1182
- ├── docs/ ← Strategic documentation
1183
- └── logs/ ← Logs and execution history
533
+ src/ # TypeScript code ONLY (compiled to dist/)
534
+ plugins/ # ALL Claude Code components (skills, agents, commands, hooks)
535
+ ├── specweave/ # Core plugin (auto-loaded)
536
+ └── specweave-*/ # Optional plugins (GitHub, JIRA, etc.)
537
+ .specweave/ # Framework data (increments, docs, logs)
1184
538
  ```
1185
539
 
1186
- **Rules**:
1187
- - ✅ `src/` = TypeScript code ONLY (compiled to `dist/`)
1188
- - ✅ ALL skills/agents/commands/hooks = Inside `plugins/` (including core!)
1189
- - ✅ `plugins/specweave/` = Core framework plugin (always loaded)
1190
- - Marketplace = GLOBAL via CLI (no per-project `.claude/` folder)
1191
- - ❌ NEVER mix `*.ts` and `SKILL.md` in the same directory
540
+ **Key Rules**:
541
+ - ✅ `src/` = TypeScript code ONLY
542
+ - ✅ ALL skills/agents/commands/hooks = Inside `plugins/`
543
+ - ✅ Marketplace = GLOBAL via CLI (no per-project `.claude/`)
544
+ - NEVER mix `*.ts` and `SKILL.md` in same directory
1192
545
  - ❌ NEVER create new files in project root (use increment folders)
1193
546
 
1194
- **Key Architectural Principle**:
1195
- - TypeScript code (`*.ts`) goes in `src/` → compiled to `dist/`
1196
- - Claude-native files (`SKILL.md`, `AGENT.md`, `*.md`) stay in `plugins/` → loaded directly by Claude Code
1197
- - Even "core" framework components are in `plugins/specweave/` (everything is a plugin!)
1198
- - This separation ensures clean builds and prevents mixing compiled code with runtime files
1199
-
1200
547
  ### Tech Stack
1201
548
 
1202
- **Core**:
1203
- - TypeScript 5.x (strict mode)
1204
- - Node.js 18+ (ESM + CommonJS)
1205
- - Commander.js (CLI framework)
1206
- - Inquirer.js (interactive prompts)
1207
- - fs-extra (file operations)
1208
-
1209
- **Testing**:
1210
- - Playwright (E2E browser tests)
1211
- - Jest (unit + integration tests)
1212
- - ts-jest (TypeScript support)
1213
-
1214
- **Documentation**:
1215
- - Docusaurus 3.x (docs-site/)
1216
- - Mermaid diagrams (architecture visualization)
1217
- - Markdown (all docs)
1218
-
1219
- **Distribution**:
1220
- - NPM package (`npm publish`)
1221
- - Install script (`install.sh`)
1222
-
1223
- ---
1224
-
1225
- ## Directory Structure
549
+ **Core**: TypeScript 5.x, Node.js 18+, Commander.js, Inquirer.js
550
+ **Testing**: Playwright (E2E), Jest (unit/integration)
551
+ **Docs**: Docusaurus 3.x, Mermaid diagrams
552
+ **Distribution**: NPM package, install script
1226
553
 
1227
- ```
1228
- specweave/
1229
- ├── src/ # SOURCE OF TRUTH (TypeScript code ONLY)
1230
- │ ├── cli/ # CLI commands (init, version)
1231
- │ │ └── commands/
1232
- │ │ └── init.ts # Main installation logic
1233
- │ ├── core/ # Core framework logic (TypeScript only)
1234
- │ │ ├── plugin-loader.ts # Load plugins from disk
1235
- │ │ ├── plugin-manager.ts # Plugin lifecycle management
1236
- │ │ ├── plugin-detector.ts # Auto-detect plugins (4 phases)
1237
- │ │ ├── config-manager.ts # Config loading/validation
1238
- │ │ ├── types/
1239
- │ │ │ └── plugin.ts # Plugin type definitions
1240
- │ │ └── schemas/
1241
- │ │ ├── plugin-manifest.schema.json
1242
- │ │ └── specweave-config.schema.json
1243
- │ ├── hooks/ # TypeScript utilities for hooks
1244
- │ │ └── lib/ # Hook helper functions
1245
- │ ├── adapters/ # Tool adapters (legacy)
1246
- │ │ ├── adapter-interface.ts
1247
- │ │ ├── adapter-base.ts
1248
- │ │ ├── claude/
1249
- │ │ ├── cursor/ (legacy)
1250
- │ │ └── generic/ (legacy)
1251
- │ ├── templates/ # User project templates
1252
- │ │ ├── CLAUDE.md.template
1253
- │ │ ├── AGENTS.md.template
1254
- │ │ └── ...
1255
- │ └── utils/ # Utility functions
1256
-
1257
- ├── plugins/ # ALL PLUGINS (root level)
1258
- │ ├── specweave/ # CORE PLUGIN (framework essentials)
1259
- │ │ ├── .claude-plugin/
1260
- │ │ │ └── plugin.json # Claude native manifest
1261
- │ │ ├── skills/ # Core skills (9 total)
1262
- │ │ │ ├── spec-generator/ # Specification generation for increments
1263
- │ │ │ ├── increment-planner/ # Increment planning and spec generation
1264
- │ │ │ ├── context-loader/ # Context loading optimization
1265
- │ │ │ ├── tdd-workflow/ # Test-driven development workflow
1266
- │ │ │ ├── project-kickstarter/ # New project bootstrapping
1267
- │ │ │ ├── brownfield-analyzer/ # Existing codebase analysis
1268
- │ │ │ ├── brownfield-onboarder/ # Brownfield project onboarding
1269
- │ │ │ ├── increment-quality-judge/# Quality assessment
1270
- │ │ │ └── context-optimizer/ # Context optimization
1271
- │ │ ├── agents/ # Core agents (22 total)
1272
- │ │ │ ├── pm/ # Product Manager agent
1273
- │ │ │ ├── architect/ # System Architect agent
1274
- │ │ │ ├── tech-lead/ # Tech Lead agent
1275
- │ │ │ └── ...
1276
- │ │ ├── commands/ # Core commands (22 total)
1277
- │ │ │ ├── inc.md # /specweave:inc
1278
- │ │ │ ├── do.md # /specweave:do
1279
- │ │ │ ├── done.md # /specweave:done
1280
- │ │ │ └── ...
1281
- │ │ ├── hooks/ # Lifecycle hooks (8 total)
1282
- │ │ │ ├── post-task-completion.sh # Auto-runs after tasks complete
1283
- │ │ │ ├── pre-implementation.sh # Pre-task validation
1284
- │ │ │ └── ...
1285
- │ │ └── lib/ # TypeScript utilities (optional)
1286
- │ │
1287
- │ ├── specweave-github/ # GitHub Issues integration
1288
- │ │ ├── .claude-plugin/
1289
- │ │ │ └── plugin.json # Claude native manifest
1290
- │ │ ├── skills/
1291
- │ │ │ ├── github-sync/
1292
- │ │ │ └── github-issue-tracker/
1293
- │ │ ├── agents/
1294
- │ │ │ └── github-manager/
1295
- │ │ ├── commands/
1296
- │ │ │ ├── github-create-issue.md
1297
- │ │ │ ├── github-sync.md
1298
- │ │ │ └── ...
1299
- │ │ └── lib/ # TypeScript utilities
1300
- │ ├── specweave-figma/ # Figma design sync
1301
- │ ├── specweave-infrastructure/ # K8s, Helm, Terraform
1302
- │ └── ... (18 plugins total)
1303
-
1304
- ├── .claude-plugin/ # Claude Code marketplace (root level)
1305
- │ ├── marketplace.json # Plugin catalog (18 plugins)
1306
- │ └── README.md # Marketplace documentation
1307
-
1308
- ├── .claude/ # Pre-installed for SpecWeave dev
1309
- │ ├── agents/ # Installed from plugins/*/agents/
1310
- │ ├── commands/ # Installed from plugins/*/commands/
1311
- │ ├── hooks/ # Installed from plugins/*/hooks/
1312
- │ └── skills/ # Installed from plugins/*/skills/
1313
-
1314
- ├── .specweave/ # SpecWeave's own increments
1315
- │ ├── increments/
1316
- │ │ ├── 0001-core-framework/
1317
- │ │ ├── 0002-core-enhancements/
1318
- │ │ │ ├── spec.md
1319
- │ │ │ ├── plan.md
1320
- │ │ │ ├── tasks.md # Tasks with embedded tests (v0.7.0+)
1321
- │ │ │ ├── logs/ # ✅ Session logs go here
1322
- │ │ │ ├── scripts/ # ✅ Helper scripts
1323
- │ │ │ └── reports/ # ✅ Analysis files
1324
- │ │ └── _backlog/
1325
- │ ├── docs/
1326
- │ │ ├── internal/ # Strategic docs (NEVER published) - 6 core folders
1327
- │ │ │ ├── strategy/ # Business rationale, vision, PRDs, OKRs
1328
- │ │ │ ├── specs/ # Feature specifications (detailed requirements, project history)
1329
- │ │ │ │ └── spec-###-{name}.md # User stories, AC, implementation plans
1330
- │ │ │ ├── architecture/ # Technical design (HLD, LLD, ADR, diagrams)
1331
- │ │ │ │ ├── adr/ # Architecture Decision Records (why we chose X over Y)
1332
- │ │ │ │ └── diagrams/ # Mermaid + SVG (C4 model diagrams)
1333
- │ │ │ ├── delivery/ # Build & release processes (roadmap, DORA, branching)
1334
- │ │ │ ├── operations/ # Production operations (runbooks, SLOs, incidents)
1335
- │ │ │ └── governance/ # Policies (security, compliance, coding standards)
1336
- │ │ └── public/ # User-facing docs (can publish)
1337
- │ │ ├── guides/
1338
- │ │ └── api/
1339
- │ └── logs/
1340
-
1341
- ├── tests/
1342
- │ ├── e2e/ # Playwright E2E tests
1343
- │ ├── integration/ # Integration tests
1344
- │ ├── unit/ # Unit tests
1345
- │ └── specs/ # Test specifications
1346
-
1347
- ├── bin/ # Installation scripts
1348
- │ ├── install-all.sh
1349
- │ ├── install-skills.sh
1350
- │ └── install-agents.sh
1351
-
1352
- ├── scripts/ # Build/deployment scripts
1353
- │ ├── install-brownfield.sh
1354
- │ └── generate-diagram-svgs.sh
1355
-
1356
- ├── docs-site/ # Docusaurus documentation site
1357
-
1358
- ├── CLAUDE.md # This file (for contributors)
1359
- ├── README.md # GitHub README (for users)
1360
- ├── CHANGELOG.md # Version history
1361
- ├── package.json # NPM package definition
1362
- └── tsconfig.json # TypeScript configuration
1363
- ```
554
+ **For complete directory structure**: See `README.md` or browse the repository
1364
555
 
1365
556
  ---
1366
557
 
@@ -1368,44 +559,32 @@ specweave/
1368
559
 
1369
560
  ### ✅ ALLOWED in Root
1370
561
 
1371
- - `CLAUDE.md` (this file)
1372
- - `README.md`, `CHANGELOG.md`, `LICENSE`
1373
- - Standard config files (`package.json`, `tsconfig.json`, `.gitignore`)
562
+ - `CLAUDE.md`, `README.md`, `CHANGELOG.md`, `LICENSE`
563
+ - Config files (`package.json`, `tsconfig.json`, `.gitignore`)
1374
564
  - Build artifacts (`dist/`, only if needed temporarily)
1375
565
 
1376
- ### ❌ NEVER Create in Root (Pollutes Repository)
566
+ ### ❌ NEVER Create in Root
1377
567
 
1378
- **See comprehensive rules at top of document**: [🚨 CRITICAL: NEVER POLLUTE PROJECT ROOT!](#-critical-never-pollute-project-root)
568
+ **See comprehensive rules at top**: [🚨 CRITICAL: NEVER POLLUTE PROJECT ROOT!](#-critical-never-pollute-project-root)
1379
569
 
1380
570
  **Quick summary**:
1381
- - ✅ ALL AI-generated files → increment folders (`.specweave/increments/####/reports/`, `logs/`, `scripts/`)
571
+ - ✅ ALL AI-generated files → `.specweave/increments/####/reports/`
1382
572
  - ✅ Architecture decisions → `.specweave/docs/internal/architecture/adr/`
1383
573
  - ❌ NEVER create `.md` files, scripts, or logs in project root
1384
- - ❌ Build artifacts (`.tgz`, `.pt`, etc.) → add to `.gitignore`
1385
574
 
1386
575
  ### Runtime Artifacts (NOT Source Controlled)
1387
576
 
1388
- **Logs and ephemeral files** should NEVER be committed:
1389
-
1390
577
  ```
1391
578
  ❌ NEVER COMMIT:
1392
- .specweave/logs/ # Framework runtime logs
1393
- .specweave/logs/last-hook-fire # Hook execution timestamps
1394
- .specweave/increments/*/logs/ # Increment execution logs
1395
- .specweave/cache/ # Temporary cache
1396
- *.tmp # Temporary files
579
+ .specweave/logs/ # Runtime logs
580
+ .specweave/increments/*/logs/ # Increment logs
581
+ .specweave/cache/ # Temporary cache
1397
582
  ```
1398
583
 
1399
- **Why?**
1400
- - ✅ Logs are execution artifacts, not source code
1401
- - ✅ They change on every run (noise in git history)
1402
- - ✅ They cause unnecessary merge conflicts
1403
- - ✅ They bloat the repository over time
1404
- - ✅ They're developer-specific, not shared state
584
+ **Why?** Logs are execution artifacts, not source code. They cause merge conflicts and bloat the repo.
1405
585
 
1406
- **Enforcement**: `.gitignore` excludes these patterns automatically.
586
+ **Enforcement**: `.gitignore` excludes these automatically.
1407
587
 
1408
- ---
1409
588
 
1410
589
  ## Internal Documentation Structure
1411
590
 
@@ -1423,9 +602,9 @@ specweave/
1423
602
  | **operations/** | Production ops (How we run) | Runbooks, incidents, performance | `runbook-api.md`, `performance-tuning.md` |
1424
603
  | **governance/** | Policies (Guardrails) | Security, compliance, coding standards | `security-policy.md`, `coding-standards.md` |
1425
604
 
1426
- ### Multi-Project Organization (v0.8.0+, Flattened v0.16.11+)
605
+ ### Multi-Project Organization
1427
606
 
1428
- **FLATTENED STRUCTURE** (v0.16.11): Simpler, cleaner paths with document-type-first organization
607
+ **FLATTENED STRUCTURE**: Simpler, cleaner paths with document-type-first organization
1429
608
 
1430
609
  ```
1431
610
  .specweave/docs/internal/
@@ -1505,724 +684,141 @@ specweave/
1505
684
 
1506
685
  ---
1507
686
 
1508
- ## Specs Architecture: Two Locations Explained
1509
-
1510
- **CRITICAL ARCHITECTURAL CONCEPT**: SpecWeave uses specs in TWO locations for different purposes. Understanding this distinction is essential.
1511
-
1512
- ### The Core Question: Why Two Locations?
1513
-
1514
- 1. **Living Docs Specs**: `.specweave/docs/internal/specs/{project-id}/spec-NNN-feature-area.md` - **Permanent, feature-level knowledge base**
1515
- 2. **Increment Specs**: `.specweave/increments/####-name/spec.md` - **Temporary, focused implementation snapshot**
1516
-
1517
- **Key Difference**: Specs use **3-digit numbers** (001, 002, 003) for **feature areas**, increments use **4-digit numbers** (0001, 0002, 0003) for **implementations**.
1518
-
1519
- ### The Answer: Permanent vs Temporary
1520
-
1521
- **Living Docs Specs = Permanent, Feature-Level Knowledge Base**
1522
-
1523
- - **Location**: `.specweave/docs/internal/specs/default/spec-001-core-framework-architecture.md` (single project) or `.specweave/docs/internal/specs/web-app/spec-001-user-auth.md` (multi-project)
1524
- - **Purpose**: COMPLETE, PERMANENT source of truth for entire feature area
1525
- - **Lifecycle**: Created once, updated over time, NEVER deleted
1526
- - **Scope**: Comprehensive feature area (e.g., "Core Framework", 10-50 user stories)
1527
- - **Contains**:
1528
- - ✅ ALL user stories for the feature area (across multiple increments)
1529
- - ✅ ALL acceptance criteria for those user stories
1530
- - ✅ Implementation history (which increments implemented which parts)
1531
- - ✅ Links to brownfield documentation (existing project docs)
1532
- - ✅ External PM tool links (GitHub Project, Jira Epic, ADO Feature)
1533
- - ✅ Architecture decisions rationale (ADRs)
1534
- - ✅ Success criteria & metrics for the feature area
1535
-
1536
- **Increment Specs = Temporary, Focused Implementation Snapshot**
1537
-
1538
- - **Location**: `.specweave/increments/0001-core-framework/spec.md`
1539
- - **Purpose**: TEMPORARY implementation reference (what am I building THIS iteration?)
1540
- - **Lifecycle**: Created per increment, can be deleted after completion
1541
- - **Scope**: Focused subset (3-5 user stories for this increment only)
1542
- - **Contains**:
1543
- - ✅ Reference to living docs: `"See: SPEC-001-core-framework-architecture"`
1544
- - ✅ Subset of user stories: `"Implements: US-001, US-002, US-003 only"`
1545
- - ✅ What's being implemented RIGHT NOW (this iteration)
1546
- - ✅ Out of scope: Lists what's NOT in this increment (deferred to future increments)
1547
-
1548
- ### Real-World Example: SpecWeave Core Framework
1549
-
1550
- **Living Docs Spec** (Permanent, Feature-Level):
1551
- ```
1552
- File: .specweave/docs/internal/specs/default/spec-001-core-framework-architecture.md
1553
-
1554
- # SPEC-001: Core Framework & Architecture
1555
- Foundation framework with CLI, plugin system, cross-platform support
1556
-
1557
- ## Increments (Implementation History)
1558
- - 0001-core-framework: MVP CLI, skills, agents (Complete)
1559
- - 0002-core-enhancements: Context optimization, PM agent (Complete)
1560
- - 0004-plugin-architecture: Claude native plugins (Complete)
1561
- - 0005-cross-platform-cli: Windows/Mac/Linux support (Complete)
1562
-
1563
- ## User Stories (35 total across all 4 increments)
1564
- - US-001: NPM installation (0001) ✅
1565
- - US-003: Context optimization (0002) ✅
1566
- - US-005: Plugin system (0004) ✅
1567
- - US-007: Cross-platform CLI (0005) ✅
1568
- ... (31 more stories)
1569
-
1570
- ## External References
1571
- - GitHub Project: TBD (create for 1.0.0)
1572
- ```
1573
-
1574
- **Increment Spec** (Temporary, Implementation-Level):
1575
- ```
1576
- File: .specweave/increments/0001-core-framework/spec.md
1577
-
1578
- # Increment 0001: Core Framework MVP
1579
- **Implements**: SPEC-001-core-framework-architecture (US-001 to US-002 only)
1580
- **Complete Specification**: See ../../docs/internal/projects/default/specs/spec-001-core-framework-architecture.md
1581
-
1582
- ## What We're Implementing (This Increment Only)
1583
- - US-001: NPM installation + CLI basics ✅
1584
- - US-002: Plugin system foundation ✅
1585
-
1586
- ## Out of Scope (For This Increment)
1587
- - ❌ Context optimization (US-003) → Increment 0002
1588
- - ❌ Claude native plugins (US-005) → Increment 0004
1589
- - ❌ Cross-platform support (US-007) → Increment 0005
1590
- ```
1591
-
1592
- ### Key Benefits
1593
-
1594
- **Why This Architecture?**
1595
-
1596
- 1. **Permanent Knowledge Base**: Living docs = long-term memory. Answer: "How did we build authentication?"
1597
- 2. **Focused Implementation**: Increment specs = short-term focus. Answer: "What am I building RIGHT NOW?"
1598
- 3. **Brownfield Integration**: Living docs link to existing project documentation, increment specs don't need this complexity
1599
- 4. **Clean After Completion**: Delete increment specs (optional), living docs remain as knowledge base
1600
- 5. **External PM Tool Integration**: Jira epic → Living docs spec (permanent link), increment specs don't need external links
1601
-
1602
- ### When to Use Which?
1603
-
1604
- **Create Living Docs Spec When**:
1605
- - ✅ Planning a major feature (authentication, payments, messaging)
1606
- - ✅ Feature spans multiple increments (will take weeks/months)
1607
- - ✅ Need brownfield integration (link to existing project docs)
1608
- - ✅ Want permanent historical record (how did we build this?)
1609
- - ✅ Need external PM tool link (Jira epic, ADO feature, GitHub milestone)
1610
-
1611
- **Create Increment Spec When**:
1612
- - ✅ Starting implementation of one increment
1613
- - ✅ Want quick reference (what am I building right now?)
1614
- - ✅ Need focused scope (just 3 user stories, not 20)
1615
-
1616
- ### Comparison Table
1617
-
1618
- | Aspect | Living Docs Specs | Increment Specs |
1619
- |--------|------------------|----------------|
1620
- | **Location** | `.specweave/docs/internal/specs/` | `.specweave/increments/####/` |
1621
- | **Lifecycle** | ✅ Permanent (never deleted) | ⏳ Temporary (optional deletion) |
1622
- | **Scope** | 📚 Complete feature (20 US) | 🎯 Focused subset (3 US) |
1623
- | **Size** | 500+ lines (comprehensive) | 50-100 lines (focused) |
1624
- | **Purpose** | Knowledge base + history | Implementation tracker |
1625
- | **Coverage** | ALL user stories | SUBSET of user stories |
1626
- | **Brownfield** | ✅ Links to existing docs | ❌ Rarely needed |
1627
- | **External Links** | ✅ Jira, ADO, GitHub | ❌ Rarely needed |
1628
- | **Multiple Increments** | ✅ One spec → many increments | ❌ One increment → one spec |
1629
- | **After Completion** | ✅ Remains forever | ⚠️ Can be deleted |
1630
-
1631
- ### Analogy: Wikipedia vs Sticky Notes
1632
-
1633
- - **Living Docs Specs** = 📚 Wikipedia Article (permanent, comprehensive, updated over time)
1634
- - **Increment Specs** = 📝 Sticky Note Reminder (temporary, focused, disposable after done)
1635
-
1636
- ### Typical Workflow
1637
-
1638
- **Phase 1: Planning** (PM Agent)
1639
- ```
1640
- User: "I want to build a plugin-based framework with CLI"
1641
- PM Agent:
1642
- 1. Creates living docs spec:
1643
- → .specweave/docs/internal/specs/spec-001-core-framework-architecture.md
1644
- → Contains ALL 35 user stories (comprehensive, feature-level)
1645
- → Links to GitHub Project (TBD)
1646
- → Maps to 4 increments (0001, 0002, 0004, 0005)
1647
- ```
1648
-
1649
- **Phase 2: Increment 1** (Core MVP)
1650
- ```
1651
- User: "/specweave:increment 0001-core-framework"
1652
- PM Agent:
1653
- 1. Creates increment spec:
1654
- → .specweave/increments/0001-core-framework/spec.md
1655
- → References living docs: "See SPEC-001"
1656
- → Contains ONLY US-001 to US-002 (focused, this iteration only)
1657
- 2. Implementation happens...
1658
- 3. Increment completes ✅
1659
- 4. Increment spec stays for history (or can be deleted)
1660
- ```
1661
-
1662
- **Phase 3: Increment 2** (Enhancements)
1663
- ```
1664
- User: "/specweave:increment 0002-core-enhancements"
1665
- PM Agent:
1666
- 1. Creates increment spec:
1667
- → .specweave/increments/0002-core-enhancements/spec.md
1668
- → References SAME living docs: "See SPEC-001"
1669
- → Contains ONLY US-003 to US-004 (focused, this iteration only)
1670
- 2. Implementation happens...
1671
- 3. Increment completes ✅
1672
- ```
1673
-
1674
- **Phase 4: All Increments Done!**
1675
- ```
1676
- After ALL increments complete (0001, 0002, 0004, 0005):
1677
- - ✅ Living docs spec REMAINS (permanent knowledge base)
1678
- - ⏳ Increment specs can be deleted (optional cleanup)
1679
- - ✅ Complete history preserved in spec-001
1680
- - ✅ GitHub Project linked to SPEC-001 (not increments)
1681
- ```
1682
-
1683
- ### Relationship
1684
-
1685
- **One living docs spec → Many increment specs**
1686
-
1687
- ```
1688
- SPEC-001: Core Framework & Architecture (Living Docs - Permanent, Feature-Level)
1689
- ├── 0001-core-framework (Increment - Temporary, Implementation-Level)
1690
- ├── 0002-core-enhancements (Increment - Temporary, Implementation-Level)
1691
- ├── 0004-plugin-architecture (Increment - Temporary, Implementation-Level)
1692
- └── 0005-cross-platform-cli (Increment - Temporary, Implementation-Level)
1693
-
1694
- SPEC-002: Intelligent AI Capabilities (Living Docs - Permanent, Feature-Level)
1695
- ├── 0003-intelligent-model-selection (Increment - Temporary, Implementation-Level)
1696
- ├── 0007-smart-increment-discipline (Increment - Temporary, Implementation-Level)
1697
- └── 0009-intelligent-reopen-logic (Increment - Temporary, Implementation-Level)
1698
- ```
1699
-
1700
- ### Summary
1701
-
1702
- **Two Locations, Two Purposes**:
1703
-
1704
- 1. **Living Docs Specs** (`.specweave/docs/internal/specs/`):
1705
- - ✅ Permanent knowledge base
1706
- - ✅ Complete feature specification
1707
- - ✅ Links to brownfield docs
1708
- - ✅ External PM tool integration
1709
- - ✅ Spans multiple increments
1710
-
1711
- 2. **Increment Specs** (`.specweave/increments/####/`):
1712
- - ⏳ Temporary implementation tracker
1713
- - 🎯 Focused subset of work
1714
- - 📝 Quick reference: "What am I building?"
1715
- - 🗑️ Can be deleted after completion
1716
-
1717
- **Result**: Clean, focused implementation + permanent knowledge base
1718
-
1719
- **For comprehensive explanation**: See [SPECS-ARCHITECTURE-CLARIFICATION.md](.specweave/increments/0007-smart-increment-discipline/reports/SPECS-ARCHITECTURE-CLARIFICATION.md)
1720
-
1721
- ---
1722
-
1723
- ## Enterprise Specs Organization (Domain-Based)
1724
-
1725
- **NEW in v0.20.0**: Living docs specs organized by feature domain with rich metadata and auto-generated indices.
1726
-
1727
- ### The Problem with Flat Structure
1728
-
1729
- **Before** (v0.19.x and earlier):
1730
- ```
1731
- .specweave/docs/internal/specs/default/
1732
- ├── spec-001-core-framework-architecture.md
1733
- ├── spec-002-intelligent-capabilities.md
1734
- ├── spec-003-developer-experience.md
1735
- ... (30+ files in one folder)
1736
- ├── nfr-risks.md
1737
- ├── nfr-configuration-example.md
1738
- ├── overview-overview.md
1739
- └── us-us1-single-provider-setup.md
1740
- ```
1741
-
1742
- **Problems**:
1743
- - ❌ 30+ files in single folder (hard to navigate)
1744
- - ❌ Mixed document types (specs, NFRs, overviews, user stories)
1745
- - ❌ No categorization by feature area
1746
- - ❌ Poor scalability (becomes unmanageable at 100+ specs)
1747
- - ❌ No rich metadata (status, priority, ownership)
1748
-
1749
- ### Enterprise Solution: Domain-Based Organization
1750
-
1751
- **After** (v0.20.0+):
1752
- ```
1753
- .specweave/docs/internal/specs/default/
1754
- ├── core-framework/ # Domain folder
1755
- │ ├── README.md # Domain overview
1756
- │ ├── spec-001-*.md # Feature specs
1757
- │ ├── spec-004-*.md
1758
- │ ├── nfrs/ # NFRs for this domain
1759
- │ │ └── nfr-cross-platform.md
1760
- │ └── user-stories/ # Extracted user stories
1761
- │ └── us-001-*.md
1762
-
1763
- ├── developer-experience/
1764
- │ ├── spec-003-*.md
1765
- │ ├── spec-022-*.md
1766
- │ └── user-stories/
1767
-
1768
- ├── integrations/
1769
- │ ├── github/
1770
- │ │ └── spec-017-sync-fix.md
1771
- │ ├── jira/
1772
- │ └── ado/
1773
-
1774
- ├── infrastructure/
1775
- │ ├── spec-004-metrics.md
1776
- │ ├── spec-029-cicd-failure.md
1777
- │ └── nfrs/
1778
-
1779
- ├── quality-velocity/
1780
- │ ├── spec-005-stabilization.md
1781
- │ └── spec-010-dora-metrics.md
1782
-
1783
- ├── intelligence/
1784
- │ ├── spec-002-intelligent-capabilities.md
1785
- │ ├── spec-016-self-reflection.md
1786
- │ └── spec-009-intelligent-reopen.md
1787
-
1788
- └── _index/ # Auto-generated indices
1789
- ├── README.md # Master index
1790
- ├── by-status.md # Active, planning, completed, archived
1791
- ├── by-domain.md # All domains
1792
- ├── by-release.md # 1.0.0, 1.1.0, 2.0.0
1793
- ├── by-priority.md # P0, P1, P2, P3
1794
- └── by-team.md # Core Team, Platform Team, etc.
1795
- ```
1796
-
1797
- ### Six Feature Domains
687
+ ## Specs: Two Locations
1798
688
 
1799
- | Domain | Description | Examples |
1800
- |--------|-------------|----------|
1801
- | **core-framework** | Core framework capabilities | CLI, plugin architecture, configuration, lifecycle |
1802
- | **developer-experience** | DX improvements | Setup, onboarding, docs, error messages, usability |
1803
- | **integrations** | External tool integrations | GitHub, JIRA, Azure DevOps, Figma, Slack |
1804
- | **infrastructure** | Platform, DevOps, ops | CI/CD, monitoring, observability, performance |
1805
- | **quality-velocity** | Testing, metrics, releases | Testing framework, DORA metrics, stabilization |
1806
- | **intelligence** | AI-powered features | Model selection, self-reflection, smart workflows |
689
+ 1. **Living Docs** (`.specweave/docs/internal/specs/`): Permanent, feature-level, 20+ user stories (3-digit: spec-001)
690
+ 2. **Increment Specs** (`.specweave/increments/####/`): Temporary, focused, 3-5 user stories (4-digit: 0001)
1807
691
 
1808
- ### Rich Metadata for Every Spec
692
+ **Relationship**: One living docs spec → Many increment specs.
1809
693
 
1810
- Every spec gets YAML frontmatter with comprehensive metadata:
694
+ See [SPECS-ARCHITECTURE-CLARIFICATION.md](.specweave/increments/0007-smart-increment-discipline/reports/SPECS-ARCHITECTURE-CLARIFICATION.md) for full explanation.
1811
695
 
1812
- ```yaml
1813
- ---
1814
- # Identity
1815
- id: spec-001-core-framework-architecture
1816
- title: "Core Framework & Architecture"
1817
- version: 2.0
1818
- status: active | planning | completed | archived
1819
-
1820
- # Classification
1821
- domain: core-framework
1822
- category: feature | nfr | user-story | overview
1823
- priority: P0 | P1 | P2 | P3
1824
- complexity: low | medium | high | very-high
1825
-
1826
- # Ownership
1827
- team: Core Team
1828
- owner: @anton-abyzov
1829
- stakeholders: ["Product", "Engineering"]
1830
-
1831
- # Lifecycle
1832
- created: 2025-01-15
1833
- last_updated: 2025-11-10
1834
- target_release: 1.0.0
1835
-
1836
- # Relationships
1837
- increments: [0001, 0002, 0004, 0005]
1838
- depends_on: []
1839
- blocks: [spec-002, spec-003]
1840
- related: [spec-016]
1841
-
1842
- # External Links
1843
- github_project: https://github.com/anton-abyzov/specweave/projects/1
1844
- jira_epic: null
1845
- confluence: null
1846
-
1847
- # Tags
1848
- tags: [framework, cli, plugin-system, mvp]
1849
-
1850
- # Metrics
1851
- estimated_effort: 120h
1852
- actual_effort: 95h
1853
- user_stories: 35
1854
- completion: 100%
1855
696
  ---
1856
- ```
1857
-
1858
- ### Auto-Generated Navigation Indices
1859
-
1860
- **Five index views** for different navigation needs:
1861
-
1862
- 1. **by-status.md** - Status-based view
1863
- - Active (currently being worked on)
1864
- - Planning (being planned)
1865
- - Completed (delivered to production)
1866
- - Archived (historical reference)
1867
-
1868
- 2. **by-domain.md** - Domain-based view
1869
- - Core Framework (5 specs)
1870
- - Developer Experience (3 specs)
1871
- - Integrations (4 specs)
1872
- - Infrastructure (3 specs)
1873
- - Quality & Velocity (2 specs)
1874
- - Intelligence (3 specs)
1875
-
1876
- 3. **by-release.md** - Release planning view
1877
- - 1.0.0 (MVP release)
1878
- - 1.1.0 (Post-launch improvements)
1879
- - 2.0.0 (Major features)
1880
- - Unscheduled (backlog)
1881
-
1882
- 4. **by-priority.md** - Priority-based view
1883
- - P0 (Critical, security, production blockers)
1884
- - P1 (High, MVPessential, core features)
1885
- - P2 (Medium, nice-to-have, enhancements)
1886
- - P3 (Low, future, backlog, deferred)
1887
-
1888
- 5. **by-team.md** - Team ownership view
1889
- - Core Team
1890
- - Platform Team
1891
- - DX Team
1892
- - Integrations Team
1893
-
1894
- ### Automated Classification
1895
697
 
1896
- **Intelligent Living Docs Sync** auto-classifies specs by domain using keyword matching:
698
+ ## Living Docs Sync (Universal Hierarchy)
1897
699
 
1898
- ```typescript
1899
- // Auto-classification during living docs sync
1900
- const classifyDomain = (spec: string): string => {
1901
- const keywords = {
1902
- 'core-framework': ['framework', 'cli', 'plugin', 'core', 'foundation'],
1903
- 'developer-experience': ['dx', 'ux', 'installation', 'setup', 'guide'],
1904
- 'integrations': ['github', 'jira', 'ado', 'figma', 'sync'],
1905
- 'infrastructure': ['cicd', 'monitoring', 'observability', 'performance'],
1906
- 'quality-velocity': ['testing', 'dora', 'metrics', 'stabilization'],
1907
- 'intelligence': ['ai', 'intelligent', 'smart', 'reflection', 'model']
1908
- };
1909
-
1910
- // Score each domain and return highest
1911
- // Confidence threshold: 0.5 (50% keyword match)
1912
- };
1913
- ```
700
+ **CRITICAL**: SpecWeave uses Universal Hierarchy architecture for living docs. This section explains the structure and automatic sync process.
1914
701
 
1915
- ### PM Agent Instructions
702
+ ### Structure (Standard Level)
1916
703
 
1917
- **CRITICAL**: When creating living docs specs, PM agent MUST:
704
+ **Location**: `.specweave/docs/internal/specs/{project-id}/`
1918
705
 
1919
- 1. **Classify Domain** - Determine feature domain based on content
1920
- 2. **Add Rich Metadata** - Include all required frontmatter fields
1921
- 3. **Use Correct Path** - Save to domain-specific folder
1922
- 4. **Generate README** - Update domain README.md
1923
- 5. **Regenerate Indices** - Run index generation after creating spec
706
+ Each FS-* (Feature Spec / Epic) folder contains:
707
+ - **README.md** - Epic overview (high-level feature summary, business value, implementation history)
708
+ - **us-\*.md** - User story files DIRECTLY in epic folder (NOT in subfolder)
1924
709
 
1925
- **Example PM Agent Workflow**:
1926
-
1927
- ```typescript
1928
- // Step 1: Classify domain
1929
- const domain = classifyDomain(spec.title, spec.content);
1930
- // Result: "core-framework"
1931
-
1932
- // Step 2: Determine path
1933
- const specPath = `.specweave/docs/internal/specs/default/${domain}/spec-001-core-framework.md`;
1934
-
1935
- // Step 3: Add frontmatter
1936
- const frontmatter = {
1937
- id: 'spec-001-core-framework-architecture',
1938
- title: 'Core Framework & Architecture',
1939
- domain: 'core-framework',
1940
- category: 'feature',
1941
- priority: 'P1',
1942
- status: 'active',
1943
- team: 'Core Team',
1944
- owner: '@anton-abyzov',
1945
- created: '2025-11-12',
1946
- target_release: '1.0.0',
1947
- tags: ['framework', 'cli', 'plugin']
1948
- };
1949
-
1950
- // Step 4: Write spec with frontmatter
1951
- writeSpec(specPath, frontmatter, content);
1952
-
1953
- // Step 5: Update domain README
1954
- updateDomainReadme(domain, spec);
1955
-
1956
- // Step 6: Regenerate indices
1957
- regenerateIndices();
710
+ **Correct Structure**:
1958
711
  ```
712
+ .specweave/docs/internal/specs/
713
+ └── default/ ← Project: default
714
+ ├── README.md ← Project overview
715
+ ├── FS-024-bidirectional-spec-sync/
716
+ │ ├── README.md ← Epic overview
717
+ │ ├── us-001-*.md ← User stories
718
+ │ ├── us-002-*.md
719
+ │ └── us-003-*.md
720
+ ├── FS-030-intelligent-living-docs/
721
+ │ ├── README.md
722
+ │ ├── us-001-*.md
723
+ │ └── (more user stories...)
724
+ └── FS-031-external-tool-status-synchronization/
725
+ ├── README.md
726
+ ├── us-001-rich-external-issue-content.md
727
+ ├── us-002-task-level-mapping.md
728
+ └── (5 more user stories...)
729
+ ```
730
+
731
+ **❌ WRONG - Do NOT create**:
732
+ - `spec.md` files (use README.md instead)
733
+ - `user-stories/` subfolders (user stories go directly in FS-* folder)
734
+ - Root-level `user-stories/` folder
735
+
736
+ ### Hierarchy Mapping
737
+
738
+ | SpecWeave | GitHub | Jira | ADO | Description |
739
+ |-----------|--------|------|-----|-------------|
740
+ | **FS-* (Epic)** | Project/Milestone | Epic | Epic | Strategic feature (20+ user stories) |
741
+ | **US-* (User Story)** | Issue | Story | User Story | Detailed requirement (5-10 AC) |
742
+ | **T-* (Task)** | Checkbox | Sub-task | Task | Implementation unit (1-4 hours) |
743
+
744
+ ### Automatic Sync Process
745
+
746
+ **When**: After completing an increment with `/specweave:done`
1959
747
 
1960
- ### Migration Scripts
1961
-
1962
- **Three scripts for migration**:
748
+ **How It Works**:
749
+ 1. **HierarchyMapper** detects which FS-* folder the increment belongs to:
750
+ - **Method 1 (Frontmatter)**: Checks `epic: FS-031` in increment's `spec.md` (100% confidence)
751
+ - **Method 2 (Increment ID)**: Maps `0031-feature` → `FS-031` (90% confidence)
752
+ - **Method 3 (Config)**: Checks explicit mapping in `config.json` (100% confidence)
753
+ - **Fallback**: Auto-creates new FS-* folder if needed (50% confidence)
1963
754
 
1964
- 1. **Classify Specs** (`scripts/classify-specs.ts`)
1965
- - Scans existing specs
1966
- - Auto-classifies by domain (keyword matching)
1967
- - Generates classification report
1968
- - Saves classification.json for migration
755
+ 2. **SpecDistributor** writes files:
756
+ - Epic overview → `FS-031/README.md` (high-level summary, business value, implementation history)
757
+ - User stories → `FS-031/us-001-*.md`, `FS-031/us-002-*.md`, etc. (directly in folder)
1969
758
 
1970
- 2. **Migrate to Domains** (`scripts/migrate-specs-to-domains.ts`)
1971
- - Reads classification.json
1972
- - Creates domain folders
1973
- - Moves specs to domain-specific folders
1974
- - Adds/updates frontmatter
1975
- - Creates domain READMEs
1976
- - Supports --dry-run mode
759
+ **ID Normalization**: Handles both `0031` and `31` → `FS-031` (removes leading zeros, pads to 3 digits)
1977
760
 
1978
- 3. **Generate Indices** (`scripts/generate-spec-indices.ts`)
1979
- - Scans all specs
1980
- - Generates 5 navigation indices
1981
- - Creates master index (README.md)
1982
- - Shows statistics
761
+ ### Manual Sync (If Needed)
1983
762
 
1984
- **Usage**:
763
+ If automatic sync doesn't trigger, run manually:
1985
764
 
1986
765
  ```bash
1987
- # Step 1: Classify existing specs
1988
- npx ts-node scripts/classify-specs.ts
1989
- # Output: classification-report.md, classification.json
1990
-
1991
- # Step 2: Review classification
1992
- vim .specweave/docs/internal/specs/default/_index/classification-report.md
1993
-
1994
- # Step 3: Migrate (dry-run first)
1995
- npx ts-node scripts/migrate-specs-to-domains.ts --dry-run
1996
-
1997
- # Step 4: Migrate (actual)
1998
- npx ts-node scripts/migrate-specs-to-domains.ts
1999
-
2000
- # Step 5: Generate indices
2001
- npx ts-node scripts/generate-spec-indices.ts
766
+ # From project root
767
+ node -e "import('./dist/src/core/living-docs/spec-distributor.js').then(async ({ SpecDistributor }) => {
768
+ const distributor = new SpecDistributor(process.cwd());
769
+ await distributor.distribute('0031-external-tool-status-sync');
770
+ });"
2002
771
  ```
2003
772
 
2004
- ### Benefits
773
+ ### Key Implementation Files
2005
774
 
2006
- **For Users**:
2007
- - Find specs 10x faster (browse by domain vs scroll through 30+ files)
2008
- - Clear relationships (dependencies, blockers, related specs)
2009
- - ✅ Rich metadata (status, priority, ownership, effort)
2010
- - ✅ Multi-dimensional navigation (status, domain, release, team, priority)
775
+ - **`src/core/living-docs/hierarchy-mapper.ts`** - Detects epic folder (400+ lines)
776
+ - **`src/core/living-docs/spec-distributor.ts`** - Distributes content to FS-* folders
777
+ - **`.specweave/docs/internal/specs/default/README.md`** - Project overview with sync instructions
2011
778
 
2012
- **For Teams**:
2013
- - ✅ Team ownership (core-team/, platform-team/)
2014
- - ✅ Release planning (1.0.0, 1.1.0, 2.0.0)
2015
- - ✅ Dependency management (blocks[], depends_on[])
2016
- - ✅ Effort tracking (estimated_effort vs actual_effort)
779
+ ### User Story Format
2017
780
 
2018
- **For Enterprise**:
2019
- - Scalability (handles 100+ specs easily)
2020
- - Compliance (audit trail via metadata)
2021
- - Reporting (auto-generated indices for stakeholders)
2022
- - Multi-project (backend/, frontend/, mobile/)
781
+ Each `us-*.md` file contains:
782
+ - **Frontmatter**: `id`, `epic`, `title`, `status`, `priority`, `created`, `completed`
783
+ - **Epic Link**: `[SPEC-0031](./README.md)` (links to README.md in same folder)
784
+ - **User Story**: "As a... I want... So that..."
785
+ - **Acceptance Criteria**: AC-US1-01, AC-US1-02, etc. (with P1/P2 priorities)
786
+ - **Implementation**: Links to increment and tasks
787
+ - **Business Rationale**: Why this user story matters
788
+ - **Related Stories**: Cross-links to other US-*.md files
2023
789
 
2024
- ### Configuration
790
+ ### Epic Overview Format (README.md)
2025
791
 
2026
- Add to `.specweave/config.json`:
792
+ Each `README.md` contains:
793
+ - **Frontmatter**: `id`, `title`, `type: epic`, `status`, `priority`, `created`, `last_updated`, `external_tools`
794
+ - **Epic Overview**: High-level feature description
795
+ - **Business Value**: Key benefits (bullet points)
796
+ - **Implementation History**: Table showing which increments implemented which stories
797
+ - **User Stories**: Links to all us-*.md files (grouped by phase)
798
+ - **External Tool Integration**: GitHub/Jira/ADO links
2027
799
 
2028
- ```json
2029
- {
2030
- "specs": {
2031
- "organization": {
2032
- "strategy": "domain-based",
2033
- "autoDomainClassification": true,
2034
- "autoGenerateIndices": true,
2035
- "requireMetadata": true,
2036
- "domains": [
2037
- "core-framework",
2038
- "developer-experience",
2039
- "integrations",
2040
- "infrastructure",
2041
- "quality-velocity",
2042
- "intelligence"
2043
- ],
2044
- "metadata": {
2045
- "required": ["id", "title", "status", "domain", "team", "owner"],
2046
- "optional": ["priority", "complexity", "tags", "increments"]
2047
- }
2048
- }
2049
- }
2050
- }
2051
- ```
2052
-
2053
- ### For Agents and Skills
800
+ ### Troubleshooting
2054
801
 
2055
- **PM Agent MUST**:
2056
- 1. Always classify domain before creating spec
2057
- 2. Add rich frontmatter with all required fields
2058
- 3. Save to correct domain folder (not flat structure)
2059
- 4. Update domain README after creating spec
2060
- 5. Regenerate indices after spec creation
802
+ **Problem**: Sync creates wrong folder (e.g., FS-0031 instead of FS-031)
803
+ **Solution**: ID normalization is already implemented. Rebuild: `npm run build`
2061
804
 
2062
- **Living Docs Sync MUST**:
2063
- 1. Detect domain from increment spec content
2064
- 2. Place spec in correct domain folder
2065
- 3. Add/update frontmatter with metadata
2066
- 4. Preserve existing classification if present
2067
- 5. Regenerate indices after sync
805
+ **Problem**: Files go to wrong location (root level or wrong subfolder)
806
+ **Solution**: Check `userStoriesSubdir` is empty string in HierarchyMapper
2068
807
 
2069
- **See**:
2070
- - [Organization Strategy](.specweave/docs/internal/specs/ORGANIZATION-STRATEGY.md) - Complete architecture
2071
- - Migration scripts in `scripts/` directory
2072
- - Configuration in `.specweave/config.json`
808
+ **Problem**: Epic not detected
809
+ **Solution**: Add `epic: FS-031` to increment's `spec.md` frontmatter
2073
810
 
2074
811
  ---
2075
812
 
2076
- ## Living Completion Reports
2077
-
2078
- ### The Problem with Traditional Reports
2079
-
2080
- **Traditional approach** (report written at the end):
2081
- ```
2082
- Start increment: Plan 10 user stories
2083
- During work: Scope changes 5 times (not documented)
2084
- End increment: Write report "Completed 8/10 stories"
2085
- Future: "Why was Story 5 removed?" → No one remembers!
2086
- ```
2087
-
2088
- **Problems**:
2089
- - ❌ No audit trail for scope changes
2090
- - ❌ Decision rationale lost
2091
- - ❌ Difficult for onboarding/compliance
2092
- - ❌ Can't learn from past iterations
2093
-
2094
- ### Living Reports Solution
2095
-
2096
- **SpecWeave approach** (report updated in real-time):
2097
- ```
2098
- Start: Initialize completion report (v1.0)
2099
- During work:
2100
- - 2025-11-06: Added US6 (dark mode) → /update-scope → v1.1
2101
- - 2025-11-07: Deferred US3 (CSV export) → /update-scope → v1.2
2102
- - 2025-11-08: WebSockets → Polling pivot → /update-scope → v1.3
2103
- End: Finalize report with complete scope evolution history
2104
- Future: "Why was Story 5 removed?" → Check report, find exact reason with WHO approved and WHY!
2105
- ```
813
+ ## Enterprise Specs Organization
2106
814
 
2107
- **Benefits**:
2108
- - ✅ Complete audit trail (every scope change documented)
2109
- - ✅ Real-time context (captured when decision is fresh)
2110
- - ✅ Regulatory compliance (explains deviations from plan)
2111
- - ✅ Learning for future increments
2112
- - ✅ Onboarding new team members (understand project history)
2113
-
2114
- ### Report Structure
2115
-
2116
- **Location**: `.specweave/increments/{id}/reports/COMPLETION-REPORT.md`
2117
-
2118
- **Sections**:
2119
- 1. **Original Scope**: What was planned at increment start
2120
- 2. **Scope Evolution**: Living log of changes (updated during increment)
2121
- 3. **Final Delivery**: What was actually delivered
2122
- 4. **What Changed and Why**: Rationale for scope changes
2123
- 5. **Lessons Learned**: What we learned for next time
2124
- 6. **Metrics**: Velocity, scope creep, test coverage, defects
2125
-
2126
- ### Workflow
2127
-
2128
- **1. Initialize Report** (automatic when increment created):
2129
- ```bash
2130
- /specweave:increment "User dashboard"
2131
- # Creates: .specweave/increments/0008-user-dashboard/reports/COMPLETION-REPORT.md (v1.0)
2132
- ```
2133
-
2134
- **2. Update During Work** (whenever scope changes):
2135
- ```bash
2136
- # Quick log
2137
- /specweave:update-scope "Added dark mode toggle (stakeholder request from CMO, +16 hours)"
2138
-
2139
- # Or interactive
2140
- /specweave:update-scope
2141
- # Prompts:
2142
- # - What changed? (Added/Removed/Modified)
2143
- # - Why? (Business reason, technical blocker, etc.)
2144
- # - Impact? (+/- hours)
2145
- # - Who approved? (PM, stakeholder, etc.)
2146
- # - Documentation? (ADR, GitHub issue, etc.)
2147
- ```
2148
-
2149
- **3. Finalize at Completion** (via `/specweave:done`):
2150
- ```bash
2151
- /specweave:done 0008
2152
- # Validates report completeness
2153
- # Prompts to fill any missing sections
2154
- # Marks increment as complete
2155
- ```
2156
-
2157
- ### Example Entry
2158
-
2159
- ```markdown
2160
- ## Scope Evolution (Living Updates)
2161
-
2162
- ### 2025-11-06: Added user story
2163
-
2164
- **Changed**: US6: Dark mode toggle
2165
- **Reason**: Stakeholder request from CMO (high priority, blocks marketing launch)
2166
- **Impact**: +16 hours
2167
- **Decision**: PM + CMO
2168
- **Documentation**: GitHub issue #45
815
+ Living docs organized by feature domain (core-framework, integrations, infrastructure, etc.). Six domains, rich YAML metadata, auto-generated indices (by-status, by-domain, by-release, by-priority, by-team). Migration scripts available. See [Organization Strategy](.specweave/docs/internal/specs/ORGANIZATION-STRATEGY.md).
2169
816
 
2170
817
  ---
2171
818
 
2172
- ### 2025-11-07: Removed/deferred user story
2173
-
2174
- **Changed**: US3: Data export to CSV
2175
- **Reason**: Not critical for MVP, can be added later without breaking changes
2176
- **Impact**: -8 hours (deferred to increment 0009)
2177
- **Decision**: PM
2178
- **Documentation**: None
2179
-
2180
- ---
2181
-
2182
- ### 2025-11-08: Technical pivot (architecture change)
2183
-
2184
- **Changed**: WebSockets → Long-polling
2185
- **Reason**: WebSocket library had critical security vulnerability (CVE-2025-1234)
2186
- **Impact**: -4 hours (simpler implementation)
2187
- **Decision**: Architect + Security Lead
2188
- **Documentation**: ADR-008: Why We Chose Polling Over WebSockets
2189
-
2190
- ---
2191
- ```
2192
-
2193
- ### When to Update
2194
-
2195
- ✅ **DO update** when:
2196
- - Adding new user story or task
2197
- - Removing/deferring work
2198
- - Modifying scope of existing story
2199
- - Making architecture pivots (technical decisions)
2200
- - Reducing/expanding scope
2201
- - Blocking issues discovered
2202
-
2203
- ❌ **DON'T update** for:
2204
- - Bug fixes discovered during implementation (normal)
2205
- - Minor implementation details
2206
- - Code refactoring (unless scope-affecting)
2207
-
2208
- ### Best Practices
2209
-
2210
- 1. **Update in real-time**: Don't batch updates (capture context while fresh)
2211
- 2. **Be specific**: "Added US6: Dark mode" not "Added feature"
2212
- 3. **Include rationale**: Always answer WHY
2213
- 4. **Link to docs**: ADR, GitHub issue, Jira ticket
2214
- 5. **Track approvals**: Who made the decision
2215
- 6. **Quantify impact**: +/- hours for scope changes
2216
-
2217
- ### Commands
2218
-
2219
- | Command | Purpose |
2220
- |---------|---------|
2221
- | `/specweave:increment "feature"` | Creates increment with initial completion report |
2222
- | `/specweave:update-scope` | Log scope change during increment |
2223
- | `/specweave:done <id>` | Finalize report and mark increment complete |
819
+ ## Living Completion Reports
2224
820
 
2225
- **See**: [update-scope.md](plugins/specweave/commands/update-scope.md) for detailed documentation
821
+ Update reports during work (not at end) for complete audit trail. Log scope changes with `/specweave:update-scope`. Commands: `/specweave:increment` (init), `/specweave:update-scope` (log changes), `/specweave:done` (finalize). See [update-scope.md](plugins/specweave/commands/update-scope.md).
2226
822
 
2227
823
  ---
2228
824
 
@@ -2280,287 +876,52 @@ npm run build && npm test
2280
876
 
2281
877
  **Four Levels of Testing** (mirroring SpecWeave's philosophy):
2282
878
 
2283
- 1. **Specification Tests** (`.specweave/docs/internal/strategy/`)
2284
- - Acceptance criteria in PRDs
2285
- - Manual validation
2286
-
2287
- 2. **Embedded Tests** (`.specweave/increments/####/tasks.md`)
2288
- - Test plans embedded in tasks (BDD format, v0.7.0+)
2289
- - AC-ID traceability (AC-US1-01, AC-US1-02, etc.)
2290
-
2291
- 3. **Integration Tests** (`tests/integration/{skill-name}/`)
2292
- - Tests for plugin and skill functionality
2293
- - Tool sync (github, ado, jira)
2294
- - Brownfield detection and other integrations
2295
- - Run via: `npm run test:integration`
2296
-
2297
- 4. **Code Tests** (`tests/`)
2298
- - **E2E (Playwright)**: MANDATORY for UI features
2299
- - `tests/e2e/specweave-smoke.spec.ts`
2300
- - Run: `npm run test:e2e`
2301
- - **Integration**: Tool sync, brownfield detection
2302
- - `tests/integration/`
2303
- - Run: `npm run test:integration`
2304
- - **Unit**: Core logic, config parsing
2305
- - `tests/unit/`
2306
- - Run: `npm test`
2307
-
2308
- **Coverage Requirements**:
2309
- - Critical paths: 90%+
2310
- - Overall: 80%+
2311
- - Tests MUST tell the truth (no false positives)
2312
-
2313
- ### Hooks and Automation
2314
-
2315
- ## 🎯 CRITICAL: How Claude Code Hooks Actually Work
2316
-
2317
- **Official Docs**: https://code.claude.com/docs/en/hooks
2318
-
2319
- ### The Correct Architecture (Plugin-Based Hooks)
2320
-
2321
- **Hooks live in the PLUGIN, not in `.claude/hooks/`!**
2322
-
2323
- ```
2324
- plugins/specweave/
2325
- ├── .claude-plugin/
2326
- │ └── plugin.json ← "hooks": "./hooks/hooks.json"
2327
- ├── hooks/
2328
- │ ├── hooks.json ← Hook configuration (references .sh files)
2329
- │ ├── post-task-completion.sh ← Stays here (NOT copied!)
2330
- │ └── post-increment-planning.sh
2331
- └── ...
2332
- ```
2333
-
2334
- **Key Facts**:
2335
- 1. ✅ **Hooks stay in plugins/** - They are NOT copied to `.claude/hooks/`
2336
- 2. ✅ **hooks.json references them** - Uses `${CLAUDE_PLUGIN_ROOT}/hooks/post-task-completion.sh`
2337
- 3. ✅ **Automatic discovery** - Claude Code reads plugin's hooks.json at startup
2338
- 4. ✅ **Runtime merging** - Plugin hooks merge with user/project hooks automatically
2339
- 5. ✅ **SpecWeave doesn't use `.claude/`** - Plugin hooks live in `plugins/`, but users CAN add custom hooks to `.claude/settings.json`
2340
-
2341
- ### Hook Discovery Flow
2342
-
2343
- ```
2344
- 1. Plugin installed:
2345
- /plugin install specweave
2346
-
2347
- 2. Claude Code startup:
2348
- Reads: plugins/specweave/.claude-plugin/plugin.json
2349
-
2350
- Discovers: "hooks": "./hooks/hooks.json"
2351
-
2352
- Loads: plugins/specweave/hooks/hooks.json
2353
-
2354
- Registers: PostToolUse → TodoWrite → ${CLAUDE_PLUGIN_ROOT}/hooks/post-task-completion.sh
2355
-
2356
- 3. Hook execution:
2357
- TodoWrite completes
2358
-
2359
- Claude Code executes: plugins/specweave/hooks/post-task-completion.sh
2360
-
2361
- Hook runs!
2362
- ```
2363
-
2364
- **NO copying needed!** `${CLAUDE_PLUGIN_ROOT}` resolves to the plugin directory automatically.
2365
-
2366
- ### What `.claude/` Actually Contains
2367
-
2368
- **SpecWeave doesn't create it!** But users can create `.claude/settings.json` for custom hooks/settings.
2369
-
2370
- **Why SpecWeave doesn't create `.claude/`:**
2371
- - Marketplace registration is GLOBAL via CLI (`claude plugin marketplace add`)
2372
- - No per-project settings.json needed for SpecWeave
2373
- - No hook files needed (hooks come from plugins, not project)
2374
- - Cleaner project structure
2375
-
2376
- **Valid uses of `.claude/` folder:**
2377
- - ✅ User-defined custom hooks (`.claude/settings.json`)
2378
- - ✅ Project-specific hook configurations
2379
- - ✅ Local settings (`.claude/settings.local.json`)
2380
-
2381
- **If you see `.claude/settings.json`** created by SpecWeave in your project:
2382
- - It's from an older version of SpecWeave (<v0.14.0)
2383
- - Safe to delete - marketplace is already registered globally
2384
- - Won't affect functionality
2385
-
2386
- ### What `.specweave/config.json` Contains
2387
-
2388
- **THIS is where hook behavior is configured**:
2389
- ```json
2390
- {
2391
- "hooks": {
2392
- "post_task_completion": {
2393
- "sync_living_docs": true, // ✅ Enables living docs sync
2394
- "sync_tasks_md": true, // ✅ Updates tasks.md
2395
- "external_tracker_sync": true // ✅ Syncs to GitHub/Jira/ADO
2396
- }
2397
- },
2398
- "sync": {
2399
- "enabled": true,
2400
- "activeProfile": "github-default",
2401
- "profiles": {
2402
- "github-default": {
2403
- "provider": "github",
2404
- "config": {
2405
- "owner": "anton-abyzov",
2406
- "repo": "specweave"
2407
- }
2408
- }
2409
- }
2410
- }
2411
- }
2412
- ```
2413
-
2414
- Hooks READ this config to know:
2415
- - Whether sync is enabled
2416
- - Which provider to sync to (GitHub/Jira/ADO)
2417
- - Owner/repo or domain/project info
2418
-
2419
- ### Summary: What Makes Hooks Work
2420
-
2421
- | Component | Location | Purpose |
2422
- |-----------|----------|---------|
2423
- | **Hook scripts** | `plugins/specweave/hooks/*.sh` | Actual executable code |
2424
- | **Hook config** | `plugins/specweave/hooks/hooks.json` | Registers hooks with Claude |
2425
- | **Plugin manifest** | `plugins/specweave/.claude-plugin/plugin.json` | Points to hooks.json |
2426
- | **Marketplace** | GLOBAL (via CLI) | Plugin discovery (NOT per-project!) |
2427
- | **Behavior config** | `.specweave/config.json` | Hook behavior settings |
2428
-
2429
- **Bottom line**: Hooks are a **plugin feature**, not a project feature. They work via plugin installation (GLOBAL), not file copying!
2430
-
2431
- **For detailed hook documentation**, see:
2432
- - **Plugin Hook Documentation**: `plugins/specweave/hooks/README.md` - How hooks work, configuration, testing
2433
- - **Official Claude Code Docs**: https://code.claude.com/docs/en/hooks - Native hook system reference
2434
-
2435
- ---
2436
-
2437
- **Post-Task Completion Hook** (`plugins/specweave/hooks/post-task-completion.sh`):
2438
-
2439
- **Smart Session-End Detection**:
2440
- - ✅ Tracks inactivity gaps between TodoWrite calls
2441
- - ✅ Only plays sound when session is TRULY ending (15s+ inactivity after all tasks complete)
2442
- - ✅ Skips sound during rapid work (Claude creating multiple todo lists)
2443
- - ✅ Enhanced logging with decision reasoning in `.specweave/logs/hooks-debug.log`
2444
- - ✅ Debouncing prevents duplicate hook fires
2445
-
2446
- **How It Works**:
2447
- ```
2448
- Problem: Claude creates multiple todo lists in one conversation
2449
- - List 1: [A, B, C] → completes → sound plays ❌
2450
- - List 2: [D, E] → completes 30s later → sound plays again ❌
2451
- - User hears sounds while Claude is still working!
2452
-
2453
- Solution: Inactivity-based detection
2454
- - 10:00:00 - Task done (gap: 5s) → skip sound
2455
- - 10:00:05 - Task done (gap: 5s) → skip sound
2456
- - 10:00:10 - All done (gap: 5s) → skip sound (rapid work)
2457
- - ... (15+ seconds pass)
2458
- - 10:01:00 - All done (gap: 50s) → PLAY SOUND! ✅ (session ending)
2459
- ```
2460
-
2461
- **Configuration** (`src/hooks/post-task-completion.sh`):
2462
- - `INACTIVITY_THRESHOLD=15` - Seconds of inactivity to assume session ending (adjustable)
2463
- - `DEBOUNCE_SECONDS=2` - Prevents duplicate hook fires
2464
-
2465
- **Pre-Tool-Use Hook** (`.claude/hooks/pre-tool-use.sh`):
2466
-
2467
- **Purpose**: Detect when Claude asks questions BEFORE task completion
2468
-
2469
- **The Problem**: The post-task-completion hook only fires after TodoWrite events. If Claude asks a question via AskUserQuestion WITHOUT completing any tasks first, no sound plays and the user doesn't know Claude is waiting for input.
2470
-
2471
- **The Solution**: The pre-tool-use hook fires BEFORE every tool call, allowing us to detect AskUserQuestion immediately.
2472
-
2473
- **How It Works**:
2474
- ```
2475
- Scenario 1: Question after task completion
2476
- - 10:00:00 - Task completed (TodoWrite) → post-task-completion hook fires
2477
- - 10:00:15 - Inactivity threshold reached → SOUND! ✅
2478
-
2479
- Scenario 2: Question WITHOUT task completion (NEW!)
2480
- - 10:00:00 - Claude calls AskUserQuestion → pre-tool-use hook fires
2481
- - 10:00:00 - Detects tool_name="AskUserQuestion" → SOUND! ✅
2482
- - User is notified IMMEDIATELY, not after 15s
2483
- ```
2484
-
2485
- **Key Features**:
2486
- - ✅ Fires BEFORE any tool call (PreToolUse event)
2487
- - ✅ Filters for AskUserQuestion specifically
2488
- - ✅ Plays distinctive sound (Tink.aiff on macOS, dialog-question.oga on Linux)
2489
- - ✅ Non-blocking and fast (<10ms overhead)
2490
- - ✅ Complements post-task-completion hook (both work together)
2491
-
2492
- **Result**: Users are ALWAYS notified when Claude needs input, regardless of whether tasks have been completed or not.
2493
-
2494
- **Manual Actions** (Claude MUST do after each task):
2495
- - Update `CLAUDE.md` when structure changes
2496
- - Update `README.md` for user-facing changes
2497
- - Update `CHANGELOG.md` for API changes
2498
-
2499
- **Living Docs Sync** (AUTOMATIC after task completion):
2500
-
2501
- **The Critical Problem**: `.specweave/docs/internal/specs/` is the **permanent source of truth** for ALL completed work across the entire enterprise. Without automatic sync, this documentation becomes stale and incomplete.
879
+ 1. **Specification Tests** (`.specweave/docs/internal/strategy/`)
880
+ - Acceptance criteria in PRDs
881
+ - Manual validation
2502
882
 
2503
- **How It Works** (Automatic):
2504
- 1. **Hook Triggers**: After every task completion (TodoWrite), `post-task-completion.sh` fires
2505
- 2. **Sync Check**: Runs `dist/hooks/lib/sync-living-docs.js` to check if sync is needed
2506
- 3. **Automatic Sync**: If enabled in config, syncs increment specs to living docs
2507
- 4. **Result**: `.specweave/docs/internal/specs/spec-{id}.md` is always up-to-date
883
+ 2. **Embedded Tests** (`.specweave/increments/####/tasks.md`)
884
+ - Test plans embedded in tasks (BDD format)
885
+ - AC-ID traceability (AC-US1-01, AC-US1-02, etc.)
2508
886
 
2509
- **Configuration** (`.specweave/config.json`):
2510
- ```json
2511
- {
2512
- "hooks": {
2513
- "post_task_completion": {
2514
- "sync_living_docs": true, // ✅ MUST be true!
2515
- "sync_tasks_md": true, // Updates tasks.md with completion status
2516
- "external_tracker_sync": true // Syncs to GitHub/Jira/ADO
2517
- }
2518
- }
2519
- }
2520
- ```
887
+ 3. **Integration Tests** (`tests/integration/{skill-name}/`)
888
+ - Tests for plugin and skill functionality
889
+ - Tool sync (github, ado, jira)
890
+ - Brownfield detection and other integrations
891
+ - Run via: `npm run test:integration`
2521
892
 
2522
- **Manual Sync** (when automatic sync was disabled):
2523
- ```bash
2524
- # Sync all completed increments to living docs
2525
- /specweave:sync-docs update
893
+ 4. **Code Tests** (`tests/`)
894
+ - **E2E (Playwright)**: MANDATORY for UI features
895
+ - `tests/e2e/specweave-smoke.spec.ts`
896
+ - Run: `npm run test:e2e`
897
+ - **Integration**: Tool sync, brownfield detection
898
+ - `tests/integration/`
899
+ - Run: `npm run test:integration`
900
+ - **Unit**: Core logic, config parsing
901
+ - `tests/unit/`
902
+ - Run: `npm test`
2526
903
 
2527
- # Or copy manually (emergency only):
2528
- cp .specweave/increments/0001-core-framework/spec.md \
2529
- .specweave/docs/internal/specs/spec-0001-core-framework.md
2530
- ```
904
+ **Coverage Requirements**:
905
+ - Critical paths: 90%+
906
+ - Overall: 80%+
907
+ - Tests MUST tell the truth (no false positives)
2531
908
 
2532
- **Verify Sync**:
2533
- ```bash
2534
- # Check all synced specs
2535
- ls -1 .specweave/docs/internal/specs/spec-*.md
909
+ ### Hooks and Automation
2536
910
 
2537
- # Should match number of completed increments
2538
- ls -1 .specweave/increments/ | grep -E '^[0-9]{4}' | wc -l
2539
- ```
911
+ ## Hooks (Automated Workflows)
2540
912
 
2541
- **Why This Matters**:
2542
- - ✅ **Enterprise-level traceability**: Every increment's spec is permanently archived
2543
- - ✅ **Cross-increment history**: See all work completed across the entire project
2544
- - ✅ **Onboarding new developers**: Read specs to understand what was built and why
2545
- - ✅ **Compliance & auditing**: Complete audit trail of all product decisions
2546
- - ✅ **Living documentation**: Specs stay up-to-date without manual intervention
913
+ Hooks live in plugins (`plugins/specweave/hooks/`), auto-discovered via `plugin.json`. No `.claude/` folder needed (global CLI registration). Configure behavior in `.specweave/config.json`. See [Plugin Hook Docs](plugins/specweave/hooks/README.md) and [Claude Code Hooks](https://code.claude.com/docs/en/hooks).
2547
914
 
2548
- **🧠 INTELLIGENT LIVING DOCS SYNC (v0.18.0+)**
915
+ ---
2549
916
 
2550
- **Two Sync Modes**:
917
+ **Key Hooks**:
918
+ - **post-task-completion**: Smart session-end detection (15s inactivity), sound notification, living docs sync, external tool sync
919
+ - **pre-tool-use**: Immediate sound on AskUserQuestion (before task completion)
920
+ - **Living docs sync**: Auto-syncs increment specs to `.specweave/docs/internal/specs/` (permanent archive)
2551
921
 
2552
- 1. **Simple Mode** (Legacy):
2553
- - Copies entire `spec.md` to living docs as single file
2554
- - Location: `.specweave/docs/internal/specs/spec-{id}.md`
2555
- - Use when: Single project, simple workflow
922
+ Configure via `.specweave/config.json` `hooks.post_task_completion`. Manual sync: `/specweave:sync-docs`.
2556
923
 
2557
- 2. **Intelligent Mode** (NEW in v0.18.0+):
2558
- - Parses spec.md into sections
2559
- - Classifies content (user stories, architecture, ADRs, operations, etc.)
2560
- - Detects project (backend/frontend/mobile)
2561
- - Distributes to appropriate folders
2562
- - Generates cross-links
2563
- - Adds Docusaurus frontmatter
924
+ **Intelligent Living Docs Sync**: Two modes - Simple (single file) or Intelligent (parses, classifies, distributes by category+project). 9 categories, multi-project support. Enable in `.specweave/config.json` → `livingDocs.intelligent.enabled`. See [Intelligent Living Docs Guide](.specweave/docs/public/guides/intelligent-living-docs-sync.md).
2564
925
 
2565
926
  **Enable Intelligent Mode** (`.specweave/config.json`):
2566
927
  ```json
@@ -2734,7 +1095,7 @@ Core hook: plugins/specweave/hooks/post-task-completion.sh (452 lines)
2734
1095
  └── Azure DevOps sync (11 lines) ← Embedded in core!
2735
1096
  ```
2736
1097
 
2737
- **After (v0.13.0+)**:
1098
+ **After**:
2738
1099
  ```
2739
1100
  Core hook: plugins/specweave/hooks/post-task-completion.sh (330 lines)
2740
1101
  ├── Core concerns ONLY (sound, living docs, translation, reflection)
@@ -2780,12 +1141,25 @@ ADO plugin: plugins/specweave-ado/hooks/post-task-completion.sh (150 lines)
2780
1141
 
2781
1142
  **Post-Increment-Planning Hook** (AUTOMATIC after `/specweave:increment`):
2782
1143
 
2783
- **GitHub Issue Auto-Creation** (NEW in v0.8.20+):
1144
+ **GitHub Issue Auto-Creation**:
2784
1145
 
2785
1146
  **The Critical Problem**: Without automatic GitHub issue creation, increments don't sync to GitHub automatically. This requires manual `/specweave-github:create-issue` calls, which are often forgotten.
2786
1147
 
2787
1148
  **The Solution**: The `post-increment-planning.sh` hook now auto-creates GitHub issues immediately after increment planning completes.
2788
1149
 
1150
+ **Issue Title Format** (IMPORTANT):
1151
+
1152
+ SpecWeave uses **date-based naming** for GitHub issues to match the Epic folder structure:
1153
+
1154
+ | Context | Format | Example | Code Location |
1155
+ |---------|--------|---------|---------------|
1156
+ | **Increment Issue** | `[FS-YY-MM-DD] Title` | `[FS-25-11-12] External Tool Status Sync` | `post-increment-planning.sh` (line 409) |
1157
+ | **Epic/Spec Issue** | `[FS-NNN] Title` | `[FS-031] External Tool Status Sync` | `github-epic-sync.ts` (line 540) |
1158
+
1159
+ **Legacy Format** (deprecated): `[INC-0031]` - No longer used in codebase!
1160
+
1161
+ The date format (`FS-YY-MM-DD`) is extracted from `metadata.json` creation date and matches the Epic folder naming convention in `.specweave/docs/internal/specs/default/FS-YY-MM-DD-feature-name/`.
1162
+
2789
1163
  **How It Works** (Automatic):
2790
1164
  1. **Hook Triggers**: After `/specweave:increment` completes planning (spec.md, plan.md, tasks.md created)
2791
1165
  2. **Auto-Create Check**: Checks if `config.sync.settings.autoCreateIssue` is enabled
@@ -2911,7 +1285,7 @@ cat .specweave/increments/0016-self-reflection-system/metadata.json
2911
1285
 
2912
1286
  ---
2913
1287
 
2914
- **✅ Metadata Validation & Fallback Creation** (NEW in v0.14.0+):
1288
+ **✅ Metadata Validation & Fallback Creation**:
2915
1289
 
2916
1290
  **The Problem**: Hook failures (no GitHub CLI, network issues, permission problems) left increments without metadata.json, breaking status line, WIP limits, and external sync.
2917
1291
 
@@ -2992,7 +1366,7 @@ cat .specweave/increments/0016-self-reflection-system/metadata.json
2992
1366
 
2993
1367
  **Configuration Note**:
2994
1368
 
2995
- The old config key `hooks.post_increment_planning.auto_create_github_issue` is **deprecated** (v0.14.0+).
1369
+ The old config key `hooks.post_increment_planning.auto_create_github_issue` is **deprecated**.
2996
1370
 
2997
1371
  ```json
2998
1372
  {
@@ -3014,192 +1388,9 @@ The old config key `hooks.post_increment_planning.auto_create_github_issue` is *
3014
1388
 
3015
1389
  ---
3016
1390
 
3017
- ## Status Line Feature (Increment Progress Display)
3018
-
3019
- **NEW in v0.14.0**: Ultra-fast status line showing current increment progress with intelligent caching.
3020
-
3021
- ### The Problem
3022
-
3023
- Users working on increments had no quick way to see:
3024
- - Which increment is active
3025
- - How many tasks complete (X/Y)
3026
- - Current task being worked on
3027
- - Overall progress percentage
3028
-
3029
- They had to run `/specweave:progress` every time, which was slow and disruptive.
3030
-
3031
- ### The Solution: Fast Caching Architecture
3032
-
3033
- **Performance Target**: <1ms render time (99% of requests)
3034
-
3035
- **Architecture**:
3036
- 1. **Hook pre-computes cache** (async, 10-50ms) - User doesn't wait
3037
- 2. **Status line reads cache** (sync, <1ms) - Ultra-fast display
3038
- 3. **mtime-based invalidation** - Detects external edits
3039
-
3040
- ### How It Works
3041
-
3042
- ```
3043
- Post-Task-Completion Hook
3044
-
3045
- Runs update-status-line.sh (async, non-blocking)
3046
- ├─ Parses tasks.md (counts completed/total)
3047
- ├─ Finds current task (first [ ] checkbox)
3048
- ├─ Gets tasks.md mtime (for invalidation)
3049
- └─ Writes to .specweave/state/status-line.json
3050
-
3051
- Status Line Renderer
3052
- ├─ Reads cache (<0.3ms)
3053
- ├─ Validates freshness (0.2ms)
3054
- │ ├─ Age check (<5s = fresh)
3055
- │ └─ mtime check (file unchanged = fresh)
3056
- └─ Formats output (0.1ms)
3057
-
3058
- Total: <1ms ✅
3059
- ```
3060
-
3061
- ### Example Output
3062
-
3063
- ```bash
3064
- # Normal progress
3065
- [sync-fix] ████░░░░ 15/30 (50%) • T-016: Update docs
3066
-
3067
- # Near completion
3068
- [sync-fix] ███████░ 28/30 (93%) • T-029: Final review
3069
-
3070
- # Complete
3071
- [sync-fix] ████████ 30/30 (100%) • Use /specweave:done
1391
+ ## Status Line Feature
3072
1392
 
3073
- # No active increment
3074
- No active increment
3075
- ```
3076
-
3077
- ### Cache File Format
3078
-
3079
- **Location**: `.specweave/state/status-line.json`
3080
-
3081
- ```json
3082
- {
3083
- "incrementId": "0017-sync-architecture-fix",
3084
- "incrementName": "sync-architecture-fix",
3085
- "totalTasks": 30,
3086
- "completedTasks": 15,
3087
- "percentage": 50,
3088
- "currentTask": {
3089
- "id": "T-016",
3090
- "title": "Update documentation"
3091
- },
3092
- "lastUpdate": "2025-11-10T15:30:00Z",
3093
- "lastModified": 1699632600
3094
- }
3095
- ```
3096
-
3097
- ### Multi-Window Support
3098
-
3099
- **Scenario 1: Same Increment, Multiple Windows** ✅
3100
- - Window 1 completes T-016 → Hook updates cache
3101
- - Window 2 reads cache → Sees same progress
3102
- - ✅ Both windows synchronized via shared cache
3103
-
3104
- **Scenario 2: External Edits (Vim/Git)** ✅
3105
- - User edits tasks.md in vim → mtime changes
3106
- - Cache detects mtime mismatch → Returns null
3107
- - Next hook fire regenerates cache
3108
- - ✅ Changes detected within 5 seconds
3109
-
3110
- **Scenario 3: Multiple Active Increments** ⚠️
3111
- - User violates 1-active rule (starts 0018 while 0017 active)
3112
- - Cache shows 0018 (most recent)
3113
- - Window 1 (working on 0017) sees 0018 status ❌
3114
- - ✅ **This is intentional!** Visual enforcement of discipline
3115
-
3116
- ### Configuration
3117
-
3118
- **In `.specweave/config.json`**:
3119
-
3120
- ```json
3121
- {
3122
- "statusLine": {
3123
- "enabled": true,
3124
- "maxCacheAge": 5000,
3125
- "progressBarWidth": 8,
3126
- "maxIncrementNameLength": 20,
3127
- "maxTaskTitleLength": 30,
3128
- "showProgressBar": true,
3129
- "showPercentage": true,
3130
- "showCurrentTask": true
3131
- }
3132
- }
3133
- ```
3134
-
3135
- ### Performance Benchmarks
3136
-
3137
- | Metric | Target | Actual | Result |
3138
- |--------|--------|--------|--------|
3139
- | **Cache Hit** | <1ms | 0.015ms | ✅ 67x faster |
3140
- | **Cache Miss** | N/A | 10-50ms | Async (no wait) |
3141
- | **1000 Renders** | <1000ms | 14.87ms | ✅ 67x faster |
3142
-
3143
- ### Implementation Files
3144
-
3145
- **Core**:
3146
- - `src/core/status-line/types.ts` - Type definitions
3147
- - `src/core/status-line/status-line-manager.ts` - Fast cache reader
3148
- - `plugins/specweave/hooks/lib/update-status-line.sh` - Cache updater
3149
- - `src/cli/commands/status-line.ts` - CLI command
3150
-
3151
- **Tests**:
3152
- - `tests/unit/status-line/status-line-manager.test.ts` - Unit tests
3153
- - `tests/integration/status-line/multi-window.test.ts` - Integration tests
3154
-
3155
- **Integration**:
3156
- - Modified: `plugins/specweave/hooks/post-task-completion.sh` (+8 lines)
3157
- - Modified: `src/core/schemas/specweave-config.schema.json` (+54 lines)
3158
-
3159
- ### Usage
3160
-
3161
- **Automatic** (via hook):
3162
- ```bash
3163
- # Complete any task
3164
- # → Hook fires automatically
3165
- # → Cache updates in background
3166
- # → Status line shows latest progress
3167
- ```
3168
-
3169
- **Manual** (CLI):
3170
- ```bash
3171
- # Display status line
3172
- specweave status-line
3173
-
3174
- # Output JSON
3175
- specweave status-line --json
3176
-
3177
- # Clear cache
3178
- specweave status-line --clear
3179
- ```
3180
-
3181
- **Integration** (status displays):
3182
- ```typescript
3183
- import { StatusLineManager } from 'specweave/core/status-line';
3184
-
3185
- const manager = new StatusLineManager(process.cwd());
3186
- const status = manager.render();
3187
- console.log(status); // "[sync-fix] ████░░░░ 15/30 (50%) • T-016"
3188
- ```
3189
-
3190
- ### Benefits
3191
-
3192
- **For Users**:
3193
- - ✅ Always know where they are in increment (at a glance)
3194
- - ✅ No need to run `/specweave:progress` repeatedly
3195
- - ✅ Multi-window support (shared cache)
3196
- - ✅ Detects external edits (vim, git)
3197
-
3198
- **For Development**:
3199
- - ✅ <1ms render (no performance impact)
3200
- - ✅ Simple architecture (150 lines total)
3201
- - ✅ No database, no locking, no complexity
3202
- - ✅ Works with CI/CD (cache optional)
1393
+ <1ms render, auto-updates after tasks, multi-window support, external edit detection. Shows most recent increment progress. See [Status Line Guide](https://spec-weave.com/docs/learn/status-line).
3203
1394
 
3204
1395
  ---
3205
1396
 
@@ -3466,259 +1657,24 @@ vim .claude-plugin/marketplace.json
3466
1657
 
3467
1658
  **SpecWeave supports syncing increments to unlimited external repositories** (GitHub, JIRA, Azure DevOps) with intelligent rate limiting and time range filtering.
3468
1659
 
3469
- ### 🎯 CRITICAL: Source of Truth Architecture
3470
-
3471
- **The Hub is LOCAL**, not external!
3472
-
3473
- ```
3474
- CORRECT Architecture:
3475
- .specweave/docs/specs/ ↔ GitHub Issues (Local External)
3476
- .specweave/docs/specs/ ↔ Jira Epics (Local ↔ External)
3477
- .specweave/docs/specs/ ↔ Azure DevOps Items (Local ↔ External)
3478
-
3479
- ❌ WRONG (External-to-External):
3480
- GitHub ↔ Jira (External ↔ External - NO!)
3481
- GitHub PRs ↔ Jira Features (External ↔ External - NO!)
3482
- ```
3483
-
3484
- **Key Principle**: `.specweave/` is the **permanent source of truth**. External tools (GitHub, Jira, ADO) are **MIRRORS** of this truth.
3485
-
3486
- **Sync Direction**:
3487
- - **Bidirectional** (default): Local ↔ External (changes sync both ways)
3488
- - **Export only**: Local → External (push changes from Local to External)
3489
- - **Import only**: External → Local (pull changes from External to Local)
3490
-
3491
- ### Core Concepts
3492
-
3493
- **3-Layer Architecture**:
3494
-
3495
- ```
3496
- Layer 1: Credentials (.env)
3497
- ├── GITHUB_TOKEN=...
3498
- ├── JIRA_API_TOKEN=...
3499
- └── AZURE_DEVOPS_PAT=...
3500
-
3501
- Layer 2: Sync Profiles (config.json)
3502
- ├── specweave-dev (GitHub: anton-abyzov/specweave)
3503
- ├── client-mobile (GitHub: client-org/mobile-app)
3504
- ├── internal-jira (JIRA: company.atlassian.net/PROJ)
3505
- └── ado-backend (ADO: myorg/backend-services)
3506
-
3507
- Layer 3: Per-Increment Metadata (metadata.json)
3508
- └── 0004-plugin-architecture
3509
- ├── profile: specweave-dev
3510
- ├── issueNumber: 130
3511
- └── timeRange: 1M
3512
- ```
3513
-
3514
- ### Sync Profiles
3515
-
3516
- **Profiles** define how to connect to external systems:
3517
-
3518
- ```json
3519
- {
3520
- "sync": {
3521
- "profiles": {
3522
- "specweave-dev": {
3523
- "provider": "github",
3524
- "displayName": "SpecWeave Development",
3525
- "config": {
3526
- "owner": "anton-abyzov",
3527
- "repo": "specweave"
3528
- },
3529
- "timeRange": {
3530
- "default": "1M",
3531
- "max": "6M"
3532
- },
3533
- "rateLimits": {
3534
- "maxItemsPerSync": 500,
3535
- "warnThreshold": 100
3536
- }
3537
- }
3538
- }
3539
- }
3540
- }
3541
- ```
3542
-
3543
- **Benefits**:
3544
- - ✅ Unlimited profiles per provider (3+, 5+, 10+ repos)
3545
- - ✅ Different increments sync to different repos
3546
- - ✅ Team-based organization (Frontend → repo-A, Backend → repo-B)
3547
- - ✅ Multi-client support (Client-A, Client-B, Client-C)
3548
-
3549
- ### Project Contexts
3550
-
3551
- **Projects** organize work into logical groups:
3552
-
3553
- ```json
3554
- {
3555
- "sync": {
3556
- "projects": {
3557
- "specweave-core": {
3558
- "id": "specweave-core",
3559
- "name": "SpecWeave Core",
3560
- "description": "Core framework development",
3561
- "keywords": ["framework", "cli", "plugin"],
3562
- "team": "Core Team",
3563
- "defaultSyncProfile": "specweave-dev",
3564
- "specsFolder": ".specweave/docs/internal/specs/specweave-core",
3565
- "increments": ["0001-core-framework", "0002-core-enhancements"]
3566
- }
3567
- }
3568
- }
3569
- }
3570
- ```
3571
-
3572
- **Smart Project Detection**:
3573
- - Project name match: +10 points
3574
- - Team name match: +5 points
3575
- - Keyword match: +3 points per keyword
3576
- - Auto-select if confidence > 0.7
1660
+ **Quick Summary**:
1661
+ - ✅ **Local is source of truth** - `.specweave/` → External tools (mirrors)
1662
+ - ✅ **3-layer architecture** - Credentials Profiles → Per-increment metadata
1663
+ - ✅ **Unlimited profiles** - Frontend → repo-A, Backend → repo-B, Client-C → repo-C
1664
+ - ✅ **Smart project detection** - Auto-selects profile based on keywords
1665
+ - **Time range filtering** - 1W/1M/3M/6M/ALL (prevents rate limit issues)
1666
+ - **Rate limit protection** - Pre-flight validation, safe thresholds
3577
1667
 
3578
1668
  **Example**:
3579
- ```
3580
- Increment: "Add React Native dark mode for mobile app"
3581
- → Detects project "mobile-app" (keywords: mobile, react-native)
3582
- → Uses profile "client-mobile" automatically
3583
- → Syncs to client-org/mobile-app repo
3584
- ```
3585
-
3586
- ### Time Range Filtering
3587
-
3588
- **Problem**: Syncing ALL data takes 25+ minutes and hits rate limits.
3589
-
3590
- **Solution**: Time range presets filter data by creation date:
3591
-
3592
- | Preset | Duration | Items | API Calls | Duration | Impact |
3593
- |--------|----------|-------|-----------|----------|--------|
3594
- | **1W** | 1 week | ~50 | 75 | 30 sec | Low |
3595
- | **1M** | 1 month | ~200 | 300 | 2 min | Medium (✅ Recommended) |
3596
- | **3M** | 3 months | ~600 | 900 | 5 min | Medium |
3597
- | **6M** | 6 months | ~1,200 | 1,800 | 10 min | High |
3598
- | **ALL** | All time | ~5,000+ | 7,500+ | 30+ min | Critical (❌ Avoid) |
3599
-
3600
- **Usage**:
3601
1669
  ```bash
3602
- # Interactive (select time range)
1670
+ # Interactive sync (selects time range)
3603
1671
  /specweave-github:sync 0004
3604
1672
 
3605
- # Specify time range
1673
+ # Specify time range (recommended: 1M)
3606
1674
  /specweave-github:sync 0004 --time-range 1M
3607
-
3608
- # Preview before executing
3609
- /specweave-github:sync 0004 --dry-run
3610
- ```
3611
-
3612
- ### Rate Limiting Protection
3613
-
3614
- **Pre-Flight Validation**:
3615
- 1. Estimate API calls based on time range
3616
- 2. Check current rate limit status (GitHub: 5000/hour, JIRA: 100/min, ADO: 200/5min)
3617
- 3. Calculate impact: low (<250 calls), medium (250-1000), high (1000-2500), critical (2500+)
3618
- 4. Warn or block if risky
3619
-
3620
- **Example: Critical Impact Blocked**:
3621
- ```
3622
- ❌ This sync may FAIL due to:
3623
-
3624
- Blockers:
3625
- • CRITICAL rate limit impact: 7,500 API calls exceeds safe threshold
3626
- • Not enough rate limit remaining (need 7,500, only 4,850 remaining)
3627
-
3628
- Recommendations:
3629
- 1. Reduce time range to 1 month (~300 API calls, SAFE)
3630
- 2. Wait for rate limit reset (25 minutes)
3631
- 3. Split sync across multiple time periods
3632
- ```
3633
-
3634
- ### File Organization
3635
-
3636
- **Specs organized by project**:
3637
- ```
3638
- .specweave/docs/internal/specs/
3639
- ├── specweave-core/
3640
- │ ├── spec-001-core-framework.md
3641
- │ └── spec-002-plugin-architecture.md
3642
- ├── client-mobile/
3643
- │ ├── spec-001-mvp.md
3644
- │ └── spec-002-dark-mode.md
3645
- └── internal-backend/
3646
- └── spec-001-api-v2.md
3647
- ```
3648
-
3649
- ### Key Files
3650
-
3651
- **Core Infrastructure**:
3652
- - `src/core/types/sync-profile.ts` - Type definitions (432 lines)
3653
- - `src/core/sync/profile-manager.ts` - CRUD for profiles (463 lines)
3654
- - `src/core/sync/rate-limiter.ts` - Rate limiting logic (365 lines)
3655
- - `src/core/sync/project-context.ts` - Project management (379 lines)
3656
-
3657
- **Client Libraries** (Profile-Based):
3658
- - `plugins/specweave-github/lib/github-client-v2.ts` - GitHub sync (466 lines)
3659
- - `plugins/specweave-jira/lib/jira-client-v2.ts` - JIRA sync (520 lines)
3660
- - `plugins/specweave-ado/lib/ado-client-v2.ts` - ADO sync (485 lines)
3661
-
3662
- **UX Components**:
3663
- - `src/core/sync/time-range-selector.ts` - Interactive time range selection (295 lines)
3664
- - `src/core/sync/profile-selector.ts` - Interactive profile selection (230 lines)
3665
-
3666
- **Migration**:
3667
- - `src/cli/commands/migrate-to-profiles.ts` - Automatic migration from V1 (425 lines)
3668
-
3669
- ### Common Commands
3670
-
3671
- ```bash
3672
- # Profile management
3673
- /specweave:sync-profile create
3674
- /specweave:sync-profile list
3675
- /specweave:sync-profile get <id>
3676
- /specweave:sync-profile update <id>
3677
- /specweave:sync-profile delete <id>
3678
-
3679
- # Project management
3680
- /specweave:project create
3681
- /specweave:project list
3682
- /specweave:project link <project-id> <increment-id>
3683
- /specweave:project stats
3684
-
3685
- # Syncing (GitHub example)
3686
- /specweave-github:sync <increment-id>
3687
- /specweave-github:sync <increment-id> --profile <id>
3688
- /specweave-github:sync <increment-id> --time-range 1M
3689
- /specweave-github:sync <increment-id> --dry-run
3690
-
3691
- # Migration from V1
3692
- specweave migrate-to-profiles
3693
- ```
3694
-
3695
- ### Migration from V1 (Single Project)
3696
-
3697
- **Automatic**:
3698
- ```bash
3699
- specweave migrate-to-profiles
3700
1675
  ```
3701
1676
 
3702
- **Output**:
3703
- ```
3704
- ✅ Created GitHub profile: default-github
3705
- Repository: anton-abyzov/specweave
3706
-
3707
- ✅ Created default project context
3708
- Name: specweave
3709
- Default profile: default-github
3710
-
3711
- 📊 Migration Summary:
3712
- Profiles created: 1
3713
- Projects created: 1
3714
- ```
3715
-
3716
- ### Documentation
3717
-
3718
- **User Guide**: `.specweave/increments/0011-multi-project-sync/reports/USER-GUIDE-MULTI-PROJECT-SYNC.md`
3719
- **ADR**: `.specweave/docs/internal/architecture/adr/0016-multi-project-external-sync.md`
3720
- **Implementation Summary**: `.specweave/increments/0011-multi-project-sync/COMPLETE-IMPLEMENTATION.md`
3721
- **Command Docs**: `plugins/specweave-github/commands/specweave-github-sync.md`
1677
+ **For complete architecture, configuration, profiles, project contexts, and time range filtering**: See [Multi-Project Sync Architecture](https://spec-weave.com/docs/integrations/multi-project-sync) (comprehensive guide with 3-layer architecture, rate limiting, smart detection, and migration guide)
3722
1678
 
3723
1679
  ---
3724
1680
 
@@ -3913,175 +1869,129 @@ vim docs-site/docs/guides/getting-started.md
3913
1869
  cd docs-site && npm run build
3914
1870
  ```
3915
1871
 
3916
- ### Translation Workflow (Multilingual Support)
3917
-
3918
- **SpecWeave supports multilingual development** via two-phase post-generation translation (Increment 0006).
3919
-
3920
- **Key Concept**: Users work in their native language (great UX), system auto-translates to English (maintainable docs).
1872
+ ### Translation Workflow
3921
1873
 
3922
- **Two-Phase Translation Architecture**:
1874
+ Two-phase post-generation: Phase 1 (increment files), Phase 2 (ADRs/HLDs). 9 languages, ~$0.02/increment, 100% auto. See [Translation Guide](https://spec-weave.com/docs/learn/translation).
3923
1875
 
3924
- | Phase | Hook | What Gets Translated | When | Coverage |
3925
- |-------|------|---------------------|------|----------|
3926
- | **Phase 1** | post-increment-planning | Increment files + Living docs specs | After `/specweave:increment` | 80% of docs |
3927
- | **Phase 2** | post-task-completion | ADRs, HLDs, diagrams | After each task completion | 20% of docs |
1876
+ ---
3928
1877
 
3929
- **Workflow**:
1878
+ ## Troubleshooting
3930
1879
 
3931
- ```bash
3932
- # 1. User creates increment in Russian
3933
- /specweave:increment "Добавить пользовательскую аутентификацию"
3934
-
3935
- # 2. PM agent generates spec.md, plan.md, tasks.md in Russian (natural, user-friendly)
3936
-
3937
- # 3. post-increment-planning hook fires automatically (PHASE 1)
3938
- # Phase A: Translates increment files (spec.md, plan.md, tasks.md) to English
3939
- # Phase B: Translates living docs specs to English (NEW!)
3940
- # - .specweave/docs/internal/specs/spec-*.md
3941
- # - .specweave/docs/internal/strategy/**/*.md
3942
- # Cost: ~$0.02 total
3943
-
3944
- # User sees:
3945
- # ✅ Increment created
3946
- # 🌐 Detected Russian content. Translating increment files to English...
3947
- # 📄 spec.md... ✅
3948
- # 📄 plan.md... ✅
3949
- # 📄 tasks.md... ✅
3950
- # 🌐 Checking living docs for translation...
3951
- # 📄 Living docs detected: spec-0001-user-auth.md
3952
- # ✅ Translated 1 living docs file(s) to English
3953
- # ✅ Translation complete!
3954
- # Increment files: 3/3
3955
- # Living docs: 1 file(s)
3956
- # Estimated cost: ~$0.01-0.02 (using Haiku)
3957
-
3958
- # 4. During implementation, architect creates ADRs in Russian
3959
-
3960
- # 5. post-task-completion hook fires after each task (PHASE 2)
3961
- # - Translates newly created ADRs to English
3962
- # - Translates HLDs/diagrams to English
3963
- # Cost: ~$0.01 per file
3964
-
3965
- # Result: ALL documentation in English (100% coverage)
3966
- ```
1880
+ **Skills not activating?**
1881
+ 1. Check plugin is installed: `/plugin list --installed`
1882
+ 2. Verify YAML frontmatter in `plugins/{plugin}/skills/{skill}/SKILL.md`
1883
+ 3. Restart Claude Code
1884
+ 4. Check description has clear trigger keywords
3967
1885
 
3968
- **Configuration** (`.specweave/config.json`):
1886
+ **Commands not working?**
1887
+ 1. Check plugin is installed: `/plugin list --installed`
1888
+ 2. Verify command exists: `plugins/{plugin}/commands/{command}.md`
1889
+ 3. Check YAML frontmatter
1890
+ 4. Restart Claude Code
3969
1891
 
3970
- ```json
3971
- {
3972
- "language": "ru",
3973
- "translation": {
3974
- "enabled": true,
3975
- "autoTranslateInternalDocs": true,
3976
- "autoTranslateLivingDocs": true,
3977
- "keepFrameworkTerms": true,
3978
- "keepTechnicalTerms": true,
3979
- "translationModel": "haiku"
3980
- }
3981
- }
3982
- ```
1892
+ **Tests failing?**
1893
+ 1. Run `npm run build` first
1894
+ 2. Check test output for specific errors
1895
+ 3. Verify test data in `tests/fixtures/`
1896
+ 4. Check Playwright browser install: `npx playwright install`
3983
1897
 
3984
- **Key Settings**:
3985
- - `language`: Primary language (en, ru, es, zh, de, fr, ja, ko, pt)
3986
- - `autoTranslateInternalDocs`: Auto-translate increment files + living docs specs to English (default: true)
3987
- - `autoTranslateLivingDocs`: Auto-translate ADRs/HLDs after task completion (default: true)
3988
- - `translationModel`: Model to use (haiku/sonnet/opus, default: haiku)
1898
+ **Root folder polluted?**
1899
+ 1. Identify which increment created the files
1900
+ 2. Move to `.specweave/increments/####/reports/`
1901
+ 3. Update `.gitignore` if needed
3989
1902
 
3990
- **Supported Languages**:
3991
- - English (en)
3992
- - Russian (ru)
3993
- - Spanish (es)
3994
- - Chinese (zh)
3995
- - German (de)
3996
- - French (fr)
3997
- - Japanese (ja)
3998
- - Korean (ko)
3999
- - Portuguese (pt)
1903
+ **Plugin hooks not working? (Development Setup)**
4000
1904
 
4001
- **Cost**: ~$0.02 per increment (5-7 files, Haiku model)
1905
+ **Symptom 1**: Errors like `"post-task-completion.sh: No such file or directory"` after TodoWrite
1906
+ **Symptom 2**: `✘ Plugin 'specweave' not found in marketplace 'specweave'`
4002
1907
 
4003
- **Coverage**: 100% (no gaps! All living docs translated)
1908
+ **Root Cause**: Two common issues:
1909
+ 1. **No symlink**: Directory doesn't exist at `~/.claude/plugins/marketplaces/specweave`
1910
+ 2. **No registration**: Marketplace not registered with Claude Code (common after updates/restarts)
4004
1911
 
4005
- **Implementation Details**:
4006
- - Language detection: Heuristic-based (<1ms, zero cost)
4007
- - Code preservation: Never translates code blocks, inline code, or links
4008
- - Validation: Checks heading count, code block count, link count, YAML structure
4009
- - See: `.specweave/increments/0006-llm-native-i18n/reports/IMPLEMENTATION-COMPLETE.md`
1912
+ **The Key Insight**:
1913
+ - **Symlink**: Creates directory structure for hooks
1914
+ - **Registration**: Tells Claude Code where to find plugins
1915
+ - ⚠️ **Both required**: Having one without the other breaks functionality!
4010
1916
 
4011
- **Testing Translation Utilities**:
1917
+ **🚀 Automated Setup (Recommended)**:
4012
1918
 
4013
1919
  ```bash
4014
- # Run translation unit tests
4015
- npm test -- tests/unit/i18n/translation.test.ts
1920
+ # Run smart setup script (auto-detects and fixes BOTH issues)
1921
+ ./scripts/setup-dev-plugins.sh
4016
1922
 
4017
- # Test result: 67/67 passing (100%)
1923
+ # What it does:
1924
+ # 1. Detects environment (local vs VM)
1925
+ # 2. Creates/verifies symlink
1926
+ # 3. ✨ NEW: Checks marketplace registration
1927
+ # 4. ✨ NEW: Auto-registers if missing
1928
+ # 5. Installs core plugins
1929
+ # 6. Verifies everything works
4018
1930
  ```
4019
1931
 
4020
- **Files**:
4021
- - Utilities: `src/utils/translation.ts` (673 lines, 11 languages)
4022
- - CLI Script: `src/hooks/lib/translate-file.ts` (398 lines)
4023
- - Hook (Phase 1): `plugins/specweave/hooks/post-increment-planning.sh` (~420 lines)
4024
- - Hook (Phase 2): `src/hooks/lib/translate-living-docs.ts` (217 lines)
4025
- - Tests: `tests/unit/i18n/translation.test.ts` (705 lines, 67 tests)
4026
- - E2E Tests: `tests/e2e/i18n/living-docs-translation.spec.ts` (6 test cases)
4027
- - Schema: `src/core/schemas/specweave-config.schema.json`
1932
+ **Environment Detection**:
1933
+ - **Local machine** Symlink + Registration (instant updates)
1934
+ - **claude.ai/code VM** GitHub marketplace (reliable, auto-clones)
1935
+ - **Codespaces/Gitpod** GitHub marketplace (cloud-friendly)
4028
1936
 
4029
- **Migrating Existing Non-English Living Docs**:
4030
-
4031
- For projects with existing non-English living docs, use the one-time migration script:
1937
+ **Manual Fix (If Script Fails)**:
4032
1938
 
1939
+ **Step 1: Check Registration**
4033
1940
  ```bash
4034
- # One-time migration (translates all living docs to English)
4035
- bash scripts/migrate-living-docs-to-english.sh
4036
-
4037
- # What it does:
4038
- # - Scans .specweave/docs/internal/ for non-English files
4039
- # - Translates each file to English (preserves code blocks, links, framework terms)
4040
- # - Skips files already in English
4041
- # - Non-blocking (continues even if some files fail)
1941
+ # See if marketplace is registered
1942
+ claude plugin marketplace list
4042
1943
 
4043
- # Estimated time: 1-2 minutes per 100 files
4044
- # Estimated cost: ~$0.01 per file (using Haiku)
1944
+ # If empty or no "specweave" Need to register!
4045
1945
  ```
4046
1946
 
4047
- **After migration**:
1947
+ **Step 2: Fix Registration**
4048
1948
  ```bash
4049
- # Review translated files
4050
- git diff .specweave/docs/internal/
1949
+ # Register marketplace (use PROJECT ROOT, not .claude-plugin!)
1950
+ claude plugin marketplace add /Users/antonabyzov/Projects/github/specweave
4051
1951
 
4052
- # Commit changes
4053
- git add . && git commit -m "docs: translate living docs to English"
1952
+ # OR from within project:
1953
+ cd /path/to/specweave
1954
+ claude plugin marketplace add $(pwd)
4054
1955
 
4055
- # Future increments will auto-translate
4056
- /specweave:increment "Добавить новую функцию" # Auto-translates!
1956
+ # Verify it worked
1957
+ claude plugin marketplace list
1958
+ # Should show: ❯ specweave (Source: Directory /path/to/specweave)
4057
1959
  ```
4058
1960
 
4059
- ---
1961
+ **Step 3: Install Plugins**
1962
+ ```bash
1963
+ # Now plugins should install successfully
1964
+ claude plugin install specweave
1965
+ claude plugin install specweave-github
1966
+ claude plugin install specweave-jira
1967
+ claude plugin install specweave-ado
1968
+ ```
4060
1969
 
4061
- ## Troubleshooting
1970
+ **Alternative: Use GitHub Marketplace** (VM/Cloud)
1971
+ ```bash
1972
+ # Remove local marketplace
1973
+ claude plugin marketplace remove specweave
4062
1974
 
4063
- **Skills not activating?**
4064
- 1. Check plugin is installed: `/plugin list --installed`
4065
- 2. Verify YAML frontmatter in `plugins/{plugin}/skills/{skill}/SKILL.md`
4066
- 3. Restart Claude Code
4067
- 4. Check description has clear trigger keywords
1975
+ # Add from GitHub (like production users)
1976
+ claude plugin marketplace add anton-abyzov/specweave
4068
1977
 
4069
- **Commands not working?**
4070
- 1. Check plugin is installed: `/plugin list --installed`
4071
- 2. Verify command exists: `plugins/{plugin}/commands/{command}.md`
4072
- 3. Check YAML frontmatter
4073
- 4. Restart Claude Code
1978
+ # Install plugins (should work immediately)
1979
+ claude plugin install specweave
1980
+ claude plugin install specweave-github
1981
+ ```
4074
1982
 
4075
- **Tests failing?**
4076
- 1. Run `npm run build` first
4077
- 2. Check test output for specific errors
4078
- 3. Verify test data in `tests/fixtures/`
4079
- 4. Check Playwright browser install: `npx playwright install`
1983
+ **Benefits**:
1984
+ - **Local + Registration**: Instant updates + Plugin installation works
1985
+ - **VM (GitHub)**: Always reliable, no registration issues
1986
+ - **Automated script**: Handles both symlink AND registration
1987
+ - **Self-healing**: Re-running script fixes broken registrations
4080
1988
 
4081
- **Root folder polluted?**
4082
- 1. Identify which increment created the files
4083
- 2. Move to `.specweave/increments/####/reports/`
4084
- 3. Update `.gitignore` if needed
1989
+ **Why This Matters**:
1990
+ - **Production users**: No issue (GitHub marketplace via `specweave init`)
1991
+ - **Contributors**: Need both symlink AND registration (script handles it)
1992
+ - **After Claude Code updates**: Registration can be lost (script detects and fixes)
1993
+
1994
+ **Documentation**: See `.specweave/increments/0030-intelligent-living-docs/reports/MARKETPLACE-REGISTRATION-FIX.md` for complete analysis
4085
1995
 
4086
1996
  ---
4087
1997