opencode-athena 0.0.1

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.
@@ -0,0 +1,266 @@
1
+ ---
2
+ description: Work on multiple stories in parallel using background agents
3
+ ---
4
+
5
+ # Athena Parallel - Multi-Story Execution
6
+
7
+ > **⚠️ NOT YET IMPLEMENTED**
8
+ >
9
+ > This command describes **planned functionality** that is not yet available. The `athena_parallel` tool is a placeholder. This document describes the intended behavior for future implementation.
10
+
11
+ Execute multiple BMAD stories simultaneously using background agents for maximum throughput.
12
+
13
+ ## Planned Behavior
14
+
15
+ ### When to Use This Command
16
+
17
+ - Multiple independent stories in the sprint backlog
18
+ - Stories work on different parts of the codebase (no file conflicts)
19
+ - You want to maximize development throughput
20
+ - Stories have no dependencies on each other
21
+
22
+ ### Prerequisites
23
+
24
+ - Multiple pending stories in `sprint-status.yaml`
25
+ - Stories must be independent (no blocking dependencies)
26
+ - Stories should not modify the same files
27
+ - Sufficient context window capacity for coordination
28
+
29
+ ## Planned Workflow
30
+
31
+ ### Step 1: Check Sprint Status
32
+
33
+ First, view available stories:
34
+
35
+ ```
36
+ athena_get_story()
37
+ ```
38
+
39
+ Identify stories that can safely run in parallel:
40
+ - ✅ Different modules or directories
41
+ - ✅ No shared file modifications
42
+ - ✅ No data dependencies
43
+ - ❌ Avoid stories that modify the same files
44
+
45
+ ### Step 2: Analyze for Conflicts (Planned)
46
+
47
+ The `athena_parallel` tool will analyze stories for potential conflicts:
48
+
49
+ ```
50
+ athena_parallel({
51
+ storyIds: ["2.1", "2.2", "2.3"],
52
+ dryRun: true // Just check for conflicts, don't execute
53
+ })
54
+ ```
55
+
56
+ **Planned conflict detection:**
57
+ - Parse story requirements for file paths mentioned
58
+ - Check architecture.md for overlapping components
59
+ - Identify shared dependencies
60
+ - Report potential conflicts before execution
61
+
62
+ ### Step 3: Execute in Parallel (Planned)
63
+
64
+ ```
65
+ athena_parallel({
66
+ storyIds: ["2.1", "2.2", "2.3"],
67
+ waitForCompletion: false // Return immediately, run in background
68
+ })
69
+ ```
70
+
71
+ **Planned execution flow:**
72
+ 1. Validate no conflicts between selected stories
73
+ 2. Mark all stories as `in_progress` in `sprint-status.yaml`
74
+ 3. Spawn background agent for each story
75
+ 4. Each agent runs `/athena-dev` workflow independently
76
+ 5. Coordinate to prevent concurrent file modifications
77
+ 6. Report completion as each story finishes
78
+
79
+ ### Step 4: Monitor Progress (Planned)
80
+
81
+ **Planned monitoring capabilities:**
82
+
83
+ ```
84
+ athena_parallel({
85
+ action: "status"
86
+ })
87
+ ```
88
+
89
+ Returns:
90
+ - Which stories are running
91
+ - Progress of each background agent
92
+ - Any conflicts or blockers encountered
93
+ - Estimated completion time
94
+
95
+ ### Step 5: Handle Completion (Planned)
96
+
97
+ When stories complete:
98
+ - `sprint-status.yaml` updated automatically
99
+ - Notification sent for each completion
100
+ - Combined test run suggested
101
+ - Integration check recommended
102
+
103
+ ## Planned Features
104
+
105
+ ### Conflict Prevention
106
+
107
+ | Conflict Type | Detection | Resolution |
108
+ |---------------|-----------|------------|
109
+ | Same file edits | Pre-execution analysis | Reject parallel execution |
110
+ | Shared dependencies | Architecture analysis | Sequential for conflict area |
111
+ | Data dependencies | Story requirement parsing | Enforce story order |
112
+
113
+ ### Coordination Strategies (Planned)
114
+
115
+ **File-level locking:**
116
+ - First agent to touch a file gets exclusive access
117
+ - Other agents wait if they need the same file
118
+
119
+ **Module-level partitioning:**
120
+ - Assign stories to non-overlapping code areas
121
+ - Detect boundary violations
122
+
123
+ **Merge coordination:**
124
+ - If conflicts occur, pause and notify
125
+ - User resolves manually or chooses which version wins
126
+
127
+ ### Configuration (Planned)
128
+
129
+ ```json
130
+ // athena.json
131
+ {
132
+ "parallel": {
133
+ "maxConcurrentStories": 3,
134
+ "conflictStrategy": "prevent", // or "coordinate" or "manual"
135
+ "notifyOnComplete": true,
136
+ "autoRunTests": true
137
+ }
138
+ }
139
+ ```
140
+
141
+ ## Current Workaround
142
+
143
+ Until `athena_parallel` is implemented, you can achieve similar results manually:
144
+
145
+ ### Manual Parallel Workflow
146
+
147
+ **1. Open multiple terminal sessions:**
148
+
149
+ ```bash
150
+ # Terminal 1 - Primary story (your focus)
151
+ opencode
152
+ # Run /athena-dev for story 2.1
153
+
154
+ # Terminal 2 - Background story
155
+ opencode
156
+ # Run /athena-dev for story 2.2
157
+ ```
158
+
159
+ **2. Or use background agents within single session:**
160
+
161
+ ```
162
+ # Start story 2.1 in background
163
+ background_task({
164
+ agent: "general",
165
+ prompt: "Implement BMAD story 2.1. Load context with athena_get_story({storyId: '2.1'}), implement following /athena-dev workflow, update status when complete.",
166
+ description: "Story 2.1 implementation"
167
+ })
168
+
169
+ # Work on story 2.2 yourself
170
+ /athena-dev 2.2
171
+ ```
172
+
173
+ **3. Coordinate manually:**
174
+
175
+ - Keep track of which files each story modifies
176
+ - Avoid parallel work on same files
177
+ - Run combined tests after both complete
178
+ - Check for integration issues
179
+
180
+ ## Design Considerations for Implementation
181
+
182
+ ### Background Agent Integration
183
+
184
+ The planned implementation will use oh-my-opencode's background agent system:
185
+
186
+ ```typescript
187
+ // Conceptual implementation
188
+ async function executeParallel(storyIds: string[]) {
189
+ // 1. Validate no conflicts
190
+ const conflicts = await detectConflicts(storyIds);
191
+ if (conflicts.length > 0) {
192
+ return { error: "Conflicts detected", conflicts };
193
+ }
194
+
195
+ // 2. Mark all as in_progress
196
+ for (const id of storyIds) {
197
+ await updateSprintStatus(id, "in_progress");
198
+ }
199
+
200
+ // 3. Spawn background agents
201
+ const tasks = storyIds.map(id => ({
202
+ agent: "general", // or dedicated story-impl agent
203
+ prompt: generateStoryPrompt(id),
204
+ }));
205
+
206
+ // 4. Launch and track
207
+ const results = await backgroundManager.launchMany(tasks);
208
+
209
+ return { launched: results.length, taskIds: results.map(r => r.id) };
210
+ }
211
+ ```
212
+
213
+ ### Conflict Detection Strategy
214
+
215
+ ```typescript
216
+ // Conceptual conflict detection
217
+ async function detectConflicts(storyIds: string[]) {
218
+ const storyFiles: Map<string, string[]> = new Map();
219
+
220
+ for (const id of storyIds) {
221
+ const story = await loadStory(id);
222
+ const files = extractMentionedFiles(story);
223
+ const architectureFiles = extractArchitectureFiles(story);
224
+ storyFiles.set(id, [...files, ...architectureFiles]);
225
+ }
226
+
227
+ // Find overlapping files
228
+ const conflicts = [];
229
+ for (const [id1, files1] of storyFiles) {
230
+ for (const [id2, files2] of storyFiles) {
231
+ if (id1 >= id2) continue;
232
+ const overlap = files1.filter(f => files2.includes(f));
233
+ if (overlap.length > 0) {
234
+ conflicts.push({ stories: [id1, id2], files: overlap });
235
+ }
236
+ }
237
+ }
238
+
239
+ return conflicts;
240
+ }
241
+ ```
242
+
243
+ ## Limitations
244
+
245
+ Even when implemented:
246
+
247
+ - **Context limits**: Each background agent uses context window
248
+ - **Coordination overhead**: Managing multiple agents has overhead
249
+ - **Conflict resolution**: Some conflicts require human judgment
250
+ - **Testing complexity**: Parallel changes complicate testing
251
+
252
+ ## Tips for Future Use
253
+
254
+ - **Start small**: Test with 2 stories before scaling up
255
+ - **Choose wisely**: Pick stories in truly independent areas
256
+ - **Monitor actively**: Check progress regularly
257
+ - **Test together**: Run full test suite after parallel completion
258
+ - **Review carefully**: Parallel work may have subtle integration issues
259
+
260
+ ## Related Commands
261
+
262
+ | Command | Use When |
263
+ |---------|----------|
264
+ | `/athena-dev` | Single story implementation |
265
+ | `/athena-status` | Check sprint status and pending stories |
266
+ | `/athena-review` | Quality gate after parallel completion |
@@ -0,0 +1,326 @@
1
+ ---
2
+ description: Research patterns, implementations, or documentation using Librarian
3
+ ---
4
+
5
+ # Athena Research - Librarian-Powered Research
6
+
7
+ Use Librarian, the research specialist, to find patterns, examples, and documentation from multiple sources.
8
+
9
+ **You are Sisyphus, the orchestrator.** You will coordinate Librarian's research capabilities with Explore for comprehensive information gathering.
10
+
11
+ ## When to Use This Command
12
+
13
+ - Learning how to use an unfamiliar library or framework
14
+ - Finding implementation patterns for a specific use case
15
+ - Looking up official documentation and best practices
16
+ - Understanding how similar problems are solved in open source
17
+ - Researching before implementing a complex feature
18
+
19
+ ## Step 1: Define Your Research Goals
20
+
21
+ ### 1.1 Load Story Context (if researching for a story)
22
+
23
+ If this research is for an implementation task:
24
+
25
+ ```
26
+ athena_get_story()
27
+ ```
28
+
29
+ This provides:
30
+ - Story requirements (what you need to build)
31
+ - Architecture patterns (project conventions to follow)
32
+ - Technology constraints (what frameworks/libraries to use)
33
+
34
+ ### 1.2 Clarify What You Need
35
+
36
+ Be specific about your research goals:
37
+
38
+ **Good research questions:**
39
+ - "How do I implement JWT authentication in Express.js with refresh tokens?"
40
+ - "What's the recommended way to handle form validation in React Hook Form?"
41
+ - "How should I structure a GraphQL resolver for nested relationships?"
42
+
43
+ **Vague research questions (too broad):**
44
+ - "How do I use React?" (too general)
45
+ - "What's a good database?" (no context)
46
+ - "Help me with authentication" (no specifics)
47
+
48
+ ## Step 2: Multi-Source Research
49
+
50
+ ### 2.1 Internal Codebase Research (Explore)
51
+
52
+ **First**, check what already exists in your codebase using **@explore**:
53
+
54
+ ```
55
+ @explore I need to research existing patterns for {feature/technology}.
56
+
57
+ Please find:
58
+ 1. Existing implementations of {similar functionality}
59
+ 2. How {technology/pattern} is currently used in this project
60
+ 3. Any established conventions or helpers for this use case
61
+ 4. Related tests that show expected behavior
62
+
63
+ Return file paths with brief descriptions of what you found.
64
+ ```
65
+
66
+ **Why start with Explore:**
67
+ - Discover existing patterns to follow
68
+ - Avoid reinventing what already exists
69
+ - Understand project-specific conventions
70
+ - Find code you can extend or reference
71
+
72
+ ### 2.2 External Research (Librarian)
73
+
74
+ **Then**, use **@librarian** for external knowledge:
75
+
76
+ ```
77
+ @librarian I need to research {topic} for my implementation.
78
+
79
+ ## Context
80
+
81
+ **What I'm Building:**
82
+ {brief description of feature}
83
+
84
+ **Technology Stack:**
85
+ {relevant frameworks, libraries, versions}
86
+
87
+ **Project Constraints:**
88
+ {any architectural constraints from athena_get_story or project knowledge}
89
+
90
+ **What Explore Found:**
91
+ {brief summary of internal patterns, if any}
92
+
93
+ ## Research Questions
94
+
95
+ 1. **Best Practices:** What are the recommended patterns for {specific thing}?
96
+ 2. **Official Documentation:** What does the official {library} documentation say about {specific API/feature}?
97
+ 3. **Common Pitfalls:** What mistakes do developers commonly make with {technology}?
98
+ 4. **Examples:** How have other production projects implemented {similar feature}?
99
+
100
+ ## Desired Output
101
+
102
+ Please provide:
103
+ 1. **Summary** - Key findings in 2-3 paragraphs
104
+ 2. **Code Examples** - Concrete implementation examples
105
+ 3. **Recommendations** - What approach I should take given my constraints
106
+ 4. **Sources** - Links to documentation and references for further reading
107
+ ```
108
+
109
+ ### 2.3 Parallel Research (Optional)
110
+
111
+ For comprehensive research, run **multiple Librarian queries in parallel**:
112
+
113
+ ```
114
+ # Background task 1: Official documentation
115
+ @librarian Research official {library} documentation for {specific feature}.
116
+ Focus on API reference and official examples.
117
+
118
+ # Background task 2: GitHub examples
119
+ @librarian Search GitHub for production implementations of {feature}.
120
+ Focus on well-maintained repos with similar tech stack.
121
+
122
+ # Background task 3: Best practices
123
+ @librarian Find articles and guides about best practices for {pattern}.
124
+ Focus on recent content (2024+) and authoritative sources.
125
+ ```
126
+
127
+ ## Step 3: Research by Use Case
128
+
129
+ ### Use Case A: Learning a New Library
130
+
131
+ ```
132
+ @librarian I need to learn how to use {library} for {specific purpose}.
133
+
134
+ **My Goal:** {what you want to accomplish}
135
+ **My Stack:** {your project's relevant technologies}
136
+ **My Experience:** {what you already know about similar tools}
137
+
138
+ Please research:
139
+ 1. **Getting Started** - How to set up and configure {library}
140
+ 2. **Core Concepts** - Key abstractions and patterns to understand
141
+ 3. **API Reference** - Main APIs I'll need for {specific purpose}
142
+ 4. **Examples** - Code examples for my use case
143
+ 5. **Gotchas** - Common mistakes and how to avoid them
144
+ ```
145
+
146
+ ### Use Case B: Design Pattern Research
147
+
148
+ ```
149
+ @librarian I need to research the best pattern for {specific problem}.
150
+
151
+ **Problem:** {describe the problem you're solving}
152
+ **Constraints:** {technical constraints, performance requirements, etc.}
153
+ **Options Considered:** {patterns you're aware of}
154
+
155
+ Please research:
156
+ 1. **Pattern Comparison** - Compare {pattern A} vs {pattern B} for my use case
157
+ 2. **Trade-offs** - Pros and cons of each approach
158
+ 3. **Real-World Usage** - How production codebases handle this
159
+ 4. **Recommendation** - Which pattern fits my constraints best
160
+ ```
161
+
162
+ ### Use Case C: Troubleshooting Research
163
+
164
+ ```
165
+ @librarian I'm encountering {issue} with {technology} and need to understand why.
166
+
167
+ **The Issue:** {describe what's happening}
168
+ **Error Message:** {if applicable}
169
+ **What I've Tried:** {previous attempts}
170
+
171
+ Please research:
172
+ 1. **Common Causes** - Why does this issue typically occur?
173
+ 2. **Solutions** - How have others solved this?
174
+ 3. **Root Cause** - What's the underlying reason for this behavior?
175
+ 4. **Prevention** - How to avoid this in the future?
176
+ ```
177
+
178
+ ### Use Case D: Architecture Research
179
+
180
+ ```
181
+ @librarian I need to make an architectural decision about {topic}.
182
+
183
+ **Context:** {what you're building}
184
+ **Scale:** {expected load, data volume, team size}
185
+ **Constraints:** {technical, business, or timeline constraints}
186
+
187
+ Please research:
188
+ 1. **Industry Standards** - How do major companies handle this?
189
+ 2. **Pattern Options** - What architectural patterns apply?
190
+ 3. **Trade-off Analysis** - Pros/cons of each approach
191
+ 4. **Case Studies** - Real examples of each approach in production
192
+ ```
193
+
194
+ ## Step 4: Synthesize and Apply
195
+
196
+ ### 4.1 Combine Internal + External Findings
197
+
198
+ After receiving research results:
199
+
200
+ ```markdown
201
+ ## Research Summary for {topic}
202
+
203
+ ### Internal Patterns (from Explore)
204
+ - {pattern 1 found in codebase}
205
+ - {pattern 2 found in codebase}
206
+ - {existing code to reference}
207
+
208
+ ### External Best Practices (from Librarian)
209
+ - {best practice 1}
210
+ - {best practice 2}
211
+ - {recommended approach}
212
+
213
+ ### Reconciliation
214
+ - **Follow:** {internal pattern if it aligns with best practices}
215
+ - **Adapt:** {external pattern to fit project conventions}
216
+ - **Decision:** {final approach to use}
217
+ ```
218
+
219
+ ### 4.2 Validate with Oracle (if needed)
220
+
221
+ For complex architectural decisions, consult **@oracle** to validate:
222
+
223
+ ```
224
+ @oracle I've researched {topic} and want to validate my approach.
225
+
226
+ **Research Findings:**
227
+ {summary from Librarian}
228
+
229
+ **Proposed Approach:**
230
+ {what you plan to do}
231
+
232
+ **Questions:**
233
+ 1. Does this approach fit our architecture?
234
+ 2. Are there any risks I'm missing?
235
+ 3. Is this the right trade-off for our use case?
236
+ ```
237
+
238
+ ### 4.3 Apply to Implementation
239
+
240
+ Use your research to guide implementation:
241
+
242
+ - Follow patterns found in the codebase (consistency)
243
+ - Apply best practices from documentation
244
+ - Avoid common pitfalls identified in research
245
+ - Reference the examples found for similar use cases
246
+
247
+ ## Librarian's Research Sources
248
+
249
+ Librarian has access to multiple research tools:
250
+
251
+ | Source | Tool | Best For |
252
+ |--------|------|----------|
253
+ | **Official Docs** | context7 MCP | API references, official guides |
254
+ | **Web Search** | websearch_exa MCP | Tutorials, blog posts, articles |
255
+ | **GitHub** | grep.app MCP | Production code examples |
256
+ | **Codebase** | Internal tools | Project-specific patterns |
257
+
258
+ ## Research Workflow Summary
259
+
260
+ ```
261
+ ┌─────────────────────────────────────────────────────────┐
262
+ │ 1. DEFINE RESEARCH GOALS │
263
+ │ - Load story context (if applicable) │
264
+ │ - Clarify specific questions │
265
+ └─────────────────────────────────────────────────────────┘
266
+
267
+
268
+ ┌─────────────────────────────────────────────────────────┐
269
+ │ 2. INTERNAL RESEARCH (@explore) │
270
+ │ - Find existing patterns in codebase │
271
+ │ - Understand project conventions │
272
+ └─────────────────────────────────────────────────────────┘
273
+
274
+
275
+ ┌─────────────────────────────────────────────────────────┐
276
+ │ 3. EXTERNAL RESEARCH (@librarian) │
277
+ │ - Official documentation (context7) │
278
+ │ - Web articles and tutorials (exa) │
279
+ │ - GitHub examples (grep.app) │
280
+ └─────────────────────────────────────────────────────────┘
281
+
282
+
283
+ ┌─────────────────────────────────────────────────────────┐
284
+ │ 4. SYNTHESIZE FINDINGS │
285
+ │ - Combine internal + external knowledge │
286
+ │ - Reconcile differences │
287
+ │ - Validate with Oracle (if architectural) │
288
+ └─────────────────────────────────────────────────────────┘
289
+
290
+
291
+ ┌─────────────────────────────────────────────────────────┐
292
+ │ 5. APPLY TO IMPLEMENTATION │
293
+ │ - Follow established patterns │
294
+ │ - Apply best practices │
295
+ │ - Reference examples │
296
+ └─────────────────────────────────────────────────────────┘
297
+ ```
298
+
299
+ ## Tips for Effective Research
300
+
301
+ ### Be Specific
302
+ - "How to validate email in Zod" beats "how to use Zod"
303
+ - Include version numbers when relevant
304
+ - Mention your constraints
305
+
306
+ ### Use Multiple Sources
307
+ - Start with internal codebase (Explore)
308
+ - Then external documentation (Librarian)
309
+ - Cross-reference multiple sources
310
+
311
+ ### Time-Box Research
312
+ - Set a goal for what you need to learn
313
+ - Don't over-research - get enough to start
314
+ - You can always research more if needed
315
+
316
+ ### Document Findings
317
+ - Save useful patterns for future reference
318
+ - Note sources for deeper reading later
319
+ - Share findings with team (if applicable)
320
+
321
+ ## Cost Awareness
322
+
323
+ - **@explore** is cheap/free - use liberally for codebase searches
324
+ - **@librarian** costs tokens - be specific with queries
325
+ - **Parallel research** is efficient - batch related queries
326
+ - **@oracle** is expensive - only for validating complex decisions