Summary
The OpenCode plugin (.opencode/plugins/spec-superflow.js) has no dedicated handling for OpenCode's context compaction. After compaction, recovery of the <EXTREMELY_IMPORTANT> bootstrap only happens as an accidental side effect of the experimental.chat.messages.transform dedup check — not by design.
Current behavior
The plugin registers two hooks:
config — registers the skills directory.
experimental.chat.messages.transform — prepends the bootstrap (GEMINI.md wrapped in <EXTREMELY_IMPORTANT>) to the first user message, guarded by a dedup check:
if (firstUser.parts.some(p => p.type === 'text' && p.text.includes('EXTREMELY_IMPORTANT'))) return;
After OpenCode compacts the session, the message history is replaced by a summary. The first "user" message (the compaction summary) no longer contains EXTREMELY_IMPORTANT, so the dedup check fails and the bootstrap is silently re-injected on the next message send.
Problems
- Timing: re-injection happens on the next outgoing message, not at compaction time — the first post-compaction model turn runs without the bootstrap context.
- Fragility: it depends on the compaction summary never containing the literal string
EXTREMELY_IMPORTANT. If a future OpenCode version includes prior context in the summary, re-injection silently stops.
- Undocumented: a repo-wide search for
compacting / compaction finds nothing — this behavior is an emergent side effect, not a tested contract.
Suggestion
Add an explicit experimental.session.compacting hook that appends the bootstrap to output.context, e.g.:
'experimental.session.compacting': async (_input, output) => {
const bootstrap = getBootstrapContent();
if (!bootstrap) return;
output.context.push(bootstrap);
},
This guarantees the workflow bootstrap survives compaction deterministically, at the moment compaction happens.
Environment
- spec-superflow version: current
main (v0.10.0)
- Platform: OpenCode
Summary
The OpenCode plugin (
.opencode/plugins/spec-superflow.js) has no dedicated handling for OpenCode's context compaction. After compaction, recovery of the<EXTREMELY_IMPORTANT>bootstrap only happens as an accidental side effect of theexperimental.chat.messages.transformdedup check — not by design.Current behavior
The plugin registers two hooks:
config— registers the skills directory.experimental.chat.messages.transform— prepends the bootstrap (GEMINI.md wrapped in<EXTREMELY_IMPORTANT>) to the first user message, guarded by a dedup check:After OpenCode compacts the session, the message history is replaced by a summary. The first "user" message (the compaction summary) no longer contains
EXTREMELY_IMPORTANT, so the dedup check fails and the bootstrap is silently re-injected on the next message send.Problems
EXTREMELY_IMPORTANT. If a future OpenCode version includes prior context in the summary, re-injection silently stops.compacting/compactionfinds nothing — this behavior is an emergent side effect, not a tested contract.Suggestion
Add an explicit
experimental.session.compactinghook that appends the bootstrap tooutput.context, e.g.:This guarantees the workflow bootstrap survives compaction deterministically, at the moment compaction happens.
Environment
main(v0.10.0)