opencode-sdlc-plugin 0.2.1 → 0.3.2

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 (72) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +127 -38
  3. package/commands/sdlc-adr.md +245 -17
  4. package/commands/sdlc-debug.md +376 -0
  5. package/commands/sdlc-design.md +205 -47
  6. package/commands/sdlc-dev.md +544 -0
  7. package/commands/sdlc-info.md +325 -0
  8. package/commands/sdlc-parallel.md +283 -0
  9. package/commands/sdlc-recall.md +203 -8
  10. package/commands/sdlc-remember.md +126 -9
  11. package/commands/sdlc-research.md +343 -0
  12. package/commands/sdlc-review.md +201 -128
  13. package/commands/sdlc-status.md +297 -0
  14. package/config/presets/copilot-only.json +69 -0
  15. package/config/presets/enterprise.json +79 -0
  16. package/config/presets/event-modeling.json +74 -8
  17. package/config/presets/minimal.json +70 -0
  18. package/config/presets/solo-quick.json +70 -0
  19. package/config/presets/standard.json +78 -0
  20. package/config/presets/strict-tdd.json +79 -0
  21. package/config/schemas/athena.schema.json +338 -0
  22. package/config/schemas/sdlc.schema.json +442 -26
  23. package/dist/cli/index.d.ts +2 -1
  24. package/dist/cli/index.js +4285 -562
  25. package/dist/cli/index.js.map +1 -1
  26. package/dist/index.d.ts +1781 -1
  27. package/dist/index.js +7759 -395
  28. package/dist/index.js.map +1 -1
  29. package/dist/plugin/index.d.ts +17 -2
  30. package/dist/plugin/index.js +7730 -397
  31. package/dist/plugin/index.js.map +1 -1
  32. package/package.json +68 -33
  33. package/prompts/agents/code-reviewer.md +229 -0
  34. package/prompts/agents/domain.md +210 -0
  35. package/prompts/agents/green.md +148 -0
  36. package/prompts/agents/mutation.md +278 -0
  37. package/prompts/agents/red.md +112 -0
  38. package/prompts/event-modeling/discovery.md +176 -0
  39. package/prompts/event-modeling/gwt-generation.md +479 -0
  40. package/prompts/event-modeling/workflow-design.md +318 -0
  41. package/prompts/personas/amelia-developer.md +43 -0
  42. package/prompts/personas/bob-sm.md +43 -0
  43. package/prompts/personas/john-pm.md +43 -0
  44. package/prompts/personas/mary-analyst.md +43 -0
  45. package/prompts/personas/murat-tester.md +43 -0
  46. package/prompts/personas/paige-techwriter.md +43 -0
  47. package/prompts/personas/sally-ux.md +43 -0
  48. package/prompts/personas/winston-architect.md +43 -0
  49. package/agents/design-facilitator.md +0 -8
  50. package/agents/domain.md +0 -9
  51. package/agents/exploration.md +0 -8
  52. package/agents/green.md +0 -9
  53. package/agents/marvin.md +0 -15
  54. package/agents/model-checker.md +0 -9
  55. package/agents/red.md +0 -9
  56. package/commands/sdlc-domain-audit.md +0 -32
  57. package/commands/sdlc-plan.md +0 -63
  58. package/commands/sdlc-pr.md +0 -43
  59. package/commands/sdlc-setup.md +0 -50
  60. package/commands/sdlc-start.md +0 -34
  61. package/commands/sdlc-work.md +0 -118
  62. package/config/presets/traditional.json +0 -12
  63. package/skills/adr-policy.md +0 -21
  64. package/skills/atomic-design.md +0 -39
  65. package/skills/debugging-protocol.md +0 -47
  66. package/skills/event-modeling.md +0 -40
  67. package/skills/git-spice.md +0 -44
  68. package/skills/github-issues.md +0 -44
  69. package/skills/memory-protocol.md +0 -41
  70. package/skills/orchestration.md +0 -118
  71. package/skills/skill-enforcement.md +0 -56
  72. package/skills/tdd-constraints.md +0 -63
@@ -1,18 +1,213 @@
1
1
  ---
2
- description: Retrieve knowledge from memento MCP
2
+ description: Search and retrieve memories from persistent storage
3
3
  ---
4
4
 
5
- # SDLC Recall
5
+ # SDLC Recall - Memory Retrieval
6
+
7
+ Search and retrieve relevant context from persistent memory. Use this command before starting work to check for existing knowledge that might help.
6
8
 
7
9
  ## Usage
8
10
 
11
+ Call **sdlc_recall** to search memories:
12
+
13
+ ```
14
+ sdlc_recall({
15
+ query: "authentication"
16
+ })
17
+ ```
18
+
19
+ ## When to Recall
20
+
21
+ Use this command at the start of work to:
22
+
23
+ ### Before Implementation
24
+ - Check for existing patterns in this area
25
+ - Find conventions you should follow
26
+ - Recall domain rules that apply
27
+
28
+ ### During Debugging
29
+ - Search for similar issues solved before
30
+ - Find workarounds for known problems
31
+ - Recall environment-specific quirks
32
+
33
+ ### Before Research
34
+ - Check if you've already researched this topic
35
+ - Find related notes that might help
36
+ - Avoid duplicating previous work
37
+
38
+ ### When Returning to Code
39
+ - Recall context from previous sessions
40
+ - Find notes about why things were done a certain way
41
+ - Refresh memory on complex systems
42
+
43
+ ## Query Examples
44
+
45
+ ### Simple Keyword Search
46
+
47
+ ```
48
+ sdlc_recall({ query: "authentication" })
49
+ sdlc_recall({ query: "rate limit" })
50
+ sdlc_recall({ query: "postgres connection" })
51
+ ```
52
+
53
+ ### Key Path Search
54
+
55
+ ```
56
+ sdlc_recall({ query: "auth/jwt" })
57
+ sdlc_recall({ query: "api/stripe" })
58
+ sdlc_recall({ query: "domain/orders" })
59
+ ```
60
+
61
+ ### Filtered by Tags
62
+
63
+ ```
64
+ sdlc_recall({
65
+ query: "error handling",
66
+ tags: ["api"]
67
+ })
68
+
69
+ sdlc_recall({
70
+ query: "performance",
71
+ tags: ["database", "optimization"]
72
+ })
73
+ ```
74
+
75
+ ### Project-Specific Search
76
+
77
+ ```
78
+ sdlc_recall({
79
+ query: "conventions",
80
+ projectOnly: true
81
+ })
82
+ ```
83
+
84
+ ### Limited Results
85
+
86
+ ```
87
+ sdlc_recall({
88
+ query: "testing",
89
+ limit: 5
90
+ })
91
+ ```
92
+
93
+ ## Response Format
94
+
95
+ Results include:
96
+ - **key**: The memory's unique identifier
97
+ - **content**: The stored information
98
+ - **tags**: Associated tags
99
+ - **createdAt**: When it was first stored
100
+ - **updatedAt**: When it was last modified
101
+ - **projectDir**: Which project it came from (if stored locally)
102
+
103
+ ## Search Behavior
104
+
105
+ The search matches against:
106
+ 1. **Memory keys** (highest priority)
107
+ 2. **Content text** (semantic matching)
108
+ 3. **Tags** (when specified)
109
+
110
+ Results are ranked by relevance and returned in order.
111
+
112
+ ## Workflow Integration
113
+
114
+ ### Start of Session Pattern
115
+
116
+ ```
117
+ # Before starting any new work
118
+ sdlc_recall({ query: "<area-you're-working-on>" })
119
+
120
+ # Check the results
121
+ # If relevant memories exist, use them as context
122
+ # If not, proceed and consider remembering insights later
123
+ ```
124
+
125
+ ### Debug Workflow
126
+
127
+ ```
128
+ # When hitting an issue
129
+ sdlc_recall({ query: "<error-message-or-symptom>", tags: ["bug-fix"] })
130
+
131
+ # Check if this was solved before
132
+ # If yes, use the solution
133
+ # If no, solve it and remember the solution
134
+ ```
135
+
136
+ ### Pre-Implementation Checklist
137
+
138
+ ```
139
+ # Before implementing a feature
140
+ sdlc_recall({ query: "<feature-area>", tags: ["pattern", "convention"] })
141
+
142
+ # Learn from previous patterns
143
+ # Follow established conventions
144
+ # Avoid reinventing solutions
145
+ ```
146
+
147
+ ## Memory Sources
148
+
149
+ When **Memento MCP** is enabled:
150
+ - Searches across all OpenCode projects
151
+ - Shared knowledge base
152
+ - Synchronized memories
153
+
154
+ When using local storage:
155
+ - Searches `~/.opencode/sdlc-memory.json`
156
+ - Per-machine memories
157
+ - Can filter by project with `projectOnly: true`
158
+
159
+ ## Best Practices
160
+
161
+ 1. **Search Before Starting**: Always check for relevant memories
162
+ 2. **Use Multiple Queries**: Try different keywords if first search fails
163
+ 3. **Filter When Appropriate**: Use tags to narrow down results
164
+ 4. **Read Carefully**: Memories might be outdated - verify applicability
165
+ 5. **Update If Needed**: If a memory is out of date, update it with `/sdlc:remember`
166
+
167
+ ## Examples
168
+
169
+ ### Finding Authentication Patterns
170
+
171
+ ```
172
+ sdlc_recall({
173
+ query: "auth",
174
+ tags: ["pattern"]
175
+ })
176
+ ```
177
+
178
+ Results might include:
179
+ - `auth/jwt-refresh-pattern` - JWT token refresh strategy
180
+ - `auth/oauth/google-flow` - Google OAuth implementation
181
+ - `auth/session/management` - Session handling patterns
182
+
183
+ ### Finding Bug Fix History
184
+
9
185
  ```
10
- /sdlc-recall <query>
186
+ sdlc_recall({
187
+ query: "connection pool",
188
+ tags: ["bug-fix", "database"]
189
+ })
11
190
  ```
12
191
 
13
- ## Instructions
192
+ Results might include:
193
+ - `database/postgres/connection-pool` - Pool exhaustion fix
194
+ - `database/connection/timeout` - Timeout configuration
195
+
196
+ ### Finding Domain Rules
197
+
198
+ ```
199
+ sdlc_recall({
200
+ query: "order cancellation",
201
+ tags: ["domain", "business-rules"]
202
+ })
203
+ ```
204
+
205
+ Results might include:
206
+ - `domain/orders/cancellation` - Cancellation policy rules
207
+ - `domain/orders/refunds` - Refund processing rules
208
+
209
+ ## Related Commands
14
210
 
15
- - Use `mcp__memento__semantic_search` with the query.
16
- - Open relevant nodes with `mcp__memento__open_nodes`.
17
- - Summarize key observations and related entities.
18
- - If no results, suggest alternate search terms.
211
+ - `/sdlc:remember` - Store new memories
212
+ - `/sdlc-dev` - Implementation workflow (recall first)
213
+ - `/sdlc-debug` - Debugging workflow (recall for past solutions)
@@ -1,19 +1,136 @@
1
1
  ---
2
- description: Store knowledge in memento MCP
2
+ description: Store discoveries and insights to persistent memory
3
3
  ---
4
4
 
5
- # SDLC Remember
5
+ # SDLC Remember - Persistent Memory Storage
6
+
7
+ Store context, discoveries, or insights to persistent memory for future sessions. This command helps you save important information that should persist across sessions.
6
8
 
7
9
  ## Usage
8
10
 
11
+ Call **sdlc_remember** to store a memory:
12
+
9
13
  ```
10
- /sdlc-remember <what>
14
+ sdlc_remember({
15
+ key: "auth/jwt-refresh-pattern",
16
+ content: "JWT tokens in this project use sliding window refresh. When a token is within 5 minutes of expiry, the client automatically requests a new token. The refresh endpoint is POST /api/auth/refresh with the current token in the Authorization header.",
17
+ tags: ["auth", "jwt", "api"]
18
+ })
11
19
  ```
12
20
 
13
- ## Instructions
21
+ ## When to Remember
22
+
23
+ Use this command to store:
24
+
25
+ ### Project Conventions
26
+ - Naming patterns discovered during development
27
+ - File organization conventions
28
+ - Code style preferences not in linting rules
29
+
30
+ ### Debugging Insights
31
+ - Solutions to tricky bugs you solved
32
+ - Environment-specific quirks
33
+ - Workarounds for known issues
34
+
35
+ ### Domain Knowledge
36
+ - Business rules learned during implementation
37
+ - Domain terminology and definitions
38
+ - Edge cases and their handling
39
+
40
+ ### Technical Decisions
41
+ - Architecture rationale not in ADRs
42
+ - Why certain approaches were chosen
43
+ - Trade-offs made and their reasons
44
+
45
+ ### API Patterns
46
+ - External API quirks and behaviors
47
+ - Rate limits and retry strategies
48
+ - Authentication flows
49
+
50
+ ## Key Naming Conventions
51
+
52
+ Use slash-separated paths for organization:
53
+
54
+ ```
55
+ project/component/topic
56
+
57
+ Examples:
58
+ - auth/oauth/google-flow
59
+ - api/errors/retry-strategy
60
+ - database/migrations/conventions
61
+ - testing/fixtures/user-factory
62
+ - deployment/env/staging-quirks
63
+ ```
64
+
65
+ ## Tags
66
+
67
+ Tags help filter and find related memories:
68
+
69
+ ```
70
+ sdlc_remember({
71
+ key: "api/rate-limits",
72
+ content: "GitHub API has a 5000 requests/hour limit. Use conditional requests with ETag headers to reduce consumption.",
73
+ tags: ["api", "github", "rate-limit", "optimization"]
74
+ })
75
+ ```
76
+
77
+ Common tag categories:
78
+ - **Component**: `auth`, `api`, `database`, `frontend`, `testing`
79
+ - **Type**: `bug-fix`, `pattern`, `convention`, `gotcha`
80
+ - **Priority**: `critical`, `important`, `nice-to-know`
81
+
82
+ ## Examples
83
+
84
+ ### Storing a Bug Fix Insight
85
+
86
+ ```
87
+ sdlc_remember({
88
+ key: "database/postgres/connection-pool",
89
+ content: "Connection pool exhaustion occurs under high load because the default pool size of 10 is too small. Increased to 25 with max_overflow=10. Also added connection recycling every 30 minutes to prevent stale connections.",
90
+ tags: ["database", "postgres", "performance", "bug-fix"]
91
+ })
92
+ ```
93
+
94
+ ### Storing a Domain Rule
95
+
96
+ ```
97
+ sdlc_remember({
98
+ key: "domain/orders/cancellation",
99
+ content: "Orders can only be cancelled within 24 hours of placement AND before shipping status is 'picked'. The OrderCancellationPolicy service handles this validation. Edge case: orders with 'priority shipping' have a 2-hour window instead.",
100
+ tags: ["domain", "orders", "business-rules"]
101
+ })
102
+ ```
103
+
104
+ ### Storing an API Pattern
105
+
106
+ ```
107
+ sdlc_remember({
108
+ key: "api/stripe/webhook-verification",
109
+ content: "Stripe webhooks must be verified using the raw body, not parsed JSON. The express.raw() middleware must be applied BEFORE any JSON body parser for the /webhooks/stripe route. Verification uses the Stripe-Signature header.",
110
+ tags: ["api", "stripe", "webhooks", "security"]
111
+ })
112
+ ```
113
+
114
+ ## Memory Storage
115
+
116
+ When **Memento MCP** is enabled in your configuration, memories sync across all OpenCode projects, enabling cross-project knowledge sharing.
117
+
118
+ Otherwise, memories are stored locally in:
119
+ ```
120
+ ~/.opencode/sdlc-memory.json
121
+ ```
122
+
123
+ ## Best Practices
124
+
125
+ 1. **Be Specific**: Include enough context that future-you will understand
126
+ 2. **Use Consistent Keys**: Follow the same naming pattern across memories
127
+ 3. **Tag Generously**: More tags means easier discovery later
128
+ 4. **Update When Needed**: The same key updates the existing memory
129
+ 5. **Include Examples**: Code snippets and examples are valuable
130
+ 6. **Document "Why"**: Explain the reasoning, not just the facts
131
+
132
+ ## Related Commands
14
133
 
15
- - Search with `mcp__memento__semantic_search` before creating new entities.
16
- - Choose entity type: debugging_insight, user_preference, project, design_pattern, tool_discovery, domain_concept, feature_implementation, architecture_decision.
17
- - Include observations with date and scope.
18
- - Create relationships where possible.
19
- - Return a confirmation summary.
134
+ - `/sdlc:recall` - Search and retrieve stored memories
135
+ - `/sdlc-debug` - May suggest remembering debugging insights
136
+ - `/sdlc-research` - May suggest remembering research findings
@@ -0,0 +1,343 @@
1
+ ---
2
+ description: Research patterns, implementations, or documentation using Librarian
3
+ ---
4
+
5
+ # SDLC Research - Librarian-Powered Research
6
+
7
+ ## Git Operations Policy
8
+
9
+ **⚠️ AUTOMATIC GIT OPERATIONS ARE PROHIBITED**
10
+
11
+ You must NOT perform any git operations automatically:
12
+ - ❌ Do NOT run `git commit` to save changes
13
+ - ❌ Do NOT run `git push` to push to remote
14
+ - ❌ Do NOT run `git checkout -b` or `git branch` to create branches
15
+ - ❌ Do NOT run `git merge`, `git rebase`, or `git cherry-pick`
16
+ - ❌ Do NOT run `gh pr create` or other GitHub CLI operations
17
+
18
+ **Git operations are ONLY permitted if the user explicitly requests them.**
19
+
20
+ This command focuses on research and should rarely involve git operations. If you believe git operations are needed, ASK the user first.
21
+
22
+ ---
23
+
24
+ Use Librarian, the research specialist, to find patterns, examples, and documentation from multiple sources.
25
+
26
+ **You are Sisyphus, the orchestrator.** You will coordinate Librarian's research capabilities with Explore for comprehensive information gathering.
27
+
28
+ ## When to Use This Command
29
+
30
+ - Learning how to use an unfamiliar library or framework
31
+ - Finding implementation patterns for a specific use case
32
+ - Looking up official documentation and best practices
33
+ - Understanding how similar problems are solved in open source
34
+ - Researching before implementing a complex feature
35
+
36
+ ## Step 1: Define Your Research Goals
37
+
38
+ ### 1.1 Load Story Context (if researching for a story)
39
+
40
+ If this research is for an implementation task:
41
+
42
+ ```
43
+ sdlc_get_story()
44
+ ```
45
+
46
+ This provides:
47
+ - Story requirements (what you need to build)
48
+ - Architecture patterns (project conventions to follow)
49
+ - Technology constraints (what frameworks/libraries to use)
50
+
51
+ ### 1.2 Clarify What You Need
52
+
53
+ Be specific about your research goals:
54
+
55
+ **Good research questions:**
56
+ - "How do I implement JWT authentication in Express.js with refresh tokens?"
57
+ - "What's the recommended way to handle form validation in React Hook Form?"
58
+ - "How should I structure a GraphQL resolver for nested relationships?"
59
+
60
+ **Vague research questions (too broad):**
61
+ - "How do I use React?" (too general)
62
+ - "What's a good database?" (no context)
63
+ - "Help me with authentication" (no specifics)
64
+
65
+ ## Step 2: Multi-Source Research
66
+
67
+ ### 2.1 Internal Codebase Research (Explore)
68
+
69
+ **First**, check what already exists in your codebase using **@explore**:
70
+
71
+ ```
72
+ @explore I need to research existing patterns for {feature/technology}.
73
+
74
+ Please find:
75
+ 1. Existing implementations of {similar functionality}
76
+ 2. How {technology/pattern} is currently used in this project
77
+ 3. Any established conventions or helpers for this use case
78
+ 4. Related tests that show expected behavior
79
+
80
+ Return file paths with brief descriptions of what you found.
81
+ ```
82
+
83
+ **Why start with Explore:**
84
+ - Discover existing patterns to follow
85
+ - Avoid reinventing what already exists
86
+ - Understand project-specific conventions
87
+ - Find code you can extend or reference
88
+
89
+ ### 2.2 External Research (Librarian)
90
+
91
+ **Then**, use **@librarian** for external knowledge:
92
+
93
+ ```
94
+ @librarian I need to research {topic} for my implementation.
95
+
96
+ ## Context
97
+
98
+ **What I'm Building:**
99
+ {brief description of feature}
100
+
101
+ **Technology Stack:**
102
+ {relevant frameworks, libraries, versions}
103
+
104
+ **Project Constraints:**
105
+ {any architectural constraints from sdlc_get_story or project knowledge}
106
+
107
+ **What Explore Found:**
108
+ {brief summary of internal patterns, if any}
109
+
110
+ ## Research Questions
111
+
112
+ 1. **Best Practices:** What are the recommended patterns for {specific thing}?
113
+ 2. **Official Documentation:** What does the official {library} documentation say about {specific API/feature}?
114
+ 3. **Common Pitfalls:** What mistakes do developers commonly make with {technology}?
115
+ 4. **Examples:** How have other production projects implemented {similar feature}?
116
+
117
+ ## Desired Output
118
+
119
+ Please provide:
120
+ 1. **Summary** - Key findings in 2-3 paragraphs
121
+ 2. **Code Examples** - Concrete implementation examples
122
+ 3. **Recommendations** - What approach I should take given my constraints
123
+ 4. **Sources** - Links to documentation and references for further reading
124
+ ```
125
+
126
+ ### 2.3 Parallel Research (Optional)
127
+
128
+ For comprehensive research, run **multiple Librarian queries in parallel**:
129
+
130
+ ```
131
+ # Background task 1: Official documentation
132
+ @librarian Research official {library} documentation for {specific feature}.
133
+ Focus on API reference and official examples.
134
+
135
+ # Background task 2: GitHub examples
136
+ @librarian Search GitHub for production implementations of {feature}.
137
+ Focus on well-maintained repos with similar tech stack.
138
+
139
+ # Background task 3: Best practices
140
+ @librarian Find articles and guides about best practices for {pattern}.
141
+ Focus on recent content (2024+) and authoritative sources.
142
+ ```
143
+
144
+ ## Step 3: Research by Use Case
145
+
146
+ ### Use Case A: Learning a New Library
147
+
148
+ ```
149
+ @librarian I need to learn how to use {library} for {specific purpose}.
150
+
151
+ **My Goal:** {what you want to accomplish}
152
+ **My Stack:** {your project's relevant technologies}
153
+ **My Experience:** {what you already know about similar tools}
154
+
155
+ Please research:
156
+ 1. **Getting Started** - How to set up and configure {library}
157
+ 2. **Core Concepts** - Key abstractions and patterns to understand
158
+ 3. **API Reference** - Main APIs I'll need for {specific purpose}
159
+ 4. **Examples** - Code examples for my use case
160
+ 5. **Gotchas** - Common mistakes and how to avoid them
161
+ ```
162
+
163
+ ### Use Case B: Design Pattern Research
164
+
165
+ ```
166
+ @librarian I need to research the best pattern for {specific problem}.
167
+
168
+ **Problem:** {describe the problem you're solving}
169
+ **Constraints:** {technical constraints, performance requirements, etc.}
170
+ **Options Considered:** {patterns you're aware of}
171
+
172
+ Please research:
173
+ 1. **Pattern Comparison** - Compare {pattern A} vs {pattern B} for my use case
174
+ 2. **Trade-offs** - Pros and cons of each approach
175
+ 3. **Real-World Usage** - How production codebases handle this
176
+ 4. **Recommendation** - Which pattern fits my constraints best
177
+ ```
178
+
179
+ ### Use Case C: Troubleshooting Research
180
+
181
+ ```
182
+ @librarian I'm encountering {issue} with {technology} and need to understand why.
183
+
184
+ **The Issue:** {describe what's happening}
185
+ **Error Message:** {if applicable}
186
+ **What I've Tried:** {previous attempts}
187
+
188
+ Please research:
189
+ 1. **Common Causes** - Why does this issue typically occur?
190
+ 2. **Solutions** - How have others solved this?
191
+ 3. **Root Cause** - What's the underlying reason for this behavior?
192
+ 4. **Prevention** - How to avoid this in the future?
193
+ ```
194
+
195
+ ### Use Case D: Architecture Research
196
+
197
+ ```
198
+ @librarian I need to make an architectural decision about {topic}.
199
+
200
+ **Context:** {what you're building}
201
+ **Scale:** {expected load, data volume, team size}
202
+ **Constraints:** {technical, business, or timeline constraints}
203
+
204
+ Please research:
205
+ 1. **Industry Standards** - How do major companies handle this?
206
+ 2. **Pattern Options** - What architectural patterns apply?
207
+ 3. **Trade-off Analysis** - Pros/cons of each approach
208
+ 4. **Case Studies** - Real examples of each approach in production
209
+ ```
210
+
211
+ ## Step 4: Synthesize and Apply
212
+
213
+ ### 4.1 Combine Internal + External Findings
214
+
215
+ After receiving research results:
216
+
217
+ ```markdown
218
+ ## Research Summary for {topic}
219
+
220
+ ### Internal Patterns (from Explore)
221
+ - {pattern 1 found in codebase}
222
+ - {pattern 2 found in codebase}
223
+ - {existing code to reference}
224
+
225
+ ### External Best Practices (from Librarian)
226
+ - {best practice 1}
227
+ - {best practice 2}
228
+ - {recommended approach}
229
+
230
+ ### Reconciliation
231
+ - **Follow:** {internal pattern if it aligns with best practices}
232
+ - **Adapt:** {external pattern to fit project conventions}
233
+ - **Decision:** {final approach to use}
234
+ ```
235
+
236
+ ### 4.2 Validate with Oracle (if needed)
237
+
238
+ For complex architectural decisions, consult **@oracle** to validate:
239
+
240
+ ```
241
+ @oracle I've researched {topic} and want to validate my approach.
242
+
243
+ **Research Findings:**
244
+ {summary from Librarian}
245
+
246
+ **Proposed Approach:**
247
+ {what you plan to do}
248
+
249
+ **Questions:**
250
+ 1. Does this approach fit our architecture?
251
+ 2. Are there any risks I'm missing?
252
+ 3. Is this the right trade-off for our use case?
253
+ ```
254
+
255
+ ### 4.3 Apply to Implementation
256
+
257
+ Use your research to guide implementation:
258
+
259
+ - Follow patterns found in the codebase (consistency)
260
+ - Apply best practices from documentation
261
+ - Avoid common pitfalls identified in research
262
+ - Reference the examples found for similar use cases
263
+
264
+ ## Librarian's Research Sources
265
+
266
+ Librarian has access to multiple research tools:
267
+
268
+ | Source | Tool | Best For |
269
+ |--------|------|----------|
270
+ | **Official Docs** | context7 MCP | API references, official guides |
271
+ | **Web Search** | websearch_exa MCP | Tutorials, blog posts, articles |
272
+ | **GitHub** | grep.app MCP | Production code examples |
273
+ | **Codebase** | Internal tools | Project-specific patterns |
274
+
275
+ ## Research Workflow Summary
276
+
277
+ ```
278
+ ┌─────────────────────────────────────────────────────────┐
279
+ │ 1. DEFINE RESEARCH GOALS │
280
+ │ - Load story context (if applicable) │
281
+ │ - Clarify specific questions │
282
+ └─────────────────────────────────────────────────────────┘
283
+
284
+
285
+ ┌─────────────────────────────────────────────────────────┐
286
+ │ 2. INTERNAL RESEARCH (@explore) │
287
+ │ - Find existing patterns in codebase │
288
+ │ - Understand project conventions │
289
+ └─────────────────────────────────────────────────────────┘
290
+
291
+
292
+ ┌─────────────────────────────────────────────────────────┐
293
+ │ 3. EXTERNAL RESEARCH (@librarian) │
294
+ │ - Official documentation (context7) │
295
+ │ - Web articles and tutorials (exa) │
296
+ │ - GitHub examples (grep.app) │
297
+ └─────────────────────────────────────────────────────────┘
298
+
299
+
300
+ ┌─────────────────────────────────────────────────────────┐
301
+ │ 4. SYNTHESIZE FINDINGS │
302
+ │ - Combine internal + external knowledge │
303
+ │ - Reconcile differences │
304
+ │ - Validate with Oracle (if architectural) │
305
+ └─────────────────────────────────────────────────────────┘
306
+
307
+
308
+ ┌─────────────────────────────────────────────────────────┐
309
+ │ 5. APPLY TO IMPLEMENTATION │
310
+ │ - Follow established patterns │
311
+ │ - Apply best practices │
312
+ │ - Reference examples │
313
+ └─────────────────────────────────────────────────────────┘
314
+ ```
315
+
316
+ ## Tips for Effective Research
317
+
318
+ ### Be Specific
319
+ - "How to validate email in Zod" beats "how to use Zod"
320
+ - Include version numbers when relevant
321
+ - Mention your constraints
322
+
323
+ ### Use Multiple Sources
324
+ - Start with internal codebase (Explore)
325
+ - Then external documentation (Librarian)
326
+ - Cross-reference multiple sources
327
+
328
+ ### Time-Box Research
329
+ - Set a goal for what you need to learn
330
+ - Don't over-research - get enough to start
331
+ - You can always research more if needed
332
+
333
+ ### Document Findings
334
+ - Save useful patterns for future reference
335
+ - Note sources for deeper reading later
336
+ - Share findings with team (if applicable)
337
+
338
+ ## Cost Awareness
339
+
340
+ - **@explore** is cheap/free - use liberally for codebase searches
341
+ - **@librarian** costs tokens - be specific with queries
342
+ - **Parallel research** is efficient - batch related queries
343
+ - **@oracle** is expensive - only for validating complex decisions