@leejungkiin/awkit 1.3.7 → 1.3.8

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.
package/bin/awk.js CHANGED
@@ -2201,12 +2201,12 @@ function cmdTrello(args) {
2201
2201
  const subCmd = args[0];
2202
2202
  const text = args.slice(1).join(' ');
2203
2203
 
2204
- if (!subCmd || subCmd === 'help') {
2204
+ if (!subCmd || subCmd === 'help' || subCmd === '--help' || subCmd === '-h') {
2205
2205
  trelloHelp();
2206
2206
  return;
2207
2207
  }
2208
2208
 
2209
- if (!text && subCmd !== 'help') {
2209
+ if (!text) {
2210
2210
  err(`Missing argument for 'trello ${subCmd}'. Usage: awkit trello ${subCmd} <text>`);
2211
2211
  return;
2212
2212
  }
@@ -2223,12 +2223,51 @@ function cmdTrello(args) {
2223
2223
  break;
2224
2224
 
2225
2225
  case 'item':
2226
- // trello-cli doesn't support adding checklist items natively.
2227
- // We fall back to marking an item incomplete (which implicitly creates it in some versions)
2228
- // or inform the user to use the REST API.
2229
- info(`Adding checklist item: ${text}`);
2230
- warn('Note: trello-cli may not support adding items. Use REST API if this fails.');
2231
- trelloExec(['card:check-item', '--item', text, '--state', 'incomplete']);
2226
+ info(`Adding checklist item via REST API: ${text}`);
2227
+ const credItem = trelloLoadCredentials();
2228
+ const cfgItem = trelloLoadProjectConfig();
2229
+ if (!credItem || !cfgItem) {
2230
+ err("Credentials or config missing for REST API fallback.");
2231
+ break;
2232
+ }
2233
+
2234
+ // 1. Get checklists
2235
+ const clRes = spawnSync('npx', ['--yes', 'trello-cli', 'card:checklists', '--board', cfgItem.board, '--list', cfgItem.list, '--card', cfgItem.card, '--format', 'json'], { env: { ...process.env, TRELLO_KEY: credItem.api_key, TRELLO_TOKEN: credItem.api_token }, encoding: 'utf-8' });
2236
+
2237
+ if (clRes.status !== 0) {
2238
+ err(`Failed to get checklists: ${clRes.stderr || clRes.stdout}`);
2239
+ break;
2240
+ }
2241
+
2242
+ try {
2243
+ // Sometime trello-cli outputs to stdout along with some other logs.
2244
+ // We extract the JSON array part.
2245
+ const outText = clRes.stdout;
2246
+ const jsonStr = outText.substring(outText.indexOf('['));
2247
+ const checklists = JSON.parse(jsonStr);
2248
+
2249
+ if (!checklists || checklists.length === 0) {
2250
+ err("No checklists found on card. Create one first using 'awkit trello checklist <name>'.");
2251
+ break;
2252
+ }
2253
+
2254
+ // Add to the LAST checklist (most recently appended usually)
2255
+ const targetChecklist = checklists[checklists.length - 1];
2256
+ const checklistId = targetChecklist.id;
2257
+
2258
+ // 2. Add item via curl
2259
+ const url = `https://api.trello.com/1/checklists/${checklistId}/checkItems?name=${encodeURIComponent(text)}&key=${credItem.api_key}&token=${credItem.api_token}`;
2260
+ const addRes = spawnSync('curl', ['-s', '-X', 'POST', url], { encoding: 'utf-8' });
2261
+
2262
+ const responseJson = JSON.parse(addRes.stdout);
2263
+ if (responseJson.id) {
2264
+ ok(`Item added successfully to checklist "${targetChecklist.name}".`);
2265
+ } else {
2266
+ err(`Failed to add item via REST API: ${addRes.stdout}`);
2267
+ }
2268
+ } catch (e) {
2269
+ err(`Failed to parse checklists or execute curl: ${e.message}`);
2270
+ }
2232
2271
  break;
2233
2272
 
2234
2273
  case 'complete':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leejungkiin/awkit",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "Antigravity Workflow Kit. Unified AI agent orchestration system.",
5
5
  "main": "bin/awk.js",
6
6
  "bin": {
@@ -110,6 +110,56 @@ digraph process {
110
110
  }
111
111
  ```
112
112
 
113
+ ## UI-First Task Ordering (Gate 4 Three-Phase — v12.3)
114
+
115
+ When a task set includes UI components (COMPLEX or MODERATE), tasks MUST be ordered in three phases:
116
+
117
+ ### Phase A: Infrastructure Tasks
118
+ ```
119
+ Priority: Execute FIRST
120
+ Examples:
121
+ - Add dependencies (Gradle, SPM, CocoaPods)
122
+ - Create project structure (packages, modules, DI)
123
+ - Set up navigation skeleton (NavGraph, Router)
124
+ - Configure build variants, signing
125
+ Gate: App MUST build successfully → proceed
126
+ ```
127
+
128
+ ### Phase B: UI Shell Tasks (Mock Data)
129
+ ```
130
+ Priority: Execute SECOND, BEFORE any logic tasks
131
+ Examples:
132
+ - Build all screen layouts with static/mock data
133
+ - Implement navigation between screens
134
+ - Add animations, transitions, loading/empty/error states
135
+ - Wire up UI components (no real API/DB calls)
136
+ Gate: 🧪 USER TEST CHECKPOINT — user must test UI on device
137
+ → Present test guidance (see symphony-enforcer TP1.7)
138
+ → User confirms UI OK → proceed to Phase C
139
+ → User reports issue → fix → re-checkpoint
140
+ ```
141
+
142
+ ### Phase C: Logic Tasks (Per Feature)
143
+ ```
144
+ Priority: Execute LAST, after UI is confirmed
145
+ Examples:
146
+ - Replace mock data with real API/DB calls
147
+ - Implement business logic, validation
148
+ - Add error handling, retry, offline support
149
+ - Wire up hardware features (camera, GPS, sensors)
150
+ Gate: 🧪 USER TEST CHECKPOINT per feature (batch small ones)
151
+ → Especially important for hardware-dependent features
152
+ ```
153
+
154
+ ### Task Sorting Rule
155
+ ```
156
+ When creating task list from implementation plan:
157
+ 1. Tag each task: [INFRA] [UI] [LOGIC]
158
+ 2. Sort: INFRA first → UI second → LOGIC last
159
+ 3. Within each phase: respect dependency ordering
160
+ 4. Between phases: MANDATORY checkpoint where indicated
161
+ ```
162
+
113
163
  ## Task Decomposition
114
164
 
115
165
  When facing multiple problems (e.g., 5 test failures across 3 files):
@@ -0,0 +1,130 @@
1
+ ---
2
+ name: admob-roas
3
+ description: When the user wants to implement AdMob ROAS tracking, track ad impressions to Firebase, or optimize in-app ad revenue events in Native Android (Kotlin) or iOS (Swift). Also use when the user mentions "tROAS", "ad_impression", "OnPaidEventListener", "paidEventHandler", or "admob ROAS event".
4
+ metadata:
5
+ version: 1.0.0
6
+ ---
7
+
8
+ # ROAS Event Tracking cho AdMob (Native Android & iOS)
9
+
10
+ You are an expert in mobile app analytics and AdMob monetization. Your goal is to help the user implement ROAS event tracking (`ad_impression`) for AdMob in Native Android (Kotlin) and iOS (Swift).
11
+
12
+ > **🎯 Mục tiêu**: Đảm bảo Firebase Analytics nhận được sự kiện `ad_impression` kèm theo giá trị doanh thu (`value`, `currency`) mỗi khi quảng cáo hiển thị. Điều này **bắt buộc** để Google Ads / Facebook Ads có thể chạy tROAS (Target Return On Ad Spend) campaign.
13
+
14
+ ---
15
+
16
+ ## 1. Yêu Cầu Cốt Lõi (Requirements)
17
+
18
+ Khi AI Agent được giao nhiệm vụ tích hợp quảng cáo (AdMob) vào dự án Native Android (Kotlin) hoặc iOS (Swift), **LUÔN** phải đảm bảo:
19
+ - SDK `Firebase Analytics` đã được cài đặt và khởi tạo.
20
+ - Bắt sự kiện **OnPaidEventListener** (Android) hoặc **paidEventHandler** (iOS) trên TẤT CẢ các loại quảng cáo: Banner, Interstitial, Rewarded, AppOpen, Native.
21
+ - Convert chuẩn xác giá trị vi mô (`valueMicros` / `NSDecimalNumber`) ra giá trị thập phân thực.
22
+ - Bắn event `ad_impression` về Firebase.
23
+
24
+ ---
25
+
26
+ ## 2. Standard Pattern: Android (Kotlin)
27
+
28
+ ### Bước 1: Tạo Helper/Tracker Class
29
+
30
+ Tạo file `RoasTracker.kt` ở package data/analytics:
31
+
32
+ ```kotlin
33
+ import android.os.Bundle
34
+ import com.google.android.gms.ads.AdValue
35
+ import com.google.android.gms.ads.AdapterResponseInfo
36
+ import com.google.firebase.analytics.FirebaseAnalytics
37
+
38
+ object RoasTracker {
39
+ fun trackAdMobImpression(
40
+ firebaseAnalytics: FirebaseAnalytics,
41
+ adValue: AdValue,
42
+ responseInfo: AdapterResponseInfo?,
43
+ adFormat: String
44
+ ) {
45
+ val valueMicros = adValue.valueMicros
46
+ val currencyCode = adValue.currencyCode
47
+ val valueDouble = valueMicros / 1_000_000.0 // Convert sang dạng float/double
48
+
49
+ val bundle = Bundle().apply {
50
+ putString(FirebaseAnalytics.Param.AD_PLATFORM, "admob")
51
+ putString(FirebaseAnalytics.Param.AD_SOURCE, responseInfo?.adSourceName ?: "AdMob")
52
+ putString(FirebaseAnalytics.Param.AD_FORMAT, adFormat)
53
+ putDouble(FirebaseAnalytics.Param.VALUE, valueDouble)
54
+ putString(FirebaseAnalytics.Param.CURRENCY, currencyCode)
55
+ }
56
+
57
+ firebaseAnalytics.logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, bundle)
58
+ }
59
+ }
60
+ ```
61
+
62
+ ### Bước 2: Tích hợp vào Ad Lifecycle
63
+
64
+ **Ví dụ với AppOpenAd / InterstitialAd:**
65
+ ```kotlin
66
+ interstitialAd?.onPaidEventListener = OnPaidEventListener { adValue ->
67
+ RoasTracker.trackAdMobImpression(
68
+ firebaseAnalytics = FirebaseAnalytics.getInstance(context),
69
+ adValue = adValue,
70
+ responseInfo = interstitialAd?.responseInfo?.loadedAdapterResponseInfo,
71
+ adFormat = "interstitial"
72
+ )
73
+ }
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 3. Standard Pattern: iOS (Swift)
79
+
80
+ ### Bước 1: Tạo Helper/Tracker Struct
81
+
82
+ Tạo file `RoasTracker.swift`:
83
+
84
+ ```swift
85
+ import Foundation
86
+ import FirebaseAnalytics
87
+ import GoogleMobileAds
88
+
89
+ struct RoasTracker {
90
+ static func trackAdMobImpression(
91
+ adValue: GADAdValue,
92
+ responseInfo: GADAdNetworkResponseInfo?,
93
+ adFormat: String
94
+ ) {
95
+ let value = adValue.value.doubleValue
96
+ let currency = adValue.currencyCode
97
+
98
+ Analytics.logEvent(AnalyticsEventAdImpression, parameters: [
99
+ AnalyticsParameterAdPlatform: "admob",
100
+ AnalyticsParameterAdSource: responseInfo?.adNetworkClassName ?? "AdMob",
101
+ AnalyticsParameterAdFormat: adFormat,
102
+ AnalyticsParameterValue: value,
103
+ AnalyticsParameterCurrency: currency
104
+ ])
105
+ }
106
+ }
107
+ ```
108
+
109
+ ### Bước 2: Tích hợp vào Ad Lifecycle
110
+
111
+ **Ví dụ với GADRewardedAd:**
112
+ ```swift
113
+ rewardedAd?.paidEventHandler = { [weak rewardedAd] adValue in
114
+ guard let ad = rewardedAd else { return }
115
+ RoasTracker.trackAdMobImpression(
116
+ adValue: adValue,
117
+ responseInfo: ad.responseInfo?.loadedAdNetworkResponseInfo,
118
+ adFormat: "rewarded"
119
+ )
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## 4. Kiểm tra Validation
126
+
127
+ Một luồng ROAS hợp lệ phải có đủ các yếu tố sau:
128
+ 1. Bạn phải đăng ký `OnPaidEventListener` NGAY SAU KHI Ad báo quá trình load thành công (trong `onAdLoaded`).
129
+ 2. Log output phải hiển thị event `ad_impression` trong Logcat (hoặc Xcode console) qua chế độ `-enable_core_ads` hoặc Firebase Verbose logging `adb shell setprop log.tag.FA VERBOSE`.
130
+ 3. Kiểm tra các event onboarding `tutorial_begin` và `tutorial_complete` để đảm bảo luồng cài đặt và sử dụng ứng dụng được tracking liên kết.
@@ -1,498 +1,96 @@
1
1
  ---
2
2
  name: orchestrator
3
- description: >-
4
- Autonomous State Machine Gatekeeper — triages task complexity, enforces 7-Gate pipeline,
5
- and auto-routes to the correct skill. AI tự kiểm tra trạng thái dự án và bắt buộc
6
- user đi qua đúng Gate trước khi code. User KHÔNG CẦN gọi workflow bằng tay.
7
- Hỗ trợ auto-detect .kiro/specs từ IDE Kiro để bypass/accelerate Gates.
8
- metadata:
9
- stage: core
10
- version: "2.3"
11
- replaces: "2.2"
12
- tags: [orchestrator, routing, gate, triage, state-machine, core, kiro]
13
- agent: Orchestrator
14
- trigger: always
15
- invocation-type: auto
16
- priority: 0
3
+ description: Intelligent dispatcher — analyzes context and delegates to the right skill or workflow
17
4
  ---
18
5
 
19
- # Orchestrator v2.3 — Autonomous State Machine Gatekeeper
6
+ # Orchestrator Skill
20
7
 
21
- > **Purpose:** Route mọi request qua hệ thống 7-Gate tự động.
22
- > AI tự nhận diện project state tự quyết định gate nào cần chạy.
23
- > User chỉ cần nói ý tưởng, AI lo phần còn lại.
24
- > Hỗ trợ auto-detect `.kiro/specs` để accelerate/bypass Gates khi IDE đã tạo sẵn specs.
8
+ ## Purpose
9
+ Route user requests to the correct workflow or skill based on context analysis.
25
10
 
26
- ---
27
-
28
- ## ⚡ Core Principle
29
-
30
- ```
31
- AI LÀ NGƯỜI GIÁM SÁT "CÁN CÂN" CỦA DỰ ÁN.
32
- - User không cần nhớ workflow nào để gọi
33
- - AI tự detect thiếu spec → tự hỏi
34
- - AI tự detect thiếu design → tự phác thảo
35
- - AI tự detect thiếu tickets → tự tạo
36
- - Chỉ cho phép code khi TẤT CẢ prerequisites thỏa mãn
37
- ```
38
-
39
- ### 6 Decision Principles (Auto-decide khi không cần hỏi user)
40
-
41
- ```
42
- 1. Complete > Shortcuts — AI cost rẻ. Implement đủ, kể cả edge cases.
43
- 2. Evidence > Assumptions — Dựa trên data thực tế, không đoán.
44
- 3. Standard > Custom — Ưu tiên thư viện/pattern có sẵn.
45
- 4. Explicit > Implicit — Code rõ ràng, không clever tricks.
46
- 5. Test > Trust — Viết test, không "chắc chắn đúng".
47
- 6. Small > Big — Incremental changes, không big-bang.
48
- ```
49
-
50
- ---
51
-
52
- ## 🔍 Kiro Spec Detection (Auto-Accelerate Gates)
53
-
54
- > **Kiro** là IDE có khả năng sinh spec cấu trúc tại `.kiro/specs/`.
55
- > Khi phát hiện thư mục này, orchestrator tự động map nội dung vào Gate system,
56
- > giúp bypass/accelerate các Gates mà không cần AI tự sinh lại tài liệu.
57
-
58
- ### Detection Logic (chạy ĐẦU TIÊN trước Gate check)
59
-
60
- ```yaml
61
- kiro_detection:
62
- trigger: Mỗi khi bắt đầu COMPLEX task
63
- scan_path: ".kiro/specs/" (tương đối từ project root)
64
-
65
- structure_expected:
66
- .kiro/specs/
67
- ├── <project-slug>/ # Top-level project spec
68
- │ ├── requirements.md # → Gate 1 (Spec)
69
- │ ├── design.md # → Gate 2 (Architecture)
70
- │ └── tasks.md # → Gate 3 (Symphony Tasks)
71
- ├── <module-01>/ # Per-module specs
72
- │ ├── requirements.md # → Gate 1.5 (Module Spec)
73
- │ ├── design.md # → Gate 2 (per-module design)
74
- │ └── tasks.md # → Gate 3 (per-module tasks)
75
- └── <module-02>/
76
- └── ...
77
-
78
- gate_mapping:
79
- gate_1_spec:
80
- pass_if: ANY requirements.md exists in .kiro/specs/
81
- source: .kiro/specs/<project-slug>/requirements.md
82
- action: Load as project BRIEF — bypass brainstorm-agent
83
-
84
- gate_1_5_module_spec:
85
- pass_if: ≥2 module folders (excluding project-slug) with requirements.md
86
- source: .kiro/specs/<module>/requirements.md (each)
87
- action: Load as module specs — bypass module-spec-writer
88
-
89
- gate_2_architecture:
90
- pass_if: ANY design.md exists in .kiro/specs/
91
- source: .kiro/specs/<project-slug>/design.md + per-module design.md
92
- action: Load as approved design — auto-approve (user already approved in Kiro)
93
-
94
- gate_2_5_visual:
95
- pass_if: NOT affected (Kiro doesn't produce visual designs)
96
- action: Normal Gate 2.5 flow
97
-
98
- gate_3_tasks:
99
- pass_if: ANY tasks.md exists in .kiro/specs/
100
- source: .kiro/specs/<module>/tasks.md (each)
101
- action: Parse tasks → auto-create Symphony tickets
102
-
103
- output_format:
104
- "🔍 KIRO SPECS DETECTED at .kiro/specs/
105
- 📄 Requirements: {count} files (Gate 1 + 1.5 → AUTO-PASS)
106
- 📐 Design docs: {count} files (Gate 2 → AUTO-PASS)
107
- 📋 Task lists: {count} files (Gate 3 → AUTO-IMPORT)
108
- Modules: {list module names}"
109
- ```
110
-
111
- ### Kiro Spec Priority Rules
112
-
113
- ```
114
- 1. .kiro/specs > docs/specs > docs/architecture > Brain/NeuralMemory
115
- → Kiro specs LUÔN được ưu tiên khi tồn tại
116
-
117
- 2. Nếu CẢ .kiro/specs VÀ docs/specs tồn tại:
118
- → Dùng .kiro/specs làm source of truth
119
- → Cảnh báo: "⚠️ Phát hiện cả .kiro/specs và docs/specs.
120
- Sử dụng .kiro/specs làm source of truth. docs/specs có thể outdated."
121
-
122
- 3. Kiro specs KHÔNG thay thế:
123
- → Gate 2.5 (Visual Design) — Kiro không tạo design visuals
124
- → Gate 5 (Verification) — luôn cần run tests/build
125
- → NeuralMemory decisions — vẫn lưu context vào brain
126
-
127
- 4. Khi code (Gate 4), AI PHẢI đối chiếu với:
128
- → .kiro/specs/<module>/requirements.md (acceptance criteria)
129
- → .kiro/specs/<module>/design.md (technical design)
130
- → .kiro/specs/<module>/tasks.md (task checklist)
131
- ```
132
-
133
- ---
134
-
135
- ## 🎯 STEP 1: Complexity Triage (BẮT BUỘC)
136
-
137
- Mỗi khi nhận request từ user, orchestrator PHẢI phân loại complexity **TRƯỚC** mọi action khác.
138
-
139
- ### Scoring Criteria
140
-
141
- ```yaml
142
- factors:
143
- persistence_change: # Thay đổi Database/Storage/Model
144
- score: +4
145
- signals: ["database", "schema", "table", "collection", "model", "migration", "storage"]
146
-
147
- new_feature: # Feature hoàn toàn mới
148
- score: +3
149
- signals: ["tính năng mới", "new feature", "implement", "build", "tạo mới"]
150
-
151
- multi_file: # Ảnh hưởng nhiều file/module
152
- score: +2
153
- signals: [">3 files", "cross-module", "refactor lớn", "architecture"]
154
-
155
- api_change: # Thay đổi API contract
156
- score: +2
157
- signals: ["API", "endpoint", "request", "response", "contract"]
158
-
159
- ui_only: # Chỉ thay đổi UI/styling
160
- score: +0
161
- signals: ["đổi màu", "UI", "layout", "font", "padding", "margin"]
162
-
163
- single_file_fix: # Sửa 1 file, logic nhỏ
164
- score: +0
165
- signals: ["fix typo", "sửa lỗi nhỏ", "update text", "rename"]
166
- ```
167
-
168
- ### Classification
169
-
170
- ```
171
- TRIVIAL (score 0-2): Bypass ALL gates → Execute trực tiếp
172
- Examples: đổi màu nút, sửa typo, thêm log, fix linter, update string
173
-
174
- MODERATE (score 3-5): Gate 3 + 4 + 5
175
- Examples: thêm UI component, sửa logic business nhỏ, update 1-2 files
176
-
177
- COMPLEX (score 6-10): ALL 7 Gates bắt buộc
178
- Examples: thêm feature mới, thay đổi DB schema, thiết kế UI, refactor architecture, thêm API
179
- ```
180
-
181
- ### Output Format
182
-
183
- ```
184
- 🔍 TRIAGE: [TRIVIAL|MODERATE|COMPLEX] (score: N/10)
185
- Factors: [list detected factors]
186
- Gates required: [list gates]
187
- ```
188
-
189
- ---
190
-
191
- ## 🚦 STEP 2: Gate State Check (Cho COMPLEX tasks)
192
-
193
- Sau khi triage = COMPLEX, orchestrator kiểm tra **tuần tự** từng Gate.
194
- Dừng tại Gate ĐẦU TIÊN chưa thỏa mãn.
195
-
196
- ### Gate 1: Spec Clarification 🔴
197
-
198
- ```
199
- CHECK: Tồn tại file mô tả feature này?
200
- → CHECK 1 (Kiro): .kiro/specs/<module>/requirements.md tồn tại?
201
- → CÓ → AUTO-PASS Gate 1 (Kiro specs detected)
202
- → CHECK 2: docs/specs/<feature>.md HOẶC docs/BRIEF.md có section liên quan
203
- → CHECK 3: NeuralMemory có BRIEF/SPEC cho feature này
204
-
205
- PASS condition:
206
- - .kiro/specs requirements.md tồn tại (highest priority), HOẶC
207
- - docs/specs file tồn tại VÀ có nội dung rõ ràng, HOẶC
208
- - NeuralMemory có BRIEF/SPEC
209
-
210
- FAIL action:
211
- → Thông báo user: "Ý tưởng rất hay! Nhưng trước khi bắt tay vào code,
212
- để tôi hỏi vài câu để chốt rõ yêu cầu đã nhé."
213
- → Kích hoạt: brainstorm-agent skill (Phase 2-6)
214
- → Output: BRIEF.md hoặc docs/specs/<feature>.md
215
- → Sau khi tạo xong → Re-check Gate 1 → Proceed Gate 1.5
216
- ```
217
-
218
- ### Gate 1.5: Module Specification 🟠
219
-
220
- ```
221
- CHECK: Mỗi module có file spec chi tiết?
222
- → CHECK 1 (Kiro): .kiro/specs/ chứa ≥2 module folders với requirements.md?
223
- → CÓ → AUTO-PASS Gate 1.5 (Kiro module specs detected)
224
- → Load từng .kiro/specs/<module>/requirements.md làm module spec
225
- → CHECK 2: docs/specs/modules/<module>_spec.md tồn tại?
226
- → CHECK 3: NeuralMemory có module specs cho project này
227
-
228
- PASS condition:
229
- - .kiro/specs module folders tồn tại (highest priority), HOẶC
230
- - Tất cả modules có spec file VÀ status "Approved"
231
-
232
- SKIP condition:
233
- → TRIVIAL hoặc MODERATE tasks → SKIP
234
- → Single-module projects (≤3 modules, không phải port) → SKIP
235
- → User nói "skip spec" → SKIP
236
-
237
- MANDATORY condition:
238
- → COMPLEX (score ≥6) VÀ >3 modules
239
- → Port/migration projects (iOS→Android, Android→iOS)
240
-
241
- FAIL action:
242
- → Thông báo user: "Trước khi thiết kế kỹ thuật, để em mô tả chi tiết
243
- từng module — screens, flows, rules — để anh em hiểu rõ cùng nhau."
244
- → Kích hoạt: module-spec-writer skill
245
- → Output: docs/specs/modules/<module>_spec.md (per module)
246
- → Sau khi tạo + approved → Re-check Gate 1.5 → Proceed Gate 2
247
- ```
248
-
249
- ### Gate 2: Architecture & Data Design 🟠
250
-
251
- ```
252
- CHECK: Tồn tại bản thiết kế kỹ thuật đã được duyệt?
253
- → CHECK 1 (Kiro): .kiro/specs/<module>/design.md tồn tại?
254
- → CÓ → AUTO-PASS Gate 2 (Kiro design specs detected, pre-approved by IDE)
255
- → Load design.md làm approved architecture document
256
- → Lưu vào NeuralMemory: "Kiro design docs loaded for <modules>"
257
- → CHECK 2: docs/architecture/<feature>_design.md tồn tại?
258
- → CHECK 3: implementation_plan.md có section "Data Model" + marker "Approved"
259
-
260
- PASS condition:
261
- - .kiro/specs design.md tồn tại (highest priority, auto-approved), HOẶC
262
- - docs/architecture file tồn tại VÀ có marker "## Status: Approved"
263
-
264
- FAIL action:
265
- → Thông báo user: "Đã có spec rồi. Giờ để tôi phác thảo thiết kế
266
- Database và API trước khi code, tránh phải sửa đi sửa lại sau nhé."
267
- → Kích hoạt: spec-gate skill
268
- → Output: docs/architecture/<feature>_design.md
269
- → Yêu cầu user approve design
270
- → Sau khi approved → Re-check Gate 2 → Proceed Gate 2.5
271
- ```
272
-
273
- ### Gate 2.5: Visual Design & UI Sync 🎨
274
-
275
- ```
276
- CHECK: Đã có thiết kế UI/hiểu biết chung về UI chưa?
277
- → Scan: docs/design/ hoặc docs/screenshot/ có ảnh/tài liệu UI
278
- → HOẶC: file docs/design/<feature>.pen đã được duyệt
279
-
280
- PASS condition: Đã có ảnh UI tham chiếu HOẶC bản vẽ Pencil đính kèm.
281
-
282
- SKIP condition:
283
- → Backend/Logic-only tasks (Cron, API pure, Refactor, DB Query...)
284
- → User nói "skip design"
285
-
286
- FAIL action:
287
- → Thông báo user: "Tính năng này có giao diện nên để đảm bảo đồng bộ,
288
- tôi sẽ phác thảo qua thiết kế bằng Pencil hoặc anh có thể gửi ảnh screenshot/vào docs/design/ trước nhé."
289
- → Kích hoạt: visual-design-gate skill
290
- → Output: UI layout thống nhất (ảnh / .pen file)
291
- → Xác nhận approve visual preview
292
- → Sau khi approved → Re-check Gate 2.5 → Proceed Gate 3
293
- ```
294
-
295
- ### Gate 3: Task Breakdown (Symphony) 🟡
296
-
297
- ```
298
- CHECK: Có Symphony tasks liên kết feature này?
299
- → CHECK 1 (Kiro): .kiro/specs/<module>/tasks.md tồn tại?
300
- → CÓ → Parse tasks từ Kiro tasks.md
301
- → Map task items → Symphony tickets (symphony_create_task)
302
- → AUTO-IMPORT: Tạo Symphony tasks từ Kiro task list
303
- → CHECK 2: symphony_available_tasks → filter by feature keyword/tag
304
-
305
- PASS condition: ≥1 task tồn tại cho feature này
306
-
307
- FAIL action:
308
- → Đọc design doc từ Gate 2 (hoặc .kiro/specs design.md)
309
- → Auto-generate 3-8 micro-tasks
310
- → Tạo Symphony tasks (symphony_create_task cho mỗi task)
311
- → Present danh sách cho user confirm
312
- → Sau khi confirm → Proceed Gate 4
313
- ```
314
-
315
- ### Gate 4: Execution 🟢
316
-
317
- ```
318
- CHECK: Có ticket đang In Progress?
319
- → symphony_available_tasks(filter="in_progress")
320
-
321
- 🔍 SEARCH BEFORE BUILDING (BẮT BUỘC trước khi viết code mới):
322
- Layer 0 — Structural (GitNexus, CHỈ khi .gitnexus/ tồn tại):
323
- → gitnexus_impact: Check blast radius của symbol cần sửa
324
- → gitnexus_context: Xem 360° callers/callees trước khi code
325
- → gitnexus_query: Tìm execution flows liên quan
326
- Layer 1 — Tried-and-True:
327
- → nmem_recall: Tìm similar problems đã giải quyết trong brain
328
- → grep_search: Tìm existing utils/patterns trong codebase
329
- Layer 2 — New-and-Popular:
330
- → Tìm thư viện/SDK chuẩn ngành cho problem này
331
- → Ưu tiên well-maintained, community-backed solutions
332
- Layer 3 — First-Principles:
333
- → CHỈ build from scratch khi Layer 1+2 không có solution phù hợp
334
- → Ghi lý do tại sao existing solutions không đáp ứng
335
-
336
- ⚠️ KHÔNG được skip layers! Log kết quả search vào progress report.
337
-
338
- ACTION:
339
- → Nếu chưa có → Claim task tiếp theo: symphony_claim_task
340
- → Code THEO TICKET, THEO DESIGN DOC, THEO search results
341
- → Nếu phát hiện cần sửa schema khác design → ⛔ DỪNG:
342
- "Schema change ngoài approved design detected.
343
- Quay lại Gate 2 để cập nhật design doc."
344
- → Complete ticket → symphony_complete_task
345
- ```
346
-
347
- ### Gate 5: Verification 🔵
348
-
349
- ```
350
- ACTION: Auto-trigger sau mỗi Gate 4 completion
351
- → verification-gate skill (evidence before claims)
352
- → Boil-the-Lake checklist (completeness check)
353
- → code-review skill (nếu task phức tạp)
354
- → Đối chiếu: code thực tế vs design doc
355
- → OK → Task done → Auto-Next (TP4 in symphony-enforcer)
356
- ```
357
-
358
- ---
359
-
360
- ## 🔀 STEP 3: Slash Command Detection (Giữ lại)
361
-
362
- Nếu user dùng slash command rõ ràng → Load workflow file trực tiếp, SKIP triage.
11
+ ## Routing Logic
363
12
 
13
+ ### 1. Slash Command Detection
364
14
  ```
365
15
  User input starts with `/` → Load workflow file directly
366
16
  /plan → workflows/lifecycle/plan.md
367
17
  /code → workflows/lifecycle/code.md
368
18
  /debug → workflows/lifecycle/debug.md
369
- /brainstorm brainstorm-agent skill
370
- ...etc (see GEMINI.md)
19
+ ...etc (see GEMINI.md § 2)
371
20
  ```
372
21
 
373
- > **Note:** Slash commands bypass triage vì user ĐÃ BIẾT mình cần gì.
374
-
375
- ---
376
-
377
- ## 🧠 STEP 4: Intent Detection (Fallback)
378
-
379
- Nếu KHÔNG phải slash command VÀ triage chưa rõ:
380
-
22
+ ### 2. Intent Detection (No slash command)
381
23
  ```yaml
382
24
  code_intent:
383
- keywords: ["implement", "build", "create", "add", "code", "fix", "viết", "tạo", "làm"]
384
- action: Run triage route theo complexity
25
+ keywords: ["implement", "build", "create", "add", "code", "fix", "viết", "tạo"]
26
+ action: Suggest `/code` or `/codeExpert`
385
27
 
386
28
  debug_intent:
387
- keywords: ["error", "bug", "crash", "fix", "lỗi", "sửa", "fail", "broken"]
388
- action: systematic-debugging skill (bypass spec gates — debugging is reactive)
29
+ keywords: ["error", "bug", "crash", "fix", "lỗi", "sửa", "fail"]
30
+ action: Suggest `/debug` or `/debugExpert`
389
31
 
390
32
  plan_intent:
391
33
  keywords: ["plan", "design", "architect", "how to", "strategy", "thiết kế"]
392
- action: Suggest Gate 1-2 flow
393
-
394
- brainstorm_intent:
395
- keywords: ["brainstorm", "ý tưởng", "idea", "nên làm gì", "what should"]
396
- action: brainstorm-agent skill
34
+ action: Suggest `/plan` or `/planExpert`
397
35
 
398
36
  context_intent:
399
37
  keywords: ["remember", "save", "continue", "where was I", "nhớ", "tiếp"]
400
- action: Suggest /recap or /save-brain
38
+ action: Suggest `/recap` or `/save-brain`
401
39
 
402
- refactor_intent:
403
- keywords: ["refactor", "rename", "extract", "split", "move", "restructure", "blast radius", "impact"]
404
- action: gitnexus-intelligence skill (impact analysis + safe refactoring)
40
+ ads_intent:
41
+ keywords: ["ads", "campaign", "CPI", "ROAS", "quảng cáo"]
42
+ action: Suggest `/ads-audit` or `/adsExpert`
405
43
  ```
406
44
 
407
- ---
408
-
409
- ## 🗣️ Communication Style
410
-
411
- Orchestrator KHÔNG nói giọng máy móc. Dùng giọng đồng nghiệp senior:
412
-
45
+ ### 3. Skill Pack Check
413
46
  ```
414
- "ERROR: Gate 1 not satisfied. Spec document missing."
415
- tưởng rất hay! Kinh nghiệm cho thấy nếu không chốt yêu cầu trước,
416
- sau sửa cực lắm. Để tôi hỏi vài câu rồi mình chốt spec nhé?"
417
-
418
- ❌ "Gate 2 failed. Architecture document required."
419
- ✅ "Đã hiểu yêu cầu rồi. Giờ để tôi phác thảo cấu trúc database
420
- cho anh xem trước — tránh kiểu vừa làm vừa đập đi xây lại."
421
-
422
- ❌ "Execution blocked. No Symphony task found."
423
- ✅ "Design ngon rồi! Giờ tôi bẻ ra thành 5 task nhỏ trên Symphony
424
- để track tiến độ nhé."
47
+ If user request involves iOS-specific Check if mobile-ios pack enabled
48
+ If not enabled Suggest: "awf enable-pack mobile-ios"
425
49
  ```
426
50
 
427
- ---
51
+ ### 3.5. Gate 4 Three-Phase Routing (v12.3 — AUTO-ENFORCE)
428
52
 
429
- ## 🚫 Anti-Patterns
53
+ > ⚠️ AI PHẢI CHỦ ĐỘNG kích hoạt — KHÔNG chờ user gọi.
54
+ > Khi detect COMPLEX + UI → TỰ ĐỘNG announce Phase Announcement Block.
430
55
 
431
56
  ```yaml
432
- never_do:
433
- - Cho phép code COMPLEX task chưa qua Gate 1-2
434
- - Tự ý thêm cột DB ngoài approved design
435
- - Hỏi "Bạn muốn chạy workflow nào?" — AI phải TỰ QUYẾT
436
- - Tạo Symphony tickets trước khi có design doc (Gate 3 cần Gate 2)
437
- - Force user qua 5 Gates cho trivial tasks
438
- - Code mới mà chưa search existing solution (Search Before Building)
439
- - Đồng ý approach có vấn đề mà không push back (Anti-sycophancy)
440
- - Skip edge cases / error handling vì "trivial" (Boil the Lake)
441
-
442
- always_do:
443
- - Hiển thị triage result trước mọi action
444
- - Thông báo đang Gate nào khi chặn
445
- - Giữ giọng thân thiện, giải thích LÝ DO chặn
446
- - Cho phép user override gate: "skip gates" hoặc "bỏ qua"
447
- - Re-check gates sau mỗi lần user provide input
448
- - Search NeuralMemory + codebase TRƯỚC khi code mới
449
- - Report DONE_WITH_CONCERNS nếu có caveats (Completion Status)
450
- - Escalate sau 3 failed attempts (3-Strike Rule)
451
- ```
452
-
453
- ---
454
-
455
- ## 🔗 Skill Relationships
456
-
457
- ```
458
- DELEGATES TO:
459
- Gate 1 brainstorm-agent (phỏng vấn BRIEF.md)
460
- Gate 1.5 module-spec-writer ( tả chi tiết per-module spec)
461
- Gate 2 → spec-gate (thiết kế DB/API design doc)
462
- Gate 2.5 → visual-design-gate (thống nhất UI/UX bằng Pencil)
463
- Gate 3 → symphony-enforcer (tạo + track tasks)
464
- Gate 4 → relevant coding workflow (/code, /codeExpert)
465
- Gate 5 → verification-gate + code-review
466
-
467
- WORKS WITH:
468
- nm-memory-sync (đọc context từ NeuralMemory)
469
- awf-session-restore (restore state)
470
- symphony-orchestrator (đảm bảo Symphony server running)
471
- gitnexus-intelligence (architectural awareness trước khi code)
472
-
473
- DOES NOT:
474
- Execute code trực tiếp (delegates to workflows)
475
- Modify files (chỉ route + enforce gates)
476
- ```
477
-
478
- ---
479
-
480
- ## 🧩 Edge Cases
481
-
482
- | Tình huống | Xử lý |
483
- |-----------|--------|
484
- | User nói "skip gates" / "bỏ qua" | Cho phép bypass, ghi cảnh báo |
485
- | Feature đã có partial spec | Gate 1 pass, check Gate 2 |
486
- | Debug request | Bypass spec gates — debugging is reactive |
487
- | User follow-up nhỏ sau feature done | Re-triage — thường TRIVIAL |
488
- | Multiple features cùng lúc | Triage TỪNG feature riêng |
489
- | Spec tồn tại nhưng outdated | Cảnh báo "Spec cũ, cần update?" |
490
- | Project chưa có docs/ folder | Tạo folder structure tự động |
491
- | `.kiro/specs/` tồn tại | AUTO-DETECT → accelerate Gates 1, 1.5, 2, 3 |
492
- | `.kiro/specs` + `docs/specs` cùng tồn tại | Ưu tiên `.kiro/specs`, cảnh báo potential conflict |
493
- | `.kiro/specs` chỉ có 1 module folder | Pass Gate 1, SKIP Gate 1.5 (single module) |
494
- | `.kiro/specs/<module>/tasks.md` format lạ | Parse best-effort, fallback tạo tasks thủ công |
495
-
496
- ---
497
-
498
- *orchestrator v2.3 — Autonomous State Machine Gatekeeper for AWKit (Kiro Spec Integration)*
57
+ gate4_triage:
58
+ trigger: After Gate 3 (tasks created), before execution begins
59
+ auto_activate: true # AI proactively triggers, no user command needed
60
+
61
+ complex_with_ui:
62
+ condition: complexity == COMPLEX AND task has UI components
63
+ action: Enforce Three-Phase Execution
64
+ phases:
65
+ - Phase A: Infrastructure (dependencies, DI, navigation skeleton)
66
+ → Must build successfully before Phase B
67
+ - Phase B: UI Shell (all screens with mock data)
68
+ TRIGGER TP1.7: User Test Checkpoint (MANDATORY)
69
+ User must confirm UI OK before Phase C
70
+ - Phase C: Logic Integration (per feature)
71
+ TRIGGER TP1.7: after each feature (batch small ones)
72
+ task_ordering: UI tasks MUST be grouped before logic tasks in Symphony
73
+
74
+ moderate_with_ui:
75
+ condition: complexity == MODERATE AND task has UI components
76
+ action: Phase A+C merged, Phase B optional (recommend for hardware features)
77
+
78
+ trivial_or_backend:
79
+ condition: complexity == TRIVIAL OR no UI components
80
+ action: Skip phases, code straight through (no checkpoints)
81
+
82
+ detect_ui_components:
83
+ signals:
84
+ - Task mentions: screen, view, layout, UI, button, form, navigation
85
+ - Files include: *.xml (Android), *.swift (iOS views), *.compose, *.tsx
86
+ - Spec references: wireframe, mockup, design, screenshot
87
+ ```
88
+
89
+ ### 4. Fallback
90
+ ```
91
+ No match → Ask clarifying question (max 2 times)
92
+ Still unclear → Suggest `/help`
93
+ ```
94
+
95
+ ## Auto-Activation
96
+ This skill is always active. It runs as the first layer before any other processing.
@@ -4,13 +4,13 @@ description: |
4
4
  Mandatory Symphony checkpoint system. Ensures AI never forgets to create,
5
5
  update, or complete tasks in Symphony. Enforces progress reporting at every
6
6
  milestone and auto-detects task completion without waiting for user confirmation.
7
- v3.4: Kiro Spec Integration, Completion Status Protocol, Search-Before-Building, Boil-the-Lake.
7
+ v3.5: UI-First Three-Phase Execution with User Test Checkpoints.
8
8
  metadata:
9
9
  stage: core
10
- version: "3.4"
11
- replaces: "v3.3"
10
+ version: "3.5"
11
+ replaces: "v3.4"
12
12
  requires: symphony-orchestrator
13
- tags: [symphony, enforcement, checkpoint, task-lifecycle, core, spec-first, auto-next, kiro]
13
+ tags: [symphony, enforcement, checkpoint, task-lifecycle, core, spec-first, auto-next, kiro, ui-first, user-test]
14
14
  agent: Symphony Enforcer
15
15
  allowed-tools:
16
16
  - symphony_create_task
@@ -24,17 +24,14 @@ invocation-type: auto
24
24
  priority: 1
25
25
  ---
26
26
 
27
- # Symphony Enforcer v3.4Kiro Spec Integration + Completion Status Protocol
27
+ # Symphony Enforcer v3.5UI-First Three-Phase Execution + User Test Checkpoints
28
28
 
29
29
  > **Purpose:** Đảm bảo AI KHÔNG BAO GIỜ quên cập nhật Symphony.
30
- > **Key Changes v3.4:**
31
- > - **Kiro Spec Integration**: Auto-detect `.kiro/specs/`load specs + import tasks
32
- > - **Completion Status Protocol**: 4-status (DONE/DONE_WITH_CONCERNS/BLOCKED/NEEDS_CONTEXT)
33
- > - **Design Compliance (TP1.5)**: Đối chiếu schema changes vs approved design doc
34
- > - **Pre-Plan Gate**: Đọc spec trước khi plan, hỏi user về constraints
35
- > - **Auto-Lifecycle**: Liên kết task_boundary ↔ Symphony tự động
36
- > - **Auto-Next**: BẮT BUỘC gợi ý next steps sau mỗi task done
37
- > - **Atomic Git Commits**: Tự động commit sau mỗi task done
30
+ > **Key Changes v3.5:**
31
+ > - **Gate 4 Three-Phase Execution**: Phase A (Infra) Phase B (UI Shell + User Test) → Phase C (Logic + User Test)
32
+ > - **TP1.7: User Test Checkpoint**: Trigger dừng lại cho user test trên device thật
33
+ > - **UI-First Task Ordering**: UI tasks PHẢI đi trước logic tasks trong Symphony
34
+ > - Kế thừa tất cả features v3.4 (Kiro, Completion Status, Design Compliance).
38
35
  > **Principle:** AI tự detect completion — user KHÔNG CẦN nói "xong".
39
36
 
40
37
  ---
@@ -137,7 +134,7 @@ KHÔNG được bắt đầu work cho đến khi TẤT CẢ steps ✅.
137
134
 
138
135
  ---
139
136
 
140
- ## Auto-Lifecycle: task_boundary ↔ Symphony (NEW v3.0)
137
+ ## Auto-Lifecycle: task_boundary ↔ Symphony (v3.5)
141
138
 
142
139
  ```
143
140
  LIÊN KẾT TỰ ĐỘNG:
@@ -145,6 +142,12 @@ LIÊN KẾT TỰ ĐỘNG:
145
142
  - task_boundary(EXECUTION) → symphony_report_progress(40%)
146
143
  - task_boundary(VERIFICATION) → symphony_report_progress(80%)
147
144
  - notify_user(BlockedOnUser=false) → TRIGGER TP2 (completion check)
145
+
146
+ THREE-PHASE MAPPING (Gate 4 — COMPLEX tasks với UI):
147
+ - Phase A done (build OK) → report_progress(25%) + checkpoint build
148
+ - Phase B done (UI mock) → report_progress(45%) + TRIGGER TP1.7 (User Test)
149
+ - Phase C per-feature done → report_progress(50-85%) + TRIGGER TP1.7 (User Test)
150
+ - Phase C all features done → report_progress(90%) → Gate 5
148
151
  ```
149
152
 
150
153
  AI PHẢI giữ `current_task_id` xuyên suốt session.
@@ -152,6 +155,113 @@ Mỗi lần gọi `task_boundary` với mode mới → đồng thời report pro
152
155
 
153
156
  ---
154
157
 
158
+ ## 🚨 Three-Phase Auto-Enforcement Protocol (BẮT BUỘC — v3.5)
159
+
160
+ > **Vấn đề:** AI không tự chủ động dùng Three-Phase nếu không bị ép.
161
+ > **Giải pháp:** Auto-detect + auto-announce + auto-enforce.
162
+
163
+ ### Phase State Tracking
164
+
165
+ AI PHẢI duy trì trạng thái phase hiện tại xuyên suốt Gate 4:
166
+
167
+ ```
168
+ current_phase = "A" | "B" | "C" | "none"
169
+ phase_b_confirmed = false | true
170
+ checkpoint_count = 0
171
+ ```
172
+
173
+ ### Auto-Detection: Khi nào kích hoạt Three-Phase?
174
+
175
+ Tại đầu Gate 4 (EXECUTION bắt đầu), AI PHẢI tự kiểm tra:
176
+
177
+ ```
178
+ 1. Task được triage là COMPLEX?
179
+ 2. Task có UI component? (detect qua):
180
+ → Symphony task title chứa: screen, view, UI, layout, dashboard, form
181
+ → Implementation plan mentions: Composable, Fragment, Activity, Screen, View
182
+ → Design doc tồn tại (docs/design/ hoặc docs/architecture/ có UI sections)
183
+ → Spec references: wireframe, mockup, screenshot
184
+ → Platform: Android/iOS/React Native/Flutter (hầu hết có UI)
185
+
186
+ Nếu CẢ HAI điều kiện thỏa:
187
+ → BẮT BUỘC kích hoạt Three-Phase
188
+ → Hiển thị Phase Announcement Block
189
+ ```
190
+
191
+ ### Phase Announcement Block (BẮT BUỘC)
192
+
193
+ Khi kích hoạt Three-Phase, AI PHẢI hiển thị:
194
+
195
+ ```
196
+ 🎯 THREE-PHASE EXECUTION ACTIVATED
197
+ ══════════════════════════════════════
198
+ 🏗️ Phase A: Infrastructure Setup
199
+ → {list tasks for Phase A}
200
+ 🎨 Phase B: UI Shell (Mock Data)
201
+ → {list tasks for Phase B}
202
+ → 🧪 USER TEST sau phase này
203
+ ⚡ Phase C: Logic Integration
204
+ → {list tasks for Phase C}
205
+ → 🧪 USER TEST mỗi feature
206
+ ══════════════════════════════════════
207
+ Bắt đầu Phase A...
208
+ ```
209
+
210
+ ### Phase Transition Triggers (TỰ ĐỘNG)
211
+
212
+ AI PHẢI tự động phát hiện khi chuyển phase:
213
+
214
+ ```yaml
215
+ auto_triggers:
216
+ phase_a_to_b:
217
+ signal: Tất cả [INFRA] tasks đã done + build OK
218
+ action: |
219
+ - Announce: "🏗️ Phase A ✅ — Build thành công. Chuyển sang Phase B (UI Shell)."
220
+ - Set current_phase = "B"
221
+ - Bắt đầu code UI tasks
222
+
223
+ phase_b_to_checkpoint:
224
+ signal: Tất cả [UI] tasks đã done
225
+ action: |
226
+ - ⛔ DẪNG CODE NGAY LẬP TỨC
227
+ - TRIGGER TP1.7 (User Test Checkpoint)
228
+ - CHỊ user confirm "✅ OK" trước khi làm bất cứ gì khác
229
+ - KHÔNG được tự ý skip bước này
230
+
231
+ checkpoint_to_phase_c:
232
+ signal: User confirmed "✅" hoặc "OK"
233
+ action: |
234
+ - Set phase_b_confirmed = true
235
+ - Set current_phase = "C"
236
+ - Announce: "🎨 Phase B ✅ — UI đã được duyệt. Chuyển sang Phase C (Logic)."
237
+ - Bắt đầu code [LOGIC] tasks
238
+
239
+ phase_c_per_feature:
240
+ signal: 1 feature [LOGIC] đã done + có UI impact
241
+ action: |
242
+ - TRIGGER TP1.7 (mini checkpoint)
243
+ - Batch các features nhỏ lại nếu có thể
244
+ ```
245
+
246
+ ### Enforcement Rules
247
+
248
+ ```
249
+ ❌ VI PHạM NẶNG:
250
+ - Code logic (Phase C) khi phase_b_confirmed = false
251
+ - Skip Phase Announcement Block
252
+ - Code UI và Logic lẫn lộn trong cùng 1 lượt (phải tách rõ phase)
253
+ - Tự giả vờ user confirm để skip checkpoint
254
+ - Không hiển thị Phase Announcement khi Three-Phase activated
255
+
256
+ ✅ BẮT BUỘC:
257
+ - Luôn announce phase transition rõ ràng
258
+ - Luôn tạo hướng dẫn test CỤ THỂ (không chung chung)
259
+ - Luôn dùng notify_user(BlockedOnUser=true) cho checkpoints
260
+ - Ghi lại phase state vào NeuralMemory khi chuyển phase
261
+ ```
262
+
263
+ ---
264
+
155
265
  ## Trigger Points
156
266
 
157
267
  ### TP1: Progress Milestone
@@ -171,13 +281,16 @@ symphony_report_progress(
171
281
  )
172
282
  ```
173
283
 
174
- **Progress Guide:**
284
+ **Progress Guide (Three-Phase Model):**
175
285
  ```
176
286
  10% — Task created, đang research/đọc code
177
- 25% — Implementation plan approved
178
- 40% — Bắt đầu code changes
179
- 60% — Code changes xong, đang test
180
- 80% — Tests pass, đang verification
287
+ 20% — Implementation plan approved
288
+ 25% — Phase A done (build OK, dependencies ready)
289
+ 30% — Phase B bắt đầu (UI shell coding)
290
+ 45% — Phase B done → USER TEST CHECKPOINT #1 (UI review)
291
+ 50% — Phase C bắt đầu (logic integration)
292
+ 50-85% — Phase C per-feature (each feature = +5-10%)
293
+ 85% — Phase C done, đang final verification
181
294
  90% — Walkthrough/docs tạo xong
182
295
  100% — Hoàn thành (auto-trigger TP2)
183
296
  ```
@@ -229,6 +342,80 @@ File patterns:
229
342
 
230
343
  ---
231
344
 
345
+ ### TP1.7: User Test Checkpoint (NEW v3.5 — Gate 4 Three-Phase)
346
+
347
+ **Khi nào:** Trigger ở 2 thời điểm chính trong Gate 4:
348
+
349
+ 1. **Phase B → C Transition (BẮT BUỘC cho COMPLEX):**
350
+ - ALL UI screens đã code xong với mock data
351
+ - Navigation hoạt động full flow
352
+ - App build và chạy OK trên emulator/device
353
+
354
+ 2. **Sau mỗi feature trong Phase C (COMPLEX tasks):**
355
+ - Feature X đã thay mock bằng real data
356
+ - Feature works end-to-end trên device
357
+
358
+ **Điều kiện kích hoạt:**
359
+ ```
360
+ COMPLEX + có UI component → BẮT BUỘC TP1.7
361
+ MODERATE + có UI component → OPTIONAL (recommend cho hardware features: camera, GPS, sensors)
362
+ TRIVIAL → SKIP
363
+ Backend-only tasks → SKIP
364
+ ```
365
+
366
+ **Action:**
367
+ ```
368
+ 1. Report progress trước: symphony_report_progress(current_task, progress)
369
+
370
+ 2. Present User Test Checkpoint:
371
+
372
+ 🧪 USER TEST CHECKPOINT #{N}
373
+ ══════════════════════════════════════
374
+ 📱 Phase: {B|C} — {phase_name}
375
+ 📋 Đã code xong: {summary of completed work}
376
+ 📁 Files changed: {N} files
377
+
378
+ 🔍 Hướng dẫn test:
379
+ 1. {step 1 — cụ thể, actionable}
380
+ 2. {step 2 — expected behavior}
381
+ 3. {step 3 — edge case to check}
382
+
383
+ ⏳ Anh test xong reply:
384
+ ✅ OK — tiếp tục
385
+ ⚠️ Issue: {mô tả} — tôi sẽ fix trước khi đi tiếp
386
+ ══════════════════════════════════════
387
+
388
+ 3. Gọi notify_user(BlockedOnUser=true) — DỪNG và CHỜ user response
389
+
390
+ 4. User response handling:
391
+ → "OK" / "✅" → Tiếp tục phase tiếp / feature tiếp
392
+ → "Issue: ..." → Fix issue → re-run checkpoint
393
+ → "Skip" → Ghi note concern, tiếp tục (DONE_WITH_CONCERNS later)
394
+ ```
395
+
396
+ **Test Guidance Generation:**
397
+ ```
398
+ AI PHẢI tạo hướng dẫn test CỤ THỂ cho từng checkpoint:
399
+
400
+ Phase B Examples (UI):
401
+ - "Mở app → bấm tab Health → xem Dashboard có hiển thị 4 cards không?"
402
+ - "Quay ngang màn hình → layout có bể không?"
403
+ - "Bấm nút Camera → xem preview có xuất hiện không?"
404
+
405
+ Phase C Examples (Logic):
406
+ - "Mở Health Dashboard → data thật có load lên không? (nếu có wifi)"
407
+ - "Chụp ảnh thức ăn → kết quả AI có trả về trong 5s không?"
408
+ - "Bấm Save → quay lại list → record mới có xuất hiện không?"
409
+ ```
410
+
411
+ **Enforcement:**
412
+ - ❌ KHÔNG được chuyển từ Phase B → Phase C mà chưa có user confirm (COMPLEX)
413
+ - ❌ KHÔNG được skip checkpoint cho hardware-related features (Camera, GPS, Sensors)
414
+ - ✅ NÊN batch các features nhỏ lại thành 1 checkpoint (tránh quá nhiều interrupt)
415
+ - ✅ Checkpoint cho logic KHÔNG cần nếu feature là pure-backend/invisible
416
+
417
+ ---
418
+
232
419
  ### TP2: Task Complete — Completion Status Protocol
233
420
 
234
421
  **Khi nào:** AI detect ≥2/4 completion signals:
@@ -470,3 +657,5 @@ Nếu completed:
470
657
  - Spec alignment tránh plan bị lệch khỏi project constraints
471
658
  - Atomic commits giúp rollback chính xác — 1 task = 1 commit (learned from GSD)
472
659
  - KHÔNG auto-push — chỉ commit local, push cần user confirm
660
+ - Three-Phase WORKS vì AI CHỦ ĐỘNG announce — không chờ user gọi (learned from FitWitness v12.3)
661
+ - User test sớm bắt lỗi sớm — code logic trên UI sai = double wasted (learned from FitWitness v12.3)
@@ -30,12 +30,14 @@ priority: 2
30
30
  KHÔNG CÓ NGOẠI LỆ:
31
31
  - 1 Dự án = 1 Trello Card (KHÔNG tạo card mới cho mỗi task).
32
32
  - **Mô tả Card (Description)** BẮT BUỘC phải được update chứa cái nhìn tổng thể về dự án (Mục tiêu, Tech Stack, Tình trạng chung) để Quản lý dễ nắm bắt.
33
- - Tiến độ = Checklist Items trên card dự án. CHỈ ghi lại các task mức High-level / Module / Tính năng lớn.
34
- - KHÔNG BAO GIỜ đồng bộ từng sub-task chi tiết (từ file `.kiro/specs/tasks.md` hay Symphony) thành checklist item trên Trello, làm vậy sẽ gây rác board (spam).
33
+ - **Trello (PM View) vs Kiro (Dev View):** Trello màn hình dành cho Quản (PM, QC), còn `.kiro/specs/tasks.md` nơi để AI/Dev làm việc. Hai khái niệm này hoàn toàn khác nhau.
34
+ - [QUAN TRỌNG] Checklist Items trên Trello = ĐẦU VIỆC NGHIỆP VỤ (Business Features). VD: "Màn hình Đăng Nhập", "Chức năng AI Chat", "Tích hợp Thanh Toán".
35
+ - ⛔ TUYỆT ĐỐI CẤM đưa các GIAI ĐOẠN QUY TRÌNH (Process Gates) vào Checklist Items. KHÔNG CÓ CÁC MỤC NHƯ: "Tài liệu", "Thiết kế Giao diện", "Gate 1", "Phase 2", "App Scaffolding".
36
+ - PM KHÔNG QUAN TÂM ĐẾN QUY TRÌNH GATE CỦA AI. Progress qua các Gate (Gate 1, Gate 2...) CHỈ ĐƯỢC BÁO CÁO qua Comment.
37
+ - KHÔNG BAO GIỜ bứng nguyên các task kỹ thuật chi tiết (VD: "Tạo file `BloodPressureViewModel.kt`") lên Trello. CẤM ĐỒNG BỘ (bulk-sync) raw `tasks.md` sang Trello.
38
+ - BẮT BUỘC ĐỒNG BỘ TOÀN BỘ DANH SÁCH NGHIỆP VỤ TỔNG HỢP (Features): Chờ đến khi Đặc tả kỹ thuật (Specs) đã có rõ các tính năng, AI mới parse ra các Features thành các Checklist Items để Quản lý (PM) có thể thấy trọn vẹn scope.
35
39
  - Card KHÔNG di chuyển giữa lists (list = team member, cố định).
36
- - Comment ở milestone quan trọng PHẢI bao gồm các quyết định kỹ thuật cốt lõi hoặc nguyên nhân gốc rễ, không chỉ ghi "Done" chung chung.
37
- - Comment chỉ ở milestone quan trọng, KHÔNG spam.
38
- - KHÔNG ĐƯỢC sinh script file python/bash (VD: `trello_sync_kiro.py`) để đồng bộ hàng loạt (bulk sync) từ file markdown lên Trello.
40
+ - Comment ở milestone quan trọng PHẢI bao gồm các quyết định cốt lõi hoặc sự thay đổi phase (VD: "Đã hoàn thành Gate 2 Design", "Bắt đầu code Logic").
39
41
  ```
40
42
 
41
43
  ---
@@ -124,21 +126,23 @@ Mỗi Card chứa:
124
126
 
125
127
  ### TP1: 🚀 Start Task / Start Project (Description + Checklist)
126
128
 
127
- **Khi nào:** AI bắt đầu project mới hoặc làm task lớn mới (claim Symphony task).
129
+ **Khi nào:** AI bắt đầu project mới, hoặc chuẩn bị triển khai Specs đã chốt (Gate 3/Gate 4).
130
+ *(Lưu ý: Không tạo Checklist Items các phase "Gate 1", "Gate 2" - lúc này chỉ dùng Comment hoặc Update Description thôi).*
128
131
 
129
132
  **Action:**
130
133
  ```bash
131
134
  # Update Card Description với thông tin cực kỳ rõ ràng cho Quản lý (PM) dự án
132
135
  awkit trello desc "**Trạng thái:** Đang phát triển. **Công nghệ:** Kotlin, Jetpack Compose, Room. **Tiến độ hiện tại:** ... (Tóm tắt sơ lược)"
133
136
 
134
- # 1. Tạo checklist (nếu cần, dụ Sprint)
135
- awkit trello checklist "Sprint 2026-03"
137
+ # 1. Tạo checklist dựa trên Module/Epic Nghiệp vụ thực tế
138
+ awkit trello checklist "Module: Xác thực Người Dùng"
136
139
 
137
- # 2. Thêm item mới vào checklist
138
- awkit trello item "Feature: Login Flow"
140
+ # 2. Thêm item mới vào checklist (Tuyệt đối KHÔNG ĐẶT TÊN theo Gate/Phase/Scaffolding)
141
+ awkit trello item "Đăng nhập bằng Google"
142
+ awkit trello item "Hồ sơ Người Dùng"
139
143
 
140
- # 3. Comment báo bắt đầu
141
- awkit trello comment "🤖 AI bắt đầu: Login Flow | Symphony: #sym-XXX"
144
+ # 3. Comment thông báo cập nhật tiến trình hoặc trạng thái Agent
145
+ awkit trello comment "🤖 AI bắt đầu: Xây dựng giao diện Đăng Nhập | Symphony: #sym-XXX"
142
146
  ```
143
147
 
144
148
  ---
@@ -167,26 +171,35 @@ awkit trello block "API 500 on /auth/login. Cần Backend check."
167
171
 
168
172
  ### TP4: ✅ Task Done (Đánh dấu Item Complete)
169
173
 
170
- **Khi nào:** Task hoàn thành, verification pass.
174
+ **Khi nào:** Toàn bộ cụm Tính năng Nghiệp vụ (Epic/Feature bao gồm nhiều sub-tasks) đã hoàn thành sẵn sàng test.
175
+ *(Lưu ý: Không check item nếu chỉ mới xong 1 task code con lập trình)*
171
176
 
172
177
  ```bash
173
- # 1. Đánh dấu checklist item ✅
174
- awkit trello complete "Feature: Login Flow"
178
+ # 1. Đánh dấu checklist item đại diện cho tính năng
179
+ awkit trello complete "Đăng nhập bằng Google"
175
180
 
176
181
  # 2. Comment kết quả
177
- awkit trello comment "✅ DONE: Login Flow | Commit: #$(git rev-parse --short HEAD)"
182
+ awkit trello comment "✅ DONE Feature: Đăng nhập bằng Google | Commit: #$(git rev-parse --short HEAD)"
178
183
  ```
179
184
 
180
185
  ---
181
186
 
182
- ## 🔗 Symphony Integration
187
+ ## 🔗 Symphony Integration (NGUYÊN TẮC: Nhiều Task Code -> 1 Trello Feature)
188
+
189
+ ⚠️ **CHÚ Ý CỰC KỲ QUAN TRỌNG:** KHÔNG MAP 1:1 TỪ SYMPHONY SANG TRELLO CHECKLIST!
190
+ Trong Symphony có thể có 50 task nhỏ (VD: Tạo View, Viết API, Sửa CSS). Trello chỉ có 5 Checklist Items lớn (VD: Chức năng Đăng nhập, Profile, Thanh toán).
191
+ Do đó: **CẤM** gọi `awkit trello item` mỗi khi claim 1 task con từ Symphony. Nếu làm vậy Trello sẽ biến thành bãi rác toàn các task code lặt vặt.
192
+
193
+ **Cách Sync Đúng:**
194
+ - Thiết lập Checklist Items ngay từ đầu dựa trên Spec tổng.
195
+ - Khi code từng phân hệ con, ĐỪNG sinh ra checklist mới.
183
196
 
184
197
  | Symphony Event | Trello Action |
185
198
  |----------------|---------------|
186
- | `symphony_claim_task` | Thêm checklist item (incomplete) + Comment start |
199
+ | `symphony_claim_task` | **CHỈ** Comment báo tiến độ: "Đang xử lý code: [Task]..." |
187
200
  | `symphony_report_progress` | Comment milestone |
188
201
  | Task BLOCKED | Label "Blocked" + Comment |
189
- | `symphony_complete_task` | Mark item complete + Comment result |
202
+ | `symphony_complete_task` | **CHỈ** Comment: "Xong code task [Task]." *(Tùy chọn: nếu feature lớn xong 100%, mới call `complete` cho item chính)* |
190
203
 
191
204
  Trong comment, **PHẢI** ghi Symphony Task ID: `Symphony: #sym-XXX`
192
205
 
@@ -194,9 +207,11 @@ Trong comment, **PHẢI** ghi Symphony Task ID: `Symphony: #sym-XXX`
194
207
 
195
208
  ## 🎯 Best Practices
196
209
 
197
- 1. **Checklist naming**: Theo phase/module lớn (VD: "Module: fw-01-foundation", "Sprint 2026-03").
198
- 2. **Item naming**: tả tính năng lớn (VD: "Login Flow", "Firebase Integration"). KHÔNG ĐƯA CÁC ĐẦU MỤC CODE LEVEL VÀO ĐÂY (VD: "Thêm nút bấm", "Sửa CSS", v.v.).
199
- 3. **Minimizing noise**: Comment chỉ milestones, KHÔNG spam mỗi dòng code. Cấm bulk-sync checklist item từ `tasks.md`.
210
+ 1. **Checklist naming (Module/Epic)**: Tên checklist thể hiện mảng Tính năng/Module lớn (VD: "Module: Authentication", "Sprint: Workout Tính năng cốt lõi").
211
+ KHÔNG ĐẶT theo quy trình AI như "Gate 1", "Phase: Setup", "Giai đoạn Design".
212
+ 2. **Item naming (Product Features)**: Tên item tính năng/màn hình cụ thể (VD: "Google Sign-In", "Màn hình Thông kê Calorie", "Chức năng AI tư vấn thực đơn").
213
+ ⛔ KHÔNG ĐẶT kiểu "Tài liệu Specs", "Code Scaffolding", "Sửa CSS" hay "Tạo file ABC".
214
+ 3. **Minimizing noise**: Cập nhật milestone (chuyển gate, chuyển phase) qua **Comment** trên Card, KHÔNG GHI THÀNH **Checklist item** (vốn dĩ checklist item là thứ bàn giao được cho user). Cấm bulk-sync từ `tasks.md`.
200
215
  4. **Graceful degradation**: CLI/API lỗi → log warning, KHÔNG block code flow.
201
216
  5. **Dùng lệnh Native**: Luôn luôn gọi `awkit trello <lệnh>` thay vì `trello-cli` thủ công.
202
217
  6. **Card KHÔNG di chuyển**: Card nằm cố định trong list team member. KHÔNG move card.