@leejungkiin/awkit 1.7.1 → 1.7.5

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.
Files changed (262) hide show
  1. package/README.md +42 -5
  2. package/bin/awk.js +1148 -92
  3. package/core/CLAUDE.md +1 -1
  4. package/core/GEMINI.md +152 -167
  5. package/core/GEMINI.md.bak +153 -116
  6. package/core/GreetingEngine/index.js +225 -0
  7. package/core/GreetingEngine/locales/en.json +6 -0
  8. package/core/GreetingEngine/locales/ja.json +6 -0
  9. package/core/GreetingEngine/locales/vi.json +6 -0
  10. package/core/GreetingEngine/test.js +37 -0
  11. package/core/skill-runtime-manifest.json +3 -0
  12. package/docs/Claude Fable 5.md +3826 -0
  13. package/docs/PRD.md +57 -0
  14. package/docs/android_kotlin_system_instruction.md +210 -0
  15. package/docs/brainstorm_multi_agent_cli.md +211 -0
  16. package/docs/brainstorm_ponytail_integration.md +146 -0
  17. package/docs/brainstorm_smart_setup.md +113 -0
  18. package/docs/deep-research-report (1).md +293 -0
  19. package/docs/history/GEMINI.v1.md +135 -0
  20. package/docs/history/PRD.v1.md +55 -0
  21. package/docs/history/PRD.v2.md +57 -0
  22. package/docs/history/brainstorm_antigravity_unified_architecture.v1.md +105 -0
  23. package/docs/history/implementation_plan.v1.md +58 -0
  24. package/docs/history/memoizedfibonacci_spec.v1.md +127 -0
  25. package/docs/specs/greetingapp_spec.md +97 -0
  26. package/docs/specs/memoizedfibonacci_spec.md +211 -0
  27. package/package.json +4 -1
  28. package/scripts/artifact-storage.js +130 -0
  29. package/scripts/automation-gate.js +35 -2
  30. package/scripts/claude-plan.js +76 -0
  31. package/scripts/dependency-manager.js +210 -0
  32. package/scripts/exec-rtk.js +11 -5
  33. package/scripts/i18n-helper.js +381 -0
  34. package/scripts/multi-model-pipeline.js +386 -0
  35. package/scripts/qwen-exec.js +147 -0
  36. package/skill-packs/mobile-ios/pack.json +4 -2
  37. package/skill-packs/reverse-engineering/pack.json +1 -0
  38. package/skills/CATALOG.md +20 -0
  39. package/skills/GEMINI.md +9 -1
  40. package/skills/TRIGGER_INDEX.md +10 -0
  41. package/skills/ai-music/SKILL.md +275 -0
  42. package/skills/android-re-analyzer/SKILL.md +238 -0
  43. package/skills/android-re-analyzer/references/api-extraction-patterns.md +119 -0
  44. package/skills/android-re-analyzer/references/call-flow-analysis.md +176 -0
  45. package/skills/android-re-analyzer/references/fernflower-usage.md +115 -0
  46. package/skills/android-re-analyzer/references/jadx-usage.md +116 -0
  47. package/skills/android-re-analyzer/references/setup-guide.md +221 -0
  48. package/skills/android-re-analyzer/scripts/check-deps.sh +129 -0
  49. package/skills/android-re-analyzer/scripts/decompile.sh +375 -0
  50. package/skills/android-re-analyzer/scripts/find-api-calls.sh +118 -0
  51. package/skills/android-re-analyzer/scripts/install-dep.sh +448 -0
  52. package/skills/animal-island-ui-style/SKILL.md +1450 -0
  53. package/skills/app-store-review-agent/SKILL.md +164 -0
  54. package/skills/app-store-review-agent/references/guidelines/README.md +154 -0
  55. package/skills/app-store-review-agent/references/guidelines/by-app-type/ai_apps.md +37 -0
  56. package/skills/app-store-review-agent/references/guidelines/by-app-type/all_apps.md +50 -0
  57. package/skills/app-store-review-agent/references/guidelines/by-app-type/crypto_finance.md +31 -0
  58. package/skills/app-store-review-agent/references/guidelines/by-app-type/games.md +31 -0
  59. package/skills/app-store-review-agent/references/guidelines/by-app-type/health_fitness.md +31 -0
  60. package/skills/app-store-review-agent/references/guidelines/by-app-type/kids.md +27 -0
  61. package/skills/app-store-review-agent/references/guidelines/by-app-type/macos.md +38 -0
  62. package/skills/app-store-review-agent/references/guidelines/by-app-type/social_ugc.md +32 -0
  63. package/skills/app-store-review-agent/references/guidelines/by-app-type/subscription_iap.md +34 -0
  64. package/skills/app-store-review-agent/references/guidelines/by-app-type/vpn.md +18 -0
  65. package/skills/app-store-review-agent/references/rules/design/minimum_functionality.md +96 -0
  66. package/skills/app-store-review-agent/references/rules/design/sign_in_with_apple.md +54 -0
  67. package/skills/app-store-review-agent/references/rules/entitlements/unused_entitlements.md +83 -0
  68. package/skills/app-store-review-agent/references/rules/metadata/accurate_metadata.md +54 -0
  69. package/skills/app-store-review-agent/references/rules/metadata/apple_trademark.md +99 -0
  70. package/skills/app-store-review-agent/references/rules/metadata/china_storefront.md +72 -0
  71. package/skills/app-store-review-agent/references/rules/metadata/competitor_terms.md +56 -0
  72. package/skills/app-store-review-agent/references/rules/metadata/subscription_metadata.md +81 -0
  73. package/skills/app-store-review-agent/references/rules/privacy/privacy_manifest.md +84 -0
  74. package/skills/app-store-review-agent/references/rules/privacy/unnecessary_data.md +60 -0
  75. package/skills/app-store-review-agent/references/rules/subscription/misleading_pricing.md +63 -0
  76. package/skills/app-store-review-agent/references/rules/subscription/missing_tos_pp.md +54 -0
  77. package/skills/awf-ponytail/SKILL.md +91 -0
  78. package/skills/awf-ponytail-review/SKILL.md +67 -0
  79. package/skills/awf-session-restore/SKILL.md +3 -3
  80. package/skills/brainstorm-agent/SKILL.md +11 -2
  81. package/skills/brainstorm-agent/templates/brief-template.md +8 -0
  82. package/skills/claude-planner/SKILL.md +71 -0
  83. package/skills/code-review/SKILL.md +87 -0
  84. package/skills/codex-conductor/SKILL.md +25 -1
  85. package/skills/expo-game-development/SKILL.md +163 -0
  86. package/skills/flutter/LICENSE.txt +202 -0
  87. package/skills/flutter/SKILL.md +127 -0
  88. package/skills/flutter-project-creater/LICENSE.txt +202 -0
  89. package/skills/flutter-project-creater/SKILL.md +106 -0
  90. package/skills/game-developer/SKILL.md +163 -0
  91. package/skills/game-developer/references/ecs-patterns.md +501 -0
  92. package/skills/game-developer/references/multiplayer-networking.md +475 -0
  93. package/skills/game-developer/references/performance-optimization.md +422 -0
  94. package/skills/game-developer/references/unity-patterns.md +271 -0
  95. package/skills/game-developer/references/unreal-cpp.md +352 -0
  96. package/skills/generate-gui-assets/SKILL.md +305 -0
  97. package/skills/generate-gui-assets/agents/openai.yaml +4 -0
  98. package/skills/generate-gui-assets/references/catalog-schema.md +58 -0
  99. package/skills/generate-gui-assets/references/extraction-techniques.md +21 -0
  100. package/skills/generate-gui-assets/references/prompt-patterns.md +58 -0
  101. package/skills/generate-gui-assets/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  102. package/skills/generate-gui-assets/scripts/build_gui_contact_sheet.py +51 -0
  103. package/skills/generate-gui-assets/scripts/clean_chroma_edges.py +262 -0
  104. package/skills/generate-gui-assets/scripts/copy_approved_icons.py +64 -0
  105. package/skills/generate-gui-assets/scripts/prepare_gui_asset_run.py +91 -0
  106. package/skills/generate-gui-assets/scripts/suggest_grid_options.py +63 -0
  107. package/skills/generate-gui-assets/scripts/validate_gui_catalog.py +50 -0
  108. package/skills/godot-game-development/SKILL.md +142 -0
  109. package/skills/hatch-pet/LICENSE.txt +201 -0
  110. package/skills/hatch-pet/SKILL.md +420 -0
  111. package/skills/hatch-pet/agents/openai.yaml +4 -0
  112. package/skills/hatch-pet/references/animation-rows.md +29 -0
  113. package/skills/hatch-pet/references/codex-pet-contract.md +35 -0
  114. package/skills/hatch-pet/references/qa-rubric.md +60 -0
  115. package/skills/hatch-pet/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  116. package/skills/hatch-pet/scripts/clean_chroma_edges.py +262 -0
  117. package/skills/hatch-pet/scripts/compose_atlas.py +150 -0
  118. package/skills/hatch-pet/scripts/derive_running_left_from_running_right.py +143 -0
  119. package/skills/hatch-pet/scripts/extract_strip_frames.py +323 -0
  120. package/skills/hatch-pet/scripts/finalize_pet_run.py +382 -0
  121. package/skills/hatch-pet/scripts/generate_pet_images.py +287 -0
  122. package/skills/hatch-pet/scripts/inspect_frames.py +246 -0
  123. package/skills/hatch-pet/scripts/make_contact_sheet.py +96 -0
  124. package/skills/hatch-pet/scripts/package_custom_pet.py +108 -0
  125. package/skills/hatch-pet/scripts/pet_job_status.py +117 -0
  126. package/skills/hatch-pet/scripts/prepare_pet_run.py +673 -0
  127. package/skills/hatch-pet/scripts/queue_pet_repairs.py +172 -0
  128. package/skills/hatch-pet/scripts/record_imagegen_result.py +250 -0
  129. package/skills/hatch-pet/scripts/render_animation_videos.py +134 -0
  130. package/skills/hatch-pet/scripts/render_animation_videos.sh +5 -0
  131. package/skills/hatch-pet/scripts/validate_atlas.py +139 -0
  132. package/skills/i18n-orchestrator/SKILL.md +37 -0
  133. package/skills/ios-simulator-skill/SKILL.md +390 -0
  134. package/skills/ios-simulator-skill/scripts/accessibility_audit.py +300 -0
  135. package/skills/ios-simulator-skill/scripts/app_launcher.py +326 -0
  136. package/skills/ios-simulator-skill/scripts/app_state_capture.py +400 -0
  137. package/skills/ios-simulator-skill/scripts/appearance.py +385 -0
  138. package/skills/ios-simulator-skill/scripts/build_and_test.py +348 -0
  139. package/skills/ios-simulator-skill/scripts/clipboard.py +103 -0
  140. package/skills/ios-simulator-skill/scripts/common/__init__.py +61 -0
  141. package/skills/ios-simulator-skill/scripts/common/cache_utils.py +289 -0
  142. package/skills/ios-simulator-skill/scripts/common/device_utils.py +462 -0
  143. package/skills/ios-simulator-skill/scripts/common/env_config.py +35 -0
  144. package/skills/ios-simulator-skill/scripts/common/hang_pipeline.py +862 -0
  145. package/skills/ios-simulator-skill/scripts/common/hang_sessions.py +490 -0
  146. package/skills/ios-simulator-skill/scripts/common/idb_utils.py +180 -0
  147. package/skills/ios-simulator-skill/scripts/common/screenshot_utils.py +338 -0
  148. package/skills/ios-simulator-skill/scripts/container.py +668 -0
  149. package/skills/ios-simulator-skill/scripts/gesture.py +394 -0
  150. package/skills/ios-simulator-skill/scripts/hang_watcher.py +1533 -0
  151. package/skills/ios-simulator-skill/scripts/keyboard.py +391 -0
  152. package/skills/ios-simulator-skill/scripts/localization_audit.py +483 -0
  153. package/skills/ios-simulator-skill/scripts/location.py +467 -0
  154. package/skills/ios-simulator-skill/scripts/log_monitor.py +493 -0
  155. package/skills/ios-simulator-skill/scripts/model_inspector.py +645 -0
  156. package/skills/ios-simulator-skill/scripts/navigator.py +461 -0
  157. package/skills/ios-simulator-skill/scripts/privacy_manager.py +310 -0
  158. package/skills/ios-simulator-skill/scripts/push_notification.py +240 -0
  159. package/skills/ios-simulator-skill/scripts/screen_mapper.py +296 -0
  160. package/skills/ios-simulator-skill/scripts/sim_health_check.sh +245 -0
  161. package/skills/ios-simulator-skill/scripts/sim_list.py +299 -0
  162. package/skills/ios-simulator-skill/scripts/simctl_boot.py +312 -0
  163. package/skills/ios-simulator-skill/scripts/simctl_create.py +316 -0
  164. package/skills/ios-simulator-skill/scripts/simctl_delete.py +357 -0
  165. package/skills/ios-simulator-skill/scripts/simctl_erase.py +351 -0
  166. package/skills/ios-simulator-skill/scripts/simctl_shutdown.py +290 -0
  167. package/skills/ios-simulator-skill/scripts/simulator_selector.py +375 -0
  168. package/skills/ios-simulator-skill/scripts/status_bar.py +250 -0
  169. package/skills/ios-simulator-skill/scripts/test_recorder.py +323 -0
  170. package/skills/ios-simulator-skill/scripts/visual_diff.py +235 -0
  171. package/skills/ios-simulator-skill/scripts/xcode/__init__.py +13 -0
  172. package/skills/ios-simulator-skill/scripts/xcode/builder.py +397 -0
  173. package/skills/ios-simulator-skill/scripts/xcode/cache.py +204 -0
  174. package/skills/ios-simulator-skill/scripts/xcode/config.py +178 -0
  175. package/skills/ios-simulator-skill/scripts/xcode/reporter.py +343 -0
  176. package/skills/ios-simulator-skill/scripts/xcode/xcresult.py +451 -0
  177. package/skills/ios-visual-qa-strategist/SKILL.md +111 -0
  178. package/skills/ios-visual-qa-strategist/agents/openai.yaml +4 -0
  179. package/skills/ios-visual-qa-strategist/references/ios-tool-selection.md +61 -0
  180. package/skills/ios-visual-qa-strategist/references/minimal-capture-policy.md +56 -0
  181. package/skills/ios-visual-qa-strategist/references/visual-reasoning-heuristics.md +53 -0
  182. package/skills/orchestrator/SKILL.md +0 -20
  183. package/skills/persistent-storage/SKILL.md +55 -0
  184. package/skills/qwen-conductor/SKILL.md +100 -0
  185. package/skills/short-maker/SKILL.md +23 -0
  186. package/skills/short-maker/scripts/effects.js +56 -0
  187. package/skills/short-maker/scripts/shortmaker-bridge.js +332 -0
  188. package/skills/short-maker/scripts/videomix.js +601 -0
  189. package/skills/short-maker/templates/hyperframes/cinematic-character.template.html +172 -0
  190. package/skills/short-maker/templates/hyperframes/index.template.html +194 -0
  191. package/skills/smali-to-kotlin/SKILL.md +128 -0
  192. package/skills/smali-to-kotlin/examples/getting-started/tech-stack.md +58 -0
  193. package/skills/smali-to-kotlin/examples/pipeline/data-ui-parity.md +118 -0
  194. package/skills/smali-to-kotlin/examples/pipeline/scanner-and-bootstrap.md +106 -0
  195. package/skills/smali-to-kotlin/library-patterns.md +189 -0
  196. package/skills/smali-to-kotlin/phase-0-discovery.md +128 -0
  197. package/skills/smali-to-kotlin/phase-1-architecture.md +166 -0
  198. package/skills/smali-to-kotlin/phase-2-blueprint-ui.md +347 -0
  199. package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
  200. package/skills/smali-to-kotlin/phase-3-build.md +248 -0
  201. package/skills/smali-to-kotlin/phase-3-logic-build.md +268 -0
  202. package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
  203. package/skills/smali-to-kotlin/templates/app-map.md +101 -0
  204. package/skills/smali-to-kotlin/templates/architecture.md +142 -0
  205. package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
  206. package/skills/spec-gate/SKILL.md +6 -2
  207. package/skills/symphony-enforcer/SKILL.md +8 -0
  208. package/skills/symphony-enforcer/examples/mindful-stop.md +2 -0
  209. package/skills/symphony-enforcer/examples/three-phase.md +16 -0
  210. package/skills/symphony-enforcer/examples/trigger-points.md +7 -1
  211. package/skills/unity-game-development/SKILL.md +231 -0
  212. package/skills/video-edit/SKILL.md +36 -0
  213. package/skills/video-edit/scripts/video_edit.py +324 -0
  214. package/templates/project-identity/android.json +2 -2
  215. package/templates/project-identity/backend-nestjs.json +2 -2
  216. package/templates/project-identity/expo.json +2 -2
  217. package/templates/project-identity/ios.json +2 -2
  218. package/templates/project-identity/web-nextjs.json +2 -2
  219. package/templates/setup-mapping.json +48 -0
  220. package/templates/specs/design-template.md +161 -71
  221. package/templates/specs/requirements-template.md +65 -133
  222. package/templates/specs/task-spec-template.xml +3 -0
  223. package/workflows/_uncategorized/critic.md +40 -0
  224. package/workflows/_uncategorized/git-rebase-flow.md +81 -0
  225. package/workflows/_uncategorized/image-gen.md +118 -0
  226. package/workflows/_uncategorized/multi-model-pipeline.md +60 -0
  227. package/workflows/_uncategorized/pixel-gen.md +86 -0
  228. package/workflows/_uncategorized/pixel-setup.md +90 -0
  229. package/workflows/_uncategorized/ponytail-review.md +59 -0
  230. package/workflows/_uncategorized/reverse-android-build.md +222 -0
  231. package/workflows/_uncategorized/reverse-android-design.md +139 -0
  232. package/workflows/_uncategorized/reverse-android-discover.md +150 -0
  233. package/workflows/_uncategorized/reverse-android-scan.md +158 -0
  234. package/workflows/_uncategorized/reverse-android.md +143 -0
  235. package/workflows/_uncategorized/reverse-ios-build.md +240 -0
  236. package/workflows/_uncategorized/reverse-ios-design.md +112 -0
  237. package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
  238. package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
  239. package/workflows/_uncategorized/reverse-ios.md +152 -0
  240. package/workflows/_uncategorized/safety-router.md +34 -0
  241. package/workflows/_uncategorized/teach.md +89 -0
  242. package/workflows/_uncategorized/verify-ui.md +53 -0
  243. package/workflows/_uncategorized/visualize-screenshots.md +34 -0
  244. package/workflows/ads/ads-analyst.md +201 -0
  245. package/workflows/ads/ads-audit.md +106 -0
  246. package/workflows/ads/ads-optimize.md +97 -0
  247. package/workflows/ads/ads-targeting.md +241 -0
  248. package/workflows/ads/adsExpert.md +160 -0
  249. package/workflows/ads/smali-ads-config.md +400 -0
  250. package/workflows/ads/smali-ads-flow.md +331 -0
  251. package/workflows/ads/smali-ads-interstitial.md +377 -0
  252. package/workflows/ads/smali-ads-native.md +382 -0
  253. package/workflows/context/teach.md +89 -0
  254. package/workflows/gitnexus.md +8 -8
  255. package/workflows/lifecycle/brainstorm.md +43 -0
  256. package/workflows/lifecycle/code.md +5 -0
  257. package/workflows/lifecycle/init.md +23 -5
  258. package/workflows/lifecycle/multi-model-pipeline.md +60 -0
  259. package/workflows/multi-agent-pipeline.md +52 -0
  260. package/workflows/quality/ponytail-review.md +59 -0
  261. package/workflows/roles/critic.md +40 -0
  262. package/workflows/roles/safety-router.md +34 -0
package/docs/PRD.md ADDED
@@ -0,0 +1,57 @@
1
+ # Product Requirement Document (PRD) - GreetingApp
2
+
3
+ ## Revision History
4
+ | Version | Date | Description | Author |
5
+ |---|---|---|---|
6
+ | v1.0 | 2026-06-22 | Initial PRD for GreetingApp | Antigravity Orchestrator |
7
+
8
+ ---
9
+
10
+ ## 1. Executive Summary
11
+ GreetingApp is a micro-application designed to deliver personalized, localized, and dynamic greetings to users. It adapts to the user's name, current time of day, and language preferences.
12
+
13
+ ## 2. Objectives & Goals
14
+ - Provide dynamic greetings based on user local time (Morning, Afternoon, Evening, Night).
15
+ - Support multi-language greetings (English, Vietnamese, Japanese).
16
+ - Track user greeting history and statistics.
17
+ - Expose both CLI and REST API interfaces.
18
+
19
+ ## 3. User Personas & Use Cases
20
+ - **End User:** Wants to see a welcoming, contextual message when logging in or using the CLI.
21
+ - **Developer:** Wants an easy-to-integrate greeting microservice API for downstream services.
22
+
23
+ ## 4. Functional Requirements
24
+ 1. **Dynamic Greeting Generation:**
25
+ - Detects local time of user.
26
+ - Personalizes with name (fallback to "Guest").
27
+ 2. **Localization (i18n):**
28
+ - Supports: English (`en`), Vietnamese (`vi`), Japanese (`ja`).
29
+ 3. **Greeting Analytics / History:**
30
+ - Stores logs of generated greetings (User, Timestamp, Language).
31
+ - Exposes statistics (e.g., total greetings generated, most active user).
32
+ 4. **Interfaces:**
33
+ - Command Line Interface (CLI): `awkit greet --name=Alice`
34
+ - REST API endpoint: `GET /api/greet?name=Alice&lang=vi`
35
+
36
+ ## 5. Non-Functional Requirements
37
+ - **Performance:** Response time for greeting generation under 50ms.
38
+ - **Reliability:** Storage fallback to memory if database/file storage is offline.
39
+ - **Extensibility:** Easy configuration to add new languages.
40
+
41
+ ## 6. System Flow & Sequence Diagram
42
+ ```mermaid
43
+ sequenceDiagram
44
+ autonumber
45
+ actor User
46
+ participant Client as CLI / API Client
47
+ participant Engine as Greeting Engine
48
+ participant DB as Storage / History DB
49
+
50
+ User->>Client: Triggers greeting command/request (name, lang)
51
+ Client->>Engine: Resolve greeting configuration
52
+ Engine->>Engine: Validate input & detect Time of Day
53
+ Engine->>DB: Log transaction (user, time, format)
54
+ DB-->>Engine: Log confirmation
55
+ Engine->>Client: Return formatted greeting string
56
+ Client->>User: Display greeting output
57
+ ```
@@ -0,0 +1,210 @@
1
+ # System Instruction for Premium Android Kotlin App Development
2
+
3
+ You are the **Ultimate Senior Android Developer, Mobile Architect, and Motion UI/UX Specialist**. Your mission is to design, scaffold, and implement industry-leading, premium-tier, production-ready Android applications from scratch. You write clean, scalable Kotlin, build fluid motion designs in Jetpack Compose, enforce strict Clean Architecture boundaries, and deploy using high-performance engineering standards.
4
+
5
+ ---
6
+
7
+ ## 1. Architectural & Engineering Standards (Clean Architecture)
8
+
9
+ ### 1.1 Folder & Package Structure
10
+
11
+ Organize the codebase following feature-based modularization, isolating features into self-contained architectural directories:
12
+
13
+ ```
14
+ app/src/main/java/com/company/myapp/
15
+ ├── core/ # Shared utilities, DI modules, theme, navigators
16
+ │ ├── di/ # Global AppModule, NetworkModule, DatabaseModule
17
+ │ ├── theme/ # Color, Type, Shape, Theme definitions
18
+ │ └── utils/ # Extensions, formatters, cryptography helpers
19
+ └── features/ # Feature-specific modules
20
+ └── [feature_name]/ # e.g., authentication, dashboard, onboarding
21
+ ├── domain/ # Pure Business Logic (No android framework imports)
22
+ │ ├── entities/ # Business domain models (standard Kotlin classes)
23
+ │ ├── usecases/ # Single-responsibility use cases
24
+ │ └── repositories/ # Repository interfaces (abstractions)
25
+ ├── data/ # Platform & External Systems
26
+ │ ├── datasources/ # Local (Room/DataStore) & Remote (Retrofit/Ktor) sources
27
+ │ ├── dto/ # API and DB data transfer objects (with @Serializable)
28
+ │ └── repositories/ # Concrete repository implementations (extends domain)
29
+ └── presentation/ # Jetpack Compose UI Layer
30
+ ├── ui/ # Stateless screens, composables, views, styling
31
+ └── viewmodels/ # Flow state holders, screen action handlers
32
+ ```
33
+
34
+ ### 1.2 Strict Layer Boundaries & Dependency Rules
35
+
36
+ Enforce the inward dependency rule (**Presentation → Domain ← Data**):
37
+
38
+ - **Domain Layer**: MUST be pure Kotlin. Never import `android.*`, `androidx.*`, `retrofit.*`, or other framework libraries. It defines the business entities and repository abstractions.
39
+ - **Presentation Layer**: Consists of composables and ViewModels. ViewModels use Domain UseCases to fetch and transform data.
40
+ - **Data Layer**: Responsible for persistence (Room), caching (DataStore), and network communications (Retrofit). Implements repository interfaces defined in the Domain layer.
41
+
42
+ ### 1.3 Dependency Injection (Dagger Hilt)
43
+
44
+ - Always use Dagger Hilt for DI: annotate your Application class with `@HiltAndroidApp`, activities with `@AndroidEntryPoint`, and ViewModels with `@HiltViewModel`.
45
+ - Use `@Inject constructor` for class dependencies.
46
+ - Define interface bindings cleanly in Hilt `@Module` classes using `@Binds` (for repository implementations) and `@Provides` (for external clients like Retrofit, Room, or DataStore instances).
47
+
48
+ ---
49
+
50
+ ## 2. UI-First Methodology & Premium Motion UX
51
+
52
+ Aesthetics and responsiveness are core features. The user must feel the fluidity of the interface through premium, elastic movements and elegant spacing.
53
+
54
+ ### 2.1 The UI-First Implementation Pipeline
55
+
56
+ Always prototype the visual design and settle the visual shell before wiring up reactive database endpoints:
57
+
58
+ 1. **Draft UI Skeleton**: Set up the visual container blocks.
59
+ 2. **Add Static Mock Data**: Render standard visual states (empty, loading, normal, error).
60
+ 3. **Implement Micro-interactions & Motion**: Add smooth spring transitions, hover states, and keyframe animations.
61
+ 4. **Connect Presentation State**: Wire the stateless UI components to real Hilt-injected ViewModels.
62
+ 5. **Final Parity Audit**: Verify screen performance on virtual emulators or physical testing targets.
63
+
64
+ ### 2.2 Elastic & Spring Physics Animations
65
+
66
+ Any dynamic presentation, button click, or page transition must utilize **spring-based physics** by default to create a premium, tactile feel.
67
+
68
+ - **Spring Press Effect on Buttons**:
69
+ ```kotlin
70
+ @Composable
71
+ fun PrimaryButton(
72
+ text: String,
73
+ onClick: () -> Unit,
74
+ modifier: Modifier = Modifier
75
+ ) {
76
+ var isPressed by remember { mutableStateOf(false) }
77
+ val scale by animateFloatAsState(
78
+ targetValue = if (isPressed) 0.95f else 1f,
79
+ animationSpec = spring(
80
+ dampingRatio = Spring.DampingRatioMediumBouncy,
81
+ stiffness = Spring.StiffnessLow
82
+ )
83
+ )
84
+
85
+ Button(
86
+ onClick = onClick,
87
+ modifier = modifier
88
+ .fillMaxWidth()
89
+ .scale(scale)
90
+ .pointerInput(Unit) {
91
+ detectTapGestures(
92
+ onPress = {
93
+ isPressed = true
94
+ tryAwaitRelease()
95
+ isPressed = false
96
+ }
97
+ )
98
+ }
99
+ ) {
100
+ Text(text, style = MaterialTheme.typography.bodyLarge)
101
+ }
102
+ }
103
+ ```
104
+
105
+ ### 2.3 Curated Color Systems & Typography Tokens
106
+
107
+ - **No Raw Primary Colors**: Utilize highly cohesive, harmonized HSL/Material 3 theme palettes. Enforce curated dark themes, neon borders, and soft semantic alerts.
108
+ - **Typography**: Dynamically fetch professional modern fonts (e.g., _Inter_, _Outfit_, _Roboto_) with a strong, highly readable visual hierarchy. Support Dynamic Type to scale text gracefully based on accessibility settings.
109
+ - **Glassmorphism**: Use semi-transparent container fills with fine, light borders, subtle background blurs, and soft shadows (`Modifier.shadow()`) to deliver modern UI depth.
110
+
111
+ ### 2.4 Touch Psychology
112
+
113
+ - **Tap Targets**: Maintain all interactive targets at a minimum of **48dp × 48dp** (based on Fitts' Law for human fingertips).
114
+ - **Spacing**: Ensure a minimum gap of **8-12dp** between adjacent interactive elements to prevent accidental miss-taps.
115
+ - **Thumb Zone Optimization**: Place core navigation controls, primary CTAs, and dynamic tab bars at the bottom half of the screen (the "easy-to-reach" zone).
116
+
117
+ ---
118
+
119
+ ## 3. High-Performance Engineering & Data Security
120
+
121
+ ### 3.1 Jetpack Compose List Optimizations
122
+
123
+ Improperly written lists cause jank and frame drops. Always adhere to these performance rules:
124
+
125
+ - **Always use Lazy Lists**: Use `LazyColumn` or `LazyRow` instead of `ScrollView` for lists with dynamic content.
126
+ - **Explicit State Keying**: Always provide a unique, stable ID for every list item using the `key` parameter to prevent redundant compose recompositions:
127
+ ```kotlin
128
+ LazyColumn {
129
+ items(
130
+ items = itemList,
131
+ key = { item -> item.stableId }
132
+ ) { item ->
133
+ ListItemComponent(item = item)
134
+ }
135
+ }
136
+ ```
137
+ - **Stateless Preview Delegates**: Break screens into a parent stateful wrapper (injecting ViewModel and handling navigation) and a child stateless screen composable containing only hardcoded parameters. This enables rapid Material Preview compilation for multiple states (Normal, Loading, Empty, Error).
138
+
139
+ ### 3.2 Secure Persistence & Tokens
140
+
141
+ - **Zero PII Leakage**: Never print user tokens, passwords, database values, or personal identifiers in production log outputs.
142
+ - **Encrypted Storage**: Cache API tokens, user authorization flags, and sensitive user states exclusively in `EncryptedSharedPreferences` or encrypted local databases (e.g., SQLCipher on top of Room).
143
+ - **Environment Configs**: Configure API endpoints, API keys, and deployment profiles in a secure `.env` or system environment mapping, injecting them through gradle custom `BuildConfig` fields.
144
+
145
+ ### 3.3 Asynchronous Threading & Flows
146
+
147
+ - **Explicit Dispatchers**: Ensure heavy calculations and local/remote source operations are launched on the correct dispatchers:
148
+ ```kotlin
149
+ viewModelScope.launch(Dispatchers.IO) {
150
+ repository.fetchData()
151
+ }
152
+ ```
153
+ - **Lifecycle-aware Flows**: Collect flows in Composable scopes safely using `collectAsStateWithLifecycle()` to prevent memory leaks and background battery drainage.
154
+
155
+ ---
156
+
157
+ ## 4. AWKit Android CLI & ADB Commands
158
+
159
+ Utilize the unified `android` CLI tool and ADB commands to execute system interactions, layout inspection, and test setups cleanly:
160
+
161
+ ```bash
162
+ # 1. Environment & Device Scaffolding
163
+ android info # Retrieve current Android SDK locations and configuration
164
+ android sdk install platforms/android-34 # Download a specific platform SDK target
165
+ android emulator start --name="Pixel_7_API_34" # Launch a selected Android Virtual Device (AVD)
166
+
167
+ # 2. Build & Layout Audits
168
+ android describe --project_dir=. # Scan targets and locate built APK paths
169
+ android layout --pretty # Dump the raw UI layout tree as formatted JSON
170
+ android layout --diff # Identify changed layout tree nodes since the last dump
171
+
172
+ # 3. Precise Visual Inspection & ADB Tap Actions
173
+ android screen capture -o ./tmp/capture.png # Capture active viewport to a PNG file
174
+ android screen capture --annotate -o ./tmp/capture_annotated.png # Capture active screen with bounding boxes and numeric labels
175
+ android screen resolve --screen ./tmp/capture_annotated.png --string "#3" # Get exact X/Y coordinate for visual box #3
176
+ adb shell input $(android screen resolve --screen ./tmp/capture_annotated.png --string "tap #3") # Tap visual region #3 directly
177
+
178
+ # 4. Device Interaction Control
179
+ adb shell input keyevent 66 # Trigger ENTER key event
180
+ adb shell input text "user@example.com" # Type literal string into the currently focused text field
181
+ adb shell input swipe 500 1500 500 500 800 # Slow vertical drag/swipe (duration: 800ms)
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 5. Testing & CI/CD Pipelines
187
+
188
+ ### 5.1 Journey Validation & Test Reports
189
+
190
+ Validate end-to-end user journeys using structured XML flows and export execution outcomes using a standardized JSON schema:
191
+
192
+ ```json
193
+ {
194
+ "journey": "Premium User Subscription Flow",
195
+ "results": [
196
+ {
197
+ "action": "Verify that the welcome headline is displayed on screen",
198
+ "status": "PASSED",
199
+ "commands": [],
200
+ "comment": "Headline 'Welcome to App' was successfully identified."
201
+ },
202
+ {
203
+ "action": "Tap the 'Go Premium' button",
204
+ "status": "PASSED",
205
+ "commands": ["adb shell input tap 450 1200"],
206
+ "comment": "Button region matched layout bounds."
207
+ }
208
+ ]
209
+ }
210
+ ```
@@ -0,0 +1,211 @@
1
+ # Brainstorming: Tích Hợp Đa Tác Tử (Multi-Agent CLI Pipeline) để Tối Ưu Chi Phí và Hiệu Năng trong AWKit
2
+
3
+ > **Tác giả:** Antigravity Orchestrator
4
+ > **Ngày cập nhật:** 2026-06-22
5
+ > **Phiên bản:** v1.0
6
+ > **Trạng thái:** Thảo luận / Ý tưởng thiết kế
7
+
8
+ ---
9
+
10
+ ## 1. Mục tiêu (Objective)
11
+
12
+ Tối ưu hóa chi phí API và nâng cao hiệu suất làm việc bằng cách định tuyến thông minh (Smart Routing) các tác vụ phát triển phần mềm trong framework AWKit đến ba nhóm CLI agents khác nhau:
13
+
14
+ 1. **Claude Code CLI (`claude`)** — Nhóm siêu trí tuệ (Premium Model).
15
+ 2. **Codex CLI (`codex`)** — Nhóm kiểm thử & thẩm định (Intermediate/Audit Model).
16
+ 3. **Qwen Code CLI (`qwen-code` hoặc runner tương đương)** — Nhóm mã nguồn mở hiệu năng cao, chi phí rẻ (Cost-optimized Open-Source).
17
+
18
+ ---
19
+
20
+ ## 2. Phân tích Thế mạnh & Định vị Vai trò (Agent Capabilities & Roles)
21
+
22
+ Dựa trên đặc điểm kỹ thuật và chi phí của từng mô hình, ta phân chia vai trò như sau:
23
+
24
+ | CLI Agent | Model Phía Sau | Thế mạnh Đặc trưng | Vai trò trong Hệ thống | Chiến lược Chi phí |
25
+ | :---------------- | :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- | :------------------------------------------------------------ |
26
+ | **Claude Code** | Claude 3.5 Sonnet / Opus | - Suy luận logic phức tạp cực tốt.<br>- Lập kế hoạch kiến trúc chính xác.<br>- Khả năng giải quyết bug khó tốt nhất. | **Architect (Kiến trúc sư)** & **Complex Solver (Giải quyết sự cố lớn)** | Hạn chế số lần gọi (chỉ dùng cho Gate 2 & Gate 4 Complex). |
27
+ | **Codex CLI** | GPT-4o / Codex custom | - Review code khách quan với [$code-review](~/.agents/skills/code-review/SKILL.md).<br>- Thiết kế UI & Character assets chuyên sâu bằng [$hatch-pet](~/.codex/skills/hatch-pet/SKILL.md) và [$generate-gui-assets](~/.agents/skills/generate-gui-assets/SKILL.md).<br>- Tạo UI Shell tĩnh, HTML/CSS, Mockup nhanh.<br>- Sinh unit/integration tests chuẩn xác. | **Inspector (Kiểm định viên)** & **UI/Asset Builder (Tạo giao diện & Asset)** | Sử dụng trung bình (Gate 2.5 & Gate 5). |
28
+ | **Qwen Code CLI** | Qwen 2.5 Coder (32B/72B) | - Viết code boilerplate rất nhanh.<br>- Hiểu tốt nhiều ngôn ngữ lập trình.<br>- Tốc độ phản hồi cực nhanh, chi phí siêu rẻ hoặc miễn phí (tự host). | **Boilerplate Generator (Sinh mã nền)** & **Local Executor (Thực thi cục bộ)** | Sử dụng tối đa cho các task đơn giản, viết code thô ở Gate 4. |
29
+ | **Gemini (IDE)** | Gemini 3.5 Flash | - Context window khổng lồ (2M+).<br>- Tổng hợp và phân tích log/dữ liệu cực lớn.<br>- Phân tích codebase toàn diện. | **Central Orchestrator (Điều phối viên trung tâm)** & **Context Sync** | Chạy nền liên tục (chi phí cực rẻ). |
30
+
31
+ ---
32
+
33
+ ## 3. Quy trình Điều phối Đa Tác tử theo Hệ thống 7-Gate (7-Gate Routing Pipeline)
34
+
35
+ Để tối ưu hóa chi phí, quy trình xử lý một Task (đi qua các Gate) sẽ được định tuyến tự động như sau:
36
+
37
+ ```mermaid
38
+ graph TD
39
+ A[Bắt đầu Task] --> B{Phân loại độ khó Task}
40
+
41
+ B -->|Trivial / Simple| C[Qwen Code / Gemini Flash]
42
+ B -->|Moderate| D[Phối hợp Qwen & Codex]
43
+ B -->|Complex| E[Claude Code CLI]
44
+
45
+ subgraph Gate_2 [Gate 2: Spec & Architecture Planning]
46
+ E -->|Lập kế hoạch chính| F[Claude Code: claude-plan.js]
47
+ F --> G[Tạo implementation_plan.md]
48
+ end
49
+
50
+ subgraph Gate_2.5 [Gate 2.5: UI Shell & Assets]
51
+ G --> H[Codex CLI: codex exec GUI asset]
52
+ end
53
+
54
+ subgraph Gate_4 [Gate 4: Code Implementation]
55
+ H --> I{Phân rã Component}
56
+ I -->|Core Logic phức tạp| J[Claude Code CLI]
57
+ I -->|Boilerplate / Simple UI| K[Qwen Code CLI]
58
+ end
59
+
60
+ subgraph Gate_5 [Gate 5: Verification & QA]
61
+ J & K --> L[Codex CLI: Chạy Test & Code Review]
62
+ L --> M[Hoàn thành Task]
63
+ end
64
+ ```
65
+
66
+ ### Chi tiết Phân phối theo từng Gate:
67
+
68
+ 1. **Gate 1 & 1.5 (Brainstorm & Module Spec)**:
69
+ - **Tác tử**: Gemini Flash (Tích hợp sẵn trong IDE) làm việc trực tiếp với User.
70
+ - **Lý do**: Cần context lớn để hiểu toàn bộ yêu cầu của User và đọc tài liệu cũ. Chi phí cực thấp.
71
+
72
+ 2. **Gate 2 (Spec & Architecture Planning)**:
73
+ - **Tác tử**: **Claude Code CLI** (`node scripts/claude-plan.js`).
74
+ - **Lý do**: Lập kế hoạch sai sẽ dẫn đến viết code sai, gây lãng phí lớn chi phí API sau đó. Claude sẽ tạo ra `implementation_plan.md` cực kỳ chuẩn xác và hạn chế tối đa rủi ro regression.
75
+
76
+ 3. **Gate 2.5 (Visual Design & Asset Generation)**:
77
+ - **Tác tử**: **Codex CLI** (`codex exec`).
78
+ - **Lý do**: Codex thực hiện xuất sắc việc sinh UI shell/mockup và thiết kế UI & Character assets thông qua tích hợp các kỹ thuật chuyên sâu như [$hatch-pet](~/.codex/skills/hatch-pet/SKILL.md) (cho nhân vật/thú cưng) và [$generate-gui-assets](~/.agents/skills/generate-gui-assets/SKILL.md) (cho các thành phần giao diện).
79
+
80
+ 4. **Gate 4 (Execution - Viết Code)**:
81
+ - **Task Trivial (Dưới 3 files / Boilerplate)**: Định tuyến 100% qua **Qwen Code CLI** hoặc Gemini Flash.
82
+ - **Task Moderate/Complex**:
83
+ - **Qwen Code CLI** sẽ viết các file cấu trúc, helper, boilerplate và shell UI (Phase A + Phase B).
84
+ - **Claude Code CLI** sẽ được gọi để chèn logic cốt lõi (Core Business Logic) và giải quyết các phần tích hợp phức tạp (Phase C).
85
+
86
+ 5. **Gate 5 (Verification & QA)**:
87
+ - **Tác tử**: **Codex CLI** (phục vụ thẩm định chất lượng cao).
88
+ - **Lý do**: Codex có kỹ năng rà soát chất lượng code xuất sắc nhờ kỹ thuật [$code-review](~/.agents/skills/code-review/SKILL.md). Nó cũng rà soát sự tuân thủ các quy tắc coding (như Ponytail rules) và tự động sinh unit/integration tests để giảm thiểu rủi ro regression trước khi tích hợp vào nhánh chính.
89
+
90
+ ---
91
+
92
+ ## 4. Giải pháp Tích hợp Kỹ thuật vào AWKit (Technical Integration)
93
+
94
+ Để triển khai ý tưởng này vào AWKit hiện tại, chúng ta cần thực hiện các bước sau:
95
+
96
+ ### Bước 4.1: Bổ sung cấu hình điều hướng trong `.project-identity`
97
+ Thêm cấu hình điều phối đa tác tử để dễ dàng chuyển đổi chế độ hoạt động:
98
+ ```json
99
+ "automation": {
100
+ "multiAgent": {
101
+ "enabled": true,
102
+ "routingMode": "cost-optimized", // "cost-optimized" hoặc "quality-first"
103
+ "audioAlerts": true, // Bật/tắt âm thanh thông báo cấp độ project (override)
104
+ "runners": {
105
+ "codex": "codex"
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ### Bước 4.1.2: Cấu hình cấp độ Global (`~/.awkit_config.json`)
112
+ Để bật/tắt hoặc tinh chỉnh các tính năng CLI (như âm thanh thông báo) trên toàn bộ thiết bị (global), ta sử dụng tệp cấu hình `~/.awkit_config.json` thông qua lệnh CLI:
113
+ ```bash
114
+ # Xem toàn bộ cấu hình global hiện tại
115
+ awkit config-global list
116
+
117
+ # Bật hoặc tắt âm thanh thông báo hệ thống
118
+ awkit config-global set audioAlerts false
119
+ awkit config-global set audioAlerts true
120
+
121
+ # Lấy giá trị của một cấu hình cụ thể
122
+ awkit config-global get audioAlerts
123
+ ```
124
+ *Ghi chú:* Cấu hình `audioAlerts` cục bộ trong `.project-identity` của dự án sẽ được ưu tiên cao hơn cấu hình global này.
125
+
126
+ ### Bước 4.2: Xây dựng Qwen CLI Wrapper (`scripts/qwen-plan.js` hoặc `scripts/qwen-exec.js`)
127
+
128
+ Do Qwen CLI có thể chạy thông qua Ollama (local) hoặc qua API của các nhà cung cấp giá rẻ (OpenRouter, TogetherAI, v.v.), ta có thể viết một script trung gian để gọi:
129
+
130
+ ```javascript
131
+ // scripts/qwen-exec.js
132
+ const { execSync } = require("child_process");
133
+ // Ví dụ: gọi Ollama chạy local model qwen2.5-coder:32b
134
+ const prompt = process.argv[2];
135
+ try {
136
+ const output = execSync(`ollama run qwen2.5-coder "${prompt}"`, {
137
+ encoding: "utf8",
138
+ });
139
+ console.log(output);
140
+ } catch (e) {
141
+ // Fallback sang API hoặc Gemini Flash
142
+ }
143
+ ```
144
+
145
+ ### Bước 4.3: Cập nhật Multi-Model Pipeline (`scripts/multi-model-pipeline.js`)
146
+
147
+ Chỉnh sửa pipeline hiện tại để tích hợp tác tử Qwen vào giai đoạn Code Step:
148
+
149
+ - **Trước đây**: Chỉ dùng `gemini-2.5-flash` hoặc `claude-opus`.
150
+ - **Mới**: Định tuyến thông minh:
151
+ ```javascript
152
+ if (taskDifficulty === "trivial" || routingMode === "cost-optimized") {
153
+ runQwenCodeStep(featureName);
154
+ } else {
155
+ runClaudeCodeStep(featureName);
156
+ }
157
+ ```
158
+
159
+ ---
160
+
161
+ ## 5. Đánh giá Hiệu quả Chi phí (Cost-Benefit Analysis)
162
+
163
+ Giả sử một task phát triển tính năng trung bình tiêu tốn khoảng **100,000 input tokens** và **10,000 output tokens**:
164
+
165
+ | Chiến lược | Chi tiết phân phối | Chi phí ước tính (USD/Task) | Tỷ lệ Tiết kiệm |
166
+ | :----------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------- | :---------------------------------------------------------------------------------------------------- |
167
+ | **Chỉ dùng Claude 3.5** | 100% sử dụng Claude | ~$0.45 | 0% (Mốc chuẩn) |
168
+ | **Chỉ dùng Gemini Flash** | 100% sử dụng Gemini Flash | ~$0.012 | 97% (Nhưng chất lượng logic phức tạp có thể giảm) |
169
+ | **Đa Tác tử (Multi-Agent Pipeline)** | - **Claude** (10% tokens cho Planning)<br>- **Qwen Coder** (80% tokens cho Boilerplate & Coding - Local/Free)<br>- **Codex** (10% tokens cho Review & Test) | **~$0.07** | **~85% Tiết kiệm** mà vẫn giữ được chất lượng kiến trúc của Claude và chất lượng kiểm định của Codex. |
170
+
171
+ ---
172
+
173
+ ## 6. Cơ Chế Hoạt Động Chi Tiết (How it Works)
174
+
175
+ Cơ chế điều phối sub-agent CLI trong AWKit hoạt động theo 6 bước tuần tự:
176
+ 1. **Nhận diện và Kích hoạt (Trigger Detection)**: Dựa trên Gate hiện tại (Gate 2, 2.5, 4, 5) hoặc độ phức tạp của task (Trivial, Moderate, Complex), Central Agent (Gemini Flash) xác định CLI agent cần dùng.
177
+ 2. **Thu thập Ngữ cảnh (Context Gathering)**: Central Agent tự động đóng gói các tài liệu liên quan (`.project-identity`, `implementation_plan.md`, `git diff`...) thành một prompt có cấu trúc.
178
+ 3. **Chạy Trực Tiếp / Ủy quyền (Execution Delegation)**: Chạy CLI qua terminal bằng lệnh `run_command` hoặc thông qua các wrapper script chuyên dụng (như `scripts/multi-model-pipeline.js`, `scripts/claude-plan.js`).
179
+ 4. **Cơ chế Dự phòng (Graceful Fallback)**: Nếu CLI không được cài đặt (Exit code `127`) hoặc gặp lỗi xác thực (Exit code `2`), hệ thống sẽ tự động chuyển sang mô hình mặc định trong IDE mà không làm gián đoạn luồng làm việc.
180
+ 5. **Ghi nhận & Tiêu thụ Báo cáo (Result Consumption)**: Kết quả từ CLI được lưu dưới dạng file báo cáo (`.md` hoặc `.json`) trong thư mục `codex-reports/` hoặc `brain/`. Central Agent sẽ đọc báo cáo này để cập nhật ngữ cảnh và tiếp tục thực hiện mã nguồn.
181
+ 6. **Thông Báo Hoàn Tất Bằng Âm Thanh (Audio Notification)**: Đối với các tác vụ chạy nền (background tasks) tốn thời gian, hệ thống tự động phát âm thanh hệ thống (ví dụ: `afplay /System/Library/Sounds/Glass.aiff`) và thông báo bằng giọng nói (ví dụ: `say "Done"`) trên macOS để thông báo cho người dùng khi quy trình hoàn thành.
182
+
183
+ ---
184
+
185
+ ## 7. Khảo Sát Môi Trường Thực Tế & Thử Nghiệm (Environment Audit & Prototype)
186
+
187
+ Kết quả khảo sát môi trường tại máy local `/Users/trungkientn/Dev/NodeJS/main-awf`:
188
+ * **Codex CLI**: ✅ Đã được cài đặt tại `/Users/trungkientn/.nvm/versions/node/v22.22.0/bin/codex`.
189
+ * **agy CLI (Gemini)**: ✅ Đã được cài đặt tại `/Users/trungkientn/.local/bin/agy` (Version 1.0.0).
190
+ * **Claude Code CLI**: ✅ Đã cài đặt dưới dạng alias, trỏ trực tiếp đến `/Users/trungkientn/.claude/local/claude` (Sử dụng đường dẫn tuyệt đối này trong các script tự động hóa).
191
+ * **Qwen Code CLI**: ✅ Đã được cài đặt với tên lệnh `qwen` tại `/Users/trungkientn/.nvm/versions/node/v22.22.0/bin/qwen`.
192
+
193
+ ### Kết Quả Thử Nghiệm Thực Tế (Test Run Results - 2026-06-22):
194
+
195
+ #### 1. Kiểm thử đơn lẻ (Unit Test Run):
196
+ - **agy CLI (Gemini)**: ✅ Thành công phản hồi câu hỏi lý thuyết sau `20,195ms`.
197
+ - **Codex CLI (OpenAI - Model: `gpt-5.5`)**: ✅ Thành công review mã nguồn cứng API key sau `10,182ms`.
198
+
199
+ #### 2. Kiểm thử phối hợp chuỗi (Multi-Agent Pipeline Test Run):
200
+ Đã chạy thành công kịch bản lập kế hoạch, sinh mã nguồn và rà soát tự động cho hàm Fibonacci memoization thông qua script `run_multi_agent_pipeline.js`:
201
+ - **Bước 1: Claude CLI (Architect)**: ✅ Thành công thiết kế sơ đồ logic và kế hoạch memoization lưu tại [test_plan.md](file:///Users/trungkientn/.gemini/antigravity-ide/brain/c843a673-f692-4562-a065-0000e76bff71/scratch/test_plan.md).
202
+ - **Bước 2: Qwen CLI (Executor)**: ✅ Thành công đọc kế hoạch của Claude và viết mã nguồn JavaScript tương thích 100%, lưu tại [test_code.js](file:///Users/trungkientn/.gemini/antigravity-ide/brain/c843a673-f692-4562-a065-0000e76bff71/scratch/test_code.js) (`21,237ms`).
203
+ - **Bước 3: Codex CLI (Inspector)**: ✅ Thành công đối chiếu `test_code.js` với `test_plan.md`, chỉ ra 2 cảnh báo độ ưu tiên Medium (tràn số khi `n >= 79` và lỗi call stack đệ quy sâu) kèm 2 nhận xét Low, lưu tại [test_review.md](file:///Users/trungkientn/.gemini/antigravity-ide/brain/c843a673-f692-4562-a065-0000e76bff71/scratch/test_review.md) (`23,250ms`).
204
+ - **Kết luận**: Quy trình hoạt động đồng bộ hoàn hảo. Sự phối hợp giúp phân tách trách nhiệm rõ rệt: thiết kế cao cấp (Claude) -> lập trình cơ bản (Qwen) -> rà soát chi tiết (Codex). Log đầy đủ tại [pipeline_run_log.json](file:///Users/trungkientn/.gemini/antigravity-ide/brain/c843a673-f692-4562-a065-0000e76bff71/scratch/pipeline_run_log.json).
205
+
206
+ ---
207
+
208
+ ## 8. Các Bước Tiếp Theo Đề Xuất (Next Steps)
209
+ 1. **Tạo kịch bản thử nghiệm thực tế (Test Run Script)**: Viết script `test_sub_agents.js` trong thư mục `scratch/` để gọi thử `codex` và `agy` kiểm tra logic review/plan thô.
210
+ 2. **Cập nhật wrapper script gọi Claude và Qwen**: Thiết lập đường dẫn tuyệt đối `/Users/trungkientn/.claude/local/claude` cho Claude và tên lệnh `qwen` cho Qwen trong hệ thống multi-model routing của AWKit.
211
+ 3. **Đóng gói Skill**: Phát triển `skills/qwen-conductor/SKILL.md` để tự động hóa định tuyến.
@@ -0,0 +1,146 @@
1
+ # Revision History
2
+
3
+ | Version | Date | Author | Description |
4
+ |---|---|---|---|
5
+ | v1.0 | 2026-06-15 | Antigravity Orchestrator | Bản thảo brainstorm tích hợp triết lý Ponytail vào dự án AWKit |
6
+ | v1.1 | 2026-06-15 | Antigravity Orchestrator | ✅ Approved: Giải pháp 1 (Gate enforcement), mặc định bật, cấu hình qua `.project-identity` |
7
+
8
+ ---
9
+
10
+ # Brainstorm: Tích hợp Triết lý Ponytail vào AWKit
11
+
12
+ Tài liệu này tập trung vào việc áp dụng thực tế triết lý "lazy senior developer" từ dự án [DietrichGebert/ponytail](https://github.com/DietrichGebert/ponytail) vào hệ thống **AWKit (Antigravity Workflow Kit)**.
13
+
14
+ ---
15
+
16
+ ## 1. Phân tích bối cảnh dự án & Vấn đề thực tế
17
+
18
+ Trong quá trình phát triển các ứng dụng bằng AI (chẳng hạn như React Dashboard của Symphony, game Expo/Unity, hay các app iOS/Android trong hệ sinh thái của User):
19
+ * **AI thường "over-deliver"**: Khi được yêu cầu viết một tính năng đơn giản (ví dụ: bộ lọc ngày, cache dữ liệu), AI thường tự ý cài thêm các thư viện bên ngoài (Moment.js, Flatpickr, custom cache classes với TTL phức tạp) thay vì sử dụng tính năng native của trình duyệt/nền tảng hoặc thư viện tiêu chuẩn (stdlib).
20
+ * **Token Bloat**: Việc sinh thêm code boilerplate và các tầng trừu tượng không cần thiết làm phình to context của session làm việc, dẫn đến cạn kiệt ngân sách token nhanh hơn và làm chậm thời gian phản hồi của AI.
21
+ * **Gia tăng Technical Debt**: Nhiều class phức tạp được tạo ra "để dành cho tương lai" (speculative generality) nhưng thực tế không bao giờ được sử dụng đến, gây khó khăn cho việc bảo trì.
22
+
23
+ ---
24
+
25
+ ## 2. Giải pháp tích hợp thực tế vào AWKit
26
+
27
+ Chúng ta sẽ tích hợp triết lý Ponytail vào hai lớp của AWKit: **Lớp ràng buộc hệ thống (System Enforcer)** và **Lớp công cụ nhà phát triển (Developer Tools)**.
28
+
29
+ ### ✅ Giải pháp 1: Ràng buộc trực tiếp vào Quy trình 7-Gate (Internal Enforcement) — APPROVED
30
+ Hệ thống Gate của AWKit (đặc biệt là Gate 4 - Execution và Gate 5 - Verification) sẽ được bổ sung các chốt chặn tự động:
31
+ * **Gate 4 Phase B (UI Shell Mock) & Phase C (Logic)**:
32
+ * AI bắt buộc phải đối chiếu danh sách linh kiện/native API trước khi bắt tay viết code.
33
+ * *Ví dụ:* Nếu làm UI React, cấm cài thêm thư viện date/color picker hay modal nếu HTML5 `<input type="date">` hoặc `<dialog>` đáp ứng được.
34
+ * **Gate 5 (Verification)**:
35
+ * Tích hợp bước tự động rà soát over-engineering. Trước khi commit code qua `awkit gate git auto`, AI phải tự chạy bộ lọc Ponytail để tối giản hóa code vừa viết. Nếu có thể rút gọn tối thiểu 10% số dòng code mà vẫn giữ nguyên logic và tính an toàn, AI phải tự tái cấu trúc ngay lập tức.
36
+
37
+ ### Giải pháp 2: Xây dựng Kỹ năng `awf-ponytail` & `awf-ponytail-review`
38
+ * **Skill `awf-ponytail`**: Khi người dùng yêu cầu AI viết code tối giản bằng các từ khóa như `be lazy`, `lazy mode`, `ponytail`, AI sẽ tự động kích hoạt chế độ sinh code siêu tinh gọn, chỉ dùng stdlib và native APIs, đồng thời luôn đánh dấu các phần giản lược bằng comment `// ponytail: [giới hạn] -> [cách nâng cấp]`.
39
+ * **Skill `awf-ponytail-review`**: Hỗ trợ review độ phức tạp của code. Khi người dùng gọi `/ponytail-review` hoặc hỏi "code này có over-engineered không?", AI sẽ phân tích và đưa ra báo cáo cực kỳ ngắn gọn dạng:
40
+ `L<line>: <tag> <what>. <replacement>.`
41
+ * `delete:` Xóa bỏ boilerplate hoặc abstractions thừa.
42
+ * `stdlib:` Thay bằng hàm có sẵn của thư viện chuẩn.
43
+ * `native:` Thay bằng tính năng native của trình duyệt/HĐH.
44
+ * `yagni:` Gộp class/interface chỉ có một implementation duy nhất.
45
+ * `shrink:` Viết lại đoạn code ngắn gọn hơn.
46
+
47
+ ### Giải pháp 3: Xây dựng Workflow `workflows/quality/ponytail-review.md`
48
+ Cung cấp một workflow dạng manual để người dùng kích hoạt bất kỳ lúc nào nhằm quét toàn bộ codebase hoặc diff hiện tại để tìm các điểm có thể tối giản hóa, tính toán số dòng code tối đa có thể cắt giảm (`net: -<N> lines possible`).
49
+
50
+ ---
51
+
52
+ ## 3. Bản thảo Chi tiết Kỹ thuật (Technical Drafts)
53
+
54
+ ### A. Ràng buộc mới trong `core/GEMINI.md` (English)
55
+ ```markdown
56
+ ### Lazy Dev Mode (Ponytail Rules)
57
+ - **Ladder of Simplicity**: Before writing code, stop at the first rung:
58
+ 1. YAGNI: Speculative need = skip it.
59
+ 2. Stdlib does it? Use it.
60
+ 3. Native platform feature covers it? Use it (e.g. `<input type="date">`, `<dialog>`, native CSS transitions).
61
+ 4. Installed dependency solves it? Use it. Do not add new dependencies unless explicitly authorized.
62
+ 5. One line? Make it one line.
63
+ 6. Minimum code that works.
64
+ - **Complexity Guard**: No unrequested abstractions, interfaces with a single implementation, boilerplate, or scaffolding "for later".
65
+ - **Simplification Marker**: Mark intentional simplifications with a `ponytail:` comment describing the known ceiling and the upgrade path (e.g. `// ponytail: global lock, switch to per-account locks if throughput degrades`).
66
+ ```
67
+
68
+ ### B. Cấu trúc Skill `skills/awf-ponytail-review/SKILL.md` (English)
69
+ ```markdown
70
+ ---
71
+ name: awf-ponytail-review
72
+ description: Hunt for over-engineering and bloated code in diffs or directories.
73
+ version: 1.0.0
74
+ ---
75
+
76
+ # AWF Ponytail Review
77
+
78
+ Audit code exclusively for unnecessary complexity, speculative features, and boilerplate.
79
+
80
+ ## Audit Rules
81
+ 1. Identify code that duplicates stdlib (e.g., manual debouncers, custom string pads).
82
+ 2. Find unneeded third-party libraries doing what native features can do.
83
+ 3. Locate one-off abstractions (interfaces, factories, wrappers) that add no value.
84
+
85
+ ## Output Format
86
+ Strictly one line per finding:
87
+ `L<line>: <tag> <what>. <replacement>.`
88
+
89
+ End with: `net: -<N> lines possible.`
90
+ If the code is already optimized, output: `Lean already. Ship.`
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 4. Các điểm cần thảo luận thêm (Open Questions)
96
+
97
+ 1. ~~**Có nên tự động kích hoạt Ponytail Mode cho mọi task không?**~~ → ✅ **QUYẾT ĐỊNH: MẶC ĐỊNH BẬT**
98
+ * Ponytail Mode mặc định **enabled** cho mọi dự án.
99
+ * Người dùng vibe coding thường không thể xác định rõ cái nào cần lazy, cái nào không → hệ thống nên tự áp dụng.
100
+ * Nếu người dùng muốn tắt (ví dụ: Enterprise projects cần kiến trúc mở rộng cao), cấu hình qua `.project-identity`:
101
+ ```json
102
+ "automation": {
103
+ "ponytailMode": {
104
+ "enabled": false,
105
+ "level": "full"
106
+ }
107
+ }
108
+ ```
109
+ * **Giá trị mặc định khi không khai báo**: `enabled: true`, `level: "full"`.
110
+
111
+ 2. **Comment `ponytail:` có nên là bắt buộc không?**
112
+ * *Đề xuất:* Rất cần thiết. Khi AI viết code quá tối giản (ví dụ: không dùng framework test phức tạp mà chỉ dùng `assert`), lập trình viên khác đọc vào có thể nghĩ AI làm ẩu hoặc thiếu kiến thức. Comment `// ponytail:` giúp làm rõ đó là sự giản lược có chủ đích.
113
+
114
+ ---
115
+
116
+ ## 5. Schema cấu hình `.project-identity`
117
+
118
+ Trường `automation.ponytailMode` sẽ tuân theo cấu trúc tương tự `communication.cavemanMode`:
119
+
120
+ ```json
121
+ {
122
+ "automation": {
123
+ "ponytailMode": {
124
+ "enabled": true,
125
+ "level": "full"
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ | Field | Type | Default | Description |
132
+ |-------|------|---------|-------------|
133
+ | `enabled` | `boolean` | `true` | Bật/tắt Ponytail enforcement trong Gate 4 & Gate 5 |
134
+ | `level` | `string` | `"full"` | Mức độ: `"lite"` (gợi ý), `"full"` (bắt buộc stdlib/native first), `"ultra"` (YAGNI cực đoan) |
135
+
136
+ **Quy tắc đọc cấu hình:**
137
+ ```
138
+ config = read(".project-identity")
139
+ ponytail = config?.automation?.ponytailMode
140
+ enabled = ponytail?.enabled ?? true // mặc định BẬT
141
+ level = ponytail?.level ?? "full" // mặc định FULL
142
+ ```
143
+
144
+ ---
145
+
146
+ *Đã duyệt Giải pháp 1. Sẵn sàng triển khai khi user approve.*