opencodekit 0.17.11 → 0.17.13
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 +4653 -11498
- package/dist/template/.opencode/AGENTS.md +43 -7
- package/dist/template/.opencode/agent/plan.md +1 -1
- package/dist/template/.opencode/command/compound.md +1 -1
- package/dist/template/.opencode/command/lfg.md +1 -1
- package/dist/template/.opencode/memory/project/project.md +2 -2
- package/dist/template/.opencode/memory/project/state.md +2 -2
- package/dist/template/.opencode/memory/project/tech-stack.md +9 -9
- package/dist/template/.opencode/memory/project/user.md +2 -2
- package/dist/template/.opencode/opencode.json +292 -100
- package/dist/template/.opencode/plans/1770006237537-mighty-otter.md +3 -3
- package/dist/template/.opencode/plans/1770006913647-glowing-forest.md +2 -2
- package/dist/template/.opencode/plans/swarm-protocol.md +7 -7
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +1 -1
- package/dist/template/.opencode/skill/context-management/SKILL.md +82 -66
- package/dist/template/.opencode/skill/deep-research/SKILL.md +12 -10
- package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +4 -4
- package/dist/template/.opencode/skill/test-driven-development/SKILL.md +9 -6
- package/package.json +14 -17
|
@@ -5,65 +5,102 @@ description: Use when context is growing large, needing to prune/distill tool ou
|
|
|
5
5
|
|
|
6
6
|
# Context Management
|
|
7
7
|
|
|
8
|
-
Manage conversation context to prevent degradation. Uses DCP plugin.
|
|
8
|
+
Manage conversation context to prevent degradation. Uses DCP plugin (`@tarquinen/opencode-dcp@latest`).
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Tool Hierarchy (v2.2+ Philosophy)
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
DCP beta shifted to a compress-first approach. Follow this order strictly:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
```
|
|
15
|
+
compress > distill > prune
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
| Tool | Use When | Cache Impact |
|
|
19
|
+
| ---------- | ------------------------------------------------------ | ------------ |
|
|
20
|
+
| `compress` | A phase of work is complete — collapse the whole phase | Minimal |
|
|
21
|
+
| `distill` | Large raw output with extractable value to preserve | Low |
|
|
22
|
+
| `prune` | Pure noise: wrong target, irrelevant, zero value | Moderate |
|
|
23
|
+
|
|
24
|
+
**Why this matters:** Granular `prune` calls trigger cache invalidation on every provider, especially Anthropic. Compressing whole phases instead of surgically deleting individual outputs is cheaper, faster, and more reliable.
|
|
25
|
+
|
|
26
|
+
**Never prune because it's convenient. Only prune true noise.**
|
|
27
|
+
|
|
28
|
+
## DCP Slash Commands (Recommended)
|
|
15
29
|
|
|
16
30
|
| Command | Purpose | When to Use |
|
|
17
31
|
| ----------------------- | ---------------------------------------- | ----------------------------------- |
|
|
18
32
|
| `/dcp compress [focus]` | Collapse conversation range into summary | Phase complete, research done |
|
|
19
|
-
| `/dcp sweep [count]` | Prune all tools since last user message | Cleanup noise, quick prune |
|
|
20
33
|
| `/dcp distill [focus]` | Distill key findings before removing | Large outputs with valuable details |
|
|
34
|
+
| `/dcp sweep [count]` | Prune all tools since last user message | Cleanup pure noise only |
|
|
21
35
|
| `/dcp context` | Show token breakdown by category | Check context usage |
|
|
22
36
|
| `/dcp stats` | Show cumulative pruning stats | Review efficiency |
|
|
23
37
|
|
|
24
|
-
|
|
38
|
+
## Tool Calls (Fallback)
|
|
39
|
+
|
|
40
|
+
Use when slash commands aren't suitable:
|
|
41
|
+
|
|
42
|
+
| Tool | Purpose | When to Use |
|
|
43
|
+
| ---------- | ----------------------------- | ------------------------------------- |
|
|
44
|
+
| `compress` | Collapse conversation range | Phase complete, research done |
|
|
45
|
+
| `distill` | Extract key info, then remove | Large outputs with valuable details |
|
|
46
|
+
| `prune` | Remove tool outputs (no save) | Noise only — irrelevant, never-needed |
|
|
47
|
+
|
|
48
|
+
**Note:** Prefer `/dcp compress` slash command over the `compress` tool — better boundary matching.
|
|
49
|
+
|
|
50
|
+
## Phase-Boundary Compress Triggers
|
|
25
51
|
|
|
26
|
-
|
|
52
|
+
The most effective compress timing is at natural phase endings. For the Compound Engineering loop:
|
|
27
53
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
54
|
+
| Phase ends | What to compress | Keep |
|
|
55
|
+
| --------------------- | ---------------------------------------- | --------------------------------- |
|
|
56
|
+
| `/plan` research done | Exploration turns, scout/explore outputs | Plan.md facts, key decisions |
|
|
57
|
+
| `/ship` wave complete | Implementation turns, read file outputs | Commit refs, verification results |
|
|
58
|
+
| `/review` complete | Raw agent outputs (all 5 reviewers) | Synthesized findings summary |
|
|
59
|
+
| `/compound` done | Entire compound loop session | Observation titles stored |
|
|
60
|
+
| Session → handoff | Everything since last compress | Handoff doc summary |
|
|
33
61
|
|
|
34
|
-
**
|
|
62
|
+
**Rule:** Every completed phase is a compress candidate. Don't wait until context is full — compress as chapters close.
|
|
35
63
|
|
|
36
64
|
## DCP Auto-Strategies
|
|
37
65
|
|
|
38
|
-
DCP runs these automatically
|
|
66
|
+
DCP runs these automatically at zero LLM cost — don't manually manage these:
|
|
39
67
|
|
|
40
68
|
- **Deduplication** — removes duplicate tool calls (same tool + same args)
|
|
41
69
|
- **Supersede Writes** — removes write inputs when file is later read
|
|
42
70
|
- **Purge Errors** — removes errored tool inputs after 4 turns
|
|
43
71
|
|
|
44
|
-
You don't need to manually prune these.
|
|
45
|
-
|
|
46
72
|
## When to Evaluate
|
|
47
73
|
|
|
48
|
-
**DO evaluate
|
|
74
|
+
**DO evaluate at:**
|
|
49
75
|
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
- Phase complete (research, exploration, implementation)
|
|
76
|
+
- Start of new turn after receiving user message (best timing — you know what's needed next)
|
|
77
|
+
- Phase boundary: research done, implementation wave done, review done
|
|
78
|
+
- Large tool output just returned that won't be needed for upcoming edits
|
|
79
|
+
- Information superseded by newer, more specific output
|
|
55
80
|
|
|
56
81
|
**DO NOT manage when:**
|
|
57
82
|
|
|
58
|
-
- Output needed for upcoming edits
|
|
59
|
-
- Contains
|
|
60
|
-
- Uncertain if you'll need it
|
|
83
|
+
- Output needed for upcoming file edits (read files stay until edit is done)
|
|
84
|
+
- Contains active file contents you're about to modify
|
|
85
|
+
- Uncertain if you'll need it — defer until certain
|
|
86
|
+
- DCP auto-strategies already handle it
|
|
87
|
+
|
|
88
|
+
## Protected Content
|
|
89
|
+
|
|
90
|
+
Auto-protected from pruning (v2.1.7+):
|
|
91
|
+
|
|
92
|
+
- `write` and `edit` tool outputs
|
|
93
|
+
- `.env*` files
|
|
94
|
+
- `AGENTS.md`
|
|
95
|
+
- `.opencode/**` config
|
|
96
|
+
- `.beads/**` tasks
|
|
97
|
+
- `package.json`, `tsconfig.json`
|
|
61
98
|
|
|
62
|
-
|
|
99
|
+
Don't manually protect what's already protected.
|
|
63
100
|
|
|
64
|
-
|
|
101
|
+
## Distill — Preserve + Remove
|
|
65
102
|
|
|
66
|
-
Extract high-fidelity knowledge from tool outputs, then remove the raw output.
|
|
103
|
+
Extract high-fidelity knowledge from tool outputs, then remove the raw output. Distillation must be a **complete technical substitute** — capture signatures, types, logic, constraints, everything essential.
|
|
67
104
|
|
|
68
105
|
```typescript
|
|
69
106
|
distill({
|
|
@@ -82,55 +119,34 @@ distill({
|
|
|
82
119
|
});
|
|
83
120
|
```
|
|
84
121
|
|
|
85
|
-
### Prune — Remove Noise (Last Resort)
|
|
86
|
-
|
|
87
|
-
Delete tool outputs entirely. No preservation. Use for noise, wrong targets, or superseded information.
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
prune({ ids: ["5", "8"] }); // IDs from <prunable-tools> list
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Critical Rules
|
|
94
|
-
|
|
95
|
-
- IDs MUST come from the current `<prunable-tools>` list
|
|
96
|
-
- The list refreshes after every tool use — don't cache IDs
|
|
97
|
-
- Invalid IDs will error
|
|
98
|
-
- **Distill before prune** — if there's anything worth keeping, distill it
|
|
99
|
-
- **Batch operations** — accumulate several candidates before acting
|
|
100
|
-
- **Timing** — manage at the START of a new turn (after user message), not at the end of your turn
|
|
101
|
-
|
|
102
|
-
## Protected Content
|
|
103
|
-
|
|
104
|
-
Auto-protected from pruning:
|
|
105
|
-
|
|
106
|
-
- `.env*` files
|
|
107
|
-
- `AGENTS.md`
|
|
108
|
-
- `.opencode/**` config
|
|
109
|
-
- `.beads/**` tasks
|
|
110
|
-
- `package.json`, `tsconfig.json`
|
|
111
|
-
|
|
112
122
|
## Context Budget Guidelines
|
|
113
123
|
|
|
114
|
-
| Phase | Target | Action
|
|
115
|
-
| ----------------- | ------- |
|
|
116
|
-
| Starting work | <50k | Load only essential AGENTS.md + task spec
|
|
117
|
-
| Mid-task | 50-100k |
|
|
118
|
-
| Approaching limit | >100k |
|
|
119
|
-
| Near capacity | >150k | Session restart with handoff
|
|
124
|
+
| Phase | Target | Action |
|
|
125
|
+
| ----------------- | ------- | ------------------------------------------------- |
|
|
126
|
+
| Starting work | <50k | Load only essential AGENTS.md + task spec |
|
|
127
|
+
| Mid-task | 50-100k | Compress completed phases, keep active files |
|
|
128
|
+
| Approaching limit | >100k | Compress aggressively by phase, distill remaining |
|
|
129
|
+
| Near capacity | >150k | Session restart with handoff |
|
|
130
|
+
|
|
131
|
+
At >100k: prefer compressing full phases over distilling individual outputs. The cache cost is lower.
|
|
120
132
|
|
|
121
133
|
## Quick Reference
|
|
122
134
|
|
|
123
135
|
```
|
|
136
|
+
HIERARCHY: compress > distill > prune
|
|
137
|
+
TIMING: manage at turn START, not turn END
|
|
138
|
+
PHASE ENDS = compress trigger
|
|
139
|
+
|
|
124
140
|
DCP SLASH COMMANDS (preferred):
|
|
125
|
-
/dcp compress [focus] → Collapse
|
|
141
|
+
/dcp compress [focus] → Collapse completed phase
|
|
126
142
|
/dcp distill [focus] → Distill key findings
|
|
127
|
-
/dcp sweep [count] → Prune
|
|
143
|
+
/dcp sweep [count] → Prune pure noise only
|
|
128
144
|
/dcp context → Show token breakdown
|
|
129
145
|
|
|
130
146
|
TOOL CALLS (fallback):
|
|
147
|
+
compress({ topic, content: { startId, endId, summary } })
|
|
131
148
|
distill({ targets: [{ id, distillation }] })
|
|
132
|
-
prune({ ids: [...] })
|
|
149
|
+
prune({ ids: [...] }) ← last resort only
|
|
133
150
|
|
|
134
|
-
BUDGET: <50k start → 50-100k
|
|
135
|
-
TIMING: Manage at turn START, not turn END
|
|
151
|
+
BUDGET: <50k start → 50-100k compress phases → >100k aggressive → >150k restart
|
|
136
152
|
```
|
|
@@ -93,15 +93,17 @@ The explore agent will run:
|
|
|
93
93
|
### Phase 3: Pattern Discovery
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
|
-
// Find similar patterns in codebase
|
|
97
|
-
grep({ pattern: "<relevant pattern>", include: "
|
|
96
|
+
// Find similar patterns in codebase (use project's file extension: *.ts, *.py, *.rs, *.go, *.java, etc.)
|
|
97
|
+
grep({ pattern: "<relevant pattern>", include: "*.<ext>" });
|
|
98
98
|
|
|
99
99
|
// Locate related files
|
|
100
100
|
glob({ pattern: "src/**/*<topic>*" });
|
|
101
101
|
|
|
102
|
-
// Check tests for usage examples
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
// Check tests for usage examples (adapt glob to project conventions)
|
|
103
|
+
// JS/TS: **/*.test.ts, **/*.spec.ts | Python: **/test_*.py | Rust: **/tests/**
|
|
104
|
+
// Go: **/*_test.go | Java: **/src/test/**/*.java
|
|
105
|
+
glob({ pattern: "**/*test*" });
|
|
106
|
+
grep({ pattern: "<function name>", include: "*test*" });
|
|
105
107
|
```
|
|
106
108
|
|
|
107
109
|
### Phase 4: External Research (If Needed)
|
|
@@ -113,9 +115,9 @@ Only if internal exploration doesn't answer the question:
|
|
|
113
115
|
context7({ operation: "resolve", libraryName: "<lib>" });
|
|
114
116
|
context7({ operation: "query", libraryId: "<id>", topic: "<specific question>" });
|
|
115
117
|
|
|
116
|
-
// Real-world patterns
|
|
118
|
+
// Real-world patterns (adapt language parameter to project)
|
|
117
119
|
codesearch({ query: "<API usage pattern>", tokensNum: 5000 });
|
|
118
|
-
grepsearch({ query: "<code pattern>", language: "
|
|
120
|
+
grepsearch({ query: "<code pattern>", language: "<project language>" });
|
|
119
121
|
```
|
|
120
122
|
|
|
121
123
|
## Confidence Levels
|
|
@@ -279,9 +281,9 @@ Return file:line references for all findings.`,
|
|
|
279
281
|
});
|
|
280
282
|
|
|
281
283
|
// Phase 3: Pattern discovery (parallel with Phase 2)
|
|
282
|
-
grep({ pattern: "middleware", include: "
|
|
283
|
-
grep({ pattern: "rateLimit", include: "
|
|
284
|
-
glob({ pattern: "src/middleware
|
|
284
|
+
grep({ pattern: "middleware", include: "*.<ext>" });
|
|
285
|
+
grep({ pattern: "rateLimit", include: "*.<ext>" });
|
|
286
|
+
glob({ pattern: "src/middleware/*" });
|
|
285
287
|
|
|
286
288
|
// Phase 4: External (if patterns unclear)
|
|
287
289
|
context7({ operation: "resolve", libraryName: "express" });
|
|
@@ -193,7 +193,7 @@ npm run lint
|
|
|
193
193
|
# Must exit 0. If fails → STOP. Run npm run lint:fix, then fix remaining.
|
|
194
194
|
|
|
195
195
|
# Gate 3: Tests
|
|
196
|
-
|
|
196
|
+
vitest
|
|
197
197
|
# Must exit 0. If fails → STOP. Fix failing tests first.
|
|
198
198
|
```
|
|
199
199
|
|
|
@@ -216,7 +216,7 @@ npm run lint || {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
echo "Gate 3/3: Tests..."
|
|
219
|
-
|
|
219
|
+
vitest || { echo "FAILED: Fix failing tests before proceeding."; exit 1; }
|
|
220
220
|
|
|
221
221
|
echo "All gates passed. Safe to merge/PR/close."
|
|
222
222
|
```
|
|
@@ -248,7 +248,7 @@ echo "All gates passed. Safe to merge/PR/close."
|
|
|
248
248
|
|
|
249
249
|
```bash
|
|
250
250
|
# Before closing any bead:
|
|
251
|
-
npm run typecheck && npm run lint &&
|
|
251
|
+
npm run typecheck && npm run lint && vitest
|
|
252
252
|
|
|
253
253
|
# If all pass:
|
|
254
254
|
br close <id> --reason "Implementation complete. All gates passed."
|
|
@@ -273,7 +273,7 @@ Workers must include gate results in their completion report:
|
|
|
273
273
|
|
|
274
274
|
### Gate Command Used
|
|
275
275
|
|
|
276
|
-
`npm run typecheck && npm run lint &&
|
|
276
|
+
`npm run typecheck && npm run lint && vitest`
|
|
277
277
|
```
|
|
278
278
|
|
|
279
279
|
## Common Mistakes
|
|
@@ -120,8 +120,13 @@ Vague name, tests mock not code
|
|
|
120
120
|
|
|
121
121
|
**MANDATORY. Never skip.**
|
|
122
122
|
|
|
123
|
+
Run the project's test command:
|
|
124
|
+
|
|
123
125
|
```bash
|
|
124
|
-
|
|
126
|
+
# Detect from project config:
|
|
127
|
+
# package.json → npm test / vitest | Cargo.toml → cargo test
|
|
128
|
+
# pyproject.toml → pytest | go.mod → go test ./...
|
|
129
|
+
# pom.xml → mvn test | build.gradle → gradle test
|
|
125
130
|
```
|
|
126
131
|
|
|
127
132
|
Confirm:
|
|
@@ -176,9 +181,7 @@ Don't add features, refactor other code, or "improve" beyond the test.
|
|
|
176
181
|
|
|
177
182
|
**MANDATORY.**
|
|
178
183
|
|
|
179
|
-
|
|
180
|
-
npm test path/to/test.test.ts
|
|
181
|
-
```
|
|
184
|
+
Run the project's test command (same as Verify RED).
|
|
182
185
|
|
|
183
186
|
Confirm:
|
|
184
187
|
|
|
@@ -316,7 +319,7 @@ test("rejects empty email", async () => {
|
|
|
316
319
|
**Verify RED**
|
|
317
320
|
|
|
318
321
|
```bash
|
|
319
|
-
$
|
|
322
|
+
$ <project test command>
|
|
320
323
|
FAIL: expected 'Email required', got undefined
|
|
321
324
|
```
|
|
322
325
|
|
|
@@ -334,7 +337,7 @@ function submitForm(data: FormData) {
|
|
|
334
337
|
**Verify GREEN**
|
|
335
338
|
|
|
336
339
|
```bash
|
|
337
|
-
$
|
|
340
|
+
$ <project test command>
|
|
338
341
|
PASS
|
|
339
342
|
```
|
|
340
343
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencodekit",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.13",
|
|
4
4
|
"description": "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
5
5
|
"keywords": ["agents", "cli", "mcp", "opencode", "opencodekit", "template"],
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,15 +19,13 @@
|
|
|
19
19
|
"registry": "https://registry.npmjs.org"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"dev": "
|
|
23
|
-
"build": "
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"validate:command-doc": "bun run src/validation/command-doc.ts --check",
|
|
30
|
-
"validate:docs-drift": "bun run src/validation/docs-drift.ts --check",
|
|
22
|
+
"dev": "tsx src/index.ts",
|
|
23
|
+
"build": "tsdown && 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/",
|
|
24
|
+
"typecheck": "tsgo --noEmit",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
"validate:command-doc": "tsx src/validation/command-doc.ts --check",
|
|
28
|
+
"validate:docs-drift": "tsx src/validation/docs-drift.ts --check",
|
|
31
29
|
"validate:governance": "npm run validate:command-doc && npm run validate:docs-drift",
|
|
32
30
|
"lint": "oxlint .",
|
|
33
31
|
"lint:fix": "oxlint --fix .",
|
|
@@ -39,26 +37,25 @@
|
|
|
39
37
|
"@ai-sdk/provider-utils": "^4.0.15",
|
|
40
38
|
"@clack/prompts": "^0.7.0",
|
|
41
39
|
"@opencode-ai/plugin": "^1.2.6",
|
|
42
|
-
"@opentui/core": "^0.1.80",
|
|
43
|
-
"@opentui/solid": "^0.1.80",
|
|
44
40
|
"cac": "^6.7.14",
|
|
45
41
|
"cli-table3": "^0.6.5",
|
|
46
42
|
"diff": "^8.0.3",
|
|
47
43
|
"ora": "^9.3.0",
|
|
48
44
|
"picocolors": "^1.1.1",
|
|
49
|
-
"solid-js": "1.9.9",
|
|
50
45
|
"zod": "^3.25.76"
|
|
51
46
|
},
|
|
52
47
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "^1.9.4",
|
|
54
|
-
"@types/bun": "latest",
|
|
55
48
|
"@types/diff": "^8.0.0",
|
|
56
49
|
"@types/node": "^22.19.11",
|
|
50
|
+
"@typescript/native-preview": "latest",
|
|
57
51
|
"oxfmt": "^0.23.0",
|
|
58
52
|
"oxlint": "^1.48.0",
|
|
59
|
-
"
|
|
53
|
+
"tsdown": "latest",
|
|
54
|
+
"tsx": "latest",
|
|
55
|
+
"typescript": "^5.9.3",
|
|
56
|
+
"vitest": "latest"
|
|
60
57
|
},
|
|
61
58
|
"engines": {
|
|
62
|
-
"
|
|
59
|
+
"node": ">=20.19.0"
|
|
63
60
|
}
|
|
64
61
|
}
|