OpenCode Session Depot
opencode_depotSession depot: list, inspect, archive/unarchive, rename, delete, search transcripts, semantic RAG search, code-recall search, or stats.
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="search", query="vienna", project="chitchat", timeframe_days=7) 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") opencode_depot(action="star", session_id="sess_01") opencode_depot(action="tag_add", session_id="sess_01", tags="neuro, vienna") opencode_depot(action="list", starred=True, sort="starred") opencode_depot(action="export", session_id="sess_01", format="docx") opencode_depot(action="memops", session_id="sess_01", tags="neuro")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | List/search: only sessions carrying this tag | |
| sort | No | Sort order (list); 'starred' puts favourites first | updated |
| tags | No | tag_add/tag_remove: comma-separated tags, e.g. 'neuro, vienna' | |
| 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). search filters: query + optional timeframe_days (last N days), project (directory/project_id substring), include_archived, starred (true = only favourites), tag. star / unstar: toggle a favourite (sidecar db, never touches opencode.db). tag_add / tag_remove: attach/detach tags (tags param, comma-separated). tags: list every tag with usage counts. export: write md/html/docx to out_path (docx needs LibreOffice). memops: drop a frontmatter note into the advanced-memory inbox. 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. | |
| format | No | export: output format (docx requires LibreOffice installed) | md |
| offset | No | Page offset (list) | |
| search | No | Title substring filter (list) | |
| status | No | Status filter (list): all, active, or archived | all |
| date_to | No | Search/list: explicit range end YYYY-MM-DD (takes precedence over timeframe_days) | |
| project | No | Project/directory substring filter (list) | |
| starred | No | List/search: true = only favourites, false = only unstarred, null = no constraint | |
| out_path | No | export: destination file (default ~/Downloads) | |
| date_from | No | Search/list: explicit range start YYYY-MM-DD (takes precedence over timeframe_days) | |
| 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 | |
| timeframe_days | No | Search/list: parts/sessions from the last N days (e.g. 7 = last week) | |
| include_archived | No | Search: include archived sessions |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| message | Yes | ||
| success | Yes |