You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
chore: add <protect> tags to slash command files for DCP context preservation #221
OpenCode's DCP (Dynamic Context Pruning) plugin compresses slash command content during long sessions. Unlike skills (which are delivered via the skill tool and are protected by DCP's default protectedTools), slash commands are injected as user messages in the conversation — making them fully eligible for compression.
This was confirmed by investigating the OpenCode source code:
Skills: tool/skill.ts — delivered as tool_use/tool_result pairs, protected by DCP's default protectedTools list
Commands: session/prompt.ts:1356-1481 → createUserMessage() — delivered as role: "user" messages, no DCP protection
For long-running pipeline commands, DCP can compress away the command instructions mid-execution, causing the agent to lose its operating instructions.
Solution
Add <protect>...</protect> tags around critical sections of each slash command file. When DCP's compress.protectTags config is enabled, content wrapped in these tags is preserved verbatim during compression rather than being summarized away.
What to wrap
Not every line needs protection. Focus <protect> tags on:
Guardrails and safety rules — sections that prevent destructive actions
Execution checklists and step definitions — the structural backbone
Exit conditions and resume instructions — critical for pipeline resumability
Session-resume guards — instructions about not trusting compressed context
Verbose explanations, examples, and formatting guidance can remain unprotected — DCP's compression summaries handle those adequately.
Prerequisite
Users must enable protectTags in their DCP config (~/.config/opencode/dcp.jsonc):
{
"compress": {
"protectTags": true
}
}
Source command files in this repo
The source templates live in internal/scaffold/assets/commands/ and are scaffolded into projects via gaze init:
gaze-fix.md is the highest priority — it runs a multi-step fix pipeline that can span many turns. gaze.md and speckit.testreview.md are shorter but still benefit from protection on their guardrails sections.
Activity
docs: add spec artifacts for dcp-protect-tags change
chore: add protect tags to slash command files for DCP context preser…
docs: add spec artifacts for dcp-protect-tags change
chore: add protect tags to slash command files for DCP context preser…
docs: add spec artifacts for dcp-protect-tags change
chore: add protect tags to slash command files for DCP context preser…