From 2ee628174705a5db2dcd1bf2eeafe295a8fb48b7 Mon Sep 17 00:00:00 2001 From: GoldJohnKing Date: Fri, 7 Aug 2026 20:16:01 +0800 Subject: feat(opencode): add V2 (opencode2) plugin compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dual V1/V2 support to the OpenCode plugin. The same source file now works on both OpenCode V1 (opencode) and V2 (opencode2) without version detection at runtime. V2 changes: - Add default export { id, server, setup } for V2 PluginSupervisor - setup() registers skills via ctx.skill.transform() (V2 native API) - setup() injects bootstrap via ctx.session.hook('context') (V2 equivalent of V1's experimental.chat.messages.transform) - config hook guards against V2 array-format skills to avoid conflicts Both APIs confirmed active at runtime via diagnostics in the V2 beta. No external dependencies added — pure JavaScript throughout. Docs updated with V2 install instructions, OPENCODE_CONFIG_DIR side-by-side setup, and accurate How It Works section for both versions. --- docs/README.opencode.md | 106 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 95 insertions(+), 11 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 11da854..ab5810f 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -4,6 +4,11 @@ Complete guide for using Superpowers with [OpenCode.ai](https://opencode.ai). ## Installation +Installation differs between OpenCode V1 (`opencode`) and V2 (`opencode2`). +Install Superpowers separately for each version if you use both. + +### OpenCode V1 (`opencode`) + Add superpowers to the `plugin` array in your `opencode.json` (global or project-level): ```json @@ -17,10 +22,62 @@ registers all skills. Verify by asking: "Tell me about your superpowers" -OpenCode uses its own plugin install. If you also use Claude Code, Codex, or -another harness, install Superpowers separately for each one. +### OpenCode V2 (`opencode2`) + +V2 does not support `git+https://` plugin installation. Use a local clone with +a path reference instead. -### Migrating from the old symlink-based install +1. Clone the repository: + +```bash +git clone https://github.com/obra/superpowers.git ~/superpowers +``` + +2. Add the plugin using the `plugin` field (singular) with an absolute path: + +```jsonc +{ + "$schema": "https://opencode.ai/config.json", + "plugin": [ + "/home/your-username/superpowers/.opencode/plugins/superpowers.js" + ] +} +``` + +> **Note:** V2 does not expand `~` in local plugin paths. Use an absolute path +> or a relative path (`./` or `../`) resolved from the config file directory. + +3. Restart and verify: + +```bash +opencode2 service restart +``` + +Ask: "Tell me about your superpowers" + +### Running V1 and V2 Side by Side + +V1 (`opencode`) and V2 (`opencode2`) share the same default config directory +(`~/.config/opencode/`). Since V2 normalizes V1's `plugin` field into its own +loading pipeline, putting a `git+https://` spec (which V2 cannot install) in +the shared config causes V2 to silently fail loading it. + +To use different plugin sources for each version, point V2 at a separate +config directory via the `OPENCODE_CONFIG_DIR` environment variable: + +```bash +# In ~/.bashrc (or equivalent shell config) +export OPENCODE_CONFIG_DIR="$HOME/.config/opencode2" +``` + +Then maintain two config files: + +- `~/.config/opencode/opencode.json` — V1 config, using `git+https://` sources +- `~/.config/opencode2/opencode.json` — V2 config, using local path sources + +Both versions can now run independently without interfering with each other. + +### Migrating from the old symlink-based install (V1) If you previously installed superpowers using `git clone` and symlinks, remove the old setup: @@ -82,6 +139,8 @@ Create project-specific skills in `.opencode/skills/` within your project. ## Updating +### V1 (`opencode`) + OpenCode installs Superpowers through a git-backed package spec. Some OpenCode and Bun versions pin that resolved git dependency in a lockfile or cache, so a restart may not pick up the newest Superpowers commit. If updates do not appear, @@ -95,12 +154,23 @@ To pin a specific version, use a branch or tag: } ``` +### V2 (`opencode2`) + +```bash +cd ~/superpowers && git pull +opencode2 service restart +``` + ## How It Works The plugin does two things: -1. **Injects bootstrap context** via the `experimental.chat.messages.transform` hook, adding superpowers awareness to every conversation. -2. **Registers the skills directory** via the `config` hook, so OpenCode discovers all superpowers skills without symlinks or manual config. +1. **Registers the skills directory** so OpenCode discovers all superpowers skills without symlinks or manual config. + - **V1:** via the `config` hook, injecting into `config.skills.paths` + - **V2:** via the `setup()` function using `ctx.skill.transform()` (V2 native API, confirmed active at runtime) +2. **Injects bootstrap context** into the first user message of each conversation, adding superpowers awareness. + - **V1:** via `experimental.chat.messages.transform` hook + - **V2:** via `ctx.session.hook("context")` — the V2 equivalent (confirmed active at runtime) ### Tool Mapping @@ -121,9 +191,22 @@ Skills speak in actions rather than naming any one runtime's tools. On OpenCode ### Plugin not loading -1. Check OpenCode logs: `opencode run --print-logs "hello" 2>&1 | grep -i superpowers` -2. Verify the plugin line in your `opencode.json` is correct -3. Make sure you're running a recent version of OpenCode +**V1:** Check OpenCode logs: + +``` +opencode run --print-logs "hello" 2>&1 | grep -i superpowers +``` + +**V2:** Check the server log: + +``` +opencode2 service status +``` + +Then inspect `~/.local/share/opencode/log/opencode.log`, filtering for `role=server`. + +Also verify the plugin path in your `opencode.json` is correct and that you're +running a recent version of OpenCode. ### Windows install issues @@ -153,11 +236,12 @@ Then use the installed package path in `opencode.json`: ### Bootstrap not appearing -1. Check OpenCode version supports `experimental.chat.messages.transform` hook -2. Restart OpenCode after config changes +- **V1:** Check OpenCode version supports `experimental.chat.messages.transform` hook. Restart OpenCode after config changes. +- **V2:** The plugin uses `ctx.session.hook("context")` for bootstrap injection. Verify the plugin loaded via `opencode2 api get /api/plugin`. Restart with `opencode2 service restart` after config changes. ## Getting Help - Report issues: https://github.com/obra/superpowers/issues - Main documentation: https://github.com/obra/superpowers -- OpenCode docs: https://opencode.ai/docs/ +- OpenCode V2 docs: https://opencode.ai/v2/docs/ +- OpenCode V1 docs: https://opencode.ai/docs/ -- cgit From aeba3ee2fd6dfc750827dfc3d3624ff505f94b59 Mon Sep 17 00:00:00 2001 From: GoldJohnKing Date: Tue, 1 Sep 2026 15:12:38 +0800 Subject: docs(opencode): remove and merge identical v1/v2 install and update guidance --- docs/README.opencode.md | 71 ++----------------------------------------------- 1 file changed, 2 insertions(+), 69 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index ab5810f..316f3ea 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -4,11 +4,6 @@ Complete guide for using Superpowers with [OpenCode.ai](https://opencode.ai). ## Installation -Installation differs between OpenCode V1 (`opencode`) and V2 (`opencode2`). -Install Superpowers separately for each version if you use both. - -### OpenCode V1 (`opencode`) - Add superpowers to the `plugin` array in your `opencode.json` (global or project-level): ```json @@ -17,66 +12,11 @@ Add superpowers to the `plugin` array in your `opencode.json` (global or project } ``` -Restart OpenCode. The plugin installs through OpenCode's plugin manager and -registers all skills. +Restart OpenCode (`opencode2 service restart` on V2). The plugin installs +through OpenCode's plugin manager and registers all skills. Verify by asking: "Tell me about your superpowers" -### OpenCode V2 (`opencode2`) - -V2 does not support `git+https://` plugin installation. Use a local clone with -a path reference instead. - -1. Clone the repository: - -```bash -git clone https://github.com/obra/superpowers.git ~/superpowers -``` - -2. Add the plugin using the `plugin` field (singular) with an absolute path: - -```jsonc -{ - "$schema": "https://opencode.ai/config.json", - "plugin": [ - "/home/your-username/superpowers/.opencode/plugins/superpowers.js" - ] -} -``` - -> **Note:** V2 does not expand `~` in local plugin paths. Use an absolute path -> or a relative path (`./` or `../`) resolved from the config file directory. - -3. Restart and verify: - -```bash -opencode2 service restart -``` - -Ask: "Tell me about your superpowers" - -### Running V1 and V2 Side by Side - -V1 (`opencode`) and V2 (`opencode2`) share the same default config directory -(`~/.config/opencode/`). Since V2 normalizes V1's `plugin` field into its own -loading pipeline, putting a `git+https://` spec (which V2 cannot install) in -the shared config causes V2 to silently fail loading it. - -To use different plugin sources for each version, point V2 at a separate -config directory via the `OPENCODE_CONFIG_DIR` environment variable: - -```bash -# In ~/.bashrc (or equivalent shell config) -export OPENCODE_CONFIG_DIR="$HOME/.config/opencode2" -``` - -Then maintain two config files: - -- `~/.config/opencode/opencode.json` — V1 config, using `git+https://` sources -- `~/.config/opencode2/opencode.json` — V2 config, using local path sources - -Both versions can now run independently without interfering with each other. - ### Migrating from the old symlink-based install (V1) If you previously installed superpowers using `git clone` and symlinks, remove the old setup: @@ -154,13 +94,6 @@ To pin a specific version, use a branch or tag: } ``` -### V2 (`opencode2`) - -```bash -cd ~/superpowers && git pull -opencode2 service restart -``` - ## How It Works The plugin does two things: -- cgit From ca380ba48876148518a393b0e87c3e2a25fd3bcf Mon Sep 17 00:00:00 2001 From: GoldJohnKing Date: Thu, 10 Sep 2026 09:00:50 +0800 Subject: fix(opencode): differentiate tool mapping by host flavor and harden child detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current opencode2 builds renamed the model-facing tools (bash→shell, task→subagent with `agent` instead of `subagent_type`, apply_patch→ patch/patchText) and removed todowrite entirely, so the single v1 mapping injected on v2 hosts taught the model stale tool names. - export V1_MAPPING/V2_MAPPING and inject the flavor-correct one on each path (v1 messages.transform → V1; v2 ctx.session.hook("context") → V2, incl. no-todo-tool guidance and sessionID continuation) - child-session detection now keys on parentID presence (primary signal on both flavors) with dual-shape unwrapping preserved; v1 #2160 behavior unchanged - mirror surfaces updated: INSTALL.md dual mapping tables, README.opencode.md host-flavor notes, test-bootstrap-caching.mjs asserts both mappings + drives the v2 context hook end-to-end - skills: add OpenCode to executing-plans' subagent-capable list, accurate OpenCode worktree status (git fallback; TUI dialogs are user-side only), generalized live-subagent resume guidance --- docs/README.opencode.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 316f3ea..fd1a292 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -96,18 +96,20 @@ To pin a specific version, use a branch or tag: ## How It Works -The plugin does two things: +The plugin does two things, using host-flavor-specific APIs: 1. **Registers the skills directory** so OpenCode discovers all superpowers skills without symlinks or manual config. - - **V1:** via the `config` hook, injecting into `config.skills.paths` - - **V2:** via the `setup()` function using `ctx.skill.transform()` (V2 native API, confirmed active at runtime) -2. **Injects bootstrap context** into the first user message of each conversation, adding superpowers awareness. - - **V1:** via `experimental.chat.messages.transform` hook - - **V2:** via `ctx.session.hook("context")` — the V2 equivalent (confirmed active at runtime) + - **V1:** via the `config` hook, injecting into `config.skills.paths` + - **V2:** via the `setup()` function using `ctx.skill.transform()` (V2 native API, confirmed active at runtime) +2. **Injects bootstrap context** into the first user message of each conversation, adding superpowers awareness. The bootstrap includes a tool mapping that is also flavor-specific: V1 sessions get the V1 tool names below, V2 sessions get the V2 names. + - **V1:** via `experimental.chat.messages.transform` hook + - **V2:** via `ctx.session.hook("context")` — the V2 equivalent (confirmed active at runtime) ### Tool Mapping -Skills speak in actions rather than naming any one runtime's tools. On OpenCode these resolve to: +Skills speak in actions rather than naming any one runtime's tools. The bootstrap maps them to the tools your OpenCode flavor actually exposes. + +**V1 (`opencode` 1.x):** - "Create a todo" / "mark complete in todo list" → `todowrite` - `Subagent (general-purpose):` template → OpenCode's `task` tool with `subagent_type: "general"` (or `"explore"` for codebase exploration) @@ -118,7 +120,20 @@ Skills speak in actions rather than naming any one runtime's tools. On OpenCode - "Search file contents" / "find files by name" → `grep`, `glob` - "Fetch a URL" → `webfetch` -(Verified against the installed OpenCode CLI's tool inventory.) +**V2 (`opencode2` beta):** + +- "Create a todo" → V2 has no todo tool of any kind; the mapping tells the model to track the plan in a markdown file (or the harness's plan facility) instead +- `Subagent (general-purpose):` template → OpenCode's `subagent` tool with `agent: "general"` (or `"explore"`); pass `sessionID` to continue a previous subagent +- "Invoke a skill" → OpenCode's native `skill` tool +- "Read a file" → `read` +- "Create a file" / "edit a file" / "delete a file" → `patch` with `patchText` (same patch format as V1's `apply_patch`) +- "Run a shell command" → `shell` (`command`, `workdir`, `timeout`, `background`) +- "Search file contents" / "find files by name" → `grep`, `glob` +- "Fetch a URL" → `webfetch` + +In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_type` to `agent`, and continuation happens by re-invoking with `sessionID`), `apply_patch` → `patch`, and `bash` → `shell`, and it dropped the todo tool entirely; `read`, `grep`, `glob`, `webfetch`, and `skill` keep their V1 names. + +(V1 list verified against the installed OpenCode 1.18.x CLI's tool inventory; V2 list verified against the V2 source at `dbd9b18`.) ## Troubleshooting -- cgit From 4996eb00bdcfad114c09610cc8b5737eb1a9f0e6 Mon Sep 17 00:00:00 2001 From: GoldJohnKing Date: Mon, 14 Sep 2026 17:47:03 +0800 Subject: fix(opencode): align V2 tool mapping with the 2.0.3 catalog; harden plugin internals - V2 bootstrap mapping now teaches write/edit/websearch (verified against a live v2.0.3 /api/plugin tool catalog) instead of routing all file mutation through patch - frontmatter parser tolerates CRLF and YAML block scalars/continuation lines - child-session cache is bounded (512 entries, oldest-quarter eviction) - INSTALL.md and docs/README.opencode.md tool tables synced to the 2.0.3 catalog; unit-test needle list extended to cover the new tools --- docs/README.opencode.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index fd1a292..9f99d31 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -126,14 +126,17 @@ Skills speak in actions rather than naming any one runtime's tools. The bootstra - `Subagent (general-purpose):` template → OpenCode's `subagent` tool with `agent: "general"` (or `"explore"`); pass `sessionID` to continue a previous subagent - "Invoke a skill" → OpenCode's native `skill` tool - "Read a file" → `read` -- "Create a file" / "edit a file" / "delete a file" → `patch` with `patchText` (same patch format as V1's `apply_patch`) +- "Create / overwrite a file" → `write` +- "Edit a file" → `edit` for targeted changes, or `patch` with `patchText` (same patch format as V1's `apply_patch`) when a skill speaks in patch format +- "Delete a file" → `patch` (via `patchText`) or a `shell` `rm` - "Run a shell command" → `shell` (`command`, `workdir`, `timeout`, `background`) - "Search file contents" / "find files by name" → `grep`, `glob` - "Fetch a URL" → `webfetch` +- "Search the web" → `websearch` -In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_type` to `agent`, and continuation happens by re-invoking with `sessionID`), `apply_patch` → `patch`, and `bash` → `shell`, and it dropped the todo tool entirely; `read`, `grep`, `glob`, `webfetch`, and `skill` keep their V1 names. +In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_type` to `agent`, and continuation happens by re-invoking with `sessionID`), `apply_patch` → `patch`, and `bash` → `shell`, and it dropped the todo tool entirely; `read`, `write`, `edit`, `grep`, `glob`, `webfetch`, `websearch`, and `skill` keep their V1 names (`write`/`edit`/`websearch` replace V1's `apply_patch`-only path, `apply_patch`-only mutation habits, and V1's lack of a search tool respectively). -(V1 list verified against the installed OpenCode 1.18.x CLI's tool inventory; V2 list verified against the V2 source at `dbd9b18`.) +(V1 list verified against the installed OpenCode 1.18.x CLI's tool inventory; V2 list verified against the 2.0.3 tool catalog served by a live v2.0.3 service via `/api/plugin`.) ## Troubleshooting -- cgit From 1eae439437a3fbcb892529a4a777bded256d2e2b Mon Sep 17 00:00:00 2001 From: Drew Ritter Date: Thu, 17 Sep 2026 18:27:50 -0700 Subject: docs(opencode): describe supported V2 setup and bootstrap behavior --- docs/README.opencode.md | 72 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 19 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 9f99d31..16da8b7 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -4,7 +4,11 @@ Complete guide for using Superpowers with [OpenCode.ai](https://opencode.ai). ## Installation -Add superpowers to the `plugin` array in your `opencode.json` (global or project-level): +OpenCode V2 requires version 2.0.4 or later. + +### OpenCode V1 + +Use the existing V1 plugin configuration: ```json { @@ -12,8 +16,23 @@ Add superpowers to the `plugin` array in your `opencode.json` (global or project } ``` -Restart OpenCode (`opencode2 service restart` on V2). The plugin installs -through OpenCode's plugin manager and registers all skills. +### OpenCode V2 (2.0.4 or later) + +Use the V2 plugin configuration: + +```json +{ + "plugins": ["superpowers@git+https://github.com/obra/superpowers.git"] +} +``` + +For a local V2 installation, configure the repository directory containing +`index.js`. OpenCode 2.0.4 and 2.0.7 reject a configured direct JavaScript-file +path. Discovered plugin symlinks remain supported. + +Restart OpenCode. V2 uses the `opencode` command; `opencode2` may be available +as an alias. The plugin installs through OpenCode's plugin manager and +registers all skills. Verify by asking: "Tell me about your superpowers" @@ -86,13 +105,10 @@ and Bun versions pin that resolved git dependency in a lockfile or cache, so a restart may not pick up the newest Superpowers commit. If updates do not appear, clear OpenCode's package cache or reinstall the plugin. -To pin a specific version, use a branch or tag: +### V2 (`opencode` 2.0.4 or later) -```json -{ - "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v5.0.3"] -} -``` +For V2, a pin must reference a release or immutable commit containing this +integration. ## How It Works @@ -101,10 +117,19 @@ The plugin does two things, using host-flavor-specific APIs: 1. **Registers the skills directory** so OpenCode discovers all superpowers skills without symlinks or manual config. - **V1:** via the `config` hook, injecting into `config.skills.paths` - **V2:** via the `setup()` function using `ctx.skill.transform()` (V2 native API, confirmed active at runtime) -2. **Injects bootstrap context** into the first user message of each conversation, adding superpowers awareness. The bootstrap includes a tool mapping that is also flavor-specific: V1 sessions get the V1 tool names below, V2 sessions get the V2 names. +2. **Injects bootstrap context** with a flavor-specific tool mapping: V1 sessions get the V1 tool names below, and V2 sessions get the V2 names. - **V1:** via `experimental.chat.messages.transform` hook - **V2:** via `ctx.session.hook("context")` — the V2 equivalent (confirmed active at runtime) +Controller sessions receive the using-superpowers bootstrap in transient model +context. Delegated child sessions keep access to native skills but do not receive +the controller bootstrap. A manual fork without a parent session keeps controller +behavior. After V2 native compaction removes all user messages, the plugin appends +a transient bootstrap message after the checkpoint; saved history is unchanged. + +If session lookup fails, the plugin keeps bootstrap for that request and retries +on the next request. Failed lookups are not cached as controller decisions. + ### Tool Mapping Skills speak in actions rather than naming any one runtime's tools. The bootstrap maps them to the tools your OpenCode flavor actually exposes. @@ -120,23 +145,21 @@ Skills speak in actions rather than naming any one runtime's tools. The bootstra - "Search file contents" / "find files by name" → `grep`, `glob` - "Fetch a URL" → `webfetch` -**V2 (`opencode2` beta):** +**V2 (`opencode` 2.0.4 or later; `opencode2` may be available as an alias):** - "Create a todo" → V2 has no todo tool of any kind; the mapping tells the model to track the plan in a markdown file (or the harness's plan facility) instead - `Subagent (general-purpose):` template → OpenCode's `subagent` tool with `agent: "general"` (or `"explore"`); pass `sessionID` to continue a previous subagent - "Invoke a skill" → OpenCode's native `skill` tool - "Read a file" → `read` -- "Create / overwrite a file" → `write` -- "Edit a file" → `edit` for targeted changes, or `patch` with `patchText` (same patch format as V1's `apply_patch`) when a skill speaks in patch format -- "Delete a file" → `patch` (via `patchText`) or a `shell` `rm` +- "Create, edit, or delete files" → use `patch` with `patchText` when available; otherwise use `write` to create or overwrite files, `edit` for targeted changes, and `shell` for deletion - "Run a shell command" → `shell` (`command`, `workdir`, `timeout`, `background`) - "Search file contents" / "find files by name" → `grep`, `glob` - "Fetch a URL" → `webfetch` - "Search the web" → `websearch` -In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_type` to `agent`, and continuation happens by re-invoking with `sessionID`), `apply_patch` → `patch`, and `bash` → `shell`, and it dropped the todo tool entirely; `read`, `write`, `edit`, `grep`, `glob`, `webfetch`, `websearch`, and `skill` keep their V1 names (`write`/`edit`/`websearch` replace V1's `apply_patch`-only path, `apply_patch`-only mutation habits, and V1's lack of a search tool respectively). +In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_type` to `agent`, and continuation happens by re-invoking with `sessionID`), `apply_patch` → `patch`, and `bash` → `shell`, and it dropped the todo tool entirely. The available mutation tools depend on the selected model: `patch` is available for selected GPT model IDs, while other models use `write` and `edit`. -(V1 list verified against the installed OpenCode 1.18.x CLI's tool inventory; V2 list verified against the 2.0.3 tool catalog served by a live v2.0.3 service via `/api/plugin`.) +(V1 list verified against the installed OpenCode 1.18.x CLI's tool inventory; V2 list verified against the OpenCode 2.0.4 and 2.0.7 host contracts.) ## Troubleshooting @@ -151,7 +174,7 @@ opencode run --print-logs "hello" 2>&1 | grep -i superpowers **V2:** Check the server log: ``` -opencode2 service status +opencode service status ``` Then inspect `~/.local/share/opencode/log/opencode.log`, filtering for `role=server`. @@ -171,7 +194,10 @@ package: npm install superpowers@git+https://github.com/obra/superpowers.git --prefix "$HOME\.config\opencode" ``` -Then use the installed package path in `opencode.json`: +Then use the installed package path in `opencode.json` for your OpenCode +version: + +**V1:** ```json { @@ -179,6 +205,14 @@ Then use the installed package path in `opencode.json`: } ``` +**V2 (2.0.4 or later):** + +```json +{ + "plugins": ["~/.config/opencode/node_modules/superpowers"] +} +``` + ### Skills not found 1. Use OpenCode's `skill` tool to list available skills @@ -188,7 +222,7 @@ Then use the installed package path in `opencode.json`: ### Bootstrap not appearing - **V1:** Check OpenCode version supports `experimental.chat.messages.transform` hook. Restart OpenCode after config changes. -- **V2:** The plugin uses `ctx.session.hook("context")` for bootstrap injection. Verify the plugin loaded via `opencode2 api get /api/plugin`. Restart with `opencode2 service restart` after config changes. +- **V2:** The plugin uses `ctx.session.hook("context")` for bootstrap injection. Verify the plugin loaded via `opencode api get /api/plugin`. Restart with `opencode service restart` after config changes. The `opencode2` command may be available as an alias. ## Getting Help -- cgit From 1e0ea8fcf8b62c6a44b5b97eb183dbd98e5f2f1b Mon Sep 17 00:00:00 2001 From: Drew Ritter Date: Thu, 17 Sep 2026 18:48:11 -0700 Subject: docs: clarify OpenCode V1 and V2 skill behavior --- docs/README.opencode.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index 16da8b7..d4a7c8c 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -94,7 +94,10 @@ description: Use when [condition] - [what it does] Create project-specific skills in `.opencode/skills/` within your project. -**Skill Priority:** Project skills > Personal skills > Superpowers skills +**V2 Skill Priority:** Project skills > Personal skills > Superpowers skills. On +tested V1 1.18.31, bundled Superpowers skills take precedence when a personal +or project skill has the same name; use distinct names for personal and project +skills. This behavior is unchanged by the migration. ## Updating -- cgit From 034fae28cda8a246d80491919cc79398cb5540b8 Mon Sep 17 00:00:00 2001 From: Drew Ritter Date: Thu, 17 Sep 2026 20:52:40 -0700 Subject: docs(opencode): fix pin example, local-path examples, and V2 log troubleshooting Restore the version-pin example for both config keys and state the V2 constraint (the pinned ref must include OpenCode V2 support). Replace the `~/...` local-package examples with absolute paths: OpenCode does not expand `~`, and a tilde entry is installed as a package spec rather than loaded as a directory. Point V2 troubleshooting at `opencode run --standalone --print-logs`, since plugin logs are server-role and hidden without `--standalone`. Describe where the bootstrap lands when native compaction retains user messages under the default keep budget. Co-Authored-By: Claude Fable 5.1 --- docs/README.opencode.md | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'docs/README.opencode.md') diff --git a/docs/README.opencode.md b/docs/README.opencode.md index d4a7c8c..63073a3 100644 --- a/docs/README.opencode.md +++ b/docs/README.opencode.md @@ -101,17 +101,22 @@ skills. This behavior is unchanged by the migration. ## Updating -### V1 (`opencode`) - OpenCode installs Superpowers through a git-backed package spec. Some OpenCode and Bun versions pin that resolved git dependency in a lockfile or cache, so a restart may not pick up the newest Superpowers commit. If updates do not appear, clear OpenCode's package cache or reinstall the plugin. -### V2 (`opencode` 2.0.4 or later) +To pin a specific version, add a tag or commit to the spec (same form for the +V1 `plugin` key and the V2 `plugins` key): + +```json +{ + "plugin": ["superpowers@git+https://github.com/obra/superpowers.git#v6.3.0"] +} +``` -For V2, a pin must reference a release or immutable commit containing this -integration. +On V2, pin a tag or commit that includes OpenCode V2 support; `v6.3.0` and +earlier releases load only on V1. ## How It Works @@ -127,8 +132,11 @@ The plugin does two things, using host-flavor-specific APIs: Controller sessions receive the using-superpowers bootstrap in transient model context. Delegated child sessions keep access to native skills but do not receive the controller bootstrap. A manual fork without a parent session keeps controller -behavior. After V2 native compaction removes all user messages, the plugin appends -a transient bootstrap message after the checkpoint; saved history is unchanged. +behavior. When V2 native compaction retains earlier user messages (the default +`compaction.keep.tokens` budget), the bootstrap goes into the first retained user +message ahead of the checkpoint, as in an uncompacted session. When compaction +removes all user messages, the plugin appends a transient bootstrap message after +the checkpoint. Saved history is unchanged either way. If session lookup fails, the plugin keeps bootstrap for that request and retries on the next request. Failed lookups are not cached as controller decisions. @@ -174,13 +182,14 @@ In short, V2 renamed `task` → `subagent` (the agent name moved from `subagent_ opencode run --print-logs "hello" 2>&1 | grep -i superpowers ``` -**V2:** Check the server log: +**V2:** Plugins load in the background server, whose logs `--print-logs` only +shows with `--standalone`: ``` -opencode service status +opencode run --standalone --print-logs "hello" 2>&1 | grep -i superpowers ``` -Then inspect `~/.local/share/opencode/log/opencode.log`, filtering for `role=server`. +Or inspect `~/.local/share/opencode/log/opencode.log`, filtering for `role=server`. Also verify the plugin path in your `opencode.json` is correct and that you're running a recent version of OpenCode. @@ -197,14 +206,15 @@ package: npm install superpowers@git+https://github.com/obra/superpowers.git --prefix "$HOME\.config\opencode" ``` -Then use the installed package path in `opencode.json` for your OpenCode -version: +Then use the absolute path of the installed package in `opencode.json` for your +OpenCode version. OpenCode does not expand `~`; a `~/...` entry is treated as a +package name, not a local directory. **V1:** ```json { - "plugin": ["~/.config/opencode/node_modules/superpowers"] + "plugin": ["C:\\Users\\\\.config\\opencode\\node_modules\\superpowers"] } ``` @@ -212,7 +222,7 @@ version: ```json { - "plugins": ["~/.config/opencode/node_modules/superpowers"] + "plugins": ["C:\\Users\\\\.config\\opencode\\node_modules\\superpowers"] } ``` -- cgit