OpenCode Session Depot
opencode_depotManage and search opencode session archives: list, inspect, archive, restore, rename, delete, full-text search, semantic RAG, and code-recall. Reads SQLite depot directly.
Instructions
Session depot: list, inspect, archive/unarchive, rename, delete, search transcripts, semantic RAG search, code-recall search, or stats.
Reads opencode's SQLite depot directly - works without opencode serve.
Archive/unarchive/rename are reversible; delete is permanent (FK cascade).
search = exact/full-text wayback find; rag = semantic similarity over
indexed transcripts; code = when an agent touched a file (patch paths +
edit tool inputs), by path or by content. rag/code need
uv sync --extra rag and an index pass (rag_index indexes both).
Return Format
{"success": bool, "message": str, "data": dict}
Examples
opencode_depot(action="list", status="archived", limit=20) opencode_depot(action="unarchive", session_id="sess_01") opencode_depot(action="search", query="power limit") opencode_depot(action="rag", query="what did we decide about the power limit") opencode_depot(action="code", path_filter="auth_utils.py") opencode_depot(action="code", query="extracted the auth module", path_filter="src") opencode_depot(action="rag_index") opencode_depot(action="stats")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | Sort order (list) | updated |
| agent | No | Agent name filter (list) | |
| limit | No | Page size (list/search/rag/code) | |
| query | No | Search text (search/rag/code) | |
| title | No | New title (rename) | |
| action | Yes | list: sessions with filters. get: one session with counts. archive: hide from active list. unarchive: restore (missing in opencode UI). rename: set title. delete: permanently remove (cascades messages). search: full-text across transcripts and titles (wayback find). rag: semantic search over indexed transcripts (needs rag extras). rag_index: index new sessions for semantic search (text + code). rag_status: index state + availability. code: find WHEN an agent touched a file - by path (path_filter only) or by content (query): patch paths + edit tool inputs from every session. code_index: rebuild the code table from all sessions (code-only backfill). code_status: code index state. stats: aggregate cost/tokens by agent/project. | |
| offset | No | Page offset (list) | |
| search | No | Title substring filter (list) | |
| status | No | Status filter (list): all, active, or archived | all |
| project | No | Project/directory substring filter (list) | |
| session_id | No | Session ID (required for get/archive/unarchive/rename/delete) | |
| path_filter | No | File path substring (code): only rows whose path contains this |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||