Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
OpenCode already has a sync-event architecture internally, but external integrations still do not have a stable, durable way to consume session history as an append-only machine-readable stream.
Today, the practical options are snapshot-oriented (export), mutable session state, or live SSE. That makes external archival / replay / checkpointed ingestion harder than it needs to be, especially around compaction, revert, and long-running automation.
One concrete consumer on our side is open-agent-stream, a local-first adapter pipeline that currently supports Codex and Claude and is evaluating OpenCode support.
The ask here is not to replace OpenCode's mutable session tables. Those seem like valid read models for the UI/server. The ask is to expose a durable integration surface alongside them.
Proposed solution
Either of these would solve the core problem:
- Persist sync events by default as a supported non-experimental feature.
- Add a stable export/replay surface for them, for example:
opencode export-events [sessionID] --format jsonl --since <cursor>or an equivalent HTTP endpoint with cursorable replay.
What this surface should guarantee
- Append-only, versioned schema suitable for external consumers.
- Historical replay plus live tailing.
- Coverage for user/assistant messages, tool calls/results, compaction boundaries, revert/remove operations, and session metadata changes.
- Durable behavior across restarts and compaction.
- Documentation of the event contract as public API, not just internal implementation detail.
Why this differs from related issues
Several existing issues ask for session export, full transcript retention, human-readable logs, or hook compatibility. This request is narrower and more infrastructural: a durable machine-consumable contract for external integrations.
That would let tools ingest OpenCode without scraping mutable SQLite state or depending on TUI/web-only export behavior.
Related issues
- How does our client access OpenCode CLI context in real-time via Bash? (i.e. Logging API) #10592 Logging / real-time bash access to context
- [FEATURE]:
opencode session exportto markdown or json #9387 Session export to markdown/json - [FEATURE]:Add pre-compaction hook for session save/export #14164 Pre-compaction save/export hook
- [FEATURE]: Track & save the actual FULL session transcript across compactions #16765 Full transcript across compactions
- Native Claude Code hooks compatibility (PreToolUse, PostToolUse, Stop) #12472 Claude Code hook compatibility (
transcript_pathuse case) - [FEATURE]: Session logging as OpenAI messages #7535 Session logging as OpenAI messages
- Can I get an easily human readable log file with plain text that just shows the whole conversation? #3274 Human-readable whole-conversation log
- [FEATURE]:Save conversation history locally #19017 Save conversation history locally
If this direction is acceptable, I would be happy to help with a scoped follow-up proposal around event shape, cursor semantics, and a minimal export-events CLI.
Activity
github-actions commentedon Mar 29, 2026
This issue might be a duplicate of existing issues. Please check:
If #19567 is the intended issue, please close this one.
perendipity commentedon Mar 29, 2026
Closing as an accidental duplicate of #19567. Keeping the discussion there.