opencodekit 0.21.9 → 0.22.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.
Files changed (165) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/template/.opencode/AGENTS.md +116 -499
  3. package/dist/template/.opencode/README.md +1 -1
  4. package/dist/template/.opencode/agent/build.md +56 -396
  5. package/dist/template/.opencode/agent/explore.md +15 -16
  6. package/dist/template/.opencode/agent/general.md +2 -2
  7. package/dist/template/.opencode/agent/plan.md +3 -3
  8. package/dist/template/.opencode/agent/review.md +2 -3
  9. package/dist/template/.opencode/agent/scout.md +34 -16
  10. package/dist/template/.opencode/agent/vision.md +0 -1
  11. package/dist/template/.opencode/command/clarify.md +48 -0
  12. package/dist/template/.opencode/command/commit.md +53 -0
  13. package/dist/template/.opencode/command/design.md +4 -4
  14. package/dist/template/.opencode/command/fix.md +56 -0
  15. package/dist/template/.opencode/command/improve-architecture.md +55 -0
  16. package/dist/template/.opencode/command/init.md +88 -68
  17. package/dist/template/.opencode/command/refactor.md +66 -0
  18. package/dist/template/.opencode/command/review-codebase.md +1 -1
  19. package/dist/template/.opencode/command/ship.md +1 -1
  20. package/dist/template/.opencode/command/test.md +66 -0
  21. package/dist/template/.opencode/dcp.jsonc +29 -46
  22. package/dist/template/.opencode/memory/README.md +3 -5
  23. package/dist/template/.opencode/memory/_templates/adr.md +45 -0
  24. package/dist/template/.opencode/memory/project/gotchas.md +1 -1
  25. package/dist/template/.opencode/memory/project/user.md +1 -2
  26. package/dist/template/.opencode/memory/session-context.md +1 -1
  27. package/dist/template/.opencode/opencode.json +10 -332
  28. package/dist/template/.opencode/plugin/README.md +1 -1
  29. package/dist/template/.opencode/plugin/guard.ts +62 -0
  30. package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
  31. package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
  32. package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
  33. package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
  34. package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
  35. package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
  36. package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
  37. package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
  38. package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
  39. package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
  40. package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
  41. package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
  42. package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
  43. package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
  44. package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
  45. package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
  46. package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
  47. package/dist/template/.opencode/plugin/memory.ts +7 -17
  48. package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
  49. package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
  50. package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
  51. package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
  52. package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
  53. package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
  54. package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
  55. package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
  56. package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
  57. package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
  58. package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
  59. package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
  60. package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
  61. package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
  62. package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
  63. package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
  64. package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
  65. package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
  66. package/dist/template/.opencode/tool/context7.ts +1 -1
  67. package/dist/template/.opencode/tool/grepsearch.ts +1 -1
  68. package/package.json +1 -1
  69. package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
  70. package/dist/template/.opencode/agent/painter.md +0 -83
  71. package/dist/template/.opencode/command/compound.md +0 -240
  72. package/dist/template/.opencode/command/curate.md +0 -299
  73. package/dist/template/.opencode/command/handoff.md +0 -149
  74. package/dist/template/.opencode/command/health.md +0 -356
  75. package/dist/template/.opencode/command/init-context.md +0 -297
  76. package/dist/template/.opencode/command/init-user.md +0 -125
  77. package/dist/template/.opencode/command/iterate.md +0 -200
  78. package/dist/template/.opencode/command/lfg.md +0 -173
  79. package/dist/template/.opencode/command/resume.md +0 -78
  80. package/dist/template/.opencode/command/status.md +0 -126
  81. package/dist/template/.opencode/command/ui-slop-check.md +0 -169
  82. package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
  83. package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
  84. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
  85. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
  86. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
  87. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
  88. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -253
  89. package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
  90. package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
  91. package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
  92. package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
  93. package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
  94. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
  95. package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
  96. package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
  97. package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
  98. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
  99. package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
  100. package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
  101. package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
  102. package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
  103. package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
  104. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
  105. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
  106. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
  107. package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
  108. package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
  109. package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
  110. package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
  111. package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
  112. package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
  113. package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
  114. package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
  115. package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
  116. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
  117. package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
  118. package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
  119. package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
  120. package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
  121. package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
  122. package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
  123. package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
  124. package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
  125. package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
  126. package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
  127. package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
  128. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
  129. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
  130. package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
  131. package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
  132. package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
  133. package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
  134. package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
  135. package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
  136. package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
  137. package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
  138. package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
  139. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
  140. package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
  141. package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
  142. package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
  143. package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
  144. package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
  145. package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
  146. package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
  147. package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
  148. package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
  149. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
  150. package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
  151. package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
  152. package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
  153. package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
  154. package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
  155. package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
  156. package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
  157. package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
  158. package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
  159. package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
  160. /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
  161. /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
  162. /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
  163. /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
  164. /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
  165. /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
@@ -1,390 +0,0 @@
1
- ---
2
- name: context-management
3
- description: Unified protocol for context health and session lifecycle management using DCP tools, thresholds, handoff, resume workflows, and post-compaction restoration.
4
- version: 3.0.0
5
- tags: [context, workflow, session]
6
- dependencies: []
7
- ---
8
-
9
- # Context Management
10
-
11
- > Unified protocol for context health across start, active execution, compression, restoration, handoff, and resume.
12
-
13
- Use this skill to keep context high-signal while preserving edit safety and execution continuity.
14
-
15
- ## When to Use
16
-
17
- - Context is growing and signal quality is dropping
18
- - A phase is complete and should be compressed
19
- - You are preparing `/handoff` or resuming prior work
20
- - You need deterministic restoration after compaction
21
- - You need reusable summary templates for exploration/implementation/debugging
22
-
23
- ## Core Principle
24
-
25
- Prefer **phase-level context hygiene** over emergency cleanup.
26
-
27
- ```text
28
- compress > sweep > handoff
29
- ```
30
-
31
- - **compress**: shrink closed chapters while preserving decisions
32
- - **sweep**: remove stale/noisy residue from closed chapters
33
- - **handoff**: reset in a fresh session when compression is insufficient
34
-
35
- ## DCP Command Usage
36
-
37
- ### `/dcp context`
38
-
39
- Run at session start and major boundaries to detect pressure early.
40
-
41
- ### `/dcp compress`
42
-
43
- Primary action for completed chapters.
44
-
45
- Use when:
46
-
47
- - exploration has stable conclusions
48
- - implementation wave is complete and verified
49
- - review output has been synthesized
50
-
51
- ### `/dcp sweep`
52
-
53
- Secondary cleanup after chapter closure.
54
-
55
- Sweep candidates:
56
-
57
- - wrong-target searches
58
- - superseded logs
59
- - duplicate tool output
60
- - dead-end exploration replaced by synthesis
61
- - large terminal dumps no longer needed
62
-
63
- Do not sweep active material needed for immediate edits.
64
-
65
- ## Session Lifecycle Protocol
66
-
67
- ### 1) Start Session
68
-
69
- 1. Load task + essential policy docs only
70
- 2. Run `/dcp context`
71
- 3. Rehydrate prior state only if needed:
72
- - `find_sessions({ query })`
73
- - `read_session({ session_id, focus })`
74
- - `memory-search({ query })` / `memory-read({ file })`
75
- 4. Verify git position before edits
76
-
77
- ### 2) During Active Work
78
-
79
- - Keep active file outputs readable until edit + verification finish
80
- - Reclassify context at boundaries: active vs closed
81
- - Compress closed chapters before opening a new major chapter
82
- - Sweep only after synthesis exists
83
-
84
- ### 3) Pre-Handoff / Closeout
85
-
86
- 1. Compress closed phases
87
- 2. Sweep stale/noisy residue
88
- 3. Persist decisions/learnings to memory
89
- 4. Write concise handoff (changed, pending, risks)
90
-
91
- ### 4) Resume Session
92
-
93
- 1. Rehydrate only relevant context
94
- 2. Validate assumptions against files + git state
95
- 3. Continue with fresh budget and explicit priorities
96
-
97
- ## Context Budget Thresholds
98
-
99
- | Threshold | Interpretation | Required Action |
100
- | --------- | --------------- | ---------------------------------- |
101
- | <50k | Healthy start | Keep inputs minimal |
102
- | 50k-100k | Moderate growth | Compress completed phases |
103
- | >100k | High pressure | Aggressive compress + `/dcp sweep` |
104
- | >150k | Near capacity | Handoff + resume fresh session |
105
-
106
- Guardrails: ~70% consolidate closed exploration, ~85% schedule handoff, ~95% immediate cleanup/restart.
107
-
108
- ## Phase Boundary Triggers
109
-
110
- Compress at these boundaries:
111
-
112
- - Research complete -> compress exploration/search output
113
- - Implementation wave complete -> compress read/edit/test cycle output
114
- - Review complete -> compress raw reviewer output; keep synthesis
115
- - Pre-handoff -> compress non-essential context since last checkpoint
116
-
117
- Rule: **Closed phases should not remain uncompressed for long.**
118
-
119
- ## Compaction Decision Tree
120
-
121
- Use this before each cleanup action.
122
-
123
- ```text
124
- Is context pressure increasing materially?
125
- ├── NO
126
- │ └── Continue work; reassess at next phase boundary
127
- └── YES
128
- ├── Is there a completed phase with stable conclusions?
129
- │ ├── YES -> /dcp compress completed range
130
- │ └── NO
131
- │ ├── Is growth mostly stale/noisy closed-phase output?
132
- │ │ ├── YES -> /dcp sweep
133
- │ │ └── NO
134
- │ │ ├── Is most remaining context still active/relevant?
135
- │ │ │ ├── YES -> Prepare handoff + resume fresh session
136
- │ │ │ └── NO -> Reclassify content, then compress/sweep
137
- │ └── If uncertain, preserve active content until closure
138
- ```
139
-
140
- ## Custom Summarization Templates
141
-
142
- Use these templates to keep summaries dense and recoverable.
143
-
144
- ### A) Code Exploration Template
145
-
146
- ```markdown
147
- ## Exploration Summary: [Component/Module]
148
-
149
- ### Objective
150
-
151
- - [What was investigated]
152
-
153
- ### Architecture Map
154
-
155
- - Entry points: `path/to/entry.ts`
156
- - Core modules: `A`, `B`, `C`
157
- - Data flow: [input -> transform -> output]
158
- - Dependencies/services: [list]
159
-
160
- ### Verified Findings
161
-
162
- - [Finding with evidence]
163
- - [Finding with evidence]
164
- - [Finding with evidence]
165
-
166
- ### Constraints
167
-
168
- - [Technical/policy/runtime constraints]
169
-
170
- ### Decisions
171
-
172
- - [Decision] -> [Rationale]
173
- - [Decision] -> [Rationale]
174
-
175
- ### Next Step
176
-
177
- - [Immediate next action]
178
- ```
179
-
180
- ### B) Implementation Template
181
-
182
- ```markdown
183
- ## Implementation Summary: [Feature/Fix]
184
-
185
- ### Scope
186
-
187
- - [What this wave covered]
188
-
189
- ### Completed
190
-
191
- - [x] `path/to/file.ts` -> [change]
192
- - [x] `path/to/file.test.ts` -> [coverage]
193
- - [x] [other completed work]
194
-
195
- ### Verification Evidence
196
-
197
- - Typecheck: [command + result]
198
- - Lint: [command + result]
199
- - Tests: [command + result]
200
-
201
- ### Remaining
202
-
203
- - [ ] [pending item]
204
- - [ ] [pending item]
205
-
206
- ### Key Decisions
207
-
208
- - [Decision + reason]
209
- - [Decision + reason]
210
-
211
- ### Resume Anchor
212
-
213
- - Resume from: `path/to/file.ts` [function/region]
214
- ```
215
-
216
- ### C) Debugging Template
217
-
218
- ```markdown
219
- ## Debug Summary: [Issue]
220
-
221
- ### Symptoms
222
-
223
- - Error: [exact error]
224
- - Trigger: [request/action]
225
- - Location: `path:line`
226
-
227
- ### Root Cause
228
-
229
- - [causal chain with evidence]
230
-
231
- ### Fix Applied
232
-
233
- - `path/to/file.ts` -> [exact fix]
234
- - `path/to/test.ts` -> [new/updated coverage]
235
-
236
- ### Verification
237
-
238
- - [test command + result]
239
- - [manual check + result]
240
-
241
- ### Next Step
242
-
243
- - [if unresolved, next investigation/fix]
244
- ```
245
-
246
- ## DCP Plugin Integration
247
-
248
- This project uses `@tarquinen/opencode-dcp` via `experimental.chat.system.transform`.
249
-
250
- ### DCP Responsibilities (Always On)
251
-
252
- - context budget monitoring + threshold cues
253
- - `/dcp` command surface (`context`, `compress`, `sweep`, `stats`)
254
- - prunable-tools guidance + token-aware nudges
255
- - critical-limit warnings
256
-
257
- ### Context-Management Responsibilities (This Skill)
258
-
259
- - timing policy for compress/sweep/handoff
260
- - summary quality and template selection
261
- - post-compaction restoration protocol
262
- - cross-session rehydration sequence
263
-
264
- ### Division of Responsibility
265
-
266
- - **DCP plugin**: measures/surfaces pressure, exposes cleanup commands
267
- - **context-management skill**: decides when to apply commands and how to preserve continuity
268
-
269
- ### Custom Prompt Overrides
270
-
271
- Custom DCP prompts are enabled (`experimental.customPrompts: true`).
272
-
273
- Override precedence:
274
-
275
- 1. `.opencode/dcp-prompts/overrides/` (project)
276
- 2. config directory overrides
277
- 3. `~/.config/opencode/dcp-prompts/overrides/` (global)
278
-
279
- Key file: `compress-message.md` (structured compression schema). Recommended blocks: Primary Request, Key Technical Concepts, Files/Code, Errors/Fixes, Problem Solving, User Messages, Pending Tasks, Current Work, Next Step.
280
-
281
- ## Post-Compaction Restoration Protocol (Critical)
282
-
283
- After any compaction (server-side or `/dcp compress`), execute all 5 steps before editing.
284
-
285
- ### Step 1 — Re-read Active Files (max 5)
286
-
287
- Re-read files active before compaction.
288
-
289
- - prioritize most recent edits first
290
- - cap at 5 files
291
- - use targeted reads (`offset`/`limit`) for precision
292
-
293
- Example:
294
-
295
- ```text
296
- read({ filePath: "src/auth.ts", offset: 30, limit: 80 })
297
- ```
298
-
299
- Why: restores exact local code context and satisfies read-before-edit safety requirements.
300
-
301
- ### Step 2 — Restore Active Skills
302
-
303
- Reload any skills active before compaction.
304
-
305
- ```typescript
306
- skill({ name: "<active-skill>" });
307
- ```
308
-
309
- Why: skill instructions are prompt-injected and may be dropped by compaction.
310
-
311
- ### Step 3 — Reconcile Todo State
312
-
313
- Rebuild exact task status:
314
-
315
- - what was `in_progress`
316
- - what remains `pending`
317
- - what is `completed`
318
-
319
- Why: prevents duplicate work and missed subtasks.
320
-
321
- ### Step 4 — Verify Git Position
322
-
323
- ```bash
324
- git branch --show-current
325
- git status --short
326
- ```
327
-
328
- Why: confirms branch correctness and re-anchors uncommitted file state.
329
-
330
- ### Step 5 — Scan Memory / Session Artifacts
331
-
332
- If compaction was heavy, recover nuance using:
333
-
334
- - `memory-search({ query, limit: 3 })`
335
- - `memory-read({ file })`
336
- - `find_sessions({ query, limit })`
337
- - `read_session({ session_id, focus })`
338
-
339
- Why: restores rationale/constraints often missing from short summaries.
340
-
341
- ### Restoration Exit Criteria
342
-
343
- Do not resume edits until active targets are re-read, required skills are reloaded, todo state is reconciled, git position is confirmed, and critical rationale is recovered when needed.
344
-
345
- ## Context Transfer Sources (Cross-Session)
346
-
347
- Use in priority order:
348
-
349
- 1. Memory artifacts (`memory-search`, `memory-read`, observations)
350
- 2. Session history (`find_sessions`, `read_session`)
351
- 3. Task tracker state (`br show <id>`)
352
- 4. Git evidence (`git diff`, `git log`, test output)
353
-
354
- Carry forward decisions, constraints, and next actions — not transcript bulk.
355
-
356
- ## Anti-Patterns
357
-
358
- | Anti-Pattern | Why It Hurts | Correct Pattern |
359
- | ------------------------------------- | -------------------------------------- | ---------------------------------------------- |
360
- | Compressing active edit context | Loses exact data needed for safe edits | Keep active outputs until edit+verify complete |
361
- | Sweeping still-live content | Causes rework and precision loss | Sweep only stale/noisy closed-phase outputs |
362
- | Leaving closed phases uncompressed | Context bloat degrades later turns | Compress at each phase boundary |
363
- | Handoff without memory persistence | Next session loses rationale | Persist decisions before handoff |
364
- | Skipping restoration after compaction | Edit failures, skill drift, task drift | Run 5-step restoration before resuming |
365
-
366
- ## Verification
367
-
368
- Before claiming context cleanup complete, verify:
369
-
370
- - active edit targets are still readable
371
- - closed chapters are compressed or intentionally retained
372
- - no critical decision exists only in transient output
373
- - restoration protocol completed after compaction
374
- - handoff includes next actions and blockers
375
-
376
- ## Quick Playbook
377
-
378
- ```text
379
- 1) /dcp context
380
- 2) classify context: active vs closed
381
- 3) /dcp compress on closed chapters
382
- 4) /dcp sweep stale/noisy closed outputs
383
- 5) if compaction happened: run 5-step restoration
384
- 6) persist key decisions to memory
385
- 7) handoff/resume with focused rehydration
386
- ```
387
-
388
- ## See Also
389
-
390
- - `memory-system`