awf-vibecoder-kit 5.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.
- package/LICENSE +21 -0
- package/README.md +159 -0
- package/bin/setup.js +144 -0
- package/bin/uninstall.js +28 -0
- package/docs/README.md +37 -0
- package/docs/commands.md +306 -0
- package/docs/glossary.md +181 -0
- package/docs/quick-start.md +96 -0
- package/docs/scenarios.md +293 -0
- package/docs/skills.md +147 -0
- package/index.js +13 -0
- package/package.json +36 -0
- package/skills/awf-adaptive-language/SKILL.md +189 -0
- package/skills/awf-auto-save/SKILL.md +223 -0
- package/skills/awf-context-help/SKILL.md +180 -0
- package/skills/awf-error-translator/SKILL.md +153 -0
- package/skills/awf-onboarding/SKILL.md +248 -0
- package/skills/awf-session-restore/SKILL.md +234 -0
- package/workflows/README.md +325 -0
- package/workflows/audit.md +231 -0
- package/workflows/awf-update.md +81 -0
- package/workflows/brainstorm.md +164 -0
- package/workflows/canary.md +102 -0
- package/workflows/code.md +663 -0
- package/workflows/customize.md +346 -0
- package/workflows/debug.md +265 -0
- package/workflows/deploy.md +314 -0
- package/workflows/design.md +364 -0
- package/workflows/dev-loop.md +182 -0
- package/workflows/freeze.md +79 -0
- package/workflows/help.md +299 -0
- package/workflows/init.md +145 -0
- package/workflows/learn.md +119 -0
- package/workflows/next.md +256 -0
- package/workflows/plan.md +605 -0
- package/workflows/recap.md +230 -0
- package/workflows/refactor.md +165 -0
- package/workflows/review.md +156 -0
- package/workflows/rollback.md +52 -0
- package/workflows/run.md +237 -0
- package/workflows/save_brain.md +522 -0
- package/workflows/sync.md +69 -0
- package/workflows/test.md +91 -0
- package/workflows/vibecoder-guide.md +285 -0
- package/workflows/visualize.md +469 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: awf-error-translator
|
|
3
|
+
description: >-
|
|
4
|
+
Translate technical errors to human-friendly language. Keywords: error,
|
|
5
|
+
translate, explain, help, fix, fail, broken, crash, bug.
|
|
6
|
+
Activates on /debug, /code, /test when errors detected.
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# AWF Error Translator
|
|
11
|
+
|
|
12
|
+
Dịch lỗi kỹ thuật sang ngôn ngữ đời thường cho non-tech users.
|
|
13
|
+
|
|
14
|
+
## Trigger Conditions
|
|
15
|
+
|
|
16
|
+
**Post-hook for:** `/debug`, `/code`, `/test`
|
|
17
|
+
|
|
18
|
+
**When:** Error message detected in output
|
|
19
|
+
|
|
20
|
+
## Execution Logic
|
|
21
|
+
|
|
22
|
+
### Step 1: Detect Error
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
if output contains error patterns:
|
|
26
|
+
→ Activate translation
|
|
27
|
+
else:
|
|
28
|
+
→ Skip (no error)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Step 2: Match & Translate
|
|
32
|
+
|
|
33
|
+
Match error against database, return human message + action.
|
|
34
|
+
|
|
35
|
+
### Step 3: Display
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
❌ Lỗi: [human message]
|
|
39
|
+
💡 Gợi ý: [action]
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Error Translation Database
|
|
43
|
+
|
|
44
|
+
### Database Errors
|
|
45
|
+
|
|
46
|
+
| Pattern | Human Message | Action |
|
|
47
|
+
|---------|---------------|--------|
|
|
48
|
+
| `ECONNREFUSED` | Database chưa chạy | Khởi động PostgreSQL/MySQL |
|
|
49
|
+
| `ETIMEDOUT` | Database phản hồi chậm quá | Kiểm tra kết nối mạng |
|
|
50
|
+
| `ER_ACCESS_DENIED` | Sai mật khẩu database | Kiểm tra file .env |
|
|
51
|
+
| `relation .* does not exist` | Bảng chưa tồn tại | Chạy migration: `/run migrate` |
|
|
52
|
+
| `duplicate key` | Dữ liệu bị trùng | Kiểm tra unique constraint |
|
|
53
|
+
|
|
54
|
+
### JavaScript/TypeScript Errors
|
|
55
|
+
|
|
56
|
+
| Pattern | Human Message | Action |
|
|
57
|
+
|---------|---------------|--------|
|
|
58
|
+
| `TypeError: Cannot read` | Đang đọc biến chưa có giá trị | Kiểm tra null/undefined |
|
|
59
|
+
| `ReferenceError` | Dùng biến chưa khai báo | Kiểm tra tên biến |
|
|
60
|
+
| `SyntaxError` | Code viết sai cú pháp | Kiểm tra dấu ngoặc, chấm phẩy |
|
|
61
|
+
| `Maximum call stack` | Vòng lặp vô hạn | Kiểm tra điều kiện dừng |
|
|
62
|
+
| `Cannot find module` | Thiếu package | Chạy `npm install` |
|
|
63
|
+
|
|
64
|
+
### Network Errors
|
|
65
|
+
|
|
66
|
+
| Pattern | Human Message | Action |
|
|
67
|
+
|---------|---------------|--------|
|
|
68
|
+
| `fetch failed` | Không kết nối được server | Kiểm tra URL và internet |
|
|
69
|
+
| `CORS` | Website chặn request | Cấu hình CORS trên server |
|
|
70
|
+
| `ERR_CERT` | Chứng chỉ SSL lỗi | Dùng HTTP thay HTTPS (dev only) |
|
|
71
|
+
| `timeout` | Request quá lâu | Tăng timeout hoặc kiểm tra server |
|
|
72
|
+
| `ENOTFOUND` | Domain không tồn tại | Kiểm tra lại URL |
|
|
73
|
+
|
|
74
|
+
### Package Errors
|
|
75
|
+
|
|
76
|
+
| Pattern | Human Message | Action |
|
|
77
|
+
|---------|---------------|--------|
|
|
78
|
+
| `npm ERR!` | Cài package bị lỗi | Xóa node_modules, cài lại |
|
|
79
|
+
| `peer dep` | Phiên bản không tương thích | Cập nhật package.json |
|
|
80
|
+
| `EACCES` | Không có quyền truy cập | Chạy với sudo hoặc sửa quyền |
|
|
81
|
+
| `ENOSPC` | Hết dung lượng ổ đĩa | Dọn dẹp disk |
|
|
82
|
+
| `gyp ERR!` | Lỗi build native module | Cài build tools |
|
|
83
|
+
|
|
84
|
+
### Test Errors
|
|
85
|
+
|
|
86
|
+
| Pattern | Human Message | Action |
|
|
87
|
+
|---------|---------------|--------|
|
|
88
|
+
| `Expected .* but received` | Test thất bại - kết quả sai | Sửa code hoặc update test |
|
|
89
|
+
| `Timeout` | Test chạy quá lâu | Tăng timeout hoặc optimize |
|
|
90
|
+
| `before each hook` | Setup test bị lỗi | Kiểm tra beforeEach |
|
|
91
|
+
| `snapshot` | UI thay đổi | Update snapshot nếu đúng |
|
|
92
|
+
| `coverage` | Thiếu test coverage | Viết thêm test |
|
|
93
|
+
|
|
94
|
+
### Build Errors
|
|
95
|
+
|
|
96
|
+
| Pattern | Human Message | Action |
|
|
97
|
+
|---------|---------------|--------|
|
|
98
|
+
| `tsc.*error` | Lỗi TypeScript | Sửa type errors |
|
|
99
|
+
| `ESLint` | Code không đúng style | Chạy lint fix |
|
|
100
|
+
| `Build failed` | Build thất bại | Đọc log chi tiết |
|
|
101
|
+
| `Out of memory` | Hết RAM | Tăng memory limit |
|
|
102
|
+
| `FATAL ERROR` | Lỗi nghiêm trọng | Restart và thử lại |
|
|
103
|
+
|
|
104
|
+
### Git Errors
|
|
105
|
+
|
|
106
|
+
| Pattern | Human Message | Action |
|
|
107
|
+
|---------|---------------|--------|
|
|
108
|
+
| `conflict` | Code bị xung đột | Merge conflict manually |
|
|
109
|
+
| `rejected` | Push bị từ chối | Pull trước khi push |
|
|
110
|
+
| `detached HEAD` | Không ở branch nào | Checkout về branch |
|
|
111
|
+
| `not a git repo` | Chưa init git | Chạy `git init` |
|
|
112
|
+
|
|
113
|
+
### Deploy Errors
|
|
114
|
+
|
|
115
|
+
| Pattern | Human Message | Action |
|
|
116
|
+
|---------|---------------|--------|
|
|
117
|
+
| `502 Bad Gateway` | Server không phản hồi | Restart server |
|
|
118
|
+
| `503 Service` | Server quá tải | Scale up resources |
|
|
119
|
+
| `permission denied` | Không có quyền deploy | Kiểm tra credentials |
|
|
120
|
+
| `quota exceeded` | Hết quota | Nâng cấp plan |
|
|
121
|
+
|
|
122
|
+
## Output Format
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
🔍 Translating error...
|
|
126
|
+
|
|
127
|
+
❌ Lỗi: [human_message]
|
|
128
|
+
└─ Gốc: [original_error_snippet]
|
|
129
|
+
|
|
130
|
+
💡 Gợi ý: [action]
|
|
131
|
+
└─ Hoặc chạy: /debug để tìm hiểu thêm
|
|
132
|
+
|
|
133
|
+
────────────────────────────────
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Fallback
|
|
137
|
+
|
|
138
|
+
If no pattern matches:
|
|
139
|
+
```
|
|
140
|
+
❌ Lỗi: Có vấn đề xảy ra
|
|
141
|
+
💡 Gợi ý: Chạy /debug để em phân tích chi tiết
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Performance
|
|
145
|
+
|
|
146
|
+
- Translation: < 100ms
|
|
147
|
+
- Pattern matching: Simple regex
|
|
148
|
+
- No external API calls
|
|
149
|
+
|
|
150
|
+
## Security
|
|
151
|
+
|
|
152
|
+
- Sanitize error messages (remove credentials, paths)
|
|
153
|
+
- Never expose sensitive info in translations
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: awf-onboarding
|
|
3
|
+
description: >-
|
|
4
|
+
First-time user onboarding experience. Keywords: new, first, start, begin,
|
|
5
|
+
welcome, tutorial, guide, learn, help me.
|
|
6
|
+
Activates on first /init or when .brain/preferences.json doesn't exist.
|
|
7
|
+
version: 1.0.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# AWF Onboarding
|
|
11
|
+
|
|
12
|
+
Hướng dẫn người dùng mới làm quen với AWF.
|
|
13
|
+
|
|
14
|
+
## Trigger Conditions
|
|
15
|
+
|
|
16
|
+
**Activates when:**
|
|
17
|
+
- User chạy `/init` lần đầu (không có `.brain/` folder)
|
|
18
|
+
- User chạy `/help` và chưa có preferences
|
|
19
|
+
- User nói "mới dùng", "hướng dẫn", "không biết bắt đầu"
|
|
20
|
+
|
|
21
|
+
**Check:**
|
|
22
|
+
```
|
|
23
|
+
if NOT exists(".brain/preferences.json") AND NOT exists("~/.antigravity/preferences.json"):
|
|
24
|
+
Activate onboarding
|
|
25
|
+
else:
|
|
26
|
+
Skip (returning user)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Execution Logic
|
|
30
|
+
|
|
31
|
+
### Step 1: Welcome Message
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
👋 **CHÀO MỪNG ĐẾN VỚI AWF!**
|
|
35
|
+
|
|
36
|
+
Em là trợ lý AI, sẽ giúp anh biến ý tưởng thành app thật.
|
|
37
|
+
|
|
38
|
+
🎯 AWF có thể giúp anh:
|
|
39
|
+
• Tạo app/website từ con số 0
|
|
40
|
+
• Không cần biết code (em làm giùm!)
|
|
41
|
+
• Nhớ mọi thứ giữa các lần làm việc
|
|
42
|
+
|
|
43
|
+
⏱️ Cho em 2 phút để hướng dẫn nhanh nhé?
|
|
44
|
+
|
|
45
|
+
1️⃣ Có, hướng dẫn em đi
|
|
46
|
+
2️⃣ Không cần, bắt đầu luôn
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 2: Quick Assessment (nếu chọn 1)
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
📊 **EM CẦN HIỂU ANH MỘT CHÚT:**
|
|
53
|
+
|
|
54
|
+
Anh đã từng làm app/website chưa?
|
|
55
|
+
|
|
56
|
+
1️⃣ Chưa bao giờ (newbie)
|
|
57
|
+
→ Em sẽ giải thích mọi thứ đơn giản
|
|
58
|
+
|
|
59
|
+
2️⃣ Có biết chút chút (basic)
|
|
60
|
+
→ Em giải thích khi cần
|
|
61
|
+
|
|
62
|
+
3️⃣ Dân IT rồi (technical)
|
|
63
|
+
→ Em nói chuyện như đồng nghiệp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 3: 5 Commands Tour
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
🗺️ **5 LỆNH QUAN TRỌNG NHẤT:**
|
|
70
|
+
|
|
71
|
+
┌─────────────────────────────────────────┐
|
|
72
|
+
│ 1️⃣ /brainstorm │
|
|
73
|
+
│ "Tôi có ý tưởng nhưng chưa rõ" │
|
|
74
|
+
│ → AI giúp làm rõ ý tưởng │
|
|
75
|
+
├─────────────────────────────────────────┤
|
|
76
|
+
│ 2️⃣ /plan │
|
|
77
|
+
│ "Tôi biết muốn làm gì rồi" │
|
|
78
|
+
│ → AI lên kế hoạch chi tiết │
|
|
79
|
+
├─────────────────────────────────────────┤
|
|
80
|
+
│ 3️⃣ /code │
|
|
81
|
+
│ "Bắt đầu viết code đi" │
|
|
82
|
+
│ → AI code theo kế hoạch │
|
|
83
|
+
├─────────────────────────────────────────┤
|
|
84
|
+
│ 4️⃣ /run │
|
|
85
|
+
│ "Chạy thử xem nào" │
|
|
86
|
+
│ → Khởi động app để xem kết quả │
|
|
87
|
+
├─────────────────────────────────────────┤
|
|
88
|
+
│ 5️⃣ /debug │
|
|
89
|
+
│ "Có lỗi rồi, sửa giùm" │
|
|
90
|
+
│ → AI tìm và sửa lỗi │
|
|
91
|
+
└─────────────────────────────────────────┘
|
|
92
|
+
|
|
93
|
+
💡 Mẹo: Không cần nhớ hết! Gõ /next bất cứ lúc nào
|
|
94
|
+
để em gợi ý nên làm gì tiếp.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 4: Quick Start Options
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
🚀 **BẮT ĐẦU THÔI!**
|
|
101
|
+
|
|
102
|
+
Anh muốn làm gì?
|
|
103
|
+
|
|
104
|
+
1️⃣ Tôi có ý tưởng app rồi → /plan
|
|
105
|
+
2️⃣ Chưa rõ, muốn bàn trước → /brainstorm
|
|
106
|
+
3️⃣ Hướng dẫn chi tiết hơn → /help
|
|
107
|
+
4️⃣ Tùy chỉnh cách AI nói chuyện → /customize
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 5: Initialize .brain/ Folder
|
|
111
|
+
|
|
112
|
+
**Tạo folder structure:**
|
|
113
|
+
```
|
|
114
|
+
.brain/
|
|
115
|
+
├── preferences.json
|
|
116
|
+
├── session.json
|
|
117
|
+
├── session_log.txt
|
|
118
|
+
└── brain.json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**preferences.json:**
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"communication": {
|
|
125
|
+
"tone": "friendly",
|
|
126
|
+
"personality": "assistant"
|
|
127
|
+
},
|
|
128
|
+
"technical": {
|
|
129
|
+
"technical_level": "[user_choice]",
|
|
130
|
+
"detail_level": "simple",
|
|
131
|
+
"autonomy_level": "ask_often"
|
|
132
|
+
},
|
|
133
|
+
"onboarding_completed": true,
|
|
134
|
+
"onboarding_date": "[timestamp]"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**session.json:**
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"updated_at": "[timestamp]",
|
|
142
|
+
"working_on": {
|
|
143
|
+
"feature": null,
|
|
144
|
+
"task": null,
|
|
145
|
+
"status": "idle"
|
|
146
|
+
},
|
|
147
|
+
"pending_tasks": [],
|
|
148
|
+
"errors_encountered": [],
|
|
149
|
+
"decisions_made": [
|
|
150
|
+
{
|
|
151
|
+
"decision": "Technical level set to [level]",
|
|
152
|
+
"reason": "User selection during onboarding"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"skipped_tests": []
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**session_log.txt:**
|
|
160
|
+
```
|
|
161
|
+
[YYYY-MM-DD HH:MM] ONBOARDING COMPLETE
|
|
162
|
+
[YYYY-MM-DD HH:MM] Technical level: [level]
|
|
163
|
+
[YYYY-MM-DD HH:MM] Ready for first project
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**brain.json:**
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"meta": {
|
|
170
|
+
"schema_version": "1.0.0",
|
|
171
|
+
"awf_version": "4.0.2",
|
|
172
|
+
"created_at": "[timestamp]"
|
|
173
|
+
},
|
|
174
|
+
"project": {
|
|
175
|
+
"name": null,
|
|
176
|
+
"type": null,
|
|
177
|
+
"status": "not_started"
|
|
178
|
+
},
|
|
179
|
+
"updated_at": "[timestamp]"
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Step 6: Save & Complete
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
✅ **HOÀN TẤT SETUP!**
|
|
187
|
+
|
|
188
|
+
Em đã tạo:
|
|
189
|
+
📁 .brain/
|
|
190
|
+
├── preferences.json (cài đặt của anh)
|
|
191
|
+
├── session.json (theo dõi tiến độ)
|
|
192
|
+
├── session_log.txt (nhật ký)
|
|
193
|
+
└── brain.json (kiến thức dự án)
|
|
194
|
+
|
|
195
|
+
💾 Mọi thứ sẽ được tự động lưu từ giờ!
|
|
196
|
+
|
|
197
|
+
────────────────────────
|
|
198
|
+
|
|
199
|
+
Giờ anh muốn làm gì?
|
|
200
|
+
|
|
201
|
+
1️⃣ Tạo dự án đầu tiên → /init
|
|
202
|
+
2️⃣ Bàn ý tưởng trước → /brainstorm
|
|
203
|
+
3️⃣ Xem hướng dẫn chi tiết → /help
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Returning User Detection
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
if exists("preferences.json") AND preferences.onboarding_completed == true:
|
|
210
|
+
|
|
211
|
+
Nếu > 7 ngày không dùng:
|
|
212
|
+
"👋 Chào mừng anh quay lại! Gõ /recap để em nhắc lại đang làm gì nhé."
|
|
213
|
+
|
|
214
|
+
Nếu < 7 ngày:
|
|
215
|
+
Skip welcome, vào thẳng workflow
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Error Handling
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
If cannot create .brain/ folder:
|
|
222
|
+
Try create in current directory
|
|
223
|
+
If still fail:
|
|
224
|
+
Warning: "⚠️ Em không tạo được folder lưu trữ, nhưng vẫn làm việc được!"
|
|
225
|
+
Continue in-memory mode
|
|
226
|
+
|
|
227
|
+
If user skips all steps:
|
|
228
|
+
Use defaults: technical_level = "basic"
|
|
229
|
+
Mark onboarding_completed = true
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Integration
|
|
233
|
+
|
|
234
|
+
**Với /init:**
|
|
235
|
+
```
|
|
236
|
+
/init được gọi
|
|
237
|
+
↓
|
|
238
|
+
Check .brain/ folder
|
|
239
|
+
↓
|
|
240
|
+
├── Không có → Chạy onboarding TRƯỚC
|
|
241
|
+
└── Có rồi → Chạy /init bình thường
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## Performance
|
|
245
|
+
|
|
246
|
+
- Total time: < 2 minutes
|
|
247
|
+
- No external API calls
|
|
248
|
+
- Minimal file I/O
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: awf-session-restore
|
|
3
|
+
description: >-
|
|
4
|
+
Lazy-loading context restore with 3 levels. Fast startup with minimal tokens.
|
|
5
|
+
Keywords: context, memory, session, restore, recap, remember, resume, continue.
|
|
6
|
+
version: 2.0.0
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# AWF Session Restore (Lazy Loading)
|
|
10
|
+
|
|
11
|
+
Khoi phuc context voi 3 cap do de tiet kiem token.
|
|
12
|
+
|
|
13
|
+
## Load Levels
|
|
14
|
+
|
|
15
|
+
| Level | Tokens | Khi nao | Gi duoc load |
|
|
16
|
+
|-------|--------|---------|--------------|
|
|
17
|
+
| 1 | ~200 | Luon luon | summary, current task, blockers |
|
|
18
|
+
| 2 | ~800 | /recap full | + decisions, pending tasks, recent files |
|
|
19
|
+
| 3 | ~2000 | /recap deep | + full history, all errors, conversation |
|
|
20
|
+
|
|
21
|
+
## Trigger Conditions
|
|
22
|
+
|
|
23
|
+
### Auto-Trigger (Level 1 only)
|
|
24
|
+
- Bat dau session moi
|
|
25
|
+
- Truoc moi AWF workflow
|
|
26
|
+
|
|
27
|
+
### Manual Trigger
|
|
28
|
+
- `/recap` → Level 1 (nhanh)
|
|
29
|
+
- `/recap full` → Level 1 + 2
|
|
30
|
+
- `/recap deep` → Level 1 + 2 + 3
|
|
31
|
+
- `/recap [topic]` → Smart search
|
|
32
|
+
|
|
33
|
+
## Execution Logic
|
|
34
|
+
|
|
35
|
+
### Level 1: Instant Load (Always)
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
load_level_1():
|
|
39
|
+
summary = session.summary
|
|
40
|
+
|
|
41
|
+
show:
|
|
42
|
+
"""
|
|
43
|
+
👋 Chao mung tro lai!
|
|
44
|
+
|
|
45
|
+
📍 Project: {summary.project}
|
|
46
|
+
📍 Dang lam: {summary.current_feature}
|
|
47
|
+
└─ Task: {summary.current_task}
|
|
48
|
+
└─ Status: {summary.status} ({summary.progress_percent}%)
|
|
49
|
+
|
|
50
|
+
⏭️ Buoc tiep: {summary.next_step}
|
|
51
|
+
🕐 Last saved: {format_time(updated_at)}
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
# Token cost: ~200
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Level 2: On-Demand (When Requested)
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
load_level_2():
|
|
61
|
+
load_level_1()
|
|
62
|
+
|
|
63
|
+
decisions = session.decisions_made[-5:] # Last 5
|
|
64
|
+
pending = session.pending_tasks[:5] # Next 5
|
|
65
|
+
files = session.working_on.files
|
|
66
|
+
|
|
67
|
+
show:
|
|
68
|
+
"""
|
|
69
|
+
─────────────────────────────
|
|
70
|
+
📋 Quyet dinh gan day:
|
|
71
|
+
{format_decisions(decisions)}
|
|
72
|
+
|
|
73
|
+
📝 Viec can lam:
|
|
74
|
+
{format_pending(pending)}
|
|
75
|
+
|
|
76
|
+
📁 Files dang sua:
|
|
77
|
+
{format_files(files)}
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
# Token cost: ~800 total
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Level 3: Deep Dive (Explicit Request)
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
load_level_3():
|
|
87
|
+
load_level_2()
|
|
88
|
+
|
|
89
|
+
errors = session.errors_encountered
|
|
90
|
+
checkpoints = session.context_checkpoints
|
|
91
|
+
changes = session.recent_changes
|
|
92
|
+
|
|
93
|
+
show:
|
|
94
|
+
"""
|
|
95
|
+
─────────────────────────────
|
|
96
|
+
🐛 Lich su loi:
|
|
97
|
+
{format_errors(errors)}
|
|
98
|
+
|
|
99
|
+
💾 Checkpoints:
|
|
100
|
+
{format_checkpoints(checkpoints)}
|
|
101
|
+
|
|
102
|
+
📜 Thay doi gan day:
|
|
103
|
+
{format_changes(changes)}
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
# Token cost: ~2000 total
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Smart Search: /recap [topic]
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
recap_topic(topic):
|
|
113
|
+
# Search in all tiers
|
|
114
|
+
results = search_session(topic)
|
|
115
|
+
results += search_brain(topic)
|
|
116
|
+
|
|
117
|
+
show:
|
|
118
|
+
"""
|
|
119
|
+
🔍 Tim kiem: "{topic}"
|
|
120
|
+
|
|
121
|
+
{format_search_results(results)}
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
# Only load relevant context
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Auto-Inject (System Prompt)
|
|
128
|
+
|
|
129
|
+
Khi bat dau session, inject Level 1 vao system prompt:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
## Session Context (Auto-loaded)
|
|
133
|
+
|
|
134
|
+
- Project: {project}
|
|
135
|
+
- Feature: {current_feature}
|
|
136
|
+
- Task: {current_task}
|
|
137
|
+
- Status: {status} ({progress}%)
|
|
138
|
+
- Blockers: {blockers_count}
|
|
139
|
+
|
|
140
|
+
[Conversation continues below...]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Token Budget
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Total context: 128K tokens
|
|
147
|
+
├── System prompt: 10K (fixed)
|
|
148
|
+
├── Conversation: 100K (dynamic)
|
|
149
|
+
├── Session load: 8K max
|
|
150
|
+
│ ├── Level 1: 200 (always)
|
|
151
|
+
│ ├── Level 2: 600 (on-demand)
|
|
152
|
+
│ └── Level 3: 1200 (explicit)
|
|
153
|
+
└── Buffer: 10K (safety)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Output Format
|
|
157
|
+
|
|
158
|
+
### /recap (Level 1)
|
|
159
|
+
```
|
|
160
|
+
👋 Chao mung tro lai!
|
|
161
|
+
|
|
162
|
+
📍 Project: ThaoCoffe
|
|
163
|
+
📍 Dang lam: User Authentication
|
|
164
|
+
└─ Task: Login form validation
|
|
165
|
+
└─ Status: coding (65%)
|
|
166
|
+
|
|
167
|
+
⏭️ Buoc tiep: Add password validation
|
|
168
|
+
🕐 Last saved: 2 gio truoc
|
|
169
|
+
|
|
170
|
+
💡 Go /recap full de xem chi tiet.
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### /recap full (Level 1+2)
|
|
174
|
+
```
|
|
175
|
+
[Level 1 output]
|
|
176
|
+
─────────────────────────────
|
|
177
|
+
📋 Quyet dinh gan day:
|
|
178
|
+
• Dung NextAuth (don gian hon)
|
|
179
|
+
• Validation bang Zod
|
|
180
|
+
• Session-based auth
|
|
181
|
+
|
|
182
|
+
📝 Viec can lam:
|
|
183
|
+
1. [HIGH] Add password validation
|
|
184
|
+
2. [MED] Implement remember me
|
|
185
|
+
3. [LOW] Add forgot password
|
|
186
|
+
|
|
187
|
+
📁 Files dang sua:
|
|
188
|
+
• src/app/login/page.tsx
|
|
189
|
+
• src/lib/auth.ts
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### /recap deep (All levels)
|
|
193
|
+
```
|
|
194
|
+
[Level 1+2 output]
|
|
195
|
+
─────────────────────────────
|
|
196
|
+
🐛 Lich su loi:
|
|
197
|
+
• CORS error → Fixed: added middleware
|
|
198
|
+
• Type error → Fixed: added null check
|
|
199
|
+
|
|
200
|
+
💾 Checkpoints (7 ngay):
|
|
201
|
+
• 2024-01-15 14:30 - workflow_end
|
|
202
|
+
• 2024-01-16 09:00 - user_leaving
|
|
203
|
+
|
|
204
|
+
📜 Thay doi gan day:
|
|
205
|
+
• [feature] Added login form
|
|
206
|
+
• [bugfix] Fixed CORS issue
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Error Handling
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
if session.json not found:
|
|
213
|
+
show: "Chua co session. Bat dau moi nhe!"
|
|
214
|
+
skip restore
|
|
215
|
+
|
|
216
|
+
if session.json corrupted:
|
|
217
|
+
try: restore from latest snapshot
|
|
218
|
+
if success:
|
|
219
|
+
show: "Da khoi phuc tu backup."
|
|
220
|
+
else:
|
|
221
|
+
show: "Session bi loi. Bat dau fresh!"
|
|
222
|
+
create new session
|
|
223
|
+
|
|
224
|
+
if summary missing:
|
|
225
|
+
generate summary from available data
|
|
226
|
+
save to session.json
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Performance
|
|
230
|
+
|
|
231
|
+
- Level 1 load: < 100ms
|
|
232
|
+
- Level 2 load: < 300ms
|
|
233
|
+
- Level 3 load: < 500ms
|
|
234
|
+
- Search: < 1s
|