Append-only JSONL recorder for OpenCode conversation bus events (with compaction boundary rollover).
npm install opencode-conversation-recorderRecord OpenCode session bus events to append-only JSONL files per session, with an explicit split when compaction happens:
- events_0.jsonl: pre-compaction history
- events_1.jsonl: post-compaction history (starts after session.compacted)
1) Build:
``bash`
npm install
npm run build
2) Add to your OpenCode config (global ~/.config/opencode/opencode.json or project opencode.json):
`jsonc`
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["file:///ABSOLUTE/PATH/TO/opencode-conversation-recorder/dist/index.js"]
}
3) Enable recording:
`bash`
OPENCODE_CONVERSATION_RECORD=1 \
OPENCODE_CONVERSATION_RECORD_DIR=/tmp/opencode-recordings \
opencode run 'say hello world in python'
- Base directory:
- OPENCODE_CONVERSATION_RECORD_DIR if set${worktree}/.opencode/conversations
- else ${baseDir}/${sessionId}/events_0.jsonl
- Per session:
- ${baseDir}/${sessionId}/events_1.jsonl
- (after compaction)
This plugin also records system prompt snapshots emitted during LLM calls via
the experimental.chat.system.transform hook. These are written as JSONL linestype: "system.prompt"
with and payload:
`json``
{
"system": ["...system prompt segment 1...", "...segment 2..."]
}