You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: run export/import without booting a project instance #42490
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
opencode export reads session rows and prints them, but boots a full project instance to do it: config load, plugin init, and the LSP forks. With any plugin configured, plugin init npm-installs into the config dir before a single row is read. db already declares instance: false at three call sites, and export yields only Session.Service, which the app runtime provides — so for export this is a one-line change. Happy to PR it.
import is why this is a question rather than a patch. It reads three things off InstanceRef (project id, directory, worktree) that are all reachable another way — but nothing in the import path creates the project row the imported session's project_id points at. That row appears as a side effect of instance boot (Project resolve inserts it) or of session creation (packages/core/src/session.ts does an onConflictDoNothing insert). With PRAGMA foreign_keys = ON that side effect is load-bearing: drop the instance and a cold import into a fresh workspace has nothing to satisfy the foreign key. Should import ensure the project row itself, the way session creation does? If that's the right shape I'll PR both.
Context: we drive opencode over ACP and spawn opencode export once per turn to persist transcripts, so the instance boot is a per-turn cost.
Same root cause as #37435, and its PR (#37477) covers session list only — so the export half here is complementary: the same one-line pattern on a different command. The import half is the part that sweep can't take mechanically: import writes a session row whose project_id row only exists because the instance boot created it (foreign_keys is ON), so import needs the project row ensured before it can drop the instance. That contract question is what this issue is really asking.
Activity
github-actions commentedon Aug 14, 2026
This issue might be a duplicate of existing issues. Please check:
InstanceBootstrapfor read-only CLI commands (specificallysession list); yourexportfix is the same one-line pattern proposed thereinstance: falsefor session/export/stats commandscameronalizadeh-distyl commentedon Aug 14, 2026
Same root cause as #37435, and its PR (#37477) covers
session listonly — so the export half here is complementary: the same one-line pattern on a different command. The import half is the part that sweep can't take mechanically: import writes a session row whose project_id row only exists because the instance boot created it (foreign_keys is ON), so import needs the project row ensured before it can drop the instance. That contract question is what this issue is really asking.github-actions commentedon Oct 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.