@leejungkiin/awkit 1.3.4 → 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.
@@ -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.