Compare commits

..

1 Commits

Author SHA1 Message Date
Drew Ritter
dc6082d7ff Add native OpenClaw plugin support 2026-04-28 16:56:39 -07:00
10 changed files with 404 additions and 6 deletions

67
.codex/INSTALL.md Normal file
View File

@@ -0,0 +1,67 @@
# Installing Superpowers for Codex
Enable superpowers skills in Codex via native skill discovery. Just clone and symlink.
## Prerequisites
- Git
## Installation
1. **Clone the superpowers repository:**
```bash
git clone https://github.com/obra/superpowers.git ~/.codex/superpowers
```
2. **Create the skills symlink:**
```bash
mkdir -p ~/.agents/skills
ln -s ~/.codex/superpowers/skills ~/.agents/skills/superpowers
```
**Windows (PowerShell):**
```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.agents\skills"
cmd /c mklink /J "$env:USERPROFILE\.agents\skills\superpowers" "$env:USERPROFILE\.codex\superpowers\skills"
```
3. **Restart Codex** (quit and relaunch the CLI) to discover the skills.
## Migrating from old bootstrap
If you installed superpowers before native skill discovery, you need to:
1. **Update the repo:**
```bash
cd ~/.codex/superpowers && git pull
```
2. **Create the skills symlink** (step 2 above) — this is the new discovery mechanism.
3. **Remove the old bootstrap block** from `~/.codex/AGENTS.md` — any block referencing `superpowers-codex bootstrap` is no longer needed.
4. **Restart Codex.**
## Verify
```bash
ls -la ~/.agents/skills/superpowers
```
You should see a symlink (or junction on Windows) pointing to your superpowers skills directory.
## Updating
```bash
cd ~/.codex/superpowers && git pull
```
Skills update instantly through the symlink.
## Uninstalling
```bash
rm ~/.agents/skills/superpowers
```
Optionally delete the clone: `rm -rf ~/.codex/superpowers`.

23
.openclaw/index.js Normal file
View File

@@ -0,0 +1,23 @@
const SUPERPOWERS_GUIDANCE = `## Superpowers
You have access to the Superpowers skill framework through OpenClaw's native skill system.
Before responding to software development work, check whether one of those skills applies.
If a Superpowers skill fits the task, invoke it before proceeding.
Start with \`using-superpowers\` when you need the overall workflow. Common follow-on
skills include \`brainstorming\`, \`writing-plans\`, \`test-driven-development\`,
\`systematic-debugging\`, \`dispatching-parallel-agents\`, and
\`verification-before-completion\`.
When Superpowers instructions mention generic tools, use the closest native OpenClaw
tool or workflow.`;
export default {
id: "superpowers-openclaw",
name: "Superpowers for OpenClaw",
description: "Expose the Superpowers skill pack through OpenClaw's native plugin skill discovery.",
register(api) {
api.on("before_prompt_build", async () => ({ prependSystemContext: SUPERPOWERS_GUIDANCE }));
},
};

View File

@@ -4,6 +4,7 @@
{ "path": ".claude-plugin/plugin.json", "field": "version" },
{ "path": ".cursor-plugin/plugin.json", "field": "version" },
{ "path": ".codex-plugin/plugin.json", "field": "version" },
{ "path": "openclaw.plugin.json", "field": "version" },
{ "path": ".claude-plugin/marketplace.json", "field": "plugins.0.version" },
{ "path": "gemini-extension.json", "field": "version" }
],

View File

@@ -127,6 +127,33 @@ already use it in another harness.
- Detailed docs: [docs/README.opencode.md](docs/README.opencode.md)
### OpenClaw
OpenClaw uses its native plugin system. Install Superpowers separately even if
you already use it in another harness.
- Clone and link the plugin:
```bash
git clone https://github.com/obra/superpowers.git ~/.openclaw/vendor/superpowers
openclaw plugins install --link ~/.openclaw/vendor/superpowers --dangerously-force-unsafe-install
openclaw plugins enable superpowers-openclaw
openclaw gateway restart
```
The override is required because OpenClaw scans the linked plugin directory
during native plugin install. It flags `skills/writing-skills/render-graphs.js`,
an existing Superpowers skill-authoring helper, because that script shells out
to Graphviz. The helper is not part of the OpenClaw runtime hook; review the
source before using the override.
- Verify the plugin and skills are available:
```bash
openclaw plugins info superpowers-openclaw --json
openclaw skills info using-superpowers --json
```
### Cursor
- In Cursor Agent chat, install from marketplace:

126
docs/README.codex.md Normal file
View File

@@ -0,0 +1,126 @@
# Superpowers for Codex
Guide for using Superpowers with OpenAI Codex via native skill discovery.
## Quick Install
Tell Codex:
```
Fetch and follow instructions from https://raw.githubusercontent.com/obra/superpowers/refs/heads/main/.codex/INSTALL.md
```
## Manual Installation
### Prerequisites
- OpenAI Codex CLI
- Git
### Steps
1. Clone the repo:
```bash
git clone https://github.com/obra/superpowers.git ~/.codex/superpowers
```
2. Create the skills symlink:
```bash
mkdir -p ~/.agents/skills
ln -s ~/.codex/superpowers/skills ~/.agents/skills/superpowers
```
3. Restart Codex.
4. **For subagent skills** (optional): Skills like `dispatching-parallel-agents` and `subagent-driven-development` require Codex's multi-agent feature. Add to your Codex config:
```toml
[features]
multi_agent = true
```
### Windows
Use a junction instead of a symlink (works without Developer Mode):
```powershell
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.agents\skills"
cmd /c mklink /J "$env:USERPROFILE\.agents\skills\superpowers" "$env:USERPROFILE\.codex\superpowers\skills"
```
## How It Works
Codex has native skill discovery — it scans `~/.agents/skills/` at startup, parses SKILL.md frontmatter, and loads skills on demand. Superpowers skills are made visible through a single symlink:
```
~/.agents/skills/superpowers/ → ~/.codex/superpowers/skills/
```
The `using-superpowers` skill is discovered automatically and enforces skill usage discipline — no additional configuration needed.
## Usage
Skills are discovered automatically. Codex activates them when:
- You mention a skill by name (e.g., "use brainstorming")
- The task matches a skill's description
- The `using-superpowers` skill directs Codex to use one
### Personal Skills
Create your own skills in `~/.agents/skills/`:
```bash
mkdir -p ~/.agents/skills/my-skill
```
Create `~/.agents/skills/my-skill/SKILL.md`:
```markdown
---
name: my-skill
description: Use when [condition] - [what it does]
---
# My Skill
[Your skill content here]
```
The `description` field is how Codex decides when to activate a skill automatically — write it as a clear trigger condition.
## Updating
```bash
cd ~/.codex/superpowers && git pull
```
Skills update instantly through the symlink.
## Uninstalling
```bash
rm ~/.agents/skills/superpowers
```
**Windows (PowerShell):**
```powershell
Remove-Item "$env:USERPROFILE\.agents\skills\superpowers"
```
Optionally delete the clone: `rm -rf ~/.codex/superpowers` (Windows: `Remove-Item -Recurse -Force "$env:USERPROFILE\.codex\superpowers"`).
## Troubleshooting
### Skills not showing up
1. Verify the symlink: `ls -la ~/.agents/skills/superpowers`
2. Check skills exist: `ls ~/.codex/superpowers/skills`
3. Restart Codex — skills are discovered at startup
### Windows junction issues
Junctions normally work without special permissions. If creation fails, try running PowerShell as administrator.
## Getting Help
- Report issues: https://github.com/obra/superpowers/issues
- Main documentation: https://github.com/obra/superpowers

13
openclaw.plugin.json Normal file
View File

@@ -0,0 +1,13 @@
{
"id": "superpowers-openclaw",
"name": "Superpowers for OpenClaw",
"version": "5.0.7",
"description": "Expose the Superpowers skill pack through OpenClaw's native plugin skill discovery.",
"skills": [
"./skills"
],
"configSchema": {
"type": "object",
"additionalProperties": false
}
}

View File

@@ -2,5 +2,10 @@
"name": "superpowers",
"version": "5.0.7",
"type": "module",
"main": ".opencode/plugins/superpowers.js"
"main": ".opencode/plugins/superpowers.js",
"openclaw": {
"extensions": [
"./.openclaw/index.js"
]
}
}

View File

@@ -52,6 +52,7 @@ EXCLUDES=(
"/.gitattributes"
"/.github/"
"/.gitignore"
"/.openclaw/"
"/.opencode/"
"/.version-bump.json"
"/.worktrees/"
@@ -64,6 +65,7 @@ EXCLUDES=(
"/GEMINI.md"
"/RELEASE-NOTES.md"
"/gemini-extension.json"
"/openclaw.plugin.json"
"/package.json"
# Directories not shipped by canonical Codex plugins

View File

@@ -70,11 +70,10 @@ specified in the instructions above.
### When this workaround can be removed
This approach compensates for Codex not yet exposing plugin-packaged custom
agents as named `spawn_agent` targets. OpenAI plugin examples can include
plugin-level `agents/` directories, but skills still need to read those prompts
and spawn a built-in agent role. When Codex exposes plugin agents as callable
named agent types, this manual prompt-loading workaround can be removed.
This approach compensates for Codex's plugin system not yet supporting an `agents`
field in `plugin.json`. When `RawPluginManifest` gains an `agents` field, the
plugin can symlink to `agents/` (mirroring the existing `skills/` symlink) and
skills can dispatch named agent types directly.
## Environment Detection

View File

@@ -0,0 +1,135 @@
#!/usr/bin/env bash
# Test: OpenClaw native plugin package
# Verifies the Superpowers repo exposes a native OpenClaw plugin contract.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
cd "$REPO_ROOT"
echo "=== Test: OpenClaw native plugin package ==="
echo "Test 1: Checking OpenClaw manifest..."
node <<'NODE'
import fs from "node:fs";
const manifestPath = "openclaw.plugin.json";
if (!fs.existsSync(manifestPath)) {
throw new Error(`${manifestPath} is missing`);
}
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
if (manifest.id !== "superpowers-openclaw") {
throw new Error(`unexpected manifest id: ${manifest.id}`);
}
if (manifest.version !== pkg.version) {
throw new Error(`manifest version ${manifest.version} must match package version ${pkg.version}`);
}
if (!Array.isArray(manifest.skills) || manifest.skills.length !== 1 || manifest.skills[0] !== "./skills") {
throw new Error(`unexpected skills declaration: ${JSON.stringify(manifest.skills)}`);
}
if (
!manifest.configSchema ||
manifest.configSchema.type !== "object" ||
manifest.configSchema.additionalProperties !== false ||
manifest.configSchema.properties !== undefined
) {
throw new Error(`manifest must declare an empty object configSchema: ${JSON.stringify(manifest.configSchema)}`);
}
if ("entrypoint" in manifest) {
throw new Error("OpenClaw entrypoints belong in package.json openclaw.extensions, not openclaw.plugin.json");
}
if ("hooks" in manifest) {
throw new Error("OpenClaw hook registration belongs in the runtime entrypoint, not openclaw.plugin.json");
}
NODE
echo " [PASS] Manifest declares plugin skills correctly"
echo "Test 2: Checking package OpenClaw extension metadata..."
node <<'NODE'
import fs from "node:fs";
const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
if (pkg.name !== "superpowers") {
throw new Error(`package name changed unexpectedly: ${pkg.name}`);
}
if (pkg.type !== "module") {
throw new Error("OpenClaw runtime should preserve the repo's ESM package mode");
}
const extensions = pkg.openclaw?.extensions;
if (!Array.isArray(extensions) || extensions.length !== 1 || extensions[0] !== "./.openclaw/index.js") {
throw new Error(`unexpected openclaw.extensions: ${JSON.stringify(extensions)}`);
}
NODE
echo " [PASS] package.json points OpenClaw at the runtime entrypoint"
echo "Test 3: Checking runtime entrypoint syntax and hook behavior..."
node --check .openclaw/index.js
node <<'NODE'
const module = await import(new URL("./.openclaw/index.js", import.meta.url));
const plugin = module.default;
if (!plugin || plugin.id !== "superpowers-openclaw" || typeof plugin.register !== "function") {
throw new Error("OpenClaw runtime must default-export a plugin with register(api)");
}
const hooks = [];
const api = {
pluginConfig: {},
rootDir: process.cwd(),
logger: { warn(message) { throw new Error(`unexpected warning: ${message}`); } },
on(name, handler) {
hooks.push({ name, handler });
},
};
plugin.register(api);
if (hooks.length !== 1 || hooks[0].name !== "before_prompt_build") {
throw new Error(`unexpected hooks: ${JSON.stringify(hooks.map((hook) => hook.name))}`);
}
const result = await hooks[0].handler();
if (!result?.prependSystemContext?.includes("Superpowers")) {
throw new Error("before_prompt_build hook must inject Superpowers guidance");
}
if (result.prependSystemContext.includes("~/.openclaw/skills")) {
throw new Error("native plugin guidance must not advertise managed skill symlinks");
}
NODE
echo " [PASS] Runtime entrypoint registers the prompt hook"
echo "Test 4: Checking README install flow..."
if ! grep -q 'openclaw plugins install --link ~/.openclaw/vendor/superpowers' README.md; then
echo " [FAIL] README must document linked OpenClaw plugin install"
exit 1
fi
if ! grep -q -- '--dangerously-force-unsafe-install' README.md; then
echo " [FAIL] README must document OpenClaw scanner override required by existing helper scripts"
exit 1
fi
if ! grep -q 'skills/writing-skills/render-graphs.js' README.md; then
echo " [FAIL] README must explain the exact Superpowers helper that triggers OpenClaw's scanner"
exit 1
fi
if ! grep -q 'not part of the OpenClaw runtime hook' README.md; then
echo " [FAIL] README must explain that the flagged helper is not part of the OpenClaw runtime hook"
exit 1
fi
if ! grep -q 'openclaw plugins enable superpowers-openclaw' README.md; then
echo " [FAIL] README must document enabling the OpenClaw plugin"
exit 1
fi
if ! grep -q 'openclaw gateway restart' README.md; then
echo " [FAIL] README must document restarting the gateway"
exit 1
fi
if grep -q 'OPENCLAW_SKILLS_DIR\|ln -s\|AGENTS-snippet\|.openclaw/INSTALL.md' README.md; then
echo " [FAIL] README must not use the legacy symlink/snippet wrapper or extra install doc"
exit 1
fi
echo " [PASS] README documents native plugin commands"
echo ""
echo "=== OpenClaw native plugin tests passed ==="