moai-adk 0.25.4__py3-none-any.whl → 0.32.8__py3-none-any.whl

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.

Potentially problematic release.


This version of moai-adk might be problematic. Click here for more details.

Files changed (378) hide show
  1. moai_adk/__init__.py +2 -5
  2. moai_adk/__main__.py +114 -82
  3. moai_adk/cli/__init__.py +6 -1
  4. moai_adk/cli/commands/__init__.py +1 -3
  5. moai_adk/cli/commands/analyze.py +5 -16
  6. moai_adk/cli/commands/doctor.py +6 -18
  7. moai_adk/cli/commands/init.py +56 -125
  8. moai_adk/cli/commands/language.py +14 -35
  9. moai_adk/cli/commands/status.py +9 -15
  10. moai_adk/cli/commands/update.py +1555 -190
  11. moai_adk/cli/prompts/init_prompts.py +112 -56
  12. moai_adk/cli/spec_status.py +263 -0
  13. moai_adk/cli/ui/__init__.py +44 -0
  14. moai_adk/cli/ui/progress.py +422 -0
  15. moai_adk/cli/ui/prompts.py +389 -0
  16. moai_adk/cli/ui/theme.py +129 -0
  17. moai_adk/cli/worktree/__init__.py +27 -0
  18. moai_adk/cli/worktree/__main__.py +31 -0
  19. moai_adk/cli/worktree/cli.py +672 -0
  20. moai_adk/cli/worktree/exceptions.py +89 -0
  21. moai_adk/cli/worktree/manager.py +490 -0
  22. moai_adk/cli/worktree/models.py +65 -0
  23. moai_adk/cli/worktree/registry.py +128 -0
  24. moai_adk/core/PHASE2_OPTIMIZATIONS.md +467 -0
  25. moai_adk/core/analysis/session_analyzer.py +17 -56
  26. moai_adk/core/claude_integration.py +26 -54
  27. moai_adk/core/command_helpers.py +10 -10
  28. moai_adk/core/comprehensive_monitoring_system.py +1183 -0
  29. moai_adk/core/config/auto_spec_config.py +5 -11
  30. moai_adk/core/config/migration.py +19 -9
  31. moai_adk/core/config/unified.py +436 -0
  32. moai_adk/core/context_manager.py +6 -12
  33. moai_adk/core/enterprise_features.py +1404 -0
  34. moai_adk/core/error_recovery_system.py +725 -112
  35. moai_adk/core/event_driven_hook_system.py +1371 -0
  36. moai_adk/core/git/__init__.py +8 -0
  37. moai_adk/core/git/branch_manager.py +3 -11
  38. moai_adk/core/git/checkpoint.py +1 -3
  39. moai_adk/core/git/conflict_detector.py +413 -0
  40. moai_adk/core/git/manager.py +91 -1
  41. moai_adk/core/hooks/post_tool_auto_spec_completion.py +56 -80
  42. moai_adk/core/input_validation_middleware.py +1006 -0
  43. moai_adk/core/integration/engine.py +6 -18
  44. moai_adk/core/integration/integration_tester.py +10 -9
  45. moai_adk/core/integration/utils.py +1 -1
  46. moai_adk/core/issue_creator.py +10 -28
  47. moai_adk/core/jit_context_loader.py +956 -0
  48. moai_adk/core/jit_enhanced_hook_manager.py +1987 -0
  49. moai_adk/core/language_config_resolver.py +485 -0
  50. moai_adk/core/language_validator.py +28 -41
  51. moai_adk/core/mcp/setup.py +15 -12
  52. moai_adk/core/merge/__init__.py +9 -0
  53. moai_adk/core/merge/analyzer.py +481 -0
  54. moai_adk/core/migration/alfred_to_moai_migrator.py +383 -0
  55. moai_adk/core/migration/backup_manager.py +78 -9
  56. moai_adk/core/migration/custom_element_scanner.py +358 -0
  57. moai_adk/core/migration/file_migrator.py +8 -17
  58. moai_adk/core/migration/interactive_checkbox_ui.py +488 -0
  59. moai_adk/core/migration/selective_restorer.py +470 -0
  60. moai_adk/core/migration/template_utils.py +74 -0
  61. moai_adk/core/migration/user_selection_ui.py +338 -0
  62. moai_adk/core/migration/version_detector.py +6 -10
  63. moai_adk/core/migration/version_migrator.py +3 -3
  64. moai_adk/core/performance/cache_system.py +8 -10
  65. moai_adk/core/phase_optimized_hook_scheduler.py +879 -0
  66. moai_adk/core/project/checker.py +2 -4
  67. moai_adk/core/project/detector.py +1 -3
  68. moai_adk/core/project/initializer.py +135 -23
  69. moai_adk/core/project/phase_executor.py +54 -81
  70. moai_adk/core/project/validator.py +6 -12
  71. moai_adk/core/quality/trust_checker.py +9 -27
  72. moai_adk/core/realtime_monitoring_dashboard.py +1724 -0
  73. moai_adk/core/robust_json_parser.py +611 -0
  74. moai_adk/core/rollback_manager.py +73 -148
  75. moai_adk/core/session_manager.py +10 -26
  76. moai_adk/core/skill_loading_system.py +579 -0
  77. moai_adk/core/spec/confidence_scoring.py +31 -100
  78. moai_adk/core/spec/ears_template_engine.py +351 -286
  79. moai_adk/core/spec/quality_validator.py +35 -69
  80. moai_adk/core/spec_status_manager.py +64 -74
  81. moai_adk/core/template/backup.py +45 -20
  82. moai_adk/core/template/config.py +112 -39
  83. moai_adk/core/template/merger.py +11 -19
  84. moai_adk/core/template/processor.py +253 -149
  85. moai_adk/core/template_engine.py +73 -40
  86. moai_adk/core/template_variable_synchronizer.py +417 -0
  87. moai_adk/core/unified_permission_manager.py +745 -0
  88. moai_adk/core/user_behavior_analytics.py +851 -0
  89. moai_adk/core/version_sync.py +429 -0
  90. moai_adk/foundation/__init__.py +56 -0
  91. moai_adk/foundation/backend.py +1027 -0
  92. moai_adk/foundation/database.py +1115 -0
  93. moai_adk/foundation/devops.py +1585 -0
  94. moai_adk/foundation/ears.py +431 -0
  95. moai_adk/foundation/frontend.py +870 -0
  96. moai_adk/foundation/git/commit_templates.py +4 -12
  97. moai_adk/foundation/git.py +376 -0
  98. moai_adk/foundation/langs.py +484 -0
  99. moai_adk/foundation/ml_ops.py +1162 -0
  100. moai_adk/foundation/testing.py +1524 -0
  101. moai_adk/foundation/trust/trust_principles.py +23 -72
  102. moai_adk/foundation/trust/validation_checklist.py +57 -162
  103. moai_adk/project/__init__.py +0 -0
  104. moai_adk/project/configuration.py +1084 -0
  105. moai_adk/project/documentation.py +566 -0
  106. moai_adk/project/schema.py +447 -0
  107. moai_adk/statusline/alfred_detector.py +1 -3
  108. moai_adk/statusline/config.py +13 -4
  109. moai_adk/statusline/enhanced_output_style_detector.py +23 -15
  110. moai_adk/statusline/main.py +51 -15
  111. moai_adk/statusline/renderer.py +104 -48
  112. moai_adk/statusline/update_checker.py +3 -9
  113. moai_adk/statusline/version_reader.py +140 -46
  114. moai_adk/templates/.claude/agents/moai/ai-nano-banana.md +549 -0
  115. moai_adk/templates/.claude/agents/moai/builder-agent.md +445 -0
  116. moai_adk/templates/.claude/agents/moai/builder-command.md +1132 -0
  117. moai_adk/templates/.claude/agents/moai/builder-skill.md +601 -0
  118. moai_adk/templates/.claude/agents/moai/expert-backend.md +831 -0
  119. moai_adk/templates/.claude/agents/moai/expert-database.md +774 -0
  120. moai_adk/templates/.claude/agents/moai/expert-debug.md +396 -0
  121. moai_adk/templates/.claude/agents/moai/expert-devops.md +711 -0
  122. moai_adk/templates/.claude/agents/moai/expert-frontend.md +666 -0
  123. moai_adk/templates/.claude/agents/moai/expert-security.md +474 -0
  124. moai_adk/templates/.claude/agents/moai/expert-uiux.md +1038 -0
  125. moai_adk/templates/.claude/agents/moai/manager-claude-code.md +429 -0
  126. moai_adk/templates/.claude/agents/moai/manager-docs.md +570 -0
  127. moai_adk/templates/.claude/agents/moai/manager-git.md +937 -0
  128. moai_adk/templates/.claude/agents/moai/manager-project.md +891 -0
  129. moai_adk/templates/.claude/agents/moai/manager-quality.md +598 -0
  130. moai_adk/templates/.claude/agents/moai/manager-spec.md +713 -0
  131. moai_adk/templates/.claude/agents/moai/manager-strategy.md +600 -0
  132. moai_adk/templates/.claude/agents/moai/manager-tdd.md +603 -0
  133. moai_adk/templates/.claude/agents/moai/mcp-context7.md +369 -0
  134. moai_adk/templates/.claude/agents/moai/mcp-figma.md +1567 -0
  135. moai_adk/templates/.claude/agents/moai/mcp-notion.md +749 -0
  136. moai_adk/templates/.claude/agents/moai/mcp-playwright.md +427 -0
  137. moai_adk/templates/.claude/agents/moai/mcp-sequential-thinking.md +994 -0
  138. moai_adk/templates/.claude/commands/moai/0-project.md +1143 -0
  139. moai_adk/templates/.claude/commands/moai/1-plan.md +1435 -0
  140. moai_adk/templates/.claude/commands/moai/2-run.md +883 -0
  141. moai_adk/templates/.claude/commands/moai/3-sync.md +993 -0
  142. moai_adk/templates/.claude/commands/moai/9-feedback.md +314 -0
  143. moai_adk/templates/.claude/hooks/__init__.py +8 -0
  144. moai_adk/templates/.claude/hooks/moai/__init__.py +8 -0
  145. moai_adk/templates/.claude/hooks/moai/lib/__init__.py +85 -0
  146. moai_adk/templates/.claude/hooks/moai/lib/checkpoint.py +244 -0
  147. moai_adk/templates/.claude/hooks/moai/lib/common.py +131 -0
  148. moai_adk/templates/.claude/hooks/moai/lib/config_manager.py +446 -0
  149. moai_adk/templates/.claude/hooks/moai/lib/config_validator.py +639 -0
  150. moai_adk/templates/.claude/hooks/moai/lib/example_config.json +104 -0
  151. moai_adk/templates/.claude/hooks/moai/lib/git_operations_manager.py +590 -0
  152. moai_adk/templates/.claude/hooks/moai/lib/language_validator.py +317 -0
  153. moai_adk/templates/.claude/hooks/moai/lib/models.py +102 -0
  154. moai_adk/templates/.claude/hooks/moai/lib/path_utils.py +28 -0
  155. moai_adk/templates/.claude/hooks/moai/lib/project.py +768 -0
  156. moai_adk/templates/.claude/hooks/moai/lib/test_hooks_improvements.py +443 -0
  157. moai_adk/templates/.claude/hooks/moai/lib/timeout.py +160 -0
  158. moai_adk/templates/.claude/hooks/moai/lib/unified_timeout_manager.py +530 -0
  159. moai_adk/templates/.claude/hooks/moai/session_end__auto_cleanup.py +862 -0
  160. moai_adk/templates/.claude/hooks/moai/session_start__show_project_info.py +921 -0
  161. moai_adk/templates/.claude/output-styles/moai/r2d2.md +380 -0
  162. moai_adk/templates/.claude/output-styles/moai/yoda.md +338 -0
  163. moai_adk/templates/.claude/settings.json +172 -0
  164. moai_adk/templates/.claude/skills/moai-docs-generation/SKILL.md +247 -0
  165. moai_adk/templates/.claude/skills/moai-docs-generation/modules/README.md +44 -0
  166. moai_adk/templates/.claude/skills/moai-docs-generation/modules/api-documentation.md +130 -0
  167. moai_adk/templates/.claude/skills/moai-docs-generation/modules/code-documentation.md +152 -0
  168. moai_adk/templates/.claude/skills/moai-docs-generation/modules/multi-format-output.md +178 -0
  169. moai_adk/templates/.claude/skills/moai-docs-generation/modules/user-guides.md +147 -0
  170. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +319 -0
  171. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +320 -0
  172. moai_adk/templates/.claude/skills/moai-domain-database/modules/README.md +53 -0
  173. moai_adk/templates/.claude/skills/moai-domain-database/modules/mongodb.md +231 -0
  174. moai_adk/templates/.claude/skills/moai-domain-database/modules/postgresql.md +169 -0
  175. moai_adk/templates/.claude/skills/moai-domain-database/modules/redis.md +262 -0
  176. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +496 -0
  177. moai_adk/templates/.claude/skills/moai-domain-uiux/SKILL.md +453 -0
  178. moai_adk/templates/.claude/skills/moai-domain-uiux/examples.md +560 -0
  179. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/accessibility-wcag.md +260 -0
  180. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/component-architecture.md +228 -0
  181. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/design-system-tokens.md +405 -0
  182. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/icon-libraries.md +401 -0
  183. moai_adk/templates/.claude/skills/moai-domain-uiux/modules/theming-system.md +373 -0
  184. moai_adk/templates/.claude/skills/moai-domain-uiux/reference.md +243 -0
  185. moai_adk/templates/.claude/skills/moai-formats-data/SKILL.md +491 -0
  186. moai_adk/templates/.claude/skills/moai-formats-data/modules/README.md +98 -0
  187. moai_adk/templates/.claude/skills/moai-formats-data/modules/SKILL-MODULARIZATION-TEMPLATE.md +278 -0
  188. moai_adk/templates/.claude/skills/moai-formats-data/modules/caching-performance.md +459 -0
  189. moai_adk/templates/.claude/skills/moai-formats-data/modules/data-validation.md +485 -0
  190. moai_adk/templates/.claude/skills/moai-formats-data/modules/json-optimization.md +374 -0
  191. moai_adk/templates/.claude/skills/moai-formats-data/modules/toon-encoding.md +308 -0
  192. moai_adk/templates/.claude/skills/moai-foundation-claude/SKILL.md +201 -0
  193. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/best-practices-checklist.md +616 -0
  194. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-custom-slash-commands-official.md +729 -0
  195. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-hooks-official.md +560 -0
  196. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-iam-official.md +635 -0
  197. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-memory-official.md +543 -0
  198. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-settings-official.md +663 -0
  199. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-skills-official.md +113 -0
  200. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/claude-code-sub-agents-official.md +238 -0
  201. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/complete-configuration-guide.md +175 -0
  202. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-examples.md +1674 -0
  203. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/skill-formatting-guide.md +729 -0
  204. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-examples.md +1513 -0
  205. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-formatting-guide.md +1086 -0
  206. moai_adk/templates/.claude/skills/moai-foundation-claude/reference/sub-agents/sub-agent-integration-patterns.md +1100 -0
  207. moai_adk/templates/.claude/skills/moai-foundation-context/SKILL.md +438 -0
  208. moai_adk/templates/.claude/skills/moai-foundation-core/SKILL.md +515 -0
  209. moai_adk/templates/.claude/skills/moai-foundation-core/modules/README.md +296 -0
  210. moai_adk/templates/.claude/skills/moai-foundation-core/modules/agents-reference.md +346 -0
  211. moai_adk/templates/.claude/skills/moai-foundation-core/modules/commands-reference.md +432 -0
  212. moai_adk/templates/.claude/skills/moai-foundation-core/modules/delegation-patterns.md +757 -0
  213. moai_adk/templates/.claude/skills/moai-foundation-core/modules/execution-rules.md +687 -0
  214. moai_adk/templates/.claude/skills/moai-foundation-core/modules/modular-system.md +665 -0
  215. moai_adk/templates/.claude/skills/moai-foundation-core/modules/progressive-disclosure.md +649 -0
  216. moai_adk/templates/.claude/skills/moai-foundation-core/modules/spec-first-tdd.md +864 -0
  217. moai_adk/templates/.claude/skills/moai-foundation-core/modules/token-optimization.md +708 -0
  218. moai_adk/templates/.claude/skills/moai-foundation-core/modules/trust-5-framework.md +981 -0
  219. moai_adk/templates/.claude/skills/moai-foundation-quality/SKILL.md +362 -0
  220. moai_adk/templates/.claude/skills/moai-foundation-quality/examples.md +1232 -0
  221. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/best-practices.md +261 -0
  222. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/integration-patterns.md +194 -0
  223. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/proactive-analysis.md +229 -0
  224. moai_adk/templates/.claude/skills/moai-foundation-quality/modules/trust5-validation.md +169 -0
  225. moai_adk/templates/.claude/skills/moai-foundation-quality/reference.md +1266 -0
  226. moai_adk/templates/.claude/skills/moai-foundation-quality/scripts/quality-gate.sh +668 -0
  227. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/github-actions-quality.yml +481 -0
  228. moai_adk/templates/.claude/skills/moai-foundation-quality/templates/quality-config.yaml +519 -0
  229. moai_adk/templates/.claude/skills/moai-integration-mcp/SKILL.md +352 -0
  230. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/README.md +52 -0
  231. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/error-handling.md +334 -0
  232. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/integration-patterns.md +310 -0
  233. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/security-authentication.md +256 -0
  234. moai_adk/templates/.claude/skills/moai-integration-mcp/modules/server-architecture.md +253 -0
  235. moai_adk/templates/.claude/skills/moai-lang-unified/README.md +133 -0
  236. moai_adk/templates/.claude/skills/moai-lang-unified/SKILL.md +296 -0
  237. moai_adk/templates/.claude/skills/moai-lang-unified/examples.md +1269 -0
  238. moai_adk/templates/.claude/skills/moai-lang-unified/reference.md +331 -0
  239. moai_adk/templates/.claude/skills/moai-library-mermaid/SKILL.md +298 -0
  240. moai_adk/templates/.claude/skills/moai-library-mermaid/advanced-patterns.md +465 -0
  241. moai_adk/templates/.claude/skills/moai-library-mermaid/examples.md +270 -0
  242. moai_adk/templates/.claude/skills/moai-library-mermaid/optimization.md +440 -0
  243. moai_adk/templates/.claude/skills/moai-library-mermaid/reference.md +228 -0
  244. moai_adk/templates/.claude/skills/moai-library-nextra/SKILL.md +316 -0
  245. moai_adk/templates/.claude/skills/moai-library-nextra/advanced-patterns.md +336 -0
  246. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-deployment-patterns.md +182 -0
  247. moai_adk/templates/.claude/skills/moai-library-nextra/modules/advanced-patterns.md +17 -0
  248. moai_adk/templates/.claude/skills/moai-library-nextra/modules/configuration.md +57 -0
  249. moai_adk/templates/.claude/skills/moai-library-nextra/modules/content-architecture-optimization.md +162 -0
  250. moai_adk/templates/.claude/skills/moai-library-nextra/modules/deployment.md +52 -0
  251. moai_adk/templates/.claude/skills/moai-library-nextra/modules/framework-core-configuration.md +186 -0
  252. moai_adk/templates/.claude/skills/moai-library-nextra/modules/i18n-setup.md +55 -0
  253. moai_adk/templates/.claude/skills/moai-library-nextra/modules/mdx-components.md +52 -0
  254. moai_adk/templates/.claude/skills/moai-library-nextra/optimization.md +303 -0
  255. moai_adk/templates/.claude/skills/moai-library-shadcn/SKILL.md +370 -0
  256. moai_adk/templates/.claude/skills/moai-library-shadcn/examples.md +575 -0
  257. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/advanced-patterns.md +394 -0
  258. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/optimization.md +278 -0
  259. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-components.md +457 -0
  260. moai_adk/templates/.claude/skills/moai-library-shadcn/modules/shadcn-theming.md +373 -0
  261. moai_adk/templates/.claude/skills/moai-library-shadcn/reference.md +74 -0
  262. moai_adk/templates/.claude/skills/moai-platform-baas/README.md +186 -0
  263. moai_adk/templates/.claude/skills/moai-platform-baas/SKILL.md +290 -0
  264. moai_adk/templates/.claude/skills/moai-platform-baas/examples.md +1225 -0
  265. moai_adk/templates/.claude/skills/moai-platform-baas/reference.md +567 -0
  266. moai_adk/templates/.claude/skills/moai-platform-baas/scripts/provider-selector.py +323 -0
  267. moai_adk/templates/.claude/skills/moai-platform-baas/templates/stack-config.yaml +204 -0
  268. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/SKILL.md +446 -0
  269. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/advanced-patterns.md +379 -0
  270. moai_adk/templates/.claude/skills/moai-workflow-jit-docs/optimization.md +286 -0
  271. moai_adk/templates/.claude/skills/moai-workflow-project/README.md +190 -0
  272. moai_adk/templates/.claude/skills/moai-workflow-project/SKILL.md +387 -0
  273. moai_adk/templates/.claude/skills/moai-workflow-project/__init__.py +520 -0
  274. moai_adk/templates/.claude/skills/moai-workflow-project/complete_workflow_demo_fixed.py +574 -0
  275. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_project_setup.py +317 -0
  276. moai_adk/templates/.claude/skills/moai-workflow-project/examples/complete_workflow_demo.py +663 -0
  277. moai_adk/templates/.claude/skills/moai-workflow-project/examples/config-migration-example.json +190 -0
  278. moai_adk/templates/.claude/skills/moai-workflow-project/examples/question-examples.json +135 -0
  279. moai_adk/templates/.claude/skills/moai-workflow-project/examples/quick_start.py +196 -0
  280. moai_adk/templates/.claude/skills/moai-workflow-project/modules/__init__.py +17 -0
  281. moai_adk/templates/.claude/skills/moai-workflow-project/modules/advanced-patterns.md +158 -0
  282. moai_adk/templates/.claude/skills/moai-workflow-project/modules/ask_user_integration.py +340 -0
  283. moai_adk/templates/.claude/skills/moai-workflow-project/modules/batch_questions.py +713 -0
  284. moai_adk/templates/.claude/skills/moai-workflow-project/modules/config_manager.py +538 -0
  285. moai_adk/templates/.claude/skills/moai-workflow-project/modules/documentation_manager.py +1336 -0
  286. moai_adk/templates/.claude/skills/moai-workflow-project/modules/language_initializer.py +730 -0
  287. moai_adk/templates/.claude/skills/moai-workflow-project/modules/migration_manager.py +608 -0
  288. moai_adk/templates/.claude/skills/moai-workflow-project/modules/template_optimizer.py +1005 -0
  289. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/config-schema.json +316 -0
  290. moai_adk/templates/.claude/skills/moai-workflow-project/schemas/tab_schema.json +1362 -0
  291. moai_adk/templates/.claude/skills/moai-workflow-project/templates/config-template.json +71 -0
  292. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/product-template.md +44 -0
  293. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/structure-template.md +48 -0
  294. moai_adk/templates/.claude/skills/moai-workflow-project/templates/doc-templates/tech-template.md +71 -0
  295. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/config-manager-setup.json +109 -0
  296. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/language-initializer.json +228 -0
  297. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/menu-project-config.json +130 -0
  298. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/project-batch-questions.json +97 -0
  299. moai_adk/templates/.claude/skills/moai-workflow-project/templates/question-templates/spec-workflow-setup.json +150 -0
  300. moai_adk/templates/.claude/skills/moai-workflow-project/test_integration_simple.py +436 -0
  301. moai_adk/templates/.claude/skills/moai-workflow-templates/SKILL.md +374 -0
  302. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/code-templates.md +124 -0
  303. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/feedback-templates.md +100 -0
  304. moai_adk/templates/.claude/skills/moai-workflow-templates/modules/template-optimizer.md +138 -0
  305. moai_adk/templates/.claude/skills/moai-workflow-testing/LICENSE.txt +202 -0
  306. moai_adk/templates/.claude/skills/moai-workflow-testing/SKILL.md +453 -0
  307. moai_adk/templates/.claude/skills/moai-workflow-testing/advanced-patterns.md +576 -0
  308. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/ai-powered-testing.py +294 -0
  309. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/console_logging.py +35 -0
  310. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/element_discovery.py +40 -0
  311. moai_adk/templates/.claude/skills/moai-workflow-testing/examples/static_html_automation.py +34 -0
  312. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/README.md +220 -0
  313. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/ai-debugging.md +845 -0
  314. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/automated-code-review.md +1416 -0
  315. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/performance-optimization.md +1234 -0
  316. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/smart-refactoring.md +1243 -0
  317. moai_adk/templates/.claude/skills/moai-workflow-testing/modules/tdd-context7.md +1260 -0
  318. moai_adk/templates/.claude/skills/moai-workflow-testing/optimization.md +505 -0
  319. moai_adk/templates/.claude/skills/moai-workflow-testing/reference/playwright-best-practices.md +57 -0
  320. moai_adk/templates/.claude/skills/moai-workflow-testing/scripts/with_server.py +218 -0
  321. moai_adk/templates/.claude/skills/moai-workflow-testing/templates/alfred-integration.md +376 -0
  322. moai_adk/templates/.claude/skills/moai-workflow-testing/workflows/enterprise-testing-workflow.py +571 -0
  323. moai_adk/templates/.claude/skills/moai-worktree/SKILL.md +410 -0
  324. moai_adk/templates/.claude/skills/moai-worktree/examples.md +606 -0
  325. moai_adk/templates/.claude/skills/moai-worktree/modules/integration-patterns.md +982 -0
  326. moai_adk/templates/.claude/skills/moai-worktree/modules/parallel-development.md +778 -0
  327. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-commands.md +646 -0
  328. moai_adk/templates/.claude/skills/moai-worktree/modules/worktree-management.md +782 -0
  329. moai_adk/templates/.claude/skills/moai-worktree/reference.md +357 -0
  330. moai_adk/templates/.git-hooks/pre-commit +103 -41
  331. moai_adk/templates/.git-hooks/pre-push +116 -21
  332. moai_adk/templates/.github/workflows/ci-universal.yml +513 -0
  333. moai_adk/templates/.github/workflows/security-secrets-check.yml +179 -0
  334. moai_adk/templates/.gitignore +184 -44
  335. moai_adk/templates/.mcp.json +7 -9
  336. moai_adk/templates/.moai/cache/personalization.json +10 -0
  337. moai_adk/templates/.moai/config/config.yaml +344 -0
  338. moai_adk/templates/.moai/config/presets/manual.yaml +28 -0
  339. moai_adk/templates/.moai/config/presets/personal.yaml +30 -0
  340. moai_adk/templates/.moai/config/presets/team.yaml +33 -0
  341. moai_adk/templates/.moai/config/questions/_schema.yaml +79 -0
  342. moai_adk/templates/.moai/config/questions/tab1-user.yaml +108 -0
  343. moai_adk/templates/.moai/config/questions/tab2-project.yaml +122 -0
  344. moai_adk/templates/.moai/config/questions/tab3-git.yaml +542 -0
  345. moai_adk/templates/.moai/config/questions/tab4-quality.yaml +167 -0
  346. moai_adk/templates/.moai/config/questions/tab5-system.yaml +152 -0
  347. moai_adk/templates/.moai/config/sections/git-strategy.yaml +40 -0
  348. moai_adk/templates/.moai/config/sections/language.yaml +11 -0
  349. moai_adk/templates/.moai/config/sections/project.yaml +13 -0
  350. moai_adk/templates/.moai/config/sections/quality.yaml +15 -0
  351. moai_adk/templates/.moai/config/sections/system.yaml +14 -0
  352. moai_adk/templates/.moai/config/sections/user.yaml +5 -0
  353. moai_adk/templates/.moai/config/statusline-config.yaml +86 -0
  354. moai_adk/templates/.moai/scripts/setup-glm.py +136 -0
  355. moai_adk/templates/CLAUDE.md +382 -501
  356. moai_adk/utils/__init__.py +24 -1
  357. moai_adk/utils/banner.py +7 -10
  358. moai_adk/utils/common.py +16 -30
  359. moai_adk/utils/link_validator.py +4 -12
  360. moai_adk/utils/safe_file_reader.py +2 -6
  361. moai_adk/utils/timeout.py +160 -0
  362. moai_adk/utils/toon_utils.py +256 -0
  363. moai_adk/version.py +22 -0
  364. moai_adk-0.32.8.dist-info/METADATA +2478 -0
  365. moai_adk-0.32.8.dist-info/RECORD +396 -0
  366. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/WHEEL +1 -1
  367. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/entry_points.txt +1 -0
  368. moai_adk/cli/commands/backup.py +0 -82
  369. moai_adk/cli/commands/improve_user_experience.py +0 -348
  370. moai_adk/cli/commands/migrate.py +0 -158
  371. moai_adk/cli/commands/validate_links.py +0 -118
  372. moai_adk/templates/.github/workflows/moai-gitflow.yml +0 -413
  373. moai_adk/templates/.github/workflows/moai-release-create.yml +0 -100
  374. moai_adk/templates/.github/workflows/moai-release-pipeline.yml +0 -188
  375. moai_adk/utils/user_experience.py +0 -531
  376. moai_adk-0.25.4.dist-info/METADATA +0 -2279
  377. moai_adk-0.25.4.dist-info/RECORD +0 -112
  378. {moai_adk-0.25.4.dist-info → moai_adk-0.32.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,588 +1,469 @@
1
- # {{PROJECT_NAME}}
1
+ # Mr. Alfred Execution Directive
2
2
 
3
- **SPEC-First TDD Development with Alfred SuperAgent - Claude Code v4.0 Integration**
3
+ ## Alfred: The Strategic Orchestrator (Claude Code Official Guidelines)
4
4
 
5
- > **Document Language**: {{CONVERSATION_LANGUAGE_NAME}} > **Project Owner**: {{PROJECT_OWNER}} > **Config**: `.moai/config/config.json` > **Version**: {{MOAI_VERSION}} (from .moai/config.json)
6
- > **Current Conversation Language**: {{CONVERSATION_LANGUAGE_NAME}} (conversation_language: "{{CONVERSATION_LANGUAGE}}")
7
- > **Claude Code Compatibility**: Latest v4.0+ Features Integrated
5
+ Core Principle: Alfred delegates all tasks to specialized agents and coordinates their execution.
8
6
 
9
- **🌐 Check My Conversation Language**: `cat .moai/config.json | jq '.language.conversation_language'`
7
+ ### Mandatory Requirements
8
+
9
+ - [HARD] Full Delegation: All tasks must be delegated to appropriate specialized agents
10
+ WHY: Specialized agents have domain-specific knowledge and optimized tool access
11
+
12
+ - [HARD] Complexity Analysis: Analyze task complexity and requirements to select appropriate approach
13
+ WHY: Matching task complexity to agent capability ensures optimal outcomes
14
+
15
+ - [SOFT] Result Integration: Consolidate agent execution results and report to user
16
+
17
+ - [HARD] Language-Aware Responses: Always respond in user's selected language (internal agent instructions remain in English)
18
+ WHY: User comprehension is paramount; English internals ensure consistency
19
+ See "Language-Aware Responses" section for detailed rules
10
20
 
11
21
  ---
12
22
 
13
- ## 🚀 Quick Start (First 5 Minutes) - Enhanced with Claude Code v4.0
23
+ ## Documentation Standards
14
24
 
15
- **New to Alfred?** Start with the modern Claude Code workflow:
25
+ ### Required Practices
16
26
 
17
- 1. **Initialize with Plan Mode**:
18
- ```bash
19
- /alfred:0-project # Auto-detects and sets up optimal configuration
20
- ```
27
+ All instruction documents must follow these standards:
21
28
 
22
- 2. **Create your first SPEC with Interactive Planning**:
23
- ```bash
24
- /alfred:1-plan "your feature description" # Uses Plan Mode for complex tasks
25
- ```
29
+ Formatting Requirements:
30
+ - Use detailed markdown formatting for explanations
31
+ - Document step-by-step procedures in text form
32
+ - Describe concepts and logic in narrative style
33
+ - Present workflows with clear textual descriptions
34
+ - Organize information using list format
35
+ - Express everything in pure text format
26
36
 
27
- 3. **Implement with TDD + Explore Subagent**:
28
- ```bash
29
- /alfred:2-run SPEC-001 # Leverages Haiku 4.5 for codebase exploration
30
- ```
37
+ ### Content Restrictions
31
38
 
32
- 4. **Sync with Context Optimization**:
33
- ```bash
34
- /alfred:3-sync auto SPEC-001 # Optimized context management
35
- ```
39
+ Restricted Content:
40
+ - Conceptual explanations expressed as code examples
41
+ - Workflow descriptions presented as code snippets
42
+ - Executable code examples in instructions
43
+ - Programming code used to explain concepts
44
+ - Flow control logic expressed as code (if/else, loops, conditions)
45
+ - Branching logic presented as programming syntax
46
+ - Comparison operations written as code expressions
47
+ - Decision trees shown as code structures
48
+ - Table format in instructions
49
+ - Emoji or emoji characters in instructions
50
+ - Time estimates or duration predictions (e.g., "4-6 hours", "takes 2 days")
36
51
 
37
- **Enhanced Features**:
38
- - **Press Tab** to toggle thinking mode (see planning process)
39
- - **Use @-mentions** for automatic context addition (`@src/components`)
40
- - **Leverage MCP servers** for external integrations (`@github help`)
52
+ WHY: Code examples can be misinterpreted as executable commands. Tables and emojis reduce parsing reliability. Time estimates are unverifiable and create false expectations. Flow control and branching logic must use narrative text format (e.g., "If condition A is true, then execute step 1. Otherwise, proceed to step 2.") instead of code syntax (e.g., if A: step1 else: step2).
41
53
 
42
- ---
54
+ ### Scope of Application
43
55
 
44
- ## 🎩 Alfred SuperAgent - Claude Code v4.0 Integration
56
+ These standards apply to: CLAUDE.md, agent definitions, slash commands, skill definitions, hook definitions, and configuration files.
45
57
 
46
- You are the SuperAgent **🎩 Alfred** orchestrating **{{PROJECT_NAME}}** with **Claude Code v4.0+ capabilities**.
58
+ ### Correct vs Incorrect Examples
47
59
 
48
- ### Enhanced Core Architecture
60
+ Flow Control - INCORRECT (code block):
49
61
 
50
- **4-Layer Modern Architecture** (Claude Code v4.0 Standard):
51
- ```
52
- Commands (Orchestration) → Task() delegation
53
-
54
- Sub-agents (Domain Expertise) → Skill() invocation
55
-
56
- Skills (Knowledge Capsules) → Progressive Disclosure
57
-
58
- Hooks (Guardrails & Context) → Auto-triggered events
59
- ```
62
+ If auto_branch equals False, set ROUTE to USE_CURRENT_BRANCH. Otherwise, set ROUTE to CREATE_BRANCH.
60
63
 
61
- ### Alfred's Enhanced Capabilities
64
+ Flow Control - CORRECT (text instructions):
62
65
 
63
- 1. **Plan Mode Integration**: Automatically breaks down complex tasks into phases
64
- 2. **Explore Subagent**: Leverages Haiku 4.5 for rapid codebase exploration
65
- 3. **Interactive Questions**: Proactively seeks clarification for better outcomes
66
- 4. **MCP Integration**: Seamlessly connects to external services via Model Context Protocol
67
- 5. **Context Management**: Optimizes token usage with intelligent context pruning
68
- 6. **Thinking Mode**: Transparent reasoning process (toggle with Tab key)
66
+ Check the auto_branch configuration value:
67
+ - If auto_branch equals false: Set ROUTE to USE_CURRENT_BRANCH
68
+ - If auto_branch equals true: Set ROUTE to CREATE_BRANCH
69
69
 
70
- ### Model Selection Strategy
70
+ Branching Logic - INCORRECT (code):
71
71
 
72
- - **Planning Phase**: Claude Sonnet 4.5 (deep reasoning)
73
- - **Execution Phase**: Claude Haiku 4.5 (fast, efficient)
74
- - **Exploration Tasks**: Haiku 4.5 with Explore subagent
75
- - **Complex Decisions**: Interactive Questions with user collaboration
72
+ Process each file in the list. For files with .py extension, perform processing. For other files, skip to next.
76
73
 
77
- ---
74
+ Branching Logic - CORRECT (text):
75
+
76
+ For each file in the file list:
77
+ - Check if the file extension is .py
78
+ - If yes: Process the file
79
+ - If no: Skip to the next file
80
+
81
+ Comparison Operations - INCORRECT (code):
82
+
83
+ Check if the score is greater than or equal to 80, less than 50, or between 50 and 79.
84
+
85
+ Comparison Operations - CORRECT (text):
86
+
87
+ Compare the score against thresholds:
88
+ - If score is 80 or higher: Apply high-priority action
89
+ - If score is below 50: Apply low-priority action
90
+ - If score is between 50 and 79: Apply medium-priority action
78
91
 
79
- ## 🌐 Enhanced Language Architecture & Claude Code Integration
80
-
81
- ### Multi-Language Support with Claude Code
82
-
83
- **Layer 1: User-Facing Content ({{CONVERSATION_LANGUAGE_NAME}})**
84
- - All conversations, responses, and interactions
85
- - Generated documents and SPEC content
86
- - Code comments and commit messages (project-specific)
87
- - Interactive Questions and user prompts
88
-
89
- **Layer 2: Claude Code Infrastructure (English)**
90
- - Skill invocations: `Skill("skill-name")`
91
- - MCP server configurations
92
- - Plugin manifest files
93
- - Claude Code settings and hooks
94
-
95
- ### Claude Code Language Configuration
96
-
97
- ```json
98
- {
99
- "language": {
100
- "conversation_language": "{{CONVERSATION_LANGUAGE}}",
101
- "claude_code_mode": "enhanced",
102
- "mcp_integration": true,
103
- "interactive_questions": true
104
- }
105
- }
106
- ```
107
-
108
- ### AskUserQuestion Integration (Enhanced)
109
-
110
- **Critical Rule**: Use AskUserQuestion for ALL user interactions, following Claude Code v4.0 patterns:
111
-
112
- ```json
113
- {
114
- "questions": [{
115
- "question": "Implementation approach preference?",
116
- "header": "Architecture Decision",
117
- "multiSelect": false,
118
- "options": [
119
- {
120
- "label": "Standard Approach",
121
- "description": "Proven pattern with Claude Code best practices"
122
- },
123
- {
124
- "label": "Optimized Approach",
125
- "description": "Performance-focused with MCP integration"
126
- }
127
- ]
128
- }]
129
- }
130
- ```
92
+ Decision Trees - INCORRECT (code):
93
+
94
+ Based on user role, determine access level. For admin role, grant full access. For user role, grant read-only access.
95
+
96
+ Decision Trees - CORRECT (text):
97
+
98
+ Determine access level based on user role:
99
+ - Admin role detected: Grant full access to all resources
100
+ - User role detected: Grant read-only access to public resources
101
+ - Guest role detected: Grant limited access to welcome page only
131
102
 
132
103
  ---
133
104
 
134
- ## 🏛️ Claude Code v4.0 Architecture Integration
135
-
136
- ### Modern 4-Layer System
137
-
138
- **1. Commands (Workflow Orchestration)**
139
- - Enhanced with Plan Mode for complex tasks
140
- - Interactive Questions for clarification
141
- - Automatic context optimization
142
-
143
- **2. Sub-agents (Domain Expertise)**
144
- - Model selection optimization (Sonnet/Haiku)
145
- - MCP server integration capabilities
146
- - Parallel execution support
147
-
148
- **3. Skills (Knowledge Progressive Disclosure)**
149
- - Lazy loading for performance
150
- - Cross-skill references
151
- - Version-controlled knowledge
152
-
153
- **4. Hooks (Context & Guardrails)**
154
- - PreToolUse validation (sandbox mode)
155
- - PostToolUse quality checks
156
- - SessionStart context seeding
157
-
158
- ### Claude Code v4.0 Features Integration
159
-
160
- **Plan Mode**:
161
- ```bash
162
- # Automatically triggered for complex tasks
163
- /alfred:1-plan "complex multi-step feature"
164
- # Alfred creates phased implementation plan
165
- # Each phase executed by optimal subagent
166
- ```
167
-
168
- **Explore Subagent**:
169
- ```bash
170
- # Fast codebase exploration
171
- "Where are error handling patterns implemented?"
172
- # Explore subagent automatically searches code patterns
173
- # Saves context with efficient summarization
174
- ```
175
-
176
- **MCP Integration**:
177
- ```bash
178
- # External service integration
179
- @github list issues
180
- @filesystem search pattern
181
- /mcp manage servers
182
- ```
183
-
184
- **Context Management**:
185
- ```bash
186
- /context # Check usage
187
- /add-dir src/components # Add directory
188
- /memory # Memory management
189
- /compact # Optimize conversation
190
- ```
105
+ ## Claude Code Official Agent Invocation Patterns
106
+
107
+ ### Explicit Agent Invocation
108
+
109
+ Invoke agents using clear, direct natural language:
110
+
111
+ - "Use the expert-backend subagent to develop the API"
112
+ - "Use the manager-tdd subagent to implement with TDD approach"
113
+ - "Use the Explore subagent to analyze the codebase structure"
114
+
115
+ WHY: Explicit invocation patterns ensure consistent agent activation and clear task boundaries.
116
+
117
+ ### Agent Chaining Patterns
118
+
119
+ Sequential Chaining:
120
+ First use the code-analyzer subagent to identify issues, then use the optimizer subagent to implement fixes, finally use the tester subagent to validate the solution
121
+
122
+ Parallel Execution:
123
+ Use the expert-backend subagent to develop the API, simultaneously use the expert-frontend subagent to create the UI
124
+
125
+ ### Resumable Agents
126
+
127
+ Resume interrupted agent work:
128
+ - Resume agent abc123 and continue the security analysis
129
+ - Continue with the frontend development using the existing context
191
130
 
192
131
  ---
193
132
 
194
- ## 🚀 MCP Integration & External Services
195
-
196
- ### Model Context Protocol Setup
197
-
198
- **Configuration (.mcp.json)**:
199
- ```json
200
- {
201
- "mcpServers": {
202
- "github": {
203
- "command": "npx",
204
- "args": ["-y", "@anthropic-ai/mcp-server-github"],
205
- "oauth": {
206
- "clientId": "your-client-id",
207
- "clientSecret": "your-client-secret",
208
- "scopes": ["repo", "issues"]
209
- }
210
- },
211
- "context7": {
212
- "command": "npx",
213
- "args": ["-y", "@upstash/context7-mcp@latest"]
214
- },
215
- "filesystem": {
216
- "command": "npx",
217
- "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"]
218
- }
219
- }
220
- }
221
- ```
222
-
223
- ### MCP Usage Patterns
224
-
225
- **Direct MCP Tools** (80% of cases):
226
- ```bash
227
- mcp__context7__resolve-library-id("React")
228
- mcp__context7__get-library-docs("/facebook/react")
229
- ```
230
-
231
- **MCP Agent Integration** (20% complex cases):
232
- ```bash
233
- @agent-mcp-context7-integrator
234
- @agent-mcp-sequential-thinking-integrator
235
- ```
133
+ ## Alfred's Three-Step Execution Model
134
+
135
+ ### Step 1: Understand
136
+
137
+ - Analyze user request complexity and scope
138
+ - Clarify ambiguous requirements using AskUserQuestion at command level (not in subagents)
139
+ - Dynamically load required Skills for knowledge acquisition
140
+ - Collect all necessary user preferences before delegating to agents
141
+
142
+ Core Execution Skills:
143
+ - Skill("moai-foundation-claude") - Alfred orchestration rules
144
+ - Skill("moai-foundation-core") - SPEC system and core workflows
145
+ - Skill("moai-workflow-project") - Project management and documentation
146
+ - Skill("moai-workflow-docs") - Integrated document management
147
+
148
+ ### Step 2: Plan
149
+
150
+ - Explicitly invoke Plan subagent to plan the task
151
+ - Establish optimal agent selection strategy after request analysis
152
+ - Decompose work into steps and determine execution order
153
+ - Report detailed plan to user and request approval
154
+
155
+ Agent Selection Guide by Task Type:
156
+ - API Development: Use expert-backend subagent
157
+ - React Components: Use expert-frontend subagent
158
+ - Security Review: Use expert-security subagent
159
+ - TDD-Based Development: Use manager-tdd subagent
160
+ - Documentation Generation: Use manager-docs subagent
161
+ - Complex Multi-Step Tasks: Use general-purpose subagent
162
+ - Codebase Analysis: Use Explore subagent
163
+
164
+ ### Step 3: Execute
165
+
166
+ - Invoke agents explicitly according to approved plan
167
+ - Monitor agent execution and adjust as needed
168
+ - Integrate completed work results into final deliverables
169
+ - [HARD] Ensure all agent responses are provided in user's language
236
170
 
237
171
  ---
238
172
 
239
- ## 🔧 Enhanced Settings Configuration
240
-
241
- ### Claude Code v4.0 Compatible Settings
242
-
243
- **(.claude/settings.json)**:
244
- ```json
245
- {
246
- "permissions": {
247
- "allowedTools": [
248
- "Read(**/*.{js,ts,json,md})",
249
- "Edit(**/*.{js,ts})",
250
- "Bash(git:*)",
251
- "Bash(npm:*)",
252
- "Bash(node:*)"
253
- ],
254
- "deniedTools": [
255
- "Edit(/config/secrets.json)",
256
- "Bash(rm -rf:*)",
257
- "Bash(sudo:*)"
258
- ]
259
- },
260
- "permissionMode": "acceptEdits",
261
- "spinnerTipsEnabled": true,
262
- "sandbox": {
263
- "allowUnsandboxedCommands": false
264
- },
265
- "hooks": {
266
- "PreToolUse": [
267
- {
268
- "matcher": "Bash",
269
- "hooks": [
270
- {
271
- "type": "command",
272
- "command": "python3 .claude/hooks/validate-command.py"
273
- }
274
- ]
275
- }
276
- ],
277
- "SessionStart": [
278
- {
279
- "type": "command",
280
- "command": "echo 'Claude Code session started'"
281
- }
282
- ]
283
- },
284
- "mcpServers": {
285
- "context7": {
286
- "command": "npx",
287
- "args": ["-y", "@upstash/context7-mcp@latest"]
288
- }
289
- },
290
- "statusLine": {
291
- "enabled": true,
292
- "format": "{{model}} | {{tokens}} | {{thinking}}"
293
- }
294
- }
295
- ```
173
+ ## Agent Design Principles (Claude Code Official Guidelines)
174
+
175
+ ### Single Responsibility Design
176
+
177
+ Each agent maintains clear, narrow domain expertise:
178
+ - "Use the expert-backend subagent to implement JWT authentication"
179
+ - "Use the expert-frontend subagent to create reusable button components"
180
+
181
+ WHY: Single responsibility enables deep expertise and reduces context switching overhead.
182
+
183
+ ### Detailed Prompt Composition
184
+
185
+ Prompt Composition Requirements:
186
+ - Specify the target subagent and action clearly
187
+ - Include language directive for user responses
188
+ - List concrete requirements with specific parameters
189
+ - Detail technical stack and security requirements
190
+ - Define expected outputs and deliverables
191
+
192
+ ### Language-Aware Responses
193
+
194
+ Critical Principle: All agents must respond in the user's selected language.
195
+
196
+ Language Response Requirements:
197
+ - User-facing responses: Always use the user's selected language from conversation_language
198
+ - Internal agent instructions: Always use English for consistency and clarity
199
+ - Code comments and documentation: Use English as specified in development standards
200
+
201
+ Language Resolution:
202
+ - Korean user receives Korean responses
203
+ - Japanese user receives Japanese responses
204
+ - English user receives English responses
205
+
206
+ WHY: User comprehension is the primary goal; English internals ensure maintainability.
207
+
208
+ ### Tool Access Restrictions
209
+
210
+ Tool Access Levels:
211
+ - Read-Only Agents: Read, Grep, Glob tools only
212
+ - Write-Limited Agents: Can create new files, cannot modify existing production code
213
+ - Full-Access Agents: Full access to Read, Write, Edit, Bash tools as needed
214
+
215
+ WHY: Least-privilege access prevents accidental modifications and enforces role boundaries.
216
+
217
+ ### User Interaction Architecture
218
+
219
+ Critical Constraint: Subagents invoked via Task() operate in isolated, stateless contexts and cannot interact with users directly.
220
+
221
+ Subagent Limitations:
222
+ - Subagents receive input once from the main thread at invocation
223
+ - Subagents return output once as a final report when execution completes
224
+ - Subagents cannot pause execution to wait for user responses
225
+ - Subagents cannot use AskUserQuestion tool effectively
226
+
227
+ WHY: Task() creates isolated execution contexts for parallelization and context management.
228
+
229
+ Correct User Interaction Pattern:
230
+
231
+ - [HARD] Commands must handle all user interaction via AskUserQuestion before delegating to agents
232
+ WHY: Commands run in the main thread where user interaction is possible
233
+
234
+ - [HARD] Pass user choices as parameters when invoking Task()
235
+ WHY: Subagents need pre-collected user decisions to execute without interaction
236
+
237
+ - [HARD] Agents must return structured responses for follow-up decisions
238
+ WHY: Commands can use agent responses to determine next user questions
239
+
240
+ Correct Workflow Pattern:
241
+ Step 1: Command uses AskUserQuestion to collect user preferences
242
+ Step 2: Command invokes Task() with user choices in the prompt
243
+ Step 3: Subagent executes based on provided parameters without user interaction
244
+ Step 4: Subagent returns structured response with results
245
+ Step 5: Command uses AskUserQuestion for next decision based on agent response
246
+
247
+ AskUserQuestion Tool Constraints:
248
+ - Maximum 4 options per question
249
+ - No emoji characters in question text, headers, or option labels
250
+ - Questions must be in user's conversation_language
251
+ - multiSelect parameter enables multiple choice selection when needed
296
252
 
297
253
  ---
298
254
 
299
- ## 🎯 Enhanced Workflow Integration
300
-
301
- ### Alfred × Claude Code Workflow
302
-
303
- **Phase 0: Project Setup**
304
- ```bash
305
- /alfred:0-project
306
- # Claude Code auto-detection + optimal configuration
307
- # MCP server setup suggestion
308
- # Performance baseline establishment
309
- ```
310
-
311
- **Phase 1: SPEC with Plan Mode**
312
- ```bash
313
- /alfred:1-plan "feature description"
314
- # Plan Mode for complex features
315
- # Interactive Questions for clarification
316
- # Automatic context gathering
317
- ```
318
-
319
- **Phase 2: Implementation with Explore**
320
- ```bash
321
- /alfred:2-run SPEC-001
322
- # Explore subagent for codebase analysis
323
- # Optimal model selection per task
324
- # MCP integration for external data
325
- ```
326
-
327
- **Phase 3: Sync with Optimization**
328
- ```bash
329
- /alfred:3-sync auto SPEC-001
330
- # Context optimization
331
- # Performance monitoring
332
- # Quality gate validation
333
- ```
334
-
335
- ### Enhanced Git Integration
336
-
337
- **Automated Workflows**:
338
- ```bash
339
- # Smart commit messages (Claude Code style)
340
- git commit -m "$(cat <<'EOF'
341
- Implement feature with Claude Code v4.0 integration
342
-
343
- - Plan Mode for complex task breakdown
344
- - Explore subagent for codebase analysis
345
- - MCP integration for external services
346
-
347
- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
348
-
349
- Co-Authored-By: Claude <noreply@anthropic.com>
350
- EOF
351
- )"
352
-
353
- # Enhanced PR creation
354
- gh pr create --title "Feature with Claude Code v4.0" --body "$(cat <<'EOF'
355
- ## Summary
356
- Claude Code v4.0 enhanced implementation
357
-
358
- ## Features
359
- - [ ] Plan Mode integration
360
- - [ ] Explore subagent utilization
361
- - [ ] MCP server connectivity
362
- - [ ] Context optimization
363
-
364
- ## Test Plan
365
- - [ ] Automated tests pass
366
- - [ ] Manual validation complete
367
- - [ ] Performance benchmarks met
368
-
369
- 🤖 Generated with [Claude Code](https://claude.ai/code)
370
- EOF
371
- )"
372
- ```
255
+ ## Advanced Agent Usage
256
+
257
+ ### Dynamic Agent Selection
258
+
259
+ Dynamic Selection Process:
260
+ - First analyze task complexity using task-analyzer subagent
261
+ - For simple tasks: use general-purpose subagent
262
+ - For medium complexity: use appropriate expert-* subagent
263
+ - For complex tasks: use workflow-manager subagent to coordinate multiple specialized agents
373
264
 
374
265
  ---
375
266
 
376
- ## 📊 Performance Monitoring & Optimization
267
+ ## Tool Execution Optimization
268
+
269
+ ### Parallel vs Sequential Execution
377
270
 
378
- ### Claude Code Performance Metrics
271
+ Parallel Execution Indicators:
272
+ - Operations on different files with no shared state
273
+ - Read-only operations with no dependencies
274
+ - Independent API calls or searches
379
275
 
380
- **Built-in Monitoring**:
381
- ```bash
382
- /cost # API usage and costs
383
- /usage # Plan usage limits
384
- /context # Current context usage
385
- /memory # Memory management
386
- ```
276
+ Sequential Execution Indicators:
277
+ - Output of one operation feeds input of another
278
+ - Write operations to the same file
279
+ - Operations with explicit ordering requirements
387
280
 
388
- **Performance Optimization Features**:
281
+ Execution Rule:
282
+ - [HARD] Execute all independent tool calls in parallel when no dependencies exist
283
+ - [HARD] Chain dependent operations sequentially with context passing
389
284
 
390
- 1. **Context Management**:
391
- - Automatic context pruning
392
- - Smart file selection
393
- - Token usage optimization
285
+ ---
286
+
287
+ ## SPEC-Based Workflow Integration
394
288
 
395
- 2. **Model Selection**:
396
- - Dynamic model switching
397
- - Cost-effective execution
398
- - Quality optimization
289
+ ### MoAI Commands and Agent Coordination
399
290
 
400
- 3. **MCP Integration**:
401
- - Server performance monitoring
402
- - Connection health checks
403
- - Fallback mechanisms
291
+ MoAI Command Integration Process:
292
+ 1. /moai:1-plan "user authentication system" leads to Use the spec-builder subagent
293
+ 2. /moai:2-run SPEC-001 leads to Use the manager-tdd subagent
294
+ 3. /moai:3-sync SPEC-001 leads to Use the manager-docs subagent
404
295
 
405
- ### Auto-Optimization
296
+ ### Agent Chain for SPEC Execution
406
297
 
407
- **Configuration Monitoring**:
408
- ```bash
409
- # Alfred monitors performance automatically
410
- # Suggests optimizations based on usage patterns
411
- # Alerts on configuration drift
412
- ```
298
+ SPEC Execution Agent Chain:
299
+ - Phase 1: Use the spec-analyzer subagent to understand requirements
300
+ - Phase 2: Use the architect-designer subagent to create system design
301
+ - Phase 3: Use the expert-backend subagent to implement core features
302
+ - Phase 4: Use the expert-frontend subagent to create user interface
303
+ - Phase 5: Use the tester-validator subagent to ensure quality standards
304
+ - Phase 6: Use the docs-generator subagent to create documentation
413
305
 
414
306
  ---
415
307
 
416
- ## 🔒 Enhanced Security & Best Practices
417
-
418
- ### Claude Code v4.0 Security Features
419
-
420
- **Sandbox Mode**:
421
- ```json
422
- {
423
- "sandbox": {
424
- "allowUnsandboxedCommands": false,
425
- "validatedCommands": ["git:*", "npm:*", "node:*"]
426
- }
427
- }
428
- ```
429
-
430
- **Security Hooks**:
431
- ```python
432
- #!/usr/bin/env python3
433
- # .claude/hooks/security-validator.py
434
-
435
- import re
436
- import sys
437
- import json
438
-
439
- DANGEROUS_PATTERNS = [
440
- r"rm -rf",
441
- r"sudo ",
442
- r":/.*\.\.",
443
- r"&&.*rm",
444
- r"\|.*sh"
445
- ]
446
-
447
- def validate_command(command):
448
- for pattern in DANGEROUS_PATTERNS:
449
- if re.search(pattern, command):
450
- return False, f"Dangerous pattern detected: {pattern}"
451
- return True, "Command safe"
452
-
453
- if __name__ == "__main__":
454
- input_data = json.load(sys.stdin)
455
- command = input_data.get("command", "")
456
- is_safe, message = validate_command(command)
457
-
458
- if not is_safe:
459
- print(f"SECURITY BLOCK: {message}", file=sys.stderr)
460
- sys.exit(2)
461
- sys.exit(0)
462
- ```
308
+ ## MCP Integration and External Services
309
+
310
+ ### Context7 Integration
311
+
312
+ Leverage Context7 MCP server for current API documentation and information:
313
+ - Use the mcp-context7 subagent to research latest API documentation
314
+ - Get current framework best practices and patterns
315
+ - Check library version compatibility and migration guides
316
+
317
+ ### Sequential-Thinking for Complex Tasks
318
+
319
+ Use Sequential-Thinking MCP for complex analysis and architecture design:
320
+ - For complex tasks (greater than 10 files, architecture changes): First activate the sequential-thinking subagent
321
+ - Then use the appropriate expert-* subagents for implementation
463
322
 
464
323
  ---
465
324
 
466
- ## 📚 Enhanced Documentation Reference
325
+ ## Token Management and Optimization
467
326
 
468
- ### Claude Code v4.0 Integration Map
327
+ ### Context Optimization
469
328
 
470
- | Feature | Claude Native | Alfred Integration | Enhancement |
471
- |---------|---------------|-------------------|-------------|
472
- | **Plan Mode** | Built-in | Alfred workflow | SPEC-driven planning |
473
- | **Explore Subagent** | Automatic | Task delegation | Domain-specific exploration |
474
- | **MCP Integration** | Native | Service orchestration | Business logic integration |
475
- | **Interactive Questions** | Built-in | Structured decision trees | Complex clarification flows |
476
- | **Context Management** | Automatic | Project-specific optimization | Intelligent pruning |
477
- | **Thinking Mode** | Tab toggle | Workflow transparency | Step-by-step reasoning |
329
+ Context Optimization Process:
330
+ - Before delegating to agents: Use the context-optimizer subagent to create minimal context
331
+ - Include: spec_id, key_requirements (max 3 bullet points), architecture_summary (max 200 chars)
332
+ - Exclude: background information, reasoning, and non-essential details
478
333
 
479
- ### Alfred Skills Integration
334
+ ### Session Management
480
335
 
481
- **Core Alfred Skills Enhanced**:
482
- - `Skill("moai-alfred-workflow")` - Enhanced with Plan Mode
483
- - `Skill("moai-alfred-agent-guide")` - Updated for Claude Code v4.0
484
- - `Skill("moai-alfred-context-budget")` - Optimized context management
485
- - `Skill("moai-alfred-personas")` - Enhanced communication patterns
336
+ Each agent invocation creates an independent 200K token session:
337
+ - Complex tasks break into multiple agent sessions
338
+ - Session boundaries prevent context overflow and enable parallel processing
486
339
 
487
340
  ---
488
341
 
489
- ## 🎯 Enhanced Troubleshooting
342
+ ## User Personalization and Language Settings
343
+
344
+ User and language configuration is automatically loaded from section files below.
345
+
346
+ @.moai/config/sections/user.yaml
347
+ @.moai/config/sections/language.yaml
348
+
349
+ ### Configuration Structure
350
+
351
+ Configuration is split into modular section files for token efficiency:
352
+ - sections/user.yaml: User name for personalized greetings
353
+ - sections/language.yaml: All language preferences (conversation, code, docs)
354
+ - sections/project.yaml: Project metadata
355
+ - sections/git-strategy.yaml: Git workflow configuration
356
+ - sections/quality.yaml: TDD and quality settings
357
+ - sections/system.yaml: MoAI system settings
490
358
 
491
- ### Claude Code v4.0 Common Issues
359
+ ### Configuration Priority
492
360
 
493
- **MCP Connection Issues**:
494
- ```bash
495
- # Check MCP server status
496
- claude mcp serve
361
+ 1. Environment Variables (highest priority): MOAI_USER_NAME, MOAI_CONVERSATION_LANG
362
+ 2. Section Files: .moai/config/sections/*.yaml
363
+ 3. Default Values: English, default greeting
497
364
 
498
- # Validate configuration
499
- claude /doctor
365
+ ### Agent Delegation Rules
500
366
 
501
- # Restart MCP servers
502
- /mcp restart
503
- ```
367
+ Include personalization information in all subagent invocations:
368
+ - "Use the [subagent] subagent to [task]. User: {name}, Language: [user_language]"
504
369
 
505
- **Context Management**:
506
- ```bash
507
- # Check context usage
508
- /context
370
+ ---
371
+
372
+ ## Error Recovery and Problem Resolution
509
373
 
510
- # Optimize conversation
511
- /compact
374
+ ### Systematic Error Handling
512
375
 
513
- # Clear and restart
514
- /clear
515
- ```
376
+ Error Handling Process:
377
+ - Agent execution errors: Use the expert-debug subagent to troubleshoot issues
378
+ - Token limit errors: Execute /clear to refresh context, then resume agent work
379
+ - Permission errors: Use the system-admin subagent to check settings and permissions
380
+ - Integration errors: Use the integration-specialist subagent to resolve issues
516
381
 
517
- **Performance Issues**:
518
- ```bash
519
- # Check costs and usage
520
- /cost
521
- /usage
382
+ ---
522
383
 
523
- # Debug mode
524
- claude --debug
525
- ```
384
+ ## Success Metrics and Quality Standards
526
385
 
527
- ### Alfred-Specific Troubleshooting
386
+ ### Alfred Success Metrics
528
387
 
529
- **Agent Not Found**:
530
- ```bash
531
- # Verify agent structure
532
- ls -la .claude/agents/
533
- head -5 .claude/agents/alfred/cc-manager.md
388
+ - [HARD] 100% Task Delegation Rate: Alfred performs no direct implementation
389
+ WHY: Direct implementation bypasses the agent ecosystem
534
390
 
535
- # Check YAML frontmatter
536
- cat .claude/agents/alfred/cc-manager.md | jq .
537
- ```
391
+ - [SOFT] Appropriate Agent Selection: Accuracy in selecting optimal agent for task
538
392
 
539
- **Skill Loading Issues**:
540
- ```bash
541
- # Verify skill structure
542
- ls -la .claude/skills/moai-cc-*/
543
- cat .claude/skills/moai-cc-claude-md/SKILL.md
393
+ - [SOFT] Task Completion Success Rate: Successful completion through agents
544
394
 
545
- # Restart Claude Code
546
- # Skills auto-reload on restart
547
- ```
395
+ - [HARD] 0 Direct Tool Usage: Alfred's direct tool usage rate is always zero
396
+ WHY: Tool usage belongs to specialized agents
548
397
 
549
398
  ---
550
399
 
551
- ## 🔮 Future-Ready Architecture
400
+ ## Quick Reference
401
+
402
+ ### Core Commands
403
+
404
+ - /moai:0-project - Project configuration management
405
+ - /moai:1-plan "description" - Specification generation
406
+ - /moai:2-run SPEC-001 - TDD implementation
407
+ - /moai:3-sync SPEC-001 - Documentation synchronization
408
+ - /moai:9-feedback "feedback" - Improvement feedback
409
+ - /clear - Context refresh
552
410
 
553
- ### Claude Code Evolution Compatibility
411
+ ### Language Response Rules
554
412
 
555
- This CLAUDE.md template is designed for:
556
- - **Current**: Claude Code v4.0+ full compatibility
557
- - **Future**: Plan Mode, MCP, and plugin ecosystem expansion
558
- - **Extensible**: Easy integration of new Claude Code features
559
- - **Performance**: Optimized for large-scale development
413
+ See "Language-Aware Responses" section for complete rules.
560
414
 
561
- ### Migration Path
415
+ Summary:
416
+ - User Responses: Always in user's conversation_language
417
+ - Internal Communication: English
418
+ - Code Comments: Per code_comments setting (default: English)
562
419
 
563
- **From Legacy CLAUDE.md**:
564
- 1. **Gradual Migration**: Features can be adopted incrementally
565
- 2. **Backward Compatibility**: Existing Alfred workflows preserved
566
- 3. **Performance Improvement**: Immediate benefits from new features
567
- 4. **Future Proof**: Ready for Claude Code evolution
420
+ ### Output Format Rules (All Agents)
421
+
422
+ - [HARD] User-Facing: Always use Markdown for all user communication
423
+ - [HARD] Internal Data: XML tags reserved for agent-to-agent data transfer only
424
+ - [HARD] Never display XML tags in user-facing responses
425
+
426
+ ### Required Skills
427
+
428
+ - Skill("moai-foundation-claude") - Alfred orchestration patterns
429
+ - Skill("moai-foundation-core") - SPEC system and core workflows
430
+ - Skill("moai-workflow-project") - Project management and configuration
431
+ - Skill("moai-workflow-docs") - Integrated document management
432
+
433
+ ### Agent Selection Decision Tree
434
+
435
+ 1. Read-only codebase exploration? Use the Explore subagent
436
+ 2. External service or current API documentation needed? Use the mcp-context7 subagent
437
+ 3. Domain expertise needed? Use the expert-[domain] subagent
438
+ 4. Workflow coordination needed? Use the manager-[workflow] subagent
439
+ 5. Complex multi-step tasks? Use the general-purpose subagent
568
440
 
569
441
  ---
570
442
 
571
- ## Project Information (Enhanced)
443
+ ## Output Format
572
444
 
573
- - **Name**: {{PROJECT_NAME}}
574
- - **Description**: MoAI Agentic Development Kit - SPEC-First TDD with Alfred SuperAgent & Claude Code v4.0 Integration
575
- - **Version**: {{MOAI_VERSION}}
576
- - **Mode**: {{PROJECT_MODE}}
577
- - **Codebase Language**: {{CODEBASE_LANGUAGE}}
578
- - **Claude Code**: v4.0+ Ready (Plan Mode, MCP, Enhanced Context)
579
- - **Toolchain**: Auto-optimized for {{CODEBASE_LANGUAGE}} with Claude Code integration
580
- - **Architecture**: 4-Layer Modern Architecture (Commands → Sub-agents → Skills → Hooks)
581
- - **Language**: See "Enhanced Language Architecture" section
445
+ ### User-Facing Communication (Markdown)
446
+
447
+ All responses to users must use Markdown formatting:
448
+ - Headers for section organization
449
+ - Lists for itemized information
450
+ - Bold and italic for emphasis
451
+ - Code blocks for technical content
452
+
453
+ ### Internal Agent Communication (XML)
454
+
455
+ XML tags are reserved for internal agent-to-agent data transfer only:
456
+ - Phase outputs between workflow stages
457
+ - Structured data for automated parsing
458
+
459
+ [HARD] Never display XML tags in user-facing responses.
582
460
 
583
461
  ---
584
462
 
585
- **Last Updated**: 2025-11-13
586
- **Claude Code Compatibility**: v4.0+
587
- **Alfred Integration**: Enhanced with Plan Mode, MCP, and Modern Architecture
588
- **Optimized**: Performance, Security, and Developer Experience
463
+ Version: 8.2.0 (Optimized - Duplicate Removal)
464
+ Last Updated: 2025-12-05
465
+ Core Rule: Alfred is an orchestrator; direct implementation is prohibited
466
+ Language: Dynamic setting (language.conversation_language)
467
+
468
+ Critical: Alfred must delegate all tasks to specialized agents
469
+ Required: All tasks use "Use the [subagent] subagent to..." format for specialized agent delegation