opencodekit 0.9.1 → 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 +2 -2
- package/dist/index.js +32 -24
- package/dist/template/.opencode/AGENTS.md +180 -85
- package/dist/template/.opencode/README.md +2 -2
- package/dist/template/.opencode/agent/build.md +16 -26
- package/dist/template/.opencode/agent/explore.md +18 -25
- package/dist/template/.opencode/agent/planner.md +38 -9
- package/dist/template/.opencode/agent/review.md +5 -13
- package/dist/template/.opencode/agent/rush.md +24 -55
- package/dist/template/.opencode/agent/scout.md +5 -21
- package/dist/template/.opencode/agent/vision.md +0 -14
- package/dist/template/.opencode/opencode.json +514 -474
- package/dist/template/.opencode/plugin/README.md +110 -98
- package/dist/template/.opencode/plugin/compactor.ts +95 -171
- package/dist/template/.opencode/plugin/enforcer.ts +177 -127
- package/dist/template/.opencode/plugin/injector.ts +150 -0
- package/dist/template/.opencode/plugin/lib/notify.ts +86 -0
- package/dist/template/.opencode/plugin/notification.ts +57 -123
- package/dist/template/.opencode/plugin/truncator.ts +60 -166
- package/dist/template/.opencode/skill/mqdh/SKILL.md +161 -0
- package/dist/template/.opencode/skill/v0/SKILL.md +154 -0
- package/dist/template/.opencode/tool/lsp.ts +454 -0
- package/package.json +51 -63
package/README.md
CHANGED
|
@@ -251,10 +251,10 @@ You've successfully set up OpenCodeKit when:
|
|
|
251
251
|
|
|
252
252
|
---
|
|
253
253
|
|
|
254
|
-
**OpenCodeKit v0.9.
|
|
254
|
+
**OpenCodeKit v0.9.2**
|
|
255
255
|
**Architecture**: Two-layer (Memory + Beads + Git)
|
|
256
256
|
**Package**: `npx opencodekit` to scaffold new projects
|
|
257
|
-
**New in v0.9.
|
|
257
|
+
**New in v0.9.2**: 6 new LSP tools, `ock init --beads` flag, improved tool guidance
|
|
258
258
|
**Ready for**: Daily production use
|
|
259
259
|
|
|
260
260
|
Enjoy your streamlined agent system with clean phase transitions!
|
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.
|
|
753
|
+
version: "0.10.0",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
type: "module",
|
|
756
756
|
repository: {
|
|
@@ -764,10 +764,7 @@ var package_default = {
|
|
|
764
764
|
bin: {
|
|
765
765
|
ock: "dist/index.js"
|
|
766
766
|
},
|
|
767
|
-
files: [
|
|
768
|
-
"dist",
|
|
769
|
-
"README.md"
|
|
770
|
-
],
|
|
767
|
+
files: ["dist", "README.md"],
|
|
771
768
|
scripts: {
|
|
772
769
|
dev: "bun run src/index.ts",
|
|
773
770
|
build: "bun build src/index.ts --outdir dist --target node && mkdir -p dist/template && rsync -av --exclude=node_modules --exclude=dist --exclude=.git --exclude=coverage --exclude=.next --exclude=.turbo --exclude=logs --exclude=package-lock.json .opencode/ dist/template/.opencode/",
|
|
@@ -779,14 +776,7 @@ var package_default = {
|
|
|
779
776
|
lint: "biome check .",
|
|
780
777
|
"lint:fix": "biome check --fix ."
|
|
781
778
|
},
|
|
782
|
-
keywords: [
|
|
783
|
-
"cli",
|
|
784
|
-
"opencodekit",
|
|
785
|
-
"template",
|
|
786
|
-
"agents",
|
|
787
|
-
"mcp",
|
|
788
|
-
"opencode"
|
|
789
|
-
],
|
|
779
|
+
keywords: ["cli", "opencodekit", "template", "agents", "mcp", "opencode"],
|
|
790
780
|
author: "OpenCodeKit",
|
|
791
781
|
license: "MIT",
|
|
792
782
|
engines: {
|
|
@@ -809,9 +799,7 @@ var package_default = {
|
|
|
809
799
|
"@types/node": "^22.10.1",
|
|
810
800
|
typescript: "^5.7.2"
|
|
811
801
|
},
|
|
812
|
-
trustedDependencies: [
|
|
813
|
-
"@beads/bd"
|
|
814
|
-
]
|
|
802
|
+
trustedDependencies: ["@beads/bd"]
|
|
815
803
|
};
|
|
816
804
|
|
|
817
805
|
// src/commands/agent.ts
|
|
@@ -3062,14 +3050,15 @@ async function editAutoupdate(configPath) {
|
|
|
3062
3050
|
}
|
|
3063
3051
|
|
|
3064
3052
|
// src/commands/init.ts
|
|
3053
|
+
import { execSync } from "node:child_process";
|
|
3065
3054
|
import {
|
|
3066
3055
|
existsSync as existsSync3,
|
|
3067
3056
|
mkdirSync as mkdirSync2,
|
|
3068
3057
|
readFileSync as readFileSync3,
|
|
3069
|
-
|
|
3070
|
-
|
|
3058
|
+
readdirSync as readdirSync2,
|
|
3059
|
+
writeFileSync as writeFileSync3
|
|
3071
3060
|
} from "node:fs";
|
|
3072
|
-
import { join as join3
|
|
3061
|
+
import { basename, dirname, join as join3 } from "node:path";
|
|
3073
3062
|
import { fileURLToPath } from "node:url";
|
|
3074
3063
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
3075
3064
|
var EXCLUDED_DIRS = [
|
|
@@ -3126,9 +3115,7 @@ async function copyDir(src, dest) {
|
|
|
3126
3115
|
continue;
|
|
3127
3116
|
const srcPath = join3(src, entry.name);
|
|
3128
3117
|
const destPath = join3(dest, entry.name);
|
|
3129
|
-
if (entry.isSymbolicLink()) {
|
|
3130
|
-
continue;
|
|
3131
|
-
} else if (entry.isDirectory()) {
|
|
3118
|
+
if (entry.isSymbolicLink()) {} else if (entry.isDirectory()) {
|
|
3132
3119
|
await copyDir(srcPath, destPath);
|
|
3133
3120
|
} else {
|
|
3134
3121
|
const content = readFileSync3(srcPath, "utf-8");
|
|
@@ -3190,7 +3177,28 @@ async function initCommand(options = {}) {
|
|
|
3190
3177
|
process.exit(1);
|
|
3191
3178
|
}
|
|
3192
3179
|
s.stop("Done");
|
|
3193
|
-
|
|
3180
|
+
if (options.beads) {
|
|
3181
|
+
const beadsDir = join3(targetDir, ".beads");
|
|
3182
|
+
if (!existsSync3(beadsDir)) {
|
|
3183
|
+
const bs = de();
|
|
3184
|
+
bs.start("Initializing .beads/");
|
|
3185
|
+
try {
|
|
3186
|
+
execSync("bd init", { cwd: targetDir, stdio: "ignore" });
|
|
3187
|
+
bs.stop("Beads initialized");
|
|
3188
|
+
} catch {
|
|
3189
|
+
mkdirSync2(beadsDir, { recursive: true });
|
|
3190
|
+
writeFileSync3(join3(beadsDir, "config.yaml"), `# Beads configuration
|
|
3191
|
+
version: 1
|
|
3192
|
+
`);
|
|
3193
|
+
writeFileSync3(join3(beadsDir, "issues.jsonl"), "");
|
|
3194
|
+
writeFileSync3(join3(beadsDir, "metadata.json"), JSON.stringify({ created: new Date().toISOString() }, null, 2));
|
|
3195
|
+
bs.stop("Beads initialized (manual)");
|
|
3196
|
+
}
|
|
3197
|
+
} else {
|
|
3198
|
+
f2.info(".beads/ already exists");
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
le("cd .opencode && bun install", "Next steps");
|
|
3194
3202
|
$e(import_picocolors7.default.green("Ready to code!"));
|
|
3195
3203
|
}
|
|
3196
3204
|
|
|
@@ -3736,7 +3744,7 @@ var cli = cac("ock");
|
|
|
3736
3744
|
cli.option("--verbose", "Enable verbose logging");
|
|
3737
3745
|
cli.option("--quiet", "Suppress all output");
|
|
3738
3746
|
cli.version(`${packageVersion}`);
|
|
3739
|
-
cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").action(initCommand);
|
|
3747
|
+
cli.command("init", "Initialize OpenCodeKit in current directory").option("--force", "Reinitialize even if already exists").option("--beads", "Also initialize .beads/ for multi-agent coordination").action(initCommand);
|
|
3740
3748
|
cli.command("agent [action]", "Manage agents (list, add, view)").action(async (action) => {
|
|
3741
3749
|
if (!action) {
|
|
3742
3750
|
console.log(`
|
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# OpenCode Global Rules
|
|
2
2
|
|
|
3
|
+
## Constraint Awareness
|
|
4
|
+
|
|
5
|
+
OpenCode operates at **Stage 5-6** of AI adoption:
|
|
6
|
+
|
|
7
|
+
- **Stage 5** (Agentic Verification): Agents run tests and iterate autonomously
|
|
8
|
+
- **Stage 6** (Multi-Agent Orchestration): Parallel workstreams with coordination
|
|
9
|
+
|
|
10
|
+
**Current constraint**: Planning and specification quality. Implementation capacity is not the bottleneck—how well you specify requirements is.
|
|
11
|
+
|
|
12
|
+
### Autonomous Duration
|
|
13
|
+
|
|
14
|
+
The key metric: **How long can an agent work before losing the plot?**
|
|
15
|
+
|
|
16
|
+
Extend autonomous duration by:
|
|
17
|
+
|
|
18
|
+
- Binding tighter to intent (clear specs, constraints, invariants)
|
|
19
|
+
- Providing systematic context (AGENTS.md hierarchy, memory files)
|
|
20
|
+
- Verification loops (test → iterate → verify)
|
|
21
|
+
|
|
22
|
+
### Greenfield vs Legacy
|
|
23
|
+
|
|
24
|
+
- **Greenfield**: Simple context, fast prototypes, agents work well immediately
|
|
25
|
+
- **Legacy**: Complex context, hidden invariants, "that one place you must not touch"
|
|
26
|
+
|
|
27
|
+
Codebase complexity is a primary difficulty knob. Context is how you pay it down.
|
|
28
|
+
|
|
29
|
+
### Context Engineering Principles
|
|
30
|
+
|
|
31
|
+
**Three constraints on context:**
|
|
32
|
+
|
|
33
|
+
1. **Blind spots cause hallucinations** - If agent doesn't see specific context, it fills gaps with generic training priors. You only get the behavior you load.
|
|
34
|
+
2. **Everything influences everything** - Noise-to-signal ratio matters. Irrelevant files degrade ALL output quality.
|
|
35
|
+
3. **Window is finite** - Performance degrades BEFORE hitting hard token limits. Curate the smallest, highest-signal slice.
|
|
36
|
+
|
|
37
|
+
**Practical implications:**
|
|
38
|
+
|
|
39
|
+
- Prefer `lsp_document_symbols` over reading entire files
|
|
40
|
+
- Read specific line ranges, not whole documents
|
|
41
|
+
- Navigate AGENTS.md hierarchy: root → subsystem → details (progressive disclosure)
|
|
42
|
+
- Prune context aggressively; completed work doesn't need to stay loaded
|
|
43
|
+
|
|
44
|
+
### Intent Layer Principles
|
|
45
|
+
|
|
46
|
+
**What belongs in each AGENTS.md (Intent Node):**
|
|
47
|
+
|
|
48
|
+
- **Purpose & Scope** - What this area does. What it explicitly DOESN'T do.
|
|
49
|
+
- **Entry Points & Contracts** - Main APIs, invariants, "all X goes through Y"
|
|
50
|
+
- **Usage Patterns** - Canonical examples: "To add a rule, follow this pattern..."
|
|
51
|
+
- **Anti-patterns** - Negative examples: "Never call X directly; go through Y"
|
|
52
|
+
- **Dependencies & Downlinks** - What it connects to, pointers to child AGENTS.md
|
|
53
|
+
- **Pitfalls** - Things that repeatedly confused agents/humans
|
|
54
|
+
|
|
55
|
+
**Key mechanics:**
|
|
56
|
+
|
|
57
|
+
- **Hierarchical loading** - When a node loads, all ancestors load too (T-shaped view)
|
|
58
|
+
- **Compression, not bloat** - Good nodes compress code; if node is 10k tokens for 20k code, you're adding weight
|
|
59
|
+
- **Least Common Ancestor (LCA)** - Place shared knowledge at shallowest node covering all relevant paths
|
|
60
|
+
- **Downlinks for discovery** - Point to related context without loading everything upfront
|
|
61
|
+
|
|
3
62
|
## Priority Hierarchy
|
|
4
63
|
|
|
5
64
|
1. Security constraints (always first)
|
|
@@ -48,6 +107,56 @@ Specify depth when delegating to control tool call budget:
|
|
|
48
107
|
- **Find work**: Use `bd ready` for unblocked tasks
|
|
49
108
|
- **URLs**: Never generate or guess URLs. Only use URLs from user input, tool results, or verified documentation.
|
|
50
109
|
|
|
110
|
+
## Interaction Modes
|
|
111
|
+
|
|
112
|
+
### Sounding Board Mode
|
|
113
|
+
|
|
114
|
+
Recognize when user wants discussion, not action. Trigger phrases:
|
|
115
|
+
|
|
116
|
+
- "Let's chat for a second..."
|
|
117
|
+
- "Help me think through this..."
|
|
118
|
+
- "Before we write any code..."
|
|
119
|
+
- "What are the tradeoffs of..."
|
|
120
|
+
- "I'm torn between X and Y..."
|
|
121
|
+
- "Play devil's advocate..."
|
|
122
|
+
|
|
123
|
+
**Response**: Ask clarifying questions, surface tradeoffs, explore alternatives. Don't jump to implementation.
|
|
124
|
+
|
|
125
|
+
### Execution Mode (Default)
|
|
126
|
+
|
|
127
|
+
Take action. Produce output. Iterate based on feedback.
|
|
128
|
+
|
|
129
|
+
**Key insight**: First output is ~70-80% right. Refinement is expected, not failure.
|
|
130
|
+
|
|
131
|
+
### Generic + Specific Pattern
|
|
132
|
+
|
|
133
|
+
For batch operations, combine generic goal with concrete example:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
"Refactor all database queries to use parameterized statements.
|
|
137
|
+
|
|
138
|
+
For example, this: db.execute(f"SELECT * FROM users WHERE id = {user_id}")
|
|
139
|
+
Becomes: db.execute("SELECT * FROM users WHERE id = ?", [user_id])
|
|
140
|
+
|
|
141
|
+
Find and fix all similar patterns."
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The generic sets intent; the example sets format. Agent generalizes from example.
|
|
145
|
+
|
|
146
|
+
### Inject Uncertainty
|
|
147
|
+
|
|
148
|
+
When facing design decisions, don't just accept user framing as gospel. Question assumptions:
|
|
149
|
+
|
|
150
|
+
- If user says "use SQLite for cache" → Ask about tradeoffs vs alternatives
|
|
151
|
+
- If user provides a list → Ask if categories make sense, what's missing
|
|
152
|
+
- If plan seems too simple → Surface edge cases they might not have considered
|
|
153
|
+
|
|
154
|
+
Trigger uncertainty mode with phrases like:
|
|
155
|
+
|
|
156
|
+
- "I think this should be... but I'm not sure that's right"
|
|
157
|
+
- "My plan is X, but I'm second-guessing whether..."
|
|
158
|
+
- "What am I missing here?"
|
|
159
|
+
|
|
51
160
|
## Universal Standards
|
|
52
161
|
|
|
53
162
|
### Communication
|
|
@@ -79,35 +188,80 @@ Specify depth when delegating to control tool call budget:
|
|
|
79
188
|
|
|
80
189
|
## Tool Priority
|
|
81
190
|
|
|
82
|
-
**LSP tools → AST
|
|
191
|
+
**LSP tools → AST-grep → Built-in tools**
|
|
192
|
+
|
|
193
|
+
1. **LSP tools** - Semantic code intelligence (10 tools)
|
|
194
|
+
2. `ast-grep` - **Code search/replace** (functions, patterns, imports, hooks)
|
|
195
|
+
3. `grep` - **Text search** (logs, config, non-code files, simple strings)
|
|
196
|
+
4. `glob` - File discovery by name pattern
|
|
197
|
+
5. `read`, `edit`, `write` - File operations
|
|
83
198
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
199
|
+
### Choosing the Right Search Tool
|
|
200
|
+
|
|
201
|
+
Ask yourself: **"Am I looking for code structure or just text?"**
|
|
202
|
+
|
|
203
|
+
**Use `ast-grep` when you need to find:**
|
|
204
|
+
|
|
205
|
+
- How a function is called → `pattern="fetchUser($$$)"`
|
|
206
|
+
- Where a hook is used → `pattern="useState($$$)"`
|
|
207
|
+
- Import statements → `pattern="import { $$ } from '$MOD'"`
|
|
208
|
+
- Class definitions → `pattern="class $NAME { $$$ }"`
|
|
209
|
+
- Try-catch blocks → `pattern="try { $$$ } catch ($E) { $$$ }"`
|
|
210
|
+
|
|
211
|
+
**Use `grep` when you need to find:**
|
|
212
|
+
|
|
213
|
+
- Error messages in logs → `pattern="FATAL|ERROR"`
|
|
214
|
+
- Config values → `pattern="API_KEY"`
|
|
215
|
+
- TODO comments → `pattern="TODO|FIXME"`
|
|
216
|
+
- Text in markdown/docs → `pattern="deprecated"`
|
|
217
|
+
|
|
218
|
+
**Use LSP tools when you need to:**
|
|
219
|
+
|
|
220
|
+
- Understand what a symbol is → `lsp_hover`
|
|
221
|
+
- Jump to where something is defined → `lsp_goto_definition`
|
|
222
|
+
- Find all usages before refactoring → `lsp_find_references`
|
|
223
|
+
- Rename across the entire codebase → `lsp_rename`
|
|
88
224
|
|
|
89
225
|
**Rule**: Always `read` before `edit` to verify content.
|
|
90
226
|
|
|
91
|
-
### LSP Tools
|
|
227
|
+
### LSP Tools (10 tools)
|
|
92
228
|
|
|
93
|
-
Semantic
|
|
229
|
+
Semantic code intelligence via Language Server Protocol:
|
|
94
230
|
|
|
95
|
-
|
|
96
|
-
# Rename symbol across entire codebase
|
|
97
|
-
lsp_rename(filePath, line, character, newName)
|
|
231
|
+
**Navigation & Understanding:**
|
|
98
232
|
|
|
99
|
-
|
|
100
|
-
|
|
233
|
+
- `lsp_hover(filePath, line, character)` - Get type info and docs at cursor
|
|
234
|
+
- `lsp_goto_definition(filePath, line, character)` - Jump to where symbol is defined
|
|
235
|
+
- `lsp_find_references(filePath, line, character)` - Find all usages of a symbol
|
|
236
|
+
- `lsp_document_symbols(filePath)` - Get file outline (classes, functions, etc.)
|
|
237
|
+
- `lsp_workspace_symbols(query, filePath)` - Fuzzy search symbols across workspace
|
|
101
238
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
239
|
+
**Diagnostics:**
|
|
240
|
+
|
|
241
|
+
- `lsp_diagnostics(filePath, severity?)` - Get errors/warnings from language server
|
|
242
|
+
|
|
243
|
+
**Refactoring:**
|
|
105
244
|
|
|
106
|
-
|
|
245
|
+
- `lsp_rename(filePath, line, character, newName)` - Rename symbol across codebase
|
|
246
|
+
- `lsp_code_actions(filePath, startLine, startChar, endLine, endChar)` - Get available refactorings
|
|
247
|
+
- `lsp_code_action_apply(...)` - Apply a specific code action
|
|
248
|
+
- `lsp_organize_imports(filePath)` - Clean up and sort imports
|
|
107
249
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
250
|
+
**When to use each tool:**
|
|
251
|
+
|
|
252
|
+
**"What type is this variable?"** → Use `lsp_hover` to see type signature without reading the entire definition file.
|
|
253
|
+
|
|
254
|
+
**"Where is this function defined?"** → Use `lsp_goto_definition` to jump directly to source instead of grepping.
|
|
255
|
+
|
|
256
|
+
**"What uses this function?"** → Use `lsp_find_references` before changing anything to see all call sites.
|
|
257
|
+
|
|
258
|
+
**"What's in this file?"** → Use `lsp_document_symbols` for a quick outline without reading the entire file.
|
|
259
|
+
|
|
260
|
+
**"Where is UserService defined?"** → Use `lsp_workspace_symbols` to fuzzy search across all files.
|
|
261
|
+
|
|
262
|
+
**"Are there type errors?"** → Use `lsp_diagnostics` to check before running tests.
|
|
263
|
+
|
|
264
|
+
**"Rename this function safely"** → Use `lsp_rename` to update all references automatically.
|
|
111
265
|
|
|
112
266
|
**Caveat**: LSP tools modify files directly. Re-read files before further edits.
|
|
113
267
|
|
|
@@ -216,23 +370,17 @@ memory-search(query: "session", type: "handoffs")
|
|
|
216
370
|
|
|
217
371
|
- Task tracking uses Beads (`bd` CLI)
|
|
218
372
|
|
|
219
|
-
##
|
|
220
|
-
|
|
221
|
-
Plugins run automatically in the background:
|
|
222
|
-
|
|
223
|
-
- **enforcer** - OS notification when session idles with incomplete TODOs
|
|
224
|
-
- **compactor** - Warns at 70%, 85%, 95% context usage - prevents rushed work
|
|
225
|
-
- **truncator** - Dynamic output truncation based on context remaining
|
|
373
|
+
## Session Management
|
|
226
374
|
|
|
227
|
-
**
|
|
375
|
+
**Philosophy**: Short sessions (<150k tokens) beat long bloated ones. Agents get worse with too much context. Cost is exponential.
|
|
228
376
|
|
|
229
|
-
|
|
230
|
-
- 85% - Consider pruning or summarizing
|
|
231
|
-
- 95% - Critical: prune immediately or start new session
|
|
377
|
+
### Context Thresholds
|
|
232
378
|
|
|
233
|
-
|
|
379
|
+
The environment monitors context usage and warns at these thresholds:
|
|
234
380
|
|
|
235
|
-
**
|
|
381
|
+
- **70%** - Consolidate work; consider pruning irrelevant tool outputs
|
|
382
|
+
- **85%** - Summarize findings and consider starting a new session
|
|
383
|
+
- **95%** - Critical: prune context immediately or restart session
|
|
236
384
|
|
|
237
385
|
### Session Tools
|
|
238
386
|
|
|
@@ -355,25 +503,6 @@ Call `bd_insights` for graph analysis showing bottlenecks and high-priority keys
|
|
|
355
503
|
|
|
356
504
|
Get `bd_priority` recommendations for what to work on next based on graph analysis. Use `bd_diff` to compare issue changes between git revisions.
|
|
357
505
|
|
|
358
|
-
### Quick Start
|
|
359
|
-
|
|
360
|
-
```typescript
|
|
361
|
-
// 1. Join workspace
|
|
362
|
-
bd_init({ team: "project", role: "fe" });
|
|
363
|
-
|
|
364
|
-
// 2. Get next task
|
|
365
|
-
const task = bd_claim();
|
|
366
|
-
|
|
367
|
-
// 3. Lock files before editing
|
|
368
|
-
bd_reserve({ paths: ["src/auth.ts", "src/types.ts"] });
|
|
369
|
-
|
|
370
|
-
// 4. Do the work...
|
|
371
|
-
|
|
372
|
-
// 5. Complete and restart
|
|
373
|
-
bd_done({ id: task.id, msg: "Implemented auth" });
|
|
374
|
-
// RESTART SESSION
|
|
375
|
-
```
|
|
376
|
-
|
|
377
506
|
### Rules
|
|
378
507
|
|
|
379
508
|
- **Always `bd_init()` first** in any session using beads tools
|
|
@@ -381,40 +510,6 @@ bd_done({ id: task.id, msg: "Implemented auth" });
|
|
|
381
510
|
- **One task per session** - restart after `bd_done()`
|
|
382
511
|
- **Use `bd_msg(to="all")`** for team-wide announcements
|
|
383
512
|
|
|
384
|
-
### Skill
|
|
385
|
-
|
|
386
|
-
Load `beads` skill for detailed workflow guidance:
|
|
387
|
-
|
|
388
|
-
```
|
|
389
|
-
skill({ name: "beads" })
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
## Skills System
|
|
393
|
-
|
|
394
|
-
OpenCode has a native `skill` tool that auto-discovers skills from `.opencode/skill/` and `~/.config/opencode/skill/`. Use `skill({ name: "skill-name" })` when:
|
|
395
|
-
|
|
396
|
-
- Creating something new → `brainstorming`
|
|
397
|
-
- Bug or unexpected behavior → `systematic-debugging`
|
|
398
|
-
- Implementing feature → `test-driven-development`
|
|
399
|
-
- Before commit/done → `verification-before-completion`
|
|
400
|
-
- Complex multi-step work → `writing-plans` → `executing-plans`
|
|
401
|
-
- Finished implementation → `requesting-code-review`
|
|
402
|
-
- Building UI → `frontend-aesthetics`
|
|
403
|
-
- UI/UX with images → `ui-ux-research` or `visual-analysis`
|
|
404
|
-
- Accessibility audit → `accessibility-audit`
|
|
405
|
-
- Design system audit → `design-system-audit`
|
|
406
|
-
- Mockups to code → `mockup-to-code`
|
|
407
|
-
- Large codebase research → `gemini-large-context`
|
|
408
|
-
|
|
409
|
-
Skip for simple questions, quick edits, or conversations.
|
|
410
|
-
|
|
411
|
-
### How It Works
|
|
412
|
-
|
|
413
|
-
1. Available skills are listed in the `skill` tool description (auto-discovered)
|
|
414
|
-
2. Load a skill: `skill({ name: "brainstorming" })`
|
|
415
|
-
3. Skills consume context - load on-demand, one at a time
|
|
416
|
-
4. Skill permissions can be configured in `opencode.json` (`allow`/`deny`/`ask`)
|
|
417
|
-
|
|
418
513
|
## Core Constraints
|
|
419
514
|
|
|
420
515
|
- No sudo
|
|
@@ -329,8 +329,8 @@ fi
|
|
|
329
329
|
|
|
330
330
|
---
|
|
331
331
|
|
|
332
|
-
**OpenCodeKit v0.9.
|
|
332
|
+
**OpenCodeKit v0.9.2**
|
|
333
333
|
**Architecture:** Two-Layer (Memory + Beads + Git)
|
|
334
|
-
**New in v0.9.
|
|
334
|
+
**New in v0.9.2:** 6 new LSP tools, `ock init --beads` flag, improved tool guidance
|
|
335
335
|
**Package:** `npx opencodekit` to scaffold new projects
|
|
336
336
|
**Last Updated:** January 2, 2026
|
|
@@ -43,35 +43,14 @@ Primary orchestrator. Execute-first. Autonomous task completion until resolved.
|
|
|
43
43
|
- Use `file:line_number` format for code references
|
|
44
44
|
- No emojis unless explicitly requested
|
|
45
45
|
- Keep responses concise
|
|
46
|
+
- First output is ~70-80% right; refinement is expected, not failure
|
|
46
47
|
|
|
47
|
-
##
|
|
48
|
+
## Interaction Awareness
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
3. **Built-in tools** for pattern matching (grep, glob, read)
|
|
52
|
-
4. **Bash** for running tests, builds, commands
|
|
50
|
+
**Sounding Board triggers**: "Let's chat", "Help me think through", "Before we code", "What are the tradeoffs"
|
|
51
|
+
→ Ask clarifying questions, explore alternatives. Don't jump to implementation.
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
Use LSP tools for safe, semantic refactoring. Use `lsp_rename` to rename functions, variables, or classes across the entire codebase - it updates all references automatically. Use `lsp_organize_imports` after making changes to clean up unused imports and sort the remaining ones. Use `lsp_code_actions` to explore available refactoring options at a specific location.
|
|
57
|
-
|
|
58
|
-
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
59
|
-
|
|
60
|
-
### AST-Grep
|
|
61
|
-
|
|
62
|
-
Semantic code search/replace - smarter than regex:
|
|
63
|
-
|
|
64
|
-
```
|
|
65
|
-
# Search patterns
|
|
66
|
-
ast-grep pattern="console.log($$$)" # Find all console.log
|
|
67
|
-
ast-grep pattern="async function $NAME($$$) { $$$ }" # Find async functions
|
|
68
|
-
ast-grep pattern="const [$S, $SET] = useState($$$)" # Find React hooks
|
|
69
|
-
|
|
70
|
-
# Replace (dry run first)
|
|
71
|
-
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
53
|
+
**Execution mode** (default): Take action, produce output, iterate on feedback.
|
|
75
54
|
|
|
76
55
|
## Anti-Hallucination
|
|
77
56
|
|
|
@@ -79,6 +58,17 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
79
58
|
**During work:** Verify against spec constraints; stop if violation detected
|
|
80
59
|
**After work:** Update review.md; close bead with reason
|
|
81
60
|
|
|
61
|
+
## Verification Loop
|
|
62
|
+
|
|
63
|
+
You are the implementation half of an implementation+verification pair. After making changes:
|
|
64
|
+
|
|
65
|
+
1. Run tests, check for regressions
|
|
66
|
+
2. If tests fail, iterate: analyze → fix → retest
|
|
67
|
+
3. Continue loop until tests pass (up to 30-60 min autonomous cycles)
|
|
68
|
+
4. Only then mark task complete
|
|
69
|
+
|
|
70
|
+
**Goal**: Return tested, working code—not just code that looks right.
|
|
71
|
+
|
|
82
72
|
## Task Management
|
|
83
73
|
|
|
84
74
|
- Use TodoWrite to track subtasks; update every 10-15 minutes
|
|
@@ -14,18 +14,33 @@ tools:
|
|
|
14
14
|
todoread: false
|
|
15
15
|
todowrite: false
|
|
16
16
|
ast-grep*: true
|
|
17
|
+
lsp*: true
|
|
17
18
|
---
|
|
18
19
|
|
|
19
20
|
# Explore Agent
|
|
20
21
|
|
|
21
22
|
File search specialist. Navigate and explore codebases efficiently.
|
|
22
23
|
|
|
24
|
+
**Context is your constraint.** Your job is to find the smallest, highest-signal slice of code that answers the question. Avoid loading noise; every irrelevant file degrades the caller's output quality.
|
|
25
|
+
|
|
23
26
|
## Strengths
|
|
24
27
|
|
|
25
28
|
- Finding files using glob patterns
|
|
26
29
|
- Searching code with regex patterns
|
|
27
30
|
- Reading and analyzing file contents
|
|
28
31
|
- Semantic code search with AST-Grep
|
|
32
|
+
- Understanding symbol types and definitions with LSP
|
|
33
|
+
|
|
34
|
+
## Navigation Strategy
|
|
35
|
+
|
|
36
|
+
**Progressive disclosure**: Start broad, narrow based on findings.
|
|
37
|
+
|
|
38
|
+
1. Use `lsp_workspace_symbols` or `lsp_document_symbols` to understand structure without reading whole files
|
|
39
|
+
2. Use `lsp_goto_definition` to jump directly to source instead of grepping
|
|
40
|
+
3. Use `lsp_find_references` to map usage before returning
|
|
41
|
+
4. Only `read` the specific lines that matter
|
|
42
|
+
|
|
43
|
+
**Avoid blind exploration**: Don't grep for generic terms. Use semantic tools first.
|
|
29
44
|
|
|
30
45
|
## Guidelines
|
|
31
46
|
|
|
@@ -35,32 +50,10 @@ File search specialist. Navigate and explore codebases efficiently.
|
|
|
35
50
|
- No emojis in responses
|
|
36
51
|
- **DO NOT** create files or modify system state
|
|
37
52
|
|
|
38
|
-
## Tool Priority
|
|
39
|
-
|
|
40
|
-
**Use AST-Grep for semantic search, then fall back to built-in tools.**
|
|
41
|
-
|
|
42
|
-
### AST-Grep (Semantic Search)
|
|
43
|
-
|
|
44
|
-
`ast-grep` finds functions, classes, and patterns semantically.
|
|
45
|
-
|
|
46
|
-
**Pattern syntax:** `$NAME` = single node, `$$$` = zero or more nodes
|
|
47
|
-
|
|
48
|
-
**Examples:**
|
|
49
|
-
|
|
50
|
-
- `ast-grep pattern="function $NAME($$$) { $$$ }"` - Find all functions
|
|
51
|
-
- `ast-grep pattern="console.log($$$)"` - Find all console.log calls
|
|
52
|
-
- `ast-grep pattern="const [$S, $SET] = useState($$$)"` - Find React hooks
|
|
53
|
-
|
|
54
|
-
### Built-in Tools (Pattern Matching)
|
|
55
|
-
|
|
56
|
-
- `glob` - Find files by pattern (`**/*.ts`)
|
|
57
|
-
- `grep` - Search file contents with regex
|
|
58
|
-
- `read` - Read specific file contents
|
|
59
|
-
|
|
60
53
|
## Thoroughness Levels
|
|
61
54
|
|
|
62
|
-
**Quick**: Single ast-grep or glob. Read 1-3 files. Return immediately.
|
|
55
|
+
**Quick**: Single ast-grep, lsp_workspace_symbols, or glob. Read 1-3 files. Return immediately.
|
|
63
56
|
|
|
64
|
-
**Medium**: AST-grep +
|
|
57
|
+
**Medium**: AST-grep + LSP verification. Check 2-3 naming conventions. Read 3-5 files. Use `lsp_find_references` to trace usage.
|
|
65
58
|
|
|
66
|
-
**Very Thorough**: Comprehensive search across multiple terms and locations.
|
|
59
|
+
**Very Thorough**: Comprehensive search across multiple terms and locations. Use `lsp_find_references` to build dependency map. Report with file:line references.
|
|
@@ -27,6 +27,8 @@ tools:
|
|
|
27
27
|
|
|
28
28
|
Break complex tasks into phases, assign agents, coordinate execution.
|
|
29
29
|
|
|
30
|
+
**At Stage 6, specification quality is THE constraint.** Implementation capacity is not the bottleneck—how well you define requirements, edge cases, and acceptance criteria determines success.
|
|
31
|
+
|
|
30
32
|
## Strengths
|
|
31
33
|
|
|
32
34
|
- Decomposing complex tasks into phases
|
|
@@ -41,6 +43,18 @@ Break complex tasks into phases, assign agents, coordinate execution.
|
|
|
41
43
|
- Use `task` tool to delegate execution
|
|
42
44
|
- No emojis in responses
|
|
43
45
|
- Keep coordinating until all phases complete
|
|
46
|
+
- Question user assumptions; surface tradeoffs before committing to approach
|
|
47
|
+
|
|
48
|
+
## Inject Uncertainty
|
|
49
|
+
|
|
50
|
+
Don't accept user framing as gospel. Actively question:
|
|
51
|
+
|
|
52
|
+
- If user says "use X for Y" → Ask about tradeoffs vs alternatives
|
|
53
|
+
- If user provides a list → Ask if categories make sense, what's missing
|
|
54
|
+
- If plan seems too simple → Surface edge cases they might not have considered
|
|
55
|
+
|
|
56
|
+
Trigger phrases to recognize: "I think... but not sure", "My plan is X, but I'm second-guessing", "What am I missing here?"
|
|
57
|
+
→ Engage in exploration before committing to plan.
|
|
44
58
|
|
|
45
59
|
## Planning Pattern
|
|
46
60
|
|
|
@@ -57,15 +71,6 @@ Use **Facts/Guesses/Plans** in bead notes:
|
|
|
57
71
|
- **Guesses**: Unverified. Include validation strategy and risk.
|
|
58
72
|
- **Plans**: Concrete actions with dependencies.
|
|
59
73
|
|
|
60
|
-
## Agent Assignments
|
|
61
|
-
|
|
62
|
-
- Codebase search → @explore
|
|
63
|
-
- Library docs, patterns → @scout
|
|
64
|
-
- Code review, debugging → @review
|
|
65
|
-
- Implementation → @build
|
|
66
|
-
|
|
67
|
-
**Typical chain**: research → plan → build → review
|
|
68
|
-
|
|
69
74
|
## Re-planning Triggers
|
|
70
75
|
|
|
71
76
|
When blocked 3+ attempts or >24h stall:
|
|
@@ -78,3 +83,27 @@ When blocked 3+ attempts or >24h stall:
|
|
|
78
83
|
## Output Format
|
|
79
84
|
|
|
80
85
|
Provide: Phase breakdown, deliverables per phase, validation gates, agent assignments.
|
|
86
|
+
|
|
87
|
+
## Specification Quality Checklist
|
|
88
|
+
|
|
89
|
+
Before delegating to @build:
|
|
90
|
+
|
|
91
|
+
- [ ] Edge cases identified and documented
|
|
92
|
+
- [ ] Acceptance criteria are testable
|
|
93
|
+
- [ ] Constraints and invariants explicit
|
|
94
|
+
- [ ] Dependencies mapped
|
|
95
|
+
- [ ] "Never do X" rules surfaced
|
|
96
|
+
|
|
97
|
+
Poorly defined specs waste agent cycles. Your planning quality is the ceiling.
|
|
98
|
+
|
|
99
|
+
## Intent Layer Planning
|
|
100
|
+
|
|
101
|
+
When planning new subsystems or major refactors, include AGENTS.md creation:
|
|
102
|
+
|
|
103
|
+
1. **Define scope boundaries** - What this area owns, what it explicitly doesn't
|
|
104
|
+
2. **Document contracts** - Entry points, invariants, "all X goes through Y"
|
|
105
|
+
3. **Capture anti-patterns early** - "Never do X" rules before they become bugs
|
|
106
|
+
4. **Plan downlinks** - How this connects to existing AGENTS.md hierarchy
|
|
107
|
+
5. **Place at LCA** - Shared knowledge goes at shallowest node covering all paths
|
|
108
|
+
|
|
109
|
+
A good Intent Node compresses understanding; if you need 10k tokens to describe 10k tokens of code, you're adding weight, not value.
|