opencode-restart
v0.0.13
Published
OpenCode plugin that restarts the current instance and rejoins the session with a continuation message
Downloads
1,028
Maintainers
Readme
opencode-restart
OpenCode plugin that restarts the current instance and rejoins the session with a continuation message. Useful for testing plugins that need a fresh process.
Install
npm install opencode-restartConfigure
Add to your opencode.json:
{
"plugin": {
"opencode-restart": true
}
}How it works
The plugin provides a restart tool that:
- Writes a restart marker file (
.opencode-restart.json) with the session ID and continuation message - Spawns a shell process that waits for the current server to shut down, then launches a new
opencodeinstance - Disposes the current instance, which causes the server to exit
- The spawned shell detects the shutdown and starts a fresh
opencodeprocess - On startup, the plugin finds the marker file, removes it, and sends the continuation message to the original session
Usage
The AI agent can call the restart tool:
restart({ message: "Restarted successfully. Continuing where we left off." })Files
The plugin creates a temporary .opencode-restart.json marker file in the project directory during restart. Add it to your .gitignore:
.opencode-restart.jsonLicense
MIT
