oc-transcript-save
v0.0.4
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
- Install dependencies:
bun install- The plugin exports
TranscriptSavePluginwhich can be registered with your OpenCode instance.
Configuration
Environment Variables
| Variable | Description | Default |
| -------------------------- | ---------------------------------------- | -------------------------------- |
| OC_TRANSCRIPT_SAVE_PATH | Directory where markdown files are saved | os.tmpdir()/oc-transcript-save |
| OC_TRANSCRIPT_SAVE_DEBUG | Enable debug logging (1 or true) | false |
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:
- session.status: Triggers when session becomes idle
- session.idle: Explicit idle state trigger
- Prefetches during busy/retry states for performance
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
