moai-adk 0.4.0__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.
- moai_adk/__init__.py +1 -8
- moai_adk/cli/commands/init.py +10 -5
- moai_adk/cli/commands/update.py +274 -118
- moai_adk/cli/prompts/init_prompts.py +14 -18
- moai_adk/core/diagnostics/slash_commands.py +1 -1
- moai_adk/core/project/backup_utils.py +1 -0
- moai_adk/core/project/phase_executor.py +3 -1
- moai_adk/core/project/validator.py +3 -2
- moai_adk/core/template/backup.py +11 -3
- moai_adk/core/template/merger.py +16 -3
- moai_adk/core/template/processor.py +22 -3
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +443 -424
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +116 -103
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +130 -116
- moai_adk/templates/.claude/agents/alfred/git-manager.md +186 -174
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +227 -213
- moai_adk/templates/.claude/agents/alfred/project-manager.md +205 -125
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +224 -209
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +174 -160
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +151 -139
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +209 -196
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +247 -233
- moai_adk/templates/.claude/commands/alfred/0-project.md +673 -640
- moai_adk/templates/.claude/commands/alfred/1-plan.md +342 -333
- moai_adk/templates/.claude/commands/alfred/2-run.md +295 -285
- moai_adk/templates/.claude/commands/alfred/3-sync.md +366 -356
- moai_adk/templates/.claude/hooks/alfred/README.md +52 -52
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +44 -48
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +17 -17
- moai_adk/templates/.claude/hooks/alfred/core/checkpoint.py +59 -59
- moai_adk/templates/.claude/hooks/alfred/core/context.py +19 -19
- moai_adk/templates/.claude/hooks/alfred/core/project.py +52 -52
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +1 -1
- moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +4 -4
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +27 -27
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +16 -17
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +11 -11
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +308 -307
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +297 -296
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +191 -190
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +112 -0
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +95 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +105 -0
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +90 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +87 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +62 -0
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +70 -43
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +141 -141
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +179 -165
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +78 -78
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +90 -90
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +39 -25
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +117 -74
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +131 -134
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +43 -11
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +51 -14
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +46 -10
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +62 -25
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +44 -17
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +44 -14
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +45 -13
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +46 -14
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +48 -8
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +44 -12
- moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +44 -43
- moai_adk/templates/.github/workflows/moai-gitflow.yml +36 -35
- moai_adk/templates/.moai/config.json +9 -6
- moai_adk/templates/.moai/memory/development-guide.md +220 -221
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +85 -85
- moai_adk/templates/.moai/memory/spec-metadata.md +149 -150
- moai_adk/templates/.moai/project/product.md +90 -90
- moai_adk/templates/.moai/project/structure.md +85 -85
- moai_adk/templates/.moai/project/tech.md +117 -117
- moai_adk/templates/CLAUDE.md +350 -722
- moai_adk-0.4.1.dist-info/METADATA +303 -0
- moai_adk-0.4.1.dist-info/RECORD +152 -0
- moai_adk/templates/.claude/commands/alfred/1-spec.md +0 -31
- moai_adk/templates/.claude/commands/alfred/2-build.md +0 -30
- moai_adk/templates/.claude/skills/scripts/standardize_skills.py +0 -166
- moai_adk/templates/.claude/skills/scripts/verify_standardization.sh +0 -43
- moai_adk/templates/.moai/hooks/pre-push.sample +0 -88
- moai_adk-0.4.0.dist-info/METADATA +0 -1816
- moai_adk-0.4.0.dist-info/RECORD +0 -145
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.1.dist-info}/WHEEL +0 -0
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.1.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.1.dist-info}/licenses/LICENSE +0 -0
moai_adk/templates/CLAUDE.md
CHANGED
|
@@ -6,875 +6,503 @@
|
|
|
6
6
|
|
|
7
7
|
## ▶◀ Meet Alfred: Your MoAI SuperAgent
|
|
8
8
|
|
|
9
|
-
**Alfred
|
|
10
|
-
|
|
11
|
-
###
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
###
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
| **
|
|
46
|
-
| **
|
|
47
|
-
| **
|
|
48
|
-
| **
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
|
53
|
-
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- 🔍 복잡한 코드 구조 파악이 필요할 때
|
|
77
|
-
- 🔍 여러 파일에 걸친 구현을 추적할 때
|
|
78
|
-
- 🔍 특정 기능의 전체 흐름을 이해할 때
|
|
79
|
-
- 🔍 의존성 관계를 분석할 때
|
|
80
|
-
- 🔍 리팩토링 전 영향 범위를 확인할 때
|
|
81
|
-
|
|
82
|
-
**사용 예시**:
|
|
9
|
+
**Alfred** orchestrates the MoAI-ADK agentic workflow across a four-layer stack (Commands → Sub-agents → Skills → Hooks). The SuperAgent interprets user intent, activates the right specialists, streams Claude Skills on demand, and enforces the TRUST 5 principles so every project follows the SPEC → TDD → Sync rhythm.
|
|
10
|
+
|
|
11
|
+
### 4-Layer Architecture (v0.4.0)
|
|
12
|
+
|
|
13
|
+
| Layer | Owner | Purpose | Examples |
|
|
14
|
+
| --- | --- | --- | --- |
|
|
15
|
+
| **Commands** | User ↔ Alfred | Workflow entry points that establish the Plan → Run → Sync cadence | `/alfred:0-project`, `/alfred:1-plan`, `/alfred:2-run`, `/alfred:3-sync` |
|
|
16
|
+
| **Sub-agents** | Alfred | Deep reasoning and decision making for each phase | project-manager, spec-builder, code-builder pipeline, doc-syncer |
|
|
17
|
+
| **Skills (44)** | Claude Skills | Reusable knowledge capsules loaded just-in-time | Foundation (TRUST/TAG/Git), Essentials (debug/refactor/review), Domain & Language packs |
|
|
18
|
+
| **Hooks** | Runtime guardrails | Fast validation + JIT context hints (<100 ms) | SessionStart status card, PreToolUse destructive-command blocker |
|
|
19
|
+
|
|
20
|
+
### Core Sub-agent Roster
|
|
21
|
+
|
|
22
|
+
> Alfred + 10 core sub-agents + 6 zero-project specialists + 2 built-in Claude agents = **19-member team**
|
|
23
|
+
|
|
24
|
+
| Sub-agent | Model | Phase | Responsibility | Trigger |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| **project-manager** 📋 | Sonnet | Init | Project bootstrap, metadata interview, mode selection | `/alfred:0-project` |
|
|
27
|
+
| **spec-builder** 🏗️ | Sonnet | Plan | Plan board consolidation, EARS-based SPEC authoring | `/alfred:1-plan` |
|
|
28
|
+
| **code-builder pipeline** 💎 | Sonnet | Run | Phase 1 `implementation-planner` → Phase 2 `tdd-implementer` to execute RED → GREEN → REFACTOR | `/alfred:2-run` |
|
|
29
|
+
| **doc-syncer** 📖 | Haiku | Sync | Living documentation, README/CHANGELOG updates | `/alfred:3-sync` |
|
|
30
|
+
| **tag-agent** 🏷️ | Haiku | Sync | TAG inventory, orphan detection, chain repair | `@agent-tag-agent` |
|
|
31
|
+
| **git-manager** 🚀 | Haiku | Plan · Sync | GitFlow automation, Draft→Ready PR, auto-merge policy | `@agent-git-manager` |
|
|
32
|
+
| **debug-helper** 🔍 | Sonnet | Run | Failure diagnosis, fix-forward guidance | `@agent-debug-helper` |
|
|
33
|
+
| **trust-checker** ✅ | Haiku | All phases | TRUST 5 principle enforcement and risk flags | `@agent-trust-checker` |
|
|
34
|
+
| **quality-gate** 🛡️ | Haiku | Sync | Coverage delta review, release gate validation | Auto during `/alfred:3-sync` |
|
|
35
|
+
| **cc-manager** 🛠️ | Sonnet | Ops | Claude Code session tuning, Skill lifecycle management | `@agent-cc-manager` |
|
|
36
|
+
|
|
37
|
+
The **code-builder pipeline** runs two Sonnet specialists in sequence: **implementation-planner** (strategy, libraries, TAG design) followed by **tdd-implementer** (RED → GREEN → REFACTOR execution).
|
|
38
|
+
|
|
39
|
+
### Zero-project Specialists
|
|
40
|
+
|
|
41
|
+
| Sub-agent | Model | Focus | Trigger |
|
|
42
|
+
| --- | --- | --- | --- |
|
|
43
|
+
| **language-detector** 🔍 | Haiku | Stack detection, language matrix | Auto during `/alfred:0-project` |
|
|
44
|
+
| **backup-merger** 📦 | Sonnet | Backup restore, checkpoint diff | `@agent-backup-merger` |
|
|
45
|
+
| **project-interviewer** 💬 | Sonnet | Requirement interviews, persona capture | `/alfred:0-project` Q&A |
|
|
46
|
+
| **document-generator** 📝 | Haiku | Project docs seed (`product.md`, `structure.md`, `tech.md`) | `/alfred:0-project` |
|
|
47
|
+
| **feature-selector** 🎯 | Haiku | Skill pack recommendation | `/alfred:0-project` |
|
|
48
|
+
| **template-optimizer** ⚙️ | Haiku | Template cleanup, migration helpers | `/alfred:0-project` |
|
|
49
|
+
|
|
50
|
+
### Built-in Claude Agents
|
|
51
|
+
|
|
52
|
+
| Agent | Model | Specialty | Invocation |
|
|
53
|
+
| --- | --- | --- | --- |
|
|
54
|
+
| **Explore** 🔍 | Haiku | Repository-wide search & architecture mapping | `@agent-Explore` |
|
|
55
|
+
| **general-purpose** | Sonnet | General assistance | Automatic |
|
|
56
|
+
|
|
57
|
+
#### Explore Agent Guide
|
|
58
|
+
|
|
59
|
+
The **Explore** agent excels at navigating large codebases.
|
|
60
|
+
|
|
61
|
+
**Use cases**:
|
|
62
|
+
- ✅ **Code analysis** (understand complex implementations, trace dependencies, study architecture)
|
|
63
|
+
- ✅ Search for specific keywords or patterns (e.g., "API endpoints", "authentication logic")
|
|
64
|
+
- ✅ Locate files (e.g., `src/components/**/*.tsx`)
|
|
65
|
+
- ✅ Understand codebase structure (e.g., "explain the project architecture")
|
|
66
|
+
- ✅ Search across many files (Glob + Grep patterns)
|
|
67
|
+
|
|
68
|
+
**Recommend Explore when**:
|
|
69
|
+
- 🔍 You need to understand a complex structure
|
|
70
|
+
- 🔍 The implementation spans multiple files
|
|
71
|
+
- 🔍 You want the end-to-end flow of a feature
|
|
72
|
+
- 🔍 Dependency relationships must be analyzed
|
|
73
|
+
- 🔍 You're planning a refactor and need impact analysis
|
|
74
|
+
|
|
75
|
+
**Usage examples**:
|
|
83
76
|
```python
|
|
84
|
-
# 1.
|
|
77
|
+
# 1. Deep code analysis
|
|
85
78
|
Task(
|
|
86
79
|
subagent_type="Explore",
|
|
87
|
-
description="
|
|
88
|
-
prompt="""
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
thoroughness
|
|
80
|
+
description="Analyze the full implementation of TemplateProcessor",
|
|
81
|
+
prompt="""Please analyze the TemplateProcessor class implementation:
|
|
82
|
+
- Class definition location
|
|
83
|
+
- Key method implementations
|
|
84
|
+
- Dependent classes/modules
|
|
85
|
+
- Related tests
|
|
86
|
+
thoroughness level: very thorough"""
|
|
94
87
|
)
|
|
95
88
|
|
|
96
|
-
# 2.
|
|
89
|
+
# 2. Domain-specific search (inside commands)
|
|
97
90
|
Task(
|
|
98
91
|
subagent_type="Explore",
|
|
99
|
-
description="
|
|
100
|
-
prompt="""
|
|
101
|
-
- SPEC
|
|
102
|
-
thoroughness
|
|
92
|
+
description="Find files related to the AUTH domain",
|
|
93
|
+
prompt="""Find every file related to the AUTH domain:
|
|
94
|
+
- SPEC documents, tests, implementation (src), documentation
|
|
95
|
+
thoroughness level: medium"""
|
|
103
96
|
)
|
|
104
97
|
|
|
105
|
-
# 3.
|
|
106
|
-
|
|
107
|
-
→ Alfred
|
|
108
|
-
→
|
|
109
|
-
→ Alfred
|
|
98
|
+
# 3. Natural language questions (auto-delegated by Alfred)
|
|
99
|
+
User: "Where is JWT authentication implemented in this project?"
|
|
100
|
+
→ Alfred automatically delegates to Explore
|
|
101
|
+
→ Explore returns the relevant file list
|
|
102
|
+
→ Alfred reads only the necessary files
|
|
110
103
|
```
|
|
111
104
|
|
|
112
|
-
**thoroughness
|
|
113
|
-
- `quick`:
|
|
114
|
-
- `medium`:
|
|
115
|
-
- `very thorough`:
|
|
105
|
+
**thoroughness levels** (declare explicitly inside the prompt text):
|
|
106
|
+
- `quick`: fast scan (basic patterns)
|
|
107
|
+
- `medium`: moderate sweep (multiple locations + naming rules) — **recommended**
|
|
108
|
+
- `very thorough`: exhaustive scan (full codebase analysis)
|
|
116
109
|
|
|
117
|
-
###
|
|
110
|
+
### Claude Skills (44 packs)
|
|
118
111
|
|
|
119
|
-
|
|
120
|
-
- **단일 책임 원칙**: 각 에이전트는 자신의 전문 영역만 담당
|
|
121
|
-
- **중앙 조율**: Alfred만이 에이전트 간 작업을 조율 (에이전트 간 직접 호출 금지)
|
|
122
|
-
- **품질 게이트**: 각 단계 완료 시 TRUST 원칙 및 @TAG 무결성 자동 검증
|
|
112
|
+
Alfred relies on 44 Claude Skills grouped by tier. Skills load via Progressive Disclosure: metadata is available at session start, full `SKILL.md` content loads when a sub-agent references it, and supporting templates stream only when required.
|
|
123
113
|
|
|
124
|
-
|
|
114
|
+
**Foundation Tier (6)**
|
|
125
115
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
116
|
+
| Skill | Purpose | Auto-load |
|
|
117
|
+
| --- | --- | --- |
|
|
118
|
+
| `moai-foundation-trust` | TRUST checklist, coverage gate policies | SessionStart, `/alfred:3-sync` |
|
|
119
|
+
| `moai-foundation-tags` | TAG inventory & orphan detection | `/alfred:3-sync` |
|
|
120
|
+
| `moai-foundation-specs` | SPEC metadata policy and versioning | `/alfred:1-plan` |
|
|
121
|
+
| `moai-foundation-ears` | EARS templates and requirement phrasing | `/alfred:1-plan` |
|
|
122
|
+
| `moai-foundation-git` | GitFlow automation & PR policy | Plan/Run/Sync |
|
|
123
|
+
| `moai-foundation-langs` | Language detection & Skill preload | SessionStart, `/alfred:2-run` |
|
|
132
124
|
|
|
133
|
-
|
|
125
|
+
**Essentials Tier (4)**
|
|
134
126
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
127
|
+
| Skill | Purpose | Auto-load |
|
|
128
|
+
| --- | --- | --- |
|
|
129
|
+
| `moai-essentials-debug` | Failure diagnosis & reproduction checklist | Auto when `/alfred:2-run` detects failures |
|
|
130
|
+
| `moai-essentials-perf` | Performance analysis & profiling strategies | On demand |
|
|
131
|
+
| `moai-essentials-refactor` | Refactoring patterns & code-smell remediation | `/alfred:2-run` |
|
|
132
|
+
| `moai-essentials-review` | Code review checklist & quality feedback | `/alfred:3-sync` |
|
|
141
133
|
|
|
142
|
-
|
|
134
|
+
**Domain Tier (10)** — `moai-domain-backend`, `web-api`, `frontend`, `mobile-app`, `security`, `devops`, `database`, `data-science`, `ml`, `cli-tool`.
|
|
143
135
|
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
작업이 복잡한 판단/설계/창의성이 필요한가?
|
|
147
|
-
├─ YES → Sonnet 4.5
|
|
148
|
-
│ ├─ 예: "SPEC 설계", "아키텍처 결정", "오류 원인 분석"
|
|
149
|
-
│ └─ 목표: 높은 품질, 정확한 판단
|
|
150
|
-
└─ NO → Haiku 4.5
|
|
151
|
-
├─ 예: "문서 동기화", "TAG 스캔", "Git 명령 실행"
|
|
152
|
-
└─ 목표: 빠른 속도, 비용 절감
|
|
153
|
-
```
|
|
136
|
+
**Language Tier (23)** — Python, TypeScript, Go, Rust, Java, Kotlin, Swift, Dart, C/C++, C#, Scala, Haskell, Elixir, Clojure, Lua, Ruby, PHP, JavaScript, SQL, Shell, Julia, R, plus supporting stacks.
|
|
154
137
|
|
|
155
|
-
|
|
138
|
+
**Claude Code Ops (1)** — `moai-claude-code` manages session settings, output styles, and Skill deployment.
|
|
156
139
|
|
|
157
|
-
|
|
140
|
+
Skills keep the core knowledge lightweight while allowing Alfred to assemble the right expertise for each request.
|
|
158
141
|
|
|
159
|
-
|
|
160
|
-
1. 현재 프로젝트 상태 분석 (Git, 파일, 문서 등)
|
|
161
|
-
2. 작업 범위 및 전략 결정
|
|
162
|
-
3. 계획 보고서 생성 및 사용자 확인 대기
|
|
142
|
+
### Agent Collaboration Principles
|
|
163
143
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
- **Command precedence**: Command instructions outrank agent guidelines; follow the command if conflicts occur.
|
|
145
|
+
- **Single responsibility**: Each agent handles only its specialty.
|
|
146
|
+
- **Zero overlapping ownership**: When unsure, hand off to the agent with the most direct expertise.
|
|
147
|
+
- **Confidence reporting**: Always share confidence levels and identified risks when completing a task.
|
|
148
|
+
- **Escalation path**: When blocked, escalate to Alfred with context, attempted steps, and suggested next actions.
|
|
168
149
|
|
|
169
|
-
|
|
170
|
-
- **"진행"** 또는 **"시작"**: Phase 2로 진행
|
|
171
|
-
- **"수정 [내용]"**: 계획 재수립
|
|
172
|
-
- **"중단"**: 작업 취소
|
|
150
|
+
### Model Selection Guide
|
|
173
151
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
-
|
|
152
|
+
| Model | Primary use cases | Representative sub-agents | Why it fits |
|
|
153
|
+
| --- | --- | --- | --- |
|
|
154
|
+
| **Claude 4.5 Haiku** | Documentation sync, TAG inventory, Git automation, rule-based checks | doc-syncer, tag-agent, git-manager, trust-checker, quality-gate, Explore | Fast, deterministic output for patterned or string-heavy work |
|
|
155
|
+
| **Claude 4.5 Sonnet** | Planning, implementation, troubleshooting, session ops | Alfred, project-manager, spec-builder, code-builder pipeline, debug-helper, cc-manager | Deep reasoning, multi-step synthesis, creative problem solving |
|
|
178
156
|
|
|
179
|
-
|
|
157
|
+
**Guidelines**:
|
|
158
|
+
- Default to **Haiku** when the task is pattern-driven or requires rapid iteration; escalate to **Sonnet** for novel design, architecture, or ambiguous problem solving.
|
|
159
|
+
- Record any manual model switch in the task notes (who, why, expected benefit).
|
|
160
|
+
- Combine both models when needed: e.g., Sonnet plans a refactor, Haiku formats and validates the resulting docs.
|
|
180
161
|
|
|
181
|
-
### Alfred
|
|
162
|
+
### Alfred Command Execution Pattern (Shared)
|
|
182
163
|
|
|
183
|
-
|
|
164
|
+
Alfred commands follow a three-phase loop, with an optional bootstrap stage for `/alfred:0-project`.
|
|
184
165
|
|
|
185
|
-
|
|
166
|
+
- **Phase 0 — Bootstrap (optional)**
|
|
167
|
+
Capture project metadata, create `.moai/config.json` and project docs, detect languages, and stage the recommended Skill packs.
|
|
186
168
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def suggest_next_step():
|
|
190
|
-
# 1. SPEC 상태 확인
|
|
191
|
-
spec_exists = check_spec_file_exists() # .moai/specs/SPEC-{ID}/spec.md
|
|
192
|
-
spec_version = get_spec_version() # YAML Front Matter의 version
|
|
193
|
-
spec_status = get_spec_status() # draft|active|completed|deprecated
|
|
194
|
-
|
|
195
|
-
# 2. 구현 상태 확인
|
|
196
|
-
tests_exist = check_test_files() # tests/**/*test*.py|ts|...
|
|
197
|
-
code_exists = check_code_files() # src/**/*.py|ts|...
|
|
198
|
-
tests_passing = check_test_results() # pytest, vitest 등 실행 결과
|
|
199
|
-
|
|
200
|
-
# 3. 문서 상태 확인
|
|
201
|
-
docs_synced = check_sync_status() # @TAG 체인 완전성
|
|
202
|
-
|
|
203
|
-
# 4. Git 상태 확인
|
|
204
|
-
branch_name = get_current_branch()
|
|
205
|
-
pr_status = get_pr_status() # draft|ready|merged
|
|
206
|
-
|
|
207
|
-
# 5. 현재 상태 기반 다음 단계 결정
|
|
208
|
-
if not spec_exists:
|
|
209
|
-
return "SPEC 작성: /alfred:1-spec"
|
|
210
|
-
elif spec_status == "draft" and not code_exists:
|
|
211
|
-
return "TDD 구현: /alfred:2-build SPEC-{ID}"
|
|
212
|
-
elif code_exists and not tests_passing:
|
|
213
|
-
return "테스트 수정: 실패한 테스트 확인"
|
|
214
|
-
elif tests_passing and not docs_synced:
|
|
215
|
-
return "문서 동기화: /alfred:3-sync"
|
|
216
|
-
elif pr_status == "ready":
|
|
217
|
-
return "PR 머지 대기 또는 다음 SPEC 작성"
|
|
218
|
-
else:
|
|
219
|
-
return "Git 커밋 또는 다음 작업"
|
|
220
|
-
```
|
|
169
|
+
- **Phase 1 — Analyze & Plan**
|
|
170
|
+
Understand scope, constraints, and desired outputs; review existing context (files, specs, tests); outline the execution plan and surface risks.
|
|
221
171
|
|
|
222
|
-
|
|
172
|
+
- **Phase 2 — Execute**
|
|
173
|
+
Run the approved steps in order, log progress in the task thread, escalate blockers immediately with mitigation options, and record decisions.
|
|
223
174
|
|
|
224
|
-
|
|
225
|
-
|
|
175
|
+
- **Phase 3 — Sync & Handoff**
|
|
176
|
+
Update docs, TAG inventory, and reports; verify quality gates; summarize outcomes; and suggest the next command or manual follow-up.
|
|
226
177
|
|
|
227
|
-
|
|
228
|
-
"다음 단계:
|
|
229
|
-
1. SPEC 검토 # ← SPEC은 이미 Alfred가 작성했음
|
|
230
|
-
2. 테스트 실행 # ← 테스트는 이미 실행되었음
|
|
231
|
-
3. Git 커밋"
|
|
178
|
+
### Alfred's Next-Step Suggestion Principles
|
|
232
179
|
|
|
233
|
-
|
|
234
|
-
"다음 단계:
|
|
235
|
-
1. Git 커밋 (변경 사항 커밋) # ← 실제 필요한 작업
|
|
236
|
-
2. 통합 테스트 (수동) # ← 실제 동작 확인 필요"
|
|
237
|
-
```
|
|
180
|
+
#### Pre-suggestion Checklist
|
|
238
181
|
|
|
239
|
-
|
|
182
|
+
Before suggesting the next step, always verify:
|
|
183
|
+
- You have the latest status from agents.
|
|
184
|
+
- All blockers are documented with context.
|
|
185
|
+
- Required approvals or user confirmations are noted.
|
|
186
|
+
- Suggested tasks include clear owners and outcomes.
|
|
187
|
+
- There is at most one "must-do" suggestion per step.
|
|
240
188
|
|
|
241
|
-
|
|
242
|
-
```markdown
|
|
243
|
-
✅ 다음 단계:
|
|
244
|
-
- /alfred:2-build SPEC-{ID} 실행하여 TDD 구현 시작
|
|
245
|
-
```
|
|
189
|
+
**cc-manager validation sequence**
|
|
246
190
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
```
|
|
191
|
+
1. **SPEC** – Confirm the SPEC file exists and note its status (`draft`, `active`, `completed`, `archived`). If missing, queue `/alfred:1-plan`.
|
|
192
|
+
2. **TEST & CODE** – Check whether tests and implementation files exist and whether the latest test run passed. Address failing tests before proposing new work.
|
|
193
|
+
3. **DOCS & TAGS** – Ensure `/alfred:3-sync` is not pending, Living Docs and TAG chains are current, and no orphan TAGs remain.
|
|
194
|
+
4. **GIT & PR** – Review the current branch, Draft/Ready PR state, and uncommitted changes. Highlight required Git actions explicitly.
|
|
195
|
+
5. **BLOCKERS & APPROVALS** – List outstanding approvals, unanswered questions, TodoWrite items, or dependency risks.
|
|
253
196
|
|
|
254
|
-
|
|
255
|
-
```markdown
|
|
256
|
-
✅ 다음 단계:
|
|
257
|
-
1. Git 커밋 (문서 동기화 커밋)
|
|
258
|
-
2. PR 상태 확인 (Draft → Ready 전환)
|
|
259
|
-
3. 다음 SPEC 작성 (/alfred:1-spec)
|
|
260
|
-
```
|
|
197
|
+
> cc-manager enforces this order. Reference the most recent status output when replying, and call out the next mandatory action (or confirm that all gates have passed).
|
|
261
198
|
|
|
262
|
-
|
|
263
|
-
```markdown
|
|
264
|
-
✅ 다음 단계:
|
|
265
|
-
- Git 커밋 (변경 사항 커밋)
|
|
199
|
+
#### Poor Suggestion Examples (❌)
|
|
266
200
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
Alfred는 다음과 같은 **불필요한 제안을 하지 않아야** 합니다:
|
|
273
|
-
|
|
274
|
-
1. ❌ **자신이 작성한 문서 검토**: "SPEC-{ID}/spec.md 검토"
|
|
275
|
-
- Alfred가 SPEC을 작성했다면 이미 완료된 작업
|
|
276
|
-
- 사용자가 명시적으로 검토 요청하지 않는 한 불필요
|
|
201
|
+
- Suggesting tasks already completed.
|
|
202
|
+
- Mixing unrelated actions in one suggestion.
|
|
203
|
+
- Proposing work without explaining the problem or expected result.
|
|
204
|
+
- Ignoring known blockers or assumptions.
|
|
277
205
|
|
|
278
|
-
|
|
279
|
-
- Alfred가 이미 pytest/vitest를 실행하고 결과를 확인했다면 완료
|
|
280
|
-
- 실패한 테스트가 있을 때만 재실행 제안
|
|
206
|
+
#### Good Suggestion Examples (✅)
|
|
281
207
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
208
|
+
- Link the suggestion to a clear goal or risk mitigation.
|
|
209
|
+
- Reference evidence (logs, diffs, test output).
|
|
210
|
+
- Provide concrete next steps with estimated effort.
|
|
285
211
|
|
|
286
|
-
|
|
287
|
-
- mypy, ruff 검사를 이미 통과했다면 완료
|
|
288
|
-
- 새로운 코드 추가 시에만 재검사 제안
|
|
212
|
+
#### Suggestion Restrictions
|
|
289
213
|
|
|
290
|
-
|
|
214
|
+
- Do not recommend direct commits; always go through review.
|
|
215
|
+
- Avoid introducing new scope without confirming priority.
|
|
216
|
+
- Never suppress warnings or tests without review.
|
|
217
|
+
- Do not rely on manual verification when automation exists.
|
|
291
218
|
|
|
292
|
-
|
|
219
|
+
#### Suggestion Priorities
|
|
293
220
|
|
|
294
|
-
1.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
221
|
+
1. Resolve production blockers.
|
|
222
|
+
2. Restore failing tests or pipelines.
|
|
223
|
+
3. Close gaps against the SPEC.
|
|
224
|
+
4. Improve developer experience or automation.
|
|
298
225
|
|
|
299
|
-
|
|
300
|
-
- 문서 동기화 필요 → /alfred:3-sync
|
|
301
|
-
- PR 상태 변경 필요 → Draft → Ready 전환
|
|
302
|
-
- 다음 기능 개발 → 다음 SPEC 작성
|
|
226
|
+
#### Status Commands
|
|
303
227
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
- 보안 검사
|
|
228
|
+
- `/alfred status`: Summary of current phase and active agents.
|
|
229
|
+
- `/alfred queue`: Pending actions with owners.
|
|
230
|
+
- `/alfred blockers`: Known blockers and mitigation status.
|
|
308
231
|
|
|
309
|
-
|
|
232
|
+
### Error Message Standard (Shared)
|
|
310
233
|
|
|
311
|
-
|
|
234
|
+
#### Severity Icons
|
|
312
235
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
# SPEC 버전 및 상태 확인
|
|
318
|
-
grep "^version:" .moai/specs/SPEC-*/spec.md
|
|
319
|
-
grep "^status:" .moai/specs/SPEC-*/spec.md
|
|
236
|
+
- 🔴 Critical failure (stop immediately)
|
|
237
|
+
- 🟠 Major issue (needs immediate attention)
|
|
238
|
+
- 🟡 Warning (monitor closely)
|
|
239
|
+
- 🔵 Info (no action needed)
|
|
320
240
|
|
|
321
|
-
|
|
322
|
-
find tests/ -name "*test*.py" -o -name "*test*.ts"
|
|
241
|
+
#### Message Format
|
|
323
242
|
|
|
324
|
-
# Git 상태 확인
|
|
325
|
-
git status --short
|
|
326
|
-
git branch --show-current
|
|
327
|
-
|
|
328
|
-
# PR 상태 확인 (GitHub CLI)
|
|
329
|
-
gh pr list --head $(git branch --show-current)
|
|
330
243
|
```
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
#### 심각도별 아이콘
|
|
337
|
-
- **❌ Critical**: 작업 중단, 즉시 조치 필요
|
|
338
|
-
- **⚠️ Warning**: 주의 필요, 계속 진행 가능
|
|
339
|
-
- **ℹ️ Info**: 정보성 메시지, 참고용
|
|
340
|
-
|
|
341
|
-
#### 메시지 형식
|
|
342
|
-
```
|
|
343
|
-
[아이콘] [컨텍스트]: [문제 설명]
|
|
344
|
-
→ [권장 조치]
|
|
244
|
+
🔴 <Title>
|
|
245
|
+
- Cause: <root cause>
|
|
246
|
+
- Scope: <affected components>
|
|
247
|
+
- Evidence: <logs/screenshots/links>
|
|
248
|
+
- Next Step: <required action>
|
|
345
249
|
```
|
|
346
250
|
|
|
347
|
-
|
|
348
|
-
```
|
|
349
|
-
❌ SPEC 문서 작성 실패: .moai/specs/ 디렉토리 권한 거부
|
|
350
|
-
→ chmod 755 .moai/specs 실행 후 재시도
|
|
251
|
+
### Git Commit Message Standard (Locale-aware)
|
|
351
252
|
|
|
352
|
-
|
|
353
|
-
→ 추가 테스트 케이스 작성 권장
|
|
253
|
+
#### TDD Stage Commit Templates
|
|
354
254
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
255
|
+
| Stage | Template |
|
|
256
|
+
| -------- | ---------------------------------------------------------- |
|
|
257
|
+
| RED | `test: add failing test for <feature>` |
|
|
258
|
+
| GREEN | `feat: implement <feature> to pass tests` |
|
|
259
|
+
| REFACTOR | `refactor: clean up <component> without changing behavior` |
|
|
360
260
|
|
|
361
|
-
|
|
261
|
+
#### Commit Structure
|
|
362
262
|
|
|
363
|
-
#### TDD 단계별 커밋 메시지 템플릿
|
|
364
|
-
|
|
365
|
-
**한국어 (ko)**:
|
|
366
|
-
```bash
|
|
367
|
-
🔴 RED: [테스트 설명]
|
|
368
|
-
🟢 GREEN: [구현 설명]
|
|
369
|
-
♻️ REFACTOR: [개선 설명]
|
|
370
|
-
📝 DOCS: [문서 설명]
|
|
371
263
|
```
|
|
264
|
+
<type>(scope): <subject>
|
|
372
265
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
🔴 RED: [Test description]
|
|
376
|
-
🟢 GREEN: [Implementation description]
|
|
377
|
-
♻️ REFACTOR: [Improvement description]
|
|
378
|
-
📝 DOCS: [Documentation description]
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
**일본어 (ja)**:
|
|
382
|
-
```bash
|
|
383
|
-
🔴 RED: [テスト説明]
|
|
384
|
-
🟢 GREEN: [実装説明]
|
|
385
|
-
♻️ REFACTOR: [改善説明]
|
|
386
|
-
📝 DOCS: [ドキュメント説明]
|
|
387
|
-
```
|
|
266
|
+
- Context of the change
|
|
267
|
+
- Additional notes (optional)
|
|
388
268
|
|
|
389
|
-
|
|
390
|
-
```bash
|
|
391
|
-
🔴 RED: [测试说明]
|
|
392
|
-
🟢 GREEN: [实现说明]
|
|
393
|
-
♻️ REFACTOR: [改进说明]
|
|
394
|
-
📝 DOCS: [文档说明]
|
|
269
|
+
Refs: @TAG-ID (if applicable)
|
|
395
270
|
```
|
|
396
271
|
|
|
397
|
-
|
|
398
|
-
```
|
|
399
|
-
[아이콘] [단계]: [설명]
|
|
400
|
-
|
|
401
|
-
@TAG:[SPEC-ID]-[단계]
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
**locale 자동 감지**:
|
|
405
|
-
git-manager는 커밋 생성 시 자동으로 `.moai/config.json`의 `project.locale` 값을 읽어 해당 언어로 커밋 메시지를 생성합니다.
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
## Context Engineering 전략
|
|
410
|
-
|
|
411
|
-
> **상세 구현 가이드**: @.moai/memory/development-guide.md
|
|
412
|
-
|
|
413
|
-
> 본 지침군은 **컨텍스트 엔지니어링**(JIT Retrieval)을 핵심 원리로 한다.
|
|
414
|
-
|
|
415
|
-
Alfred는 효율적인 컨텍스트 관리를 위해 다음 전략을 사용합니다:
|
|
272
|
+
## Context Engineering Strategy
|
|
416
273
|
|
|
417
274
|
### 1. JIT (Just-in-Time) Retrieval
|
|
418
|
-
필요한 순간에만 문서를 로드하여 초기 컨텍스트 부담을 최소화:
|
|
419
|
-
- 전체 문서를 선로딩하지 말고, **식별자(파일경로/링크/쿼리)**만 보유 후 필요 시 조회
|
|
420
|
-
- `/alfred:1-spec` → `product.md` 참조
|
|
421
|
-
- `/alfred:2-build` → `SPEC-XXX/spec.md` + `development-guide.md` 참조
|
|
422
|
-
- `/alfred:3-sync` → `sync-report.md` + TAG 인덱스 참조
|
|
423
275
|
|
|
424
|
-
|
|
276
|
+
- Pull only the context required for the immediate step.
|
|
277
|
+
- Prefer `Explore` over manual file hunting.
|
|
278
|
+
- Cache critical insights in the task thread for reuse.
|
|
425
279
|
|
|
426
|
-
|
|
280
|
+
#### Efficient Use of Explore
|
|
427
281
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
❌ Alfred가 직접 파일 하나하나 탐색
|
|
432
|
-
❌ 컨텍스트 비용 증가
|
|
433
|
-
|
|
434
|
-
Explore 방식 (효율):
|
|
435
|
-
✅ Explore 에이전트에 위임 (1회 호출)
|
|
436
|
-
✅ 관련 파일 목록만 반환받음
|
|
437
|
-
✅ 필요한 파일만 선택적 Read
|
|
438
|
-
✅ 컨텍스트 비용 절감
|
|
439
|
-
```
|
|
282
|
+
- Request call graphs or dependency maps when changing core modules.
|
|
283
|
+
- Fetch examples from similar features before implementing new ones.
|
|
284
|
+
- Ask for SPEC references or TAG metadata to anchor changes.
|
|
440
285
|
|
|
441
|
-
|
|
442
|
-
```python
|
|
443
|
-
# 사용자: "JWT 인증 관련 코드 어디 있어?"
|
|
444
|
-
# Alfred → Explore 에이전트 위임
|
|
445
|
-
Task(
|
|
446
|
-
subagent_type="Explore",
|
|
447
|
-
description="JWT 인증 관련 파일 탐색",
|
|
448
|
-
prompt="""JWT 인증 관련 모든 파일을 찾아주세요.
|
|
449
|
-
thoroughness 레벨: medium"""
|
|
450
|
-
)
|
|
451
|
-
→ 결과: ["src/auth/jwt.py", "tests/test_auth.py", ...]
|
|
452
|
-
→ Alfred는 결과 기반으로 필요한 파일만 Read
|
|
453
|
-
→ 컨텍스트 비용 최소화
|
|
454
|
-
```
|
|
286
|
+
### 2. Layered Context Summaries
|
|
455
287
|
|
|
456
|
-
|
|
288
|
+
1. **High-level brief**: purpose, stakeholders, success criteria.
|
|
289
|
+
2. **Technical core**: entry points, domain models, shared utilities.
|
|
290
|
+
3. **Edge cases**: known bugs, performance constraints, SLAs.
|
|
457
291
|
|
|
458
|
-
|
|
459
|
-
- `CLAUDE.md` → `development-guide.md` (상세 규칙)
|
|
460
|
-
- `CLAUDE.md` → `product/structure/tech.md` (프로젝트 컨텍스트)
|
|
461
|
-
- `development-guide.md` ↔ `product/structure/tech.md` (상호 참조)
|
|
292
|
+
### 3. Living Documentation Sync
|
|
462
293
|
|
|
463
|
-
|
|
294
|
+
- Align code, tests, and docs after each significant change.
|
|
295
|
+
- Use `/alfred:3-sync` to update Living Docs and TAG references.
|
|
296
|
+
- Record rationale for deviations from the SPEC.
|
|
464
297
|
|
|
465
|
-
##
|
|
298
|
+
## Commands · Sub-agents · Skills · Hooks
|
|
466
299
|
|
|
467
|
-
MoAI-ADK
|
|
300
|
+
MoAI-ADK assigns every responsibility to a dedicated execution layer.
|
|
468
301
|
|
|
469
|
-
###
|
|
302
|
+
### Commands — Workflow orchestration
|
|
470
303
|
|
|
471
|
-
|
|
472
|
-
-
|
|
473
|
-
-
|
|
474
|
-
- 실행 속도: 빠름 (<100ms 권장)
|
|
475
|
-
- 차단 가능: blocked=true로 작업 차단 가능
|
|
304
|
+
- User-facing entry points that enforce the Plan → Run → Sync cadence.
|
|
305
|
+
- Examples: `/alfred:0-project`, `/alfred:1-plan`, `/alfred:2-run`, `/alfred:3-sync`.
|
|
306
|
+
- Coordinate multiple sub-agents, manage approvals, and track progress.
|
|
476
307
|
|
|
477
|
-
|
|
478
|
-
- ✅ **가드레일**: 위험한 작업 차단 (rm -rf, git push --force, 프로덕션 파일 수정)
|
|
479
|
-
- ✅ **자동 백업**: 위험 작업 전 Checkpoint 자동 생성
|
|
480
|
-
- ✅ **JIT Context**: 필요한 문서 경로 추천 (파일 경로만, Alfred가 Read)
|
|
481
|
-
- ✅ **상태 알림**: 세션 시작 시 프로젝트 정보, Git 상태, SPEC 진행도 표시
|
|
308
|
+
### Sub-agents — Deep reasoning & decision making
|
|
482
309
|
|
|
483
|
-
|
|
484
|
-
-
|
|
485
|
-
-
|
|
486
|
-
- 사용자 상호작용 최소화 (차단 메시지만)
|
|
310
|
+
- Task-focused specialists (Sonnet/Haiku) that analyze, design, or validate.
|
|
311
|
+
- Examples: spec-builder, code-builder pipeline, doc-syncer, tag-agent, git-manager.
|
|
312
|
+
- Communicate status, escalate blockers, and request Skills when additional knowledge is required.
|
|
487
313
|
|
|
488
|
-
|
|
489
|
-
```python
|
|
490
|
-
# ✅ 올바른 Hooks 사용
|
|
491
|
-
def handle_pre_tool_use(payload):
|
|
492
|
-
if "rm -rf" in payload.get("command", ""):
|
|
493
|
-
create_checkpoint() # 빠른 백업
|
|
494
|
-
return HookResult(blocked=True, message="위험한 작업 차단")
|
|
495
|
-
return HookResult(blocked=False)
|
|
496
|
-
|
|
497
|
-
# ❌ 잘못된 Hooks 사용 (너무 무거움)
|
|
498
|
-
def handle_pre_tool_use(payload):
|
|
499
|
-
validate_spec_metadata() # 복잡한 검증 → Agent로!
|
|
500
|
-
check_trust_compliance() # 시간 소요 → Agent로!
|
|
501
|
-
generate_report() # 보고서 생성 → Agent로!
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
### Agents (분석 + 검증 + 보고)
|
|
507
|
-
|
|
508
|
-
**실행 특성**:
|
|
509
|
-
- 실행 시점: 사용자 명시적 호출 또는 Alfred 위임
|
|
510
|
-
- 실행 방식: Claude Code Agent (Task tool)
|
|
511
|
-
- 실행 속도: 느림 (수 초 ~ 수 분)
|
|
512
|
-
- 사용자 상호작용: 질문/확인/보고서 제공
|
|
513
|
-
|
|
514
|
-
**핵심 역할**:
|
|
515
|
-
- ✅ **상세 분석**: SPEC 메타데이터 검증, EARS 구문 검증
|
|
516
|
-
- ✅ **품질 검증**: TRUST 5원칙 준수 확인, 테스트 커버리지 분석
|
|
517
|
-
- ✅ **TAG 관리**: TAG 체인 완전성 검증, 고아 TAG 탐지
|
|
518
|
-
- ✅ **디버깅**: 오류 원인 분석, 해결 방법 제시
|
|
519
|
-
- ✅ **보고서 생성**: 상세한 분석 결과 및 권장사항 제공
|
|
520
|
-
|
|
521
|
-
**구현 원칙**:
|
|
522
|
-
- 복잡한 로직 허용 (≤300 LOC per agent)
|
|
523
|
-
- 사용자와 대화형 상호작용
|
|
524
|
-
- 여러 도구(Read, Grep, Bash) 조합 사용
|
|
525
|
-
|
|
526
|
-
**예시**:
|
|
527
|
-
```bash
|
|
528
|
-
# ✅ 올바른 Agents 사용
|
|
529
|
-
@agent-trust-checker "현재 프로젝트의 TRUST 원칙 준수도 확인"
|
|
530
|
-
→ 테스트 커버리지 87%, 코드 제약 45/45 파일 준수, TAG 체인 2개 고아 발견
|
|
531
|
-
|
|
532
|
-
@agent-spec-builder "AUTH-001 SPEC의 메타데이터 검증"
|
|
533
|
-
→ 필수 필드 7개 모두 존재, HISTORY 섹션 확인, EARS 구문 적용률 80%
|
|
534
|
-
|
|
535
|
-
@agent-debug-helper "TypeError: 'NoneType' 오류 해결"
|
|
536
|
-
→ project.py:142 라인에서 config가 None, .moai/config.json 누락 확인
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
### Commands (워크플로우 오케스트레이션)
|
|
542
|
-
|
|
543
|
-
**실행 특성**:
|
|
544
|
-
- 실행 시점: 사용자 명시적 호출 (slash command)
|
|
545
|
-
- 실행 방식: Phase 1 (계획) → Phase 2 (실행)
|
|
546
|
-
- 실행 속도: 중간 (수 초 ~ 수 분)
|
|
547
|
-
- 사용자 상호작용: 계획 승인 → 실행
|
|
548
|
-
|
|
549
|
-
**핵심 역할**:
|
|
550
|
-
- ✅ **워크플로우 관리**: 여러 단계를 순차/병렬 실행
|
|
551
|
-
- ✅ **Agent 조율**: 적절한 Agent를 호출하여 작업 위임
|
|
552
|
-
- ✅ **Git 통합**: 브랜치 생성, PR 생성, 커밋 자동화
|
|
553
|
-
- ✅ **문서 동기화**: SPEC ↔ CODE ↔ DOC 일관성 유지
|
|
554
|
-
|
|
555
|
-
**구현 원칙**:
|
|
556
|
-
- 2단계 워크플로우 (Phase 1 계획 → Phase 2 실행)
|
|
557
|
-
- 복잡한 로직은 Agent로 위임
|
|
558
|
-
- Git 작업은 사용자 확인 필수
|
|
559
|
-
|
|
560
|
-
**예시**:
|
|
561
|
-
```bash
|
|
562
|
-
# ✅ 올바른 Commands 사용
|
|
563
|
-
/alfred:1-spec "사용자 인증 기능"
|
|
564
|
-
→ Phase 1: 프로젝트 분석, SPEC 후보 제안
|
|
565
|
-
→ 사용자 승인
|
|
566
|
-
→ Phase 2: SPEC 문서 작성, 브랜치 생성, Draft PR 생성
|
|
567
|
-
|
|
568
|
-
/alfred:2-build AUTH-001
|
|
569
|
-
→ Phase 1: SPEC 분석, TDD 계획 수립
|
|
570
|
-
→ 사용자 승인
|
|
571
|
-
→ Phase 2: RED → GREEN → REFACTOR 구현
|
|
572
|
-
|
|
573
|
-
/alfred:3-sync
|
|
574
|
-
→ Phase 1: 동기화 범위 분석
|
|
575
|
-
→ 사용자 승인
|
|
576
|
-
→ Phase 2: 문서 업데이트, TAG 검증, PR Ready 전환
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
---
|
|
580
|
-
|
|
581
|
-
### 역할 분리 결정 트리
|
|
582
|
-
|
|
583
|
-
작업을 어디에 구현할지 결정할 때 다음 기준을 사용하세요:
|
|
584
|
-
|
|
585
|
-
```
|
|
586
|
-
┌─────────────────────────────────────┐
|
|
587
|
-
│ 작업이 <100ms 안에 완료되는가? │
|
|
588
|
-
│ AND 차단/경고/알림만 필요한가? │
|
|
589
|
-
└─────────────────────────────────────┘
|
|
590
|
-
↓ YES ↓ NO
|
|
591
|
-
┌─────────┐ ┌──────────────┐
|
|
592
|
-
│ Hooks │ │ 사용자와 │
|
|
593
|
-
└─────────┘ │ 상호작용이 │
|
|
594
|
-
│ 필요한가? │
|
|
595
|
-
└──────────────┘
|
|
596
|
-
↓ YES ↓ NO
|
|
597
|
-
┌──────────┐ ┌────────────┐
|
|
598
|
-
│ Agents │ │ Commands │
|
|
599
|
-
└──────────┘ └────────────┘
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
**예시 질문**:
|
|
603
|
-
- Q: "SPEC 메타데이터 검증을 어디에 구현?"
|
|
604
|
-
- A: Agent (`@agent-spec-builder`) - 복잡한 검증, 보고서 생성 필요
|
|
605
|
-
- Q: "rm -rf 명령 차단을 어디에 구현?"
|
|
606
|
-
- A: Hook (PreToolUse) - 빠른 차단, 간단한 로직
|
|
607
|
-
- Q: "TDD 워크플로우를 어디에 구현?"
|
|
608
|
-
- A: Command (`/alfred:2-build`) - 여러 단계 오케스트레이션
|
|
609
|
-
|
|
610
|
-
---
|
|
611
|
-
|
|
612
|
-
## 핵심 철학
|
|
314
|
+
### Skills — Reusable knowledge capsules (44 packs)
|
|
613
315
|
|
|
614
|
-
-
|
|
615
|
-
-
|
|
616
|
-
-
|
|
617
|
-
- **다중 언어 지원**: Python, TypeScript, Java, Go, Rust, Ruby, Dart, Swift, Kotlin 등 20개 주요 언어
|
|
618
|
-
- **모바일 지원**: Flutter, React Native, iOS (Swift), Android (Kotlin)
|
|
619
|
-
- **CODE-FIRST @TAG**: 코드 직접 스캔 방식 (중간 캐시 없음)
|
|
316
|
+
- <500-word playbooks stored under `.claude/skills/`.
|
|
317
|
+
- Loaded via Progressive Disclosure only when relevant.
|
|
318
|
+
- Provide standard templates, best practices, and checklists across Foundation, Essentials, Domain, Language, and Ops tiers.
|
|
620
319
|
|
|
621
|
-
|
|
320
|
+
### Hooks — Guardrails & just-in-time context
|
|
622
321
|
|
|
623
|
-
|
|
322
|
+
- Lightweight (<100 ms) checks triggered by session events.
|
|
323
|
+
- Block destructive commands, surface status cards, and seed context pointers.
|
|
324
|
+
- Examples: SessionStart project summary, PreToolUse safety checks.
|
|
624
325
|
|
|
625
|
-
|
|
326
|
+
### Selecting the right layer
|
|
626
327
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
```
|
|
328
|
+
1. Runs automatically on an event? → **Hook**.
|
|
329
|
+
2. Requires reasoning or conversation? → **Sub-agent**.
|
|
330
|
+
3. Encodes reusable knowledge or policy? → **Skill**.
|
|
331
|
+
4. Orchestrates multiple steps or approvals? → **Command**.
|
|
632
332
|
|
|
633
|
-
|
|
634
|
-
- **Ubiquitous**: 시스템은 [기능]을 제공해야 한다
|
|
635
|
-
- **Event-driven**: WHEN [조건]이면, 시스템은 [동작]해야 한다
|
|
636
|
-
- **State-driven**: WHILE [상태]일 때, 시스템은 [동작]해야 한다
|
|
637
|
-
- **Optional**: WHERE [조건]이면, 시스템은 [동작]할 수 있다
|
|
638
|
-
- **Constraints**: IF [조건]이면, 시스템은 [제약]해야 한다
|
|
333
|
+
Combine layers when necessary: a command triggers sub-agents, sub-agents activate Skills, and Hooks keep the session safe.
|
|
639
334
|
|
|
640
|
-
|
|
335
|
+
## Core Philosophy
|
|
641
336
|
|
|
642
|
-
|
|
337
|
+
- **SPEC-first**: requirements drive implementation and tests.
|
|
338
|
+
- **Automation-first**: trust repeatable pipelines over manual checks.
|
|
339
|
+
- **Transparency**: every decision, assumption, and risk is documented.
|
|
340
|
+
- **Traceability**: @TAG links code, tests, docs, and history.
|
|
643
341
|
|
|
644
|
-
|
|
645
|
-
```bash
|
|
646
|
-
# 1단계: SPEC 작성 (develop에서 분기)
|
|
647
|
-
/alfred:1-spec "새 기능"
|
|
648
|
-
→ feature/SPEC-{ID} 브랜치 생성
|
|
649
|
-
→ Draft PR 생성 (feature → develop)
|
|
650
|
-
|
|
651
|
-
# 2단계: TDD 구현
|
|
652
|
-
/alfred:2-build SPEC-{ID}
|
|
653
|
-
→ RED → GREEN → REFACTOR 커밋
|
|
654
|
-
|
|
655
|
-
# 3단계: 문서 동기화 + 자동 머지
|
|
656
|
-
/alfred:3-sync --auto-merge
|
|
657
|
-
→ 문서 동기화
|
|
658
|
-
→ PR Ready 전환
|
|
659
|
-
→ CI/CD 확인
|
|
660
|
-
→ PR 자동 머지 (squash)
|
|
661
|
-
→ develop 체크아웃
|
|
662
|
-
→ 다음 작업 준비 완료 ✅
|
|
663
|
-
```
|
|
342
|
+
## Three-phase Development Workflow
|
|
664
343
|
|
|
665
|
-
|
|
666
|
-
```bash
|
|
667
|
-
/alfred:1-spec "새 기능" # main/develop에서 분기
|
|
668
|
-
/alfred:2-build SPEC-{ID} # TDD 구현
|
|
669
|
-
/alfred:3-sync # 문서 동기화 + 로컬 머지
|
|
670
|
-
```
|
|
344
|
+
> Phase 0 (`/alfred:0-project`) bootstraps project metadata and resources before the cycle begins.
|
|
671
345
|
|
|
672
|
-
|
|
346
|
+
1. **SPEC**: Define requirements with `/alfred:1-plan`.
|
|
347
|
+
2. **BUILD**: Implement via `/alfred:2-run` (TDD loop).
|
|
348
|
+
3. **SYNC**: Align docs/tests using `/alfred:3-sync`.
|
|
673
349
|
|
|
674
|
-
|
|
350
|
+
### Fully Automated GitFlow
|
|
675
351
|
|
|
676
|
-
|
|
352
|
+
1. Create feature branch via command.
|
|
353
|
+
2. Follow RED → GREEN → REFACTOR commits.
|
|
354
|
+
3. Run automated QA gates.
|
|
355
|
+
4. Merge with traceable @TAG references.
|
|
677
356
|
|
|
678
|
-
|
|
679
|
-
```bash
|
|
680
|
-
@agent-debug-helper "TypeError: 'NoneType' object has no attribute 'name'"
|
|
681
|
-
@agent-debug-helper "TAG 체인 검증을 수행해주세요"
|
|
682
|
-
@agent-debug-helper "TRUST 원칙 준수 여부 확인"
|
|
683
|
-
```
|
|
357
|
+
## On-demand Agent Usage
|
|
684
358
|
|
|
685
|
-
###
|
|
686
|
-
```bash
|
|
687
|
-
@agent-tag-agent "AUTH 도메인 TAG 목록 조회"
|
|
688
|
-
@agent-tag-agent "고아 TAG 및 끊어진 링크 감지"
|
|
689
|
-
```
|
|
359
|
+
### Debugging & Analysis
|
|
690
360
|
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
/alfred:9-checkpoint create --name "refactor-start"
|
|
361
|
+
- Use `debug-helper` for error triage and hypothesis testing.
|
|
362
|
+
- Attach logs, stack traces, and reproduction steps.
|
|
363
|
+
- Ask for fix-forward vs rollback recommendations.
|
|
695
364
|
|
|
696
|
-
|
|
697
|
-
/alfred:9-checkpoint list
|
|
365
|
+
### TAG System Management
|
|
698
366
|
|
|
699
|
-
|
|
700
|
-
|
|
367
|
+
- Assign IDs as `<DOMAIN>-<###>` (e.g., `AUTH-003`).
|
|
368
|
+
- Update HISTORY with every change.
|
|
369
|
+
- Cross-check usage with `rg '@TAG:ID' -n` searches.
|
|
701
370
|
|
|
702
|
-
|
|
703
|
-
/alfred:9-checkpoint clean
|
|
704
|
-
```
|
|
371
|
+
### Backup Management
|
|
705
372
|
|
|
706
|
-
|
|
373
|
+
- `/alfred:0-project` and `git-manager` create automatic safety snapshots (e.g., `.moai-backups/`) before risky actions.
|
|
374
|
+
- Manual `/alfred:9-checkpoint` commands have been deprecated; rely on Git branches or team-approved backup workflows when additional restore points are needed.
|
|
707
375
|
|
|
708
|
-
|
|
376
|
+
## @TAG Lifecycle
|
|
709
377
|
|
|
710
|
-
|
|
378
|
+
### Core Principles
|
|
711
379
|
|
|
712
|
-
|
|
380
|
+
- TAG IDs never change once assigned.
|
|
381
|
+
- Content can evolve; log updates in HISTORY.
|
|
382
|
+
- Tie implementations and tests to the same TAG.
|
|
713
383
|
|
|
714
|
-
###
|
|
384
|
+
### TAG Structure
|
|
715
385
|
|
|
716
|
-
-
|
|
717
|
-
-
|
|
718
|
-
-
|
|
386
|
+
- `@SPEC:ID` in specs
|
|
387
|
+
- `@CODE:ID` in source
|
|
388
|
+
- `@TEST:ID` in tests
|
|
389
|
+
- `@DOC:ID` in docs
|
|
719
390
|
|
|
720
|
-
### TAG
|
|
391
|
+
### TAG Block Template
|
|
721
392
|
|
|
722
393
|
```
|
|
723
|
-
@
|
|
394
|
+
// @CODE:AUTH-001 | SPEC: SPEC-AUTH-001.md | TEST: tests/auth/service.test.ts
|
|
724
395
|
```
|
|
725
396
|
|
|
726
|
-
| TAG | 역할 | TDD 단계 | 위치 | 필수 |
|
|
727
|
-
| ---------- | -------------------- | ---------------- | ------------ | ---- |
|
|
728
|
-
| `@SPEC:ID` | 요구사항 명세 (EARS) | 사전 준비 | .moai/specs/ | ✅ |
|
|
729
|
-
| `@TEST:ID` | 테스트 케이스 | RED | tests/ | ✅ |
|
|
730
|
-
| `@CODE:ID` | 구현 코드 | GREEN + REFACTOR | src/ | ✅ |
|
|
731
|
-
| `@DOC:ID` | 문서화 | REFACTOR | docs/ | ⚠️ |
|
|
732
|
-
|
|
733
|
-
### TAG BLOCK 템플릿
|
|
734
|
-
|
|
735
|
-
> **📋 SPEC 메타데이터 표준 (SSOT)**: @.moai/memory/spec-metadata.md
|
|
736
|
-
|
|
737
|
-
**모든 SPEC 문서는 다음 구조를 따릅니다**:
|
|
738
|
-
- **필수 필드 7개**: id, version, status, created, updated, author, priority
|
|
739
|
-
- **선택 필드 9개**: category, labels, depends_on, blocks, related_specs, related_issue, scope
|
|
740
|
-
- **HISTORY 섹션**: 필수 (모든 버전 변경 이력 기록)
|
|
741
|
-
|
|
742
|
-
**전체 템플릿 및 필드 상세 설명**: `.moai/memory/spec-metadata.md` 참조
|
|
743
|
-
|
|
744
|
-
**간단한 예시**:
|
|
745
|
-
```yaml
|
|
746
|
-
---
|
|
747
|
-
id: AUTH-001
|
|
748
|
-
version: 0.0.1
|
|
749
|
-
status: draft
|
|
750
|
-
created: 2025-09-15
|
|
751
|
-
updated: 2025-09-15
|
|
752
|
-
author: @{{AUTHOR}}
|
|
753
|
-
priority: high
|
|
754
|
-
---
|
|
755
|
-
|
|
756
|
-
# @SPEC:AUTH-001: JWT 인증 시스템
|
|
757
|
-
|
|
758
397
|
## HISTORY
|
|
759
|
-
### v0.0.1 (2025-09-15)
|
|
760
|
-
- **INITIAL**: JWT 기반 인증 시스템 명세 작성
|
|
761
|
-
...
|
|
762
|
-
```
|
|
763
398
|
|
|
764
|
-
|
|
765
|
-
```typescript
|
|
766
|
-
// @CODE:AUTH-001 | SPEC: SPEC-AUTH-001.md | TEST: tests/auth/service.test.ts
|
|
767
|
-
```
|
|
399
|
+
### v0.0.1 (2025-09-15)
|
|
768
400
|
|
|
769
|
-
|
|
770
|
-
```typescript
|
|
771
|
-
// @TEST:AUTH-001 | SPEC: SPEC-AUTH-001.md
|
|
772
|
-
```
|
|
401
|
+
- **INITIAL**: Draft the JWT-based authentication SPEC.
|
|
773
402
|
|
|
774
|
-
### TAG
|
|
403
|
+
### TAG Core Rules
|
|
775
404
|
|
|
776
|
-
- **TAG ID**:
|
|
777
|
-
- **TAG
|
|
778
|
-
-
|
|
779
|
-
-
|
|
780
|
-
- **TAG
|
|
781
|
-
-
|
|
782
|
-
- **
|
|
405
|
+
- **TAG ID**: `<Domain>-<3 digits>` (e.g., `AUTH-003`) — immutable.
|
|
406
|
+
- **TAG Content**: Flexible but record changes in HISTORY.
|
|
407
|
+
- **Versioning**: Semantic Versioning (`v0.0.1 → v0.1.0 → v1.0.0`).
|
|
408
|
+
- Detailed rules: see `@.moai/memory/spec-metadata.md#versioning`.
|
|
409
|
+
- **TAG References**: Use file names without versions (e.g., `SPEC-AUTH-001.md`).
|
|
410
|
+
- **Duplicate Check**: `rg "@SPEC:AUTH" -n` or `rg "AUTH-001" -n`.
|
|
411
|
+
- **Code-first**: The source of truth lives in code.
|
|
783
412
|
|
|
784
|
-
### @CODE
|
|
413
|
+
### @CODE Subcategories (Comment Level)
|
|
785
414
|
|
|
786
|
-
|
|
787
|
-
- `@CODE:ID:
|
|
788
|
-
- `@CODE:ID:
|
|
789
|
-
- `@CODE:ID:
|
|
790
|
-
- `@CODE:ID:
|
|
791
|
-
- `@CODE:ID:INFRA` - 인프라, 데이터베이스, 외부 연동
|
|
415
|
+
- `@CODE:ID:API` — REST/GraphQL endpoints
|
|
416
|
+
- `@CODE:ID:UI` — Components and UI
|
|
417
|
+
- `@CODE:ID:DATA` — Data models, schemas, types
|
|
418
|
+
- `@CODE:ID:DOMAIN` — Business logic
|
|
419
|
+
- `@CODE:ID:INFRA` — Infra, databases, integrations
|
|
792
420
|
|
|
793
|
-
### TAG
|
|
421
|
+
### TAG Validation & Integrity
|
|
794
422
|
|
|
795
|
-
|
|
423
|
+
**Avoid duplicates**:
|
|
796
424
|
```bash
|
|
797
|
-
rg "@SPEC:AUTH" -n #
|
|
798
|
-
rg "@CODE:AUTH-001" -n #
|
|
799
|
-
rg "AUTH-001" -n # ID
|
|
425
|
+
rg "@SPEC:AUTH" -n # Search AUTH specs
|
|
426
|
+
rg "@CODE:AUTH-001" -n # Targeted ID search
|
|
427
|
+
rg "AUTH-001" -n # Global ID search
|
|
800
428
|
```
|
|
801
429
|
|
|
802
|
-
**TAG
|
|
430
|
+
**TAG chain verification** (`/alfred:3-sync` runs automatically):
|
|
803
431
|
```bash
|
|
804
432
|
rg '@(SPEC|TEST|CODE|DOC):' -n .moai/specs/ tests/ src/ docs/
|
|
805
433
|
|
|
806
|
-
#
|
|
807
|
-
rg '@CODE:AUTH-001' -n src/ # CODE
|
|
808
|
-
rg '@SPEC:AUTH-001' -n .moai/specs/ # SPEC
|
|
434
|
+
# Detect orphaned TAGs
|
|
435
|
+
rg '@CODE:AUTH-001' -n src/ # CODE exists
|
|
436
|
+
rg '@SPEC:AUTH-001' -n .moai/specs/ # SPEC missing → orphan
|
|
809
437
|
```
|
|
810
438
|
|
|
811
439
|
---
|
|
812
440
|
|
|
813
|
-
## TRUST 5
|
|
441
|
+
## TRUST 5 Principles (Language-agnostic)
|
|
814
442
|
|
|
815
|
-
>
|
|
443
|
+
> Detailed guide: `@.moai/memory/development-guide.md#trust-5-principles`
|
|
816
444
|
|
|
817
|
-
Alfred
|
|
445
|
+
Alfred enforces these quality gates on every change:
|
|
818
446
|
|
|
819
|
-
- **T**est First:
|
|
820
|
-
- **R**eadable:
|
|
821
|
-
- **U**nified:
|
|
822
|
-
- **S**ecured:
|
|
823
|
-
- **T**rackable:
|
|
447
|
+
- **T**est First: Use the best testing tool per language (Jest/Vitest, pytest, go test, cargo test, JUnit, flutter test, ...).
|
|
448
|
+
- **R**eadable: Run linters (ESLint/Biome, ruff, golint, clippy, dart analyze, ...).
|
|
449
|
+
- **U**nified: Ensure type safety or runtime validation.
|
|
450
|
+
- **S**ecured: Apply security/static analysis tools.
|
|
451
|
+
- **T**rackable: Maintain @TAG coverage directly in code.
|
|
824
452
|
|
|
825
|
-
|
|
453
|
+
**Language-specific guidance**: `.moai/memory/development-guide.md#trust-5-principles`.
|
|
826
454
|
|
|
827
455
|
---
|
|
828
456
|
|
|
829
|
-
##
|
|
457
|
+
## Language-specific Code Rules
|
|
830
458
|
|
|
831
|
-
|
|
832
|
-
-
|
|
833
|
-
-
|
|
834
|
-
-
|
|
835
|
-
-
|
|
459
|
+
**Global constraints**:
|
|
460
|
+
- Files ≤ 300 LOC
|
|
461
|
+
- Functions ≤ 50 LOC
|
|
462
|
+
- Parameters ≤ 5
|
|
463
|
+
- Cyclomatic complexity ≤ 10
|
|
836
464
|
|
|
837
|
-
|
|
838
|
-
-
|
|
839
|
-
-
|
|
840
|
-
-
|
|
841
|
-
-
|
|
465
|
+
**Quality targets**:
|
|
466
|
+
- Test coverage ≥ 85%
|
|
467
|
+
- Intent-revealing names
|
|
468
|
+
- Early guard clauses
|
|
469
|
+
- Use language-standard tooling
|
|
842
470
|
|
|
843
|
-
|
|
844
|
-
-
|
|
845
|
-
-
|
|
846
|
-
-
|
|
471
|
+
**Testing strategy**:
|
|
472
|
+
- Prefer the standard framework per language
|
|
473
|
+
- Keep tests isolated and deterministic
|
|
474
|
+
- Derive cases directly from the SPEC
|
|
847
475
|
|
|
848
476
|
---
|
|
849
477
|
|
|
850
|
-
## TDD
|
|
478
|
+
## TDD Workflow Checklist
|
|
851
479
|
|
|
852
|
-
**1
|
|
853
|
-
- [ ] `.moai/specs/SPEC-<ID>/spec.md`
|
|
854
|
-
- [ ] YAML
|
|
855
|
-
- [ ] `@SPEC:ID` TAG
|
|
856
|
-
- [ ] **HISTORY
|
|
857
|
-
- [ ] EARS
|
|
858
|
-
- [ ]
|
|
480
|
+
**Step 1: SPEC authoring** (`/alfred:1-plan`)
|
|
481
|
+
- [ ] Create `.moai/specs/SPEC-<ID>/spec.md` (with directory structure)
|
|
482
|
+
- [ ] Add YAML front matter (id, version: 0.0.1, status: draft, created)
|
|
483
|
+
- [ ] Include the `@SPEC:ID` TAG
|
|
484
|
+
- [ ] Write the **HISTORY** section (v0.0.1 INITIAL)
|
|
485
|
+
- [ ] Use EARS syntax for requirements
|
|
486
|
+
- [ ] Check for duplicate IDs: `rg "@SPEC:<ID>" -n`
|
|
859
487
|
|
|
860
|
-
**2
|
|
861
|
-
- [ ] **RED**:
|
|
862
|
-
- [ ] **GREEN**:
|
|
863
|
-
- [ ] **REFACTOR**:
|
|
864
|
-
- [ ]
|
|
488
|
+
**Step 2: TDD implementation** (`/alfred:2-run`)
|
|
489
|
+
- [ ] **RED**: Write `@TEST:ID` under `tests/` and watch it fail
|
|
490
|
+
- [ ] **GREEN**: Add `@CODE:ID` under `src/` and make the test pass
|
|
491
|
+
- [ ] **REFACTOR**: Improve code quality; document TDD history in comments
|
|
492
|
+
- [ ] List SPEC/TEST file paths in the TAG block
|
|
865
493
|
|
|
866
|
-
**3
|
|
867
|
-
- [ ]
|
|
868
|
-
- [ ]
|
|
869
|
-
- [ ] Living Document
|
|
870
|
-
- [ ] PR
|
|
494
|
+
**Step 3: Documentation sync** (`/alfred:3-sync`)
|
|
495
|
+
- [ ] Scan TAGs: `rg '@(SPEC|TEST|CODE):' -n`
|
|
496
|
+
- [ ] Ensure no orphan TAGs remain
|
|
497
|
+
- [ ] Regenerate the Living Document
|
|
498
|
+
- [ ] Move PR status from Draft → Ready
|
|
871
499
|
|
|
872
500
|
---
|
|
873
501
|
|
|
874
|
-
##
|
|
502
|
+
## Project Information
|
|
875
503
|
|
|
876
|
-
-
|
|
877
|
-
-
|
|
878
|
-
-
|
|
879
|
-
-
|
|
880
|
-
-
|
|
504
|
+
- **Name**: {{PROJECT_NAME}}
|
|
505
|
+
- **Description**: {{PROJECT_DESCRIPTION}}
|
|
506
|
+
- **Version**: {{PROJECT_VERSION}}
|
|
507
|
+
- **Mode**: {{PROJECT_MODE}}
|
|
508
|
+
- **Toolchain**: Automatically selects the best tools for the chosen language
|