opencode-session-handoff
v1.1.2
Published
OpenCode plugin for seamless session continuation when context windows fill up
Maintainers
Readme
opencode-session-handoff
An OpenCode plugin for seamless session continuation when context windows fill up.
Installation
Add to your ~/.config/opencode/opencode.json:
{
"plugin": ["opencode-session-handoff"]
}Then restart OpenCode. The plugin will auto-update when new versions are released.
What it does
When your OpenCode session gets too long, use session_handoff to:
- Create a new session titled "Handoff: {previous title}"
- Transfer a compact continuation prompt (~100-200 tokens)
- Preserve your agent mode and model settings
- Open the session picker so you can switch to it
Tools
session_handoff
Creates a new session with continuation context.
Usage: Say "handoff" or "handoff <goal>"
Examples:
handoff- Creates a handoff with summary of current workhandoff implement the login feature- Creates a handoff with goal "implement the login feature"handoff fix the failing tests- Creates a handoff with goal "fix the failing tests"
Arguments (provided by the assistant):
summary(required): 1-3 sentence summary of current stategoal(optional): What the user wants to accomplish in the next session (extracted from "handoff ")next_steps(optional): Remaining tasksblocked(optional): Current blockerkey_decisions(optional): Important decisions madefiles_modified(optional): Key files changed
Auto-fetched:
- Todo list status (completed/in-progress/pending)
- Agent mode (e.g., Sisyphus, build, plan)
- Model configuration (provider + model ID)
read_session
Reads messages from the previous session for additional context.
Usage: In a handoff session, ask to "read the previous session" if you need more details.
Use sparingly—fetches the last 20 messages which uses significant tokens.
Auto-Update
The plugin checks for updates on every new session. When a new version is available:
- Updates your
opencode.jsonconfig - Invalidates the cached package
- Runs
bun install - Shows a toast notification
Restart OpenCode to apply updates.
Development
See CONTRIBUTING.md for development setup and guidelines.
How it works
- Agent provides a summary of current work
- Plugin fetches todo list and model config from current session
- Builds a compact handoff prompt
- Creates new session via
session.create - Sends the prompt via
session.promptAsync - Opens session picker via
tui.openSessions
Inspired by Amp's handoff feature.
License
MIT
