Skip to content

Commit dbc520b

Browse files
rodion-mclaude
andcommitted
Add plugin-bridge tool to share the plugin with other agents
tools/plugin-bridge ships a launchd agent (macOS) and systemd --user path unit (Linux) that keep a symlink from an AI agent's skills directory pointing at the highest-versioned Claude Code plugin cache directory. It re-links automatically after `claude plugin update`, letting Codex CLI, Gemini CLI, and other skill-aware agents consume the exact files the plugin installs without duplicating the skill. README adds Option 4 with the install steps. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b91f0b0 commit dbc520b

6 files changed

Lines changed: 227 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ For Claude Code users, this repository also serves as a plugin marketplace with
4949

5050
For deeper integration, install the [CodeAlive MCP server](https://github.com/CodeAlive-AI/codealive-mcp) — it gives your agent direct access to CodeAlive's tools via the Model Context Protocol. The skill and MCP server complement each other: the MCP server provides tool access, the skill teaches the agent how to use it effectively.
5151

52+
### Option 4: Share the Claude Code plugin with another agent
53+
54+
If you already use the Claude Code plugin and want Codex CLI, Gemini CLI, or another skill-aware agent to consume the exact same skill files, install the [plugin bridge](tools/plugin-bridge/) — a tiny `launchd` agent (macOS) or `systemd --user` path unit (Linux) that keeps a symlink from the other agent's skills directory into the plugin's versioned cache. It re-links automatically on `claude plugin update`.
55+
56+
```bash
57+
cd tools/plugin-bridge
58+
./install-macos.sh
59+
```
60+
61+
See [`tools/plugin-bridge/README.md`](tools/plugin-bridge/README.md) for configuration and Linux instructions.
62+
5263
## Setup
5364

5465
After installing the skill, run the interactive setup:

tools/plugin-bridge/README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Plugin Bridge
2+
3+
Keep an AI agent's skills directory in sync with the Claude Code `codealive`
4+
plugin's versioned cache. The bridge lets agents like Codex CLI, Gemini CLI,
5+
Cursor, or Windsurf consume the same skill files the Claude Code plugin
6+
installs, and updates the link automatically on `claude plugin update`.
7+
8+
## Why
9+
10+
Claude Code stores plugins under a versioned cache:
11+
`~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/`. Every call to
12+
`claude plugin update` writes a new versioned directory and leaves the old one
13+
behind. Agents other than Claude Code don't read from that cache — they look
14+
for skills in their own directories (`~/.codex/skills/`, `~/.gemini/skills/`,
15+
etc.).
16+
17+
A symlink from the agent's skills directory into the cache lets them share the
18+
plugin's skill with zero duplication. The trade-off: that symlink breaks every
19+
time the plugin version changes. `plugin-bridge` rewrites the symlink to point
20+
at the newest versioned directory whenever the cache changes on disk.
21+
22+
## Files
23+
24+
| File | Purpose |
25+
|------|---------|
26+
| `update-symlink.sh` | Scans the plugin cache and refreshes the agent symlink if the target has changed |
27+
| `com.codealive.plugin-bridge.plist.template` | `launchd` agent template with placeholders |
28+
| `install-macos.sh` | Renders the plist, writes it to `~/Library/LaunchAgents`, and bootstraps the agent |
29+
| `uninstall-macos.sh` | Removes the `launchd` agent; leaves existing symlinks untouched |
30+
31+
## Install (macOS)
32+
33+
```bash
34+
./install-macos.sh
35+
```
36+
37+
Verify the symlink and the agent:
38+
39+
```bash
40+
ls -la ~/.codex/skills/codealive-context-engine
41+
launchctl print "gui/$(id -u)/com.codealive.plugin-bridge" | head
42+
cat /tmp/codealive-plugin-bridge.log
43+
```
44+
45+
Run `claude plugin update codealive@codealive-marketplace`, then re-check the
46+
symlink — it should now point at the new version's directory.
47+
48+
## Configure
49+
50+
All paths are environment-variable driven with defaults suitable for Codex CLI.
51+
Export the variables before running `install-macos.sh` to target a different
52+
agent.
53+
54+
| Variable | Default |
55+
|----------|---------|
56+
| `CODEALIVE_PLUGIN_CACHE` | `~/.claude/plugins/cache/codealive-marketplace/codealive` |
57+
| `CODEALIVE_PLUGIN_SUBPATH` | `skills/codealive-context-engine` |
58+
| `CODEALIVE_AGENT_LINK` | `~/.codex/skills/codealive-context-engine` |
59+
60+
Example for Gemini CLI:
61+
62+
```bash
63+
CODEALIVE_AGENT_LINK=~/.gemini/skills/codealive-context-engine ./install-macos.sh
64+
```
65+
66+
Note: environment variables are read by `update-symlink.sh` at runtime.
67+
`launchd` launches it via `/bin/bash` without inheriting your shell, so the
68+
overrides must be either baked into the script, exported in `~/.zshenv`, or
69+
injected through an `EnvironmentVariables` key in the plist.
70+
71+
## Uninstall (macOS)
72+
73+
```bash
74+
./uninstall-macos.sh
75+
```
76+
77+
## Linux
78+
79+
A `systemd --user` path unit gives the equivalent behaviour. Create two files:
80+
81+
`~/.config/systemd/user/codealive-plugin-bridge.path`:
82+
83+
```ini
84+
[Unit]
85+
Description=Watch CodeAlive plugin cache
86+
87+
[Path]
88+
PathModified=%h/.claude/plugins/cache/codealive-marketplace/codealive
89+
90+
[Install]
91+
WantedBy=default.target
92+
```
93+
94+
`~/.config/systemd/user/codealive-plugin-bridge.service`:
95+
96+
```ini
97+
[Unit]
98+
Description=Refresh CodeAlive plugin symlink
99+
100+
[Service]
101+
Type=oneshot
102+
ExecStart=/bin/bash %h/path/to/update-symlink.sh
103+
```
104+
105+
Enable with `systemctl --user enable --now codealive-plugin-bridge.path`.
106+
107+
## Windows
108+
109+
No native file-watcher is shipped here. A Task Scheduler entry calling
110+
`update-symlink.sh` via WSL bash or a PowerShell port on login and every
111+
N minutes is a reasonable fallback.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>Label</key>
6+
<string>com.codealive.plugin-bridge</string>
7+
<key>ProgramArguments</key>
8+
<array>
9+
<string>/bin/bash</string>
10+
<string>__UPDATER__</string>
11+
</array>
12+
<key>WatchPaths</key>
13+
<array>
14+
<string>__WATCH_PATH__</string>
15+
</array>
16+
<key>RunAtLoad</key>
17+
<true/>
18+
<key>StandardOutPath</key>
19+
<string>/tmp/codealive-plugin-bridge.log</string>
20+
<key>StandardErrorPath</key>
21+
<string>/tmp/codealive-plugin-bridge.err</string>
22+
</dict>
23+
</plist>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
# Install the plugin-bridge launchd agent on macOS.
3+
# Run once per user account. Idempotent — re-running reloads the agent.
4+
5+
set -euo pipefail
6+
7+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8+
UPDATER="$SCRIPT_DIR/update-symlink.sh"
9+
TEMPLATE="$SCRIPT_DIR/com.codealive.plugin-bridge.plist.template"
10+
11+
LABEL="com.codealive.plugin-bridge"
12+
PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
13+
14+
: "${CODEALIVE_PLUGIN_CACHE:=$HOME/.claude/plugins/cache/codealive-marketplace/codealive}"
15+
16+
chmod +x "$UPDATER"
17+
mkdir -p "$HOME/Library/LaunchAgents"
18+
19+
sed -e "s|__UPDATER__|$UPDATER|g" \
20+
-e "s|__WATCH_PATH__|$CODEALIVE_PLUGIN_CACHE|g" \
21+
"$TEMPLATE" > "$PLIST"
22+
23+
DOMAIN="gui/$(id -u)"
24+
if launchctl print "$DOMAIN/$LABEL" >/dev/null 2>&1; then
25+
launchctl bootout "$DOMAIN/$LABEL" || true
26+
fi
27+
launchctl bootstrap "$DOMAIN" "$PLIST"
28+
29+
"$UPDATER" || true
30+
31+
echo "Installed launchd agent: $LABEL"
32+
echo "Plist: $PLIST"
33+
echo "Logs: /tmp/codealive-plugin-bridge.log (stdout), /tmp/codealive-plugin-bridge.err (stderr)"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Remove the plugin-bridge launchd agent. Does not touch existing symlinks.
3+
4+
set -euo pipefail
5+
6+
LABEL="com.codealive.plugin-bridge"
7+
PLIST="$HOME/Library/LaunchAgents/$LABEL.plist"
8+
DOMAIN="gui/$(id -u)"
9+
10+
if launchctl print "$DOMAIN/$LABEL" >/dev/null 2>&1; then
11+
launchctl bootout "$DOMAIN/$LABEL" || true
12+
fi
13+
rm -f "$PLIST"
14+
15+
echo "Removed launchd agent: $LABEL"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
# Point an agent-side symlink at the highest-versioned cache directory of an
3+
# installed Claude Code plugin. Safe to re-run; relinks only when the target
4+
# changes.
5+
#
6+
# Configuration (override via environment):
7+
# CODEALIVE_PLUGIN_CACHE Parent of versioned plugin directories
8+
# Default: ~/.claude/plugins/cache/codealive-marketplace/codealive
9+
# CODEALIVE_PLUGIN_SUBPATH Skill path inside each versioned directory
10+
# Default: skills/codealive-context-engine
11+
# CODEALIVE_AGENT_LINK Symlink to create or update
12+
# Default: ~/.codex/skills/codealive-context-engine
13+
14+
set -u
15+
16+
: "${CODEALIVE_PLUGIN_CACHE:=$HOME/.claude/plugins/cache/codealive-marketplace/codealive}"
17+
: "${CODEALIVE_PLUGIN_SUBPATH:=skills/codealive-context-engine}"
18+
: "${CODEALIVE_AGENT_LINK:=$HOME/.codex/skills/codealive-context-engine}"
19+
20+
[ -d "$CODEALIVE_PLUGIN_CACHE" ] || exit 0
21+
22+
LATEST=$(ls -1 "$CODEALIVE_PLUGIN_CACHE" 2>/dev/null | sort -V | tail -1)
23+
[ -n "$LATEST" ] || exit 0
24+
25+
TARGET="$CODEALIVE_PLUGIN_CACHE/$LATEST/$CODEALIVE_PLUGIN_SUBPATH"
26+
[ -d "$TARGET" ] || exit 0
27+
28+
mkdir -p "$(dirname "$CODEALIVE_AGENT_LINK")"
29+
30+
CURRENT=$(readlink "$CODEALIVE_AGENT_LINK" 2>/dev/null || true)
31+
if [ "$CURRENT" != "$TARGET" ]; then
32+
ln -sfn "$TARGET" "$CODEALIVE_AGENT_LINK"
33+
echo "$(date -u +%FT%TZ) linked $CODEALIVE_AGENT_LINK -> $TARGET"
34+
fi

0 commit comments

Comments
 (0)