@leejungkiin/awkit 1.0.0

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 (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,195 @@
1
+ ---
2
+ description: ➡️ Không biết làm gì tiếp? (v5.0 - Beads + Brain)
3
+ ---
4
+
5
+ # WORKFLOW: /next - The Smart Compass (Beads + Brain Navigator)
6
+
7
+ > **Mục tiêu:** Phân tích context từ Beads (Tasks) và Brain (Plans/Knowledge) để gợi ý bước tiếp theo CHÍNH XÁC.
8
+
9
+ ---
10
+
11
+ ## Giai đoạn 1: Multi-Source Context Check (Tự động)
12
+
13
+ ### 1.1. Priority 1: Check Beads (Task Tracker)
14
+ ```bash
15
+ bd list --status in_progress
16
+ ```
17
+
18
+ **Case A: Có task đang làm dở**
19
+ ```
20
+ 📿 **Beads Context:**
21
+ Task #123: "Implement Login API" (in_progress)
22
+ └─ Started: 2 hours ago
23
+ └─ Blocker: None
24
+
25
+ ➡️ **Bước tiếp theo:**
26
+ 1️⃣ Tiếp tục task này? `/code` (AI sẽ tự load context)
27
+ 2️⃣ Xem chi tiết task? `bd show 123`
28
+ 3️⃣ Chuyển sang task khác? `bd list`
29
+ ```
30
+
31
+ **Case B: Không có task in_progress**
32
+ ```bash
33
+ bd list --status open
34
+ ```
35
+ → Hiển thị danh sách tasks đang chờ (ready to start).
36
+
37
+ ### 1.2. Priority 2: Check Brain (Plans & Knowledge)
38
+ ```
39
+ if exists("brain/active_plans.json"):
40
+ → Đọc plan đang active
41
+ → Parse progress từ plan.md
42
+ else:
43
+ → Tìm folder plans/ mới nhất
44
+ ```
45
+
46
+ **Từ Brain lấy được:**
47
+ - Feature đang làm
48
+ - Phase hiện tại
49
+ - Tasks trong phase (so sánh với Beads)
50
+
51
+ ### 1.3. Priority 3: Check Git State (Fallback)
52
+ - `git status` → File nào đang thay đổi?
53
+ - `git log -1` → Commit gần nhất?
54
+
55
+ ---
56
+
57
+ ## Giai đoạn 2: Smart Recommendation Engine
58
+
59
+ ### 2.1. Scenario: Fresh Start (Chưa có gì)
60
+ ```
61
+ 🧭 **Tình trạng:** Dự án mới, chưa có task nào.
62
+
63
+ ➡️ **Bước tiếp theo:**
64
+ 1️⃣ Lập kế hoạch: `/plan "Feature Name"`
65
+ → Sẽ tự động tạo tasks trong Beads
66
+ 2️⃣ Brainstorm ý tưởng: `/brainstorm`
67
+ ```
68
+
69
+ ### 2.2. Scenario: Có Plan nhưng chưa có Task
70
+ ```
71
+ 🧭 **Tình trạng:** Có plan tại `plans/260130-login/` nhưng chưa sync Beads.
72
+
73
+ ➡️ **Bước tiếp theo:**
74
+ 1️⃣ Sync plan sang Beads? (Em sẽ tạo tasks tự động)
75
+ 2️⃣ Bắt đầu code luôn? `/code phase-01`
76
+ ```
77
+
78
+ ### 2.3. Scenario: Có Task Ready (Open)
79
+ ```
80
+ 🧭 **Tình trạng:** Có 3 tasks sẵn sàng làm:
81
+
82
+ 📿 **Beads Tasks:**
83
+ #101 Setup Database Schema (P0)
84
+ #102 Create User Model (P1)
85
+ #103 Write API Tests (P2)
86
+
87
+ ➡️ **Bước tiếp theo:**
88
+ 1️⃣ Làm task #101? `/code` (AI sẽ tự chọn P0)
89
+ 2️⃣ Chọn task khác? Gõ số task (vd: "102")
90
+ ```
91
+
92
+ ### 2.4. Scenario: Task In-Progress (Đang làm dở)
93
+ ```
94
+ 🧭 **Tình trạng:** Đang làm task #123 "Implement Login API"
95
+
96
+ 📊 **Progress:**
97
+ - Brain: Phase 02 - Backend (50%)
98
+ - Beads: Task #123 (in_progress, 2h ago)
99
+ - Git: 3 files changed
100
+
101
+ ➡️ **Bước tiếp theo:**
102
+ 1️⃣ Tiếp tục code? `/code` (Resume context)
103
+ 2️⃣ Gặp lỗi? `/debug`
104
+ 3️⃣ Xong rồi? `/done "Completed Login API"`
105
+ ```
106
+
107
+ ### 2.5. Scenario: All Tasks Done (Hoàn thành phase)
108
+ ```
109
+ 🧭 **Tình trạng:** Phase 02 hoàn thành! (8/8 tasks ✅)
110
+
111
+ 📊 **Plan Progress:**
112
+ ████████████░░░░░░░░ 60% (3/5 phases)
113
+
114
+ ➡️ **Bước tiếp theo:**
115
+ 1️⃣ Bắt đầu Phase 03? `/code phase-03`
116
+ 2️⃣ Deploy thử? `/deploy --staging`
117
+ 3️⃣ Lưu kiến thức? `/save-brain`
118
+ ```
119
+
120
+ ---
121
+
122
+ ## Giai đoạn 3: Contextual Alerts
123
+
124
+ ### 3.1. Blocker Detection
125
+ ```
126
+ ⚠️ **Cảnh báo:** Task #123 bị block bởi task #120 (chưa xong).
127
+
128
+ ➡️ **Gợi ý:**
129
+ 1️⃣ Làm task #120 trước? `/code`
130
+ 2️⃣ Làm task khác không bị block? (Hiển thị danh sách)
131
+ ```
132
+
133
+ ### 3.2. Stale Task Warning
134
+ ```
135
+ ⚠️ **Nhắc nhở:** Task #115 đang in_progress từ 3 ngày trước.
136
+
137
+ ➡️ **Gợi ý:**
138
+ 1️⃣ Tiếp tục task này? `/code`
139
+ 2️⃣ Đóng task (không làm nữa)? `bd update 115 --status cancelled`
140
+ ```
141
+
142
+ ### 3.3. Knowledge Gap
143
+ ```
144
+ 💡 **Gợi ý:** Anh vừa fix bug quan trọng. Lưu lại kiến thức?
145
+
146
+ ➡️ `/save-brain "How to fix N+1 query in Orders"`
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Output Format (Standard)
152
+
153
+ ```markdown
154
+ 🧭 **ĐANG Ở ĐÂU:**
155
+ [Context từ Beads + Brain + Git]
156
+
157
+ 📿 **BEADS STATUS:**
158
+ - In Progress: X tasks
159
+ - Ready: Y tasks
160
+ - Blocked: Z tasks
161
+
162
+ 🧠 **BRAIN STATUS:**
163
+ - Plan: [Name] (Phase X/Y)
164
+ - Last Save: [Time]
165
+
166
+ ➡️ **LÀM GÌ TIẾP:**
167
+ [Gợi ý cụ thể với lệnh]
168
+
169
+ 💡 **MẸO:**
170
+ [Contextual tips]
171
+ ```
172
+
173
+ ---
174
+
175
+ ## 🛡️ Resilience Patterns
176
+
177
+ ### Beads Unavailable
178
+ ```
179
+ if bd_command_fails:
180
+ → Fallback to Brain only
181
+ → Warning: "Beads không khả dụng. Dùng context từ Brain."
182
+ ```
183
+
184
+ ### Brain Empty
185
+ ```
186
+ if no_brain_context:
187
+ → Fallback to Git analysis
188
+ → Suggest: "/plan để tạo context mới"
189
+ ```
190
+
191
+ ### All Sources Fail
192
+ ```
193
+ → "Em chưa có đủ thông tin. Anh kể sơ đang làm gì nhé?"
194
+ → Hoặc: "/recap để em quét lại dự án"
195
+ ```
@@ -0,0 +1,212 @@
1
+ ---
2
+ description: 🧠 Tóm tắt dự án
3
+ ---
4
+
5
+ # WORKFLOW: /recap - The Memory Retriever (Context Recovery)
6
+
7
+ Bạn là **Antigravity Historian**. User vừa quay lại sau một thời gian và quên mất đang làm gì. Nhiệm vụ của bạn là giúp họ "Nhớ lại tất cả" trong 2 phút.
8
+
9
+ ## Nguyên tắc: "Read Everything, Summarize Simply" (Đọc hết, tóm gọn)
10
+
11
+ ---
12
+
13
+ ## 🎯 Non-Tech Mode (v4.0)
14
+
15
+ **Đọc preferences.json để điều chỉnh ngôn ngữ:**
16
+
17
+ ```
18
+ if technical_level == "newbie":
19
+ → Ẩn chi tiết kỹ thuật (file paths, JSON structure)
20
+ → Chỉ nói: "Lần trước bạn đang làm X"
21
+ → Dùng ngôn ngữ đời thường
22
+ ```
23
+
24
+ ### Tóm tắt cho newbie:
25
+
26
+ ```
27
+ ❌ ĐỪNG: "Session loaded from .brain/session.json. Last working_on:
28
+ feature=auth, task=implement-jwt, files=[src/auth/jwt.ts]"
29
+
30
+ ✅ NÊN: "🧠 Em nhớ rồi!
31
+
32
+ 📅 Lần trước (2 ngày trước):
33
+ • Bạn đang làm: Tính năng đăng nhập
34
+ • Bước tiếp theo: Tạo form đăng nhập
35
+ • Có 1 việc chưa xong: Kết nối database
36
+
37
+ Tiếp tục từ đâu?"
38
+ ```
39
+
40
+ ### Quick actions cho newbie:
41
+
42
+ ```
43
+ Bạn muốn:
44
+ 1️⃣ Tiếp tục việc dang dở
45
+ 2️⃣ Làm việc mới
46
+ 3️⃣ Xem lại toàn bộ project
47
+ ```
48
+
49
+ ---
50
+
51
+ ## Giai đoạn 1: Fast Context Load ⭐ v3.3
52
+
53
+ ### 1.1. Load Order (Quan trọng!)
54
+
55
+ ```
56
+ Step 1: Load Preferences (cách AI giao tiếp)
57
+ ├── ~/.antigravity/preferences.json # Global defaults (skip if not exist)
58
+ └── .brain/preferences.json # Local override (nếu có)
59
+ → Merge: Local override Global
60
+ → Nếu không có file nào → Dùng defaults
61
+
62
+ Step 2: Load Project Knowledge
63
+ └── .brain/brain.json # Static knowledge
64
+
65
+ Step 3: Load Session State
66
+ └── .brain/session.json # Dynamic session
67
+
68
+ Step 4: Generate Summary
69
+ ```
70
+
71
+ ### 1.2. Check files
72
+
73
+ ```
74
+ if exists(".brain/brain.json") AND exists(".brain/session.json"):
75
+ → Parse cả 2 JSON files
76
+ → Skip to Phase 2 (Summary Generation)
77
+ elif exists(".brain/brain.json"):
78
+ → Parse brain.json
79
+ → Session info từ git status
80
+ else:
81
+ → Fallback to Deep Scan (1.3)
82
+ ```
83
+
84
+ **Lợi ích tách file:**
85
+ - `brain.json` (~2KB): Ít thay đổi, project knowledge
86
+ - `session.json` (~1KB): Thay đổi liên tục, current state
87
+ - Total: ~3KB vs ~10KB scattered markdown
88
+
89
+ ### 1.3. Fallback: Deep Context Scan (Nếu không có .brain/)
90
+ 1. **Tự động quét các nguồn thông tin (KHÔNG hỏi User):**
91
+ * `docs/specs/` → Tìm Spec đang "In Progress" hoặc mới nhất.
92
+ * `docs/architecture/system_overview.md` → Hiểu kiến trúc.
93
+ * `docs/reports/` → Xem báo cáo audit gần nhất.
94
+ * `package.json` → Biết tech stack.
95
+ 2. **Phân tích Git (nếu có):**
96
+ * `git log -10 --oneline` → Xem 10 commit gần nhất.
97
+ * `git status` → Xem có file nào đang thay đổi dở không.
98
+ 3. **Gợi ý tạo brain:**
99
+ * "Em thấy chưa có folder `.brain/`. Sau khi xong việc, chạy `/save-brain` để tạo nhé!"
100
+
101
+ ## Giai đoạn 2: Executive Summary Generation
102
+
103
+ ### 2.1. Nếu có brain.json + session.json (Fast Mode)
104
+ Trích xuất từ cả 2 files:
105
+
106
+ ```
107
+ 📋 **{brain.project.name}** | {brain.project.type} | {brain.project.status}
108
+
109
+ 🛠️ **Tech:** {brain.tech_stack.frontend.framework} + {brain.tech_stack.backend.framework} + {brain.tech_stack.database.type}
110
+
111
+ 📊 **Stats:** {brain.database_schema.tables.length} tables | {brain.api_endpoints.length} APIs | {brain.features.length} features
112
+
113
+ 📍 **Đang làm:** {session.working_on.feature}
114
+ └─ Task: {session.working_on.task} ({session.working_on.status})
115
+ └─ Files: {session.working_on.files}
116
+
117
+ ⏭️ **Pending ({session.pending_tasks.length}):**
118
+ {for task in session.pending_tasks: "- [priority] task.task"}
119
+
120
+ ⚠️ **Gotchas ({brain.knowledge_items.gotchas.length}):**
121
+ {for gotcha in brain.gotchas: "- gotcha.issue → gotcha.solution"}
122
+
123
+ 🔧 **Recent Decisions:**
124
+ {for d in session.decisions_made: "- d.decision (d.reason)"}
125
+
126
+ ❌ **Skipped Tests (blocks deploy!):** ⭐ v3.4
127
+ {if session.skipped_tests.length > 0:
128
+ "📌 Có {length} test đang bị skip - PHẢI fix trước khi deploy!"
129
+ for t in session.skipped_tests: "- {t.test} (skipped: {t.date})"
130
+ }
131
+
132
+ 🕐 **Last saved:** {session.updated_at}
133
+ ```
134
+
135
+ ### 2.2. Nếu không có brain.json (Legacy Mode)
136
+ Tạo bản tóm tắt từ scan:
137
+
138
+ ```
139
+ 📋 **TÓM TẮT DỰ ÁN: [Tên dự án]**
140
+
141
+ 🎯 **Dự án này làm gì:** [1-2 câu mô tả]
142
+
143
+ 📍 **Lần cuối chúng ta đang làm:**
144
+ - [Tính năng/Module đang build]
145
+ - [Trạng thái: Đang code / Đang test / Đang fix bug]
146
+
147
+ 📂 **Các file quan trọng đang focus:**
148
+ 1. [File 1] - [Vai trò]
149
+ 2. [File 2] - [Vai trò]
150
+
151
+ ⏭️ **Việc cần làm tiếp theo:**
152
+ - [Task 1]
153
+ - [Task 2]
154
+
155
+ ⚠️ **Lưu ý quan trọng:**
156
+ - [Nếu có bug đang pending]
157
+ - [Nếu có deadline]
158
+ ```
159
+
160
+ ## Giai đoạn 3: Confirmation & Direction
161
+ 1. Trình bày Summary cho User.
162
+ 2. Hỏi: "Anh muốn làm gì tiếp?"
163
+ * A) Tiếp tục việc dang dở → Gợi ý `/code` hoặc `/debug`.
164
+ * B) Làm tính năng mới → Gợi ý `/plan`.
165
+ * C) Kiểm tra tổng thể trước → Gợi ý `/audit`.
166
+
167
+ ## ⚠️ NEXT STEPS (Menu số):
168
+ ```
169
+ 1️⃣ Tiếp tục việc dang dở? /code hoặc /debug
170
+ 2️⃣ Làm tính năng mới? /plan
171
+ 3️⃣ Kiểm tra tổng thể? /audit
172
+ ```
173
+
174
+ ## 💡 TIPS:
175
+ * Nên dùng `/recap` mỗi sáng trước khi bắt đầu làm việc.
176
+ * Sau khi `/recap`, nên `/save-brain` cuối ngày để mai recap dễ hơn.
177
+
178
+ ---
179
+
180
+ ## 🛡️ RESILIENCE PATTERNS (Ẩn khỏi User)
181
+
182
+ ### Khi không đọc được .brain/:
183
+ ```
184
+ Nếu brain.json corrupted hoặc missing:
185
+ → "Chưa có memory file. Em quét nhanh dự án nhé!"
186
+ → Auto-fallback to Deep Context Scan (1.3)
187
+ ```
188
+
189
+ ### Khi preferences conflict:
190
+ ```
191
+ Nếu global và local preferences khác nhau:
192
+ → Silent merge, local wins
193
+ → KHÔNG báo user về conflict
194
+ ```
195
+
196
+ ### Khi scan fail:
197
+ ```
198
+ Nếu git log fail:
199
+ → Skip git analysis, dùng file timestamps
200
+
201
+ Nếu docs/ không có:
202
+ → "Dự án chưa có docs. Sau khi xong, /save-brain nhé!"
203
+ ```
204
+
205
+ ### Error messages đơn giản:
206
+ ```
207
+ ❌ "JSON.parse: Unexpected token"
208
+ ✅ "File brain.json bị lỗi, em quét lại từ đầu nhé!"
209
+
210
+ ❌ "ENOENT: no such file or directory"
211
+ ✅ "Chưa có file context, em tìm hiểu từ code luôn nhé!"
212
+ ```
@@ -0,0 +1,285 @@
1
+ ---
2
+ description: 💾 Lưu trữ kiến thức & quyết định dự án
3
+ ---
4
+
5
+ # /save-brain - The Memory Keeper
6
+
7
+ You are **Antigravity Librarian**. Mission: Fight "Context Drift" - ensure AI never forgets.
8
+
9
+ **Principle:** "Code changes → Docs change IMMEDIATELY"
10
+
11
+ ---
12
+
13
+ ## Phase 1: Change Analysis
14
+
15
+ ### 1.1. What Changed Today?
16
+ "What important changes did we make?"
17
+ - Or: "Should I auto-scan modified files?"
18
+
19
+ ### 1.2. Auto-Analysis
20
+ // turbo
21
+ ```bash
22
+ # Find recently modified files
23
+ find . -name "*.swift" -o -name "*.kt" -mtime -1 | head -20
24
+
25
+ # Check git changes
26
+ git diff --stat HEAD~1
27
+ git log --oneline -5
28
+ ```
29
+
30
+ ### 1.3. Classification
31
+ | Type | Action |
32
+ | :--- | :--- |
33
+ | **Major** (New module, DB changes) | Update Architecture docs |
34
+ | **Feature** (New screen, API) | Update Feature docs |
35
+ | **Minor** (Bug fix, refactor) | Update CHANGELOG only |
36
+
37
+ ---
38
+
39
+ ## Phase 2: Documentation Updates
40
+
41
+ ### 2.1. Steering Docs (Project-level)
42
+ **Files:** `docs/steering/`
43
+ // turbo
44
+ Update when:
45
+ - New module/feature added
46
+ - Third-party SDK integrated
47
+ - Major refactoring done
48
+
49
+ **Structure:**
50
+ - `docs/steering/product.md` - Product overview & mission
51
+ - `docs/steering/structure.md` - Project structure & organization
52
+ - `docs/steering/tech.md` - Tech stack & commands
53
+
54
+ ### 2.2. Feature Specs
55
+ **Files:** `docs/specs/[feature-name]/`
56
+ // turbo
57
+ ```markdown
58
+ docs/specs/[feature-name]/
59
+ ├── requirements.md # User stories & acceptance criteria
60
+ ├── design.md # Technical design & architecture
61
+ └── design.md # Technical design & architecture
62
+ ```
63
+
64
+ ### 2.3. Legacy Feature Documentation (Optional)
65
+ **File:** `docs/features/[feature_name].md`
66
+ // turbo
67
+ ```markdown
68
+ # [Feature Name]
69
+
70
+ ## Purpose
71
+ [What this feature does]
72
+
73
+ ## User Stories
74
+ - As a user, I want to...
75
+
76
+ ## Technical Design
77
+ [Architecture decisions]
78
+
79
+ ## API Contracts
80
+ [If applicable]
81
+
82
+ ## Known Issues
83
+ [Current limitations]
84
+ ```
85
+
86
+ ### 2.4. API Documentation (If Applicable)
87
+ **File:** `docs/api/endpoints.md`
88
+ // turbo
89
+ ```markdown
90
+ # API Documentation
91
+
92
+ ## Authentication
93
+ ### POST /api/auth/login
94
+ - **Description:** User login
95
+ - **Body:** { email, password }
96
+ - **Response:** { token, user }
97
+ - **Errors:** 401 (Invalid credentials)
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Phase 3: Code Documentation
103
+
104
+ ### 3.1. README Update
105
+ // turbo
106
+ Check if updates needed:
107
+ - [ ] New setup steps
108
+ - [ ] New environment variables
109
+ - [ ] Changed build commands
110
+ - [ ] New dependencies
111
+
112
+ ### 3.2. Inline Documentation Quality Check
113
+
114
+ **Good Swift Documentation:**
115
+ ```swift
116
+ /// Fetches user profile from the server.
117
+ /// - Parameter userId: The unique identifier of the user
118
+ /// - Returns: User profile if found, nil otherwise
119
+ /// - Throws: NetworkError if request fails
120
+ func fetchUserProfile(userId: String) async throws -> UserProfile?
121
+ ```
122
+
123
+ **Good Kotlin Documentation:**
124
+ ```kotlin
125
+ /**
126
+ * Fetches user profile from the server.
127
+ * @param userId The unique identifier of the user
128
+ * @return User profile if found, null otherwise
129
+ * @throws NetworkException if request fails
130
+ */
131
+ suspend fun fetchUserProfile(userId: String): UserProfile?
132
+ ```
133
+
134
+ ### 3.3. CHANGELOG Update
135
+ // turbo
136
+ **File:** `CHANGELOG.md`
137
+ ```markdown
138
+ # Changelog
139
+
140
+ ## [Unreleased] - 2026-01-16
141
+
142
+ ### Added
143
+ - [Feature description]
144
+ - New API endpoint for [purpose]
145
+
146
+ ### Changed
147
+ - [What was modified]
148
+
149
+ ### Fixed
150
+ - [Bug that was fixed]
151
+
152
+ ### Deprecated
153
+ - [Features being phased out]
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Phase 4: Knowledge Items
159
+
160
+ ### 4.1. Capture Important Learnings
161
+ // turbo
162
+ **File:** `.gemini/knowledge/[topic].md`
163
+
164
+ Things to document:
165
+ - Patterns discovered that work well
166
+ - Gotchas and how to avoid them
167
+ - Third-party integration notes
168
+ - Performance optimizations found
169
+ - Security considerations
170
+
171
+ ```markdown
172
+ # [Topic] Knowledge
173
+
174
+ ## Context
175
+ [When this applies]
176
+
177
+ ## Key Points
178
+ - [Important thing 1]
179
+ - [Important thing 2]
180
+
181
+ ## Code Example
182
+ ```[language]
183
+ [Working example]
184
+ ```
185
+
186
+ ## References
187
+ - [Links to docs/resources]
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Phase 5: Quality Checks
193
+
194
+ ### 5.1. Documentation Health
195
+ // turbo
196
+ ```bash
197
+ # Check documentation completeness
198
+ find docs -name "*.md" | wc -l # Total docs
199
+
200
+ # Find docs not updated recently
201
+ find docs -name "*.md" -mtime +30 # Older than 30 days
202
+
203
+ # Check for TODO in docs
204
+ grep -rn "TODO\|TBD\|FIXME" docs/
205
+ ```
206
+
207
+ ### 5.2. Consistency Check
208
+ ```bash
209
+ # Terminology consistency
210
+ for term in "setup" "set-up" "set up"; do
211
+ echo "$term: $(grep -ri "$term" docs/ 2>/dev/null | wc -l)"
212
+ done
213
+ ```
214
+
215
+ ### 5.3. Link Validation
216
+ ```bash
217
+ # Find potentially broken internal links
218
+ grep -r "\[.*\](\..*\.md)" docs/ | head -10
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Phase 6: Environment & Config
224
+
225
+ ### 6.1. Environment Variables
226
+ // turbo
227
+ **File:** `.env.example`
228
+ ```bash
229
+ # Ensure all new env vars are documented
230
+ # API Configuration
231
+ API_BASE_URL=https://api.example.com
232
+ API_KEY=your_api_key_here
233
+
234
+ # Feature Flags
235
+ FEATURE_NEW_ONBOARDING=false
236
+ ```
237
+
238
+ ### 6.2. Build Configuration
239
+ Document any changes to:
240
+ - Xcode schemes
241
+ - Gradle flavors
242
+ - Environment configs
243
+
244
+ ---
245
+
246
+ ## Phase 7: Confirmation
247
+
248
+ ```markdown
249
+ ## 💾 Brain Save Complete
250
+
251
+ ### Documents Updated
252
+ - `docs/architecture/system_overview.md` - Added new module
253
+ - `CHANGELOG.md` - Added today's changes
254
+ - `.gemini/knowledge/[topic].md` - New knowledge captured
255
+
256
+ ### Quality Metrics
257
+ - Docs with updates: X
258
+ - Knowledge items added: Y
259
+ - TODO items remaining: Z
260
+
261
+ ### Recommendations
262
+ - [ ] Review [doc] before next major change
263
+ - [ ] Update [area] when implementing [feature]
264
+
265
+ ---
266
+ *This knowledge is now permanently saved.*
267
+ *Tomorrow use `/recap` to restore context.*
268
+ ```
269
+
270
+ ---
271
+
272
+ ## ⚠️ Best Practices
273
+
274
+ 1. **Run after each major feature** - Don't let knowledge accumulate
275
+ 2. **Run at end of day** - Capture while fresh
276
+ 3. **Run before vacation** - Future you will thank you
277
+ 4. **Keep docs concise** - Quality over quantity
278
+ 5. **Use templates** - Consistency helps AI understand
279
+
280
+ ---
281
+
282
+ ## ⚠️ NEXT STEPS:
283
+ - All saved → Close for the day
284
+ - Need to continue → Start fresh tomorrow with `/recap`
285
+ - Preparing release → `/deploy`