Skip to content

An agentic skills framework & software development methodology that works.

feat: add chat.message hook to inject superpowers context automatically

Jesse Vincent5f5b789e3ee9
diff --git a/.opencode/plugin/superpowers.js b/.opencode/plugin/superpowers.js
index a3ca5c751..24af57bf7 100644
--- a/.opencode/plugin/superpowers.js
+++ b/.opencode/plugin/superpowers.js
@@ -77,6 +77,37 @@ ${content}`;
return output;
}
})
+ },
+ "chat.message": async (input, output) => {
+ // Only inject on first message of session (or every message if needed)
+ if (!output.message.system || output.message.system.length === 0) {
+ const usingSuperpowersPath = skillsCore.resolveSkillPath('using-superpowers', superpowersSkillsDir, personalSkillsDir);
+
+ if (usingSuperpowersPath) {
+ const fullContent = fs.readFileSync(usingSuperpowersPath.skillFile, 'utf8');
+ const usingSuperpowersContent = skillsCore.stripFrontmatter(fullContent);
+
+ const toolMapping = `**Tool Mapping for OpenCode:**
+When skills reference tools you don't have, substitute OpenCode equivalents:
+- \`TodoWrite\` → \`update_plan\`
+- \`Task\` tool with subagents → Use OpenCode's subagent system (@mention)
+- \`Skill\` tool → \`use_skill\` custom tool
+- \`Read\`, \`Write\`, \`Edit\`, \`Bash\` → Your native tools
+
+**Skills naming:**
+- Superpowers skills: \`superpowers:skill-name\`
+- Personal skills: \`skill-name\`
+- Personal skills override superpowers when names match`;
+
+ output.message.system = `<EXTREMELY_IMPORTANT>
+You have superpowers.
+
+${usingSuperpowersContent}
+
+${toolMapping}
+</EXTREMELY_IMPORTANT>`;
+ }
+ }
}
};
};