Skip to main content

opencode-db

Python License

CLI for OpenCode's local database. OpenCode saves every agent session, conversation, token usage, and cost in a local SQLite file. This tool lets you inspect, export, analyze, and clean up that data.

pip install opencode-db

# recommended if your system python3 is older than 3.12:
uv tool install opencode-db

Quick start

opencode-db list         # recent sessions
opencode-db view         # interactive session viewer (colored, scrollable)
opencode-db stats        # database summary
opencode-db costs --total  # total token costs
opencode-db export       # export dialog to .md (interactive)
opencode-db help         # full reference

Features

  • view — просмотр сессии в терминале с ANSI-цветами, Markdown-рендерингом и прокруткой через less
  • list / info / search / tree — навигация и поиск по сессиям
  • export — экспорт диалога в Markdown (с поддержкой Obsidian)
  • delete / prune — удаление и массовая очистка с фильтрами
  • costs / stats — аналитика токенов и расходов
  • --db-path / OPENCODE_DB — кастомный путь к БД

Optional extras

pip install opencode-db[rich]   # enhanced Markdown rendering (recommended)
pip install opencode-db         # zero external dependencies

Requirements

  • Python 3.12+ — the CLI checks the interpreter at startup and exits with a clear message instead of an ImportError on older versions
  • OpenCode (must have been run at least once)
  • macOS / Linux

Metadata

Release files for opencode-db 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opencode-db 0.7.2
File Size Uploaded Provenance
opencode_db-0.7.2.tar.gz 55.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opencode-db 0.7.2
File Interpreter ABI Platform
opencode_db-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 106.0 kB

Release files / opencode_db-0.7.2.tar.gz

Download URL opencode_db-0.7.2.tar.gz
Size 55.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f1990460aa1eca4331cb907d220aef078ffdbfd95fa687a5f2042de94a7fc912
BLAKE2b-256 checksum
How to use checksums
4cb6e0d99a8ea6cd130d0c9c1a8660d55de630b76b9fd13c372706844138f6d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / opencode_db-0.7.2-py3-none-any.whl

Download URL opencode_db-0.7.2-py3-none-any.whl
Size 50.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4dc4c97c4981a2db4cb82a1e07535dcc42a5b8e8da9da828121d58d28f4e70a
BLAKE2b-256 checksum
How to use checksums
6ccae3fc30e354626bf41f1259e413e85e97ba810aebaff939f308b355af5b5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for opencode-db 0.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for opencode_db-0.7.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page