Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .agents/skills/opencode-sync-sandbox/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,20 @@ Follow this workflow whenever a task changes sync behavior, config handling, com
- `bun run build`
6. Run full isolated E2E before declaring success:
- `./.agents/skills/opencode-sync-sandbox/scripts/run-e2e.sh`
7. Report exact evidence: what changed, what tests ran, and E2E artifact path.
- Run E2E variants that directly exercise the features changed in this task
(for example: sessions, secrets, or other changed sync flags/paths).
7. Report exact evidence: what changed, what tests ran, and an E2E artifact review.

Do not skip E2E for changes that affect sync workflows, path resolution, repo operations, or command execution.

## E2E Reporting Requirements

- Do not report the E2E artifact path unless the user explicitly asks for it.
- Read `results/summary.json`, command result payloads under `results/`, and relevant `logs/*.log` tails.
- Summarize the executed flow, pass/fail status, key warnings/errors, and any suspicious signals.
- If warnings exist, explain whether they are expected, tolerated, or need follow-up.
- For feature-flagged runs, report the exact artifact-level behavior for each changed feature (including restart requirements when relevant).

## Sandbox Rules

- Keep all E2E state inside `.memory/e2e/runs/<run-id>/`.
Expand All @@ -44,6 +54,10 @@ Use this clone to confirm command/server/tool behavior and avoid assumptions.
- `./.agents/skills/opencode-sync-sandbox/scripts/preflight.sh`
- Full two-instance GitHub E2E:
- `./.agents/skills/opencode-sync-sandbox/scripts/run-e2e.sh`
- Enable secrets coverage:
`./.agents/skills/opencode-sync-sandbox/scripts/run-e2e.sh --enable-secrets`
- Enable session database coverage (implies secrets):
`./.agents/skills/opencode-sync-sandbox/scripts/run-e2e.sh --enable-sessions`

For additional usage flags, run:

Expand Down
61 changes: 54 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ Create `~/.config/opencode/opencode-synced.jsonc`:
"includeSecrets": false,
"includeMcpSecrets": false,
"includeSessions": false,
"sessionBackend": {
"type": "git",
"turso": {
"syncIntervalSec": 15,
"autoSetup": true,
},
},
"includePromptStash": false,
"includeModelFavorites": true,
"extraSecretPaths": [],
Expand Down Expand Up @@ -105,22 +112,58 @@ in a private repo, set `"includeMcpSecrets": true` (requires `includeSecrets`).

### Sessions (private repos only)

Sync your opencode sessions (conversation history from `/sessions`) across machines by setting `"includeSessions": true`. This requires `includeSecrets` to also be enabled since sessions may contain sensitive data.
Session sync remains opt-in via `"includeSessions": true` (and requires `"includeSecrets": true`).
Session backend defaults to Git for backward compatibility. Turso is recommended for users running
multiple active machines concurrently.

```jsonc
{
"repo": { ... },
"includeSecrets": true,
"includeSessions": true
"includeSessions": true,
"sessionBackend": {
"type": "git", // or "turso"
"turso": {
"database": "my-opencode-config-sessions", // optional
"url": "libsql://...", // optional
"syncIntervalSec": 15, // default 15
"autoSetup": true, // default true
},
},
}
```

Synced session data:
#### Git backend (`sessionBackend.type = "git"`, default)

Best-effort session artifact sync via Git paths:

- `~/.local/share/opencode/opencode.db`
- `~/.local/share/opencode/opencode.db-wal` and `~/.local/share/opencode/opencode.db-shm`
- `~/.local/share/opencode/storage/session/`
- `~/.local/share/opencode/storage/message/`
- `~/.local/share/opencode/storage/part/`
- `~/.local/share/opencode/storage/session_diff/`

This mode can conflict with concurrent writers.

#### Turso backend (`sessionBackend.type = "turso"`)

Concurrent-safe snapshot backend for sessions:

- Session artifacts are **not** synced through Git paths.
- Config + secrets continue using the normal Git sync flow.
- Startup performs a Turso session pull before regular config sync.
- Background loop runs `pull -> push -> pull` on the configured interval.
- Manual `/sync-pull` and `/sync-push` trigger a foreground session sync cycle too.

Turso setup is machine-local and idempotent:

- Auto-installs Turso CLI when needed (best effort).
- Runs headless Turso login flow when needed.
- Creates/reuses the Turso database + token.
- Stores credentials in a local machine-only file (`0600`) outside the sync repo.

- `~/.local/share/opencode/storage/session/` - Session files
- `~/.local/share/opencode/storage/message/` - Message history
- `~/.local/share/opencode/storage/part/` - Message parts
- `~/.local/share/opencode/storage/session_diff/` - Session diffs
After pulling session changes, restart opencode to ensure the latest session state is loaded.

### Prompt Stash (private repos only)

Expand Down Expand Up @@ -175,6 +218,10 @@ Env var naming rules:
| `/sync-pull` | Fetch and apply remote config |
| `/sync-push` | Commit and push local changes |
| `/sync-enable-secrets` | Enable secrets sync (private repos only) |
| `/sync-sessions-backend <git\|turso>` | Switch session backend |
| `/sync-sessions-setup-turso` | Install/auth/provision Turso on this machine |
| `/sync-sessions-migrate-turso` | Bootstrap + switch from Git session sync to Turso |
| `/sync-sessions-cleanup-git` | Remove deprecated Git session artifacts after migration |
| `/sync-resolve` | Auto-resolve uncommitted changes using AI |

<details>
Expand Down
Loading
Loading