@wafonro2/opencode-resurrect
v0.1.1
Published
OpenCode plugin that saves and restores the latest session per project
Maintainers
Readme
opencode-resurrect
OpenCode plugin that saves the active session ID in the project folder and restores that session when OpenCode starts.
What it does
- Listens for
session.created,session.updated, andsession.deletedevents. - Writes
<project root>/.opencode-session-<YYYYMMDD-HHMMSSmmm>.txtcontaining only the session ID. - Avoids redundant writes by caching the last value written for each file.
- On startup, restores the most recent saved session in that project.
Install from npm (recommended)
Add the published package to your OpenCode config.
Project config (opencode.json in your repo root):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect"]
}Global config (~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@wafonro2/opencode-resurrect"]
}Then restart opencode. OpenCode installs npm plugins automatically at startup.
Verify it works
- Start
opencodein a project. - Create or update a session.
- Confirm a file like
.opencode-session-20260411-021857123.txtappears in the project root. - Restart
opencodein the same project and confirm the session restores automatically.
Local development install (optional)
For local file-based plugin loading during development:
./install.sh --globalinstalls to~/.config/opencode/plugins/../install.sh --project /path/to/projectinstalls to/path/to/project/.opencode/plugins/.
