opencodekit 0.15.13 → 0.15.15
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/dist/index.js +19 -7
- package/dist/template/.opencode/AGENTS.md +48 -4
- package/dist/template/.opencode/agent/scout.md +20 -1
- package/dist/template/.opencode/command/research.md +55 -61
- package/dist/template/.opencode/memory/observations/2026-01-28-decision-created-deep-research-skill-for-thorough.md +29 -0
- package/dist/template/.opencode/memory/observations/2026-01-28-decision-oracle-tool-optimal-usage-patterns.md +32 -0
- package/dist/template/.opencode/memory/observations/2026-01-28-learning-ampcode-deep-mode-research-integration-w.md +42 -0
- package/dist/template/.opencode/memory/observations/2026-01-28-pattern-research-delegation-pattern-explore-for-.md +32 -0
- package/dist/template/.opencode/memory/observations/2026-01-29-learning-karpathy-llm-coding-insights-dec-2025.md +44 -0
- package/dist/template/.opencode/opencode.json +306 -121
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/skill/deep-research/SKILL.md +385 -0
- package/dist/template/.opencode/tool/oracle.ts +240 -0
- package/package.json +16 -4
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deep-research
|
|
3
|
+
description: >
|
|
4
|
+
Use when analyzing unfamiliar code, implementing complex features, or entering thorough research mode.
|
|
5
|
+
Provides structured LSP exploration (all 9 operations), memory-first protocol, and confidence-scored findings.
|
|
6
|
+
Integrates with scout agent deep mode and research command --thorough flag.
|
|
7
|
+
version: "1.0.0"
|
|
8
|
+
license: MIT
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Deep Research - Comprehensive Code Understanding
|
|
12
|
+
|
|
13
|
+
Systematic methodology for thorough codebase exploration before implementation.
|
|
14
|
+
|
|
15
|
+
## When to Use This Skill
|
|
16
|
+
|
|
17
|
+
Use deep research when:
|
|
18
|
+
|
|
19
|
+
- **Complex implementation**: Feature touches 3+ files or unfamiliar modules
|
|
20
|
+
- **Thorough mode**: `/research <topic> --thorough` or scout deep mode
|
|
21
|
+
- **Pre-edit understanding**: Before modifying code you don't fully understand
|
|
22
|
+
- **Architecture exploration**: Understanding how systems connect
|
|
23
|
+
- **Debugging**: Tracing behavior through multiple layers
|
|
24
|
+
|
|
25
|
+
**Don't use when:**
|
|
26
|
+
|
|
27
|
+
- Quick syntax lookup (use quick mode instead)
|
|
28
|
+
- Well-understood code with obvious changes
|
|
29
|
+
- Time-constrained fixes (accept lower confidence)
|
|
30
|
+
|
|
31
|
+
## Core Protocol
|
|
32
|
+
|
|
33
|
+
### Phase 1: Memory First (Skip External If Found)
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
// Search past research on this topic
|
|
37
|
+
memory_search({ query: "<topic keywords>", limit: 5 });
|
|
38
|
+
|
|
39
|
+
// Check for related observations
|
|
40
|
+
memory_search({ query: "<topic> gotchas patterns", limit: 3 });
|
|
41
|
+
|
|
42
|
+
// Load relevant project context
|
|
43
|
+
memory_read({ file: "project/architecture" });
|
|
44
|
+
memory_read({ file: "project/gotchas" });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Stop condition**: If memory returns high-confidence findings on this exact topic, synthesize and skip to documentation. Only proceed to exploration if:
|
|
48
|
+
|
|
49
|
+
- No relevant memory found
|
|
50
|
+
- Memory findings are outdated or incomplete
|
|
51
|
+
- Question requires fresh analysis
|
|
52
|
+
|
|
53
|
+
### Phase 2: LSP Exploration (Delegate to Explore Agent)
|
|
54
|
+
|
|
55
|
+
**Delegate to explore agent** for comprehensive LSP analysis instead of manual operations:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
task({
|
|
59
|
+
subagent_type: "explore",
|
|
60
|
+
description: "LSP analysis of <target>",
|
|
61
|
+
prompt: `Very thorough LSP analysis of <symbol/module>.
|
|
62
|
+
|
|
63
|
+
Target files:
|
|
64
|
+
- src/path/to/file.ts
|
|
65
|
+
- src/related/module.ts
|
|
66
|
+
|
|
67
|
+
Questions to answer:
|
|
68
|
+
1. What is the type signature of <symbol>?
|
|
69
|
+
2. What calls this function? (incoming calls)
|
|
70
|
+
3. What does this function call? (outgoing calls)
|
|
71
|
+
4. Where is this symbol referenced across the codebase?
|
|
72
|
+
5. Are there interface implementations to consider?
|
|
73
|
+
|
|
74
|
+
Return structured findings with file:line references.`,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The explore agent will run:
|
|
79
|
+
|
|
80
|
+
- `documentSymbol` - File structure overview
|
|
81
|
+
- `goToDefinition` - Symbol definitions
|
|
82
|
+
- `findReferences` - All usages across codebase
|
|
83
|
+
- `hover` - Type info and documentation
|
|
84
|
+
- `workspaceSymbol` - Workspace-wide search
|
|
85
|
+
- Call hierarchy (incoming/outgoing calls)
|
|
86
|
+
|
|
87
|
+
**When to run LSP manually instead:**
|
|
88
|
+
|
|
89
|
+
- Single symbol lookup (quick mode)
|
|
90
|
+
- Explore agent unavailable
|
|
91
|
+
- Need specific operation only
|
|
92
|
+
|
|
93
|
+
### Phase 3: Pattern Discovery
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
// Find similar patterns in codebase
|
|
97
|
+
grep({ pattern: "<relevant pattern>", include: "*.ts" });
|
|
98
|
+
|
|
99
|
+
// Locate related files
|
|
100
|
+
glob({ pattern: "src/**/*<topic>*" });
|
|
101
|
+
|
|
102
|
+
// Check tests for usage examples
|
|
103
|
+
glob({ pattern: "**/*.test.ts" });
|
|
104
|
+
grep({ pattern: "<function name>", include: "*.test.ts" });
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Phase 4: External Research (If Needed)
|
|
108
|
+
|
|
109
|
+
Only if internal exploration doesn't answer the question:
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Official docs
|
|
113
|
+
context7_resolve_library_id({ libraryName: "<lib>" });
|
|
114
|
+
context7_query_docs({ libraryId: "<id>", topic: "<specific question>" });
|
|
115
|
+
|
|
116
|
+
// Real-world patterns
|
|
117
|
+
codesearch({ query: "<API usage pattern>", tokensNum: 5000 });
|
|
118
|
+
grep_search({ query: "<code pattern>", language: "TypeScript" });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Confidence Levels
|
|
122
|
+
|
|
123
|
+
Score every finding:
|
|
124
|
+
|
|
125
|
+
| Level | Criteria | Action |
|
|
126
|
+
| ---------- | ------------------------------------------ | -------------------- |
|
|
127
|
+
| **High** | LSP confirmed + tests exist + docs match | Proceed confidently |
|
|
128
|
+
| **Medium** | LSP confirmed but untested or undocumented | Proceed with caution |
|
|
129
|
+
| **Low** | Inference only, no LSP/test confirmation | Verify before using |
|
|
130
|
+
| **None** | Speculation without evidence | Discard |
|
|
131
|
+
|
|
132
|
+
## Stop Conditions
|
|
133
|
+
|
|
134
|
+
Stop research when ANY of these are true:
|
|
135
|
+
|
|
136
|
+
- All questions answered with Medium+ confidence
|
|
137
|
+
- Tool budget exhausted (~100 calls for thorough)
|
|
138
|
+
- Last 5 tool calls yielded no new insights
|
|
139
|
+
- Blocked and need human input
|
|
140
|
+
|
|
141
|
+
## Tool Budget Guidelines
|
|
142
|
+
|
|
143
|
+
| Mode | Tool Calls | Use Case |
|
|
144
|
+
| -------- | ---------- | ---------------------------------- |
|
|
145
|
+
| Quick | ~10 | Single question, syntax lookup |
|
|
146
|
+
| Default | ~30 | Moderate exploration |
|
|
147
|
+
| Thorough | ~100+ | Comprehensive analysis, new domain |
|
|
148
|
+
|
|
149
|
+
Track your tool count and stop at budget.
|
|
150
|
+
|
|
151
|
+
## Output Template
|
|
152
|
+
|
|
153
|
+
Document findings in structured format:
|
|
154
|
+
|
|
155
|
+
```markdown
|
|
156
|
+
# Deep Research: [Topic]
|
|
157
|
+
|
|
158
|
+
**Mode:** thorough
|
|
159
|
+
**Tool calls:** [N]
|
|
160
|
+
**Duration:** [time]
|
|
161
|
+
|
|
162
|
+
## Questions Addressed
|
|
163
|
+
|
|
164
|
+
1. [Q1] → Answered (High confidence)
|
|
165
|
+
2. [Q2] → Partial (Medium confidence)
|
|
166
|
+
3. [Q3] → Unanswered (needs: [what would resolve])
|
|
167
|
+
|
|
168
|
+
## LSP Findings
|
|
169
|
+
|
|
170
|
+
### Symbol: [name]
|
|
171
|
+
|
|
172
|
+
**Location:** `src/path/file.ts:42`
|
|
173
|
+
**Type:** [type signature from hover]
|
|
174
|
+
|
|
175
|
+
**Callers (incoming):**
|
|
176
|
+
|
|
177
|
+
- `src/a.ts:10` - [context]
|
|
178
|
+
- `src/b.ts:25` - [context]
|
|
179
|
+
|
|
180
|
+
**Dependencies (outgoing):**
|
|
181
|
+
|
|
182
|
+
- `src/utils.ts:15` - [what it calls]
|
|
183
|
+
|
|
184
|
+
**References:** [N] usages across [M] files
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Pattern Analysis
|
|
189
|
+
|
|
190
|
+
### Pattern 1: [Name]
|
|
191
|
+
|
|
192
|
+
**Files:** `src/a.ts`, `src/b.ts`
|
|
193
|
+
**Confidence:** High
|
|
194
|
+
**Evidence:** [LSP + grep findings]
|
|
195
|
+
|
|
196
|
+
[Description of pattern]
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Key Findings
|
|
201
|
+
|
|
202
|
+
### [Finding 1]
|
|
203
|
+
|
|
204
|
+
**Confidence:** High
|
|
205
|
+
**Sources:** LSP goToDefinition, findReferences
|
|
206
|
+
**Evidence:** `src/file.ts:42-56`
|
|
207
|
+
|
|
208
|
+
[Finding with code evidence]
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Recommendations
|
|
213
|
+
|
|
214
|
+
Based on LSP analysis:
|
|
215
|
+
|
|
216
|
+
1. [Recommendation 1] - because [LSP evidence]
|
|
217
|
+
2. [Recommendation 2] - because [pattern found]
|
|
218
|
+
|
|
219
|
+
## Open Items
|
|
220
|
+
|
|
221
|
+
- [Remaining question] - needs: [specific tool/info]
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Integration Points
|
|
225
|
+
|
|
226
|
+
### Scout Agent Deep Mode
|
|
227
|
+
|
|
228
|
+
When scout enters deep mode, load this skill:
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
skill({ name: "deep-research" });
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Scout then follows the protocol for external + internal analysis.
|
|
235
|
+
|
|
236
|
+
### Research Command --thorough
|
|
237
|
+
|
|
238
|
+
When `/research <topic> --thorough` is invoked:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
skill({ name: "deep-research" });
|
|
242
|
+
// Follow full protocol with ~100 tool budget
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Pre-Edit Verification
|
|
246
|
+
|
|
247
|
+
Before any complex edit:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
skill({ name: "deep-research" });
|
|
251
|
+
// Run Phase 2 (LSP) on all symbols being modified
|
|
252
|
+
// Proceed only when all 9 operations complete
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Workflow Example
|
|
256
|
+
|
|
257
|
+
**Scenario:** Understanding authentication middleware before adding rate limiting.
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// Phase 1: Memory check
|
|
261
|
+
memory_search({ query: "authentication middleware rate limiting" });
|
|
262
|
+
memory_read({ file: "project/architecture" });
|
|
263
|
+
|
|
264
|
+
// Phase 2: Delegate LSP exploration to explore agent
|
|
265
|
+
task({
|
|
266
|
+
subagent_type: "explore",
|
|
267
|
+
description: "Analyze auth middleware",
|
|
268
|
+
prompt: `Very thorough LSP analysis of authentication middleware.
|
|
269
|
+
|
|
270
|
+
Target: src/middleware/auth.ts
|
|
271
|
+
|
|
272
|
+
Questions:
|
|
273
|
+
1. What functions are exported from auth.ts?
|
|
274
|
+
2. What calls the auth middleware? (incoming calls)
|
|
275
|
+
3. What does it depend on? (outgoing calls)
|
|
276
|
+
4. Are there existing rate limiting patterns?
|
|
277
|
+
|
|
278
|
+
Return file:line references for all findings.`,
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Phase 3: Pattern discovery (parallel with Phase 2)
|
|
282
|
+
grep({ pattern: "middleware", include: "*.ts" });
|
|
283
|
+
grep({ pattern: "rateLimit", include: "*.ts" });
|
|
284
|
+
glob({ pattern: "src/middleware/*.ts" });
|
|
285
|
+
|
|
286
|
+
// Phase 4: External (if patterns unclear)
|
|
287
|
+
context7_resolve_library_id({ libraryName: "express" });
|
|
288
|
+
context7_query_docs({ libraryId: "/expressjs/express", topic: "middleware" });
|
|
289
|
+
|
|
290
|
+
// Document findings
|
|
291
|
+
write({
|
|
292
|
+
filePath: ".beads/artifacts/<id>/research.md",
|
|
293
|
+
content: "# Deep Research: Auth Middleware...",
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
## Anti-Patterns
|
|
298
|
+
|
|
299
|
+
### DON'T: Skip LSP Exploration
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
// Bad: Reading file without LSP analysis
|
|
303
|
+
read({ filePath: "src/auth.ts" });
|
|
304
|
+
// Then immediately editing...
|
|
305
|
+
|
|
306
|
+
// Good: Delegate to explore agent first
|
|
307
|
+
task({
|
|
308
|
+
subagent_type: "explore",
|
|
309
|
+
description: "Analyze auth.ts",
|
|
310
|
+
prompt: "Very thorough LSP analysis of src/auth.ts...",
|
|
311
|
+
});
|
|
312
|
+
// Then edit with understanding
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### DON'T: Ignore Memory
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// Bad: Jumping straight to exploration
|
|
319
|
+
grep({ pattern: "auth", include: "*.ts" });
|
|
320
|
+
|
|
321
|
+
// Good: Check memory first
|
|
322
|
+
memory_search({ query: "authentication patterns" });
|
|
323
|
+
// Only explore if memory doesn't answer
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### DON'T: Mix Confidence Levels
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
// Bad: Treating speculation as fact
|
|
330
|
+
"This function definitely handles X"; // Without LSP verification
|
|
331
|
+
|
|
332
|
+
// Good: Explicit confidence
|
|
333
|
+
"Based on LSP findReferences (High confidence): This function is called from...";
|
|
334
|
+
"Inference (Low confidence): This might also handle X, needs verification";
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### DON'T: Exceed Budget Without Stopping
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
// Bad: 150 tool calls on thorough mode
|
|
341
|
+
// Keep going indefinitely...
|
|
342
|
+
|
|
343
|
+
// Good: Track and stop
|
|
344
|
+
// Tool call 95: Still finding new insights, continue
|
|
345
|
+
// Tool call 100: Stopping at budget, documenting partial findings
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Success Criteria
|
|
349
|
+
|
|
350
|
+
Research is complete when:
|
|
351
|
+
|
|
352
|
+
- [ ] Memory checked before exploration
|
|
353
|
+
- [ ] All 9 LSP operations run on target symbols
|
|
354
|
+
- [ ] Confidence scores assigned to all findings
|
|
355
|
+
- [ ] Tool budget respected
|
|
356
|
+
- [ ] Findings documented with evidence
|
|
357
|
+
- [ ] Open items listed with resolution paths
|
|
358
|
+
|
|
359
|
+
## Quick Reference
|
|
360
|
+
|
|
361
|
+
```
|
|
362
|
+
PROTOCOL:
|
|
363
|
+
1. Memory first → skip if found
|
|
364
|
+
2. Delegate LSP to @explore (very thorough)
|
|
365
|
+
3. Patterns → grep + glob (parallel)
|
|
366
|
+
4. External → only if needed
|
|
367
|
+
|
|
368
|
+
DELEGATION:
|
|
369
|
+
task({ subagent_type: "explore", prompt: "Very thorough LSP analysis..." })
|
|
370
|
+
|
|
371
|
+
CONFIDENCE:
|
|
372
|
+
High = LSP + tests + docs
|
|
373
|
+
Medium = LSP only
|
|
374
|
+
Low = inference
|
|
375
|
+
None = discard
|
|
376
|
+
|
|
377
|
+
BUDGET:
|
|
378
|
+
quick ~10 | default ~30 | thorough ~100
|
|
379
|
+
|
|
380
|
+
STOP WHEN:
|
|
381
|
+
- Questions answered (Medium+)
|
|
382
|
+
- Budget exhausted
|
|
383
|
+
- 5 calls with no new insights
|
|
384
|
+
- Blocked on human input
|
|
385
|
+
```
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Oracle Tool - Get second opinions from alternative AI models
|
|
5
|
+
*
|
|
6
|
+
* Uses ProxyPal to access various models for:
|
|
7
|
+
* - Validating complex architectural decisions
|
|
8
|
+
* - Cross-checking debugging hypotheses
|
|
9
|
+
* - Getting alternative perspectives on tricky problems
|
|
10
|
+
* - Breaking out of reasoning ruts
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Default to Gemini 3 Pro for deep reasoning (has thinking capability)
|
|
14
|
+
const DEFAULT_MODEL = "gpt-5.2-codex";
|
|
15
|
+
|
|
16
|
+
// Available oracle models with their strengths
|
|
17
|
+
const ORACLE_MODELS: Record<string, { name: string; strength: string }> = {
|
|
18
|
+
"gpt-5.2-codex": {
|
|
19
|
+
name: "GPT-5.2 Codex",
|
|
20
|
+
strength: "Strong code understanding and generation",
|
|
21
|
+
},
|
|
22
|
+
"gemini-3-pro-preview": {
|
|
23
|
+
name: "Gemini 3 Pro",
|
|
24
|
+
strength: "Deep reasoning with thinking capability",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
interface OracleRequest {
|
|
29
|
+
question: string;
|
|
30
|
+
context?: string;
|
|
31
|
+
model?: string;
|
|
32
|
+
mode?: "validate" | "alternative" | "critique" | "brainstorm";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface ChatMessage {
|
|
36
|
+
role: "system" | "user" | "assistant";
|
|
37
|
+
content: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ChatResponse {
|
|
41
|
+
choices?: Array<{
|
|
42
|
+
message?: {
|
|
43
|
+
content?: string;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
error?: {
|
|
47
|
+
message?: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const SYSTEM_PROMPTS: Record<string, string> = {
|
|
52
|
+
validate: `You are a validation oracle. Your job is to critically examine the reasoning, approach, or solution presented to you.
|
|
53
|
+
|
|
54
|
+
Look for:
|
|
55
|
+
- Logical flaws or gaps in reasoning
|
|
56
|
+
- Edge cases that weren't considered
|
|
57
|
+
- Assumptions that may not hold
|
|
58
|
+
- Better alternatives if they exist
|
|
59
|
+
|
|
60
|
+
Be direct and specific. If the approach is sound, say so briefly. If there are issues, explain them clearly.`,
|
|
61
|
+
|
|
62
|
+
alternative: `You are an alternative perspective oracle. Your job is to suggest completely different approaches to the problem.
|
|
63
|
+
|
|
64
|
+
Focus on:
|
|
65
|
+
- Different architectural patterns
|
|
66
|
+
- Alternative technologies or libraries
|
|
67
|
+
- Unconventional but valid solutions
|
|
68
|
+
- Trade-offs the user may not have considered
|
|
69
|
+
|
|
70
|
+
Don't just validate - actively look for different ways to solve the problem.`,
|
|
71
|
+
|
|
72
|
+
critique: `You are a critical review oracle. Your job is to stress-test ideas and find weaknesses.
|
|
73
|
+
|
|
74
|
+
Examine:
|
|
75
|
+
- Security implications
|
|
76
|
+
- Performance concerns
|
|
77
|
+
- Maintainability issues
|
|
78
|
+
- Scalability problems
|
|
79
|
+
- Edge cases and failure modes
|
|
80
|
+
|
|
81
|
+
Be constructively critical. Point out problems but suggest how to address them.`,
|
|
82
|
+
|
|
83
|
+
brainstorm: `You are a brainstorming oracle. Your job is to expand on ideas and generate new possibilities.
|
|
84
|
+
|
|
85
|
+
Generate:
|
|
86
|
+
- Extensions to the proposed approach
|
|
87
|
+
- Creative variations
|
|
88
|
+
- Combinations with other techniques
|
|
89
|
+
- Future-proofing considerations
|
|
90
|
+
|
|
91
|
+
Be generative and expansive. Build on the ideas presented.`,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default tool({
|
|
95
|
+
description: `Get a second opinion from a different AI model for complex reasoning tasks.
|
|
96
|
+
|
|
97
|
+
Use when:
|
|
98
|
+
- Validating architectural decisions before implementing
|
|
99
|
+
- Cross-checking debugging hypotheses
|
|
100
|
+
- Getting alternative perspectives on tricky problems
|
|
101
|
+
- Breaking out of reasoning ruts or confirmation bias
|
|
102
|
+
|
|
103
|
+
Modes:
|
|
104
|
+
- validate: Check if reasoning is sound (default)
|
|
105
|
+
- alternative: Get completely different approaches
|
|
106
|
+
- critique: Stress-test ideas for weaknesses
|
|
107
|
+
- brainstorm: Expand and generate new possibilities
|
|
108
|
+
|
|
109
|
+
Models available:
|
|
110
|
+
${Object.entries(ORACLE_MODELS)
|
|
111
|
+
.map(([id, info]) => `- ${id}: ${info.strength}`)
|
|
112
|
+
.join("\n")}
|
|
113
|
+
|
|
114
|
+
Examples:
|
|
115
|
+
oracle({ question: "Is JWT the right choice for this API?", context: "Building a microservices auth system" })
|
|
116
|
+
oracle({ question: "Review this debugging approach", mode: "critique" })
|
|
117
|
+
oracle({ question: "What other ways could we implement caching?", mode: "alternative", model: "gpt-5.2-codex" })
|
|
118
|
+
`,
|
|
119
|
+
args: {
|
|
120
|
+
question: tool.schema
|
|
121
|
+
.string()
|
|
122
|
+
.describe("The question or problem to get a second opinion on"),
|
|
123
|
+
context: tool.schema
|
|
124
|
+
.string()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe(
|
|
127
|
+
"Additional context about the problem, constraints, or current approach",
|
|
128
|
+
),
|
|
129
|
+
model: tool.schema
|
|
130
|
+
.string()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe(
|
|
133
|
+
`Model to use for oracle (default: ${DEFAULT_MODEL}). Options: ${Object.keys(ORACLE_MODELS).join(", ")}`,
|
|
134
|
+
),
|
|
135
|
+
mode: tool.schema
|
|
136
|
+
.string()
|
|
137
|
+
.optional()
|
|
138
|
+
.describe(
|
|
139
|
+
"Oracle mode: validate (default), alternative, critique, or brainstorm",
|
|
140
|
+
),
|
|
141
|
+
},
|
|
142
|
+
execute: async (args) => {
|
|
143
|
+
const {
|
|
144
|
+
question,
|
|
145
|
+
context,
|
|
146
|
+
model = DEFAULT_MODEL,
|
|
147
|
+
mode = "validate",
|
|
148
|
+
} = args as OracleRequest;
|
|
149
|
+
|
|
150
|
+
if (!question || question.trim() === "") {
|
|
151
|
+
return "Error: question is required";
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Validate model
|
|
155
|
+
const modelInfo = ORACLE_MODELS[model];
|
|
156
|
+
if (!modelInfo) {
|
|
157
|
+
return `Error: Unknown model "${model}". Available models: ${Object.keys(ORACLE_MODELS).join(", ")}`;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Validate mode
|
|
161
|
+
const validModes = ["validate", "alternative", "critique", "brainstorm"];
|
|
162
|
+
if (!validModes.includes(mode)) {
|
|
163
|
+
return `Error: Unknown mode "${mode}". Available modes: ${validModes.join(", ")}`;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Get system prompt for mode
|
|
167
|
+
const systemPrompt = SYSTEM_PROMPTS[mode];
|
|
168
|
+
|
|
169
|
+
// Build user message
|
|
170
|
+
let userMessage = question;
|
|
171
|
+
if (context) {
|
|
172
|
+
userMessage = `Context:\n${context}\n\nQuestion:\n${question}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const messages: ChatMessage[] = [
|
|
176
|
+
{ role: "system", content: systemPrompt },
|
|
177
|
+
{ role: "user", content: userMessage },
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
// Call ProxyPal API
|
|
181
|
+
const PROXYPAL_BASE = "http://127.0.0.1:8317/v1";
|
|
182
|
+
|
|
183
|
+
try {
|
|
184
|
+
const response = await fetch(`${PROXYPAL_BASE}/chat/completions`, {
|
|
185
|
+
method: "POST",
|
|
186
|
+
headers: {
|
|
187
|
+
"Content-Type": "application/json",
|
|
188
|
+
Authorization: "Bearer proxypal-local",
|
|
189
|
+
},
|
|
190
|
+
body: JSON.stringify({
|
|
191
|
+
model,
|
|
192
|
+
messages,
|
|
193
|
+
temperature: 0.7,
|
|
194
|
+
max_tokens: 4096,
|
|
195
|
+
}),
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (!response.ok) {
|
|
199
|
+
const errorText = await response.text();
|
|
200
|
+
return `Error: Oracle API returned ${response.status}: ${errorText}`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const data = (await response.json()) as ChatResponse;
|
|
204
|
+
|
|
205
|
+
if (data.error) {
|
|
206
|
+
return `Error: ${data.error.message || "Unknown error from oracle"}`;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const content = data.choices?.[0]?.message?.content;
|
|
210
|
+
if (!content) {
|
|
211
|
+
return "Error: Oracle returned empty response";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Format response with metadata
|
|
215
|
+
return `## Oracle Response (${modelInfo.name})
|
|
216
|
+
**Mode**: ${mode}
|
|
217
|
+
**Strength**: ${modelInfo.strength}
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
${content}
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
*Second opinion from ${model}*`;
|
|
225
|
+
} catch (error: unknown) {
|
|
226
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
227
|
+
|
|
228
|
+
if (
|
|
229
|
+
message.includes("ECONNREFUSED") ||
|
|
230
|
+
message.includes("fetch failed")
|
|
231
|
+
) {
|
|
232
|
+
return `Error: Cannot connect to ProxyPal at ${PROXYPAL_BASE}.
|
|
233
|
+
|
|
234
|
+
To start ProxyPal, run: proxypal start`;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return `Error: Oracle query failed: ${message}`;
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencodekit",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.15",
|
|
4
4
|
"description": "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"cli",
|
|
8
|
+
"mcp",
|
|
9
|
+
"opencode",
|
|
10
|
+
"opencodekit",
|
|
11
|
+
"template"
|
|
12
|
+
],
|
|
6
13
|
"license": "MIT",
|
|
7
14
|
"author": "OpenCodeKit",
|
|
8
15
|
"repository": {
|
|
@@ -12,7 +19,10 @@
|
|
|
12
19
|
"bin": {
|
|
13
20
|
"ock": "dist/index.js"
|
|
14
21
|
},
|
|
15
|
-
"files": [
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
16
26
|
"type": "module",
|
|
17
27
|
"publishConfig": {
|
|
18
28
|
"access": "public",
|
|
@@ -56,5 +66,7 @@
|
|
|
56
66
|
"engines": {
|
|
57
67
|
"bun": ">=1.3.2"
|
|
58
68
|
},
|
|
59
|
-
"trustedDependencies": [
|
|
69
|
+
"trustedDependencies": [
|
|
70
|
+
"@beads/bd"
|
|
71
|
+
]
|
|
60
72
|
}
|