opencodekit 0.21.10 → 0.23.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 +1 -1
- package/dist/index.js +4 -25
- package/dist/template/.opencode/.template-manifest.json +115 -188
- package/dist/template/.opencode/AGENTS.md +127 -484
- package/dist/template/.opencode/README.md +2 -2
- package/dist/template/.opencode/agent/build.md +158 -356
- package/dist/template/.opencode/agent/explore.md +0 -1
- package/dist/template/.opencode/agent/plan.md +7 -16
- package/dist/template/.opencode/agent/review.md +0 -1
- package/dist/template/.opencode/agent/scout.md +2 -3
- package/dist/template/.opencode/agent/vision.md +0 -1
- package/dist/template/.opencode/artifacts/.active +1 -0
- package/dist/template/.opencode/artifacts/example/plan.md +12 -0
- package/dist/template/.opencode/artifacts/example/progress.md +4 -0
- package/dist/template/.opencode/artifacts/example/research.md +4 -0
- package/dist/template/.opencode/artifacts/example/spec.md +16 -0
- package/dist/template/.opencode/artifacts/todo.md +5 -0
- package/dist/template/.opencode/artifacts/verify.log +4 -0
- package/dist/template/.opencode/command/clarify.md +46 -0
- package/dist/template/.opencode/command/commit.md +53 -0
- package/dist/template/.opencode/command/create.md +29 -71
- package/dist/template/.opencode/command/design.md +1 -2
- package/dist/template/.opencode/command/explore.md +3 -4
- package/dist/template/.opencode/command/fix.md +55 -0
- package/dist/template/.opencode/command/improve-architecture.md +55 -0
- package/dist/template/.opencode/command/init.md +86 -69
- package/dist/template/.opencode/command/plan.md +30 -60
- package/dist/template/.opencode/command/pr.md +10 -28
- package/dist/template/.opencode/command/refactor.md +65 -0
- package/dist/template/.opencode/command/research.md +7 -29
- package/dist/template/.opencode/command/review-codebase.md +6 -13
- package/dist/template/.opencode/command/ship.md +136 -78
- package/dist/template/.opencode/command/test.md +66 -0
- package/dist/template/.opencode/command/ui-review.md +2 -4
- package/dist/template/.opencode/command/verify.md +15 -23
- package/dist/template/.opencode/dcp.jsonc +96 -85
- package/dist/template/.opencode/memory/README.md +4 -6
- package/dist/template/.opencode/memory/_templates/adr.md +45 -0
- package/dist/template/.opencode/memory/_templates/prd.md +1 -1
- package/dist/template/.opencode/memory/_templates/roadmap.md +1 -1
- package/dist/template/.opencode/memory/_templates/state.md +1 -1
- package/dist/template/.opencode/memory/project/gotchas.md +4 -4
- package/dist/template/.opencode/memory/project/project.md +2 -2
- package/dist/template/.opencode/memory/project/roadmap.md +1 -1
- package/dist/template/.opencode/memory/project/state.md +2 -2
- package/dist/template/.opencode/memory/project/tech-stack.md +2 -2
- package/dist/template/.opencode/memory/session-context.md +1 -1
- package/dist/template/.opencode/opencode.json +14 -152
- package/dist/template/.opencode/plugin/README.md +2 -2
- package/dist/template/.opencode/plugin/guard.ts +62 -0
- package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
- package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
- package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
- package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
- package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
- package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
- package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
- package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
- package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
- package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
- package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
- package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
- package/dist/template/.opencode/plugin/memory.ts +7 -17
- package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
- package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
- package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
- package/dist/template/.opencode/skill/brainstorming/SKILL.md +1 -1
- package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
- package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
- package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
- package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
- package/dist/template/.opencode/skill/context-engineering/SKILL.md +1 -1
- package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
- package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
- package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +26 -45
- package/dist/template/.opencode/skill/gemini-large-context/SKILL.md +4 -4
- package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
- package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
- package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
- package/dist/template/.opencode/skill/opensrc/references/example-workflow.md +1 -1
- package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
- package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
- package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
- package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
- package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
- package/dist/template/.opencode/skill/subagent-driven-development/SKILL.md +1 -1
- package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
- package/dist/template/.opencode/skill/using-git-worktrees/SKILL.md +6 -6
- package/dist/template/.opencode/skill/verification-before-completion/SKILL.md +6 -6
- package/dist/template/.opencode/skill/verification-before-completion/references/VERIFICATION_PROTOCOL.md +5 -5
- package/package.json +76 -76
- package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
- package/dist/template/.opencode/agent/painter.md +0 -83
- package/dist/template/.opencode/command/compound.md +0 -240
- package/dist/template/.opencode/command/curate.md +0 -299
- package/dist/template/.opencode/command/handoff.md +0 -149
- package/dist/template/.opencode/command/health.md +0 -356
- package/dist/template/.opencode/command/init-context.md +0 -297
- package/dist/template/.opencode/command/init-user.md +0 -125
- package/dist/template/.opencode/command/iterate.md +0 -200
- package/dist/template/.opencode/command/lfg.md +0 -173
- package/dist/template/.opencode/command/resume.md +0 -78
- package/dist/template/.opencode/command/status.md +0 -126
- package/dist/template/.opencode/command/ui-slop-check.md +0 -169
- package/dist/template/.opencode/plans/1768385996691-silent-wizard.md +0 -247
- package/dist/template/.opencode/plans/1770006237537-mighty-otter.md +0 -418
- package/dist/template/.opencode/plans/1770006913647-glowing-forest.md +0 -170
- package/dist/template/.opencode/plans/1770013678126-witty-planet.md +0 -278
- package/dist/template/.opencode/plans/1770112267595-shiny-rocket.md +0 -258
- package/dist/template/.opencode/plans/swarm-protocol.md +0 -123
- package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
- package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
- package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
- package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
- package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
- package/dist/template/.opencode/skill/beads/SKILL.md +0 -182
- package/dist/template/.opencode/skill/beads/references/BEST_PRACTICES.md +0 -27
- package/dist/template/.opencode/skill/beads/references/BOUNDARIES.md +0 -219
- package/dist/template/.opencode/skill/beads/references/DEPENDENCIES.md +0 -124
- package/dist/template/.opencode/skill/beads/references/EXAMPLES.md +0 -45
- package/dist/template/.opencode/skill/beads/references/FILE_CLAIMING.md +0 -101
- package/dist/template/.opencode/skill/beads/references/GIT_SYNC.md +0 -25
- package/dist/template/.opencode/skill/beads/references/HIERARCHY.md +0 -71
- package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +0 -40
- package/dist/template/.opencode/skill/beads/references/RESUMABILITY.md +0 -177
- package/dist/template/.opencode/skill/beads/references/SESSION_PROTOCOL.md +0 -61
- package/dist/template/.opencode/skill/beads/references/TASK_CREATION.md +0 -38
- package/dist/template/.opencode/skill/beads/references/TROUBLESHOOTING.md +0 -38
- package/dist/template/.opencode/skill/beads/references/WORKFLOWS.md +0 -226
- package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
- package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -224
- package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
- package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
- package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
- package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
- package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
- package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
- package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
- package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
- package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
- package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
- package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
- package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
- package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
- package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
- package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
- package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
- package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
- package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
- package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
- package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
- package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
- package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
- package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
- package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
- package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
- package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
- package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
- package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
- package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
- package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
- package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
- package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
- package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
- package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
- package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
- package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
- package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
- package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
- package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
- package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
- package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
- package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
- package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
- package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
- package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
- package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
- package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
- package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
- package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
- package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
- package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
- package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
- package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
- package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
- package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
- package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
- package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
- package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
- package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
- package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
- package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
- package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
- package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
- package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
- package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
- package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
- package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
- package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
- package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
- package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
- package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
- /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
- /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: context-condensation
|
|
3
|
-
description: Use when context is approaching budget limits and you need to compress, OR when handing off to another session. Provides the explicit keep/drop rubric for what survives compression — preserve goals, progress, critical files, failing tests; drop exploration noise and resolved threads. Pairs with `/dcp compress` and `/handoff`. Adapted from OpenHands context-condensation, Manus context engineering, HumanLayer backpressure.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Context Condensation
|
|
7
|
-
|
|
8
|
-
> Compression is not deletion — it is **selection of what survives**. The wrong selection makes the agent restart from zero. This skill defines what to keep.
|
|
9
|
-
|
|
10
|
-
## When to Use
|
|
11
|
-
|
|
12
|
-
- Context >100k tokens and growing
|
|
13
|
-
- Phase boundary reached (research done, ready to implement)
|
|
14
|
-
- Handing off to a new session via `/handoff`
|
|
15
|
-
- A subagent returns large output you need to integrate
|
|
16
|
-
- After `/dcp compress` ran but you still feel context drift
|
|
17
|
-
|
|
18
|
-
## Core Principle: 4 Tiers of Survival
|
|
19
|
-
|
|
20
|
-
Every conversation chunk falls into one of four tiers. Compress accordingly.
|
|
21
|
-
|
|
22
|
-
| Tier | Content | Action |
|
|
23
|
-
| ---- | -------------------------------------------------------- | ----------------------- |
|
|
24
|
-
| 1 | Goal, constraints, user-stated requirements | **Preserve verbatim** |
|
|
25
|
-
| 2 | Critical state — failing tests, current bug, open files | **Preserve as summary** |
|
|
26
|
-
| 3 | Decisions made, alternatives rejected, why | **Preserve as 1-liner** |
|
|
27
|
-
| 4 | Exploration noise — failed greps, dead ends, raw outputs | **Drop entirely** |
|
|
28
|
-
|
|
29
|
-
## Keep List (Always)
|
|
30
|
-
|
|
31
|
-
Compress around these — never drop:
|
|
32
|
-
|
|
33
|
-
- **The user's literal request.** Direct quote when short. Paraphrase only when long, and label as paraphrase.
|
|
34
|
-
- **Active failures.** Current error message, failing test name + reason, open bug. Tells the next agent what's broken.
|
|
35
|
-
- **Decisions + rationale.** "Chose JWT over sessions because [reason]." One line each. Future agents inherit the why.
|
|
36
|
-
- **File paths currently being edited.** Exact paths, not "the auth file".
|
|
37
|
-
- **Verification status.** Last typecheck/lint/test result with timestamp.
|
|
38
|
-
- **Open questions for the user.** Questions awaiting human input.
|
|
39
|
-
- **Constraints discovered mid-task.** "User can't add new deps", "DB is read-only in this env".
|
|
40
|
-
|
|
41
|
-
## Drop List (Aggressive)
|
|
42
|
-
|
|
43
|
-
Compress these to a single line or remove entirely:
|
|
44
|
-
|
|
45
|
-
- **Resolved exploration.** Found the file? Drop the 5 greps that led there.
|
|
46
|
-
- **Tool output noise.** Full directory listings, `ls` outputs, package install logs. Keep only the relevant filename.
|
|
47
|
-
- **Verbose reasoning.** Your own multi-paragraph thinking that ended in one decision. Keep the decision.
|
|
48
|
-
- **Acknowledgments.** "Got it", "I'll do that next" — pure social filler.
|
|
49
|
-
- **Failed attempts that taught nothing.** If a wrong approach added no information, drop it. Keep failures that revealed a constraint.
|
|
50
|
-
- **Sub-agent self-reports.** Keep the result + verification, drop the agent's narrative summary (Worker Distrust Protocol — don't trust the prose).
|
|
51
|
-
- **Old plans you've since revised.** Keep only the current plan.
|
|
52
|
-
|
|
53
|
-
## Failure Preservation Rule
|
|
54
|
-
|
|
55
|
-
> **Useful failures stay. Useless failures go.**
|
|
56
|
-
|
|
57
|
-
A failure is **useful** if it:
|
|
58
|
-
|
|
59
|
-
- Revealed a constraint ("can't use `mv` on this filesystem")
|
|
60
|
-
- Eliminated a hypothesis ("the bug is not in the parser")
|
|
61
|
-
- Showed a trap that another agent would re-fall into
|
|
62
|
-
|
|
63
|
-
A failure is **useless** if it:
|
|
64
|
-
|
|
65
|
-
- Was a typo / fat-finger fixed immediately
|
|
66
|
-
- Was a tool-call format error with no semantic content
|
|
67
|
-
- Was an obvious dead end no agent would repeat
|
|
68
|
-
|
|
69
|
-
**Manus rule** (from "Context Engineering for AI Agents: Lessons from Building Manus"): keep useful failures **in-context** as warnings. Don't compress to "encountered errors then succeeded" — that loses the warning.
|
|
70
|
-
|
|
71
|
-
## Condensation Triggers (Beyond Token Count)
|
|
72
|
-
|
|
73
|
-
Token count is one trigger. These are the others:
|
|
74
|
-
|
|
75
|
-
| Trigger | Action |
|
|
76
|
-
| ------------------------------------- | ----------------------------------------------- |
|
|
77
|
-
| Phase boundary (research → implement) | Compress all of research phase to summary |
|
|
78
|
-
| Subagent returns >2k tokens | Compress immediately, keep result + evidence |
|
|
79
|
-
| Same question asked twice in session | Indicates context drift — compress aggressively |
|
|
80
|
-
| Plan revised | Drop old plan completely |
|
|
81
|
-
| Conversation feels "lost" | Compress; restart from goal + current state |
|
|
82
|
-
|
|
83
|
-
## The Handoff Variant
|
|
84
|
-
|
|
85
|
-
When compressing for `/handoff` (different session, different agent will pick up), be **even more selective**:
|
|
86
|
-
|
|
87
|
-
- Preserve everything in Keep List
|
|
88
|
-
- Add a **`## Next Step`** with the literal next action
|
|
89
|
-
- Add a **`## Don't Re-Discover`** with traps already mapped
|
|
90
|
-
- Drop everything else
|
|
91
|
-
|
|
92
|
-
Handoff format:
|
|
93
|
-
|
|
94
|
-
```markdown
|
|
95
|
-
## Goal
|
|
96
|
-
|
|
97
|
-
[user's literal request]
|
|
98
|
-
|
|
99
|
-
## Status
|
|
100
|
-
|
|
101
|
-
- Done: [list of completed items with file:line]
|
|
102
|
-
- In progress: [current task]
|
|
103
|
-
- Blocked: [what's blocking, what was tried]
|
|
104
|
-
|
|
105
|
-
## Critical State
|
|
106
|
-
|
|
107
|
-
- Open files: [paths]
|
|
108
|
-
- Last verification: [command + result + timestamp]
|
|
109
|
-
- Active failures: [error / failing test]
|
|
110
|
-
|
|
111
|
-
## Decisions Made
|
|
112
|
-
|
|
113
|
-
- [one-liner] → [one-line rationale]
|
|
114
|
-
|
|
115
|
-
## Don't Re-Discover
|
|
116
|
-
|
|
117
|
-
- [trap 1]: [why]
|
|
118
|
-
- [trap 2]: [why]
|
|
119
|
-
|
|
120
|
-
## Next Step
|
|
121
|
-
|
|
122
|
-
[literal next action — copy-pastable command or description]
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## Anti-Patterns
|
|
126
|
-
|
|
127
|
-
- **"Let me summarize what we did so far..."** in every response — you're re-summarizing instead of compressing once at boundaries
|
|
128
|
-
- **Dropping the goal during compression** — the worst failure mode; the next agent has no anchor
|
|
129
|
-
- **Keeping all failures** — context fills with noise, real signals get buried
|
|
130
|
-
- **Lossy paraphrase of user request** — when in doubt, quote verbatim
|
|
131
|
-
- **Compressing during active edits** — wait for atomic step to finish
|
|
132
|
-
|
|
133
|
-
## Integration
|
|
134
|
-
|
|
135
|
-
- **Before `/dcp compress`:** Use this rubric to decide what your `summary` field should contain
|
|
136
|
-
- **In `/handoff`:** This skill defines the handoff format
|
|
137
|
-
- **After subagent return:** Apply Drop List to the agent's narrative, keep result + verification only
|
|
138
|
-
- **In long sessions:** Re-read your own context every ~30 messages and apply the rubric
|
|
139
|
-
|
|
140
|
-
## Output
|
|
141
|
-
|
|
142
|
-
When you condense, briefly state what survived and what dropped:
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
Compressed messages 12-34. Kept: goal, 3 decisions, current failure (auth.ts:42 null deref).
|
|
146
|
-
Dropped: 5 file searches, 2 abandoned approaches, dir listings.
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
This makes the compression auditable. The user (or next agent) can challenge what got cut.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: context-initialization
|
|
3
|
-
description: Initialize project context files from templates. Creates on-demand planning files (roadmap.md, state.md) and updates auto-injected project.md.
|
|
4
|
-
version: 2.0.0
|
|
5
|
-
tags: [context, workflow]
|
|
6
|
-
dependencies: []
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Context Initialization
|
|
10
|
-
|
|
11
|
-
## When to Use
|
|
12
|
-
|
|
13
|
-
- When initializing project context files (project.md, roadmap.md, state.md) from templates.
|
|
14
|
-
- project.md is auto-injected into every prompt; roadmap.md and state.md are on-demand.
|
|
15
|
-
|
|
16
|
-
## When NOT to Use
|
|
17
|
-
|
|
18
|
-
- When context files already exist and only need minor manual edits.
|
|
19
|
-
|
|
20
|
-
## Process
|
|
21
|
-
|
|
22
|
-
### 1. Verify Templates
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
srcwalk files "*.md" --scope .opencode/memory/_templates
|
|
26
|
-
# Required templates: project.md, roadmap.md, state.md
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Stop if missing.
|
|
30
|
-
|
|
31
|
-
### 2. Gather Input
|
|
32
|
-
|
|
33
|
-
Ask 5 questions:
|
|
34
|
-
|
|
35
|
-
1. Project vision
|
|
36
|
-
2. Success criteria
|
|
37
|
-
3. Target users
|
|
38
|
-
4. Phases
|
|
39
|
-
5. Current phase
|
|
40
|
-
|
|
41
|
-
Skip if `--skip-questions` flag set.
|
|
42
|
-
|
|
43
|
-
### 3. Create Files
|
|
44
|
-
|
|
45
|
-
**project.md** (auto-injected — keep concise)
|
|
46
|
-
|
|
47
|
-
- Read template via `Read({ filePath: ".opencode/memory/_templates/project.md" })`
|
|
48
|
-
- Fill with answers
|
|
49
|
-
- Write via `memory-update({ file: "project/project", content: ..., mode: "replace" })`
|
|
50
|
-
|
|
51
|
-
**roadmap.md** (on-demand — access via `memory-read({ file: "project/roadmap" })`)
|
|
52
|
-
|
|
53
|
-
- Read template
|
|
54
|
-
- Parse phases into table
|
|
55
|
-
- Write via `memory-update({ file: "project/roadmap", content: ..., mode: "replace" })`
|
|
56
|
-
|
|
57
|
-
**state.md** (on-demand — access via `memory-read({ file: "project/state" })`)
|
|
58
|
-
|
|
59
|
-
- Read template
|
|
60
|
-
- Set initial state
|
|
61
|
-
- Write via `memory-update({ file: "project/state", content: ..., mode: "replace" })`
|
|
62
|
-
|
|
63
|
-
### 4. Verify
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
srcwalk files "*.md" --scope .opencode/memory/project
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Report created files with their injection status (auto-injected vs on-demand).
|
|
@@ -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`
|