musubi-sdd 5.0.0 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/README.ja.md +106 -48
  2. package/README.md +110 -32
  3. package/bin/musubi-analyze.js +74 -67
  4. package/bin/musubi-browser.js +27 -26
  5. package/bin/musubi-change.js +48 -47
  6. package/bin/musubi-checkpoint.js +10 -7
  7. package/bin/musubi-convert.js +25 -25
  8. package/bin/musubi-costs.js +27 -10
  9. package/bin/musubi-gui.js +52 -46
  10. package/bin/musubi-init.js +1952 -10
  11. package/bin/musubi-orchestrate.js +327 -239
  12. package/bin/musubi-remember.js +69 -56
  13. package/bin/musubi-resolve.js +53 -45
  14. package/bin/musubi-trace.js +51 -22
  15. package/bin/musubi-validate.js +39 -30
  16. package/bin/musubi-workflow.js +33 -34
  17. package/bin/musubi.js +39 -2
  18. package/package.json +1 -1
  19. package/src/agents/agent-loop.js +94 -95
  20. package/src/agents/agentic/code-generator.js +119 -109
  21. package/src/agents/agentic/code-reviewer.js +105 -108
  22. package/src/agents/agentic/index.js +4 -4
  23. package/src/agents/browser/action-executor.js +13 -13
  24. package/src/agents/browser/ai-comparator.js +11 -10
  25. package/src/agents/browser/context-manager.js +6 -6
  26. package/src/agents/browser/index.js +5 -5
  27. package/src/agents/browser/nl-parser.js +31 -46
  28. package/src/agents/browser/screenshot.js +2 -2
  29. package/src/agents/browser/test-generator.js +6 -4
  30. package/src/agents/function-tool.js +71 -65
  31. package/src/agents/index.js +7 -7
  32. package/src/agents/schema-generator.js +98 -94
  33. package/src/analyzers/ast-extractor.js +164 -145
  34. package/src/analyzers/codegraph-auto-update.js +858 -0
  35. package/src/analyzers/complexity-analyzer.js +536 -0
  36. package/src/analyzers/context-optimizer.js +247 -125
  37. package/src/analyzers/impact-analyzer.js +1 -1
  38. package/src/analyzers/large-project-analyzer.js +766 -0
  39. package/src/analyzers/repository-map.js +83 -80
  40. package/src/analyzers/security-analyzer.js +19 -11
  41. package/src/analyzers/stuck-detector.js +19 -17
  42. package/src/converters/index.js +78 -57
  43. package/src/converters/ir/types.js +12 -12
  44. package/src/converters/parsers/musubi-parser.js +134 -126
  45. package/src/converters/parsers/openapi-parser.js +70 -53
  46. package/src/converters/parsers/speckit-parser.js +239 -175
  47. package/src/converters/writers/musubi-writer.js +123 -118
  48. package/src/converters/writers/speckit-writer.js +124 -113
  49. package/src/generators/rust-migration-generator.js +512 -0
  50. package/src/gui/public/index.html +1365 -1211
  51. package/src/gui/server.js +41 -40
  52. package/src/gui/services/file-watcher.js +23 -8
  53. package/src/gui/services/project-scanner.js +26 -20
  54. package/src/gui/services/replanning-service.js +27 -23
  55. package/src/gui/services/traceability-service.js +8 -8
  56. package/src/gui/services/workflow-service.js +14 -7
  57. package/src/index.js +151 -0
  58. package/src/integrations/cicd.js +90 -104
  59. package/src/integrations/codegraph-mcp.js +643 -0
  60. package/src/integrations/documentation.js +142 -103
  61. package/src/integrations/examples.js +95 -80
  62. package/src/integrations/github-client.js +17 -17
  63. package/src/integrations/index.js +5 -5
  64. package/src/integrations/mcp/index.js +21 -21
  65. package/src/integrations/mcp/mcp-context-provider.js +76 -78
  66. package/src/integrations/mcp/mcp-discovery.js +74 -72
  67. package/src/integrations/mcp/mcp-tool-registry.js +99 -94
  68. package/src/integrations/mcp-connector.js +70 -66
  69. package/src/integrations/platforms.js +50 -49
  70. package/src/integrations/tool-discovery.js +37 -31
  71. package/src/llm-providers/anthropic-provider.js +11 -11
  72. package/src/llm-providers/base-provider.js +16 -18
  73. package/src/llm-providers/copilot-provider.js +22 -19
  74. package/src/llm-providers/index.js +26 -25
  75. package/src/llm-providers/ollama-provider.js +11 -11
  76. package/src/llm-providers/openai-provider.js +12 -12
  77. package/src/managers/agent-memory.js +36 -24
  78. package/src/managers/checkpoint-manager.js +4 -8
  79. package/src/managers/delta-spec.js +19 -19
  80. package/src/managers/index.js +13 -4
  81. package/src/managers/memory-condenser.js +35 -45
  82. package/src/managers/repo-skill-manager.js +57 -31
  83. package/src/managers/skill-loader.js +25 -22
  84. package/src/managers/skill-tools.js +36 -72
  85. package/src/managers/workflow.js +30 -22
  86. package/src/monitoring/cost-tracker.js +53 -44
  87. package/src/monitoring/incident-manager.js +123 -103
  88. package/src/monitoring/index.js +144 -134
  89. package/src/monitoring/observability.js +82 -59
  90. package/src/monitoring/quality-dashboard.js +51 -39
  91. package/src/monitoring/release-manager.js +70 -50
  92. package/src/orchestration/agent-skill-binding.js +39 -47
  93. package/src/orchestration/error-handler.js +65 -107
  94. package/src/orchestration/guardrails/base-guardrail.js +26 -24
  95. package/src/orchestration/guardrails/guardrail-rules.js +50 -64
  96. package/src/orchestration/guardrails/index.js +5 -5
  97. package/src/orchestration/guardrails/input-guardrail.js +58 -45
  98. package/src/orchestration/guardrails/output-guardrail.js +104 -81
  99. package/src/orchestration/guardrails/safety-check.js +79 -79
  100. package/src/orchestration/index.js +38 -55
  101. package/src/orchestration/mcp-tool-adapters.js +96 -99
  102. package/src/orchestration/orchestration-engine.js +21 -21
  103. package/src/orchestration/pattern-registry.js +60 -45
  104. package/src/orchestration/patterns/auto.js +34 -47
  105. package/src/orchestration/patterns/group-chat.js +59 -65
  106. package/src/orchestration/patterns/handoff.js +67 -65
  107. package/src/orchestration/patterns/human-in-loop.js +51 -72
  108. package/src/orchestration/patterns/nested.js +25 -40
  109. package/src/orchestration/patterns/sequential.js +35 -34
  110. package/src/orchestration/patterns/swarm.js +63 -56
  111. package/src/orchestration/patterns/triage.js +150 -109
  112. package/src/orchestration/reasoning/index.js +9 -9
  113. package/src/orchestration/reasoning/planning-engine.js +143 -140
  114. package/src/orchestration/reasoning/reasoning-engine.js +206 -144
  115. package/src/orchestration/reasoning/self-correction.js +121 -128
  116. package/src/orchestration/replanning/adaptive-goal-modifier.js +107 -112
  117. package/src/orchestration/replanning/alternative-generator.js +37 -42
  118. package/src/orchestration/replanning/config.js +63 -59
  119. package/src/orchestration/replanning/goal-progress-tracker.js +98 -100
  120. package/src/orchestration/replanning/index.js +24 -20
  121. package/src/orchestration/replanning/plan-evaluator.js +49 -50
  122. package/src/orchestration/replanning/plan-monitor.js +32 -28
  123. package/src/orchestration/replanning/proactive-path-optimizer.js +175 -178
  124. package/src/orchestration/replanning/replan-history.js +33 -26
  125. package/src/orchestration/replanning/replanning-engine.js +106 -108
  126. package/src/orchestration/skill-executor.js +107 -109
  127. package/src/orchestration/skill-registry.js +85 -89
  128. package/src/orchestration/workflow-examples.js +228 -231
  129. package/src/orchestration/workflow-executor.js +65 -68
  130. package/src/orchestration/workflow-orchestrator.js +72 -73
  131. package/src/phase4-integration.js +47 -40
  132. package/src/phase5-integration.js +89 -30
  133. package/src/reporters/coverage-report.js +82 -30
  134. package/src/reporters/hierarchical-reporter.js +498 -0
  135. package/src/reporters/traceability-matrix-report.js +29 -20
  136. package/src/resolvers/issue-resolver.js +43 -31
  137. package/src/steering/advanced-validation.js +133 -124
  138. package/src/steering/auto-updater.js +60 -73
  139. package/src/steering/index.js +6 -6
  140. package/src/steering/quality-metrics.js +41 -35
  141. package/src/steering/steering-auto-update.js +83 -86
  142. package/src/steering/steering-validator.js +98 -106
  143. package/src/steering/template-constraints.js +53 -54
  144. package/src/templates/agents/claude-code/CLAUDE.md +32 -32
  145. package/src/templates/agents/claude-code/skills/agent-assistant/SKILL.md +13 -5
  146. package/src/templates/agents/claude-code/skills/ai-ml-engineer/mlops-guide.md +23 -23
  147. package/src/templates/agents/claude-code/skills/ai-ml-engineer/model-card-template.md +60 -41
  148. package/src/templates/agents/claude-code/skills/api-designer/api-patterns.md +27 -19
  149. package/src/templates/agents/claude-code/skills/api-designer/openapi-template.md +11 -7
  150. package/src/templates/agents/claude-code/skills/bug-hunter/SKILL.md +4 -3
  151. package/src/templates/agents/claude-code/skills/bug-hunter/root-cause-analysis.md +37 -15
  152. package/src/templates/agents/claude-code/skills/change-impact-analyzer/dependency-graph-patterns.md +36 -42
  153. package/src/templates/agents/claude-code/skills/change-impact-analyzer/impact-analysis-template.md +69 -60
  154. package/src/templates/agents/claude-code/skills/cloud-architect/aws-patterns.md +31 -38
  155. package/src/templates/agents/claude-code/skills/cloud-architect/azure-patterns.md +28 -23
  156. package/src/templates/agents/claude-code/skills/code-reviewer/SKILL.md +61 -0
  157. package/src/templates/agents/claude-code/skills/code-reviewer/best-practices.md +27 -0
  158. package/src/templates/agents/claude-code/skills/code-reviewer/review-checklist.md +29 -10
  159. package/src/templates/agents/claude-code/skills/code-reviewer/review-standards.md +29 -24
  160. package/src/templates/agents/claude-code/skills/constitution-enforcer/SKILL.md +8 -6
  161. package/src/templates/agents/claude-code/skills/constitution-enforcer/constitutional-articles.md +62 -26
  162. package/src/templates/agents/claude-code/skills/constitution-enforcer/phase-minus-one-gates.md +35 -16
  163. package/src/templates/agents/claude-code/skills/database-administrator/backup-recovery.md +27 -17
  164. package/src/templates/agents/claude-code/skills/database-administrator/tuning-guide.md +25 -20
  165. package/src/templates/agents/claude-code/skills/database-schema-designer/schema-patterns.md +39 -22
  166. package/src/templates/agents/claude-code/skills/devops-engineer/ci-cd-templates.md +25 -22
  167. package/src/templates/agents/claude-code/skills/issue-resolver/SKILL.md +24 -21
  168. package/src/templates/agents/claude-code/skills/orchestrator/SKILL.md +148 -63
  169. package/src/templates/agents/claude-code/skills/orchestrator/patterns.md +35 -16
  170. package/src/templates/agents/claude-code/skills/orchestrator/selection-matrix.md +69 -64
  171. package/src/templates/agents/claude-code/skills/performance-engineer/optimization-playbook.md +47 -47
  172. package/src/templates/agents/claude-code/skills/performance-optimizer/SKILL.md +69 -0
  173. package/src/templates/agents/claude-code/skills/performance-optimizer/benchmark-template.md +63 -45
  174. package/src/templates/agents/claude-code/skills/performance-optimizer/optimization-patterns.md +33 -35
  175. package/src/templates/agents/claude-code/skills/project-manager/SKILL.md +7 -6
  176. package/src/templates/agents/claude-code/skills/project-manager/agile-ceremonies.md +47 -28
  177. package/src/templates/agents/claude-code/skills/project-manager/project-templates.md +94 -78
  178. package/src/templates/agents/claude-code/skills/quality-assurance/SKILL.md +20 -17
  179. package/src/templates/agents/claude-code/skills/quality-assurance/qa-plan-template.md +63 -49
  180. package/src/templates/agents/claude-code/skills/release-coordinator/SKILL.md +5 -5
  181. package/src/templates/agents/claude-code/skills/release-coordinator/feature-flag-guide.md +30 -26
  182. package/src/templates/agents/claude-code/skills/release-coordinator/release-plan-template.md +67 -35
  183. package/src/templates/agents/claude-code/skills/requirements-analyst/ears-format.md +54 -42
  184. package/src/templates/agents/claude-code/skills/requirements-analyst/validation-rules.md +36 -33
  185. package/src/templates/agents/claude-code/skills/security-auditor/SKILL.md +77 -19
  186. package/src/templates/agents/claude-code/skills/security-auditor/audit-checklists.md +24 -24
  187. package/src/templates/agents/claude-code/skills/security-auditor/owasp-top-10.md +61 -20
  188. package/src/templates/agents/claude-code/skills/security-auditor/vulnerability-patterns.md +43 -11
  189. package/src/templates/agents/claude-code/skills/site-reliability-engineer/SKILL.md +1 -0
  190. package/src/templates/agents/claude-code/skills/site-reliability-engineer/incident-response-template.md +55 -25
  191. package/src/templates/agents/claude-code/skills/site-reliability-engineer/observability-patterns.md +78 -68
  192. package/src/templates/agents/claude-code/skills/site-reliability-engineer/slo-sli-guide.md +73 -53
  193. package/src/templates/agents/claude-code/skills/software-developer/solid-principles.md +83 -37
  194. package/src/templates/agents/claude-code/skills/software-developer/test-first-workflow.md +38 -31
  195. package/src/templates/agents/claude-code/skills/steering/SKILL.md +1 -0
  196. package/src/templates/agents/claude-code/skills/steering/auto-update-rules.md +31 -0
  197. package/src/templates/agents/claude-code/skills/system-architect/adr-template.md +25 -7
  198. package/src/templates/agents/claude-code/skills/system-architect/c4-model-guide.md +74 -61
  199. package/src/templates/agents/claude-code/skills/technical-writer/doc-templates/documentation-templates.md +70 -52
  200. package/src/templates/agents/claude-code/skills/test-engineer/SKILL.md +2 -0
  201. package/src/templates/agents/claude-code/skills/test-engineer/ears-test-mapping.md +75 -71
  202. package/src/templates/agents/claude-code/skills/test-engineer/test-types.md +85 -63
  203. package/src/templates/agents/claude-code/skills/traceability-auditor/coverage-matrix-template.md +39 -36
  204. package/src/templates/agents/claude-code/skills/traceability-auditor/gap-detection-rules.md +22 -17
  205. package/src/templates/agents/claude-code/skills/ui-ux-designer/SKILL.md +1 -0
  206. package/src/templates/agents/claude-code/skills/ui-ux-designer/accessibility-guidelines.md +49 -75
  207. package/src/templates/agents/claude-code/skills/ui-ux-designer/design-system-components.md +71 -59
  208. package/src/templates/agents/codex/AGENTS.md +74 -42
  209. package/src/templates/agents/cursor/AGENTS.md +74 -42
  210. package/src/templates/agents/gemini-cli/GEMINI.md +74 -42
  211. package/src/templates/agents/github-copilot/AGENTS.md +83 -51
  212. package/src/templates/agents/qwen-code/QWEN.md +74 -42
  213. package/src/templates/agents/windsurf/AGENTS.md +74 -42
  214. package/src/templates/architectures/README.md +41 -0
  215. package/src/templates/architectures/clean-architecture/README.md +113 -0
  216. package/src/templates/architectures/event-driven/README.md +162 -0
  217. package/src/templates/architectures/hexagonal/README.md +130 -0
  218. package/src/templates/index.js +6 -1
  219. package/src/templates/locale-manager.js +16 -16
  220. package/src/templates/shared/delta-spec-template.md +20 -13
  221. package/src/templates/shared/github-actions/musubi-issue-resolver.yml +5 -5
  222. package/src/templates/shared/github-actions/musubi-security-check.yml +3 -3
  223. package/src/templates/shared/github-actions/musubi-validate.yml +4 -4
  224. package/src/templates/shared/steering/structure.md +95 -0
  225. package/src/templates/skills/browser-agent.md +21 -16
  226. package/src/templates/skills/web-gui.md +8 -0
  227. package/src/templates/template-constraints.js +50 -53
  228. package/src/validators/advanced-validation.js +30 -36
  229. package/src/validators/constitutional-validator.js +77 -73
  230. package/src/validators/critic-system.js +49 -59
  231. package/src/validators/delta-format.js +59 -55
  232. package/src/validators/traceability-validator.js +7 -11
@@ -11,12 +11,14 @@ The 9 Constitutional Articles define immutable governance rules for MUSUBI SDD.
11
11
  > **Every feature MUST begin as a standalone library.**
12
12
 
13
13
  ### Rationale
14
+
14
15
  - Libraries are reusable across projects
15
16
  - Encourages modular design
16
17
  - Enables testing in isolation
17
18
  - Prevents tight coupling to frameworks
18
19
 
19
20
  ### Compliance Criteria
21
+
20
22
  ```
21
23
  ✅ COMPLIANT:
22
24
  - Feature implemented in lib/[feature]/
@@ -30,6 +32,7 @@ The 9 Constitutional Articles define immutable governance rules for MUSUBI SDD.
30
32
  ```
31
33
 
32
34
  ### Enforcement
35
+
33
36
  ```bash
34
37
  # Check implementation location
35
38
  if [[ "$feature_path" =~ ^(src/app/|web/) ]]; then
@@ -46,12 +49,14 @@ fi
46
49
  > **All libraries MUST expose CLI interfaces.**
47
50
 
48
51
  ### Rationale
52
+
49
53
  - CLI enables testing without UI
50
54
  - Supports automation and scripting
51
55
  - Provides consistent interface across platforms
52
56
  - Enables quick validation and debugging
53
57
 
54
58
  ### Compliance Criteria
59
+
55
60
  ```
56
61
  ✅ COMPLIANT:
57
62
  - lib/auth/cli.ts or lib/auth/__main__.py exists
@@ -65,6 +70,7 @@ fi
65
70
  ```
66
71
 
67
72
  ### Enforcement
73
+
68
74
  ```bash
69
75
  # Check for CLI entry point
70
76
  cli_files=("cli.ts" "cli.js" "__main__.py" "main.go")
@@ -89,12 +95,14 @@ done
89
95
  > **NON-NEGOTIABLE: No code before tests.**
90
96
 
91
97
  ### Rationale
98
+
92
99
  - Tests define expected behavior
93
100
  - Prevents untested code from entering codebase
94
101
  - Enforces Red-Green-Refactor discipline
95
102
  - Creates living documentation
96
103
 
97
104
  ### Compliance Criteria
105
+
98
106
  ```
99
107
  ✅ COMPLIANT:
100
108
  - Test file committed before source file
@@ -108,11 +116,12 @@ done
108
116
  ```
109
117
 
110
118
  ### Enforcement
119
+
111
120
  ```bash
112
121
  # Check git history for test-first
113
122
  for commit in $(git log --oneline feature-branch..HEAD); do
114
123
  files=$(git show --name-only $commit)
115
-
124
+
116
125
  # Check if source files added before tests
117
126
  if echo "$files" | grep -q "src/" && ! echo "$files" | grep -q "test"; then
118
127
  # Check previous commits for tests
@@ -131,21 +140,24 @@ done
131
140
  > **All requirements MUST use EARS patterns.**
132
141
 
133
142
  ### Rationale
143
+
134
144
  - Unambiguous requirement language
135
145
  - Testable specifications
136
146
  - Industry-standard format
137
147
  - Reduces misinterpretation
138
148
 
139
149
  ### EARS Patterns
140
- | Pattern | Template | Use Case |
141
- |---------|----------|----------|
142
- | Ubiquitous | The system SHALL [action] | Always applicable |
143
- | Event-driven | WHEN [event] the system SHALL [action] | Triggered by event |
144
- | State-driven | WHILE [state] the system SHALL [action] | During condition |
145
- | Optional | WHERE [feature] the system SHALL [action] | Optional features |
146
- | Unwanted | IF [condition] THEN the system SHALL [action] | Error handling |
150
+
151
+ | Pattern | Template | Use Case |
152
+ | ------------ | --------------------------------------------- | ------------------ |
153
+ | Ubiquitous | The system SHALL [action] | Always applicable |
154
+ | Event-driven | WHEN [event] the system SHALL [action] | Triggered by event |
155
+ | State-driven | WHILE [state] the system SHALL [action] | During condition |
156
+ | Optional | WHERE [feature] the system SHALL [action] | Optional features |
157
+ | Unwanted | IF [condition] THEN the system SHALL [action] | Error handling |
147
158
 
148
159
  ### Compliance Criteria
160
+
149
161
  ```
150
162
  ✅ COMPLIANT:
151
163
  "WHEN user clicks login, the system SHALL validate credentials"
@@ -158,6 +170,7 @@ done
158
170
  ```
159
171
 
160
172
  ### Enforcement
173
+
161
174
  ```python
162
175
  invalid_keywords = ["should", "may", "could", "might", "would"]
163
176
  required_keywords = ["SHALL", "MUST"]
@@ -165,7 +178,7 @@ required_keywords = ["SHALL", "MUST"]
165
178
  for line in requirements:
166
179
  if any(kw in line.lower() for kw in invalid_keywords):
167
180
  VIOLATION(f"Article IV: Ambiguous keyword in '{line}'")
168
-
181
+
169
182
  if "REQ-" in line and not any(kw in line for kw in required_keywords):
170
183
  WARNING(f"Article IV: Missing SHALL/MUST in '{line}'")
171
184
  ```
@@ -177,12 +190,14 @@ for line in requirements:
177
190
  > **100% traceability required: Requirement ↔ Design ↔ Task ↔ Code ↔ Test.**
178
191
 
179
192
  ### Rationale
193
+
180
194
  - Ensures every requirement is implemented
181
195
  - Prevents orphaned code
182
196
  - Enables impact analysis
183
197
  - Supports audit and compliance
184
198
 
185
199
  ### Traceability Chain
200
+
186
201
  ```
187
202
  REQ-001 (Requirement)
188
203
  ↓ (referenced in)
@@ -196,6 +211,7 @@ T-001 (Test)
196
211
  ```
197
212
 
198
213
  ### Compliance Criteria
214
+
199
215
  ```
200
216
  ✅ COMPLIANT:
201
217
  - 100% requirements have design mappings
@@ -211,19 +227,20 @@ T-001 (Test)
211
227
  ```
212
228
 
213
229
  ### Enforcement
230
+
214
231
  ```python
215
232
  def check_traceability():
216
233
  requirements = parse_requirements()
217
234
  design = parse_design()
218
235
  tasks = parse_tasks()
219
236
  tests = parse_tests()
220
-
237
+
221
238
  for req in requirements:
222
239
  if req.id not in design.references:
223
240
  VIOLATION(f"Article V: {req.id} not in design")
224
241
  if req.id not in tests.references:
225
242
  VIOLATION(f"Article V: {req.id} not tested")
226
-
243
+
227
244
  coverage = len(traced_requirements) / len(requirements) * 100
228
245
  if coverage < 100:
229
246
  VIOLATION(f"Article V: Traceability {coverage}% < 100%")
@@ -236,12 +253,14 @@ def check_traceability():
236
253
  > **All skills MUST check steering before work.**
237
254
 
238
255
  ### Rationale
256
+
239
257
  - Consistent architectural decisions
240
258
  - Technology stack awareness
241
259
  - Business context understanding
242
260
  - Prevents conflicting approaches
243
261
 
244
262
  ### Required Steering Files
263
+
245
264
  ```
246
265
  steering/
247
266
  ├── structure.md # Architecture patterns
@@ -252,6 +271,7 @@ steering/
252
271
  ```
253
272
 
254
273
  ### Compliance Criteria
274
+
255
275
  ```
256
276
  ✅ COMPLIANT:
257
277
  - Steering files read at skill start
@@ -265,6 +285,7 @@ steering/
265
285
  ```
266
286
 
267
287
  ### Enforcement
288
+
268
289
  ```python
269
290
  def check_steering_compliance():
270
291
  if not exists("steering/structure.md"):
@@ -282,18 +303,21 @@ def check_steering_compliance():
282
303
  > **Prefer the simplest solution that satisfies requirements.**
283
304
 
284
305
  ### Rationale
306
+
285
307
  - Reduces maintenance burden
286
308
  - Improves readability
287
309
  - Faster development
288
310
  - Easier testing
289
311
 
290
312
  ### Simplicity Principles
313
+
291
314
  1. **YAGNI**: You Aren't Gonna Need It
292
315
  2. **KISS**: Keep It Simple, Stupid
293
316
  3. **Minimal Dependencies**: Only what's necessary
294
317
  4. **Concrete Over Abstract**: Start simple, refactor when needed
295
318
 
296
319
  ### Compliance Criteria
320
+
297
321
  ```
298
322
  ✅ COMPLIANT:
299
323
  - Minimal external dependencies
@@ -309,12 +333,13 @@ def check_steering_compliance():
309
333
  ```
310
334
 
311
335
  ### Enforcement
336
+
312
337
  ```python
313
338
  def simplicity_check(proposal):
314
339
  # Check dependency count
315
340
  if len(proposal.dependencies) > THRESHOLD:
316
341
  WARNING("Article VII: High dependency count")
317
-
342
+
318
343
  # Check for design pattern overuse
319
344
  patterns = detect_patterns(proposal)
320
345
  if "factory" in patterns and "simple instantiation" in alternatives:
@@ -328,12 +353,14 @@ def simplicity_check(proposal):
328
353
  > **No abstraction before the third occurrence.**
329
354
 
330
355
  ### Rationale
356
+
331
357
  - Prevents premature generalization
332
358
  - Abstractions emerge from patterns
333
359
  - Concrete code is easier to change
334
360
  - Wrong abstractions are costly
335
361
 
336
362
  ### Rule of Three
363
+
337
364
  ```
338
365
  1st occurrence: Implement concrete solution
339
366
  2nd occurrence: Copy and adapt (acceptable duplication)
@@ -341,6 +368,7 @@ def simplicity_check(proposal):
341
368
  ```
342
369
 
343
370
  ### Compliance Criteria
371
+
344
372
  ```
345
373
  ✅ COMPLIANT:
346
374
  - Concrete implementation first
@@ -355,6 +383,7 @@ def simplicity_check(proposal):
355
383
  ```
356
384
 
357
385
  ### Enforcement
386
+
358
387
  ```python
359
388
  def anti_abstraction_check():
360
389
  for interface in find_interfaces():
@@ -370,12 +399,14 @@ def anti_abstraction_check():
370
399
  > **Integration tests before unit tests for new features.**
371
400
 
372
401
  ### Rationale
402
+
373
403
  - Validates end-to-end behavior first
374
404
  - Catches integration issues early
375
405
  - Unit tests fill gaps afterward
376
406
  - User-centric testing approach
377
407
 
378
408
  ### Testing Order
409
+
379
410
  ```
380
411
  1. Integration tests (happy path)
381
412
  2. Integration tests (error paths)
@@ -384,6 +415,7 @@ def anti_abstraction_check():
384
415
  ```
385
416
 
386
417
  ### Compliance Criteria
418
+
387
419
  ```
388
420
  ✅ COMPLIANT:
389
421
  - Integration tests written first
@@ -397,18 +429,19 @@ def anti_abstraction_check():
397
429
  ```
398
430
 
399
431
  ### Enforcement
432
+
400
433
  ```python
401
434
  def integration_first_check(feature):
402
435
  integration_tests = find_tests(feature, type="integration")
403
436
  unit_tests = find_tests(feature, type="unit")
404
-
437
+
405
438
  if not integration_tests:
406
439
  VIOLATION("Article IX: No integration tests found")
407
-
440
+
408
441
  # Check commit order
409
442
  integration_date = get_first_commit(integration_tests)
410
443
  unit_date = get_first_commit(unit_tests)
411
-
444
+
412
445
  if unit_date < integration_date:
413
446
  WARNING("Article IX: Unit tests committed before integration")
414
447
  ```
@@ -419,31 +452,34 @@ def integration_first_check(feature):
419
452
 
420
453
  ### Quick Reference
421
454
 
422
- | Article | Title | Key Rule |
423
- |---------|-------|----------|
424
- | I | Library-First | Features start as libraries |
425
- | II | CLI Mandate | Libraries expose CLI |
426
- | III | Test-First | Tests before code |
427
- | IV | EARS Format | Unambiguous requirements |
428
- | V | Traceability | 100% coverage |
429
- | VI | Project Memory | Check steering first |
430
- | VII | Simplicity | Simplest solution |
431
- | VIII | Anti-Abstraction | Rule of three |
432
- | IX | Integration-First | Integration before unit |
455
+ | Article | Title | Key Rule |
456
+ | ------- | ----------------- | --------------------------- |
457
+ | I | Library-First | Features start as libraries |
458
+ | II | CLI Mandate | Libraries expose CLI |
459
+ | III | Test-First | Tests before code |
460
+ | IV | EARS Format | Unambiguous requirements |
461
+ | V | Traceability | 100% coverage |
462
+ | VI | Project Memory | Check steering first |
463
+ | VII | Simplicity | Simplest solution |
464
+ | VIII | Anti-Abstraction | Rule of three |
465
+ | IX | Integration-First | Integration before unit |
433
466
 
434
467
  ### Enforcement Priority
435
468
 
436
469
  **Blocking (Must Pass)**:
470
+
437
471
  - Article III: Test-First (no exceptions)
438
472
  - Article IV: EARS Format (no exceptions)
439
473
  - Article V: Traceability (no exceptions)
440
474
 
441
475
  **Required (Strong Enforcement)**:
476
+
442
477
  - Article I: Library-First
443
478
  - Article II: CLI Mandate
444
479
  - Article VI: Project Memory
445
480
 
446
481
  **Advisory (With Justification)**:
482
+
447
483
  - Article VII: Simplicity Gate
448
484
  - Article VIII: Anti-Abstraction Gate
449
485
  - Article IX: Integration-First
@@ -39,6 +39,7 @@ Implementation Begins
39
39
  **Purpose**: Ensure project memory is consulted before work begins.
40
40
 
41
41
  **Validation**:
42
+
42
43
  ```bash
43
44
  # Check if steering files exist
44
45
  required_files=(
@@ -58,6 +59,7 @@ PASS "Steering files exist and will be consulted"
58
59
  ```
59
60
 
60
61
  **Pass Criteria**:
62
+
61
63
  - [ ] `steering/structure.md` exists
62
64
  - [ ] `steering/tech.md` exists
63
65
  - [ ] `steering/product.md` exists
@@ -73,6 +75,7 @@ PASS "Steering files exist and will be consulted"
73
75
  **Purpose**: Ensure requirements use EARS format.
74
76
 
75
77
  **Validation**:
78
+
76
79
  ```python
77
80
  def validate_ears_format(requirements_file):
78
81
  """
@@ -85,20 +88,21 @@ def validate_ears_format(requirements_file):
85
88
  r"IF .+ THEN .+ (SHALL|MUST)", # Conditional
86
89
  r"The system (SHALL|MUST)", # Ubiquitous
87
90
  ]
88
-
91
+
89
92
  invalid_keywords = ["should", "may", "could", "might"]
90
-
93
+
91
94
  for line in requirements_file:
92
95
  if any(kw in line.lower() for kw in invalid_keywords):
93
96
  FAIL(f"Ambiguous keyword found: {line}")
94
-
97
+
95
98
  if "REQ-" in line and not any(re.match(p, line) for p in valid_patterns):
96
99
  WARN(f"Requirement may not follow EARS: {line}")
97
-
100
+
98
101
  PASS("All requirements follow EARS format")
99
102
  ```
100
103
 
101
104
  **Pass Criteria**:
105
+
102
106
  - [ ] All requirements use SHALL/MUST (not should/may)
103
107
  - [ ] Requirements follow EARS patterns
104
108
  - [ ] Each requirement has unique ID (REQ-XXX)
@@ -113,6 +117,7 @@ def validate_ears_format(requirements_file):
113
117
  **Purpose**: Ensure features are implemented as standalone libraries first.
114
118
 
115
119
  **Validation**:
120
+
116
121
  ```bash
117
122
  # For new features, check target directory
118
123
  feature_path="$1"
@@ -120,7 +125,7 @@ feature_path="$1"
120
125
  if [[ "$feature_path" == *"/app/"* ]] || [[ "$feature_path" == *"/web/"* ]]; then
121
126
  # Check if corresponding lib exists
122
127
  lib_path=$(echo "$feature_path" | sed 's/app\//lib\//; s/web\//lib\//')
123
-
128
+
124
129
  if [ ! -d "$lib_path" ]; then
125
130
  FAIL "Feature must be in lib/ first before app/ or web/"
126
131
  fi
@@ -130,6 +135,7 @@ PASS "Library-First principle satisfied"
130
135
  ```
131
136
 
132
137
  **Pass Criteria**:
138
+
133
139
  - [ ] New feature targets `lib/` directory first
134
140
  - [ ] OR: Existing `lib/` module exists for the feature
135
141
  - [ ] Library has no framework dependencies
@@ -144,6 +150,7 @@ PASS "Library-First principle satisfied"
144
150
  **Purpose**: Confirm tests will be written before implementation.
145
151
 
146
152
  **Validation**:
153
+
147
154
  ```bash
148
155
  # This is a confirmation gate - agent must commit to test-first
149
156
  echo "TEST-FIRST CONFIRMATION REQUIRED"
@@ -163,6 +170,7 @@ PASS "Test-First commitment confirmed"
163
170
  ```
164
171
 
165
172
  **Pass Criteria**:
173
+
166
174
  - [ ] Agent confirms test-first commitment
167
175
  - [ ] Test file paths identified
168
176
  - [ ] Test framework confirmed in steering/tech.md
@@ -177,6 +185,7 @@ PASS "Test-First commitment confirmed"
177
185
  **Purpose**: Ensure traceability chain is established.
178
186
 
179
187
  **Validation**:
188
+
180
189
  ```python
181
190
  def validate_traceability_setup(feature_name):
182
191
  """
@@ -187,18 +196,19 @@ def validate_traceability_setup(feature_name):
187
196
  "design": f"storage/features/{feature_name}/design.md",
188
197
  "tasks": f"storage/features/{feature_name}/tasks.md",
189
198
  }
190
-
199
+
191
200
  for artifact, path in required_artifacts.items():
192
201
  if artifact == "requirements":
193
202
  # Requirements MUST exist before design
194
203
  if not os.path.exists(path):
195
204
  FAIL(f"Requirements must exist before implementation: {path}")
196
-
205
+
197
206
  # Confirm traceability matrix will be maintained
198
207
  PASS("Traceability setup confirmed")
199
208
  ```
200
209
 
201
210
  **Pass Criteria**:
211
+
202
212
  - [ ] Requirements file exists or will be created first
203
213
  - [ ] Design will reference requirements
204
214
  - [ ] Tasks will reference design
@@ -215,6 +225,7 @@ def validate_traceability_setup(feature_name):
215
225
  **Purpose**: Enforce simplest viable solution.
216
226
 
217
227
  **Validation**:
228
+
218
229
  ```markdown
219
230
  ## Simplicity Checklist
220
231
 
@@ -242,6 +253,7 @@ For the proposed solution, verify:
242
253
  ```
243
254
 
244
255
  **Pass Criteria**:
256
+
245
257
  - [ ] Solution is the simplest that satisfies requirements
246
258
  - [ ] No unnecessary complexity identified
247
259
  - [ ] Dependencies are minimal and justified
@@ -256,6 +268,7 @@ For the proposed solution, verify:
256
268
  **Purpose**: Prevent unnecessary abstraction layers.
257
269
 
258
270
  **Validation**:
271
+
259
272
  ```markdown
260
273
  ## Anti-Abstraction Checklist
261
274
 
@@ -279,6 +292,7 @@ For the proposed solution, verify:
279
292
  ```
280
293
 
281
294
  **Pass Criteria**:
295
+
282
296
  - [ ] No premature abstraction patterns
283
297
  - [ ] Concrete implementations prioritized
284
298
  - [ ] Any abstraction is justified by requirements
@@ -331,21 +345,22 @@ ALL GATES PASSED → Proceed to implementation
331
345
 
332
346
  ## Gate Results
333
347
 
334
- | Gate | Status | Notes |
335
- |------|--------|-------|
336
- | 1. Steering Check | ✅ PASS | All files exist |
337
- | 2. EARS Validation | ✅ PASS | 5/5 requirements valid |
338
- | 3. Library-First | ✅ PASS | Target: lib/auth/ |
339
- | 4. Test-First | ✅ PASS | Commitment confirmed |
340
- | 5. Traceability | ✅ PASS | Requirements exist |
341
- | 6. Simplicity | ✅ PASS | Minimal approach |
342
- | 7. Anti-Abstraction | ✅ PASS | No premature patterns |
348
+ | Gate | Status | Notes |
349
+ | ------------------- | ------- | ---------------------- |
350
+ | 1. Steering Check | ✅ PASS | All files exist |
351
+ | 2. EARS Validation | ✅ PASS | 5/5 requirements valid |
352
+ | 3. Library-First | ✅ PASS | Target: lib/auth/ |
353
+ | 4. Test-First | ✅ PASS | Commitment confirmed |
354
+ | 5. Traceability | ✅ PASS | Requirements exist |
355
+ | 6. Simplicity | ✅ PASS | Minimal approach |
356
+ | 7. Anti-Abstraction | ✅ PASS | No premature patterns |
343
357
 
344
358
  ## Overall Result: ✅ PASS
345
359
 
346
360
  Implementation may proceed.
347
361
 
348
362
  ## Next Steps
363
+
349
364
  1. Write tests (test-engineer)
350
365
  2. Implement code (software-developer)
351
366
  3. Review (code-reviewer)
@@ -356,20 +371,24 @@ Implementation may proceed.
356
371
  ## Gate Failure Escalation
357
372
 
358
373
  ### Automatic Remediation
374
+
359
375
  - Gate 1: Auto-run steering skill
360
376
  - Gate 2: Auto-run requirements-analyst
361
377
  - Gate 5: Auto-create requirements template
362
378
 
363
379
  ### Manual Intervention Required
380
+
364
381
  - Gate 3: Requires architectural decision
365
382
  - Gate 4: Requires developer commitment
366
383
  - Gate 6: Requires design simplification
367
384
  - Gate 7: Requires refactoring proposal
368
385
 
369
386
  ### Blocking Gates
387
+
370
388
  - Gate 4 (Test-First): MUST pass - no exceptions
371
389
  - Gate 2 (EARS): MUST pass - no exceptions
372
390
 
373
391
  ### Waivable Gates (with justification)
392
+
374
393
  - Gate 6 (Simplicity): Waivable with documented reason
375
394
  - Gate 7 (Anti-Abstraction): Waivable with documented reason
@@ -9,6 +9,7 @@ Best practices for database backup and recovery strategies.
9
9
  ## Backup Types
10
10
 
11
11
  ### Full Backup
12
+
12
13
  Complete copy of entire database.
13
14
 
14
15
  ```bash
@@ -20,6 +21,7 @@ mysqldump --all-databases > backup_full_$(date +%Y%m%d).sql
20
21
  ```
21
22
 
22
23
  ### Incremental Backup
24
+
23
25
  Only changes since last backup.
24
26
 
25
27
  ```bash
@@ -31,6 +33,7 @@ mysqlbinlog --start-datetime="2024-01-01 00:00:00" binlog.000001 > incremental.s
31
33
  ```
32
34
 
33
35
  ### Differential Backup
36
+
34
37
  All changes since last full backup.
35
38
 
36
39
  ---
@@ -45,11 +48,11 @@ All changes since last full backup.
45
48
 
46
49
  ### Retention Policy
47
50
 
48
- | Backup Type | Frequency | Retention |
49
- |-------------|-----------|-----------|
50
- | Full | Weekly | 4 weeks |
51
- | Differential | Daily | 1 week |
52
- | WAL/Binlog | Continuous | 2 weeks |
51
+ | Backup Type | Frequency | Retention |
52
+ | ------------ | ---------- | --------- |
53
+ | Full | Weekly | 4 weeks |
54
+ | Differential | Daily | 1 week |
55
+ | WAL/Binlog | Continuous | 2 weeks |
53
56
 
54
57
  ---
55
58
 
@@ -210,21 +213,25 @@ chown -R mysql:mysql /var/lib/mysql
210
213
  # Recovery Test Checklist
211
214
 
212
215
  ## Preparation
216
+
213
217
  - [ ] Identify test environment
214
218
  - [ ] Get latest backup
215
219
  - [ ] Document start time
216
220
 
217
221
  ## Restore
222
+
218
223
  - [ ] Restore database
219
224
  - [ ] Apply incremental backups
220
225
  - [ ] Verify data integrity
221
226
 
222
227
  ## Validation
228
+
223
229
  - [ ] Count records in key tables
224
230
  - [ ] Run application tests
225
231
  - [ ] Verify recent transactions
226
232
 
227
233
  ## Documentation
234
+
228
235
  - [ ] Record recovery time
229
236
  - [ ] Note any issues
230
237
  - [ ] Update runbook
@@ -232,10 +239,10 @@ chown -R mysql:mysql /var/lib/mysql
232
239
 
233
240
  ### RTO/RPO Calculation
234
241
 
235
- | Metric | Definition | Target |
236
- |--------|------------|--------|
237
- | RTO | Recovery Time Objective | < 1 hour |
238
- | RPO | Recovery Point Objective | < 15 min |
242
+ | Metric | Definition | Target |
243
+ | ------ | ------------------------ | -------- |
244
+ | RTO | Recovery Time Objective | < 1 hour |
245
+ | RPO | Recovery Point Objective | < 15 min |
239
246
 
240
247
  ---
241
248
 
@@ -281,15 +288,15 @@ chown -R mysql:mysql /var/lib/mysql
281
288
  metrics:
282
289
  - name: backup_last_success_timestamp
283
290
  type: gauge
284
- help: "Timestamp of last successful backup"
285
-
291
+ help: 'Timestamp of last successful backup'
292
+
286
293
  - name: backup_duration_seconds
287
294
  type: histogram
288
- help: "Backup duration in seconds"
289
-
295
+ help: 'Backup duration in seconds'
296
+
290
297
  - name: backup_size_bytes
291
298
  type: gauge
292
- help: "Size of latest backup"
299
+ help: 'Size of latest backup'
293
300
  ```
294
301
 
295
302
  ### Alerts
@@ -301,14 +308,14 @@ alerts:
301
308
  for: 1h
302
309
  severity: critical
303
310
  annotations:
304
- summary: "No successful backup in 24 hours"
305
-
311
+ summary: 'No successful backup in 24 hours'
312
+
306
313
  - alert: BackupTooSmall
307
314
  expr: backup_size_bytes < backup_size_bytes offset 1d * 0.5
308
315
  for: 5m
309
316
  severity: warning
310
317
  annotations:
311
- summary: "Backup size decreased significantly"
318
+ summary: 'Backup size decreased significantly'
312
319
  ```
313
320
 
314
321
  ---
@@ -316,16 +323,19 @@ alerts:
316
323
  ## Checklist
317
324
 
318
325
  ### Daily
326
+
319
327
  - [ ] Verify backup completed
320
328
  - [ ] Check backup size
321
329
  - [ ] Review backup logs
322
330
 
323
331
  ### Weekly
332
+
324
333
  - [ ] Test restore to dev
325
334
  - [ ] Verify offsite replication
326
335
  - [ ] Check retention policy
327
336
 
328
337
  ### Monthly
338
+
329
339
  - [ ] Full recovery drill
330
340
  - [ ] Update RTO/RPO metrics
331
341
  - [ ] Review backup strategy