Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add dzianisv/opencode-plugins --skill opencode-session-dbgit clone --depth 1 https://github.com/dzianisv/opencode-pluginsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/dzianisv/opencode-plugins/opencode-session-db)<a href="https://agentmods.dev/skills/dzianisv/opencode-plugins/opencode-session-db"><img src="https://agentmods.dev/badge/skills/dzianisv/opencode-plugins/opencode-session-db/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/dzianisv/opencode-plugins/opencode-session-db"><img src="https://agentmods.dev/badge/skills/dzianisv/opencode-plugins/opencode-session-db.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00096 | $0.02489 |
| Opus 5.5 | $0.00038 | $0.00996 |
| Sonnet 5.5 | $0.00019 | $0.00498 |
| Haiku 4.5 | $0.00010 | $0.00249 |
Grade A, and why
opencode-session-db scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.
OpenCode Session DB
Read OpenCode sessions and messages directly from SQLite — no running server needed.
Database Location
~/.local/share/opencode/opencode.db # latest/beta channel
~/.local/share/opencode/opencode-{channel}.db # dev, local, etc.
Override: OPENCODE_DB env var. WAL mode is enabled; always open read-only.
Schema Overview
11 tables. The key ones for session reading:
| Table | PK | Key columns |
|---|---|---|
project |
id |
worktree, name |
session |
id |
project_id, title, slug, directory, time_created, time_updated, time_archived |
message |
id |
session_id, time_created, data (JSON: role, tokens, cost, model, error) |
part |
id |
message_id, session_id, time_created, data (JSON: type, text, tool info) |
todo |
(session_id, position) |
content, status, priority |
Message data JSON structure
{"role": "user"|"assistant", "tokens": {...}, "cost": N, "model": {...}, "error": {...}}
Part data JSON structure — discriminated by type
text—{type:"text", text:"..."}tool—{type:"tool", tool:"toolName", input:{...}, output:"...", state:"completed"|"error"|...}reasoning—{type:"reasoning", text:"..."}step-start/step-finish— step boundariessnapshot/patch/compaction— context managementfile— file referencesagent/subtask— delegation
Common Queries
Always open read-only: sqlite3 -readonly "$DB"
# Set DB path
DB=~/.local/share/opencode/opencode.db
List recent sessions
SELECT s.id, s.title, datetime(s.time_created/1000, 'unixepoch') as created,
datetime(s.time_updated/1000, 'unixepoch') as updated, p.name as project
FROM session s JOIN project p ON s.project_id = p.id
WHERE s.time_archived IS NULL
ORDER BY s.time_updated DESC LIMIT 20;
Search sessions by title
SELECT id, title, datetime(s.time_updated/1000, 'unixepoch') as updated
FROM session s WHERE title LIKE '%search term%'
ORDER BY time_updated DESC;
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 3mo ago First seen · 282 lines · 96 tokens per session scan A 0a29f9d5e0f9
opencode-session-db is a skill published in the GitHub repository dzianisv/opencode-plugins (11 stars, last pushed 5mo ago), licensed MIT. It adds 96 tokens to every session and 2,489 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
opencode-session-db compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| opencode-session-dbdzianisv/opencode-plugins | Skill | 11 | 5mo ago | MIT | A | 96 | Claude Code, Codex |
| picko-es-tag-distributiondeepcoldy/botmux | Skill | 2.2k | yesterday | MIT | A | 109 | Claude Code, Codex |
| aoe-invariantsagent-of-empires/agent-of-empires | Skill | 5.3k | today | MIT | A | 92 | Claude Code, Codex |
| cmux-backendmanaflow-ai/cmux | Skill | 29k | today | none | A | 53 | Codex |
| cqrsDVNghiem/FlowDeck | Skill | 44 | 16d ago | MIT | A | 17 | Claude Code, Codex |
| postgres-patternsDVNghiem/FlowDeck | Skill | 44 | 16d ago | MIT | A | 17 | Claude Code, Codex |
| db-sculptorEliasOulkadi/shokunin | Skill | 112 | 1mo ago | MIT | A | 123 | Claude Code |