Syncs config and account files between the Claude Code and OpenCode home directories. Every other plugin in the ecosystem stays inside the single home of the app it is running in; sync-bridge is the one component permitted to span both homes, so an account logged in (or a config changed) in one app is mirrored to the other. It is consumed two ways: as its own plugin hook (reconciles configured files on load — by default the core-auth account store), and as an in-process library (dist/lib.js) that plugin-updater loads to run syncPlugins(), mirroring plugins.json entries flagged sync: true into the other app.
flowchart TD
subgraph Homes
CLAUDE["Claude home<br/>~/.claude → ~/.config/claude"]
OPENCODE["OpenCode home<br/>~/.config/opencode → ~/.opencode"]
end
subgraph Bridge [sync-bridge]
HOOK["plugin hook (dist/index.js)<br/>reconciles configured files on load"]
LIB["library (dist/lib.js)<br/>syncFile / sync / syncPlugins / homes"]
RECONCILE["reconcile: read each home → merge → write all homes"]
STRAT["strategies: newest | accounts (union)<br/>plugins: per-home union of sync:true entries"]
HOOK --> RECONCILE
LIB --> RECONCILE --> STRAT
end
CLAUDE <--> RECONCILE
OPENCODE <--> RECONCILE
UPDATER["plugin-updater"] -->|syncPlugins() each launch| LIB
Each home is resolved by precedence (Claude prefers ~/.claude; OpenCode prefers ~/.config/opencode), overridable via HUB_CLAUDE_DIR / HUB_OPENCODE_DIR. A relative path (e.g. config/accounts.json) is read from every existing home, reconciled by a merge strategy, and written back atomically to all homes. The accounts strategy unions the core-auth account store by account id so no login is ever lost; newest copies the most-recently-modified version.
src/— TypeScript source (homes,merge,sync,pluginsync,config,commands,index= hook,lib= library entry)core/— git submodule (intisy-ai/core): shared config, logging, and the cross-app command framework — bundled into both output files by esbuilddist/— Compiled output (generated; not committed):index.js(plugin hook) +lib.js(in-process library)test/— Node test runner specs
Add to ~/.config/opencode/config/plugins.json:
[{ "name": "sync-bridge", "url": "https://github.com/intisy-ai/sync-bridge", "enabled": true }]npm install sync-bridgeThe package main (dist/index.js) is the plugin hook and intentionally exports only SyncBridgePlugin — OpenCode runs every export as a hook, so the library functions live in a separate bundle. In-process consumers import from sync-bridge/dist/lib.js:
import { syncPlugins, syncFile, registerSyncFile, sync, existingHomes } from "sync-bridge/dist/lib.js";
syncPlugins(); // mirror plugins.json entries flagged sync:true across apps
syncFile("accounts.json", { strategy: "accounts" }); // union the account store
syncFile("config/plugins.json", { strategy: "newest" });
registerSyncFile("config/plugins.json", { strategy: "newest" });
sync(); // reconcile everything registeredGive any plugins.json entry a sync: true flag and it is mirrored into the other app's plugins.json on the next plugin-updater run, so installing a plugin in one app installs it in the other. It is a per-home union (each app keeps its own non-synced entries) and additive (never removes).
[{ "name": "antigravity-auth", "url": "https://github.com/intisy-ai/antigravity-auth", "enabled": true, "autoUpdate": false, "sync": true }]Config files are never auto-created on launch — settings are registered with defaults (core
defineConfig) and edited in the loader's Plugins → Configure screen (or/<plugin>-config); a file is written only when you change a value. Global console logging for every plugin is toggled inconfig/settings.json(logConsole: true, the opencode.json-equivalent).
Config file: ~/.config/opencode/config/sync-bridge.json (preferred) or ~/.config/opencode/sync-bridge.json (fallback); same under ~/.claude for Claude Code.
{
"logging": true,
"files": [{ "path": "config/plugins.json", "strategy": "newest" }]
}The core-auth account store (config/accounts.json) is always synced; files adds more.
| Key | Type | Default | Description |
|---|---|---|---|
logging |
boolean | true |
Write a per-session log file. Set false to disable. |
files |
array | [{ name: "accounts.json", strategy: "accounts" }] |
Files to reconcile across homes. Each entry is { name, strategy } where strategy is accounts (union by id) or newest. |
Every key is editable from chat via /sync-bridge-config.
Deployed automatically to both apps on load (~/.config/opencode/command/ and ~/.claude/commands/):
| Command | Description |
|---|---|
/sync |
Reconcile all configured files and mirror sync: true plugins across both apps right now. |
/sync-bridge-config |
View/change any config key: list, get <key>, set <key> <value>. 100% of the config is reachable here. |
core(required) — bundled git submodule; no separate install.plugin-updater(recommended) — callssyncPlugins()fromdist/lib.jseach launch to mirrorsync: trueplugins; without it, only the on-load file reconcile and the/synccommand run.
Logs are written to <home>/logs/YYYY-MM-DD/sync-bridge-HH-MM-SS.log. Set "logging": false to disable.
MIT