@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,201 @@
1
+ # Brain Entry Templates
2
+
3
+ > Các template chuẩn để lưu vào brain/ — dùng cho cả auto-save và manual /save-brain.
4
+
5
+ ---
6
+
7
+ ## Template 1: Decision (brain/decisions/)
8
+
9
+ **Filename:** `brain/decisions/YYYY-MM-DD-[slug].md`
10
+
11
+ ```markdown
12
+ ---
13
+ date: 2026-02-22
14
+ type: decision
15
+ topic: [brief topic, e.g., "Database choice for neural-brain"]
16
+ feature: [which feature/project this belongs to]
17
+ tags: [tech, architecture, database, ...]
18
+ salience: 0.90
19
+ ---
20
+
21
+ # Decision: [Topic]
22
+
23
+ ## What was decided
24
+ [Clear statement of the decision]
25
+
26
+ ## Why this approach
27
+ [Rationale — key reasons]
28
+
29
+ ## Alternatives considered
30
+ - **[Option A]**: [Why rejected]
31
+ - **[Option B]**: [Why rejected]
32
+
33
+ ## Trade-offs
34
+ - ✅ [Pro 1]
35
+ - ✅ [Pro 2]
36
+ - ⚠️ [Con/caveat]
37
+
38
+ ## Context
39
+ [Additional context: task ID, feature, constraints]
40
+ ```
41
+
42
+ ---
43
+
44
+ ## Template 2: Solution (brain/solutions/)
45
+
46
+ **Filename:** `brain/solutions/YYYY-MM-DD-[slug].md`
47
+
48
+ ```markdown
49
+ ---
50
+ date: 2026-02-22
51
+ type: solution
52
+ error_pattern: [e.g., "TypeError: Cannot read property of undefined"]
53
+ files_affected: [e.g., "activation.js, store.js"]
54
+ tags: [javascript, sqlite, null-check, ...]
55
+ salience: 0.85
56
+ ---
57
+
58
+ # Solution: [Error Pattern]
59
+
60
+ ## The Error
61
+ ```
62
+ [Paste exact error or describe the bug]
63
+ ```
64
+
65
+ ## Root Cause
66
+ [Why this happened — 1-2 sentences]
67
+
68
+ ## The Fix
69
+ [Step-by-step or code snippet showing the solution]
70
+
71
+ ```js
72
+ // Before (broken)
73
+ code here
74
+
75
+ // After (fixed)
76
+ code here
77
+ ```
78
+
79
+ ## How to Prevent
80
+ [Rule or pattern to avoid this in future]
81
+
82
+ ## Context
83
+ [What feature/task was being worked on when this occurred]
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Template 3: Architecture (brain/decisions/)
89
+
90
+ **Filename:** `brain/decisions/arch-[feature]-[date].md`
91
+
92
+ ```markdown
93
+ ---
94
+ date: 2026-02-22
95
+ type: architecture
96
+ feature: [feature name, e.g., "neural-brain"]
97
+ tags: [architecture, design, ...]
98
+ salience: 0.95
99
+ ---
100
+
101
+ # Architecture: [Feature Name]
102
+
103
+ ## Overview
104
+ [Brief description of what was designed]
105
+
106
+ ## Structure
107
+ ```
108
+ [directory tree or component diagram]
109
+ ```
110
+
111
+ ## Key Decisions
112
+ 1. [Decision 1 + rationale]
113
+ 2. [Decision 2 + rationale]
114
+ 3. [Decision 3 + rationale]
115
+
116
+ ## Tech Choices
117
+ | Component | Choice | Reason |
118
+ |-----------|--------|--------|
119
+ | [Layer] | [Tech] | [Why] |
120
+
121
+ ## Data Flow
122
+ [How data flows through the system]
123
+
124
+ ## Open Questions
125
+ - [ ] [Question to resolve later]
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Template 4: Session (brain/session.json)
131
+
132
+ **Auto-updated by ambient-brain skill.**
133
+
134
+ ```json
135
+ {
136
+ "last_updated": "2026-02-22T16:56:00+07:00",
137
+ "working_on": {
138
+ "project": "main-awf",
139
+ "feature": "neural-brain + ambient-brain skill",
140
+ "phase": "implementation",
141
+ "current_task_id": null,
142
+ "current_files": ["skills/ambient-brain/SKILL.md"]
143
+ },
144
+ "recent_decisions": [
145
+ {
146
+ "ref": "decisions/2026-02-22-use-better-sqlite3.md",
147
+ "summary": "Use better-sqlite3 for neural brain storage"
148
+ }
149
+ ],
150
+ "recent_solutions": [],
151
+ "active_context": {
152
+ "neural_brain_port": "Planning phase - studying Python source",
153
+ "ambient_brain": "Implementing skill files"
154
+ },
155
+ "completed_milestones": [],
156
+ "context_checkpoints": []
157
+ }
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Template 5: Active Plans (brain/active_plans.json)
163
+
164
+ ```json
165
+ {
166
+ "plans": [
167
+ {
168
+ "id": "neural-brain-nodejs-port",
169
+ "title": "Port neural-memory to Node.js for main-awf",
170
+ "status": "planning",
171
+ "phases": [
172
+ { "id": "p1", "name": "Study Python source", "status": "done" },
173
+ { "id": "p2", "name": "Build SQLite schema", "status": "next" },
174
+ { "id": "p3", "name": "Core data structures", "status": "pending" },
175
+ { "id": "p4", "name": "Spreading activation engine", "status": "pending" },
176
+ { "id": "p5", "name": "Public API integration", "status": "pending" }
177
+ ],
178
+ "created": "2026-02-22",
179
+ "last_updated": "2026-02-22"
180
+ },
181
+ {
182
+ "id": "ambient-brain-skill",
183
+ "title": "Ambient Brain Sync skill for AWF",
184
+ "status": "implementing",
185
+ "phases": [
186
+ { "id": "p1", "name": "Design & brainstorm", "status": "done" },
187
+ { "id": "p2", "name": "Create skill files", "status": "in_progress" },
188
+ { "id": "p3", "name": "Update GEMINI.md", "status": "next" },
189
+ { "id": "p4", "name": "Deploy to antigravity", "status": "pending" },
190
+ { "id": "p5", "name": "Test with real workflow", "status": "pending" }
191
+ ],
192
+ "created": "2026-02-22",
193
+ "last_updated": "2026-02-22"
194
+ }
195
+ ]
196
+ }
197
+ ```
198
+
199
+ ---
200
+
201
+ *brain-templates v1.0.0 — Standard formats for consistent brain storage*
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: orchestrator
3
+ description: >-
4
+ Intelligent dispatcher — analyzes context, injects project brain, then
5
+ delegates to the right skill or workflow. Always runs first.
6
+ version: 2.0.0
7
+ trigger: always
8
+ priority: 1
9
+ ---
10
+
11
+ # Orchestrator Skill v2.0 — Project-Aware
12
+
13
+ > **Role:** First-layer processor. Chạy trước MỌI skill khác.
14
+ > **New in v2.0:** Project Brain Lookup — inject project context trước khi route.
15
+
16
+ ---
17
+
18
+ ## Execution Order (MANDATORY)
19
+
20
+ ```
21
+ Step 1: Project Brain Lookup ← MỚI — chạy đầu tiên
22
+ Step 2: Intent Detection
23
+ Step 3: Route to skill/workflow
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Step 1: Project Brain Lookup (LUÔN CHẠY)
29
+
30
+ Trước khi làm bất cứ điều gì, orchestrator phải load project context:
31
+
32
+ ### 1.1 — Đọc `.project-identity`
33
+
34
+ ```yaml
35
+ check: Có file .project-identity trong project dir không?
36
+
37
+ IF EXISTS:
38
+ read: .project-identity
39
+ extract:
40
+ - projectName
41
+ - stage (stage3_development, etc.)
42
+ - architecture (clean_architecture, mvvm)
43
+ - tech stack (swift, react, node, etc.)
44
+ - currentWork / nextMilestones
45
+
46
+ SET: project_context = { name, stage, arch, stack }
47
+ ```
48
+
49
+ ### 1.2 — Đọc `CODEBASE.md`
50
+
51
+ ```yaml
52
+ check: Có file CODEBASE.md trong project dir không?
53
+
54
+ IF EXISTS:
55
+ read: CODEBASE.md
56
+ extract:
57
+ - layer_map: { layer_name → files[] }
58
+ - feature_areas: { feature → directory }
59
+ - naming_conventions
60
+ - data_flow_diagrams
61
+
62
+ SET: codebase_map = { layers, features, conventions }
63
+
64
+ RULES:
65
+ → KHÔNG scan raw directory nếu CODEBASE.md tồn tại
66
+ → KHÔNG hỏi user về file location — tự suy luận từ codebase_map
67
+ ```
68
+
69
+ ### 1.3 — Resolve Target từ Request
70
+
71
+ ```yaml
72
+ # Khi user đề cập feature/bug/area:
73
+ resolve_target(user_request, codebase_map):
74
+ keywords = extract_keywords(user_request)
75
+
76
+ # Match theo thứ tự ưu tiên:
77
+ 1. Layer match: "crash khi login" → AuthenticationViewModel, AuthUseCases
78
+ 2. Feature match: "water tracking" → Features/Water/
79
+ 3. Service match: "camera chậm" → CameraViewModel + Core/Services/
80
+ 4. Fallback: "không rõ" → list top 3 candidates từ CODEBASE.md
81
+ ```
82
+
83
+ ### 1.4 — Brief Confirm Output (LUÔN HIỂN THỊ)
84
+
85
+ ```
86
+ Format:
87
+ "📚 [ProjectName] | [Stage] | [Architecture]
88
+ 🗺️ Targeting: [resolved file/layer]"
89
+
90
+ Example:
91
+ "📚 FitBite Witness | Stage 3 Development | Clean Architecture + MVVM
92
+ 🗺️ Targeting: AuthenticationViewModel → SignInUseCase"
93
+
94
+ Nếu CODEBASE.md không có:
95
+ "📚 [ProjectName] — CODEBASE.md chưa có, đang scan cấu trúc..."
96
+
97
+ Nếu file được nhắc đến KHÔNG có trong CODEBASE.md:
98
+ → Thực hiện xong, thêm footer: "⚠️ CODEBASE.md có thể outdated — dùng /codebase-sync"
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Step 2: Intent Detection
104
+
105
+ Sau khi có project context, detect intent từ request:
106
+
107
+ ```yaml
108
+ debug_intent:
109
+ keywords: ["error", "bug", "crash", "fix", "lỗi", "sửa", "fail", "không chạy"]
110
+ + image: [screenshot of error/crash]
111
+ action: Execute debug flow với target đã resolve từ Step 1
112
+
113
+ code_intent:
114
+ keywords: ["implement", "build", "create", "add", "code", "viết", "tạo", "thêm"]
115
+ action: Execute code flow tại target layer/file đã biết
116
+
117
+ plan_intent:
118
+ keywords: ["plan", "design", "architect", "how to", "strategy", "thiết kế"]
119
+ action: Route to /plan với project context injected
120
+
121
+ context_intent:
122
+ keywords: ["remember", "save", "continue", "where was I", "nhớ", "tiếp", "recap"]
123
+ action: Route to /recap hoặc /save-brain
124
+
125
+ ads_intent:
126
+ keywords: ["ads", "campaign", "CPI", "ROAS", "quảng cáo"]
127
+ action: Route to /ads-audit hoặc /adsExpert
128
+
129
+ image_intent:
130
+ trigger: User gửi ảnh chụp màn hình
131
+ + debug keywords: Route to visual-debug với CODEBASE context
132
+ + design keywords: Route to design-to-ui
133
+ + error screenshot: Route to debug flow
134
+ ```
135
+
136
+ ---
137
+
138
+ ## Step 3: Routing
139
+
140
+ ### With Project Context (khi đã có CODEBASE.md)
141
+
142
+ ```
143
+ → Không suggest workflow, THỰC HIỆN LUÔN
144
+ → Đi thẳng đến file/layer đã resolve
145
+ → Không hỏi "file này ở đâu?" — đã biết từ CODEBASE.md
146
+ ```
147
+
148
+ ### Without Project Context
149
+
150
+ ```
151
+ → Route bình thường theo intent
152
+ → Suggest workflow phù hợp
153
+ → Có thể hỏi clarifying question (max 2 lần)
154
+ ```
155
+
156
+ ### Slash Command Detection
157
+
158
+ ```yaml
159
+ # User gõ /command → Load workflow file trực tiếp
160
+ /plan → global_workflows/plan.md
161
+ /planExpert → global_workflows/planExpert.md
162
+ /code → global_workflows/code.md
163
+ /codeExpert → global_workflows/codeExpert.md
164
+ /debug → global_workflows/debug.md
165
+ /debugExpert → global_workflows/debugExpert.md
166
+ /codebase-sync → global_workflows/codebase-sync.md # MỚI
167
+ # ...etc (see GEMINI.md)
168
+ ```
169
+
170
+ ### Fallback
171
+
172
+ ```
173
+ No intent match → Ask clarifying question (max 2 lần)
174
+ Still unclear → Suggest /help
175
+ ```
176
+
177
+ ---
178
+
179
+ ## Integration
180
+
181
+ ```yaml
182
+ runs_before: awf-session-restore, memory-sync, all workflows
183
+ provides_to: [project_context, resolved_target, intent]
184
+ receives_from: user_request, active_document
185
+
186
+ # Khi có CODEBASE.md → memory-sync R2 chỉ cần query với resolved_target
187
+ # thay vì query toàn bộ brain/
188
+ ```
189
+
190
+ ---
191
+
192
+ *orchestrator v2.0 — Project-Aware Dispatcher*
193
+ *Created by Kien AI*
@@ -0,0 +1,240 @@
1
+ ---
2
+ name: awf-session-restore
3
+ description: Auto-restore context from Beads + Brain on session start
4
+ trigger: session_start
5
+ ---
6
+
7
+ # AWF Session Restore (v5.0 - Beads + Brain)
8
+
9
+ > **Purpose:** Tự động khôi phục context khi user quay lại sau khi nghỉ.
10
+
11
+ ---
12
+
13
+ ## Trigger
14
+
15
+ Skill này tự động chạy khi:
16
+ - User mở session mới
17
+ - User gõ `/recap`
18
+ - AI detect context loss (conversation reset)
19
+
20
+ ---
21
+
22
+ ## Execution Flow
23
+
24
+ ### 1. Multi-Source Context Check
25
+
26
+ **Priority 1: Beads (Task State)**
27
+ ```bash
28
+ bd list --status in_progress
29
+ ```
30
+
31
+ **Output:**
32
+ - Tasks đang làm dở
33
+ - Tasks blocked
34
+ - Tasks ready to start
35
+
36
+ **Priority 2: Brain (Knowledge & Plans)**
37
+ ```bash
38
+ # Check active plans
39
+ cat brain/active_plans.json
40
+
41
+ # Check recent memories
42
+ ls -lt brain/ | head -5
43
+ ```
44
+
45
+ **Output:**
46
+ - Plan đang active
47
+ - Phase hiện tại
48
+ - Recent decisions/knowledge
49
+
50
+ **Priority 3: Git (Code State)**
51
+ ```bash
52
+ git status
53
+ git log -1
54
+ ```
55
+
56
+ **Output:**
57
+ - Files đang thay đổi
58
+ - Commit gần nhất
59
+
60
+ ---
61
+
62
+ ### 2. Context Synthesis
63
+
64
+ Kết hợp 3 nguồn để tạo summary:
65
+
66
+ ```markdown
67
+ 🧠 **SESSION RESTORED**
68
+
69
+ 📿 **Beads Context:**
70
+ - In Progress: Task #123 "Implement Login API" (started 2h ago)
71
+ - Blocked: Task #125 (waiting for #120)
72
+ - Ready: 3 tasks
73
+
74
+ 🧠 **Brain Context:**
75
+ - Active Plan: plans/260130-1025-shopping-cart/
76
+ - Current Phase: Phase 02 - Backend (50% complete)
77
+ - Last Save: 30 minutes ago
78
+
79
+ 📂 **Git Context:**
80
+ - Changed Files: 3 files (src/api/auth/*.ts)
81
+ - Last Commit: "feat: add user model" (1 hour ago)
82
+
83
+ ➡️ **SUGGESTED NEXT STEP:**
84
+ Continue task #123? `/codeExpert` or `/code`
85
+ ```
86
+
87
+ ---
88
+
89
+ ### 3. Smart Suggestions
90
+
91
+ Based on context, suggest appropriate action:
92
+
93
+ **Case 1: Task In-Progress**
94
+ ```
95
+ ➡️ Tiếp tục task #123?
96
+ `/codeExpert` (Fast) or `/code` (Guided)
97
+ ```
98
+
99
+ **Case 2: Task Blocked**
100
+ ```
101
+ ⚠️ Task #125 bị block bởi #120
102
+
103
+ ➡️ Làm task #120 trước?
104
+ `/codeExpert` or switch to another task
105
+ ```
106
+
107
+ **Case 3: No Active Task**
108
+ ```
109
+ 📋 Có 3 tasks ready to start
110
+
111
+ ➡️ Bắt đầu task mới?
112
+ `/next` để xem gợi ý
113
+ ```
114
+
115
+ **Case 4: Fresh Start**
116
+ ```
117
+ 🆕 Chưa có context
118
+
119
+ ➡️ Bắt đầu dự án mới?
120
+ `/planExpert "Feature"` or `/brainstorm`
121
+ ```
122
+
123
+ ---
124
+
125
+ ### 4. Memory Persistence
126
+
127
+ Update session state:
128
+
129
+ ```json
130
+ // brain/session.json
131
+ {
132
+ "last_session": "2026-01-30T10:00:00Z",
133
+ "working_on": {
134
+ "feature": "Shopping Cart",
135
+ "plan_path": "plans/260130-1025-shopping-cart/",
136
+ "current_phase": "phase-02",
137
+ "current_task": {
138
+ "id": 123,
139
+ "name": "Implement Login API",
140
+ "status": "in_progress"
141
+ }
142
+ },
143
+ "context_sources": {
144
+ "beads": true,
145
+ "brain": true,
146
+ "git": true
147
+ }
148
+ }
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Error Handling
154
+
155
+ ### Beads Unavailable
156
+ ```
157
+ ⚠️ Beads không khả dụng
158
+
159
+ Fallback: Dùng Brain + Git context
160
+ ```
161
+
162
+ ### Brain Empty
163
+ ```
164
+ ⚠️ Brain chưa có context
165
+
166
+ Gợi ý: `/plan` để tạo context mới
167
+ ```
168
+
169
+ ### All Sources Fail
170
+ ```
171
+ ❌ Không thể khôi phục context
172
+
173
+ ➡️ Bắt đầu lại:
174
+ 1. `/recap` để quét dự án
175
+ 2. `/plan` để tạo plan mới
176
+ 3. Kể cho em biết đang làm gì
177
+ ```
178
+
179
+ ---
180
+
181
+ ## Integration with Workflows
182
+
183
+ ### Auto-Trigger in Workflows
184
+
185
+ Các workflows tự động gọi session restore:
186
+
187
+ ```markdown
188
+ # In /code workflow
189
+ 1. Check session.json
190
+ 2. If no context → Trigger awf-session-restore
191
+ 3. Resume from restored context
192
+ ```
193
+
194
+ ### Manual Trigger
195
+
196
+ User có thể gọi thủ công:
197
+
198
+ ```bash
199
+ /recap # Alias for session restore
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Performance
205
+
206
+ - **Execution Time:** < 1 second
207
+ - **Sources Checked:** 3 (Beads, Brain, Git)
208
+ - **Output:** Concise summary (< 10 lines)
209
+
210
+ ---
211
+
212
+ ## Example Output
213
+
214
+ ```
215
+ 🧠 **WELCOME BACK!**
216
+
217
+ 📿 **Beads:** Task #123 "Login API" (in_progress, 2h ago)
218
+ 🧠 **Brain:** Plan "Shopping Cart" - Phase 02 (50%)
219
+ 📂 **Git:** 3 files changed
220
+
221
+ ➡️ **NEXT:** Continue coding? `/codeExpert`
222
+
223
+ 💡 **TIP:** Gõ `/next` để xem chi tiết hơn
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Configuration
229
+
230
+ User có thể customize trong `brain/preferences.json`:
231
+
232
+ ```json
233
+ {
234
+ "session_restore": {
235
+ "auto_trigger": true,
236
+ "verbosity": "concise", // concise | detailed
237
+ "sources": ["beads", "brain", "git"]
238
+ }
239
+ }
240
+ ```
@@ -0,0 +1,80 @@
1
+ # {{PROJECT_NAME}} — Codebase Map
2
+
3
+ > **Project Type:** {{PROJECT_TYPE}} | **Stage:** {{PROJECT_STAGE}}
4
+ > **Tech Stack:** {{TECH_STACK_SUMMARY}}
5
+ > **Last Synced:** {{DATE}}
6
+
7
+ ---
8
+
9
+ ## 🗺️ Layer Map
10
+
11
+ > _AI: Dùng bản đồ này để định vị file trước khi scan directory_
12
+
13
+ ```
14
+ {{DIR_STRUCTURE}}
15
+ ```
16
+
17
+ ---
18
+
19
+ ## 📁 Feature Areas
20
+
21
+ | Area | Location | Description |
22
+ |------|----------|-------------|
23
+ | _(example)_ Features | `{{FEATURES_DIR}}` | Main feature modules |
24
+ | _(example)_ Shared UI | `{{SHARED_UI_DIR}}` | Reusable UI components |
25
+ | _(example)_ Services | `{{SERVICES_DIR}}` | Business logic & data layer |
26
+ | _(example)_ Models | `{{MODELS_DIR}}` | Data models & DTOs |
27
+
28
+ > ⚠️ Update this table after adding new feature areas.
29
+
30
+ ---
31
+
32
+ ## 🔥 Firebase Integration
33
+
34
+ | Feature | Status | Notes |
35
+ |---------|--------|-------|
36
+ | Analytics | ✅ | Event tracking |
37
+ | Crashlytics | ✅ | Crash reporting |
38
+ | Remote Config | ✅ | Feature flags |
39
+ | Auth | ✅ | Sign in methods |
40
+ | Firestore | ⬜ | — |
41
+ | Storage | ⬜ | — |
42
+
43
+ ---
44
+
45
+ ## 🏗️ Architecture
46
+
47
+ - **Pattern:** {{ARCHITECTURE}}
48
+ - **State Management:** {{STATE_MANAGEMENT}}
49
+ - **Networking:** {{NETWORKING}}
50
+ - **Storage:** {{STORAGE}}
51
+
52
+ ---
53
+
54
+ ## 📏 Naming Conventions
55
+
56
+ - **Files:** `PascalCase` (Swift/Kotlin) or `kebab-case` (JS/TS)
57
+ - **Functions/Methods:** `camelCase`
58
+ - **Constants:** `UPPER_SNAKE_CASE`
59
+ - **Variables:** `camelCase`
60
+
61
+ ---
62
+
63
+ ## 🔑 Key Files
64
+
65
+ | File | Purpose |
66
+ |------|---------|
67
+ | `.project-identity` | AI project context |
68
+ | `CODEBASE.md` | This file — codebase map for AI |
69
+
70
+ > Add important files here as the project grows.
71
+
72
+ ---
73
+
74
+ ## 📝 Notes
75
+
76
+ _Add architecture decisions, gotchas, and important context here._
77
+
78
+ ---
79
+
80
+ *Auto-generated by `awkit init` — keep this file updated with `/codebase-sync`*