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
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Template Constraints Module
3
- *
3
+ *
4
4
  * LLM-constraining syntax for steering templates with:
5
5
  * - Uncertainty markers ({?...?}, {~...~})
6
6
  * - Required checklists ([x] items)
@@ -18,16 +18,16 @@ const ConstraintType = {
18
18
  CHOICE: 'choice',
19
19
  RANGE: 'range',
20
20
  PATTERN: 'pattern',
21
- CUSTOM: 'custom'
21
+ CUSTOM: 'custom',
22
22
  };
23
23
 
24
24
  // Uncertainty Marker Types
25
25
  const UncertaintyMarker = {
26
- UNKNOWN: '?', // {?...?} - value unknown
27
- ESTIMATE: '~', // {~...~} - estimated value
28
- PLACEHOLDER: '#', // {#...#} - placeholder
29
- TODO: '!', // {!...!} - needs action
30
- REVIEW: '@' // {@...@} - needs review
26
+ UNKNOWN: '?', // {?...?} - value unknown
27
+ ESTIMATE: '~', // {~...~} - estimated value
28
+ PLACEHOLDER: '#', // {#...#} - placeholder
29
+ TODO: '!', // {!...!} - needs action
30
+ REVIEW: '@', // {@...@} - needs review
31
31
  };
32
32
 
33
33
  // Validation Severity
@@ -35,7 +35,7 @@ const Severity = {
35
35
  ERROR: 'error',
36
36
  WARNING: 'warning',
37
37
  INFO: 'info',
38
- HINT: 'hint'
38
+ HINT: 'hint',
39
39
  };
40
40
 
41
41
  /**
@@ -59,8 +59,8 @@ class Constraint {
59
59
  constraint: this.name,
60
60
  type: this.type,
61
61
  severity: this.severity,
62
- message: result === true ? null : (typeof result === 'string' ? result : this.message),
63
- value
62
+ message: result === true ? null : typeof result === 'string' ? result : this.message,
63
+ value,
64
64
  };
65
65
  } catch (error) {
66
66
  return {
@@ -70,7 +70,7 @@ class Constraint {
70
70
  severity: this.severity,
71
71
  message: error.message,
72
72
  value,
73
- error
73
+ error,
74
74
  };
75
75
  }
76
76
  }
@@ -114,16 +114,14 @@ class ChecklistItem {
114
114
  if (context.checklist && !context.checklist[dep]?.checked) {
115
115
  return {
116
116
  valid: false,
117
- message: `Dependency "${dep}" must be completed first`
117
+ message: `Dependency "${dep}" must be completed first`,
118
118
  };
119
119
  }
120
120
  }
121
121
 
122
122
  return {
123
123
  valid: !this.required || this.checked,
124
- message: this.required && !this.checked
125
- ? `Required item not checked: ${this.text}`
126
- : null
124
+ message: this.required && !this.checked ? `Required item not checked: ${this.text}` : null,
127
125
  };
128
126
  }
129
127
  }
@@ -144,7 +142,7 @@ class Checklist {
144
142
  addItem(id, text, options = {}) {
145
143
  const item = new ChecklistItem(text, {
146
144
  ...options,
147
- order: this.items.size
145
+ order: this.items.size,
148
146
  });
149
147
  this.items.set(id, item);
150
148
  return item;
@@ -188,7 +186,7 @@ class Checklist {
188
186
  if (!result.valid && !result.skipped) {
189
187
  issues.push({
190
188
  item: id,
191
- message: result.message
189
+ message: result.message,
192
190
  });
193
191
  }
194
192
  }
@@ -198,7 +196,7 @@ class Checklist {
198
196
  const checked = this.getCheckedCount();
199
197
  if (checked < this.minRequired) {
200
198
  issues.push({
201
- message: `At least ${this.minRequired} items must be checked (current: ${checked})`
199
+ message: `At least ${this.minRequired} items must be checked (current: ${checked})`,
202
200
  });
203
201
  }
204
202
  }
@@ -208,7 +206,7 @@ class Checklist {
208
206
  const checked = this.getCheckedCount();
209
207
  if (checked > this.maxAllowed) {
210
208
  issues.push({
211
- message: `At most ${this.maxAllowed} items can be checked (current: ${checked})`
209
+ message: `At most ${this.maxAllowed} items can be checked (current: ${checked})`,
212
210
  });
213
211
  }
214
212
  }
@@ -218,13 +216,13 @@ class Checklist {
218
216
  checklist: this.name,
219
217
  checked: this.getCheckedCount(),
220
218
  total: this.items.size,
221
- issues
219
+ issues,
222
220
  };
223
221
  }
224
222
 
225
223
  toMarkdown() {
226
224
  const lines = [`## ${this.name}`, ''];
227
-
225
+
228
226
  for (const [, item] of this.items) {
229
227
  const checkbox = item.checked ? '[x]' : '[ ]';
230
228
  const required = item.required ? '' : ' (optional)';
@@ -238,7 +236,7 @@ class Checklist {
238
236
  const lines = content.split('\n');
239
237
  let name = 'Checklist';
240
238
  const checklist = new Checklist(name);
241
-
239
+
242
240
  for (const line of lines) {
243
241
  // Parse header
244
242
  const headerMatch = line.match(/^##\s+(.+)$/);
@@ -255,7 +253,7 @@ class Checklist {
255
253
  const text = itemMatch[2];
256
254
  const required = !itemMatch[3];
257
255
  const id = text.toLowerCase().replace(/\s+/g, '-').slice(0, 50);
258
-
256
+
259
257
  checklist.addItem(id, text, { checked, required });
260
258
  }
261
259
  }
@@ -274,7 +272,7 @@ class UncertaintyParser {
274
272
  ['~', { name: 'estimate', pattern: /\{~(.+?)~\}/g }],
275
273
  ['#', { name: 'placeholder', pattern: /\{#(.+?)#\}/g }],
276
274
  ['!', { name: 'todo', pattern: /\{!(.+?)!\}/g }],
277
- ['@', { name: 'review', pattern: /\{@(.+?)@\}/g }]
275
+ ['@', { name: 'review', pattern: /\{@(.+?)@\}/g }],
278
276
  ]);
279
277
  }
280
278
 
@@ -291,7 +289,7 @@ class UncertaintyParser {
291
289
  marker,
292
290
  value: match[1],
293
291
  original: match[0],
294
- index: match.index
292
+ index: match.index,
295
293
  });
296
294
  }
297
295
  }
@@ -307,7 +305,10 @@ class UncertaintyParser {
307
305
  for (const [marker] of this.markers) {
308
306
  const patterns = [
309
307
  new RegExp(`\\{\\${marker}${this.escapeRegex(key)}\\${marker}\\}`, 'g'),
310
- new RegExp(`\\{\\${marker}[^${marker}]*${this.escapeRegex(key)}[^${marker}]*\\${marker}\\}`, 'g')
308
+ new RegExp(
309
+ `\\{\\${marker}[^${marker}]*${this.escapeRegex(key)}[^${marker}]*\\${marker}\\}`,
310
+ 'g'
311
+ ),
311
312
  ];
312
313
 
313
314
  for (const pattern of patterns) {
@@ -341,7 +342,7 @@ class UncertaintyParser {
341
342
  highlight(content) {
342
343
  let highlighted = content;
343
344
 
344
- for (const [marker, config] of this.markers) {
345
+ for (const [_marker, config] of this.markers) {
345
346
  const regex = new RegExp(config.pattern.source, 'g');
346
347
  highlighted = highlighted.replace(regex, `**[${config.name.toUpperCase()}: $1]**`);
347
348
  }
@@ -378,7 +379,7 @@ class TemplateSection {
378
379
  issues.push({
379
380
  constraint: 'required',
380
381
  severity: Severity.ERROR,
381
- message: `Section "${this.name}" is required`
382
+ message: `Section "${this.name}" is required`,
382
383
  });
383
384
  return { valid: false, section: this.name, issues };
384
385
  }
@@ -389,7 +390,7 @@ class TemplateSection {
389
390
  issues.push({
390
391
  constraint: 'dependency',
391
392
  severity: Severity.ERROR,
392
- message: `Section "${this.name}" requires "${dep}" to be defined`
393
+ message: `Section "${this.name}" requires "${dep}" to be defined`,
393
394
  });
394
395
  }
395
396
  }
@@ -400,7 +401,7 @@ class TemplateSection {
400
401
  issues.push({
401
402
  constraint: 'minLength',
402
403
  severity: Severity.WARNING,
403
- message: `Section "${this.name}" should be at least ${this.minLength} characters`
404
+ message: `Section "${this.name}" should be at least ${this.minLength} characters`,
404
405
  });
405
406
  }
406
407
 
@@ -408,7 +409,7 @@ class TemplateSection {
408
409
  issues.push({
409
410
  constraint: 'maxLength',
410
411
  severity: Severity.WARNING,
411
- message: `Section "${this.name}" should be at most ${this.maxLength} characters`
412
+ message: `Section "${this.name}" should be at most ${this.maxLength} characters`,
412
413
  });
413
414
  }
414
415
 
@@ -417,7 +418,7 @@ class TemplateSection {
417
418
  issues.push({
418
419
  constraint: 'pattern',
419
420
  severity: Severity.ERROR,
420
- message: `Section "${this.name}" does not match required pattern`
421
+ message: `Section "${this.name}" does not match required pattern`,
421
422
  });
422
423
  }
423
424
  }
@@ -429,7 +430,7 @@ class TemplateSection {
429
430
  issues.push({
430
431
  constraint: constraint.name,
431
432
  severity: result.severity,
432
- message: result.message
433
+ message: result.message,
433
434
  });
434
435
  }
435
436
  }
@@ -437,7 +438,7 @@ class TemplateSection {
437
438
  return {
438
439
  valid: !issues.some(i => i.severity === Severity.ERROR),
439
440
  section: this.name,
440
- issues
441
+ issues,
441
442
  };
442
443
  }
443
444
  }
@@ -486,12 +487,12 @@ class TemplateDefinition {
486
487
  template: this.name,
487
488
  sections: [],
488
489
  checklists: [],
489
- global: []
490
+ global: [],
490
491
  };
491
492
 
492
493
  const sectionContext = {
493
494
  ...context,
494
- sections: document.sections || {}
495
+ sections: document.sections || {},
495
496
  };
496
497
 
497
498
  // Validate sections
@@ -499,7 +500,7 @@ class TemplateDefinition {
499
500
  const content = document.sections?.[name] || '';
500
501
  const result = section.validate(content, sectionContext);
501
502
  results.sections.push(result);
502
-
503
+
503
504
  if (!result.valid) {
504
505
  results.valid = false;
505
506
  }
@@ -508,7 +509,7 @@ class TemplateDefinition {
508
509
  // Validate checklists
509
510
  for (const [name, checklist] of this.checklists) {
510
511
  const items = document.checklists?.[name] || {};
511
-
512
+
512
513
  // Apply checked state from document
513
514
  for (const [id, checked] of Object.entries(items)) {
514
515
  if (checked) checklist.check(id);
@@ -565,18 +566,18 @@ class TemplateConstraintEngine extends EventEmitter {
565
566
  const doc = {
566
567
  sections: {},
567
568
  checklists: {},
568
- uncertainties: []
569
+ uncertainties: [],
569
570
  };
570
571
 
571
572
  // Parse sections (## headers)
572
- const sectionPattern = /^##\s+(.+)$/gm;
573
+ const _sectionPattern = /^##\s+(.+)$/gm;
573
574
  let currentSection = null;
574
575
  let currentContent = [];
575
576
  const lines = content.split('\n');
576
577
 
577
578
  for (const line of lines) {
578
579
  const sectionMatch = line.match(/^##\s+(.+)$/);
579
-
580
+
580
581
  if (sectionMatch) {
581
582
  // Save previous section
582
583
  if (currentSection) {
@@ -626,13 +627,11 @@ class TemplateConstraintEngine extends EventEmitter {
626
627
  if (!template) {
627
628
  return {
628
629
  valid: false,
629
- error: `Template "${templateName}" not found`
630
+ error: `Template "${templateName}" not found`,
630
631
  };
631
632
  }
632
633
 
633
- const document = typeof content === 'string'
634
- ? this.parseDocument(content)
635
- : content;
634
+ const document = typeof content === 'string' ? this.parseDocument(content) : content;
636
635
 
637
636
  const results = template.validate(document);
638
637
 
@@ -642,13 +641,13 @@ class TemplateConstraintEngine extends EventEmitter {
642
641
  results.uncertainties = document.uncertainties.map(u => ({
643
642
  type: u.type,
644
643
  value: u.value,
645
- message: `Unresolved ${u.type}: ${u.value}`
644
+ message: `Unresolved ${u.type}: ${u.value}`,
646
645
  }));
647
646
  }
648
647
 
649
648
  this.emit('validated', {
650
649
  template: templateName,
651
- results
650
+ results,
652
651
  });
653
652
 
654
653
  return results;
@@ -703,7 +702,7 @@ class TemplateConstraintEngine extends EventEmitter {
703
702
  createSteeringTemplates() {
704
703
  // Structure template
705
704
  const structure = new TemplateDefinition('Structure', {
706
- description: 'Project structure and architecture'
705
+ description: 'Project structure and architecture',
707
706
  });
708
707
 
709
708
  structure.addSection('Overview', { required: true, minLength: 50 });
@@ -720,7 +719,7 @@ class TemplateConstraintEngine extends EventEmitter {
720
719
 
721
720
  // Tech template
722
721
  const tech = new TemplateDefinition('Tech', {
723
- description: 'Technology stack and tools'
722
+ description: 'Technology stack and tools',
724
723
  });
725
724
 
726
725
  tech.addSection('Languages', { required: true });
@@ -736,7 +735,7 @@ class TemplateConstraintEngine extends EventEmitter {
736
735
 
737
736
  // Product template
738
737
  const product = new TemplateDefinition('Product', {
739
- description: 'Product context and goals'
738
+ description: 'Product context and goals',
740
739
  });
741
740
 
742
741
  product.addSection('Vision', { required: true, minLength: 100 });
@@ -761,7 +760,7 @@ class TemplateConstraintEngine extends EventEmitter {
761
760
  */
762
761
  function createTemplateConstraintEngine(options = {}) {
763
762
  const engine = new TemplateConstraintEngine(options);
764
-
763
+
765
764
  if (options.includeSteeringTemplates !== false) {
766
765
  engine.createSteeringTemplates();
767
766
  }
@@ -774,7 +773,7 @@ module.exports = {
774
773
  ConstraintType,
775
774
  UncertaintyMarker,
776
775
  Severity,
777
-
776
+
778
777
  // Classes
779
778
  Constraint,
780
779
  ChecklistItem,
@@ -783,7 +782,7 @@ module.exports = {
783
782
  TemplateSection,
784
783
  TemplateDefinition,
785
784
  TemplateConstraintEngine,
786
-
785
+
787
786
  // Factory
788
- createTemplateConstraintEngine
787
+ createTemplateConstraintEngine,
789
788
  };
@@ -245,47 +245,47 @@ npx musubi-sdd <command>
245
245
 
246
246
  ### Core Commands
247
247
 
248
- | Command | Purpose | Example |
249
- |---------|---------|---------|
250
- | `musubi-workflow` | Workflow state & metrics | `npx musubi-workflow status` |
251
- | `musubi-requirements` | EARS requirements | `npx musubi-requirements init <feature>` |
252
- | `musubi-design` | C4 + ADR design | `npx musubi-design init <feature>` |
253
- | `musubi-tasks` | Task breakdown | `npx musubi-tasks init <feature>` |
254
- | `musubi-trace` | Traceability | `npx musubi-trace matrix` |
255
- | `musubi-validate` | Constitutional validation | `npx musubi-validate all` |
248
+ | Command | Purpose | Example |
249
+ | --------------------- | ------------------------- | ---------------------------------------- |
250
+ | `musubi-workflow` | Workflow state & metrics | `npx musubi-workflow status` |
251
+ | `musubi-requirements` | EARS requirements | `npx musubi-requirements init <feature>` |
252
+ | `musubi-design` | C4 + ADR design | `npx musubi-design init <feature>` |
253
+ | `musubi-tasks` | Task breakdown | `npx musubi-tasks init <feature>` |
254
+ | `musubi-trace` | Traceability | `npx musubi-trace matrix` |
255
+ | `musubi-validate` | Constitutional validation | `npx musubi-validate all` |
256
256
 
257
257
  ### Advanced Commands (v3.5.0 NEW)
258
258
 
259
- | Command | Purpose | Example |
260
- |---------|---------|---------|
261
- | `musubi-orchestrate` | Multi-skill orchestration | `npx musubi-orchestrate auto <task>` |
262
- | `musubi-browser` | Browser automation & E2E | `npx musubi-browser run "click login"` |
263
- | `musubi-gui` | Web GUI dashboard | `npx musubi-gui start` |
264
- | `musubi-remember` | Agent memory management | `npx musubi-remember extract` |
265
- | `musubi-resolve` | GitHub Issue resolution | `npx musubi-resolve <issue-number>` |
266
- | `musubi-convert` | Format conversion | `npx musubi-convert to-speckit` |
259
+ | Command | Purpose | Example |
260
+ | -------------------- | ------------------------- | -------------------------------------- |
261
+ | `musubi-orchestrate` | Multi-skill orchestration | `npx musubi-orchestrate auto <task>` |
262
+ | `musubi-browser` | Browser automation & E2E | `npx musubi-browser run "click login"` |
263
+ | `musubi-gui` | Web GUI dashboard | `npx musubi-gui start` |
264
+ | `musubi-remember` | Agent memory management | `npx musubi-remember extract` |
265
+ | `musubi-resolve` | GitHub Issue resolution | `npx musubi-resolve <issue-number>` |
266
+ | `musubi-convert` | Format conversion | `npx musubi-convert to-speckit` |
267
267
 
268
268
  ### Replanning Commands (v3.6.0 NEW)
269
269
 
270
- | Command | Purpose | Example |
271
- |---------|---------|---------|
272
- | `musubi-orchestrate replan` | Execute dynamic replanning | `npx musubi-orchestrate replan <context-id>` |
273
- | `musubi-orchestrate goal register` | Register a new goal | `npx musubi-orchestrate goal register --name "Deploy API"` |
274
- | `musubi-orchestrate goal update` | Update goal progress | `npx musubi-orchestrate goal update <goal-id> --progress 50` |
275
- | `musubi-orchestrate goal status` | View goal status | `npx musubi-orchestrate goal status [goal-id]` |
276
- | `musubi-orchestrate optimize run` | Run path optimization | `npx musubi-orchestrate optimize run <path-id>` |
277
- | `musubi-orchestrate optimize suggest` | Get optimization suggestions | `npx musubi-orchestrate optimize suggest <path-id>` |
278
- | `musubi-orchestrate path analyze` | Analyze execution path | `npx musubi-orchestrate path analyze <path-id>` |
279
- | `musubi-orchestrate path optimize` | Optimize execution path | `npx musubi-orchestrate path optimize <path-id>` |
270
+ | Command | Purpose | Example |
271
+ | ------------------------------------- | ---------------------------- | ------------------------------------------------------------ |
272
+ | `musubi-orchestrate replan` | Execute dynamic replanning | `npx musubi-orchestrate replan <context-id>` |
273
+ | `musubi-orchestrate goal register` | Register a new goal | `npx musubi-orchestrate goal register --name "Deploy API"` |
274
+ | `musubi-orchestrate goal update` | Update goal progress | `npx musubi-orchestrate goal update <goal-id> --progress 50` |
275
+ | `musubi-orchestrate goal status` | View goal status | `npx musubi-orchestrate goal status [goal-id]` |
276
+ | `musubi-orchestrate optimize run` | Run path optimization | `npx musubi-orchestrate optimize run <path-id>` |
277
+ | `musubi-orchestrate optimize suggest` | Get optimization suggestions | `npx musubi-orchestrate optimize suggest <path-id>` |
278
+ | `musubi-orchestrate path analyze` | Analyze execution path | `npx musubi-orchestrate path analyze <path-id>` |
279
+ | `musubi-orchestrate path optimize` | Optimize execution path | `npx musubi-orchestrate path optimize <path-id>` |
280
280
 
281
281
  ### Guardrails Commands (v3.9.0 NEW)
282
282
 
283
- | Command | Purpose | Example |
284
- |---------|---------|---------|
285
- | `musubi-validate guardrails` | Input/Output guardrail validation | `npx musubi-validate guardrails --type input` |
286
- | `musubi-validate guardrails --type output` | Output content validation | `echo "content" \| npx musubi-validate guardrails --type output` |
287
- | `musubi-validate guardrails --type safety` | Safety check with constitutional | `npx musubi-validate guardrails --type safety --constitutional` |
288
- | `musubi-validate guardrails-chain` | Chain multiple guardrails | `npx musubi-validate guardrails-chain --parallel` |
283
+ | Command | Purpose | Example |
284
+ | ------------------------------------------ | --------------------------------- | ---------------------------------------------------------------- |
285
+ | `musubi-validate guardrails` | Input/Output guardrail validation | `npx musubi-validate guardrails --type input` |
286
+ | `musubi-validate guardrails --type output` | Output content validation | `echo "content" \| npx musubi-validate guardrails --type output` |
287
+ | `musubi-validate guardrails --type safety` | Safety check with constitutional | `npx musubi-validate guardrails --type safety --constitutional` |
288
+ | `musubi-validate guardrails-chain` | Chain multiple guardrails | `npx musubi-validate guardrails-chain --parallel` |
289
289
 
290
290
  ## Learn More
291
291
 
@@ -31,13 +31,14 @@ Detects when an AI agent is stuck in various patterns:
31
31
  - **Stage Oscillation**: Back-and-forth between stages
32
32
 
33
33
  **Usage Example**:
34
+
34
35
  ```javascript
35
36
  const { StuckDetector } = require('musubi/src/analyzers/stuck-detector');
36
37
 
37
38
  const detector = new StuckDetector({
38
- repeatThreshold: 3, // Detect after 3 repeats
39
- monologueThreshold: 10, // Detect after 10 messages
40
- minHistoryLength: 5 // Minimum events for detection
39
+ repeatThreshold: 3, // Detect after 3 repeats
40
+ monologueThreshold: 10, // Detect after 10 messages
41
+ minHistoryLength: 5, // Minimum events for detection
41
42
  });
42
43
 
43
44
  // Add events from agent session
@@ -63,6 +64,7 @@ Compresses long session history to fit context window:
63
64
  - **AmortizedCondenser**: Gradual compression with summaries
64
65
 
65
66
  **Usage Example**:
67
+
66
68
  ```javascript
67
69
  const { MemoryCondenser } = require('musubi/src/managers/memory-condenser');
68
70
 
@@ -111,13 +113,14 @@ musubi-remember clear
111
113
  ```
112
114
 
113
115
  **Usage Example**:
116
+
114
117
  ```javascript
115
118
  const { AgentMemoryManager } = require('musubi/src/managers/agent-memory');
116
119
 
117
120
  const manager = new AgentMemoryManager({
118
121
  projectRoot: process.cwd(),
119
122
  autoSave: true,
120
- minConfidence: 0.5
123
+ minConfidence: 0.5,
121
124
  });
122
125
 
123
126
  await manager.initialize();
@@ -125,7 +128,7 @@ await manager.initialize();
125
128
  // Extract learnings from session events
126
129
  const events = [
127
130
  { content: 'npm run test で単体テストを実行しました' },
128
- { content: 'Error: Module not found → npm install で解決' }
131
+ { content: 'Error: Module not found → npm install で解決' },
129
132
  ];
130
133
  const learnings = manager.extractLearnings(events);
131
134
 
@@ -214,11 +217,13 @@ musubi-analyze learnings --session ./session.log --export markdown
214
217
  **Message**: エージェントが同じアクションを繰り返しています
215
218
 
216
219
  ### Event History
220
+
217
221
  1. [action] Read file.js
218
222
  2. [action] Read file.js
219
223
  3. [action] Read file.js
220
224
 
221
225
  ### Recommended Actions
226
+
222
227
  - Try a different approach to access the file
223
228
  - Check file permissions
224
229
  - Consider alternative file paths
@@ -230,14 +235,17 @@ musubi-analyze learnings --session ./session.log --export markdown
230
235
  ## 📚 Session Learnings
231
236
 
232
237
  ### Commands (2 items)
238
+
233
239
  - `npm run test` - 単体テストを実行
234
240
  - `npm install` - 依存関係をインストール
235
241
 
236
242
  ### Error Solutions (1 item)
243
+
237
244
  - **Error**: Module not found
238
245
  - **Solution**: npm install で解決
239
246
  - **Confidence**: 0.85
240
247
 
241
248
  ### Project Structure (1 item)
249
+
242
250
  - テストファイルは `tests/` ディレクトリに配置
243
251
  ```
@@ -80,17 +80,17 @@ with mlflow.start_run():
80
80
  # Log parameters
81
81
  mlflow.log_param("learning_rate", 0.01)
82
82
  mlflow.log_param("epochs", 100)
83
-
83
+
84
84
  # Train model
85
85
  model = train_model(X_train, y_train)
86
-
86
+
87
87
  # Log metrics
88
88
  mlflow.log_metric("accuracy", accuracy)
89
89
  mlflow.log_metric("f1_score", f1)
90
-
90
+
91
91
  # Log model
92
92
  mlflow.sklearn.log_model(model, "model")
93
-
93
+
94
94
  # Log artifacts
95
95
  mlflow.log_artifact("feature_importance.png")
96
96
  ```
@@ -137,18 +137,18 @@ model:
137
137
  name: fraud-detector
138
138
  version: 2.1.0
139
139
  framework: scikit-learn
140
-
140
+
141
141
  training:
142
142
  date: 2024-01-15
143
143
  dataset_version: v1.2
144
144
  metrics:
145
145
  accuracy: 0.95
146
146
  f1_score: 0.92
147
-
147
+
148
148
  requirements:
149
149
  - scikit-learn==1.3.0
150
150
  - pandas==2.0.0
151
-
151
+
152
152
  schema:
153
153
  input:
154
154
  - name: amount
@@ -182,7 +182,7 @@ async def predict(features: dict):
182
182
  df = pd.DataFrame([features])
183
183
  prediction = model.predict(df)
184
184
  probability = model.predict_proba(df)
185
-
185
+
186
186
  return {
187
187
  "prediction": int(prediction[0]),
188
188
  "confidence": float(probability[0].max())
@@ -195,12 +195,12 @@ async def health():
195
195
 
196
196
  ### Deployment Strategies
197
197
 
198
- | Strategy | Description | Use Case |
199
- |----------|-------------|----------|
200
- | Shadow | Run parallel to existing | Validate new model |
201
- | Canary | Gradual traffic shift | Safe rollout |
202
- | Blue-Green | Full switch | Quick rollback |
203
- | A/B Test | Split traffic | Compare models |
198
+ | Strategy | Description | Use Case |
199
+ | ---------- | ------------------------ | ------------------ |
200
+ | Shadow | Run parallel to existing | Validate new model |
201
+ | Canary | Gradual traffic shift | Safe rollout |
202
+ | Blue-Green | Full switch | Quick rollback |
203
+ | A/B Test | Split traffic | Compare models |
204
204
 
205
205
  ---
206
206
 
@@ -232,20 +232,20 @@ from scipy import stats
232
232
  def detect_drift(reference_data, current_data, threshold=0.05):
233
233
  """Detect distribution drift using KS test."""
234
234
  drifted_features = []
235
-
235
+
236
236
  for column in reference_data.columns:
237
237
  statistic, p_value = stats.ks_2samp(
238
238
  reference_data[column],
239
239
  current_data[column]
240
240
  )
241
-
241
+
242
242
  if p_value < threshold:
243
243
  drifted_features.append({
244
244
  "feature": column,
245
245
  "p_value": p_value,
246
246
  "statistic": statistic
247
247
  })
248
-
248
+
249
249
  return drifted_features
250
250
  ```
251
251
 
@@ -295,24 +295,24 @@ jobs:
295
295
  runs-on: ubuntu-latest
296
296
  steps:
297
297
  - uses: actions/checkout@v4
298
-
298
+
299
299
  - name: Setup Python
300
300
  uses: actions/setup-python@v4
301
301
  with:
302
302
  python-version: '3.10'
303
-
303
+
304
304
  - name: Install dependencies
305
305
  run: pip install -r requirements.txt
306
-
306
+
307
307
  - name: Pull data
308
308
  run: dvc pull
309
-
309
+
310
310
  - name: Train model
311
311
  run: python train.py
312
-
312
+
313
313
  - name: Evaluate model
314
314
  run: python evaluate.py
315
-
315
+
316
316
  - name: Register model
317
317
  if: github.ref == 'refs/heads/main'
318
318
  run: python register_model.py