@ydtb/specsmd 0.1.22

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 (143) hide show
  1. package/README.md +322 -0
  2. package/bin/cli.js +21 -0
  3. package/flows/aidlc/README.md +372 -0
  4. package/flows/aidlc/agents/construction-agent.md +80 -0
  5. package/flows/aidlc/agents/inception-agent.md +97 -0
  6. package/flows/aidlc/agents/master-agent.md +61 -0
  7. package/flows/aidlc/agents/operations-agent.md +89 -0
  8. package/flows/aidlc/commands/construction-agent.md +67 -0
  9. package/flows/aidlc/commands/inception-agent.md +59 -0
  10. package/flows/aidlc/commands/master-agent.md +51 -0
  11. package/flows/aidlc/commands/operations-agent.md +81 -0
  12. package/flows/aidlc/context-config.yaml +67 -0
  13. package/flows/aidlc/memory-bank.yaml +105 -0
  14. package/flows/aidlc/quick-start.md +322 -0
  15. package/flows/aidlc/scripts/artifact-validator.cjs +594 -0
  16. package/flows/aidlc/scripts/bolt-complete.cjs +606 -0
  17. package/flows/aidlc/scripts/status-integrity.cjs +598 -0
  18. package/flows/aidlc/skills/construction/bolt-list.md +163 -0
  19. package/flows/aidlc/skills/construction/bolt-replan.md +345 -0
  20. package/flows/aidlc/skills/construction/bolt-start.md +442 -0
  21. package/flows/aidlc/skills/construction/bolt-status.md +185 -0
  22. package/flows/aidlc/skills/construction/navigator.md +196 -0
  23. package/flows/aidlc/skills/construction/prototype-apply.md +311 -0
  24. package/flows/aidlc/skills/inception/bolt-plan.md +372 -0
  25. package/flows/aidlc/skills/inception/context.md +171 -0
  26. package/flows/aidlc/skills/inception/intent-create.md +211 -0
  27. package/flows/aidlc/skills/inception/intent-list.md +124 -0
  28. package/flows/aidlc/skills/inception/navigator.md +207 -0
  29. package/flows/aidlc/skills/inception/requirements.md +227 -0
  30. package/flows/aidlc/skills/inception/review.md +248 -0
  31. package/flows/aidlc/skills/inception/story-create.md +304 -0
  32. package/flows/aidlc/skills/inception/units.md +278 -0
  33. package/flows/aidlc/skills/inception/vibe-to-spec.md +410 -0
  34. package/flows/aidlc/skills/master/analyze-context.md +239 -0
  35. package/flows/aidlc/skills/master/answer-question.md +141 -0
  36. package/flows/aidlc/skills/master/explain-flow.md +158 -0
  37. package/flows/aidlc/skills/master/project-init.md +281 -0
  38. package/flows/aidlc/skills/master/route-request.md +126 -0
  39. package/flows/aidlc/skills/operations/build.md +237 -0
  40. package/flows/aidlc/skills/operations/deploy.md +259 -0
  41. package/flows/aidlc/skills/operations/monitor.md +265 -0
  42. package/flows/aidlc/skills/operations/navigator.md +209 -0
  43. package/flows/aidlc/skills/operations/verify.md +224 -0
  44. package/flows/aidlc/templates/construction/bolt-template.md +226 -0
  45. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md +49 -0
  46. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md +55 -0
  47. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md +67 -0
  48. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md +62 -0
  49. package/flows/aidlc/templates/construction/bolt-types/ddd-construction-bolt.md +590 -0
  50. package/flows/aidlc/templates/construction/bolt-types/simple-construction-bolt.md +347 -0
  51. package/flows/aidlc/templates/construction/bolt-types/spike-bolt.md +240 -0
  52. package/flows/aidlc/templates/construction/construction-log-template.md +129 -0
  53. package/flows/aidlc/templates/construction/standards/coding-standards.md +29 -0
  54. package/flows/aidlc/templates/construction/standards/system-architecture.md +22 -0
  55. package/flows/aidlc/templates/construction/standards/tech-stack.md +19 -0
  56. package/flows/aidlc/templates/inception/inception-log-template.md +134 -0
  57. package/flows/aidlc/templates/inception/project/README.md +55 -0
  58. package/flows/aidlc/templates/inception/requirements-template.md +144 -0
  59. package/flows/aidlc/templates/inception/stories-template.md +38 -0
  60. package/flows/aidlc/templates/inception/story-template.md +147 -0
  61. package/flows/aidlc/templates/inception/system-context-template.md +29 -0
  62. package/flows/aidlc/templates/inception/unit-brief-template.md +177 -0
  63. package/flows/aidlc/templates/inception/units-template.md +52 -0
  64. package/flows/aidlc/templates/standards/catalog.yaml +345 -0
  65. package/flows/aidlc/templates/standards/coding-standards.guide.md +553 -0
  66. package/flows/aidlc/templates/standards/data-stack.guide.md +162 -0
  67. package/flows/aidlc/templates/standards/decision-index-template.md +32 -0
  68. package/flows/aidlc/templates/standards/tech-stack.guide.md +280 -0
  69. package/flows/fire/README.md +19 -0
  70. package/flows/fire/agents/builder/agent.md +254 -0
  71. package/flows/fire/agents/builder/skills/code-review/SKILL.md +257 -0
  72. package/flows/fire/agents/builder/skills/code-review/references/auto-fix-rules.md +218 -0
  73. package/flows/fire/agents/builder/skills/code-review/references/review-categories.md +154 -0
  74. package/flows/fire/agents/builder/skills/code-review/templates/review-report.md.hbs +120 -0
  75. package/flows/fire/agents/builder/skills/commit-changes/SKILL.md +232 -0
  76. package/flows/fire/agents/builder/skills/commit-changes/scripts/commit-changes.cjs +447 -0
  77. package/flows/fire/agents/builder/skills/run-execute/SKILL.md +700 -0
  78. package/flows/fire/agents/builder/skills/run-execute/scripts/complete-run.cjs +748 -0
  79. package/flows/fire/agents/builder/skills/run-execute/scripts/init-run.cjs +457 -0
  80. package/flows/fire/agents/builder/skills/run-execute/scripts/update-phase.cjs +239 -0
  81. package/flows/fire/agents/builder/skills/run-execute/templates/plan.md.hbs +61 -0
  82. package/flows/fire/agents/builder/skills/run-execute/templates/test-report.md.hbs +81 -0
  83. package/flows/fire/agents/builder/skills/run-plan/SKILL.md +366 -0
  84. package/flows/fire/agents/builder/skills/run-status/SKILL.md +96 -0
  85. package/flows/fire/agents/builder/skills/walkthrough-generate/SKILL.md +181 -0
  86. package/flows/fire/agents/builder/skills/walkthrough-generate/templates/walkthrough.md.hbs +108 -0
  87. package/flows/fire/agents/orchestrator/agent.md +144 -0
  88. package/flows/fire/agents/orchestrator/skills/project-init/SKILL.md +226 -0
  89. package/flows/fire/agents/orchestrator/skills/project-init/templates/coding-standards.md.hbs +149 -0
  90. package/flows/fire/agents/orchestrator/skills/project-init/templates/constitution.md.hbs +43 -0
  91. package/flows/fire/agents/orchestrator/skills/project-init/templates/system-architecture.md.hbs +101 -0
  92. package/flows/fire/agents/orchestrator/skills/project-init/templates/tech-stack.md.hbs +136 -0
  93. package/flows/fire/agents/orchestrator/skills/project-init/templates/testing-standards.md.hbs +94 -0
  94. package/flows/fire/agents/orchestrator/skills/route/SKILL.md +146 -0
  95. package/flows/fire/agents/orchestrator/skills/status/SKILL.md +696 -0
  96. package/flows/fire/agents/planner/agent.md +143 -0
  97. package/flows/fire/agents/planner/skills/design-doc-generate/SKILL.md +156 -0
  98. package/flows/fire/agents/planner/skills/design-doc-generate/templates/design.md.hbs +124 -0
  99. package/flows/fire/agents/planner/skills/intent-capture/SKILL.md +125 -0
  100. package/flows/fire/agents/planner/skills/intent-capture/templates/brief.md.hbs +40 -0
  101. package/flows/fire/agents/planner/skills/work-item-decompose/SKILL.md +166 -0
  102. package/flows/fire/agents/planner/skills/work-item-decompose/templates/work-item.md.hbs +40 -0
  103. package/flows/fire/commands/fire-builder.md +56 -0
  104. package/flows/fire/commands/fire-planner.md +48 -0
  105. package/flows/fire/commands/fire.md +46 -0
  106. package/flows/fire/memory-bank.yaml +240 -0
  107. package/flows/fire/quick-start.md +146 -0
  108. package/flows/simple/README.md +190 -0
  109. package/flows/simple/agents/agent.md +404 -0
  110. package/flows/simple/commands/agent.md +60 -0
  111. package/flows/simple/context-config.yaml +34 -0
  112. package/flows/simple/memory-bank.yaml +66 -0
  113. package/flows/simple/quick-start.md +231 -0
  114. package/flows/simple/skills/design.md +96 -0
  115. package/flows/simple/skills/execute.md +190 -0
  116. package/flows/simple/skills/requirements.md +94 -0
  117. package/flows/simple/skills/tasks.md +136 -0
  118. package/flows/simple/templates/design-template.md +138 -0
  119. package/flows/simple/templates/requirements-template.md +85 -0
  120. package/flows/simple/templates/tasks-template.md +104 -0
  121. package/lib/InstallerFactory.js +36 -0
  122. package/lib/analytics/env-detector.js +92 -0
  123. package/lib/analytics/index.js +22 -0
  124. package/lib/analytics/machine-id.js +33 -0
  125. package/lib/analytics/tracker.js +232 -0
  126. package/lib/cli-utils.js +342 -0
  127. package/lib/constants.js +44 -0
  128. package/lib/installer.js +406 -0
  129. package/lib/installers/AntigravityInstaller.js +22 -0
  130. package/lib/installers/ClaudeInstaller.js +85 -0
  131. package/lib/installers/ClineInstaller.js +21 -0
  132. package/lib/installers/CodexInstaller.js +21 -0
  133. package/lib/installers/CopilotInstaller.js +113 -0
  134. package/lib/installers/CursorInstaller.js +63 -0
  135. package/lib/installers/GeminiInstaller.js +75 -0
  136. package/lib/installers/KiroInstaller.js +77 -0
  137. package/lib/installers/OpenCodeInstaller.js +30 -0
  138. package/lib/installers/RooInstaller.js +22 -0
  139. package/lib/installers/ToolInstaller.js +76 -0
  140. package/lib/installers/WindsurfInstaller.js +22 -0
  141. package/lib/markdown-validator.ts +175 -0
  142. package/lib/yaml-validator.ts +99 -0
  143. package/package.json +69 -0
@@ -0,0 +1,590 @@
1
+ # Bolt Type: DDD Construction
2
+
3
+ ## Mandatory Output Rules (READ FIRST)
4
+
5
+ - 🚫 **NEVER** use ASCII tables for options - they break at different terminal widths
6
+ - ✅ **ALWAYS** use numbered list format: `N - **Option**: Description`
7
+ - ✅ **ALWAYS** use status indicators: ✅ (done) ⏳ (current) [ ] (pending) 🚫 (blocked)
8
+
9
+ ## Success Metrics
10
+
11
+ - ✅ Activities presented as numbered lists (not tables)
12
+ - ✅ Stage progress shown with status indicators
13
+ - ✅ Human checkpoints clearly marked
14
+
15
+ ## Failure Modes
16
+
17
+ - ❌ Using ASCII table for activities
18
+ - ❌ Auto-advancing without human confirmation
19
+ - ❌ Skipping stages
20
+
21
+ ---
22
+
23
+ ## ⛔ CRITICAL: Stage Execution Sequence
24
+
25
+ **Stages MUST be executed in this exact order:**
26
+
27
+ ```text
28
+ Stage 1: Domain Model → Stage 2: Technical Design → Stage 3: ADR Analysis (optional) → Stage 4: Implement → Stage 5: Test
29
+ ```
30
+
31
+ **Stage Overview:**
32
+
33
+ - ✅/[ ] **1. Domain Model** (Required) → `ddd-01-domain-model.md`
34
+ - ✅/[ ] **2. Technical Design** (Required) → `ddd-02-technical-design.md`
35
+ - ✅/[ ] **3. ADR Analysis** (Optional) → `adr-{n}-{slug}.md` (zero or more)
36
+ - ✅/[ ] **4. Implement** (Required) → Source code
37
+ - ✅/[ ] **5. Test** (Required) → Tests + `ddd-03-test-report.md`
38
+
39
+ **Rules**:
40
+
41
+ - Each stage MUST be completed before the next begins
42
+ - Stage 3 can be skipped if no ADR-worthy decisions are identified
43
+ - **⛔ Human validation is MANDATORY at each stage checkpoint - STOP and WAIT for approval**
44
+ - NEVER skip to implementation without completing Domain Model and Technical Design
45
+ - NEVER auto-advance to next stage without explicit user confirmation
46
+
47
+ ---
48
+
49
+ ## Metadata
50
+
51
+ ```yaml
52
+ bolt_type: ddd-construction-bolt
53
+ name: DDD Construction Bolt
54
+ description: Domain-Driven Design construction with modeling, design, implementation, and testing
55
+ version: 2.0.0
56
+ suitable_for:
57
+ - Domain-heavy business logic
58
+ - Complex entity relationships
59
+ - Services requiring clear bounded contexts
60
+ stages_count: 5
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Overview
66
+
67
+ This bolt type implements Domain-Driven Design (DDD) methodology through five sequential stages. Each stage builds upon the previous, ensuring complete design before implementation.
68
+
69
+ **Best For**:
70
+
71
+ - Business logic with complex domain rules
72
+ - Systems requiring clear entity boundaries
73
+ - Services with rich domain models
74
+ - Applications needing ubiquitous language alignment
75
+
76
+ ---
77
+
78
+ ## Stages
79
+
80
+ ### Stage 1: Domain Model
81
+
82
+ **Objective**: Create a static domain model using DDD principles
83
+
84
+ **Duration**: Hours (typically 1-4 hours depending on complexity)
85
+
86
+ **⛔ CONSTRAINTS**:
87
+
88
+ - **FORBIDDEN**: Reading, analyzing, or modifying ANY source code files
89
+ - **ONLY OUTPUT**: Documentation artifact (`ddd-01-domain-model.md`)
90
+
91
+ **Activities**:
92
+
93
+ 1 - **Identify domain entities**: Document entities and their properties
94
+ 2 - **Define value objects**: Capture immutable objects with equality by value
95
+ 3 - **Model aggregates**: Define aggregate roots and their boundaries
96
+ 4 - **Capture domain events**: Document events triggered by domain operations
97
+ 5 - **Define domain services**: Design services for complex cross-entity operations
98
+ 6 - **Design repository interfaces**: Define contracts for data access
99
+ 7 - **Document ubiquitous language**: Create glossary of domain terms
100
+
101
+ **Artifact**: `ddd-01-domain-model.md`
102
+ **Template**: `.specsmd/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-01-domain-model-template.md`
103
+ **Location**: Path defined by `schema.bolts` in `.specsmd/aidlc/memory-bank.yaml`
104
+ *(Default: `memory-bank/bolts/{bolt-id}/ddd-01-domain-model.md`)*
105
+
106
+ **Template Structure**:
107
+
108
+ ```markdown
109
+ ---
110
+ stage: model
111
+ bolt: {bolt-id}
112
+ created: {YYYY-MM-DDTHH:MM:SSZ}
113
+ ---
114
+
115
+ ## Static Model: {unit-name}
116
+
117
+ ### Entities
118
+
119
+ - **{Entity Name}**: {Properties} - {Business Rules}
120
+ - **{Entity Name}**: {Properties} - {Business Rules}
121
+
122
+ ### Value Objects
123
+
124
+ - **{Value Object}**: {Properties} - {Constraints}
125
+
126
+ ### Aggregates
127
+
128
+ - **{Aggregate Root}**: Members: {list} - Invariants: {rules}
129
+
130
+ ### Domain Events
131
+
132
+ - **{Event Name}**: Trigger: {condition} - Payload: {data}
133
+
134
+ ### Domain Services
135
+
136
+ - **{Service Name}**: Operations: {list} - Dependencies: {list}
137
+
138
+ ### Repository Interfaces
139
+
140
+ - **{Repository Name}**: Entity: {type} - Methods: {list}
141
+
142
+ ### Ubiquitous Language
143
+
144
+ - **{Term}**: {Definition}
145
+ ```
146
+
147
+ **Completion Criteria**:
148
+
149
+ - [ ] All domain entities identified and documented
150
+ - [ ] Business rules captured for each entity
151
+ - [ ] Aggregate boundaries defined
152
+ - [ ] Domain events specified
153
+ - [ ] Repository interfaces defined
154
+ - [ ] All stories covered by domain model
155
+
156
+ **⛔ HUMAN Checkpoint**: Present completion summary and **STOP**. Wait for user to confirm before proceeding to Stage 2.
157
+
158
+ ---
159
+
160
+ ### Stage 2: Technical Design
161
+
162
+ **Objective**: Transform static model into technical architecture
163
+
164
+ **Duration**: Hours (typically 2-4 hours)
165
+
166
+ **⛔ CONSTRAINTS**:
167
+
168
+ - **FORBIDDEN**: Reading, analyzing, or modifying ANY source code files
169
+ - **ONLY OUTPUT**: Documentation artifact (`ddd-02-technical-design.md`)
170
+
171
+ **Activities**:
172
+
173
+ 1 - **Select architectural pattern**: Choose and document architecture decision
174
+ 2 - **Design layer structure**: Define responsibilities for each layer
175
+ 3 - **Design API contracts**: Create OpenAPI/GraphQL specifications
176
+ 4 - **Design data persistence**: Plan schema and migrations
177
+ 5 - **Apply security patterns**: Document security approach
178
+ 6 - **Design for NFRs**: Plan performance and scalability approach
179
+ 7 - **Plan integrations**: Document integration points
180
+
181
+ **Artifact**: `ddd-02-technical-design.md`
182
+ **Template**: `.specsmd/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-02-technical-design-template.md`
183
+ **Location**: Path defined by `schema.bolts` in `.specsmd/aidlc/memory-bank.yaml`
184
+ *(Default: `memory-bank/bolts/{bolt-id}/ddd-02-technical-design.md`)*
185
+
186
+ **Template Structure**:
187
+
188
+ ```markdown
189
+ ---
190
+ stage: design
191
+ bolt: {bolt-id}
192
+ created: {YYYY-MM-DDTHH:MM:SSZ}
193
+ ---
194
+
195
+ ## Technical Design: {unit-name}
196
+
197
+ ### Architecture Pattern
198
+ {Selected pattern and rationale}
199
+
200
+ ### Layer Structure
201
+ ​```text
202
+
203
+ ┌─────────────────────────────┐
204
+ │ Presentation │ API/UI
205
+ ├─────────────────────────────┤
206
+ │ Application │ Use Cases
207
+ ├─────────────────────────────┤
208
+ │ Domain │ Business Logic
209
+ ├─────────────────────────────┤
210
+ │ Infrastructure │ Database/External
211
+ └─────────────────────────────┘
212
+
213
+ ​```
214
+
215
+ ### API Design
216
+
217
+ - **{Endpoint}**: {Method} - Request: {schema} - Response: {schema}
218
+
219
+ ### Data Model
220
+
221
+ - **{Table}**: Columns: {list} - Relationships: {list}
222
+
223
+ ### Security Design
224
+
225
+ - **{Concern}**: {Approach}
226
+
227
+ ### NFR Implementation
228
+
229
+ - **{Requirement}**: {Design Approach}
230
+ ```
231
+
232
+ **Completion Criteria**:
233
+
234
+ - [ ] Architecture pattern selected and documented
235
+ - [ ] All layers designed with responsibilities
236
+ - [ ] API contracts defined
237
+ - [ ] Database schema designed
238
+ - [ ] NFRs addressed in design
239
+ - [ ] Security patterns applied
240
+
241
+ **⛔ HUMAN Checkpoint**: Present completion summary and **STOP**. Wait for user to confirm before proceeding to Stage 3.
242
+
243
+ ---
244
+
245
+ ### Stage 3: ADR Analysis (Optional)
246
+
247
+ **Objective**: Capture significant architectural decisions before implementation
248
+
249
+ **Duration**: Minutes to hours (depends on complexity and number of ADRs)
250
+
251
+ **⛔ CONSTRAINTS**:
252
+
253
+ - **OPTIONAL**: This stage can be skipped if no ADR-worthy decisions are identified
254
+ - **REQUIRED**: Must have completed `Domain Model` and `Technical Design` stages first
255
+ - **OUTPUT**: ADR documents (if any created)
256
+
257
+ **When to Create ADRs**:
258
+
259
+ Suggest an ADR when you identify:
260
+
261
+ - **New architectural pattern not in standards**: CQRS, event sourcing, saga → Not in standards, affects future development
262
+ - **Technology choice not covered by tech-stack**: New library or service → Team should understand the rationale
263
+ - **Trade-off decision**: Performance vs simplicity, consistency vs availability → Documents "why" for future reference
264
+ - **Security/compliance approach**: Auth strategy, data handling → Critical decisions need justification
265
+ - **Integration pattern**: API design, event contracts → Affects other systems/teams
266
+ - **Intentional deviation from standards**: Exception with reasoning → Prevents confusion, documents reasoning
267
+
268
+ **Activities**:
269
+
270
+ 1 - **Review domain model and technical design**: Understand decisions made
271
+ 2 - **Compare against project standards**: Identify gaps
272
+ 3 - **Identify ADR-worthy decisions**: Create decision list
273
+ 4 - **Present opportunities to user**: Get user selection
274
+ 5 - **Create ADR documents**: Generate selected ADRs
275
+ 6 - **Update decision index**: Add entries to `memory-bank/standards/decision-index.md`
276
+
277
+ **Artifact**: `adr-{number}-{slug}.md` (zero or more)
278
+ **Template**: `.specsmd/aidlc/templates/construction/bolt-types/ddd-construction-bolt/adr-template.md`
279
+ **Location**: `memory-bank/bolts/{bolt-id}/adr-{number}-{slug}.md`
280
+
281
+ **ADR Analysis Process**:
282
+
283
+ 1. Review stories, domain model, and technical design
284
+ 2. Compare against loaded project standards
285
+ 3. If decision-worthy patterns detected, present opportunities to user
286
+ 4. Handle user response (create selected ADRs or skip)
287
+ 5. Update decision index (if ADRs created) and proceed to checkpoint
288
+
289
+ **Step 3 Output Format**:
290
+
291
+ ```markdown
292
+ ## Potential ADR Opportunities
293
+
294
+ Based on this bolt's scope, I identified decisions that may benefit from an ADR:
295
+
296
+ 1 - **{decision description}**: {why this warrants an ADR}
297
+ 2 - **{decision description}**: {why this warrants an ADR}
298
+
299
+ Would you like to create ADRs for any of these? (Enter numbers, "all", or "skip")
300
+ ```
301
+
302
+ **Step 4 Decision Handling**:
303
+
304
+ - **User selects numbers or "all"** → Generate ADRs using template, then update decision index
305
+ - **User selects "skip"** → Proceed to checkpoint with "No ADRs created"
306
+ - **No ADR opportunities identified** → Auto-proceed to checkpoint with "No ADR-worthy decisions found"
307
+
308
+ **Step 5 Decision Index Update**:
309
+
310
+ For each ADR created, add an entry to `memory-bank/standards/decision-index.md`:
311
+
312
+ 1. If `decision-index.md` doesn't exist, create it from template: `.specsmd/aidlc/templates/standards/decision-index-template.md`
313
+ 2. Add entry for each ADR in the following format:
314
+
315
+ ```markdown
316
+ ### ADR-{n}: {title}
317
+ - **Status**: {status from ADR frontmatter}
318
+ - **Date**: {YYYY-MM-DD from ADR created timestamp}
319
+ - **Bolt**: {bolt-id} ({unit-name})
320
+ - **Path**: `bolts/{bolt-id}/adr-{n}-{slug}.md`
321
+ - **Summary**: {First sentence from Context section}. {First sentence from Decision section}.
322
+ - **Read when**: {Generate guidance based on the ADR's domain - describe scenarios when agents should read this ADR}
323
+ ```
324
+
325
+ Update frontmatter: increment `total_decisions`, update `last_updated` timestamp
326
+
327
+ **"Read when" Guidance Examples**:
328
+
329
+ - "Working on authentication flows or session management"
330
+ - "Implementing caching strategies or data persistence patterns"
331
+ - "Designing API contracts or integration points"
332
+ - "Handling error cases or implementing retry logic"
333
+
334
+ **Example ADR**:
335
+
336
+ ```markdown
337
+ # ADR-001: Use CQRS for Task Queries
338
+
339
+ ## Context
340
+ Task list requires complex filtering and sorting that doesn't align with write model.
341
+
342
+ ## Decision
343
+ Implement CQRS pattern with separate read models for task queries.
344
+
345
+ ## Rationale
346
+ - Write model optimized for domain invariants
347
+ - Read model optimized for query performance
348
+ - Allows independent scaling
349
+
350
+ ## Consequences
351
+ - Additional complexity in sync
352
+ - Need event-driven updates to read model
353
+ ```
354
+
355
+ **Completion Criteria**:
356
+
357
+ - [ ] Domain model and technical design reviewed for decisions
358
+ - [ ] Project standards compared
359
+ - [ ] User presented with ADR opportunities (if any)
360
+ - [ ] Selected ADRs created (or explicitly skipped)
361
+ - [ ] Decision index updated (if ADRs were created)
362
+
363
+ **Important**: Do not force ADRs. Only suggest when there's genuine value. Simple bolts with straightforward decisions don't need ADRs.
364
+
365
+ **⛔ HUMAN Checkpoint**: Present ADR summary (created or skipped) and **STOP**. Wait for user to confirm before proceeding to Stage 4.
366
+
367
+ ---
368
+
369
+ ### Stage 4: Implement
370
+
371
+ **Objective**: Generate production-ready code from designs
372
+
373
+ **Duration**: Hours to days (varies by complexity)
374
+
375
+ **⛔ CONSTRAINTS**:
376
+
377
+ - **REQUIRED**: Must have completed `model` and `design` stages first
378
+ - **REQUIRED**: Load all bolt folder artifacts (see Bolt Context Loading section)
379
+ - **OUTPUT**: Source code based on design docs
380
+
381
+ **Activities**:
382
+
383
+ 1 - **Setup project structure**: Create scaffolding
384
+ 2 - **Implement domain entities/value objects**: Create domain code
385
+ 3 - **Implement domain services**: Build service layer
386
+ 4 - **Implement application layer**: Create use cases
387
+ 5 - **Implement infrastructure**: Build repository implementations
388
+ 6 - **Implement presentation layer**: Create API endpoints
389
+ 7 - **Add validation and error handling**: Implement guards and handlers
390
+ 8 - **Add logging and instrumentation**: Add observability code
391
+
392
+ **Artifact**: Source code in unit directory
393
+ **Location**: `src/{unit}/` or as defined in project structure
394
+
395
+ **Project Structure**:
396
+
397
+ ```text
398
+ src/{unit}/
399
+ ├── domain/
400
+ │ ├── entities/
401
+ │ ├── value-objects/
402
+ │ ├── services/
403
+ │ └── events/
404
+ ├── application/
405
+ │ ├── use-cases/
406
+ │ └── dto/
407
+ ├── infrastructure/
408
+ │ ├── repositories/
409
+ │ └── external/
410
+ └── presentation/
411
+ ├── controllers/
412
+ └── middleware/
413
+ ```
414
+
415
+ **Completion Criteria**:
416
+
417
+ - [ ] All domain models implemented
418
+ - [ ] All use cases implemented
419
+ - [ ] All API endpoints implemented
420
+ - [ ] Database connectivity working
421
+ - [ ] Validation and error handling in place
422
+ - [ ] Code documented
423
+ - [ ] Linting passing
424
+
425
+ **⛔ HUMAN Checkpoint**: Present implementation summary and **STOP**. Wait for user to confirm before proceeding to Stage 5.
426
+
427
+ ---
428
+
429
+ ### Stage 5: Test
430
+
431
+ **Objective**: Ensure quality through comprehensive testing
432
+
433
+ **Duration**: Hours (typically 2-6 hours)
434
+
435
+ **⛔ CONSTRAINTS**:
436
+
437
+ - **REQUIRED**: Must have completed `Implement` stage first
438
+ - **REQUIRED**: Load all bolt folder artifacts (see Bolt Context Loading section)
439
+ - **OUTPUT**: Tests + documentation artifact (`ddd-03-test-report.md`)
440
+
441
+ **Activities**:
442
+
443
+ 1 - **Write unit tests**: Test domain logic
444
+ 2 - **Write integration tests**: Test API endpoints
445
+ 3 - **Write security tests**: Validate security controls
446
+ 4 - **Write performance tests**: Load and stress tests
447
+ 5 - **Run all tests**: Execute test suite
448
+ 6 - **Measure coverage**: Generate coverage report
449
+ 7 - **Verify acceptance criteria**: Validate against stories
450
+
451
+ **Artifact**: `ddd-03-test-report.md`
452
+ **Template**: `.specsmd/aidlc/templates/construction/bolt-types/ddd-construction-bolt/ddd-03-test-report-template.md`
453
+ **Location**: Path defined by `schema.bolts` in `.specsmd/aidlc/memory-bank.yaml`
454
+ *(Default: `memory-bank/bolts/{bolt-id}/ddd-03-test-report.md`)*
455
+
456
+ **Test Structure**:
457
+
458
+ ```text
459
+ tests/
460
+ ├── unit/ # Domain logic tests
461
+ ├── integration/ # API tests
462
+ ├── security/ # Security tests
463
+ └── performance/ # Load tests
464
+ ```
465
+
466
+ **Template Structure**:
467
+
468
+ ```markdown
469
+ ---
470
+ stage: test
471
+ bolt: {bolt-id}
472
+ created: {YYYY-MM-DDTHH:MM:SSZ}
473
+ ---
474
+
475
+ ## Test Report: {unit-name}
476
+
477
+ ### Summary
478
+
479
+ - **Unit Tests**: {passed}/{total} passed, {coverage}% coverage
480
+ - **Integration Tests**: {passed}/{total} passed
481
+ - **Security Tests**: {passed}/{total} passed
482
+ - **Performance Tests**: {passed}/{total} passed
483
+
484
+ ### Acceptance Criteria Validation
485
+
486
+ - ✅/❌ **{Story}**: {Criteria} - {Status}
487
+
488
+ ### Issues Found
489
+ {Any issues discovered during testing}
490
+
491
+ ### Recommendations
492
+ {Improvements or follow-ups needed}
493
+ ```
494
+
495
+ **Completion Criteria**:
496
+
497
+ - [ ] All unit tests passing
498
+ - [ ] All integration tests passing
499
+ - [ ] Security tests passing
500
+ - [ ] Performance tests meet targets
501
+ - [ ] Code coverage > 80%
502
+ - [ ] All acceptance criteria met
503
+
504
+ **⛔ HUMAN Checkpoint**: Present test report and **STOP**. Wait for user to confirm bolt completion.
505
+
506
+ ---
507
+
508
+ ## State Tracking
509
+
510
+ Bolt instance tracks progress:
511
+
512
+ ```yaml
513
+ ---
514
+ current_stage: design
515
+ stages_completed:
516
+ - name: model
517
+ completed: 2024-12-05T10:00:00Z
518
+ artifact: ddd-01-domain-model.md
519
+ status: in-progress
520
+ ---
521
+ ```
522
+
523
+ ---
524
+
525
+ ## Bolt Context Loading
526
+
527
+ ### Prior Decision Lookup (All Stages)
528
+
529
+ **Before starting any stage**, scan the decision index for relevant prior ADRs:
530
+
531
+ 1. Read `memory-bank/standards/decision-index.md` (if it exists)
532
+ 2. Match the current bolt's domain/scope against "Read when" fields
533
+ 3. Load full ADRs for any matching entries
534
+ 4. Consider these decisions as constraints or guidance for the current work
535
+
536
+ **Example**: If working on a bolt for "user-service" and the decision index contains:
537
+
538
+ ```text
539
+ ### ADR-001: Use JWT for Authentication
540
+ - **Read when**: Working on authentication flows or user services
541
+ ```
542
+
543
+ → Load and consider `ADR-001` before starting design work.
544
+
545
+ **Present relevant ADRs to user** at bolt start:
546
+
547
+ ```text
548
+ ## Relevant Prior Decisions
549
+
550
+ Found {n} ADR(s) that may apply to this bolt:
551
+ - ADR-001: Use JWT for Authentication → [View](bolts/001-auth-service/adr-001-jwt-auth.md)
552
+
553
+ These decisions may constrain or guide your approach. Proceed? (y/n)
554
+ ```
555
+
556
+ ### Bolt Folder Artifacts (Stages 4-5)
557
+
558
+ For stages that build on previous work (Stage 4: Implement, Stage 5: Test), load all artifacts from the bolt folder:
559
+
560
+ **Location**: `memory-bank/bolts/{bolt-id}/`
561
+
562
+ **Load all files in this folder**, which may include:
563
+
564
+ - `bolt.md` - Bolt instance metadata
565
+ - `ddd-01-domain-model.md` - Domain model from Stage 1
566
+ - `ddd-02-technical-design.md` - Technical design from Stage 2
567
+ - `adr-*.md` - Any ADRs from Stage 3
568
+
569
+ This ensures the implementation and test stages have full context from earlier design work.
570
+
571
+ ---
572
+
573
+ ## Usage by Construction Agent
574
+
575
+ 1. **Load bolt instance** from path defined by `schema.bolts`
576
+ 2. **Read `bolt_type` field** (e.g., `ddd-construction-bolt`)
577
+ 3. **Load this definition** from `.specsmd/aidlc/templates/construction/bolt-types/`
578
+ 4. **Scan decision index** for relevant prior ADRs (see Prior Decision Lookup)
579
+ 5. **Present relevant ADRs** to user if any found, get confirmation to proceed
580
+ 6. **Check `current_stage`** in bolt instance
581
+ 7. **Load bolt folder artifacts** if stage requires previous context (see Bolt Folder Artifacts)
582
+ 8. **Execute stage** following activities defined here
583
+ 9. **Create artifacts** using templates
584
+ 10. **⛔ STOP and present completion summary** - DO NOT continue automatically
585
+ 11. **Wait for user confirmation** - user must explicitly approve (e.g., "continue", "proceed", "next")
586
+ 12. **Only after approval**: Update bolt state and advance to next stage
587
+
588
+ **⛔ CRITICAL**: Steps 10-11 are MANDATORY. Never skip the human checkpoint. Never auto-advance.
589
+
590
+ The Construction Agent is **bolt-type agnostic** - it reads stages from this file and executes them.