summaryrefslogtreecommitdiff
path: root/.opencode/plugins
diff options
context:
space:
mode:
authorDrew Ritter <drew@primeradiant.com>2026-09-17 18:24:02 -0700
committerDrew Ritter <drew@primeradiant.com>2026-09-17 18:24:02 -0700
commit2c4dcd851a851633ee9037954cd3a20769cdf8b9 (patch)
tree54d9f6202528e603c091c16b9931fd24e73b656a /.opencode/plugins
parent96ecdeb0fa60b6321f4493a20a546e0c400158f2 (diff)
fix(opencode): retain bootstrap after native compaction
Diffstat (limited to '.opencode/plugins')
-rw-r--r--.opencode/plugins/superpowers.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.js
index 51f44a3..7305470 100644
--- a/.opencode/plugins/superpowers.js
+++ b/.opencode/plugins/superpowers.js
@@ -334,8 +334,8 @@ async function setup(ctx) {
const bootstrap = getBootstrapContent(V2_MAPPING);
if (!bootstrap || !event.messages || !event.messages.length) return;
const firstUser = event.messages.find(m => m.role === 'user');
- if (!firstUser || !firstUser.content || !firstUser.content.length) return;
- if (firstUser.content.some(p => p.type === 'text' && p.text && p.text.includes('EXTREMELY_IMPORTANT'))) return;
+ if (firstUser && (!firstUser.content || !firstUser.content.length)) return;
+ if (firstUser?.content.some(p => p.type === 'text' && p.text && p.text.includes('EXTREMELY_IMPORTANT'))) return;
// #2160: the context event carries the sessionID directly. Skip the
// controller bootstrap when this prompt belongs to a task subagent
@@ -345,7 +345,13 @@ async function setup(ctx) {
event.sessionID,
)) return;
- firstUser.content.unshift({ type: 'text', text: bootstrap });
+ // Native compaction can leave only an opaque checkpoint. Keep it
+ // intact and append the transient bootstrap as a user message.
+ if (firstUser) {
+ firstUser.content.unshift({ type: 'text', text: bootstrap });
+ } else {
+ event.messages.push({ role: 'user', content: [{ type: 'text', text: bootstrap }] });
+ }
} catch (err) {
// Never let hook callback errors break the request pipeline.
console.error('[superpowers] context hook failed:', err);