OpenCode Plugin
Theopencode-sync-plugin syncs your OpenCode sessions to OpenSync automatically. Supported session and message updates appear in your dashboard as the plugin syncs them.
Source identifier: opencode
Hosted OpenSync uses
https://api.opensync.dev for HTTP requests. The currently published OpenCode 0.3.7 login validator still requires a Convex URL. Use https://reminiscent-gull-645.convex.cloud from Settings → API Access → compatibility URL. Existing credentials remain valid.Installation
Install globally with npm:Setup
1
Generate an API key
Log in to opensync.dev, go to Settings, and click Generate API Key. Copy the key (starts with
osk_).2
Run login
- Convex URL:
https://reminiscent-gull-645.convex.cloud(for hosted) or your self-hosted URL - API Key: The key you copied from Settings
3
Verify the connection
Config file
Credentials are stored in~/.opensync/credentials.json:
login. logout clears its saved credentials.
Commands
opencode-sync login
Stores your Convex URL and API key. Prompts interactively if values are not provided as flags.opencode-sync status
Shows whether credentials are configured and the saved backend URL. Useopencode-sync verify to check credentials and OpenCode plugin registration.
opencode-sync sync
In published version 0.3.7, plainopencode-sync sync checks connectivity and creates a test session. It does not import your session history.
For the legacy JSON storage layout, use an explicit import mode:
opencode-sync sync --force clears local tracking and resends all readable sessions. Use it only when you intend to resync history.
opencode-sync logout
Clears stored credentials in~/.opensync/credentials.json.
How syncing works
- The published reader expects legacy session JSON in
~/.local/share/opencode/storage/session/as JSON files. - The plugin reads session and message data from this directory.
- Each session is pushed to the
/sync/sessionHTTP endpoint on your Convex deployment. - Each message within the session is pushed to
/sync/message. - The plugin uses
externalIdfor deduplication, so re-syncing the same session is safe.
What gets synced
URL normalization
The plugin converts your Convex URL from.convex.cloud to .convex.site for HTTP endpoints:
.convex.cloud URL during login.
Troubleshooting
Plugin not syncing
- Run
opencode-sync statusto check the connection. - Verify your API key is still valid in the dashboard Settings.
- Check that OpenCode is writing to
~/.local/share/opencode/storage/session/. - For legacy JSON history, use
opencode-sync sync --all. Foropencode.db, check the compatibility note above.
Sessions missing
- Check whether your OpenCode version uses JSON storage or
opencode.dbbefore attempting an import. - Check that the session directory (
~/.local/share/opencode/storage/session/) contains JSON files.
Permission errors
The plugin needs read access to~/.local/share/opencode/storage/session/. On macOS, this is usually granted automatically. On Linux, check file permissions:
Network errors
If you seeECONNREFUSED or timeout errors:
- Verify your Convex deployment is running (
GET /healthon your Convex site URL should return{"status": "ok"}). - Check your firewall or proxy settings.
- For self-hosted deployments, ensure the Convex URL is correct.