A plugin for OpenCode that provides tools to search and retrieve your local chat history.
Search your local OpenCode chat history for sessions containing specific text.
Args
-
query(string, required): Text to search for (1-200 chars, non-whitespace) -
limitSessions(number, optional): Max sessions to return (1-12, default: 6)
Returns
- Matching sessions with metadata (title, directory, match count)
- Snippets from each session (2 per session, 220 chars each)
- Suggested
session-transcriptcalls and aquestion-tool prompt to let users pick which session to open
Reconstruct the full transcript of a specific chat session.
Args
-
sessionId(string, required): Session ID (e.g.,ses_xxx) -
limit(number, optional): Max entries to return (1-120, default: 80) -
order(string, optional):ascordesc(default:asc)
Returns
- Session metadata (title, slug, directory, project info)
- Full conversation entries with timestamps and roles
Add the package to your OpenCode config:
{
"plugin": ["opencode-session-search"]
}Supported config locations:
- Global config:
~/.config/opencode/opencode.json - Project config:
.opencode/opencode.json
Restart OpenCode so the plugin is loaded.
Find my recent work on authentication:
⚙ session-search [query=auth login, limitSessions=5]
Get the full conversation:
⚙ session-transcript [sessionId=ses_abc123, limit=100]
Run the same search from your terminal:
bun run search -- "auth login" --limitSessions 5This command uses the same query path as the session-search tool and prints JSON.
Install directly from this repo:
bun run install:localThis copies index.ts to:
~/.config/opencode/plugins/history.tsManual copy option:
mkdir -p ~/.config/opencode/plugins
cp index.ts ~/.config/opencode/plugins/history.tsRestart OpenCode and the tools will be available automatically.
This package follows Semantic Versioning (MAJOR.MINOR.PATCH).
-
PATCH: backward-compatible fixes -
MINOR: backward-compatible features -
MAJOR: breaking changes
Recommended release commands:
bun pm version patch
bun pm version minor
bun pm version majorThen publish:
bun publishThe plugin resolves the DB path in this order:
-
OPENCODE_DB_PATHenv var (if set) -
opencode db path(platform-aware) - Fallback:
~/.local/share/opencode/opencode.db
- Run type checks:
bun run test(orbun run typecheck) - Build distributable file:
bun run build - Preview package contents:
bun pm pack --dry-run - Confirm version bump uses SemVer (
bun pm version patch|minor|major) - Publish:
bun publish
MIT
