pi-opencode-session-import
Import OpenCode sessions into native vanilla-Pi and OMP sessions
Package details
Install pi-opencode-session-import from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-opencode-session-import- Package
pi-opencode-session-import- Version
0.1.0- Published
- May 27, 2026
- Downloads
- not available
- Author
- jms830
- License
- MIT
- Types
- extension
- Size
- 61.1 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./adapters/pi/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-opencode-session-import
Import OpenCode sessions into native vanilla-Pi (@earendil-works/pi-coding-agent) and OMP (@oh-my-pi/pi-coding-agent) sessions.
Runs OpenCode's SQLite database in read-only mode, converts a selected session into a native Pi/OMP session, and switches the agent into it. Bulk import, filters, idempotent registry, and dry runs included.
Features
/opencode-importslash command- Interactive session selector
list,status,all,all --dry-run,open <ses_id>subcommands- Filters:
--cwd,--since,--updated-since,--limit,--max-tool-chars - Idempotent per-runtime import registry (
~/.pi/agent/opencode-import-registry.json,~/.omp/agent/opencode-import-registry.json) - OpenCode tool calls preserved as text — never re-emitted as runtime
toolCallblocks - Reads OpenCode DB read-only and asserts mtime is unchanged after each import
Install
Vanilla Pi
pi install /path/to/pi-opencode-session-import
…or add the absolute repo path to ~/.pi/agent/settings.json:packages[].
OMP
Symlink the OMP adapter into OMP's discovery directory:
ln -s /path/to/pi-opencode-session-import/adapters/omp ~/.omp/agent/extensions/opencode-import
…or add ./adapters/omp/index.ts to your ~/.omp/agent/settings.json:extensions[].
Usage
/opencode-import # interactive selector
/opencode-import ses_xxx # import a specific session
/opencode-import list [search]
/opencode-import status
/opencode-import all --dry-run # preview bulk import
/opencode-import all # bulk import, idempotent
/opencode-import open ses_xxx # switch to an already-imported session
Flags:
--db /path/to/opencode.db
--registry /path/to/registry.json
--limit 100
--cwd /repo/path
--since 2026-05-01
--updated-since 2026-05-15
--max-tool-chars 0 (0 = drop historical tool output)
--force (reimport even when already in registry)
--dry-run
Requirements
sqlite3on PATH (CLI is invoked with-readonly -json)- Bun runtime (Pi and OMP both run Bun)
- OpenCode DB at
${XDG_DATA_HOME:-~/.local/share}/opencode/opencode.db(override with--db)
Safety
- OpenCode DB is opened with
sqlite3 -readonly - Each import asserts the DB mtime did not change
- Imports never produce native
toolCallblocks — OpenCode tool history is serialized as text inside assistant messages - Per-runtime registry prevents accidental double-imports
Tests
bun test