anomalyco / anomalyco/opencode
[FEATURE]: run export/import without booting a project instance
@kitlangton is already working on this.
Since Aug 14, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Feature hasn't been suggested before.
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.