opencode-session-handoffOpenCode plugin for seamless session continuation when context windows fill up
6
202
45 in 7 days
30.1
Multi-signal model
6 months ago
2026-01-28
Install and configure
opencode.jsonWrites to this project's opencode.json — applies to this repository only.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-session-handoff@1.1.6"]
}Writes to ~/.config/opencode/opencode.json — applies to every project.
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-session-handoff@1.1.6"]
}If you want to modify the plugin locally, install it into the project and reference the local path.
shell
pnpm add -D opencode-session-handoffopencode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.
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