oc-transcript-save
v0.2.3
Published
OpenCode plugin that autosaves full transcript in specified directory
Readme
oc-transcript-save
An OpenCode plugin that automatically saves full session transcripts to markdown files.
Features
- Automatic saving: Exports transcripts when sessions become idle
- Rich markdown output: Messages, tool calls, reasoning, files, and todos formatted as readable markdown
- YAML frontmatter: Session metadata (ID, title, timestamps) embedded in document header
- Smart caching: Prefetches data during sessions for faster saves
- Change detection: Skips redundant writes when content hasn't changed
- Atomic writes: Uses temp files to prevent corrupted output
- Configurable output: Customizable save directory via environment variable
- Debug logging: Optional verbose logging for troubleshooting
Installation
Requires OpenCode v2. Add the plugin to opencode.json(c):
{
"plugins": ["oc-transcript-save@latest"]
}OpenCode installs the package and loads it automatically. Transcripts are written on every turn the session goes idle.
OpenCode v1? Pin the legacy release:
"plugin": ["[email protected]"], or import the V1 entrypoint explicitly viaoc-transcript-save/v1.
Configuration
Environment Variables
| Variable | Description | Default |
| -------------------------- | ---------------------------------------- | ----------------------------------- |
| OC_TRANSCRIPT_SAVE_PATH | Directory where markdown files are saved | ~/.local/share/oc-transcript-save |
| OC_TRANSCRIPT_SAVE_DEBUG | Enable debug logging (1 or true) | false |
By default, transcripts are stored under the XDG data home ($XDG_DATA_HOME
or ~/.local/share) — the same area OpenCode itself uses — and never inside
your project directory. Override with OC_TRANSCRIPT_SAVE_PATH.
Output File Format
Files are named: {timestamp}-{session-id}.md
Example: 2026-03-11-09-30-45-abc123.md
Output Structure
Each markdown file contains:
---
session_id: abc123
title: "Session Title"
created_at: "2026-03-11T09:30:45.000Z"
updated_at: "2026-03-11T09:45:30.000Z"
---
### User
Your message content...
---
### Agent
Response with reasoning, tool calls, etc.Usage
The plugin automatically hooks into OpenCode events:
- OpenCode v2: exports when a turn ends (
session.execution.succeeded,.failed, or.interrupted) - OpenCode v1: exports when the session becomes idle (
session.status/session.idle)
No manual invocation needed—it runs automatically as you work.
Development
Run type checking:
bun run checkFormat code:
bun run fmtLicense
MIT
Repository
https://github.com/mdrv/oc-transcript-save
