moai-adk 0.3.13__py3-none-any.whl → 0.4.1__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 (141) hide show
  1. moai_adk/__init__.py +1 -1
  2. moai_adk/__main__.py +1 -1
  3. moai_adk/cli/commands/__init__.py +1 -1
  4. moai_adk/cli/commands/doctor.py +2 -2
  5. moai_adk/cli/commands/init.py +10 -5
  6. moai_adk/cli/commands/status.py +1 -1
  7. moai_adk/cli/commands/update.py +210 -8
  8. moai_adk/cli/prompts/init_prompts.py +15 -19
  9. moai_adk/core/__init__.py +1 -1
  10. moai_adk/core/diagnostics/slash_commands.py +1 -1
  11. moai_adk/core/git/branch.py +1 -1
  12. moai_adk/core/git/manager.py +1 -1
  13. moai_adk/core/project/backup_utils.py +1 -0
  14. moai_adk/core/project/phase_executor.py +3 -1
  15. moai_adk/core/project/validator.py +3 -2
  16. moai_adk/core/quality/__init__.py +1 -1
  17. moai_adk/core/quality/trust_checker.py +1 -1
  18. moai_adk/core/quality/validators/__init__.py +1 -1
  19. moai_adk/core/quality/validators/base_validator.py +1 -1
  20. moai_adk/core/template/__init__.py +1 -1
  21. moai_adk/core/template/backup.py +12 -3
  22. moai_adk/core/template/config.py +24 -0
  23. moai_adk/core/template/languages.py +1 -1
  24. moai_adk/core/template/merger.py +74 -4
  25. moai_adk/core/template/processor.py +62 -14
  26. moai_adk/templates/.claude/agents/alfred/cc-manager.md +765 -191
  27. moai_adk/templates/.claude/agents/alfred/debug-helper.md +116 -103
  28. moai_adk/templates/.claude/agents/alfred/doc-syncer.md +130 -116
  29. moai_adk/templates/.claude/agents/alfred/git-manager.md +186 -174
  30. moai_adk/templates/.claude/agents/alfred/implementation-planner.md +227 -213
  31. moai_adk/templates/.claude/agents/alfred/project-manager.md +205 -125
  32. moai_adk/templates/.claude/agents/alfred/quality-gate.md +224 -209
  33. moai_adk/templates/.claude/agents/alfred/spec-builder.md +174 -160
  34. moai_adk/templates/.claude/agents/alfred/tag-agent.md +151 -139
  35. moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +209 -196
  36. moai_adk/templates/.claude/agents/alfred/trust-checker.md +247 -233
  37. moai_adk/templates/.claude/commands/alfred/0-project.md +856 -355
  38. moai_adk/templates/.claude/commands/alfred/1-plan.md +572 -0
  39. moai_adk/templates/.claude/commands/alfred/2-run.md +470 -0
  40. moai_adk/templates/.claude/commands/alfred/3-sync.md +366 -356
  41. moai_adk/templates/.claude/hooks/alfred/README.md +52 -52
  42. moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +44 -48
  43. moai_adk/templates/.claude/hooks/alfred/core/__init__.py +17 -17
  44. moai_adk/templates/.claude/hooks/alfred/core/checkpoint.py +59 -59
  45. moai_adk/templates/.claude/hooks/alfred/core/context.py +19 -19
  46. moai_adk/templates/.claude/hooks/alfred/core/project.py +52 -52
  47. moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +1 -1
  48. moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +4 -4
  49. moai_adk/templates/.claude/hooks/alfred/handlers/session.py +30 -51
  50. moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +16 -17
  51. moai_adk/templates/.claude/hooks/alfred/handlers/user.py +11 -11
  52. moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +308 -307
  53. moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +297 -296
  54. moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +191 -190
  55. moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +112 -0
  56. moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +103 -0
  57. moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +103 -0
  58. moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +95 -0
  59. moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +99 -0
  60. moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +105 -0
  61. moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +97 -0
  62. moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +97 -0
  63. moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +90 -0
  64. moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +99 -0
  65. moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +87 -0
  66. moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +62 -0
  67. moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +94 -0
  68. moai_adk/templates/.claude/skills/moai-claude-code/examples.md +513 -0
  69. moai_adk/templates/.claude/skills/moai-claude-code/reference.md +433 -0
  70. moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +332 -0
  71. moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +384 -0
  72. moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +363 -0
  73. moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +595 -0
  74. moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +496 -0
  75. moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +99 -0
  76. moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +95 -0
  77. moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +98 -0
  78. moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +100 -0
  79. moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +100 -0
  80. moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +99 -0
  81. moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +99 -0
  82. moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +93 -0
  83. moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +105 -0
  84. moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +97 -0
  85. moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +102 -0
  86. moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +104 -0
  87. moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +96 -0
  88. moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +112 -0
  89. moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +98 -0
  90. moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +90 -0
  91. moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +94 -0
  92. moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +93 -0
  93. moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +86 -0
  94. moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +86 -0
  95. moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +100 -0
  96. moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +100 -0
  97. moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +102 -0
  98. moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +100 -0
  99. moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +98 -0
  100. moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +99 -0
  101. moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +100 -0
  102. moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +100 -0
  103. moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +98 -0
  104. moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +96 -0
  105. moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +98 -0
  106. moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +99 -0
  107. moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +98 -0
  108. moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +98 -0
  109. moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +96 -0
  110. moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +99 -0
  111. moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +99 -0
  112. moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +100 -0
  113. moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +100 -0
  114. moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +100 -0
  115. moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +100 -0
  116. moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +99 -0
  117. moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +96 -0
  118. moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +44 -43
  119. moai_adk/templates/.github/workflows/moai-gitflow.yml +36 -35
  120. moai_adk/templates/.moai/config.json +9 -6
  121. moai_adk/templates/.moai/memory/development-guide.md +220 -221
  122. moai_adk/templates/.moai/memory/gitflow-protection-policy.md +85 -85
  123. moai_adk/templates/.moai/memory/spec-metadata.md +149 -150
  124. moai_adk/templates/.moai/project/product.md +90 -90
  125. moai_adk/templates/.moai/project/structure.md +85 -85
  126. moai_adk/templates/.moai/project/tech.md +117 -117
  127. moai_adk/templates/CLAUDE.md +354 -573
  128. moai_adk/templates/__init__.py +1 -1
  129. moai_adk/utils/__init__.py +1 -1
  130. moai_adk/utils/banner.py +7 -7
  131. moai_adk/utils/logger.py +1 -1
  132. moai_adk-0.4.1.dist-info/METADATA +303 -0
  133. moai_adk-0.4.1.dist-info/RECORD +152 -0
  134. moai_adk/templates/.claude/commands/alfred/1-spec.md +0 -532
  135. moai_adk/templates/.claude/commands/alfred/2-build.md +0 -432
  136. moai_adk/templates/.moai/hooks/pre-push.sample +0 -88
  137. moai_adk-0.3.13.dist-info/METADATA +0 -1586
  138. moai_adk-0.3.13.dist-info/RECORD +0 -90
  139. {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/WHEEL +0 -0
  140. {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/entry_points.txt +0 -0
  141. {moai_adk-0.3.13.dist-info → moai_adk-0.4.1.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,470 @@
1
+ ---
2
+ name: alfred:2-run
3
+ description: "Implement all SPECs with SPEC ID to implement (e.g. SPEC-001) or all - Execute planned work (TDD implementation, prototyping, documentation, etc.)"
4
+ argument-hint: "SPEC-ID - All with SPEC ID to implement (e.g. SPEC-001) or all “SPEC Implementation”
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - MultiEdit
10
+ - Bash(python3:*)
11
+ - Bash(pytest:*)
12
+ - Bash(npm:*)
13
+ - Bash(node:*)
14
+ - Bash(git:*)
15
+ - Task
16
+ - WebFetch
17
+ - Grep
18
+ - Glob
19
+ - TodoWrite
20
+ ---
21
+
22
+ # ⚒️ MoAI-ADK Phase 2: Run the plan - Flexible implementation strategy
23
+ > Interactive prompts rely on `Skill("moai-alfred-tui-survey")` so AskUserQuestion renders TUI selection menus for user surveys and approvals.
24
+
25
+ ## 🎯 Command Purpose
26
+
27
+ Analyze SPEC documents to execute planned tasks. It supports not only TDD implementation but also various execution scenarios such as prototyping and documentation work.
28
+
29
+ **Run on**: $ARGUMENTS
30
+
31
+ ## 💡 Execution philosophy: “Plan → Run → Sync”
32
+
33
+ `/alfred:2-run` is a general-purpose command that does not simply "build" code, but **performs** a planned task.
34
+
35
+ ### 3 main scenarios
36
+
37
+ #### Scenario 1: TDD implementation (main method) ⭐
38
+ ```bash
39
+ /alfred:2-run SPEC-AUTH-001
40
+ → RED → GREEN → REFACTOR
41
+ → Implement high-quality code through test-driven development
42
+ ```
43
+
44
+ #### Scenario 2: Prototyping
45
+ ```bash
46
+ /alfred:2-run SPEC-PROTO-001
47
+ → Prototype implementation for quick verification
48
+ → Quick feedback with minimal testing
49
+ ```
50
+
51
+ #### Scenario 3: Documentation tasks
52
+ ```bash
53
+ /alfred:2-run SPEC-DOCS-001
54
+ → Writing documentation and generating sample code
55
+ → API documentation, tutorials, guides, etc.
56
+ ```
57
+
58
+ > **Standard two-step workflow** (see `CLAUDE.md` - "Alfred Command Execution Pattern" for details)
59
+
60
+ ## 📋 Execution flow
61
+
62
+ 1. **SPEC Analysis**: Requirements extraction and complexity assessment
63
+ 2. **Establishment of implementation strategy**: Determine the optimized approach for each language (TDD, prototype, documentation, etc.)
64
+ 3. **User Confirmation**: Review and approve action plan
65
+ 4. **Execute work**: Perform work according to the approved plan
66
+ 5. **Git Operations**: Creating step-by-step commits with git-manager
67
+
68
+ ## 🧠 Skill Loadout Overview
69
+
70
+ | Agent | Auto core skill | Conditional skills |
71
+ | ----- | ---------------- | ------------------ |
72
+ | implementation-planner | Skill("moai-alfred-language-detection") | Skill("moai-foundation-langs"), Skill("moai-alfred-performance-optimizer"), Skill("moai-alfred-tag-scanning"), Detected domain skill (e.g., Skill("moai-domain-backend")), Skill("moai-alfred-trust-validation"), Skill("moai-alfred-tui-survey") |
73
+ | tdd-implementer | Skill("moai-essentials-debug") | Detected language skill (e.g., Skill("moai-lang-python")), Skill("moai-essentials-refactor"), Skill("moai-alfred-git-workflow"), Skill("moai-essentials-perf"), Skill("moai-alfred-performance-optimizer"), Skill("moai-alfred-tui-survey") |
74
+ | quality-gate | Skill("moai-alfred-trust-validation") | Skill("moai-alfred-tag-scanning"), Skill("moai-alfred-code-reviewer"), Skill("moai-essentials-review"), Skill("moai-essentials-perf"), Skill("moai-alfred-performance-optimizer"), Skill("moai-foundation-trust"), Skill("moai-alfred-tui-survey") |
75
+ | git-manager | Skill("moai-alfred-git-workflow") | Skill("moai-foundation-git"), Skill("moai-alfred-trust-validation"), Skill("moai-alfred-tag-scanning"), Skill("moai-alfred-tui-survey") |
76
+
77
+ ## 🔗 Associated Agent
78
+
79
+ - **Phase 1**: implementation-planner (📋 technical architect) - SPEC analysis and establishment of execution strategy
80
+ - **Phase 2**: tdd-implementer (🔬 senior developer) - Dedicated to execution work
81
+ - **Phase 2.5**: quality-gate (🛡️ Quality Assurance Engineer) - TRUST principle verification (automatically)
82
+ - **Phase 3**: git-manager (🚀 Release Engineer) - Dedicated to Git commits
83
+
84
+ ## 💡 Example of use
85
+
86
+ Users can run commands as follows:
87
+ - `/alfred:2-run SPEC-001` - Run a specific SPEC
88
+ - `/alfred:2-run all` - Run all SPECs in batches
89
+ - `/alfred:2-run SPEC-003 --test` - Run only tests
90
+
91
+ ## 🔍 STEP 1: SPEC analysis and execution plan establishment
92
+
93
+ First, the specified SPEC is analyzed to establish an action plan and receive user confirmation.
94
+
95
+ **The implementation-planner agent automatically loads and analyzes the required documents.**
96
+
97
+ ### 🔍 Browse the code base (recommended)
98
+
99
+ **If you need to understand existing code structure or find similar patterns** Use the Explore agent first:
100
+
101
+ ```
102
+ Invoking the Task tool (Explore agent):
103
+ - subagent_type: "Explore"
104
+ - description: "Explore existing code structures and patterns"
105
+ - prompt: "Please explore existing code related to SPEC-$ARGUMENTS:
106
+ - Similar function implementation code (src/)
107
+ - Test patterns for reference (tests/)
108
+ - Architectural patterns and design patterns
109
+ - Use Current libraries and versions (package.json, requirements.txt)
110
+ thoroughness level: medium"
111
+ ```
112
+
113
+ **When to use the Explore Agent**:
114
+ - ✅ When you need to understand the existing code structure/pattern
115
+ - ✅ When you need to refer to how a similar function is implemented
116
+ - ✅ When you need to understand the architectural rules of the project
117
+ - ✅ Check the library and version being used
118
+
119
+ ### ⚙️ How to call an agent
120
+
121
+ **In STEP 1, we call the implementation-planner agent using the Task tool**:
122
+
123
+ ```
124
+ Task tool call example:
125
+ - subagent_type: "implementation-planner"
126
+ - description: "SPEC analysis and establishment of execution strategy"
127
+ - prompt: "Please analyze the SPEC of $ARGUMENTS and establish an execution plan.
128
+ It must include the following:
129
+ 1. SPEC requirements extraction and complexity assessment
130
+ 2. Library and tool selection (using WebFetch)
131
+ 3. TAG chain design
132
+ 4. Step-by-step execution plan
133
+ 5. Risks and response plans
134
+ 6. Create action plan and use `Skill("moai-alfred-tui-survey")` to confirm the next action with the user
135
+ (Optional) Explore results: $EXPLORE_RESULTS"
136
+ ```
137
+
138
+ ### SPEC analysis in progress
139
+
140
+ 1. **SPEC document analysis**
141
+ - Requirements extraction and complexity assessment
142
+ - Check technical constraints
143
+ - Dependency and impact scope analysis
144
+ - (Optional) Identify existing code structure based on Explore results
145
+
146
+ 2. **Establish execution strategy**
147
+ - Detect project language and optimize execution strategy
148
+ - Determine approach (TDD, prototyping, documentation, etc.)
149
+ - Estimate expected work scope and time
150
+
151
+ 3. **Check and specify library versions (required)**
152
+ - **Web search**: Check the latest stable versions of all libraries to be used through `WebSearch`
153
+ - **Specify versions**: Specify the exact version for each library in the implementation plan report (e.g. `fastapi>=0.118.3`)
154
+ - **Stability priority**: Exclude beta/alpha versions, select only production stable versions
155
+ - **Check compatibility**: Verify version compatibility between libraries
156
+ - **Search keyword examples**:
157
+ - `"FastAPI latest stable version 2025"`
158
+ - `"SQLAlchemy 2.0 latest stable version 2025"`
159
+ - `"React 18 latest stable version 2025"`
160
+
161
+ 4. **Report action plan**
162
+ - Present step-by-step action plan
163
+ - Identify potential risk factors
164
+ - Set quality gate checkpoints
165
+ - **Specify library version (required)**
166
+
167
+ ### User verification steps
168
+
169
+ After reviewing the action plan, select one of the following:
170
+ - **"Proceed"** or **"Start"**: Start executing the task as planned
171
+ - **"Modify [Content]"**: Request a plan modification
172
+ - **"Abort"**: Stop the task
173
+
174
+ ---
175
+
176
+ ## 🚀 STEP 2: Execute task (after user approval)
177
+
178
+ After user approval (gathered through `Skill("moai-alfred-tui-survey")`), **call the tdd-implementer agent using the Task tool**.
179
+
180
+ ### ⚙️ How to call an agent
181
+
182
+ **STEP 2 calls tdd-implementer using the Task tool**:
183
+
184
+ ```
185
+ Task tool call example:
186
+ - subagent_type: "tdd-implementer"
187
+ - description: "Execute task"
188
+ - prompt: "Please execute the task according to the plan approved in STEP 1.
189
+ For TDD scenario:
190
+ - Perform RED → GREEN → REFACTOR cycle,
191
+ Perform the following for each TAG:
192
+ 1. RED Phase: Write a test that fails with the @TEST:ID tag
193
+ 2. GREEN Phase: Minimal implementation with the @CODE:ID tag
194
+ 3. REFACTOR Phase: Improve code quality
195
+ 4. Verify TAG completion conditions and proceed to the next TAG
196
+
197
+ Execute on: $ARGUMENTS"
198
+ ```
199
+
200
+ ## 🔗 TDD optimization for each language
201
+
202
+ ### Project language detection and optimal routing
203
+
204
+ `tdd-implementer` automatically detects the language of your project and selects the optimal TDD tools and workflow:
205
+
206
+ - **Language detection**: Analyze project files (package.json, pyproject.toml, go.mod, etc.)
207
+ - **Tool selection**: Automatically select the optimal test framework for each language
208
+ - **TAG application**: Write @TAG annotations directly in code files
209
+ - **Run cycle**: RED → GREEN → REFACTOR sequential process
210
+
211
+ ### TDD tool mapping
212
+
213
+ #### Backend/System
214
+
215
+ | SPEC Type | Implementation language | Test Framework | Performance Goals | Coverage Goals |
216
+ |-----------|-----------|-------------------|-----------|---------------|
217
+ | **CLI/System** | TypeScript | jest + ts-node | < 18ms | 95%+ |
218
+ | **API/Backend** | TypeScript | Jest + SuperTest | < 50ms | 90%+ |
219
+ | **Frontend** | TypeScript | Jest + Testing Library | < 100ms | 85%+ |
220
+ | **Data Processing** | TypeScript | Jest + Mock | < 200ms | 85%+ |
221
+ | **Python Project** | Python | pytest + mypy | Custom | 85%+ |
222
+
223
+ #### Mobile Framework
224
+
225
+ | SPEC Type | Implementation language | Test Framework | Performance Goals | Coverage Goals |
226
+ |-----------|-----------|-------------------|-----------|---------------|
227
+ | **Flutter App** | Dart | flutter test + widget test | < 100ms | 85%+ |
228
+ | **React Native** | TypeScript | Jest + RN Testing Library | < 100ms | 85%+ |
229
+ | **iOS App** | Swift | XCTest + XCUITest | < 150ms | 80%+ |
230
+ | **Android App** | Kotlin | JUnit + Espresso | < 150ms | 80%+ |
231
+
232
+ ## 🚀 Optimized agent collaboration structure
233
+
234
+ - **Phase 1**: `implementation-planner` agent analyzes SPEC and establishes execution strategy
235
+ - **Phase 2**: `tdd-implementer` agent executes tasks (TDD cycle, prototyping, documentation, etc.)
236
+ - **Phase 2.5**: `quality-gate` agent verifies TRUST principle and quality verification (automatically)
237
+ - **Phase 3**: `git-manager` agent processes all commits at once after task completion
238
+ - **Single responsibility principle**: Each agent is responsible only for its own area of expertise
239
+ - **Inter-agent call prohibited**: Each agent runs independently, sequential calls are made only at the command level
240
+
241
+ ## 🔄 Step 2 Workflow Execution Order
242
+
243
+ ### Phase 1: Analysis and planning phase
244
+
245
+ The `implementation-planner` agent does the following:
246
+
247
+ 1. **SPEC document analysis**: Requirements extraction and complexity assessment of specified SPEC ID
248
+ 2. **Library selection**: Check the latest stable version and verify compatibility through WebFetch
249
+ 3. **TAG chain design**: Determine TAG order and dependency
250
+ 4. **Establishment of implementation strategy**: Step-by-step implementation plan and risk identification
251
+ 5. **Create action plan**: Create a structured plan and, via `Skill("moai-alfred-tui-survey")`, collect user approval before proceeding
252
+
253
+ ### Phase 2: Task execution phase (after approval)
254
+
255
+ The `tdd-implementer` agent performs **TAG-by-TAG** after user approval (based on TDD scenario):
256
+
257
+ 1. **RED Phase**: Write a failing test (add @TEST:ID tag) and check for failure
258
+ 2. **GREEN Phase**: Write minimal code that passes the test (add @CODE:ID tag)
259
+ 3. **REFACTOR Phase**: Improve code quality (without changing functionality)
260
+ 4. **TAG completion confirmation**: Verify the completion conditions of each TAG and proceed to the next TAG
261
+
262
+ ### Phase 2.5: Quality verification gate (automatic execution)
263
+
264
+ After the job execution is complete, the `quality-gate` agent **automatically** performs quality verification.
265
+
266
+ **Automatic execution conditions**:
267
+ - Automatically invoked upon completion of task execution
268
+ - Manually invoked upon user request
269
+
270
+ **Verification items**:
271
+ - **TRUST principle verification**: Trust-checker script execution and result parsing
272
+ - T (Testable): Test coverage ≥ 85%
273
+ - R (Readable): Code readability (file≤300 LOC, function≤50 LOC, Complexity≤10)
274
+ - U (Unified): Architectural integrity
275
+ - S (Secured): No security vulnerabilities
276
+ - T (Traceable): @TAG chain integrity
277
+ - **Code style**: Run and verify linter (ESLint/Pylint)
278
+ - **Test Coverage**: Run language-specific coverage tools and verify goal achievement
279
+ - **TAG chain verification**: Check orphan TAGs, missing TAGs
280
+ - **Dependency verification**: Check security vulnerabilities
281
+
282
+ **How ​​it works**: When Alfred completes job execution, it automatically calls the quality-gate agent to perform quality verification.
283
+
284
+ **Handling verification results**:
285
+
286
+ ✅ **PASS (0 Critical, 5 or less Warnings)**:
287
+ - Proceed to Phase 3 (Git work)
288
+ - Create a quality report
289
+
290
+ ⚠️ **WARNING (0 Critical, 6 or more Warnings)**:
291
+ - Display warning
292
+ - User choice: "Continue" or "Re-verify after modification"
293
+
294
+ ❌ **CRITICAL (1 or more Critical)**:
295
+ - Block Git commits
296
+ - Detailed report on items requiring improvement (including file: line information)
297
+ - Recommended tdd-implementer re-invocation
298
+
299
+ **Skip verification option**: To skip quality verification, use the `--skip-quality-check` option.
300
+
301
+ ### Phase 3: Git operations (git-manager)
302
+
303
+ After the `git-manager` agent completes the task **at once**:
304
+
305
+ 1. **Create checkpoint**: Backup point before starting work
306
+ 2. **Structured Commit**: Step-by-step commit creation (RED→GREEN→REFACTOR for TDD)
307
+ 3. **Final synchronization**: Apply Git strategy for each mode and remote synchronization
308
+
309
+
310
+ ## 📋 STEP 1 Execution Guide: SPEC Analysis and Planning
311
+
312
+ ### 1. SPEC document analysis
313
+
314
+ Alfred calls the implementation-planner agent to check the SPEC document and create an execution plan.
315
+
316
+ #### Analysis Checklist
317
+
318
+ - [ ] **Requirements clarity**: Are the functional requirements in the SPEC specific?
319
+ - [ ] **Technical constraints**: Check performance, compatibility, and security requirements
320
+ - [ ] **Dependency analysis**: Connection points with existing code and scope of impact
321
+ - [ ] **Complexity assessment**: Implementation difficulty and expected workload
322
+
323
+ ### 2. Determine implementation strategy
324
+
325
+ #### TypeScript execution criteria
326
+
327
+ | SPEC characteristics | execution language | Reason |
328
+ |-----------|-----------|------|
329
+ | CLI/System Tools | TypeScript | High performance (18ms), type safety, SQLite3 integration |
330
+ | API/Backend | TypeScript | Node.js ecosystem, Express/Fastify compatibility |
331
+ | Frontend | TypeScript | React/Vue native support |
332
+ | data processing | TypeScript | High-performance asynchronous processing, type safety |
333
+ | User Python Project | Python tool support | MoAI-ADK provides Python project development tools |
334
+
335
+ #### Approach
336
+
337
+ - **Bottom-up**: Utility → Service → API
338
+ - **Top-down**: API → Service → Utility
339
+ - **Middle-out**: Core logic → Bidirectional expansion
340
+
341
+ ### 3. Generate action plan report
342
+
343
+ Present your plan in the following format:
344
+
345
+ ```
346
+ ## Execution Plan Report: [SPEC-ID]
347
+
348
+ ### 📊 Analysis Results
349
+ - **Complexity**: [Low/Medium/High]
350
+ - **Estimated Work Time**: [Time Estimation]
351
+ - **Key Technical Challenges**: [Technical Difficulties]
352
+
353
+ ### 🎯 Execution Strategy
354
+ - **Language of choice**: [Python/TypeScript + Reason]
355
+ - **Approach**: [Bottom-up/Top-down/Middle-out or Prototype/Documentation]
356
+ - **Core module**: [Major work target]
357
+
358
+ ### 📦 Library version (required - based on web search)
359
+ **Backend dependencies** (example):
360
+ | package | Latest stable version | installation command |
361
+ |--------|--------------|----------|
362
+ | FastAPI | 0.118.3 | fastapi>=0.118.3 |
363
+ | SQLAlchemy | 2.0.43 | sqlalchemy>=2.0.43 |
364
+
365
+ **Frontend dependency** (example):
366
+ | package | Latest stable version | installation command |
367
+ |--------|--------------|----------|
368
+ | React | 18.3.1 | react@^18.3.1 |
369
+ | Vite | 7.1.9 | vite@^7.1.9 |
370
+
371
+ **Important Compatibility Information**:
372
+ - [Specific Version Requirements]
373
+ - [Known Compatibility Issues]
374
+
375
+ ### ⚠️ Risk Factors
376
+ - **Technical Risk**: [Expected Issues]
377
+ - **Dependency Risk**: [External Dependency Issues]
378
+ - **Schedule Risk**: [Possible Delay]
379
+
380
+ ### ✅ Quality Gates
381
+ - **Test Coverage**: [Goal %]
382
+ - **Performance Goals**: [Specific Metrics]
383
+ - **Security Checkpoints**: [Verification Items]
384
+
385
+ ---
386
+ **Approval Request**: Do you want to proceed with the above plan?
387
+ (Choose between “Proceed,” “Modify [Content],” or “Abort”)
388
+ ```
389
+
390
+ ---
391
+
392
+ ## 🚀 STEP 2 Execution Guide: Execute Task (After Approval)
393
+
394
+ Only if the user selects **"Proceed"** or **"Start"** will Alfred call the tdd-implementer agent to start the task.
395
+
396
+ ### TDD step-by-step guide
397
+
398
+ 1. **RED**: Writing failure tests with Given/When/Then structure. Follow test file rules for each language and simply record failure logs.
399
+ 2. **GREEN**: Add only the minimal implementation that makes the tests pass. Optimization is postponed to the REFACTOR stage.
400
+ 3. **REFACTOR**: Removal of duplication, explicit naming, structured logging/exception handling enhancements. Split into additional commits if necessary.
401
+
402
+ **TRUST 5 Principles Linkage** (Details: `development-guide.md` - "TRUST 5 Principles"):
403
+ - **T (Test First)**: Writing SPEC-based tests in the RED stage
404
+ - **R (Readable)**: Readability in the REFACTOR stage Improvement (file≤300 LOC, function≤50 LOC)
405
+ - **T (Trackable)**: Maintain @TAG traceability at all stages.
406
+
407
+ > TRUST 5 principles provide only basic recommendations, so if you need a structure that exceeds `simplicity_threshold`, proceed with the basis in SPEC or ADR.
408
+
409
+ ## Agent role separation
410
+
411
+ ### implementation-planner dedicated area
412
+
413
+ - SPEC document analysis and requirements extraction
414
+ - Library selection and version management
415
+ - TAG chain design and sequence decision
416
+ - Establishment of implementation strategy and identification of risks
417
+ - Creation of execution plan
418
+
419
+ ### tdd-implementer dedicated area
420
+
421
+ - Execute tasks (TDD, prototyping, documentation, etc.)
422
+ - Write and run tests (TDD scenarios)
423
+ - Add and manage TAG comments
424
+ - Improve code quality (refactoring)
425
+ - Run language-specific linters/formatters
426
+
427
+ ### Quality-gate dedicated area
428
+
429
+ - TRUST principle verification
430
+ - Code style verification
431
+ - Test coverage verification
432
+ - TAG chain integrity verification
433
+ - Dependency security verification
434
+
435
+ ### git-manager dedicated area
436
+
437
+ - All Git commit operations (add, commit, push)
438
+ - Checkpoint creation for each task stage
439
+ - Apply commit strategy for each mode
440
+ - Git branch/tag management
441
+ - Remote synchronization processing
442
+
443
+ ## Quality Gate Checklist
444
+
445
+ - Test coverage ≥ `.moai/config.json.test_coverage_target` (default 85%)
446
+ - Pass linter/formatter (`ruff`, `eslint --fix`, `gofmt`, etc.)
447
+ - Check presence of structured logging or observation tool call
448
+ - @TAG update needed changes note (used by doc-syncer in next step)
449
+
450
+ ---
451
+
452
+ ## 🧠 Context Management
453
+
454
+ > For more information: `.moai/memory/development-guide.md` - see section "Context Engineering"
455
+
456
+ ### Core strategy of this command
457
+
458
+ **Load first**: `.moai/specs/SPEC-XXX/spec.md` (implementation target requirement)
459
+
460
+ **Recommendation**: Job execution completed successfully. You can experience better performance and context management by starting a new chat session with the `/clear` or `/new` command before proceeding to the next step (`/alfred:3-sync`).
461
+
462
+ ---
463
+
464
+ ## Next steps
465
+
466
+ **Recommendation**: For better performance and context management, start a new chat session with the `/clear` or `/new` command before proceeding to the next step.
467
+
468
+ - After task execution is complete, document synchronization proceeds with `/alfred:3-sync`
469
+ - All Git operations are dedicated to the git-manager agent to ensure consistency
470
+ - Only command-level orchestration is used without direct calls between agents