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,572 @@
1
+ ---
2
+ name: alfred:1-plan
3
+ description: Planning (brainstorming, plan writing, design discussion) + Branch/PR creation
4
+ argument-hint: "Title 1 Title 2 ... | SPEC-ID modifications"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - MultiEdit
10
+ - Grep
11
+ - Glob
12
+ - TodoWrite
13
+ - Bash(git:*)
14
+ - Bash(gh:*)
15
+ - Bash(rg:*)
16
+ - Bash(mkdir:*)
17
+ ---
18
+
19
+ # 🏗️ MoAI-ADK Step 1: Establish a plan (Plan) - Always make a plan first and then proceed.
20
+ > Interactive prompts rely on `Skill("moai-alfred-tui-survey")` so AskUserQuestion renders TUI selection menus for user surveys and approvals.
21
+
22
+ ## 🎯 Command Purpose
23
+
24
+ **"Plan → Run → Sync"** As the first step in the workflow, it supports the entire planning process from ideation to plan creation.
25
+
26
+ **Plan for**: $ARGUMENTS
27
+
28
+ ## 💡 Planning philosophy: “Always make a plan first and then proceed.”
29
+
30
+ `/alfred:1-plan` is a general-purpose command that **creates a plan**, rather than simply “creating” a SPEC document.
31
+
32
+ ### 3 main scenarios
33
+
34
+ #### Scenario 1: Creating a Plan (Primary Method) ⭐
35
+ ```bash
36
+ /alfred:1-plan "User authentication function"
37
+ → Refine idea
38
+ → Requirements specification using EARS syntax
39
+ → Create feature/SPEC-XXX branch
40
+ → Create Draft PR
41
+ ```
42
+
43
+ #### Scenario 2: Brainstorming
44
+ ```bash
45
+ /alfred:1-plan "Payment system improvement idea"
46
+ → Organizing and structuring ideas
47
+ → Deriving requirements candidates
48
+ → Technical review and risk analysis
49
+ ```
50
+
51
+ #### Scenario 3: Improve existing SPEC
52
+ ```bash
53
+ /alfred:1-plan "SPEC-AUTH-001 Security Enhancement"
54
+ → Analyze existing plan
55
+ → Establish improvement direction
56
+ → Create new version plan
57
+ ```
58
+
59
+ > **Standard two-step workflow** (see `CLAUDE.md` - "Alfred Command Execution Pattern" for details)
60
+
61
+ ## 📋 Execution flow
62
+
63
+ 1. **Project Analysis**: In-depth analysis of product/structure/tech.md
64
+ 2. **SPEC candidate discovery**: Prioritization based on business requirements
65
+ 3. **User Verification**: Review and approve writing plan
66
+ 4. **Plan creation**: Generate specifications of EARS structure (spec.md, plan.md, acceptance.md)
67
+ 5. **Git operations**: Create branches/PRs via git-manager
68
+
69
+ ## 🧠 Skill Loadout Overview
70
+
71
+ | Agent | Auto core skill | Conditional skills |
72
+ | ----- | ---------------- | ------------------ |
73
+ | 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") |
74
+ | spec-builder | Skill("moai-foundation-ears") | Skill("moai-alfred-ears-authoring"), Skill("moai-foundation-specs"), Skill("moai-alfred-spec-metadata-validation"), Skill("moai-alfred-tag-scanning"), Skill("moai-foundation-trust"), Skill("moai-alfred-trust-validation"), 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
+ - **Primary**: spec-builder (🏗️ System Architect) - Dedicated to writing SPEC documents
80
+ - **Secondary**: git-manager (🚀 Release Engineer) - Dedicated to creating Git branches/PRs
81
+
82
+ ## 💡 Example of use
83
+
84
+ Users can run commands like this:
85
+ - `/alfred:1-plan` - Auto-suggestion based on project documents
86
+ - `/alfred:1-plan "JWT authentication system"` - Manually create a single SPEC
87
+ - `/alfred:1-plan SPEC-001 "Security hardening"` - Supplementation of existing SPEC
88
+
89
+ ## 🔍 STEP 1: Project analysis and planning
90
+
91
+ Analyze project documents to propose SPEC candidates, establish implementation strategies, and receive user confirmation.
92
+
93
+ **The spec-builder agent automatically loads and analyzes the required documents.**
94
+
95
+ ### 🔍 Explore the codebase (optional)
96
+
97
+ **If the user request is unclear or requires understanding of existing code** Use the Explore agent first:
98
+
99
+ ```
100
+ Invoking the Task tool (Explore agent):
101
+ - subagent_type: "Explore"
102
+ - description: "Explore related files in the codebase"
103
+ - prompt: "Please find all files related to the following keywords: $ARGUMENTS
104
+ - File location (src/, tests/, docs/)
105
+ - Relevant SPEC document (.moai/specs/)
106
+ - Existing implementation code
107
+ thoroughness level: medium"
108
+ ```
109
+
110
+ **Criteria for using the Explore Agent**:
111
+ - ✅ Users use keywords like “where am”, “find me”, etc.
112
+ - ✅ Need to understand existing code structure
113
+ - ✅ Investigate features across multiple files
114
+ - ❌ Given a clear SPEC title (straight into spec-builder)
115
+
116
+ ### ⚙️ How to call an agent
117
+
118
+ **STEP 1 calls the spec-builder agent using the Task tool**:
119
+
120
+ ```
121
+ Call the Task tool:
122
+ - subagent_type: "spec-builder"
123
+ - description: "Analyze the plan and establish a plan"
124
+ - prompt: "Please analyze the project document and suggest SPEC candidates.
125
+ Run in analysis mode, and must include the following:
126
+ 1. In-depth analysis of product/structure/tech.md
127
+ 2. Identify SPEC candidates and Determine priorities
128
+ 3. Design EARS structure
129
+ 4. Wait for user approval
130
+ User input: $ARGUMENTS
131
+ (Optional) Explore results: $EXPLORE_RESULTS"
132
+ ```
133
+
134
+ ### Plan analysis progress
135
+
136
+ 1. **Project document analysis**
137
+ - In-depth analysis of product/structure/tech.md
138
+ - Review existing SPEC list and priorities (.moai/specs/ scan)
139
+ - Evaluate implementation feasibility and complexity
140
+ - (Optional) Identify existing code structure by reflecting the Explore results
141
+
142
+ 2. **Discovering SPEC candidates**
143
+ - Extracting core business requirements
144
+ - Reflecting technical constraints
145
+ - Creating a list of SPEC candidates by priority
146
+
147
+ 3. **Implementation plan report**
148
+ - Present step-by-step plan creation plan
149
+ - Estimated scope of work and dependency analysis
150
+ - Design EARS structure and Acceptance Criteria
151
+
152
+ ### User verification steps
153
+
154
+ After reviewing your implementation plan, Alfred invokes `Skill("moai-alfred-tui-survey")` to present the following options:
155
+ - **"Go"** or **"Start"**: Start writing the plan as planned
156
+ - **"Modify [Content]"**: Request modifications to the plan
157
+ - **"Stop"**: Stop writing the plan
158
+
159
+ ---
160
+
161
+ ## 🚀 STEP 2: Create plan document (after user approval)
162
+
163
+ After user approval (collected via `Skill("moai-alfred-tui-survey")`), call the spec-builder and git-manager agents using the **Task tool**.
164
+
165
+ ### ⚙️ How to call an agent
166
+
167
+ ```
168
+ 1. Call spec-builder (create plan):
169
+ - subagent_type: "spec-builder"
170
+ - description: "Create SPEC document"
171
+ - prompt: "Please fill out the SPEC document according to the plan approved in STEP 1.
172
+ Create a specification for the EARS structure."
173
+
174
+ 2. Invoke git-manager (Git task):
175
+ - subagent_type: "git-manager"
176
+ - description: "Create Git branch/PR"
177
+ - prompt: "After completing the plan, please create a branch and Draft PR."
178
+ ```
179
+
180
+ ## function
181
+
182
+ - **Project document analysis**: Analyzes `.moai/project/{product,structure,tech}.md` to suggest implementation candidates and generates SPEC after user approval.
183
+ - **Personal mode**: Create a `.moai/specs/SPEC-{ID}/` directory and a template document (**Directory name format required**: `SPEC-` prefix + TAG ID).
184
+ - **Team mode**: Create a GitHub Issue (or Discussion) Associate it with a branch template.
185
+
186
+ ## How to use
187
+
188
+ The user executes the command in the form:
189
+ - `/alfred:1-plan` - Auto-suggestion based on project documents (recommended)
190
+ - `/alfred:1-plan "JWT Authentication System"` - Manually create a single SPEC
191
+ - `/alfred:1-plan SPEC-001 "Security Reinforcement"` - Supplementation of existing SPEC
192
+
193
+ If not entered, 3 to 5 priorities will be suggested based on the Q&A results, and only the approved items will be confirmed as actual SPECs.
194
+
195
+ ## Summary of processing by mode
196
+
197
+ | mode | output | Branch Strategy | Additional Actions |
198
+ | -------- | -------------------------------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- |
199
+ | Personal | Templates `.moai/specs/SPEC-XXX/spec.md`, `plan.md`, `acceptance.md`, etc. | Branch from `main` or `develop` (based on settings) | git-manager agent automatically creates checkpoints |
200
+ | Team | GitHub Issue (`[SPEC-XXX] Title`), Draft PR (optional) | **Always branch from `develop`** (GitFlow standard) | `gh` CLI stay logged in, Draft PR → develop created |
201
+
202
+ ## Input options
203
+
204
+ - **Automatic suggestion**: `/alfred:1-plan` → Create a list of candidates based on the core bullet of the project document
205
+ - **Manual creation**: Pass the title as an argument → Create only 1 case, Acceptance template is supplemented after reply
206
+ - **Supplementation mode**: `SPEC-ID Delivered in “memo” format → Update existing SPEC document/Issue
207
+
208
+ ## 📋 STEP 1 Execution Guide: Project Analysis and Planning
209
+
210
+ ### ⚠️ Essential rules: Directory naming convention
211
+
212
+ **Format that must be followed**: `.moai/specs/SPEC-{ID}/`
213
+
214
+ **Correct Example**:
215
+ - ✅ `SPEC-AUTH-001/`
216
+ - ✅ `SPEC-REFACTOR-001/`
217
+ - ✅ `SPEC-UPDATE-REFACTOR-001/`
218
+
219
+ **Incorrect example**:
220
+ - ❌ `AUTH-001/` (missing SPEC- prefix)
221
+ - ❌ `SPEC-001-auth/` (additional text after ID)
222
+ - ❌ `SPEC-AUTH-001-jwt/` (additional text after ID)
223
+
224
+ **Duplicate check required**: Before creating a new SPEC ID, be sure to search the existing TAG ID to prevent duplication.
225
+
226
+ **Composite Domain Rules**:
227
+ - ✅ Allow: `UPDATE-REFACTOR-001` (2 domains)
228
+ - ⚠️ Caution: `UPDATE-REFACTOR-FIX-001` (3+ domains, simplification recommended)
229
+
230
+ ---
231
+
232
+ ### 1. Analysis of project documents
233
+
234
+ Alfred calls the spec-builder agent to perform project document-based planning analysis and planning.
235
+
236
+ #### Analysis Checklist
237
+
238
+ - [ ] **Requirements extraction**: Identify key business requirements in product.md
239
+ - [ ] **Architectural constraints**: Identify system design constraints in structure.md
240
+ - [ ] **Technical constraints**: Technology stack and quality policy in tech.md
241
+ - [ ] **Existing SPEC**: Review current SPEC list and priorities
242
+
243
+ ### 2. SPEC candidate discovery strategy
244
+
245
+ #### Prioritization criteria
246
+
247
+ | Priority | standards | SPEC Candidate Type |
248
+ | ---------- | --------------------------- | ------------------------------------------- |
249
+ | **High** | Core Business Values ​​ | User core functions, API design |
250
+ | **Medium** | System Stability | Authentication/Security, Data Management |
251
+ | **Low** | Improvements and expansions | UI/UX improvement, performance optimization |
252
+
253
+ #### Approach by SPEC type
254
+
255
+ - **API/Backend**: Endpoint design, data model, authentication
256
+ - **Frontend**: User interface, state management, routing
257
+ - **Infrastructure**: Deployment, monitoring, security policy
258
+ - **Quality**: Test strategy, performance criteria, documentation
259
+
260
+ ### 3. Create a plan Create a plan report
261
+
262
+ Present your plan in the following format:
263
+
264
+ ```
265
+ ## Plan Creation Plan Report: [TARGET]
266
+
267
+ ### 📊 Analysis Results
268
+ - **Discovered SPEC Candidates**: [Number and Category]
269
+ - **High Priority**: [List of Core SPECs]
270
+ - **Estimated Work Time**: [Time Estimation]
271
+
272
+ ### 🎯 Writing Strategy
273
+ - **Selected SPEC**: [SPEC ID and Title to Write]
274
+ - **EARS Structure**: [Event-Action-Response-State Design]
275
+ - **Acceptance Criteria**: [Given-When-Then Scenario]
276
+
277
+ ### 📦 Technology stack and library versions (optional)
278
+ **Included only if technology stack is determined during planning stage**:
279
+ - **Web search**: Use `WebSearch` to find the latest stable versions of key libraries to use
280
+ - **Specify versions**: Specify exact versions for each library, e.g. `fastapi>=0.118.3`)
281
+ - **Stability priority**: Exclude beta/alpha versions, select only production stable versions
282
+ - **Note**: Detailed version is finalized in `/alfred:2-run` stage
283
+
284
+ ### ⚠️ Precautions
285
+ - **Technical constraints**: [Restraints to consider]
286
+ - **Dependency**: [Relevance with other SPECs]
287
+ - **Branch strategy**: [Processing by Personal/Team mode]
288
+
289
+ ### ✅ Expected deliverables
290
+ - **spec.md**: [Core specifications of the EARS structure]
291
+ - **plan.md**: [Implementation plan]
292
+ - **acceptance.md**: [Acceptance criteria]
293
+ - **Branches/PR**: [Git operations by mode]
294
+
295
+ ---
296
+ **Approval Request**: Would you like to proceed with creating a plan with the above plan?
297
+ (Choose between “Proceed,” “Modify [Content],” or “Abort”)
298
+ ```
299
+
300
+ ---
301
+
302
+ ## 🚀 STEP 2 Implementation Guide: Create a Plan (After Approval)
303
+
304
+ Only if the user selects **"Proceed"** or **"Start"** will Alfred call the spec-builder agent to begin building the SPEC document.
305
+
306
+ ### EARS specification writing guide
307
+
308
+ 1. **Event**: Define trigger events that occur in the system
309
+ 2. **Action**: Specification of the system's action for an event
310
+ 3. **Response**: Defining a response as a result of an action
311
+ 4. **State**: Specifies system state changes and side effects
312
+
313
+ **Example** (see `development-guide.md` for details):
314
+ ```markdown
315
+ ### Ubiquitous Requirements
316
+ - The system must provide user authentication functionality
317
+
318
+ ### Event-driven Requirements
319
+ - WHEN the user logs in with valid credentials, the system must issue a JWT token
320
+
321
+ ### State-driven Requirements
322
+ - When the WHILE token is in an unexpired state, the system must allow access to the protected resource.
323
+
324
+ ### Constraints
325
+ - If the IF token has expired, the system must return a 401 Unauthorized response.
326
+ ```
327
+
328
+ ### 📄 SPEC Document Template
329
+
330
+ #### YAML Front Matter Schema
331
+
332
+ > **📋 SPEC Metadata Standard (SSOT)**: `.moai/memory/spec-metadata.md`
333
+
334
+ **Metadata that must be included** at the top of the spec.md file:
335
+ - **7 required fields**: id, version, status, created, updated, author, priority
336
+ - **9 optional fields**: category, labels, depends_on, blocks, related_specs, related_issue, scope
337
+
338
+ **Simple reference example**:
339
+ ```yaml
340
+ ---
341
+ id: AUTH-001
342
+ version: 0.0.1
343
+ status: draft
344
+ created: 2025-09-15
345
+ updated: 2025-09-15
346
+ author: @Goos
347
+ priority: high
348
+ ---
349
+ ```
350
+
351
+ **Core rules**:
352
+ - **id**: Same as TAG ID (`<domain>-<3 digits>`) - Never change after creation
353
+ - **Directory name**: `.moai/specs/SPEC-{ID}/` (e.g. `SPEC-AUTH-001/`)
354
+ - **Duplicate Check**: `rg "@SPEC:{ID}" -n .moai/specs/` Required
355
+ - **version**: v0.0.1 (INITIAL) → v0.1.0 (Implementation Completed) → v1.0.0 (Stable)
356
+ - **author**: GitHub @ prefix is required before ID (e.g. `@Goos`)
357
+ - **priority**: critical | high | medium | low
358
+
359
+ **Full field description and validation methods**: see `.moai/memory/spec-metadata.md`
360
+
361
+ #### HISTORY section (required)
362
+
363
+ You must include a HISTORY section **right after the YAML Front Matter**:
364
+
365
+ ```markdown
366
+ # @SPEC:AUTH-001: JWT-based authentication system
367
+
368
+ ## HISTORY
369
+
370
+ ### v0.0.1 (2025-09-15)
371
+ - **INITIAL**: Initial creation of JWT-based authentication system specification
372
+ - **AUTHOR**: @Goos
373
+ - **SCOPE**: Token issuance, verification, and renewal logic
374
+ - **CONTEXT**: Reflects requirements for strengthening user authentication
375
+
376
+ ### v0.0.2 (2025-09-20)
377
+ - **ADDED**: Added social login requirements (Draft modification)
378
+ - **AUTHOR**: @Goos
379
+ - **REVIEW**: @security-team (approved)
380
+ - **CHANGES**:
381
+ - OAuth2 integration requirements
382
+ - Google/GitHub login support
383
+
384
+ ### v0.1.0 (2025-10-01)
385
+ - **IMPLEMENTATION COMPLETED**: TDD implementation completed (status: draft → completed)
386
+ - **TDD CYCLE**: RED → GREEN → REFACTOR
387
+ - **COMMITS**: [Implementation commit hash list]
388
+ - **FILES**: [Created/modified file list]
389
+ ```
390
+
391
+ **HISTORY writing rules**:
392
+ - **Version system**: v0.0.1 (INITIAL) → v0.1.0 (implementation complete) → v1.0.0 (stabilization)
393
+ - Detailed version system: See `.moai/memory/spec-metadata.md#version-system`
394
+ - **Version order**: Latest version on top (reverse order)
395
+ - **Change type tag**: INITIAL, ADDED, CHANGED, IMPLEMENTATION COMPLETED, BREAKING, DEPRECATED, REMOVED, FIXED
396
+ - Detailed description: See `.moai/memory/spec-metadata.md#history-writing-guide`
397
+ - **Required items**: Version, date, AUTHOR, changes
398
+ - **Optional items**: REVIEW, SCOPE, CONTEXT, MIGRATION
399
+
400
+ #### SPEC document overall structure
401
+
402
+ ```markdown
403
+ ---
404
+ id: AUTH-001
405
+ version: 1.0.0
406
+ status: draft
407
+ created: 2025-09-15
408
+ updated: 2025-09-15
409
+ author: @username
410
+ ---
411
+
412
+ # @SPEC:AUTH-001: [SPEC title]
413
+
414
+ ## HISTORY
415
+ [Change history by version – see example above]
416
+
417
+ ## Environment
418
+ [System environment and prerequisites]
419
+
420
+ ## Assumptions
421
+ [Design assumptions]
422
+
423
+ ## Requirements
424
+ ### Ubiquitous
425
+ - The system must provide [feature]
426
+
427
+ ### Event-driven (event-driven)
428
+ - WHEN [condition], the system must [operate]
429
+
430
+ ### State-driven
431
+ - WHILE When in [state], the system must [operate]
432
+
433
+ ### Optional (Optional function)
434
+ - If WHERE [condition], the system can [operate]
435
+
436
+ ### Constraints
437
+ - IF [condition], the system must be [constrained]
438
+
439
+ ## Traceability (@TAG)
440
+ - **SPEC**: @SPEC:AUTH-001
441
+ - **TEST**: tests/auth/test_service.py
442
+ - **CODE**: src/auth/service.py
443
+ - **DOC**: docs/api/authentication.md
444
+ ```
445
+
446
+ ### Agent collaboration structure
447
+
448
+ - **Step 1**: The `spec-builder` agent is dedicated to analyzing project documents and creating SPEC documents.
449
+ - **Step 2**: The `git-manager` agent is dedicated to branch creation and GitHub Issue/PR creation.
450
+ - **Single Responsibility Principle**: spec-builder only writes plans, git-manager only performs Git/GitHub operations.
451
+ - **Sequential execution**: Executes in the order spec-builder → git-manager to maintain clear dependencies.
452
+ - **No inter-agent calls**: Each agent calls the other agents. It is not called directly, but is executed sequentially only at the command level.
453
+
454
+ ## 🚀 Optimized workflow execution order
455
+
456
+ ### Phase 1: Parallel project analysis (performance optimization)
457
+
458
+ **Perform simultaneously**:
459
+
460
+ ```
461
+ Task 1 (haiku): Scan project structure
462
+ ├── Detect languages/frameworks
463
+ ├── Collect list of existing SPECs
464
+ └── Draft priority backlog
465
+
466
+ Task 2 (sonnet): In-depth document analysis
467
+ ├── product.md requirements extraction
468
+ ├── structure.md architecture analysis
469
+ └── tech.md technical constraints
470
+ ```
471
+
472
+ **Performance improvements**: Parallelize basic scans and deep analysis to minimize latency
473
+
474
+ ### Phase 2: Create SPEC document integration
475
+
476
+ The `spec-builder` agent (sonnet) integrates the results of the parallel analysis:
477
+
478
+ - Proposal of function candidates based on project document
479
+ - Creation of SPEC document after user approval (using MultiEdit)
480
+ - Simultaneous creation of 3 files (spec.md, plan.md, acceptance.md)
481
+
482
+ ### Phase 3: Git task processing
483
+
484
+ Final processing by the `git-manager` agent (haiku):
485
+
486
+ - **Branch creation**: Apply strategy for each mode
487
+ - **Personal mode**: Branch from `main` or `develop` (based on project settings)
488
+ - **Team mode**: **Always branch from `develop`** (GitFlow standard)
489
+ - Branch name: `feature/SPEC-{ID}` format
490
+ - **Create GitHub Issue**: Create SPEC Issue in Team mode
491
+ - **Create Draft PR**: `feature/SPEC-{ID}` → `develop` in Team mode Create PR
492
+ - **Initial Commit**: Commit SPEC document and create tags
493
+
494
+ **Important**: Each agent runs independently, and direct calls between agents are prohibited.
495
+
496
+ ## Agent role separation
497
+
498
+ ### spec-builder dedicated area
499
+
500
+ - Analysis of project documents and discovery of SPEC candidates
501
+ - Preparation of EARS structure specifications
502
+ - Preparation of Acceptance Criteria (Given-When-Then)
503
+ - Verification of SPEC document quality
504
+ - Application of @TAG system
505
+
506
+ ### git-manager dedicated area
507
+
508
+ - Create and manage all Git branches
509
+ - **Apply branch strategy for each mode**
510
+ - Personal: Branch from `main` or `develop`
511
+ - Team: **Always branch from `develop`** (GitFlow)
512
+ - Create GitHub Issue/PR
513
+ - Team Mode: Create Draft PR (`feature/SPEC-{ID}` → `develop`)
514
+ - Create initial commit and tags
515
+ - Handle remote synchronization
516
+
517
+ ## Step 2 workflow execution sequence
518
+
519
+ ### Phase 1: Analysis and planning phase
520
+
521
+ **Plan Analyzer** does the following:
522
+
523
+ 1. **Loading project document**: In-depth analysis of product/structure/tech.md
524
+ 2. **SPEC candidate discovery**: Prioritization based on business requirements
525
+ 3. **Establishment of implementation strategy**: EARS structure and acceptance design
526
+ 4. **Creating a Writing Plan**: Presents a step-by-step approach to writing a plan
527
+ 5. **Awaiting user approval**: Review plan and gather feedback
528
+
529
+ ### Phase 2: Plan preparation phase (after approval)
530
+
531
+ The `spec-builder` agent **continuously** performs after user approval:
532
+
533
+ 1. **Writing EARS specification**: Event-Action-Response-State structuring
534
+ 2. **Acceptance Criteria**: Given-When-Then Scenario Writing
535
+ 3. **Document quality verification**: Apply TRUST principles and @TAG
536
+ 4. **Template creation**: Simultaneous creation of spec.md, plan.md, acceptance.md
537
+
538
+ ### Phase 3: Git operations (git-manager)
539
+
540
+ The `git-manager` agent does **all at once** after the SPEC is complete:
541
+
542
+ 1. **Create branch**: Apply branch strategy for each mode
543
+ 2. **GitHub Issue**: Create SPEC Issue in Team mode
544
+ 3. **Initial commit**: Commit SPEC document and create tags
545
+ 4. **Remote Sync**: Apply synchronization strategy for each mode
546
+
547
+ ## Writing Tips
548
+
549
+ - Information that is not in the product/structure/tech document is supplemented by asking a new question.
550
+ - Acceptance Criteria is encouraged to be written at least 2 times in 3 columns Given/When/Then.
551
+ - The number of modules is reduced due to the relaxation of the Readable standard among the TRUST principles. If the recommended value (default 5) is exceeded, please include justification in the SPEC `context` section.
552
+
553
+ ---
554
+
555
+ ## 🧠 Context Management
556
+
557
+ > For more information: `.moai/memory/development-guide.md` - see section "Context Engineering"
558
+
559
+ ### Core strategy of this command
560
+
561
+ **Load first**: `.moai/project/product.md` (business requirement)
562
+
563
+ **Recommendation**: The plan is complete. 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:2-run`).
564
+
565
+ ---
566
+
567
+ ## Next steps
568
+
569
+ **Recommendation**: For better performance and context management, start a new chat session with the `/clear` or `/new` command before proceeding to the next step.
570
+
571
+ - Start implementing TDD with `/alfred:2-run SPEC-XXX`
572
+ - Team mode: After creating an issue, the git-manager agent automatically creates a branch.