opencode-athena 0.9.0 → 0.10.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/README.md CHANGED
@@ -230,6 +230,77 @@ Todo sync is enabled by default. To disable:
230
230
  }
231
231
  ```
232
232
 
233
+ ## Story Complexity Analysis
234
+
235
+ Athena automatically checks story complexity before implementation and suggests decomposition when stories are too large. This prevents context compaction issues during implementation.
236
+
237
+ ### How It Works
238
+
239
+ When you run `/athena-dev`, Athena:
240
+
241
+ 1. **Analyzes the story** - Counts tasks, estimates effort points per task
242
+ 2. **Compares against thresholds** - Research-backed limits (8 tasks / 8 points warning, 12 tasks / 13 points critical)
243
+ 3. **Recommends action** - `proceed`, `suggest-decomposition`, or `require-decomposition`
244
+ 4. **Offers decomposition** - Automatically groups tasks and creates sub-stories
245
+
246
+ ### Effort Estimation
247
+
248
+ Each task is scored based on:
249
+
250
+ | Signal | Points Added |
251
+ |--------|--------------|
252
+ | Many subtasks (>5) | +3 |
253
+ | High-effort keywords (implement, create, refactor) | +2 |
254
+ | Medium-effort keywords (add, update, modify) | +1 |
255
+ | Testing/verification required | +1 |
256
+ | External system integration (API, database) | +1 |
257
+ | Vague description | +2 |
258
+
259
+ Points are mapped to Fibonacci scale: 1, 2, 3, 5, 8.
260
+
261
+ ### Decomposition
262
+
263
+ When decomposition is recommended, Athena:
264
+
265
+ 1. **Groups tasks by concern** - UI, core logic, integration, testing
266
+ 2. **Balances groups** - Target ~8 points per sub-story
267
+ 3. **Handles dependencies** - Testing tasks depend on implementation tasks
268
+ 4. **Preserves dev notes** - Applicable sections copied to each sub-story
269
+
270
+ **Filename format:**
271
+ - Original: `3-2-reset-list-screen.md`
272
+ - Sub-stories: `3-2a-reset-list-screen.md`, `3-2b-reset-list-screen.md`
273
+
274
+ ### Tools
275
+
276
+ | Tool | Description |
277
+ |------|-------------|
278
+ | `athena_analyze_story` | Analyze story complexity and get recommendations |
279
+ | `athena_decompose_story` | Split story into sub-stories |
280
+
281
+ ### Example Output
282
+
283
+ ```
284
+ 📊 COMPLEXITY ANALYSIS
285
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
286
+ Tasks: 10 / 8 recommended ⚠️
287
+ Points: 15 / 8 threshold 🔴
288
+ File size: 12KB / 30KB ✅
289
+ Estimated compactions: 1
290
+
291
+ 🔀 SUGGESTED DECOMPOSITION
292
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
293
+ Story 3.2a: Core Implementation
294
+ ├─ Tasks: 1, 2, 3, 4
295
+ ├─ Points: ~8
296
+ └─ Dependencies: None
297
+
298
+ Story 3.2b: Testing & Verification
299
+ ├─ Tasks: 5, 6, 7
300
+ ├─ Points: ~7
301
+ └─ Dependencies: 3.2a
302
+ ```
303
+
233
304
  ## Configuration
234
305
 
235
306
  Configuration files are stored in `~/.config/opencode/`:
@@ -4,6 +4,25 @@ description: Implement the current BMAD story using Sisyphus and specialized sub
4
4
 
5
5
  # Athena Dev - Story Implementation
6
6
 
7
+ ## Instructions
8
+
9
+ You receive: `$ARGUMENTS`
10
+
11
+ **Parse the argument and load the story:**
12
+
13
+ 1. **If argument is provided** (e.g., "4.5", "story-4-5", "docs/stories/story-4-5.md"):
14
+ - Call `athena_get_story({ storyId: "<argument>" })`
15
+ - The tool handles all formats: story IDs, file paths, and `@` references
16
+ - **Proceed immediately** with Step 0 (Complexity Check) after loading
17
+
18
+ 2. **If no argument provided**:
19
+ - Call `athena_get_story()` to load the next ready story
20
+ - **Proceed immediately** with Step 0 (Complexity Check) after loading
21
+
22
+ **Do NOT ask clarifying questions about which story to implement. Load it and start working.**
23
+
24
+ ---
25
+
7
26
  ## Git Operations Policy
8
27
 
9
28
  **⚠️ AUTOMATIC GIT OPERATIONS ARE PROHIBITED**
@@ -33,7 +52,7 @@ I've completed the implementation. Would you like me to:
33
52
  ```
34
53
  athena_update_status({
35
54
  storyId: "X.Y",
36
- status: "completed",
55
+ status: "done",
37
56
  completionSummary: "What was implemented..."
38
57
  })
39
58
  ```
@@ -42,29 +61,112 @@ This updates sprint-status.yaml without requiring git commits.
42
61
 
43
62
  ---
44
63
 
45
- You are implementing a BMAD story using OpenCode Athena's full capabilities.
64
+ ## Step 0: Complexity Check (Before Implementation)
46
65
 
47
- **You are Sisyphus, the orchestrator.** You will coordinate subagents and tools to implement this story efficiently and correctly.
66
+ **After loading the story, check if it's too large to implement comfortably.**
48
67
 
49
- ## Step 1: Load Story Context
68
+ Call **athena_analyze_story** to assess complexity:
69
+
70
+ ```
71
+ athena_analyze_story({ storyId: "<story ID from Step 1>" })
72
+ ```
73
+
74
+ This returns:
75
+ - **Metrics**: Task count, subtasks, file size
76
+ - **Effort estimates**: Points per task with signals (API calls, state mgmt, etc.)
77
+ - **Recommendation**: `proceed`, `suggest-decomposition`, or `require-decomposition`
78
+ - **Suggested splits**: If decomposition recommended
79
+
80
+ ### If recommendation is `proceed`:
81
+
82
+ Continue with **Step 1.5** (Sync Todos) and normal implementation.
83
+
84
+ ### If recommendation is `suggest-decomposition`:
85
+
86
+ Present the analysis to the user:
87
+
88
+ ```
89
+ 📊 STORY COMPLEXITY ANALYSIS
90
+
91
+ This story has {X} tasks totaling ~{Y} story points.
92
+ Research suggests stories >8 points often cause context compaction issues.
93
+
94
+ SUGGESTED DECOMPOSITION:
95
+ {show the suggested splits}
96
+
97
+ What would you like to do?
98
+ [D] Decompose into sub-stories (recommended)
99
+ [P] Proceed with full story anyway
100
+ [M] Modify the decomposition groupings
101
+ ```
50
102
 
51
- Call **athena_get_story** to load the current story context:
103
+ **If user chooses [D] (Decompose):**
104
+ ```
105
+ athena_decompose_story({
106
+ storyId: "<story ID>",
107
+ useSuggestedSplits: true,
108
+ confirmed: true
109
+ })
110
+ ```
52
111
 
112
+ Then load the first sub-story:
53
113
  ```
54
- athena_get_story()
114
+ athena_get_story({ storyId: "<returned nextStory>" })
55
115
  ```
56
116
 
57
- If you need a specific story, pass the story ID:
117
+ **If user chooses [P] (Proceed):**
118
+ Continue with normal implementation, but warn:
119
+ > ⚠️ This story may require multiple compactions. Progress will be preserved via todo sync.
58
120
 
121
+ **If user chooses [M] (Modify):**
122
+ Work with the user to adjust task groupings, then call:
59
123
  ```
60
- athena_get_story({ storyId: "2.3" })
124
+ athena_decompose_story({
125
+ storyId: "<story ID>",
126
+ splits: [
127
+ { suffix: "a", taskIds: ["1", "2"], title: "Custom title" },
128
+ { suffix: "b", taskIds: ["3", "4", "5"] }
129
+ ],
130
+ confirmed: true
131
+ })
61
132
  ```
62
133
 
63
- This returns:
134
+ ### If recommendation is `require-decomposition`:
135
+
136
+ **Do NOT proceed without decomposition.** The story is too large.
137
+
138
+ ```
139
+ 🚫 STORY TOO LARGE
140
+
141
+ This story has {X} tasks totaling ~{Y} story points.
142
+ Stories this size consistently cause implementation problems.
143
+
144
+ Decomposition is REQUIRED before implementation.
145
+
146
+ {show the suggested splits}
147
+
148
+ [D] Decompose into sub-stories
149
+ [M] Modify the decomposition groupings
150
+ ```
151
+
152
+ Wait for user decision before proceeding.
153
+
154
+ ---
155
+
156
+ You are implementing a BMAD story using OpenCode Athena's full capabilities.
157
+
158
+ **You are Sisyphus, the orchestrator.** You will coordinate subagents and tools to implement this story efficiently and correctly.
159
+
160
+ ## Step 1: Load Story Context
161
+
162
+ **Note:** Story loading happens in the Instructions section above. This step documents what `athena_get_story` returns for reference.
163
+
164
+ `athena_get_story()` returns:
64
165
  - **Story**: Requirements and acceptance criteria
65
166
  - **Architecture**: Relevant technical patterns and decisions
66
167
  - **PRD**: Relevant functional requirements
67
168
  - **Sprint progress**: Where this story fits in the overall sprint
169
+ - **Todos**: Pre-formatted task list for `todowrite`
68
170
 
69
171
  **CRITICAL: Check for Implementation Notes from Previous Review**
70
172
 
@@ -109,13 +211,14 @@ This means `/athena-review` was run previously and findings were discussed with
109
211
  ### If No Implementation Notes Exist:
110
212
 
111
213
  This is a **fresh implementation** - proceed with the normal workflow:
112
- - Understand requirements and acceptance criteria
113
- - Plan your approach (Step 2)
114
- - Implement the story (Step 3)
115
- - Verify implementation (Step 4)
116
- - Complete the story (Step 5)
214
+ - Step 0: Check complexity (already done above)
215
+ - Step 1.5: Sync todos from story
216
+ - Step 2: Plan your approach
217
+ - Step 3: Implement the story
218
+ - Step 4: Verify implementation
219
+ - Step 5: Complete the story
117
220
 
118
- ## Step 1.5: Sync Todos (Automatic)
221
+ ## Step 1.5: Sync Todos
119
222
 
120
223
  When `athena_get_story` returns, it includes a `todos` section with BMAD tasks formatted for the todo list.
121
224
 
@@ -342,7 +445,7 @@ When implementation is verified and ready, update the status:
342
445
  ```
343
446
  athena_update_status({
344
447
  storyId: "<story ID>",
345
- status: "completed",
448
+ status: "done",
346
449
  completionSummary: "Implemented {feature}. {What was built}. {Tests status}. {Any notes}."
347
450
  })
348
451
  ```
@@ -365,7 +468,7 @@ If the story isn't complete but you need to save progress:
365
468
  ```
366
469
  athena_update_status({
367
470
  storyId: "<story ID>",
368
- status: "in_progress",
471
+ status: "in-progress",
369
472
  notes: "Progress: {what's done}. Remaining: {what's left}."
370
473
  })
371
474
  ```
@@ -392,6 +495,10 @@ Your workflow as Sisyphus:
392
495
 
393
496
  ```
394
497
  1. Load story (athena_get_story)
498
+ 0. Check complexity (athena_analyze_story)
499
+ - If too large → decompose first
500
+ - If manageable → proceed
501
+ 1.5. Sync todos (todowrite)
395
502
  2. Plan approach:
396
503
  - @explore → Find similar code in codebase
397
504
  - @librarian → Research unfamiliar tech
@@ -61,7 +61,7 @@ When you begin implementing a story:
61
61
  ```
62
62
  athena_update_status({
63
63
  storyId: "2.4",
64
- status: "in_progress"
64
+ status: "in-progress"
65
65
  })
66
66
  ```
67
67
 
@@ -77,7 +77,7 @@ When implementation is done and verified:
77
77
  ```
78
78
  athena_update_status({
79
79
  storyId: "2.4",
80
- status: "completed",
80
+ status: "done",
81
81
  completionSummary: "Implemented OAuth2 login flow with Google and GitHub providers. Added token refresh mechanism. All tests passing."
82
82
  })
83
83
  ```
@@ -126,7 +126,7 @@ When ready for code review or QA:
126
126
  ```
127
127
  athena_update_status({
128
128
  storyId: "2.4",
129
- status: "needs_review"
129
+ status: "review"
130
130
  })
131
131
  ```
132
132
 
@@ -149,21 +149,21 @@ athena_update_status({
149
149
  ┌──────────────────────────────────────────────────────────────┐
150
150
  │ 2. START IMPLEMENTATION │
151
151
  │ /athena-dev → Load story, plan, implement │
152
- │ Status: pendingin_progress
152
+ │ Status: backlogin-progress
153
153
  └──────────────────────────────────────────────────────────────┘
154
154
 
155
155
 
156
156
  ┌──────────────────────────────────────────────────────────────┐
157
157
  │ 3. QUALITY GATE (Optional but Recommended) │
158
158
  │ /athena-review → Oracle code review + adversarial review │
159
- │ Status: in_progressneeds_reviewcompleted/in_progress
159
+ │ Status: in-progressreviewdone/in-progress
160
160
  └──────────────────────────────────────────────────────────────┘
161
161
 
162
162
 
163
163
  ┌──────────────────────────────────────────────────────────────┐
164
164
  │ 4. COMPLETE & NEXT │
165
165
  │ /athena-status → Verify completion, see next story │
166
- │ Status: in_progresscompleted
166
+ │ Status: in-progressdone
167
167
  └──────────────────────────────────────────────────────────────┘
168
168
 
169
169
 
@@ -186,31 +186,32 @@ athena_update_status({
186
186
  ### Valid Status Flow
187
187
 
188
188
  ```
189
- pending ──────┬─────────────────────────────────────────┐
189
+ backlog ──────┬─────────────────────────────────────────┐
190
190
  │ │
191
191
  ▼ │
192
- in_progress ◄──────────────────────────┐ │
192
+ in-progress ◄──────────────────────────┐ │
193
193
  │ │ │
194
194
  ├──────► blocked ─────────────────┘ │
195
195
  │ │ │
196
196
  │ └────────────────────────────┘
197
197
  │ (when unblocked)
198
198
 
199
- ├──────► needs_review ────────────┐
199
+ ├──────► review ──────────────────┐
200
200
  │ │
201
201
  │ ▼
202
- └──────────────────────────► completed
202
+ └──────────────────────────────► done
203
203
  ```
204
204
 
205
205
  ### Status Definitions
206
206
 
207
207
  | Status | Meaning | Next Actions |
208
208
  |--------|---------|--------------|
209
- | **pending** | Not yet started | Start with `/athena-dev` |
210
- | **in_progress** | Actively being worked on | Continue implementation |
209
+ | **backlog** | Not yet started | Start with `/athena-dev` |
210
+ | **ready-for-dev** | Reviewed and ready for implementation | Start with `/athena-dev` |
211
+ | **in-progress** | Actively being worked on | Continue implementation |
211
212
  | **blocked** | Waiting for external dependency | Resolve blocker, then resume |
212
- | **needs_review** | Ready for review | Run `/athena-review` |
213
- | **completed** | Done and verified | Move to next story |
213
+ | **review** | Ready for review | Run `/athena-review` |
214
+ | **done** | Done and verified | Move to next story |
214
215
 
215
216
  ## Handling Special Cases
216
217
 
@@ -222,8 +223,8 @@ If you return to a story after a break:
222
223
  # Check current state
223
224
  athena_get_story()
224
225
 
225
- # If status is in_progress, continue
226
- # If status is pending, start fresh with /athena-dev
226
+ # If status is in-progress, continue
227
+ # If status is backlog or ready-for-dev, start fresh with /athena-dev
227
228
  ```
228
229
 
229
230
  ### Story Dependencies
@@ -245,7 +246,7 @@ When a blocker is resolved:
245
246
  ```
246
247
  athena_update_status({
247
248
  storyId: "2.4",
248
- status: "in_progress",
249
+ status: "in-progress",
249
250
  notes: "Blocker resolved. Received API credentials from DevOps. Resuming implementation."
250
251
  })
251
252
  ```
@@ -257,7 +258,7 @@ If issues are found after marking complete:
257
258
  ```
258
259
  athena_update_status({
259
260
  storyId: "2.4",
260
- status: "in_progress",
261
+ status: "in-progress",
261
262
  notes: "Reopened: Found edge case not covered. Need to add handling for empty input."
262
263
  })
263
264
  ```
@@ -274,7 +275,7 @@ When reviewing sprint status, watch for:
274
275
 
275
276
  ### Warning Signs
276
277
  - ⚠️ Multiple stories blocked
277
- - ⚠️ Story in_progress for too long
278
+ - ⚠️ Story in-progress for too long
278
279
  - ⚠️ No progress for extended time
279
280
  - ⚠️ Blockers not getting resolved
280
281
 
@@ -283,7 +284,7 @@ When reviewing sprint status, watch for:
283
284
  | Warning | Action |
284
285
  |---------|--------|
285
286
  | Multiple blocked stories | Escalate blockers, prioritize resolution |
286
- | Story stuck in_progress | Break into smaller tasks, ask for help |
287
+ | Story stuck in-progress | Break into smaller tasks, ask for help |
287
288
  | No progress | Check for hidden blockers, reassess scope |
288
289
  | Blockers aging | Follow up with responsible parties |
289
290
 
package/dist/cli/index.js CHANGED
@@ -1011,10 +1011,10 @@ z.object({
1011
1011
  )
1012
1012
  });
1013
1013
  z.object({
1014
- storyId: z.string().describe("The story ID (e.g., '2.3')"),
1015
- status: z.enum(["in_progress", "completed", "blocked", "needs_review"]).describe("The new status for the story"),
1014
+ storyId: z.string().describe("The story ID (e.g., '2.3' or '2-3')"),
1015
+ status: z.enum(["in-progress", "review", "done", "blocked"]).describe("The new status for the story (BMAD v6 hyphenated format)"),
1016
1016
  notes: z.string().optional().describe("Notes about the status change (required for 'blocked' status)"),
1017
- completionSummary: z.string().optional().describe("Summary of what was implemented (required for 'completed' status)")
1017
+ completionSummary: z.string().optional().describe("Summary of what was implemented (required for 'done' status)")
1018
1018
  });
1019
1019
  z.object({
1020
1020
  includeArchitecture: z.boolean().optional().default(true),
@@ -1030,6 +1030,41 @@ z.object({
1030
1030
  key: z.string().optional().describe("Configuration key (dot notation, e.g., 'bmad.autoStatusUpdate')"),
1031
1031
  value: z.unknown().optional().describe("Value to set (for 'set' action)")
1032
1032
  });
1033
+ var BmadStoryStatusEnum = z.enum([
1034
+ "backlog",
1035
+ "ready-for-dev",
1036
+ "in-progress",
1037
+ "review",
1038
+ "done",
1039
+ "blocked"
1040
+ ]);
1041
+ z.enum(["backlog", "in-progress", "done"]);
1042
+ z.enum(["optional", "done"]);
1043
+ var BmadDevelopmentStatusEnum = z.enum([
1044
+ "backlog",
1045
+ "ready-for-dev",
1046
+ "in-progress",
1047
+ "review",
1048
+ "done",
1049
+ "blocked",
1050
+ "optional"
1051
+ ]);
1052
+ z.object({
1053
+ generated: z.string().optional(),
1054
+ project: z.string().optional(),
1055
+ project_key: z.string().optional(),
1056
+ tracking_system: z.string().optional(),
1057
+ story_location: z.string().optional(),
1058
+ current_story: z.string().nullable().optional(),
1059
+ last_modified: z.string().optional(),
1060
+ development_status: z.record(z.string(), BmadDevelopmentStatusEnum)
1061
+ });
1062
+ z.object({
1063
+ storyId: z.string().describe("The story ID (e.g., '2.3' or '2-3')"),
1064
+ status: BmadStoryStatusEnum.describe("The new status for the story"),
1065
+ notes: z.string().optional().describe("Notes about the status change (required for 'blocked')"),
1066
+ completionSummary: z.string().optional().describe("Summary of implementation (required for 'done')")
1067
+ });
1033
1068
  var StoryStatusEnum = z.enum([
1034
1069
  "pending",
1035
1070
  "in_progress",
@@ -1038,11 +1073,12 @@ var StoryStatusEnum = z.enum([
1038
1073
  "needs_review"
1039
1074
  ]);
1040
1075
  z.enum([
1041
- "pending",
1042
- "in_progress",
1043
- "completed",
1076
+ "backlog",
1077
+ "ready-for-dev",
1078
+ "in-progress",
1079
+ "review",
1080
+ "done",
1044
1081
  "blocked",
1045
- "needs_review",
1046
1082
  "loading"
1047
1083
  ]);
1048
1084
  z.object({