fix: use agent prompts instead of event hooks for context injection

OpenCode doesn't support injecting context through event hooks. Instead,
the plugin now generates a prompt file that agents can reference via
{file:./prompts/superpowers.txt} in their configuration.
This commit is contained in:
Jesse Vincent
2025-11-22 16:13:05 -08:00
parent c940d84f3d
commit 368674419a
2 changed files with 52 additions and 27 deletions

View File

@@ -33,14 +33,40 @@ mkdir -p .opencode/plugin
ln -sf ~/.config/opencode/superpowers/.opencode/plugin/superpowers.js .opencode/plugin/superpowers.js
```
### 3. Restart OpenCode
### 3. Configure Agent Prompt
Restart OpenCode to load the plugin. On the next session, you should see:
The plugin generates a prompt file at `~/.config/opencode/prompts/superpowers.txt`. Add this to your agent configuration.
**Option A: Extend the Build agent** (recommended)
Edit `~/.config/opencode/opencode.json`:
```json
{
"agent": {
"build": {
"prompt": "{file:./prompts/superpowers.txt}"
}
}
}
```
You have superpowers.
**Option B: Create a custom agent**
Create `~/.config/opencode/agent/superbuild.md`:
```markdown
---
description: Build agent with superpowers support
---
{file:./prompts/superpowers.txt}
```
### 4. Restart OpenCode
Restart OpenCode to load the plugin. The prompt file will be generated automatically.
## Usage
### Finding Skills