opencodekit 0.19.5 → 0.20.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/dist/index.js +1 -1
- package/dist/template/.opencode/command/compound.md +4 -3
- package/dist/template/.opencode/command/create.md +6 -11
- package/dist/template/.opencode/command/design.md +3 -3
- package/dist/template/.opencode/command/handoff.md +4 -2
- package/dist/template/.opencode/command/init-context.md +79 -55
- package/dist/template/.opencode/command/init-user.md +11 -6
- package/dist/template/.opencode/command/init.md +1 -3
- package/dist/template/.opencode/command/lfg.md +4 -2
- package/dist/template/.opencode/command/plan.md +9 -9
- package/dist/template/.opencode/command/pr.md +5 -1
- package/dist/template/.opencode/command/resume.md +4 -4
- package/dist/template/.opencode/command/review-codebase.md +4 -4
- package/dist/template/.opencode/command/ship.md +5 -7
- package/dist/template/.opencode/command/start.md +8 -10
- package/dist/template/.opencode/command/status.md +1 -1
- package/dist/template/.opencode/command/ui-slop-check.md +6 -6
- package/dist/template/.opencode/command/verify.md +4 -4
- package/dist/template/.opencode/dcp-prompts/defaults/compress-message.md +1 -0
- package/dist/template/.opencode/dcp.jsonc +1 -1
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/opencode.json +3 -5
- package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +1 -1
- package/dist/template/.opencode/skill/cloudflare/SKILL.md +1 -1
- package/dist/template/.opencode/skill/context-initialization/SKILL.md +16 -17
- package/dist/template/.opencode/skill/context-management/SKILL.md +306 -79
- package/dist/template/.opencode/skill/core-data-expert/SKILL.md +1 -1
- package/dist/template/.opencode/skill/design-system-audit/SKILL.md +1 -1
- package/dist/template/.opencode/skill/design-taste-frontend/SKILL.md +1 -1
- package/dist/template/.opencode/skill/figma/SKILL.md +1 -1
- package/dist/template/.opencode/skill/figma-go/SKILL.md +1 -1
- package/dist/template/.opencode/skill/frontend-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +1 -1
- package/dist/template/.opencode/skill/high-end-visual-design/SKILL.md +1 -1
- package/dist/template/.opencode/skill/index-knowledge/SKILL.md +1 -1
- package/dist/template/.opencode/skill/industrial-brutalist-ui/SKILL.md +1 -1
- package/dist/template/.opencode/skill/jira/SKILL.md +1 -1
- package/dist/template/.opencode/skill/minimalist-ui/SKILL.md +1 -1
- package/dist/template/.opencode/skill/mqdh/SKILL.md +1 -1
- package/dist/template/.opencode/skill/opensrc/SKILL.md +184 -27
- package/dist/template/.opencode/skill/pdf-extract/SKILL.md +1 -1
- package/dist/template/.opencode/skill/pencil/SKILL.md +1 -1
- package/dist/template/.opencode/skill/playwright/SKILL.md +18 -6
- package/dist/template/.opencode/skill/{agent-browser/SKILL.md → playwright/references/agent-browser-cli.md} +0 -8
- package/dist/template/.opencode/skill/playwriter/SKILL.md +1 -1
- package/dist/template/.opencode/skill/polar/SKILL.md +1 -1
- package/dist/template/.opencode/skill/prd/SKILL.md +1 -1
- package/dist/template/.opencode/skill/react-best-practices/SKILL.md +1 -1
- package/dist/template/.opencode/skill/redesign-existing-projects/SKILL.md +1 -1
- package/dist/template/.opencode/skill/resend/SKILL.md +1 -1
- package/dist/template/.opencode/skill/stitch/SKILL.md +1 -1
- package/dist/template/.opencode/skill/stitch-design-taste/SKILL.md +1 -1
- package/dist/template/.opencode/skill/supabase/SKILL.md +1 -1
- package/dist/template/.opencode/skill/supabase-postgres-best-practices/SKILL.md +1 -1
- package/dist/template/.opencode/skill/tilth-cli/SKILL.md +47 -20
- package/dist/template/.opencode/skill/v0/SKILL.md +1 -1
- package/dist/template/.opencode/skill/v1-run/SKILL.md +1 -1
- package/dist/template/.opencode/skill/webclaw/SKILL.md +1 -1
- package/dist/template/.opencode/skill/writing-skills/SKILL.md +43 -6
- package/dist/template/.opencode/skill/{testing-skills-with-subagents/SKILL.md → writing-skills/references/testing-methodology.md} +0 -8
- package/package.json +1 -1
- package/dist/template/.opencode/skill/compaction/SKILL.md +0 -384
- package/dist/template/.opencode/skill/session-management/SKILL.md +0 -9
- package/dist/template/.opencode/skill/source-code-research/SKILL.md +0 -293
- package/dist/template/.opencode/skill/ui-ux-research/SKILL.md +0 -9
- package/dist/template/.opencode/skill/using-skills/SKILL.md +0 -117
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/analysis-tips.md +0 -0
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/anti-patterns.md +0 -0
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/common-patterns.md +0 -0
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/example-workflow.md +0 -0
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/further-reading.md +0 -0
- /package/dist/template/.opencode/skill/{source-code-research → opensrc}/references/source-structure.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: writing-skills
|
|
3
|
-
description: "Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization"
|
|
3
|
+
description: "Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology."
|
|
4
4
|
version: 1.0.0
|
|
5
5
|
tags: [documentation, workflow]
|
|
6
6
|
dependencies: []
|
|
@@ -211,12 +211,48 @@ Run same scenarios WITH skill. Agent should now comply.
|
|
|
211
211
|
|
|
212
212
|
Agent found new rationalization? Add explicit counter. Re-test until bulletproof.
|
|
213
213
|
|
|
214
|
-
**
|
|
214
|
+
**DETAILED TESTING METHODOLOGY:** See `references/testing-methodology.md` for the complete testing guide:
|
|
215
215
|
|
|
216
|
-
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
216
|
+
- Full RED-GREEN-REFACTOR testing workflow for skills
|
|
217
|
+
- Scenario templates and pressure campaign examples
|
|
218
|
+
- Rationalization hardening patterns and iteration loops
|
|
219
|
+
- End-to-end checklists and worked examples
|
|
220
|
+
|
|
221
|
+
### Inline Testing Summary (Merged Essentials)
|
|
222
|
+
|
|
223
|
+
Use this quick inline summary while authoring; use `references/testing-methodology.md` for full details.
|
|
224
|
+
|
|
225
|
+
#### Pressure scenarios (test format)
|
|
226
|
+
|
|
227
|
+
- Test behavior under realistic stress, not quiz-style prompts
|
|
228
|
+
- Force concrete A/B/C choices so violations are observable
|
|
229
|
+
- Combine at least 3 pressures per scenario for discipline skills
|
|
230
|
+
- Capture exact rationalizations verbatim during RED
|
|
231
|
+
|
|
232
|
+
| Pressure Type | What to Inject |
|
|
233
|
+
| --------------- | ------------------------------------------- |
|
|
234
|
+
| Time | Deadline, production incident, deploy clock |
|
|
235
|
+
| Sunk cost | Hours already spent, large diff to discard |
|
|
236
|
+
| Authority | Senior/manager asking to skip process |
|
|
237
|
+
| Economic | Revenue loss, promotion/job pressure |
|
|
238
|
+
| Exhaustion | End-of-day fatigue, urgency to finish |
|
|
239
|
+
| Social | Fear of looking rigid or uncooperative |
|
|
240
|
+
| Pragmatic frame | "Be practical, not dogmatic" framing |
|
|
241
|
+
|
|
242
|
+
#### Meta-testing (after failure)
|
|
243
|
+
|
|
244
|
+
When agent fails with skill loaded, ask how the skill should be rewritten to make the right choice unambiguous.
|
|
245
|
+
|
|
246
|
+
- If response is "skill was clear, I ignored it" → strengthen foundational principle
|
|
247
|
+
- If response is "skill should explicitly say X" → add X verbatim
|
|
248
|
+
- If response is "I missed section Y" → improve placement/prominence
|
|
249
|
+
|
|
250
|
+
#### Exit criteria for bulletproof skills
|
|
251
|
+
|
|
252
|
+
- Agent chooses correct action under maximum pressure
|
|
253
|
+
- Agent cites relevant sections to justify action
|
|
254
|
+
- No new rationalizations emerge across retests
|
|
255
|
+
- Meta-test confirms clarity, not ambiguity
|
|
220
256
|
|
|
221
257
|
## STOP: Before Moving to Next Skill
|
|
222
258
|
|
|
@@ -281,6 +317,7 @@ Deploying untested skills = deploying untested code. It's a violation of quality
|
|
|
281
317
|
- `references/claude-search-optimization.md` - CSO guidance: descriptions, keywords, token efficiency, cross-references
|
|
282
318
|
- `references/flowcharts-and-examples.md` - Flowchart usage rules and code example guidance
|
|
283
319
|
- `references/file-organization.md` - Patterns for self-contained vs heavy-reference skills
|
|
320
|
+
- `references/testing-methodology.md` - Complete pressure-testing methodology merged from testing-skills-with-subagents
|
|
284
321
|
- `references/testing-skill-types.md` - How to test discipline, technique, pattern, and reference skills
|
|
285
322
|
- `references/rationalization-hardening.md` - Loophole closure, rationalization tables, red flags
|
|
286
323
|
- `references/anti-patterns.md` - Anti-patterns to avoid
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: testing-skills-with-subagents
|
|
3
|
-
description: Use when creating or editing skills, before deployment, to verify they work under pressure and resist rationalization - applies RED-GREEN-REFACTOR cycle to process documentation by running baseline without skill, writing to address failures, iterating to close loopholes
|
|
4
|
-
version: 1.0.0
|
|
5
|
-
tags: [testing, agent-coordination]
|
|
6
|
-
dependencies: [writing-skills]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Testing Skills With Subagents
|
|
10
2
|
|
|
11
3
|
## When to Use
|
package/package.json
CHANGED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: compaction
|
|
3
|
-
description: >
|
|
4
|
-
Use when context is growing large during long-running tasks and needs server-side or client-side
|
|
5
|
-
summarization to continue effectively. Covers compaction triggers, custom summarization patterns,
|
|
6
|
-
session handoff, and context preservation strategies.
|
|
7
|
-
version: 1.0.0
|
|
8
|
-
tags: [context, workflow]
|
|
9
|
-
dependencies: []
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Context Compaction - Managing Long-Running Sessions
|
|
13
|
-
|
|
14
|
-
## When to Use
|
|
15
|
-
|
|
16
|
-
- Context is growing large and needs compression/cleanup to continue.
|
|
17
|
-
|
|
18
|
-
## When NOT to Use
|
|
19
|
-
|
|
20
|
-
- Short sessions with low context usage where no compaction is needed.
|
|
21
|
-
|
|
22
|
-
## Overview
|
|
23
|
-
|
|
24
|
-
**Compaction = Summarization + Preservation + Continuity**
|
|
25
|
-
|
|
26
|
-
Long-running sessions accumulate context (tool outputs, code reads, exploration results). When context approaches limits, compaction reduces it to essential information while preserving decision history and work state.
|
|
27
|
-
|
|
28
|
-
## Context Budget Awareness
|
|
29
|
-
|
|
30
|
-
### Token Thresholds
|
|
31
|
-
|
|
32
|
-
| Context Usage | Status | Action |
|
|
33
|
-
| ------------- | ----------- | --------------------------------------------- |
|
|
34
|
-
| 0-50% | 🟢 Normal | Work freely |
|
|
35
|
-
| 50-70% | 🟡 Watch | Start compressing completed explorations |
|
|
36
|
-
| 70-85% | 🟠 Compact | Actively compress and sweep stale noise |
|
|
37
|
-
| 85-95% | 🔴 Critical | Emergency compaction, prepare session handoff |
|
|
38
|
-
| 95%+ | ⛔ Limit | Session handoff required |
|
|
39
|
-
|
|
40
|
-
### Monitoring
|
|
41
|
-
|
|
42
|
-
Pay attention to these signals:
|
|
43
|
-
|
|
44
|
-
- Completed phases accumulating without being compressed
|
|
45
|
-
- Repeated file reads of the same content
|
|
46
|
-
- Large bash outputs from builds/tests
|
|
47
|
-
- Multiple exploration rounds without synthesis
|
|
48
|
-
|
|
49
|
-
## Compaction Strategies
|
|
50
|
-
|
|
51
|
-
### Strategy 1: Phase Compression (Preferred)
|
|
52
|
-
|
|
53
|
-
Compress completed conversation phases into dense summaries. This is the primary DCP instrument in the installed beta.
|
|
54
|
-
|
|
55
|
-
Compress completed conversation phases into dense summaries.
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
WHEN: A research phase is complete and findings are clear
|
|
59
|
-
DO: compress({
|
|
60
|
-
topic: "Auth Research Complete",
|
|
61
|
-
content: {
|
|
62
|
-
startString: "unique text at phase start",
|
|
63
|
-
endString: "unique text at phase end",
|
|
64
|
-
summary: "Complete technical summary of findings..."
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
**Key principle**: Only compress CLOSED chapters. Never compress active work.
|
|
70
|
-
|
|
71
|
-
### Strategy 2: Sweep Stale Noise
|
|
72
|
-
|
|
73
|
-
Use `/dcp sweep` after a phase is complete to remove stale/noisy content automatically.
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
WHEN: Wrong-target searches or superseded outputs are no longer needed
|
|
77
|
-
DO: /dcp sweep
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Key principle**: Sweep only after the relevant phase is closed. If in doubt, keep it.
|
|
81
|
-
|
|
82
|
-
### Strategy 3: Session Handoff
|
|
83
|
-
|
|
84
|
-
When context is too large to compact further, hand off to a new session.
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
WHEN: Context > 85% and significant work remains
|
|
88
|
-
DO:
|
|
89
|
-
1. Create handoff document with memory-update
|
|
90
|
-
2. Save all decisions with observation tool
|
|
91
|
-
3. Document current state and remaining work
|
|
92
|
-
4. Start new session with handoff reference
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Compaction Decision Tree
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
Is context growing large?
|
|
99
|
-
├── NO → Continue working normally
|
|
100
|
-
└── YES → What type of content is consuming space?
|
|
101
|
-
├── Completed conversation phases → COMPRESS
|
|
102
|
-
├── Stale/noisy closed-phase outputs → SWEEP
|
|
103
|
-
└── Everything is still relevant → SESSION HANDOFF
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Custom Summarization Patterns
|
|
107
|
-
|
|
108
|
-
### For Code Exploration
|
|
109
|
-
|
|
110
|
-
```markdown
|
|
111
|
-
## Exploration Summary: [Component/Module]
|
|
112
|
-
|
|
113
|
-
### Architecture
|
|
114
|
-
|
|
115
|
-
- Entry point: `src/auth/index.ts`
|
|
116
|
-
- Key classes: AuthService, TokenManager, SessionStore
|
|
117
|
-
- Dependencies: jwt, bcrypt, redis
|
|
118
|
-
|
|
119
|
-
### Key Findings
|
|
120
|
-
|
|
121
|
-
- Auth flow: login → validate → issue JWT → store session
|
|
122
|
-
- Token rotation: every 15 minutes via refresh endpoint
|
|
123
|
-
- Session storage: Redis with 24h TTL
|
|
124
|
-
|
|
125
|
-
### Decisions Made
|
|
126
|
-
|
|
127
|
-
- Use existing TokenManager (don't replace)
|
|
128
|
-
- Add rate limiting to login endpoint
|
|
129
|
-
- Migrate session store from memory to Redis
|
|
130
|
-
|
|
131
|
-
### Files to Modify
|
|
132
|
-
|
|
133
|
-
- src/auth/service.ts (add rate limiting)
|
|
134
|
-
- src/auth/session.ts (Redis integration)
|
|
135
|
-
- src/config/redis.ts (new file)
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### For Implementation Phase
|
|
139
|
-
|
|
140
|
-
```markdown
|
|
141
|
-
## Implementation Summary: [Feature]
|
|
142
|
-
|
|
143
|
-
### Completed
|
|
144
|
-
|
|
145
|
-
- [x] Database schema migration (src/db/migrations/004_auth.ts)
|
|
146
|
-
- [x] API endpoints (src/routes/auth.ts) - 3 new routes
|
|
147
|
-
- [x] Frontend forms (src/components/auth/) - Login, Register, Reset
|
|
148
|
-
|
|
149
|
-
### Verification
|
|
150
|
-
|
|
151
|
-
- TypeScript: ✅ passing
|
|
152
|
-
- Tests: ✅ 12/12 passing
|
|
153
|
-
- Lint: ✅ no issues
|
|
154
|
-
|
|
155
|
-
### Remaining
|
|
156
|
-
|
|
157
|
-
- [ ] Email verification flow
|
|
158
|
-
- [ ] Rate limiting middleware
|
|
159
|
-
|
|
160
|
-
### Key Decisions
|
|
161
|
-
|
|
162
|
-
- JWT expiry: 15 minutes (refresh: 7 days)
|
|
163
|
-
- Password hashing: bcrypt with 12 rounds
|
|
164
|
-
- Session storage: Redis (not in-memory)
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### For Debugging
|
|
168
|
-
|
|
169
|
-
```markdown
|
|
170
|
-
## Debug Summary: [Issue]
|
|
171
|
-
|
|
172
|
-
### Symptoms
|
|
173
|
-
|
|
174
|
-
- Error: "TypeError: Cannot read property 'id' of undefined"
|
|
175
|
-
- Location: src/auth/middleware.ts:42
|
|
176
|
-
- Trigger: POST /api/protected when token is expired
|
|
177
|
-
|
|
178
|
-
### Root Cause
|
|
179
|
-
|
|
180
|
-
- Token validation returns null on expired tokens
|
|
181
|
-
- Middleware assumes valid token object, no null check
|
|
182
|
-
- Race condition: token expires between validation and use
|
|
183
|
-
|
|
184
|
-
### Fix Applied
|
|
185
|
-
|
|
186
|
-
- Added null check in middleware (src/auth/middleware.ts:42)
|
|
187
|
-
- Added token refresh attempt before rejecting (src/auth/refresh.ts)
|
|
188
|
-
- Added test for expired token scenario (src/auth/**tests**/middleware.test.ts)
|
|
189
|
-
|
|
190
|
-
### Verification
|
|
191
|
-
|
|
192
|
-
- Tests: ✅ all passing including new test
|
|
193
|
-
- Manual: ✅ expired token now triggers refresh
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Session Handoff Protocol
|
|
197
|
-
|
|
198
|
-
When you must hand off to a new session:
|
|
199
|
-
|
|
200
|
-
### 1. Create Handoff Document
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
memory -
|
|
204
|
-
update({
|
|
205
|
-
file: "handoffs/YYYY-MM-DD-feature-name",
|
|
206
|
-
content: `# Session Handoff: [Feature Name]
|
|
207
|
-
|
|
208
|
-
## Context
|
|
209
|
-
[Why this session started, what was the goal]
|
|
210
|
-
|
|
211
|
-
## Completed Work
|
|
212
|
-
[What was done, files changed, decisions made]
|
|
213
|
-
|
|
214
|
-
## Current State
|
|
215
|
-
[Where things stand right now]
|
|
216
|
-
|
|
217
|
-
## Remaining Work
|
|
218
|
-
[What still needs to be done]
|
|
219
|
-
|
|
220
|
-
## Key Decisions
|
|
221
|
-
[Important choices made and why]
|
|
222
|
-
|
|
223
|
-
## Files Modified
|
|
224
|
-
[List of all files changed with brief description]
|
|
225
|
-
|
|
226
|
-
## Gotchas
|
|
227
|
-
[Things the next session should know]
|
|
228
|
-
`,
|
|
229
|
-
mode: "replace",
|
|
230
|
-
});
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### 2. Save Key Observations
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
observation({
|
|
237
|
-
type: "decision",
|
|
238
|
-
title: "Auth implementation approach",
|
|
239
|
-
narrative: "Chose JWT with Redis sessions because...",
|
|
240
|
-
facts: "JWT 15min expiry, Redis 24h TTL, bcrypt 12 rounds",
|
|
241
|
-
concepts: "authentication, sessions, tokens",
|
|
242
|
-
confidence: "high",
|
|
243
|
-
});
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### 3. Resume in New Session
|
|
247
|
-
|
|
248
|
-
```typescript
|
|
249
|
-
// In new session:
|
|
250
|
-
memory - read({ file: "handoffs/YYYY-MM-DD-feature-name" });
|
|
251
|
-
memory - search({ query: "auth implementation" });
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## Integration with DCP Plugin
|
|
255
|
-
|
|
256
|
-
This project uses `@tarquinen/opencode-dcp` for always-on context management (injected via `experimental.chat.system.transform`):
|
|
257
|
-
|
|
258
|
-
- **compress**: Phase-level conversation compression (primary DCP tool in the installed beta)
|
|
259
|
-
- **/dcp sweep**: Cleanup command for stale/noisy content after a phase is complete
|
|
260
|
-
- **Prunable-tools list**: Auto-injected into messages with token estimates
|
|
261
|
-
- **Nudge system**: Reminders every N tool calls + critical limit warnings
|
|
262
|
-
|
|
263
|
-
**Division of responsibility:**
|
|
264
|
-
|
|
265
|
-
- **DCP plugin**: Context budget rules, tool guidance, prunable-tools list, nudges (always present via system prompt)
|
|
266
|
-
- **Compaction plugin** (`.opencode/plugin/compaction.ts`): Session continuity, beads state, handoff recovery, post-compaction protocol (fires during compaction events only)
|
|
267
|
-
|
|
268
|
-
**Custom prompts (enabled):**
|
|
269
|
-
|
|
270
|
-
DCP custom prompts are enabled (`experimental.customPrompts: true`). Override files live at `.opencode/dcp-prompts/overrides/`:
|
|
271
|
-
|
|
272
|
-
- `compress-message.md` — 9-section structured summary format (Primary Request, Key Technical Concepts, Files/Code, Errors/Fixes, Problem Solving, User Messages, Pending Tasks, Current Work, Next Step)
|
|
273
|
-
|
|
274
|
-
Override precedence: project (`.opencode/dcp-prompts/overrides/`) > config dir > global (`~/.config/opencode/dcp-prompts/overrides/`).
|
|
275
|
-
|
|
276
|
-
## Post-Compaction Restoration Protocol
|
|
277
|
-
|
|
278
|
-
**Critical:** After any compaction (server-side or DCP compress), you lose raw file content and active context. Immediately restore:
|
|
279
|
-
|
|
280
|
-
### Step 1: Re-read Active Files (max 5)
|
|
281
|
-
|
|
282
|
-
Re-read the files you were actively editing before compaction. Prioritize by recency — most recently modified first. Cap at 5 files, use offset/limit to read only the sections you need (~200 lines each).
|
|
283
|
-
|
|
284
|
-
```
|
|
285
|
-
After compaction, if you were editing src/auth.ts:
|
|
286
|
-
read({ filePath: "src/auth.ts", offset: 30, limit: 50 })
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
**Why:** The Write/Edit tool requires a prior Read in the same session (`FileTime.assert()`). Without re-reading, your next edit attempt will fail.
|
|
290
|
-
|
|
291
|
-
### Step 2: Restore Active Skill Context
|
|
292
|
-
|
|
293
|
-
If you were using a skill before compaction, re-load it:
|
|
294
|
-
|
|
295
|
-
```typescript
|
|
296
|
-
skill({ name: "<active-skill>" });
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
Skills are prompt-injected — compaction drops them. Re-load to restore the workflow.
|
|
300
|
-
|
|
301
|
-
### Step 3: Check Todo State
|
|
302
|
-
|
|
303
|
-
Review your TodoWrite list to re-establish task tracking:
|
|
304
|
-
|
|
305
|
-
```
|
|
306
|
-
- What was in_progress?
|
|
307
|
-
- What was pending?
|
|
308
|
-
- What was completed?
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
### Step 4: Verify Git Position
|
|
312
|
-
|
|
313
|
-
```bash
|
|
314
|
-
git branch --show-current
|
|
315
|
-
git status --short
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
Confirms you're on the right branch and shows any uncommitted changes.
|
|
319
|
-
|
|
320
|
-
### Step 5: Scan Memory for Context
|
|
321
|
-
|
|
322
|
-
If the compaction was heavy (>50% reduction), check memory for recent observations:
|
|
323
|
-
|
|
324
|
-
```typescript
|
|
325
|
-
memory - search({ query: "<current task keywords>", limit: 3 });
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### Why This Protocol Exists
|
|
329
|
-
|
|
330
|
-
Compaction strips raw file content, tool outputs, and skill prompts. Without restoration:
|
|
331
|
-
|
|
332
|
-
- File edits fail (`FileTime.assert` — no prior read)
|
|
333
|
-
- Line-number precision is lost (you're guessing, not citing)
|
|
334
|
-
- Skill workflows are inactive (no prompt injection)
|
|
335
|
-
- Task tracking is disconnected (todos lost in compressed summary)
|
|
336
|
-
|
|
337
|
-
## Anti-Patterns
|
|
338
|
-
|
|
339
|
-
### ❌ Premature Compaction
|
|
340
|
-
|
|
341
|
-
```
|
|
342
|
-
// DON'T compress a file you're about to edit
|
|
343
|
-
compress({ ... }) // Loses exact line numbers you need
|
|
344
|
-
edit({ ... }) // Now you can't find the right location
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
**Fix**: Keep raw content while actively editing. Compress AFTER the edit phase.
|
|
348
|
-
|
|
349
|
-
### ❌ Compressing Active Work
|
|
350
|
-
|
|
351
|
-
```
|
|
352
|
-
// DON'T compress a conversation phase you might return to
|
|
353
|
-
compress({ summary: "Explored auth options" })
|
|
354
|
-
// Later: "Wait, which options did we consider?"
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
**Fix**: Only compress CLOSED chapters where findings are crystallized.
|
|
358
|
-
|
|
359
|
-
### ❌ Ignoring Context Growth
|
|
360
|
-
|
|
361
|
-
```
|
|
362
|
-
// DON'T let context grow unchecked until hitting limits
|
|
363
|
-
// By the time you notice, emergency compaction loses information
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
**Fix**: Monitor regularly. Compress at natural breakpoints and use `/dcp sweep` after closed phases.
|
|
367
|
-
|
|
368
|
-
## Checklist
|
|
369
|
-
|
|
370
|
-
Before compacting:
|
|
371
|
-
|
|
372
|
-
- [ ] Identified what type of content is consuming context
|
|
373
|
-
- [ ] Chosen appropriate strategy (compress/sweep/handoff)
|
|
374
|
-
- [ ] Verified raw content is no longer needed for active work
|
|
375
|
-
- [ ] Captured all key details in the compression summary or handoff
|
|
376
|
-
- [ ] Saved important decisions as observations
|
|
377
|
-
- [ ] Created handoff document if switching sessions
|
|
378
|
-
|
|
379
|
-
During long sessions:
|
|
380
|
-
|
|
381
|
-
- [ ] Compressing completed phases at natural breakpoints
|
|
382
|
-
- [ ] Sweeping stale/noisy outputs after phase completion
|
|
383
|
-
- [ ] Monitoring context usage trends
|
|
384
|
-
- [ ] Planning session handoff if approaching limits
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: "Merged into context-management. Load that skill instead."
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Session Management
|
|
6
|
-
|
|
7
|
-
> This skill has been merged into `context-management` which now covers both context and session lifecycle management.
|
|
8
|
-
>
|
|
9
|
-
> Load `context-management` instead.
|