opencodekit 0.15.2 → 0.15.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
750
750
|
// package.json
|
|
751
751
|
var package_default = {
|
|
752
752
|
name: "opencodekit",
|
|
753
|
-
version: "0.15.
|
|
753
|
+
version: "0.15.3",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
keywords: ["agents", "cli", "mcp", "opencode", "opencodekit", "template"],
|
|
756
756
|
license: "MIT",
|
|
@@ -44,6 +44,20 @@ Tool results and user messages may include `<system-reminder>` tags. These conta
|
|
|
44
44
|
|
|
45
45
|
External research: library docs, GitHub patterns, framework analysis.
|
|
46
46
|
|
|
47
|
+
## Memory First
|
|
48
|
+
|
|
49
|
+
Before hitting external APIs, check past research:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
memory - search({ query: "<topic keywords>", limit: 3 });
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If memory returns high-confidence findings on this exact topic, synthesize and return without external calls. Only proceed to external sources if:
|
|
56
|
+
|
|
57
|
+
- No relevant memory found
|
|
58
|
+
- Memory findings are outdated or low-confidence
|
|
59
|
+
- Question requires fresher data
|
|
60
|
+
|
|
47
61
|
## Strengths
|
|
48
62
|
|
|
49
63
|
- Official documentation lookup
|
|
@@ -85,6 +99,118 @@ Every code reference must include a GitHub permalink. Never link to a branch or
|
|
|
85
99
|
|
|
86
100
|
To construct a permalink: use `gh_grep_searchGitHub` to find code, then build the URL from the repository and file path returned. Format: `https://github.com/owner/repo/blob/<sha>/path/to/file#L10-L20`.
|
|
87
101
|
|
|
102
|
+
## Tool Priority (External Sources Only)
|
|
103
|
+
|
|
104
|
+
| Priority | Tool | Use Case | Speed |
|
|
105
|
+
| -------- | ------------- | -------------------------------------- | ------- |
|
|
106
|
+
| 1 | memory-search | Past research findings | Instant |
|
|
107
|
+
| 2 | context7 | Official library docs | Fast |
|
|
108
|
+
| 3 | codesearch | Usage patterns in real code | Fast |
|
|
109
|
+
| 4 | gh_grep | Cross-repo deep code search | Medium |
|
|
110
|
+
| 5 | webfetch | Specific doc URLs, READMEs, changelogs | Medium |
|
|
111
|
+
| 6 | opensrc + LSP | Clone & analyze source code | Slow |
|
|
112
|
+
| 7 | websearch | Tutorials, blog posts, recent news | Slow |
|
|
113
|
+
|
|
114
|
+
**Rule:** Exhaust faster tools before slower ones. Run tools in parallel when independent.
|
|
115
|
+
|
|
116
|
+
## webfetch Usage
|
|
117
|
+
|
|
118
|
+
Use `webfetch` for specific external URLs when you have a known target:
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
// GitHub raw files
|
|
122
|
+
webfetch({
|
|
123
|
+
url: "https://raw.githubusercontent.com/owner/repo/main/README.md",
|
|
124
|
+
format: "markdown",
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Documentation pages
|
|
128
|
+
webfetch({ url: "https://zod.dev/docs/guides/async", format: "markdown" });
|
|
129
|
+
|
|
130
|
+
// Release notes
|
|
131
|
+
webfetch({ url: "https://github.com/colinhacks/zod/releases", format: "markdown" });
|
|
132
|
+
|
|
133
|
+
// API references
|
|
134
|
+
webfetch({ url: "https://docs.example.com/api/authentication", format: "markdown" });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**When to use:**
|
|
138
|
+
|
|
139
|
+
- User provides a specific URL
|
|
140
|
+
- context7 returns a doc link worth fetching
|
|
141
|
+
- Need CHANGELOG or release notes
|
|
142
|
+
- GitHub README has details not in context7
|
|
143
|
+
|
|
144
|
+
## Source Code Deep Dive
|
|
145
|
+
|
|
146
|
+
When documentation is insufficient, analyze actual source code.
|
|
147
|
+
|
|
148
|
+
### Step 1: Load the Skill
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
skill({ name: "source-code-research" });
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Step 2: Clone the Package
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx opensrc <package> # npm (auto-detects version)
|
|
158
|
+
npx opensrc <package>@<version> # specific version
|
|
159
|
+
npx opensrc pypi:<package> # Python
|
|
160
|
+
npx opensrc <owner>/<repo> # GitHub repo
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Step 3: Navigate with LSP
|
|
164
|
+
|
|
165
|
+
After cloning, source lands in `opensrc/repos/github.com/<owner>/<repo>/`. Use LSP:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// Get file structure
|
|
169
|
+
lsp({
|
|
170
|
+
operation: "documentSymbol",
|
|
171
|
+
filePath: "opensrc/repos/.../src/index.ts",
|
|
172
|
+
line: 1,
|
|
173
|
+
character: 1,
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Jump to definition
|
|
177
|
+
lsp({
|
|
178
|
+
operation: "goToDefinition",
|
|
179
|
+
filePath: "opensrc/repos/.../src/types.ts",
|
|
180
|
+
line: 42,
|
|
181
|
+
character: 10,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Find all usages
|
|
185
|
+
lsp({
|
|
186
|
+
operation: "findReferences",
|
|
187
|
+
filePath: "opensrc/repos/.../src/core.ts",
|
|
188
|
+
line: 100,
|
|
189
|
+
character: 5,
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Step 4: Search Within Clone
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
// Find specific patterns
|
|
197
|
+
grep({ pattern: "async.*refine", path: "opensrc/", include: "*.ts" });
|
|
198
|
+
|
|
199
|
+
// Check tests for usage examples
|
|
200
|
+
glob({ pattern: "opensrc/**/test/**/*.ts" });
|
|
201
|
+
glob({ pattern: "opensrc/**/*.test.ts" });
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Step 5: Construct Permalinks
|
|
205
|
+
|
|
206
|
+
Build GitHub permalinks from cloned code:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
https://github.com/<owner>/<repo>/blob/<sha>/path/to/file.ts#L42-L56
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Get SHA from `opensrc/sources.json` or the cloned repo.
|
|
213
|
+
|
|
88
214
|
## Guidelines
|
|
89
215
|
|
|
90
216
|
Cite sources with links. No emojis. Explain what the code does, why it's designed that way, and how to use it.
|
|
@@ -93,10 +219,40 @@ Compare implementations across repositories when doing deep research. Note which
|
|
|
93
219
|
|
|
94
220
|
## When Things Fail
|
|
95
221
|
|
|
96
|
-
|
|
222
|
+
### Fallback Chain
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
context7 fails → try codesearch for patterns
|
|
226
|
+
codesearch empty → try gh_grep with broader query
|
|
227
|
+
gh_grep empty → webfetch specific doc URLs if known
|
|
228
|
+
still stuck → opensrc clone + LSP analysis
|
|
229
|
+
last resort → websearch for tutorials/blogs
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Specific Failures
|
|
233
|
+
|
|
234
|
+
**context7 doesn't find library:**
|
|
235
|
+
|
|
236
|
+
1. Try `codesearch({ query: "<library> <function> example" })`
|
|
237
|
+
2. Try `gh_grep_searchGitHub({ query: "import.*from.*<library>" })`
|
|
238
|
+
3. Clone with `npx opensrc <library>` and read source
|
|
239
|
+
|
|
240
|
+
**gh_grep returns nothing:**
|
|
241
|
+
|
|
242
|
+
- Broaden query: search concepts, not exact function names
|
|
243
|
+
- Try different language filters
|
|
244
|
+
- Search for error messages or config patterns
|
|
245
|
+
|
|
246
|
+
**opensrc clone fails:**
|
|
247
|
+
|
|
248
|
+
- Check if package exists on npm/pypi/crates
|
|
249
|
+
- Try GitHub URL directly: `npx opensrc owner/repo`
|
|
250
|
+
- Fall back to `webfetch` on raw GitHub files
|
|
97
251
|
|
|
98
|
-
|
|
252
|
+
**API rate limits:**
|
|
99
253
|
|
|
100
|
-
|
|
254
|
+
- Work from already-cloned repos in `opensrc/`
|
|
255
|
+
- Use `memory-search` to find cached findings
|
|
256
|
+
- Reduce parallel calls, go sequential
|
|
101
257
|
|
|
102
258
|
If you're uncertain, say so explicitly. Propose a hypothesis but flag it as unverified.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Plan: Optimize Scout Agent for External Research
|
|
2
|
+
|
|
3
|
+
**Goal:** Enhance Scout agent prompt with missing tool integrations and workflows for optimal external research.
|
|
4
|
+
|
|
5
|
+
**Scope:** READ-ONLY external research only (no local codebase changes)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Changes Required
|
|
10
|
+
|
|
11
|
+
### File: `.opencode/agent/scout.md`
|
|
12
|
+
|
|
13
|
+
#### 1. Add Memory-First Protocol (after line 43, before "External research:")
|
|
14
|
+
|
|
15
|
+
````markdown
|
|
16
|
+
## Memory First
|
|
17
|
+
|
|
18
|
+
Before hitting external APIs, check past research:
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
memory - search({ query: "<topic keywords>", limit: 3 });
|
|
22
|
+
```
|
|
23
|
+
````
|
|
24
|
+
|
|
25
|
+
If memory returns high-confidence findings on this exact topic, synthesize and return without external calls. Only proceed to external sources if:
|
|
26
|
+
|
|
27
|
+
- No relevant memory found
|
|
28
|
+
- Memory findings are outdated or low-confidence
|
|
29
|
+
- Question requires fresher data
|
|
30
|
+
|
|
31
|
+
````
|
|
32
|
+
|
|
33
|
+
#### 2. Add Tool Priority Section (replace/enhance "## Guidelines" around line 88)
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
## Tool Priority (External Sources Only)
|
|
37
|
+
|
|
38
|
+
| Priority | Tool | Use Case | Speed |
|
|
39
|
+
|----------|------|----------|-------|
|
|
40
|
+
| 1 | memory-search | Past research findings | Instant |
|
|
41
|
+
| 2 | context7 | Official library docs | Fast |
|
|
42
|
+
| 3 | codesearch | Usage patterns in real code | Fast |
|
|
43
|
+
| 4 | gh_grep | Cross-repo deep code search | Medium |
|
|
44
|
+
| 5 | webfetch | Specific doc URLs, READMEs, changelogs | Medium |
|
|
45
|
+
| 6 | opensrc + LSP | Clone & analyze source code | Slow |
|
|
46
|
+
| 7 | websearch | Tutorials, blog posts, recent news | Slow |
|
|
47
|
+
|
|
48
|
+
**Rule:** Exhaust faster tools before slower ones. Run tools in parallel when independent.
|
|
49
|
+
````
|
|
50
|
+
|
|
51
|
+
#### 3. Add webfetch Section (new section after Tool Priority)
|
|
52
|
+
|
|
53
|
+
````markdown
|
|
54
|
+
## webfetch Usage
|
|
55
|
+
|
|
56
|
+
Use `webfetch` for specific external URLs when you have a known target:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
// GitHub raw files
|
|
60
|
+
webfetch({
|
|
61
|
+
url: "https://raw.githubusercontent.com/owner/repo/main/README.md",
|
|
62
|
+
format: "markdown",
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Documentation pages
|
|
66
|
+
webfetch({ url: "https://zod.dev/docs/guides/async", format: "markdown" });
|
|
67
|
+
|
|
68
|
+
// Release notes
|
|
69
|
+
webfetch({ url: "https://github.com/colinhacks/zod/releases", format: "markdown" });
|
|
70
|
+
|
|
71
|
+
// API references
|
|
72
|
+
webfetch({ url: "https://docs.example.com/api/authentication", format: "markdown" });
|
|
73
|
+
```
|
|
74
|
+
````
|
|
75
|
+
|
|
76
|
+
**When to use:**
|
|
77
|
+
|
|
78
|
+
- User provides a specific URL
|
|
79
|
+
- context7 returns a doc link worth fetching
|
|
80
|
+
- Need CHANGELOG or release notes
|
|
81
|
+
- GitHub README has details not in context7
|
|
82
|
+
|
|
83
|
+
````
|
|
84
|
+
|
|
85
|
+
#### 4. Add Source Code Deep Dive Section (new section, expand on existing clone guidance)
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
## Source Code Deep Dive
|
|
89
|
+
|
|
90
|
+
When documentation is insufficient, analyze actual source code.
|
|
91
|
+
|
|
92
|
+
### Step 1: Load the Skill
|
|
93
|
+
```typescript
|
|
94
|
+
skill({ name: "source-code-research" })
|
|
95
|
+
````
|
|
96
|
+
|
|
97
|
+
### Step 2: Clone the Package
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx opensrc <package> # npm (auto-detects version)
|
|
101
|
+
npx opensrc <package>@<version> # specific version
|
|
102
|
+
npx opensrc pypi:<package> # Python
|
|
103
|
+
npx opensrc <owner>/<repo> # GitHub repo
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Step 3: Navigate with LSP
|
|
107
|
+
|
|
108
|
+
After cloning, source lands in `opensrc/repos/github.com/<owner>/<repo>/`. Use LSP:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// Get file structure
|
|
112
|
+
lsp({
|
|
113
|
+
operation: "documentSymbol",
|
|
114
|
+
filePath: "opensrc/repos/.../src/index.ts",
|
|
115
|
+
line: 1,
|
|
116
|
+
character: 1,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Jump to definition
|
|
120
|
+
lsp({
|
|
121
|
+
operation: "goToDefinition",
|
|
122
|
+
filePath: "opensrc/repos/.../src/types.ts",
|
|
123
|
+
line: 42,
|
|
124
|
+
character: 10,
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Find all usages
|
|
128
|
+
lsp({
|
|
129
|
+
operation: "findReferences",
|
|
130
|
+
filePath: "opensrc/repos/.../src/core.ts",
|
|
131
|
+
line: 100,
|
|
132
|
+
character: 5,
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Step 4: Search Within Clone
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// Find specific patterns
|
|
140
|
+
grep({ pattern: "async.*refine", path: "opensrc/", include: "*.ts" });
|
|
141
|
+
|
|
142
|
+
// Check tests for usage examples
|
|
143
|
+
glob({ pattern: "opensrc/**/test/**/*.ts" });
|
|
144
|
+
glob({ pattern: "opensrc/**/*.test.ts" });
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Step 5: Construct Permalinks
|
|
148
|
+
|
|
149
|
+
Build GitHub permalinks from cloned code:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
https://github.com/<owner>/<repo>/blob/<sha>/path/to/file.ts#L42-L56
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Get SHA from `opensrc/sources.json` or the cloned repo.
|
|
156
|
+
|
|
157
|
+
````
|
|
158
|
+
|
|
159
|
+
#### 5. Update Fallback Chain in "When Things Fail" Section (enhance existing)
|
|
160
|
+
|
|
161
|
+
```markdown
|
|
162
|
+
## When Things Fail
|
|
163
|
+
|
|
164
|
+
### Fallback Chain
|
|
165
|
+
````
|
|
166
|
+
|
|
167
|
+
context7 fails → try codesearch for patterns
|
|
168
|
+
codesearch empty → try gh_grep with broader query
|
|
169
|
+
gh_grep empty → webfetch specific doc URLs if known
|
|
170
|
+
still stuck → opensrc clone + LSP analysis
|
|
171
|
+
last resort → websearch for tutorials/blogs
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Specific Failures
|
|
176
|
+
|
|
177
|
+
**context7 doesn't find library:**
|
|
178
|
+
1. Try `codesearch({ query: "<library> <function> example" })`
|
|
179
|
+
2. Try `gh_grep_searchGitHub({ query: "import.*from.*<library>" })`
|
|
180
|
+
3. Clone with `npx opensrc <library>` and read source
|
|
181
|
+
|
|
182
|
+
**gh_grep returns nothing:**
|
|
183
|
+
- Broaden query: search concepts, not exact function names
|
|
184
|
+
- Try different language filters
|
|
185
|
+
- Search for error messages or config patterns
|
|
186
|
+
|
|
187
|
+
**opensrc clone fails:**
|
|
188
|
+
- Check if package exists on npm/pypi/crates
|
|
189
|
+
- Try GitHub URL directly: `npx opensrc owner/repo`
|
|
190
|
+
- Fall back to `webfetch` on raw GitHub files
|
|
191
|
+
|
|
192
|
+
**API rate limits:**
|
|
193
|
+
- Work from already-cloned repos in `opensrc/`
|
|
194
|
+
- Use `memory-search` to find cached findings
|
|
195
|
+
- Reduce parallel calls, go sequential
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Summary of Additions
|
|
201
|
+
|
|
202
|
+
| Addition | Lines | Purpose |
|
|
203
|
+
| ----------------------- | ----- | ----------------------------------------- |
|
|
204
|
+
| Memory-First Protocol | ~15 | Check past research before external calls |
|
|
205
|
+
| Tool Priority Table | ~15 | Clear hierarchy for tool selection |
|
|
206
|
+
| webfetch Section | ~25 | Document missing tool usage |
|
|
207
|
+
| Source Code Deep Dive | ~50 | Full opensrc + LSP workflow |
|
|
208
|
+
| Enhanced Fallback Chain | ~30 | Clear failure recovery paths |
|
|
209
|
+
|
|
210
|
+
**Total additions:** ~135 lines
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Files to Modify
|
|
215
|
+
|
|
216
|
+
1. `.opencode/agent/scout.md` - Add sections above
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Verification
|
|
221
|
+
|
|
222
|
+
After implementation:
|
|
223
|
+
|
|
224
|
+
1. Test Quick Mode: `@scout how to use zod .refine()`
|
|
225
|
+
2. Test Deep Mode: `@scout how do production apps handle zod async validation`
|
|
226
|
+
3. Test Source Dive: `@scout show me zod's internal parse implementation`
|
|
227
|
+
4. Verify memory check appears in scout's first actions
|
|
228
|
+
5. Verify webfetch used when given specific URLs
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Out of Scope
|
|
233
|
+
|
|
234
|
+
- Local codebase access (that's Explore agent)
|
|
235
|
+
- File modifications outside `.beads/artifacts/`
|
|
236
|
+
- Question tool (subagent constraint)
|
|
237
|
+
- New MCP integrations (uses existing tools)
|
package/package.json
CHANGED