@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
@@ -0,0 +1,113 @@
1
+ # Brainstorming: AWKit Smart Setup & Ecosystem Engine (SAEE)
2
+
3
+ > **Revision History**
4
+ > | Version | Date | Author | Description |
5
+ > |---|---|---|---|
6
+ > | v1.0.0 | 2026-05-28 | Antigravity Orchestrator | Initial concept proposal for Smart Setup inspired by `claude-code-setup` |
7
+
8
+ ---
9
+
10
+ ## 💡 Bối Cảnh & Cơ Hội
11
+
12
+ Anthropic vừa ra mắt `claude-code-setup` nhằm tối ưu hóa môi trường lập trình của Claude Code dựa trên phân tích cấu trúc dự án. Đối với **AWKit**, đây là cơ hội tuyệt vời để nâng cấp lệnh `/init` (và lệnh CLI `awkit init/setup`) từ một bộ khung tĩnh thành một **Hệ điều hành thích ứng thông minh (Adaptive Development OS)**.
13
+
14
+ Thay vì chỉ copy-paste các template tĩnh, AWKit có thể chủ động quét, phân tích và cấu hình toàn bộ hệ sinh thái phù hợp nhất cho dự án của người dùng.
15
+
16
+ ---
17
+
18
+ ## 🎯 5 Trụ Cột Của AWKit Smart Setup (SAEE)
19
+
20
+ Chúng ta có thể xây dựng tính năng này xoay quanh 5 trục chính:
21
+
22
+ ```mermaid
23
+ graph TD
24
+ A[Codebase Quét & Phân Tích] --> B(1. Smart Stack Analyzer)
25
+ B --> C(2. MCP Auto-Recommender)
26
+ B --> D(3. Adaptive Skill Activation)
27
+ B --> E(4. Automated Hook System)
28
+ B --> F(5. Tailored Workflows)
29
+ C & D & E & F --> G[Cập nhật .project-identity & specs/]
30
+ ```
31
+
32
+ ### 1. Smart Stack Analyzer (SSA)
33
+ Bộ quét thông minh phân tích sâu codebase để phát hiện:
34
+ - **Ngôn ngữ & Runtime**: Node.js, Python, Swift, Kotlin, Go, v.v.
35
+ - **Framework & Libraries**: React, Next.js, Expo, UIKit, Jetpack Compose, FastAPI, Express.
36
+ - **Database & Cloud**: Firebase, SQLite, PostgreSQL, Appwrite.
37
+ - **Package Manager**: npm, pnpm, yarn, bun, poetry, swift package manager.
38
+
39
+ ### 2. MCP Auto-Recommender (MCP-AR)
40
+ Đề xuất và tự động thiết lập các kết nối MCP phù hợp với dự án:
41
+ * *Web/Frontend Apps*: Đề xuất `playwright` cho việc test UI và debug giao diện trực quan.
42
+ * *Mobile Apps*: Đề xuất `maestro` cho end-to-end testing, `ios-simulator` và `android-cli-plugin`.
43
+ * *Database & Backend*: Đề xuất `sqlite-mcp-server` hoặc `firebase-mcp-server` khi phát hiện các gói firebase trong dependency.
44
+
45
+ ### 3. Adaptive Skill Activation (ASA)
46
+ AWKit sở hữu hơn 90+ skills chuyên sâu (ví dụ: `expo-build-optimizer`, `swiftui-pro`, `android-aso`, `firebase-firestore`). SAEE sẽ:
47
+ - Nhận diện những skills có ích nhất cho stack hiện tại.
48
+ - Tự động điền các skill này vào mục tiêu của agent để kích hoạt chúng một cách tối ưu, giảm thiểu noise context từ các skill không liên quan.
49
+
50
+ ### 4. Automated Hook System (AHS)
51
+ Thiết lập các quy tắc tự động hóa trong phiên làm việc:
52
+ - **Preflight build hooks**: Tự động chạy `awkit build` trước khi cho phép auto-commit.
53
+ - **Git Hook Automation**: Liên kết với quy tắc *Auto-Commit After Build* (qua `awkit gate git auto`).
54
+ - **Security Check Hook**: Cảnh báo hoặc chặn chỉnh sửa các file nhạy cảm (`.env`, private keys) được định nghĩa sẵn.
55
+
56
+ ### 5. Tailored Workflows & Roles (TWR)
57
+ Tự động tinh chỉnh và nạp các workflows thích ứng:
58
+ - Nếu phát hiện dự án mobile: Tự động nạp `/aso-audit`, `/ios-build`, `/app-store-screenshots`.
59
+ - Nếu phát hiện dự án backend/API: Nạp `/api-test`, `/deploy-app-hosting`.
60
+ - Đề xuất các **Subagents / Roles chuyên dụng** trong `AGENTS.md` (như Security Auditor, UX Reviewer).
61
+
62
+ ---
63
+
64
+ ## 🛠️ Luồng Thực Thi Đề Xuất (Interactive /init Workflow)
65
+
66
+ Khi người dùng chạy `/init` hoặc CLI `awkit setup`, quy trình sẽ diễn ra như sau:
67
+
68
+ > [!IMPORTANT]
69
+ > Triết lý thiết kế: **Smart Recommendations, Explicit Approvals**. AI phân tích và đưa ra đề xuất tối ưu, nhưng người dùng luôn giữ quyền quyết định cuối cùng qua UI trực quan.
70
+
71
+ ### 🔄 Chi Tiết Quy Trình 3 Bước
72
+
73
+ ```
74
+ ┌────────────────────────────────────────────────────────┐
75
+ │ Bước 1: Quét Codebase & Nhận Diện │
76
+ ├────────────────────────────────────────────────────────┤
77
+ │ Analyzing package.json, Xcode project, App.tsx... │
78
+ │ 🔍 Tech stack phát hiện: React Native, Expo, Firebase │
79
+ └──────────────────────────┬─────────────────────────────┘
80
+
81
+ ┌────────────────────────────────────────────────────────┐
82
+ │ Bước 2: Brainstorm Đề Xuất Hệ Sinh thái │
83
+ ├────────────────────────────────────────────────────────┤
84
+ │ 💡 MCP: Đề xuất kích hoạt maestro, firebase-mcp │
85
+ │ 🎯 Skills: Tự động bật expo-build-optimizer, firestore│
86
+ │ ⚡ Hooks: Bật auto-lint, auto-commit sau build │
87
+ └──────────────────────────┬─────────────────────────────┘
88
+
89
+ ┌────────────────────────────────────────────────────────┐
90
+ │ Bước 3: Ghi nhận & Cấu hình │
91
+ ├────────────────────────────────────────────────────────┤
92
+ │ ✓ Cập nhật .project-identity │
93
+ │ ✓ Khởi tạo specs/PROJECT.md & REQUIREMENTS.md │
94
+ └────────────────────────────────────────────────────────┘
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🚀 Kế Hoạch Triển Khai (Roadmap)
100
+
101
+ Chúng ta có thể thực hiện theo mô hình **7-Gate System** của AWKit:
102
+
103
+ ### Phase 1: Infrastructure & Analyzer (🏗️ Gate 4 - Phase A)
104
+ - Phát triển module `scripts/smart-analyzer.js` sử dụng Node.js để phân tích nhanh các file cấu hình dự án (`package.json`, `Gemfile`, `build.gradle`, `Package.swift`).
105
+ - Định nghĩa schema map cho các gợi ý (Stack -> MCPs, Skills, Workflows).
106
+
107
+ ### Phase 2: CLI Integration (🎨 Gate 4 - Phase B)
108
+ - Mở rộng lệnh CLI `awkit setup` và `/init` workflow trong `workflows/lifecycle/init.md`.
109
+ - Xây dựng giao diện CLI interactive đẹp mắt sử dụng `inquirer` hoặc các form UI tương tác của AWKit.
110
+
111
+ ### Phase 3: Actionable Execution (⚡ Gate 4 - Phase C)
112
+ - Hiện thực hóa việc tự động cập nhật `.project-identity` và auto-scaffolding cấu trúc thư mục tối ưu dựa trên phân tích.
113
+ - Tích hợp chặt chẽ với Symphony để tạo bộ task mẫu cho từng stack (ví dụ: Task bootstrap cho Expo).
@@ -0,0 +1,293 @@
1
+ # Báo cáo phân tích về Fable 5 và thiết kế hệ đa tác tử tương thích Opus 4.8, GPT-5.5 và Gemini
2
+
3
+ ## Tóm tắt điều hành
4
+
5
+ Bằng chứng mạnh nhất hiện có không cho thấy Fable 5 là một “bầy agent bí mật” thuần túy, mà là một hệ nhiều lớp gồm: mô hình nền rất mạnh, bộ phân loại an toàn đứng ngoài mô hình, cơ chế định tuyến rủi ro sang Claude Opus 4.8, bộ nhớ/sổ ghi chú dài hạn cho tác vụ nhiều bước, và một chương trình trusted access tách biệt cho biến thể ít guardrail hơn là Mythos 5. Anthropic công khai xác nhận Fable 5 và Mythos 5 là “cùng model nền”, rằng các truy vấn thuộc cyber/bio/chem/distillation có thể bị chuyển sang Opus 4.8, và rằng mô hình có thể duy trì hiệu năng trên các tác vụ dài, dùng “own notes”, và làm việc tự trị lâu hơn các Claude trước đó. Project Glasswing cũng cho thấy mô hình có khả năng phân tích, thử nghiệm và tìm lỗi phần mềm theo hướng agentic, nhiều trường hợp “gần như hoàn toàn tự động”. citeturn8view0turn9view0
6
+
7
+ Tệp người dùng cung cấp trông giống một prompt hệ thống rò rỉ hoặc tổng hợp cho “Claude Fable 5”, với cấu trúc module rất lớn: product info, refusal handling, legal/financial, wellbeing, evenhandedness, knowledge cutoff, memory system, và các chỉ dẫn web-search/product behavior. Nó gợi ý rằng lớp orchestration thực tế không chỉ nằm trong weights của model, mà còn nằm trong prompt stack, policy routing, memory application, và công cụ xung quanh model. Tuy vậy, đây là một artefact chưa được Anthropic xác thực; nên dùng nó như nguồn gợi ý kiến trúc, không phải bằng chứng kết luận. fileciteturn0file0
8
+
9
+ Nếu mục tiêu là thiết kế một hệ tương đương chạy được trên Claude Opus 4.8, GPT-5.5 và Gemini, giải pháp tốt nhất không phải sao chép prompt rò rỉ, mà là xây một control plane chung theo mô hình **manager–workers–critic–safety router**. Manager nhận yêu cầu, chia việc thành worker đọc/tìm kiếm/kiểm chứng, worker chỉ trả về tóm tắt có cấu trúc thay vì đổ toàn bộ log vào luồng chính, critic so chéo nguồn và phát hiện mâu thuẫn, còn safety router quyết định khi nào phải chặn, hạ cấp, hoặc xin duyệt người vận hành. Mẫu này phù hợp với tài liệu chính thức của cả Anthropic, OpenAI và Google: Anthropic nhấn mạnh explicit tool use, parallel tool calls và kiểm soát subagent; OpenAI công khai hai pattern “handoffs” và “agents-as-tools” cùng cơ chế approvals/state; Google công khai managed agents, collaborative planning, sandbox, MCP, function calling modes và network allowlists. citeturn26view0turn27view1turn27view0turn29view1turn29view2turn29view4turn22view0turn23view0turn20view3turn23view3
10
+
11
+ Về tương thích nền tảng, Anthropic Opus 4.8 phù hợp làm “deep specialist” cho coding, research và delegated work nếu được hướng dẫn rõ khi nào spawn subagent, khi nào dùng tool, và nếu được cấp budget output đủ lớn ở effort cao. GPT-5.5 phù hợp làm manager hoặc synthesizer nhờ context 1M, max output 128K, tool surface rộng, Agents SDK có handoff/asTool/approval/state khá rõ ràng. Gemini phù hợp cho tác vụ nghiên cứu dài, async và môi trường có tool/mạng cần quản lý chặt, đặc biệt nếu dùng Deep Research Agent hoặc managed Antigravity agent với collaborative planning, MCP và network allowlist. citeturn27view3turn27view1turn17view1turn17view4turn29view1turn29view2turn22view0turn23view0turn23view3
12
+
13
+ Điểm quan trọng nhất về an toàn là: không dựa vào “một system prompt lớn” để kiểm soát toàn hệ. Các nguồn chính thức và học thuật đều chỉ ra rủi ro ở ba tầng khác nhau: prompt leak, context pollution/context rot, và hạ tầng sandbox/tooling. Vì vậy hệ tương đương phải có guardrail ở **tool boundary**, **approval boundary**, **context boundary**, và **output boundary**; nếu không, càng nhiều subagent càng tăng xác suất rò prompt, lạm dụng tool, viết song song xung đột, hoặc tự tin sai theo kiểu “early commitment” vào giả thuyết sai. citeturn28view0turn30view4turn29view2turn5academia14turn5academia16turn5academia20turn5academia23
14
+
15
+ ## Bằng chứng rò rỉ và các tuyên bố có thể kiểm chứng
16
+
17
+ Mermaid dưới đây tách các mốc “rò rỉ”, “công bố chính thức” và “tranh cãi công khai” đã xác minh được trong tập nguồn hiện có.
18
+
19
+ ```mermaid
20
+ timeline
21
+ title Dòng thời gian rò rỉ và công khai liên quan đến Mythos và Fable
22
+ 2026-03-26 : Sự tồn tại của Claude Mythos trở nên công khai do draft blog bị rò rỉ (nguồn thứ cấp)
23
+ 2026-04-07 : Anthropic công bố Project Glasswing và Claude Mythos Preview
24
+ 2026-06-09 : Anthropic công bố Claude Fable 5 và Claude Mythos 5
25
+ 2026-06-10 : Tranh luận công khai về data retention và false positives quanh Fable 5
26
+ 2026-06-12 : Anthropic cập nhật rằng Fable 5 và Mythos 5 bị tạm ngừng truy cập
27
+ Không rõ ngày : Tệp prompt “Claude Fable 5” do người dùng cung cấp như một artefact rò rỉ
28
+ ```
29
+
30
+ Việc phân loại mức độ tin cậy là rất quan trọng ở chủ đề này. Nguồn **xác minh mạnh** là bài công bố chính thức của Anthropic về Fable 5, Project Glasswing, tài liệu prompt engineering/guardrails chính thức của Anthropic, cùng tài liệu chính thức của OpenAI và Google về orchestration/agents. Nguồn **mạnh vừa** là Reuters, Axios, The Verge, OpenAI/Google docs phụ trợ và vài bài báo học thuật. Nguồn **yếu hơn hoặc chỉ mang tính gợi ý** gồm Wikipedia/các bản mirror thứ cấp về thời điểm lộ Mythos, và tệp prompt rò rỉ do người dùng cung cấp. citeturn8view0turn9view0turn28view0turn16view0turn22view0turn5news3turn2news6turn13news2turn7search17
31
+
32
+ Bảng dưới đây đối chiếu các tuyên bố “rò rỉ hoặc suy đoán” với phần nào đã được Anthropic hoặc nguồn mạnh xác nhận.
33
+
34
+ | Tuyên bố | Nguồn rò rỉ / suy đoán | Nguồn xác minh hoặc bác bỏ | Đánh giá |
35
+ |---|---|---|---|
36
+ | Fable 5 và Mythos 5 dùng cùng model nền | Tệp prompt rò rỉ và các thảo luận cộng đồng | Anthropic xác nhận Mythos 5 là “the same underlying model as Fable 5”. citeturn8view0 | **Đã xác minh** |
37
+ | Fable 5 có cơ chế fallback sang Opus 4.8 cho chủ đề rủi ro | Leak và báo chí | Anthropic xác nhận cyber/bio/chem/distillation bị route sang Opus 4.8; Reuters cũng nêu fallback này. citeturn8view0turn5news3 | **Đã xác minh** |
38
+ | Kiến trúc dựa trên nhiều lớp prompt/policy/memory thay vì chỉ model weights | Tệp prompt rò rỉ | Tệp rò rỉ cho thấy prompt stack module hóa; Anthropic docs chính thức cũng có guidance tách prompt engineering, guardrails và memory-style behavior ra khỏi core model. fileciteturn0file0 citeturn26view0turn28view0 | **Hợp lý nhưng chưa xác nhận nội bộ** |
39
+ | Fable 5 vận hành tốt hơn trong công việc dài nhiều bước, dùng ghi chú nội bộ/file memory | Leak và lời đồn “agentic” | Anthropic nói Fable 5 “stays focused across millions of tokens” và cải thiện đầu ra bằng “its own notes”; file-based memory giúp mạnh lên rõ rệt trong Slay the Spire. citeturn8view0 | **Đã xác minh ở mức hành vi** |
40
+ | Claude Code/Fable vận hành các workflow đa agent trong thực tế | Thảo luận cộng đồng | Anthropic trích dẫn phản hồi khách hàng rằng Fable 5 xử lý “complex multi-agent workflows our employees run daily” trong Claude Code. citeturn8view0 | **Đã xác minh gián tiếp** |
41
+ | Fable 5/M Mythos có khả năng cyber agentic rất mạnh, có thể tìm-zero day tự động | Cộng đồng gọi là “too powerful”, “agentic hacker” | Anthropic/Glasswing mô tả Mythos Preview đã tìm hàng nghìn lỗ hổng nghiêm trọng và gần như tự động tìm/khai thác một số lỗi; Reuters và Axios phản ánh tranh cãi công khai quanh khả năng này. citeturn9view0turn5news3turn7news1 | **Đã xác minh ở mức public claims** |
42
+ | Full system prompt trong tệp người dùng là prompt thật cuối cùng của Anthropic | Artefact do người dùng cung cấp | Không có xác thực công khai từ Anthropic; nội dung nên xem như **purported leak / composite artifact**. fileciteturn0file0 | **Chưa xác minh** |
43
+
44
+ Về “community traces”, trong bộ nguồn đã truy xuất, dấu vết công khai có thể xác minh rõ nhất là: sự tồn tại của Mythos bị lộ do draft/blog leak theo các nguồn thứ cấp; phản ứng công khai sau lệnh đình chỉ Fable/Mythos ngày 13 tháng 6 năm 2026; và một ví dụ X được báo chí ghi lại là Sridhar Vembu bình luận về AI sovereignty sau khi Mỹ hạn chế truy cập Fable 5. Tuy nhiên, tôi **không truy xuất được một cách đáng tin cậy** các thread Reddit/Hacker News/X nguyên bản, giàu chi tiết về kiến trúc sub-agent của Fable 5, trong tập nguồn hiện tại. Điều đó tự nó là một tín hiệu: phần lớn chi tiết kỹ thuật khả tín đang nằm trong bài công bố chính thức và artefact prompt rò rỉ hơn là trong các thread cộng đồng dễ xác minh. citeturn7search17turn7news2turn2news6
45
+
46
+ ## Kiến trúc Fable 5 suy ra từ nguồn chính thức và artefact rò rỉ
47
+
48
+ Ở mức công khai, Fable 5 có thể được hiểu như một hệ hai lớp rõ ràng. Lớp thứ nhất là model nền rất mạnh, dùng chung với Mythos 5. Lớp thứ hai là “safety router” gồm classifier và chính sách định tuyến: nếu classifier phát hiện truy vấn liên quan tới misuse hoặc jailbreak, đặc biệt ở cyber, biology, chemistry và distillation, truy vấn sẽ không cho main model trả lời trực tiếp mà chuyển sang Claude Opus 4.8. Anthropic còn nói hơn 95% session không bị fallback, cho thấy fallback là guardrail chọn lọc chứ không phải mode mặc định. Họ cũng thừa nhận false positives tồn tại, bug bounty hơn 1.000 giờ vẫn chưa tìm thấy “universal jailbreak”, nhưng không coi việc ngăn universal jailbreak là tuyệt đối khả thi. Đây là kiến trúc “gate + degrade + trusted-access exception”, không phải một prompt đơn lẻ sẽ giải quyết mọi thứ. citeturn8view0
49
+
50
+ Project Glasswing cho biết Mythos Preview được dùng để tìm và nối các lỗ hổng phần mềm trong những codebase cực lớn và nhạy cảm. Anthropic viết rằng model đã tìm “thousands of high-severity vulnerabilities”, trong một số trường hợp “nearly all” được model phát hiện và phát triển exploit “entirely autonomously”. Đồng thời, Anthropic nói sức mạnh cyber này là hệ quả của “strong agentic coding and reasoning skills”. Nói cách khác, năng lực agentic không phải là lớp ngoài trang trí, mà là phần lõi của sản phẩm. citeturn9view0
51
+
52
+ Ở tầng prompt/orchestration, artefact rò rỉ cho thấy một bố cục kiểu “modular constitution” với nhiều khối chỉ dẫn: product info, refusal handling, child safety, legal/financial, user wellbeing, political evenhandedness, memory, knowledge cutoff, web-search defaults, v.v. Tệp này còn thể hiện một budget token rất lớn và một phong cách chỉ đạo công cụ có tính vận hành, không chỉ mang tính “chat persona”. Dù chưa thể coi đó là prompt chính thức cuối cùng, nó rất phù hợp với cách các model frontier hiện nay thường được ghép bởi nhiều lớp: **model nền + system stack + policy stack + tool router + memory adapter**. fileciteturn0file0
53
+
54
+ Anthropic còn xác nhận Fable 5 có bộ nhớ và long-context mạnh hơn đáng kể, có thể “stays focused across millions of tokens” và cải thiện đầu ra bằng “its own notes”. Điều này đặc biệt quan trọng cho thiết kế hệ đa tác tử: nếu manager cố nhồi mọi log và mọi intermediate output vào một luồng duy nhất, hiệu năng sẽ suy giảm. OpenAI mô tả chính hiện tượng này là “context pollution” và “context rot”, và khuyến nghị subagent chỉ đưa trả **summary đã chưng cất** thay vì đổ log thô vào thread chính. Tôi cho rằng đây là manh mối rất mạnh cho cách một hệ kiểu Fable 5 nên được tổ chức: manager giữ context điều hành; worker thực hiện phần “ồn”; chỉ các kết luận đã cấu trúc mới quay lại main thread. citeturn8view0turn30view4
55
+
56
+ Từ các nguồn chính thức của OpenAI và Google, ta còn thấy một mẫu hội tụ của kiến trúc agent hiện đại. OpenAI phân biệt rất rõ giữa **handoffs** và **agents-as-tools**: nếu specialist nên nắm luôn nhánh hội thoại, dùng handoff; nếu manager vẫn phải chịu trách nhiệm câu trả lời cuối, gọi specialist như tool. Google thì đóng gói managed agent trong một Linux sandbox, cho phép code execution, web browse, file handling, MCP, collaborative planning và background execution. Hai nhà cung cấp khác nhau nhưng cùng hội tụ vào một ý: orchestration hiệu quả là **phân quyền có ranh giới**, không phải thả tự do nhiều agent tranh nhau làm việc. citeturn29view1turn22view0turn23view0
57
+
58
+ Bảng sau tóm tắt các pattern điều phối có thể suy ra và lý do chúng quan trọng.
59
+
60
+ | Pattern điều phối | Dấu hiệu từ nguồn | Ý nghĩa kỹ thuật | Failure mode nếu thiếu |
61
+ |---|---|---|---|
62
+ | Safety router ngoài model | Fable classifier + fallback sang Opus 4.8. citeturn8view0 | Giảm rủi ro bằng degrade path thay vì chỉ từ chối | False positive, route nhầm, hoặc bypass classifier |
63
+ | Manager giữ thread chính; worker trả summary | OpenAI mô tả context pollution/context rot; subagent trả distilled takeaways. citeturn30view4 | Bảo vệ context quyết định khỏi log ồn | Context window bị “thối”, chất lượng synth giảm |
64
+ | Parallel read-only workers | Claude docs khuyến nghị parallel tool calls; Codex dùng parallel agents cho exploration/tests/triage; Gemini hỗ trợ parallel function calling. citeturn26view0turn30view4turn20view2 | Tăng tốc mà ít xung đột | Race condition, duplicate work, token burn |
65
+ | Explicit subagent policy | Opus 4.8 spawn ít subagent hơn mặc định; Codex không spawn tự động nếu không yêu cầu. citeturn27view0turn30view4 | Tránh delegation mơ hồ và khó debug | Under-delegation hoặc over-delegation |
66
+ | Resumable state + approvals | OpenAI approvals dùng interruptions + state; Gemini research dài phải background/poll. citeturn29view2turn29view4turn23view0 | Cho workflow dài và side-effect an toàn | Mất trạng thái, chạy lại sai, side-effect không duyệt |
67
+ | Memory qua notes/files, không dựa vào hidden thoughts | Fable dùng own notes; Gemini có thought summaries; OpenAI reasoning tokens không được giữ như transcript hữu ích. citeturn8view0turn21view4turn17view2 | Dùng summary hữu hình làm state chuẩn | Phụ thuộc mù vào hidden reasoning, khó audit |
68
+
69
+ Hai bài phân tích học thuật gần hơn với phần “giải phẫu rủi ro” cũng đáng chú ý. “Benchmarking Mythos-Linked Bug Rediscovery” cho thấy failure mode phổ biến của model khi làm cyber analysis là **chốt quá sớm vào một ứng viên có vẻ hợp lý nhưng sai**; điều này ủng hộ mạnh cho việc phải có critic/verifier độc lập trong hệ đa agent. “Mythos and the Unverified Cage” thì lập luận rằng ngay cả khi behavior guardrails tốt, hạ tầng sandbox và tool boundary vẫn có thể là điểm vỡ, nên containment phải được xem như một lớp kỹ thuật độc lập cần kiểm chứng. citeturn5academia14turn5academia20
70
+
71
+ ## Hàm ý thiết kế cho hệ tương thích Opus 4.8, GPT-5.5 và Gemini
72
+
73
+ Tôi hiểu “ChatGPT 5.5” ở đây theo nghĩa model GPT-5.5 trong tài liệu chính thức của OpenAI, vì docs hiện dùng tên model ID là `gpt-5.5` và không nêu một model ID riêng gọi là “chatgpt-5.5”. Với mục tiêu xây một orchestration layer chung, đó là cách hiểu thực dụng nhất. citeturn17view1
74
+
75
+ Bảng dưới đây là các ràng buộc và đặc điểm thực dụng nhất khi triển khai cùng một workflow trên ba họ model.
76
+
77
+ | Nền tảng | Ràng buộc và strengths chính | Hệ quả cho workflow |
78
+ |---|---|---|
79
+ | **Claude Opus 4.8** | Anthropic ghi rõ Opus 4.8 có context 1M mặc định, nhưng trên Microsoft Foundry mặc định chỉ 200k; adaptive thinking **không bật mặc định**; với use case coding/agentic nên bắt đầu từ `xhigh` và tối thiểu `high`; nếu chạy `max` hoặc `xhigh` thì nên cấp max output lớn, bắt đầu từ 64k; model thiên về reasoning hơn tool calls, và spawn ít subagent hơn mặc định. citeturn27view3turn27view1turn27view0 | Cần **nói thẳng** khi nào dùng tool, khi nào spawn subagent, khi nào song song, và khi nào không. Opus 4.8 là specialist mạnh, nhưng orchestration tốt phải rất explicit. |
80
+ | **GPT-5.5** | OpenAI docs nêu GPT-5.5 có context 1M, max output 128K, reasoning levels từ `none` tới `xhigh`, tools gồm functions, web search, file search, computer use; reasoning tokens không hiển thị nhưng vẫn tiêu tốn token/context trong lúc chạy; OpenAI khuyến nghị để dành khoảng 25k tokens cho reasoning + outputs khi bắt đầu thử nghiệm. citeturn17view1turn17view2turn17view4 | Rất hợp làm **manager/synthesizer** hoặc orchestrator chính. Cần budgeting token thật chặt, và nên dùng Agents SDK pattern “handoff vs asTool” thay vì prompt mơ hồ. |
81
+ | **Gemini** | Google docs nêu nhiều model Gemini có context 1M+; thinking là dynamic mặc định, có `thinkingLevel`; function calling có các mode `VALIDATED`, `AUTO`, `ANY`, `NONE`; hỗ trợ parallel function calling; managed agents chạy trong Linux sandbox; outbound network mặc định mở, có thể allowlist hoặc disable; Deep Research Agent cần `background=true`, hỗ trợ collaborative planning, MCP và file search. citeturn20view5turn21view4turn20view3turn20view2turn22view0turn23view3turn23view0turn23view1 | Tốt cho **research async**, sandboxed execution và tích hợp tool bên ngoài. Nhưng phải khóa network/tooling chủ động; nếu không, phạm vi hành động mặc định quá rộng cho nhiều use case doanh nghiệp. |
82
+
83
+ Ba nhà cung cấp cũng cho ba “ngôn ngữ prompt” hơi khác nhau. Anthropic ưu tiên rõ ràng, role setting, XML tags, explicit tool guidance và model-specific tuning; OpenAI nghiêng về kết hợp prompt với orchestration primitives trong SDK; Google cho phép system_instruction, AGENTS.md, SKILL.md, tool modes và collaborative planning. Vì vậy, một base prompt đủ tốt phải ở mức trừu tượng vừa phải, còn các “delta prompt” hoặc runtime adapter mới là nơi tối ưu hành vi đặc thù của từng model. citeturn26view0turn29view1turn23view5turn23view6
84
+
85
+ Về memory/state, không nên coi hidden reasoning như bộ nhớ có thể tin cậy. OpenAI nói reasoning tokens không được giữ như history hữu ích cho bước sau; Google chỉ cho thought summaries/thought signatures với mục đích hỗ trợ; Anthropic lại nhấn vào “notes” và file-based memory. Vì vậy, mọi workflow nghiêm túc nên chuẩn hóa state ngoài model bằng một **work ledger** hữu hình: plan hiện tại, danh sách worker, kết quả đã xác minh, unresolved questions, citations, và danh sách side-effect pending approval. Đây là điểm quan trọng nhất để hệ chạy qua nhiều turn và nhiều model mà không lệ thuộc vào đặc thù hidden state của từng hãng. citeturn17view2turn21view4turn8view0turn29view4
86
+
87
+ ## System prompt và workflow đề xuất
88
+
89
+ ### Prompt nền tảng đề xuất
90
+
91
+ Đây là một **prompt gốc mới**, lấy cảm hứng từ các pattern đã xác minh, nhưng không sao chép prompt rò rỉ.
92
+
93
+ ```xml
94
+ <system>
95
+ <identity>
96
+ You are an orchestrating research-and-execution agent.
97
+ Your job is to produce high-quality, verifiable results by coordinating bounded specialist workers.
98
+ </identity>
99
+
100
+ <core_principles>
101
+ Prefer accuracy over speed when they conflict.
102
+ Keep the main thread clean: do not dump raw logs, raw tool output, or long exploratory notes into the main conversation.
103
+ Never rely on hidden chain-of-thought as shared memory. Use explicit summaries, plans, and state objects.
104
+ Use tools when they materially improve correctness, freshness, or grounding.
105
+ If the task may cause external side effects or touches high-risk domains, stop and require approval or switch to safe mode.
106
+ </core_principles>
107
+
108
+ <orchestration_policy>
109
+ First classify the task into one of:
110
+ research | coding | analysis | retrieval | synthesis | high-risk | mixed.
111
+ If mixed, decompose into bounded subproblems.
112
+
113
+ Create a work plan with:
114
+ - objective
115
+ - deliverable format
116
+ - required evidence
117
+ - tool budget
118
+ - approval requirements
119
+ - context budget
120
+ - stop conditions
121
+
122
+ Spawn specialist workers only when delegation creates clear value:
123
+ - parallel reading or retrieval
124
+ - independent comparisons
125
+ - verification or criticism
126
+ - large-context partitioning
127
+ - specialized tooling
128
+
129
+ Do not spawn workers for trivial work that can be done directly.
130
+ Prefer parallel workers for read-heavy tasks.
131
+ Prefer sequential execution for write-heavy or state-mutating tasks.
132
+ </orchestration_policy>
133
+
134
+ <worker_contract>
135
+ Every worker receives:
136
+ - task_id
137
+ - role
138
+ - objective
139
+ - allowed_tools
140
+ - constraints
141
+ - dependencies
142
+ - output_schema
143
+
144
+ Every worker must return a structured result:
145
+ {
146
+ "task_id": "...",
147
+ "status": "done|blocked|needs_clarification|unsafe",
148
+ "summary": "...",
149
+ "key_facts": [],
150
+ "evidence": [{"source": "...", "claim": "..."}],
151
+ "uncertainties": [],
152
+ "risk_flags": [],
153
+ "recommended_next_actions": []
154
+ }
155
+
156
+ Workers must return distilled findings, not raw internal reasoning.
157
+ </worker_contract>
158
+
159
+ <verification_policy>
160
+ For consequential claims, route at least one verifier/critic pass.
161
+ If sources conflict, surface the disagreement instead of averaging them away.
162
+ If evidence is weak, say so explicitly.
163
+ </verification_policy>
164
+
165
+ <context_policy>
166
+ Maintain a visible work ledger:
167
+ - current_plan
168
+ - completed_tasks
169
+ - pending_tasks
170
+ - verified_facts
171
+ - open_questions
172
+ - pending_approvals
173
+
174
+ Compact aggressively:
175
+ - keep requirements, decisions, verified facts, and citations
176
+ - discard noisy logs after summarizing them
177
+ - when context is large, summarize each branch before synthesis
178
+ </context_policy>
179
+
180
+ <safety_policy>
181
+ Never provide disallowed harmful instructions.
182
+ Place validation at the tool boundary.
183
+ Require approval before:
184
+ - file mutation
185
+ - network actions outside allowlist
186
+ - transactions
187
+ - sending messages
188
+ - executing dangerous code
189
+ - operating on sensitive data
190
+ If a request is dual-use or policy-sensitive, respond safely, narrow scope, or route to a safer fallback model.
191
+ </safety_policy>
192
+
193
+ <final_answer_policy>
194
+ Final answers should contain:
195
+ - concise executive summary
196
+ - main findings
197
+ - uncertainty notes
198
+ - citations or evidence references
199
+ - recommended next actions, if useful
200
+ Provide brief progress updates during long runs, but do not narrate every micro-step.
201
+ </final_answer_policy>
202
+ </system>
203
+ ```
204
+
205
+ Prompt này bám rất sát những gì cả ba ecosystem đều hỗ trợ tốt: Anthropic thích XML, explicit delegation và tool guidance; OpenAI hỗ trợ manager–specialist boundary rõ ràng; Google hỗ trợ system_instruction + file/skill mounting + collaborative planning. citeturn26view0turn27view1turn27view0turn29view1turn23view5turn23view6
206
+
207
+ ### Workflow điều phối đề xuất
208
+
209
+ Quy trình thực thi nên đi theo các bước dưới đây.
210
+
211
+ 1. **Intake và phân loại rủi ro.** Manager xác định nhiệm vụ là research, coding, synthesis, mixed hay high-risk; đồng thời đặt deliverable contract và lựa chọn adapter theo model. Với yêu cầu có khả năng mới/động, manager ưu tiên web/retrieval thay vì trả lời từ memory. Điều này phù hợp với rulebooks chính thức của Anthropic, OpenAI và Google về current/fresh information, tools và agent planning. citeturn8view2turn16view0turn22view0
212
+
213
+ 2. **Lập kế hoạch có cấu trúc.** Đối với bài toán lớn, manager tạo plan trước khi chạy. Nếu dùng Gemini Deep Research, có thể bật collaborative_planning để người dùng duyệt plan trước khi execution; với GPT-5.5 hoặc Opus 4.8 không có primitive y hệt, plan này nên được dựng ở application layer bằng một “planning pass” đầu tiên. citeturn23view0turn29view1
214
+
215
+ 3. **Fan-out sang worker read-only hoặc bounded specialists.** Các công việc như đọc nhiều tài liệu, tra cứu nhiều nguồn, tách một corpus dài, hay so sánh nhiều phương án nên được song song hóa; việc sửa file, ghi DB, gửi email hay side-effect khác phải đi tuần tự. Cả Anthropic và OpenAI đều nhấn mạnh giá trị của parallel tool/agent calls cho read-heavy work, còn OpenAI cảnh báo ghi song song dễ tạo xung đột. citeturn26view0turn30view4
216
+
217
+ 4. **Chuẩn hóa kết quả worker.** Mỗi worker chỉ được trả về summary + evidence + uncertainty + risk flags theo schema chuẩn. Không đưa raw chain-of-thought, không đưa toàn bộ command logs lên main thread. Đây là cơ chế giảm context rot mạnh nhất và là điểm then chốt để chạy cùng lúc trên nhiều provider. citeturn30view4turn17view2turn21view4
218
+
219
+ 5. **Critic/verifier pass.** Một worker độc lập hoặc chính manager ở chế độ verifier so chéo các results, tìm mâu thuẫn, phát hiện “early commitment” hay nguồn yếu. Đây là lớp nên có đối với mọi tác vụ mà sai số không chấp nhận được. citeturn5academia14turn29view1
220
+
221
+ 6. **Safety gate và approval gate.** Trước mỗi side effect hoặc khi rơi vào vùng dual-use, workflow dừng ở approval boundary. OpenAI có primitives chính thức cho approvals và resumable state; Gemini có background state trong Interactions/managed agents; với Anthropic cần tự cài ở app/tool layer. citeturn29view2turn29view4turn23view0turn22view0
222
+
223
+ 7. **Synthesis cuối.** Manager tạo câu trả lời cuối từ verified facts và citations, đồng thời lưu work ledger đã compacted cho turn sau. Người dùng chỉ thấy plan đã duyệt, tiến độ ở mức hợp lý, kết quả, uncertainty và references; họ không cần thấy toàn bộ nội bộ reasoning. citeturn29view4turn26view0
224
+
225
+ ```mermaid
226
+ flowchart TD
227
+ A[Yêu cầu người dùng] --> B[Intake + phân loại rủi ro]
228
+ B --> C[Lập kế hoạch và budget]
229
+ C --> D{Cần chia việc?}
230
+ D -- Không --> E[Manager xử lý trực tiếp]
231
+ D -- Có --> F[Spawn worker read-only hoặc bounded specialists]
232
+ F --> G[Worker trả summary có cấu trúc]
233
+ G --> H[Critic hoặc verifier so chéo]
234
+ E --> H
235
+ H --> I{Có side effect hoặc rủi ro cao?}
236
+ I -- Có --> J[Approval hoặc fallback safe mode]
237
+ I -- Không --> K[Synthesis cuối]
238
+ J --> K
239
+ K --> L[Lưu work ledger đã compact]
240
+ L --> M[Trả kết quả có chứng cứ]
241
+ ```
242
+
243
+ ### Cơ chế fallback và an toàn
244
+
245
+ Hệ tối thiểu nên có bốn fallback.
246
+
247
+ Thứ nhất là **capability fallback**: nếu model chính không nên trả lời vì guardrail classifier, do policy, hoặc vì tool surface không phù hợp, route sang model ít quyền hơn nhưng an toàn hơn, đúng tinh thần Fable 5 → Opus 4.8. citeturn8view0
248
+
249
+ Thứ hai là **context fallback**: khi tiến gần ngưỡng context, thay vì tiếp tục append transcript, hệ buộc compact thành ledger summaries. Điều này đặc biệt quan trọng với GPT-5.5 vì reasoning tokens vẫn ăn budget, và với mọi workflow multi-agent vì context rot. citeturn17view2turn30view4
250
+
251
+ Thứ ba là **tool fallback**: nếu network không cần thiết, disable mạng; nếu cần, allowlist domain; nếu tool external quá rộng, giới hạn allowed tools hoặc dùng function mode chặt hơn như `VALIDATED` hoặc `ANY` tuỳ mục đích trên Gemini, hay `needsApproval` trên OpenAI. citeturn23view3turn20view3turn29view2
252
+
253
+ Thứ tư là **leak fallback**: đừng cố giấu mọi thứ bằng một prompt khổng lồ. Thay vào đó, đưa thông tin theo nguyên tắc need-to-know, lọc output sau sinh, và thường xuyên audit prompt/output. Cả Anthropic docs lẫn các paper về PLeak/SysVec đều ủng hộ hướng giảm nội dung nhạy cảm trong prompt và thêm lớp defensive post-processing. citeturn28view0turn5academia16turn5academia23
254
+
255
+ ## Biến thể theo model, ca kiểm thử và kiểm soát rủi ro
256
+
257
+ ### Biến thể prompt theo từng model
258
+
259
+ | Model | Delta prompt nên thêm | Vì sao |
260
+ |---|---|---|
261
+ | **Claude Opus 4.8** | “Use tools when they materially improve correctness. Spawn subagents only for parallel read-heavy work. At high-complexity tasks, prefer `xhigh` effort. If using adaptive thinking, only trigger it for multi-step reasoning. Provide concise progress updates.” citeturn27view3turn27view1turn27view0 | Opus 4.8 literal hơn, ưu tiên reasoning hơn tool calls, và spawn ít subagent mặc định. |
262
+ | **GPT-5.5** | “The manager stays responsible for the final answer unless a handoff is explicitly required. Prefer specialists as tools for bounded tasks. Keep state resumable. Reserve context headroom for reasoning.” citeturn29view1turn29view4turn17view2 | GPT-5.5 có primitives orchestration tốt nhất ở SDK/runtime; prompt nên bám kiến trúc đó. |
263
+ | **Gemini** | “If the task is large or research-heavy, produce a plan first. Use background execution for long runs. Keep network disabled unless allowlisted. Use collaborative planning when scope is uncertain. Use AGENTS.md/SKILL.md for reusable behavior and tools.” citeturn23view0turn23view3turn23view5turn23view6turn22view0 | Gemini mạnh về async research và managed agent sandbox, nhưng cần kiểm soát network/tooling chặt hơn. |
264
+
265
+ ### Ca kiểm thử khuyến nghị
266
+
267
+ | Test case | Hành vi mong đợi | Tiêu chí pass |
268
+ |---|---|---|
269
+ | **Deep research có web + tài liệu nội bộ** | Manager lập plan, spawn 2–4 worker: web researcher, document extractor, verifier, synthesizer. Nếu dùng Gemini có thể dùng collaborative planning trước khi chạy. citeturn23view0turn29view1 | Báo cáo có cấu trúc, có citations, nêu rõ uncertainties, không tràn log vào câu trả lời cuối. |
270
+ | **Codebase review read-only** | Worker song song cho security, test gaps, maintainability; không ghi file; critic hợp nhất. Pattern này gần ví dụ chính thức của Codex. citeturn30view4 | Tạo findings theo category, file references rõ, không conflict write. |
271
+ | **Tác vụ có side effect** | Model đề xuất action nhưng dừng ở approval gate; resume từ state sau khi duyệt. citeturn29view2turn29view4 | Không có side effect nào chạy trước approval. |
272
+ | **Truy vấn dual-use hoặc policy-sensitive** | Safety router route sang safe mode hoặc fallback model; không trả hướng dẫn gây hại. Fable 5 dùng chính pattern này với Opus 4.8. citeturn8view0 | Câu trả lời an toàn, có ích ở mức được phép, nêu giới hạn rõ ràng. |
273
+ | **Corpus rất dài** | Chia tài liệu theo shard, mỗi worker trả takeaway + citations, manager chỉ giữ ledger ngắn gọn. citeturn30view4turn20view5 | Không có context collapse, chất lượng synthesis ổn định. |
274
+
275
+ ### Rủi ro, misuse và giảm thiểu
276
+
277
+ | Rủi ro | Mô tả | Giảm thiểu |
278
+ |---|---|---|
279
+ | **Prompt leak / policy exfiltration** | Worker hoặc user cố kéo lộ system prompt, policy, credentials, hidden instructions. PLeak cho thấy đây là class attack thực. citeturn5academia16turn28view0 | Need-to-know prompts, output screening, prompt audits, không nhét bí mật không cần thiết vào prompt, tách credentials ra khỏi model context. |
280
+ | **Tool abuse / credential overreach** | Managed agent có mạng hoặc tool quá rộng, lạm dụng token/quyền. Gemini mặc định mở outbound network; tool có thể dùng bất kỳ credential được cấp. citeturn22view0turn23view3 | Network allowlist hoặc disable, least-privilege, short-lived tokens, approval on side effects. |
281
+ | **Context pollution / context rot** | Main thread ngập log, stack trace, command output; chất lượng quyết định giảm dần. OpenAI nêu hiện tượng này rất rõ. citeturn30view4 | Worker chỉ trả summary có cấu trúc; context compaction định kỳ; work ledger ngoài model. |
282
+ | **Parallel write conflicts** | Nhiều agent sửa cùng vùng state hoặc codebase. OpenAI khuyên cẩn trọng với write-heavy workflows song song. citeturn30view4 | Chỉ song song cho read-heavy; write theo lock hoặc serialized step. |
283
+ | **Sai tự tin do chốt sớm vào giả thuyết thuận mắt** | Paper bug-rediscovery cho thấy model dễ “early commitment”. citeturn5academia14 | Bắt buộc verifier/critic pass, yêu cầu nêu alternative hypotheses, stress-test nguồn. |
284
+ | **Tin tưởng quá mức vào behavioral safeguards** | Paper về “Unverified Cage” lập luận containment hạ tầng cũng có thể vỡ. citeturn5academia20 | Guardrail ở tool boundary, sandbox boundary, audit logs, formal verification cho infra quan trọng. |
285
+ | **False positives / degraded UX** | Fable guardrails rất chặt, có thể chặn cả yêu cầu lành tính. Anthropic thừa nhận điều này. citeturn8view0turn13news2 | Dùng degrade path thay vì refusal cứng; hiển thị lý do ở mức khái quát; có escalation path cho trusted users. |
286
+
287
+ ## Kết luận và giới hạn còn mở
288
+
289
+ Kết luận mạnh nhất của nghiên cứu này là: **điểm đáng học từ Fable 5 không phải một “prompt ma thuật”, mà là kiến trúc điều phối nhiều lớp**. Phần cốt lõi có vẻ là frontier model rất mạnh; phần tạo nên sản phẩm vận hành được là safety router, memory discipline, bounded subagenting, structured summaries, resumable state, approvals và tool/network governance. Điều này khớp cùng lúc với Anthropic public materials, với docs mới của OpenAI về handoffs/asTool/state/approvals, và với Google managed agents/Deep Research/collaborative planning. citeturn8view0turn9view0turn29view1turn29view2turn29view4turn22view0turn23view0
290
+
291
+ Nếu phải triển khai ngay một hệ tương đương đa nền tảng, tôi sẽ chọn **GPT-5.5 làm manager/synthesizer**, **Claude Opus 4.8 làm deep specialist cho coding/analysis**, và **Gemini làm async research runner hoặc sandboxed execution surface**. Nhưng cùng một design vẫn có thể chạy đơn nền tảng nếu giữ được năm bất biến: plan-first, bounded workers, structured worker schema, explicit safety/approval boundaries, và work ledger ngoài model. Đây là phần “portable architecture” thực sự. citeturn17view1turn29view1turn27view3turn23view0turn22view0
292
+
293
+ Giới hạn chính của báo cáo là hai điểm. Thứ nhất, tôi không xác minh được một bộ thread Reddit/Hacker News/X nguyên bản, giàu chi tiết kỹ thuật về sub-agent coordination của Fable 5, trong tập nguồn đã truy xuất; phần “community trace” vì vậy kém đầy đủ hơn mong muốn. Thứ hai, tệp prompt do người dùng cung cấp rất hữu ích như một artefact, nhưng vẫn là nguồn chưa được xác thực công khai; tôi đã dùng nó như tín hiệu thiết kế, không như chứng cứ kết luận. Dù vậy, ngay cả khi bỏ hẳn artefact này ra, các nguồn chính thức vẫn đủ để suy ra một workflow hệ đa tác tử tương đương, an toàn hơn và portable hơn nhiều so với việc cố tái hiện noe exact leaked prompt. fileciteturn0file0 citeturn8view0turn9view0turn26view0turn29view1turn22view0
@@ -0,0 +1,135 @@
1
+ # GEMINI.md — Antigravity v12.5
2
+
3
+ > Rules only. Updated: 2026-05-22
4
+
5
+ ---
6
+
7
+ ## Identity
8
+
9
+ - Bạn là **Antigravity Orchestrator**.
10
+ - Pragmatic. Regression-averse. Symphony-first. Multi-project.
11
+
12
+ ---
13
+
14
+ ## Session Protocol
15
+
16
+ > [!CAUTION]
17
+ > MỌI session code/debug/plan PHẢI chạy init chain TRƯỚC action. Bỏ qua = vi phạm.
18
+
19
+ ### Init Chain (BẮT BUỘC)
20
+ ```
21
+ symphony-orchestrator → awf-session-restore (gitnexus state) → nm-memory-sync → orchestrator → action
22
+ ```
23
+
24
+ - **Ngoại lệ:** Câu hỏi đơn giản hoặc user yêu cầu bỏ qua.
25
+ - **Exit Protocol:** Task done → `symphony next` + present "Next steps" (gồm `🧘 Dừng phiên` nếu ≥3 tasks done hoặc xong Gate lớn). nm-memory-sync auto-save. Deploy/push → check in-progress tasks trước.
26
+ - **Context Recovery:** Re-read `.project-identity`, GEMINI.md, chạy `nmem_recall`, thông báo user.
27
+ - **File-Level Guards:** Khi sửa `symphony/**/*.json`, `.project-identity`, hoặc `**/SKILL.md` → Đọc lại SKILL.md tương ứng.
28
+
29
+ ---
30
+
31
+ ## Rules
32
+
33
+ ### Code
34
+ - Production quality. File < 500 lines.
35
+ - Không sửa code ngoài scope. Không hardcode secrets → `.env`. Không `git reset --hard`.
36
+ - AI models: Gemini 2.5+ hoặc mới hơn. Firebase: Firebase AI Logic SDK.
37
+
38
+ ### Auto-Commit After Build (BẮT BUỘC)
39
+ - Build OK → TỰ ĐỘNG `git add` → `git commit` → `git push`. KHÔNG hỏi user.
40
+ - Commit: conventional format. Push (non-force) SafeToAutoRun=true.
41
+ - Push fail → retry `git pull --rebase && git push` 1 lần. Vẫn fail → báo user, KHÔNG force push.
42
+
43
+ ### Command Wrapper & Build Automation
44
+ - Build: CHỈ dùng `awkit build`. CẤM gọi native (`xcodebuild`, `./gradlew`, `npm run build`).
45
+ - `automation.build.enabled: false` → DỪNG, báo user. KHÔNG fallback native.
46
+ - Thêm params qua `--`: `awkit build -- -destination '...'`. Bypass wrapper = VI PHẠM.
47
+
48
+ ### 7-Gate System
49
+ - Triage: TRIVIAL (→ Gate 4 thẳng) | MODERATE (→ G3+4+5) | COMPLEX (→ all gates).
50
+ - Gates: G1 brainstorm → G1.5 module-spec (COMPLEX+>3mod) → G2 spec-gate → G2.5 visual (skip nếu backend) → G3 symphony-enforcer → G4 execution → G5 verification.
51
+ - **Gate 4 Three-Phase:**
52
+ - Phase A 🏗️ Infrastructure → B 🎨 UI Shell (mock) → C ⚡ Logic (real data).
53
+ - COMPLEX+UI: 3 phases bắt buộc. MODERATE+UI: A+C gộp, B optional. TRIVIAL: bypass.
54
+ - Phase B xong → **DỪNG, chờ "APPROVE UI"**. Gộp B+C = vi phạm.
55
+ - Mỗi feature Phase C xong → checkpoint user test.
56
+ - Kiro: `.kiro/specs/` → auto-accelerate G1,1.5,2,3.
57
+ - **Gate 2 Claude Planner (New):** Khi Gate 2 (Spec/Architecture Planning) kích hoạt cho MODERATE hoặc COMPLEX tasks, AI tự động chạy `claude-planner` bằng cách gọi `scripts/claude-plan.js`. Nếu Claude CLI chưa cài hoặc hết hạn (lệnh lỗi), AI tự động bỏ qua và sử dụng mô hình hiện tại để lập kế hoạch một cách bình thường.
58
+ - Sửa schema/UI ngoài approved design → ⛔ DỪNG quay G2/2.5.
59
+ - Chi tiết: `orchestrator/SKILL.md` + `symphony-enforcer/SKILL.md`.
60
+
61
+ ### Mindful Stop
62
+ - Iterate ≥3 lần trên 1 feature → DỪNG: "⏸️ Đề xuất commit và trải nghiệm thực tế."
63
+ - Keywords [polish, optimize, refine, tối ưu, tweak] → hỏi "Vấn đề cụ thể? Hay phòng ngừa?" → không rõ → backlog P2.
64
+ - ≥3 tasks done hoặc xong Gate lớn → suggest "🧘 Dừng phiên".
65
+ - KHÔNG tự đề xuất tối ưu trừ security/crash bug.
66
+
67
+ ### NeuralMemory
68
+ - Brain = projectId. PHẢI switch brain TRƯỚC mọi nmem call.
69
+ - `nmem_remember()` tag projectId. Cross-brain: `nmem_recall(query, brains=["default", projectId])`.
70
+
71
+ ### Anti-Yapping & Token Optimization
72
+ - Sau khi dùng tool sửa code → KHÔNG in lại code trong chat. Tóm tắt bằng bullets.
73
+ - Code block trong chat: tối đa 10 dòng. Show diff → dùng `render_diffs()`.
74
+
75
+ ### Image Generation Efficiency
76
+ - Image gen: grid/spritesheet cho batch variants, không gen từng ảnh rời.
77
+
78
+ ### Communication (CAVEMAN ULTRA)
79
+ - Chat: Tiếng Việt, tối đa 1-2 câu ngắn. Code/Docs: Tiếng Anh.
80
+ - CẤM giải thích dài, chào hỏi. Chỉ xuất KẾT QUẢ.
81
+ - Planning artifacts (implementation_plan.md, walkthrough.md) VẪN chi tiết theo format chuẩn.
82
+ - Tài liệu thảo luận & brainstorm (Brief, Requirements, Brainstorm) PHẢI dùng tiếng Việt (hoặc ngôn ngữ giao tiếp của User), chỉ Code/Architecture mới bắt buộc dùng tiếng Anh.
83
+
84
+ ### Brainstorm & Plan Integrity (BPIP)
85
+ - CẤM ghi đè (overwrite) toàn bộ BRIEF.md hoặc plan.md khi tinh chỉnh ý tưởng.
86
+ - PHẢI sử dụng công cụ sửa code (replace_file_content) để cập nhật từng phần.
87
+ - PHẢI duy trì bảng Revision History ở đầu mỗi file design/planning.
88
+ - PHẢI lưu bản sao dự phòng vào `docs/history/` trước khi sửa đổi lớn (định dạng `[filename].v[N].md`, ví dụ: `implementation_plan.v1.md`).
89
+
90
+
91
+ ### Anti-sycophancy
92
+ - Push back khi approach có vấn đề. Nêu ưu+nhược, không chỉ list ưu điểm.
93
+ - Cảnh báo TRƯỚC khi implement nếu vi phạm best practices. Nói "Tôi không chắc" khi không chắc.
94
+
95
+ ### Safety Guardrails
96
+ - CẤM SafeToAutoRun cho: recursive delete (`rm -rf`), force push, `DROP/DELETE` (no WHERE), docker prune, publish, deploy production.
97
+ - Commit: CHỈ qua `awkit gate git auto`. CẤM `git commit` trực tiếp qua bash.
98
+ - Destructive command → double-confirm user. Không chắc → hỏi trước.
99
+
100
+ ### Mandatory Check-Then-Act Protocol (🔥 BẮT BUỘC)
101
+ - TRƯỚC khi dùng công cụ sửa code/run command lần đầu mỗi task, PHẢI tự trả lời trong `<thought>` (KHÔNG in ra chat):
102
+ 1. Init Chain đã chạy?
103
+ 2. KIẾN TRÚC: Đã xem CODEBASE.md? Đang sửa Definition (gốc) hay Usage (ngọn)? (Cấm grep bừa bãi).
104
+ 3. Sửa symbol lớn? → `gitnexus_impact` trước.
105
+ 4. Commit → `awkit gate git auto` only.
106
+
107
+ ### Decision Principles
108
+ Complete>Shortcuts, Evidence>Assumptions, Standard>Custom, Explicit>Implicit, Test>Trust, Small>Big, Root>Leaves.
109
+
110
+ ### Project Context
111
+ - CODEBASE.md tồn tại → KHÔNG scan raw directory.
112
+ - KHÔNG hỏi user về project structure.
113
+ - CODEBASE.md outdated → ghi chú "⚠️ dùng /codebase-sync".
114
+
115
+ ### Tư Duy Kiến Trúc & GitNexus (Anti-Grep-First)
116
+ - **Top-Down:** LUÔN đọc `CODEBASE.md` trước để map requirement vào đúng Layer kiến trúc.
117
+ - **Root > Leaves:** Đổi GIÁ TRỊ → Tìm Definition (gốc: theme, config, entity). CẤM grep blind value ở Usage (ngọn).
118
+ - **GitNexus Graph:** Có Anchor Class → `gitnexus_context` để hiểu luồng, `gitnexus_impact` TRƯỚC KHI sửa.
119
+ - `.gitnexus/` tồn tại → BẮT BUỘC dùng GitNexus. `gitnexus_detect_changes()` trước commit.
120
+ - Chi tiết: `gitnexus-intelligence/SKILL.md`.
121
+
122
+ ### Kiro Specs
123
+ - `.kiro/specs/` tồn tại → source of truth: requirements.md (G1+1.5 AUTO-PASS), design.md (G2 AUTO-APPROVE), tasks.md (G3 AUTO-IMPORT).
124
+ - Gate 4 code PHẢI đối chiếu `.kiro/specs/<module>/`. Chi tiết: `orchestrator/SKILL.md`.
125
+
126
+ ---
127
+
128
+ ## Routing
129
+
130
+ - **Execution order:** `symphony-orchestrator` → `awf-session-restore` (gitnexus state) → `nm-memory-sync` → `symphony-enforcer` → `orchestrator` (triage + gate-check) → action
131
+ - **Gate skills:** `orchestrator` (triage) → `brainstorm-agent` (G1) → `module-spec-writer` (G1.5) → `spec-gate` (G2) → `visual-design-gate` (G2.5) → `symphony-enforcer` (G3) → `verification-gate` (G5)
132
+ - **Code intelligence:** `gitnexus-intelligence` (impact analysis, blast radius, safe refactoring)
133
+ - **Skill catalog:** xem `orchestrator/SKILL.md`
134
+ - **Workflows:** 75+ (`/xxx`). Core: `/init` `/code` `/debug` `/recap` `/next` `/todo` `/gitnexus`
135
+ - **Shortcuts:** `/todo` `/done` `/next`
@@ -0,0 +1,55 @@
1
+ # Product Requirements Document (PRD) — MemoizedFibonacci
2
+
3
+ ## Revision History
4
+
5
+ | Version | Date | Author | Description |
6
+ | :--- | :--- | :--- | :--- |
7
+ | 1.0 | 2026-06-22 | Antigravity Orchestrator | Initial draft for MemoizedFibonacci feature. |
8
+
9
+ ---
10
+
11
+ ## 1. Vision & Objectives
12
+
13
+ * **Project Summary:** The `MemoizedFibonacci` feature provides a highly optimized, high-performance utility class/module for calculating Fibonacci sequences. It leverages an advanced caching (memoization) mechanism to avoid the exponential time complexity $O(2^n)$ associated with naive recursive methods, turning sequence generation into a linear time $O(n)$ or constant-time $O(1)$ operation for subsequent lookups.
14
+ * **Problem Statement:** Standard recursive calculations of Fibonacci numbers quickly exhaust CPU resources and crash due to call stack size limits or integer overflows when $n \ge 79$ in standard floating-point representation. Naive memory caches can also grow indefinitely, leading to memory leaks in server environments.
15
+ * **Target Audience:** Core application developers, backend engineers running mathematical modeling services, and background agents requiring sequence calculations.
16
+
17
+ ---
18
+
19
+ ## 2. Core Principles & Philosophy
20
+
21
+ * **Performance & Scalability:** Constant lookups $O(1)$ for cached values, linear complexity $O(n)$ for first-time calculations.
22
+ * **Robustness & Accuracy:** Complete support for `BigInt` calculations to prevent integer overflow beyond JS safe limit ($n > 78$).
23
+ * **Memory Safety & Self-Regulation:** Integrated Least Recently Used (LRU) cache eviction strategy to guarantee a fixed maximum memory footprint.
24
+ * **Non-Blocking Operation:** Heavy calculations ($n \ge 100,000$) must run asynchronously (chunked loops or offloaded execution) to prevent thread/event-loop blockage.
25
+
26
+ ---
27
+
28
+ ## 3. Scope & Feature List
29
+
30
+ ### In Scope
31
+ * **Multiple Calculation Modes:** Synchronous calculations for small inputs; asynchronous (non-blocking) computation for larger values.
32
+ * **Flexible Precision:** Standard JS numbers for fast calculations ($n \le 78$) and `BigInt` for arbitrarily large numbers.
33
+ * **LRU Caching Strategy:** A bounded in-memory cache that automatically evicts least recently accessed Fibonacci numbers when the maximum cache capacity is reached.
34
+ * **Cache Metrics:** Reporting of cache metrics such as hit rate, miss rate, current size, and eviction count.
35
+ * **Resource Guardrails:** Hard limits on inputs to prevent CPU exhaustion.
36
+
37
+ ### Out of Scope
38
+ * **Negative/Fractional Fibonacci:** No support for negative numbers or fractional inputs (standard integer sequence only).
39
+ * **Distributed Cache integration:** No built-in Redis/Memcached integration (limited to localized, bounded memory cache with extensible hooks).
40
+
41
+ ---
42
+
43
+ ## 4. Key Performance Indicators (KPIs)
44
+
45
+ * **Execution Time (Cached):** Sub-microsecond response time for any cached value.
46
+ * **Execution Time (Uncached):** Linear scaling $O(n)$. Computing $F(10000)$ uncached must complete in under 5 milliseconds.
47
+ * **Call Stack Safety:** Zero recursion-based Call Stack Size Exceeded errors.
48
+ * **Memory Limit:** Strict enforcement of maximum cache entries (e.g. defaults to 1,000 values), keeping peak memory consumption under 25MB even for large BigInts.
49
+
50
+ ---
51
+
52
+ ## 5. Anti-Patterns (What NOT to do)
53
+ * Do not use recursive calls without tail call optimization or loop conversion. Recursion is forbidden for calculations.
54
+ * Do not store calculated BigInt values as standard floats since precision is lost.
55
+ * Do not allow the cache size to grow indefinitely (bounded cache is mandatory).