@leejungkiin/awkit 1.0.1 → 1.0.3

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.
@@ -4,116 +4,243 @@ description: Smart Beads task management with Brain integration
4
4
  trigger: always
5
5
  ---
6
6
 
7
- # Beads Manager Skill (v5.0)
7
+ # Beads Manager Skill (v6.5) — Hierarchical Epic Architecture
8
8
 
9
- > **Purpose:** Quản lý tasks trong Beads với Brain context awareness.
9
+ > **Purpose:** Quản lý tasks trong Beads với 3-level hierarchy (Epic → Phase → Subtask),
10
+ > Brain context awareness, và structured JSON output.
11
+ >
12
+ > **Requires:** Beads CLI v0.47+ (`bd version` to check)
13
+
14
+ ---
15
+
16
+ ## Architecture Overview
17
+
18
+ ```
19
+ 🏔️ EPIC (bd create -t epic) ← 1 per /plan or /planExpert
20
+ ├── 📦 Phase Task (--parent <epic>) ← Groups of related work
21
+ │ ├── 📝 Subtask (--parent <phase>) ← Atomic unit of work (~15-30 min)
22
+ │ ├── 📝 Subtask
23
+ │ └── 📝 Subtask
24
+ ├── 📦 Phase Task
25
+ │ ├── 📝 Subtask
26
+ │ └── 📝 Subtask
27
+ └── ...
28
+ ```
29
+
30
+ **Key Principles:**
31
+ - 1 Epic = 1 Feature/Plan
32
+ - Phase = sequential group (dependencies between phases)
33
+ - Subtask = smallest unit AI executes in 1 session
34
+ - All commands use `--json` for structured output
35
+ - `bd ready --parent <epic>` = intelligent task selection
10
36
 
11
37
  ---
12
38
 
13
39
  ## Core Functions
14
40
 
15
- ### 1. Smart Task Creation
41
+ ### 1. `plan_to_beads()` Plan → Beads Sync
42
+
43
+ **Trigger:** When `/planExpert` or `/plan` finishes generating plan files.
44
+
45
+ **Process:**
16
46
 
17
- **Auto-Context:**
18
47
  ```bash
19
- # Khi tạo task, tự động:
20
- 1. Detect current plan/phase từ Brain
21
- 2. Link task to parent phase
22
- 3. Set priority based on dependencies
23
- 4. Add relevant labels
48
+ # Step 1: Create epic (root node)
49
+ EPIC_ID=$(bd create "Feature Name" -t epic -p 1 \
50
+ --description "Full feature description" \
51
+ --acceptance "High-level acceptance criteria" \
52
+ --design "Architecture approach (Clean Arch, MVVM, etc.)" \
53
+ --json | jq -r '.id')
54
+
55
+ # Step 2: Create phase tasks as children of epic
56
+ PHASE1_ID=$(bd create "Phase 1: Setup & Config" \
57
+ --parent $EPIC_ID -p 1 \
58
+ --description "Project scaffolding and configuration" \
59
+ --json | jq -r '.id')
60
+
61
+ PHASE2_ID=$(bd create "Phase 2: Backend API" \
62
+ --parent $EPIC_ID -p 1 \
63
+ --description "RESTful API endpoints" \
64
+ --json | jq -r '.id')
65
+
66
+ # Step 3: Create subtasks as children of phases
67
+ bd create "Setup project structure" \
68
+ --parent $PHASE1_ID -p 2 \
69
+ --acceptance "Directory structure matches architecture" \
70
+ --json
71
+
72
+ bd create "Configure database" \
73
+ --parent $PHASE1_ID -p 2 \
74
+ --acceptance "DB configured, migrations ready" \
75
+ --json
76
+
77
+ # Step 4: Set inter-phase dependencies
78
+ bd dep add $PHASE2_ID $PHASE1_ID # Phase 2 depends on Phase 1
79
+ bd dep add $PHASE3_ID $PHASE2_ID # Phase 3 depends on Phase 2
80
+
81
+ # Step 5: Save to brain
82
+ # → Update brain/active_plans.json with epic mapping
24
83
  ```
25
84
 
26
- **Example:**
27
- ```bash
28
- # User
29
- bd create "Fix login bug"
30
-
31
- # Skill auto-enhance
32
- bd create "Fix login bug" \
33
- --parent $CURRENT_PHASE_TASK \
34
- --label bug \
35
- --priority 0 \
36
- --note "Related to plan: Shopping Cart, Phase 02"
85
+ **Rules:**
86
+ - Mỗi `/planExpert` hoặc `/plan` tạo **đúng 1 epic**
87
+ - Epic chứa metadata tổng quan (acceptance + design)
88
+ - Caps: max 8 phases/epic, max 5 subtasks/phase
89
+ - Every subtask MUST have `--acceptance` criteria
90
+
91
+ **Output Report:**
92
+ ```
93
+ PLAN CREATED — "Shopping Cart Feature"
94
+
95
+ 🏔️ Epic: bd-a3f8 (Shopping Cart Feature)
96
+ ├── 📦 bd-b1c2 Phase 1: Setup & Config (3 subtasks)
97
+ ├── 📦 bd-d3e4 Phase 2: Backend API (3 subtasks)
98
+ ├── 📦 bd-f5g6 Phase 3: Frontend UI (2 subtasks)
99
+ └── 📦 bd-h7i8 Phase 4: Testing (2 subtasks)
100
+
101
+ 📊 Total: 1 epic, 4 phases, 10 subtasks
102
+ 📿 Dependencies: Phase 1 → 2 → 3 → 4
103
+
104
+ ➡️ Next: /codeExpert (starts first ready subtask)
37
105
  ```
38
106
 
39
107
  ---
40
108
 
41
- ### 2. Task Status Tracking
109
+ ### 2. `smart_pick()` — Intelligent Task Selection
110
+
111
+ **Trigger:** Session start, `/codeExpert`, `/next`
112
+
113
+ **Process:**
42
114
 
43
- **Auto-Update:**
44
115
  ```bash
45
- # Khi workflow hoàn thành
46
- /codeExpert Auto: bd update $TASK_ID --status done
116
+ # Step 1: Get current epic from brain
117
+ EPIC_ID=$(cat brain/active_plans.json | jq -r '.current.epic_id')
118
+
119
+ # Step 2: Check in-progress first
120
+ IN_PROGRESS=$(bd list --status in_progress --parent $EPIC_ID --json)
121
+ if [ "$IN_PROGRESS" != "[]" ]; then
122
+ # Resume existing task
123
+ echo "🔁 Resuming: $(echo $IN_PROGRESS | jq -r '.[0].title')"
124
+ exit 0
125
+ fi
126
+
127
+ # Step 3: Get ready (unblocked) tasks
128
+ READY=$(bd ready --parent $EPIC_ID --json --limit 5)
47
129
 
48
- # Khi gặp blocker
49
- /debugExpert fail Auto: bd update $TASK_ID --status blocked
130
+ # Step 4: Auto-claim first ready task
131
+ TASK_ID=$(echo $READY | jq -r '.[0].id')
132
+ bd update $TASK_ID --claim
50
133
  ```
51
134
 
52
- **Status Sync:**
53
- - `open` → Task mới tạo
54
- - `in_progress` Đang làm
55
- - `blocked` Bị chặn bởi task khác
56
- - `done` Hoàn thành
57
- - `cancelled` Hủy bỏ
135
+ **Output:**
136
+ ```
137
+ 🎯 Working on: bd-x1y2 "Configure database"
138
+ 📦 Phase: Phase 1: Setup & Config
139
+ Acceptance: DB configured, migrations ready
140
+ 📋 Design: Use Room/SQLite with migration support
141
+ ```
142
+
143
+ **Fallback (no epic):**
144
+ ```bash
145
+ # Legacy flat mode for backward compatibility
146
+ bd list --status in_progress --json
147
+ # or
148
+ bd ready --json --limit 5
149
+ ```
58
150
 
59
151
  ---
60
152
 
61
- ### 3. Dependency Management
153
+ ### 3. `cascade_complete()` — Smart Completion
154
+
155
+ **Trigger:** When a task/subtask is completed.
156
+
157
+ **Process:**
62
158
 
63
- **Auto-Detect:**
64
159
  ```bash
65
- # Khi tạo task từ plan
66
- Phase 01 Task A, B, C
67
- Phase 02 → Task D, E (depends on Phase 01)
68
-
69
- # Auto-create dependencies
70
- bd dep add D A
71
- bd dep add D B
72
- bd dep add D C
160
+ # Step 1: Close the subtask
161
+ bd close <subtask-id> --reason "Completed" --suggest-next
162
+
163
+ # Step 2: Check if parent phase can be auto-closed
164
+ bd epic close-eligible
165
+ # Auto-detects and closes phases/epics where all children are done
166
+
167
+ # Step 3: Update brain/active_plans.json
168
+ # → Mark completed phases, update progress
73
169
  ```
74
170
 
75
- **Blocker Alert:**
76
- ```bash
77
- # Khi user chọn task bị block
78
- /codeExpert → Check dependencies
79
- → "Task #125 blocked by #120 (not done yet)"
80
- → Suggest: "Do task #120 first?"
171
+ **Example Cascade:**
81
172
  ```
173
+ Close bd-z1 (last subtask of Phase 1)
174
+ ✅ bd-z1 closed — "Setup project structure"
175
+ ✅ bd-b1c2 auto-closed — Phase 1: Setup & Config (all 3/3 subtasks done)
176
+ → Next ready: bd-x2y3 "Create Cart model" (Phase 2, now unblocked)
177
+ ```
178
+
179
+ **Rules:**
180
+ - Auto-close phase when ALL its subtasks are done
181
+ - Auto-close epic when ALL its phases are done
182
+ - Always `--suggest-next` to show what's unblocked
183
+ - No user confirmation needed (low friction)
82
184
 
83
185
  ---
84
186
 
85
- ### 4. Task Filtering & Search
187
+ ### 4. `progress_dashboard()` Visual Progress
86
188
 
87
- **Smart Filters:**
88
- ```bash
89
- # By status
90
- bd list --status open
91
- bd list --status in_progress
189
+ **Trigger:** `/todo`, session start, after each task completion.
92
190
 
93
- # By label
94
- bd list --label bug
95
- bd list --label feature
191
+ **Process:**
96
192
 
97
- # By priority
98
- bd list --priority 0 # Critical
99
- bd list --priority 1 # High
100
- bd list --priority 2 # Normal
193
+ ```bash
194
+ # Get epic status
195
+ bd epic status --json
196
+ # Get hierarchy tree
197
+ bd list --parent $EPIC_ID --tree
198
+ ```
101
199
 
102
- # Ready to work (no blockers)
103
- bd ready
200
+ **Output:**
201
+ ```
202
+ 🏔️ Shopping Cart Feature [████████░░] 60%
203
+
204
+ ✅ Phase 1: Setup & Config [3/3] — DONE
205
+ 🔵 Phase 2: Backend API [1/3] — IN PROGRESS
206
+ ✅ bd-x2y3 Create Cart model
207
+ 🔵 bd-x3y4 Cart CRUD API ← CURRENT
208
+ ⬜ bd-x4y5 Payment integration
209
+ ⬜ Phase 3: Frontend UI [0/2] — BLOCKED (by Phase 2)
210
+ ⬜ Phase 4: Testing [0/2] — BLOCKED (by Phase 3)
211
+ ```
212
+
213
+ **Fallback (no epic):**
214
+ ```bash
215
+ # Legacy mode
216
+ bd list --status open --limit 10
217
+ bd list --status in_progress
104
218
  ```
105
219
 
106
220
  ---
107
221
 
108
- ### 5. Task Completion Flow
222
+ ### 5. `track_metadata()` — Rich Task Data
223
+
224
+ **Trigger:** When creating or updating any task.
225
+
226
+ **Fields to use:**
109
227
 
110
- **When task done:**
228
+ | Flag | Purpose | Example |
229
+ |------|---------|---------|
230
+ | `--description` | Detailed task description | "Implement REST endpoints for cart CRUD" |
231
+ | `--acceptance` | Definition of Done (DoD) | "All 4 endpoints return correct status codes" |
232
+ | `--design` | Architecture / implementation approach | "Repository pattern + Use Cases" |
233
+ | `--notes` | Runtime findings, blockers | "Found N+1 query issue, need optimization" |
234
+ | `--body-file` | Link to detailed spec file | "docs/specs/cart-api.md" |
235
+
236
+ **Example:**
111
237
  ```bash
112
- 1. bd update $TASK_ID --status done
113
- 2. Check if phase complete (all tasks done)
114
- 3. If phase complete Update plan.md progress
115
- 4. Suggest next task: bd ready
116
- 5. Prompt: "Save knowledge? /save-brain"
238
+ bd create "Implement Cart API" \
239
+ --parent $PHASE_ID -p 1 \
240
+ --description "REST endpoints: GET/POST/PUT/DELETE /api/cart" \
241
+ --acceptance "All CRUD ops work, validation on input, 401 for unauth" \
242
+ --design "Repository pattern, DTOs for request/response" \
243
+ --json
117
244
  ```
118
245
 
119
246
  ---
@@ -123,116 +250,130 @@ bd ready
123
250
  ### `/planExpert` Integration
124
251
 
125
252
  ```bash
126
- # After plan generation
127
- 1. Call sync_plan_to_beads.sh
128
- 2. Create parent + phase + task hierarchy
129
- 3. Set dependencies
130
- 4. Report: "Created 42 tasks in Beads"
253
+ # After plan generation — replaces flat loop
254
+ 1. bd create "<feature>" -t epic -p 1 --json # Create epic
255
+ 2. For each phase: bd create "<phase>" --parent <epic> --json # Phases
256
+ 3. For each task: bd create "<task>" --parent <phase> --acceptance "..." --json # Subtasks
257
+ 4. bd dep add <phase-N+1> <phase-N> # Sequential deps
258
+ 5. Save epic mapping → brain/active_plans.json
259
+ 6. Report tree view
131
260
  ```
132
261
 
133
262
  ### `/codeExpert` Integration
134
263
 
135
264
  ```bash
136
- # Before coding
137
- 1. bd list --status in_progress
138
- 2. If found Resume that task
139
- 3. If not bd ready → Pick P0 task
140
- 4. Update task status to in_progress
141
-
142
- # After coding
143
- 1. Run tests
144
- 2. If pass → bd update --status done
145
- 3. If fail → bd update --status blocked + create bug task
265
+ # Before coding — replaces manual bd list
266
+ 1. smart_pick() Get current or next ready task from epic
267
+ 2. Load acceptance criteria as DoD
268
+ 3. Code against acceptance criteria
269
+
270
+ # After coding — replaces bd update --status done
271
+ 1. cascade_complete() → Close task + auto-close parent if eligible
272
+ 2. Suggest next ready task
146
273
  ```
147
274
 
148
- ### `/debugExpert` Integration
275
+ ### `/plan` (Guided Mode) Integration
149
276
 
150
- ```bash
151
- # When bug found
152
- 1. bd create "Fix: $ERROR_MESSAGE" --label bug --priority 0
153
- 2. Link to failing task (if any)
154
- 3. After fix → bd update --status done
155
- ```
277
+ Same as `/planExpert` but phases/tasks created incrementally as user confirms each phase.
156
278
 
157
279
  ---
158
280
 
159
281
  ## Brain Integration
160
282
 
161
- ### Active Plans Tracking
283
+ ### `active_plans.json` Schema (v6.5)
162
284
 
163
285
  ```json
164
- // brain/active_plans.json
165
286
  {
166
287
  "current": {
167
- "plan_path": "plans/260130-1025-shopping-cart/",
288
+ "epic_id": "bd-a3f8",
168
289
  "feature": "Shopping Cart",
169
- "beads_parent_id": 456,
290
+ "plan_path": "plans/260301-2109-shopping-cart/",
170
291
  "phases": [
171
292
  {
172
- "name": "Phase 01: Setup",
173
- "beads_id": 457,
174
- "status": "done"
293
+ "beads_id": "bd-b1c2",
294
+ "name": "Phase 1: Setup & Config",
295
+ "subtasks": ["bd-c1d2", "bd-c3d4", "bd-c5d6"],
296
+ "status": "done",
297
+ "depends_on": null
175
298
  },
176
299
  {
177
- "name": "Phase 02: Backend",
178
- "beads_id": 458,
300
+ "beads_id": "bd-d3e4",
301
+ "name": "Phase 2: Backend API",
302
+ "subtasks": ["bd-e1f2", "bd-e3f4", "bd-e5f6"],
179
303
  "status": "in_progress",
180
- "tasks": [123, 124, 125]
304
+ "depends_on": "bd-b1c2"
181
305
  }
182
306
  ]
183
- }
307
+ },
308
+ "plans": []
184
309
  }
185
310
  ```
186
311
 
187
312
  ### Task-Knowledge Linking
188
313
 
189
314
  ```bash
190
- # When save knowledge
315
+ # When saving knowledge during a task
191
316
  /save-brain "How to fix N+1 query"
192
-
193
- # Auto-link to current task
194
- → Save to: brain/solutions/n1-query-fix_#123.md
195
- → Add reference in task: bd update 123 --note "Solution: brain/solutions/..."
317
+ → Save to: brain/solutions/n1-query-fix.md
318
+ Update task notes: bd update <id> --notes "Solution: brain/solutions/..."
196
319
  ```
197
320
 
198
321
  ---
199
322
 
200
- ## Commands Reference
323
+ ## Gate Updates Reference
201
324
 
202
- ### Basic Commands
325
+ ### Gate 0 — Session Start
203
326
 
204
327
  ```bash
205
- # Create task
206
- bd create "Task name" [--priority 0-2] [--label tag]
207
-
208
- # List tasks
209
- bd list [--status STATUS] [--label LABEL]
328
+ # Check active epic
329
+ EPIC_ID=$(cat brain/active_plans.json | jq -r '.current.epic_id // empty')
330
+
331
+ if [ -n "$EPIC_ID" ]; then
332
+ # Hierarchical mode
333
+ bd epic status --json # Epic progress
334
+ bd list --parent $EPIC_ID --tree # Tree view
335
+ else
336
+ # Legacy flat mode
337
+ bd list --status in_progress
338
+ bd list --status open --limit 3
339
+ fi
340
+ ```
210
341
 
211
- # Update task
212
- bd update <id> --status STATUS
342
+ ### Gate 1 — Before Coding
213
343
 
214
- # Show task details
215
- bd show <id>
344
+ ```bash
345
+ if [ -n "$EPIC_ID" ]; then
346
+ smart_pick() # From epic hierarchy
347
+ else
348
+ # Legacy: create flat task
349
+ bd create "[task summary]" --priority 1
350
+ bd update <id> --status in_progress
351
+ fi
352
+ ```
216
353
 
217
- # Add dependency
218
- bd dep add <child> <parent>
354
+ ### Gate 2 — After Completion
219
355
 
220
- # Ready tasks (no blockers)
221
- bd ready
356
+ ```bash
357
+ if [ -n "$EPIC_ID" ]; then
358
+ cascade_complete() # Close + auto-cascade + suggest next
359
+ else
360
+ bd update <id> --status done
361
+ bd list --status open --limit 3
362
+ fi
222
363
  ```
223
364
 
224
- ### Enhanced Commands (via Skill)
365
+ ---
225
366
 
226
- ```bash
227
- # Smart create (auto-context)
228
- /task "Task name" # Alias, auto-add context
367
+ ## Backward Compatibility
229
368
 
230
- # Quick status
231
- /todo # Alias for bd list
232
- /done "Note" # Mark current task done + save note
369
+ ```
370
+ Detection logic:
371
+ 1. Read brain/active_plans.json
372
+ 2. If "current.epic_id" exists → Hierarchical mode (v6.5)
373
+ 3. If "current.epic_id" missing → Legacy flat mode (v5.0)
374
+ 4. All legacy bd commands continue to work
233
375
 
234
- # Task navigation
235
- /next # Show next recommended task
376
+ No breaking changes. Existing flat tasks are unaffected.
236
377
  ```
237
378
 
238
379
  ---
@@ -243,68 +384,41 @@ bd ready
243
384
 
244
385
  ```bash
245
386
  if ! command -v bd &> /dev/null; then
246
- echo "⚠️ Beads not installed"
247
- echo "Fallback: Use Brain-only mode"
248
- # Continue without task tracking
387
+ echo "⚠️ Beads CLI not installed"
388
+ echo "Fallback: Brain-only mode (active_plans.json tracking)"
249
389
  fi
250
390
  ```
251
391
 
252
- ### Task Not Found
392
+ ### Beads Version Too Old
253
393
 
254
394
  ```bash
255
- bd show 999
256
- "❌ Task #999 not found"
257
- Suggest: "bd list to see all tasks"
395
+ BD_VERSION=$(bd version 2>/dev/null | grep -oP '\d+\.\d+\.\d+')
396
+ # Require 0.47+ for --parent, -t epic, --json, bd epic
397
+ if [ "$(printf '%s\n' "0.47.0" "$BD_VERSION" | sort -V | head -n1)" != "0.47.0" ]; then
398
+ echo "⚠️ Beads $BD_VERSION too old. Need 0.47+. Falling back to flat mode."
399
+ fi
258
400
  ```
259
401
 
260
- ### Circular Dependency
402
+ ### No Active Epic
261
403
 
262
404
  ```bash
263
- bd dep add A B
264
- bd dep add B A
265
- → "❌ Circular dependency detected"
266
- → Suggest: "Remove one dependency"
405
+ # Graceful fallback to legacy flat mode
406
+ # All functions check for epic_id first, fall back to flat commands
267
407
  ```
268
408
 
269
409
  ---
270
410
 
271
- ## Performance
272
-
273
- - **Task Creation:** < 100ms
274
- - **List Tasks:** < 200ms (for 100 tasks)
275
- - **Dependency Check:** < 50ms
276
- - **Brain Sync:** < 500ms
277
-
278
- ---
279
-
280
- ## Example Workflow
411
+ ## Commands Quick Reference
281
412
 
282
- ```bash
283
- # 1. Create plan
284
- /planExpert "Shopping Cart"
285
- Creates 42 tasks in Beads
286
-
287
- # 2. Check tasks
288
- bd list
289
- Shows all tasks with status
290
-
291
- # 3. Start coding
292
- /codeExpert
293
- → Auto-picks task #123 (P0, ready)
294
- → Updates status to in_progress
295
-
296
- # 4. Complete task
297
- → Tests pass
298
- → Auto: bd update 123 --status done
299
-
300
- # 5. Next task
301
- /next
302
- → Suggests task #124 (next P0)
303
-
304
- # 6. Save knowledge
305
- /save-brain "Login API implementation"
306
- → Links to task #123
307
- ```
413
+ | Command | v5.0 (Old) | v6.5 (New) |
414
+ |---------|------------|------------|
415
+ | Create plan tasks | `bd create` loop | `bd create -t epic` + `--parent` hierarchy |
416
+ | Pick next task | `bd list --status open` | `bd ready --parent <epic> --json` |
417
+ | Claim task | `bd update --status in_progress` | `bd update --claim` |
418
+ | Complete task | `bd update --status done` | `bd close --reason --suggest-next` |
419
+ | Close phase | Manual | `bd epic close-eligible` (auto) |
420
+ | View progress | `bd list` | `bd list --parent <epic> --tree` |
421
+ | Epic status | N/A | `bd epic status --json` |
308
422
 
309
423
  ---
310
424
 
@@ -317,7 +431,10 @@ bd list
317
431
  "auto_create": true,
318
432
  "auto_update": true,
319
433
  "default_priority": 2,
320
- "labels": ["feature", "bug", "refactor"]
434
+ "max_phases_per_epic": 8,
435
+ "max_subtasks_per_phase": 5,
436
+ "use_hierarchy": true,
437
+ "labels": ["feature", "bug", "refactor", "chore"]
321
438
  }
322
439
  }
323
440
  ```