Skip to content

[FEATURE]: Durable event export / replay surface for external integrations #19568

Closed

Description

@perendipity

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:

  1. Persist sync events by default as a supported non-experimental feature.
  2. 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

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

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 29, 2026
  2. github-actions commented on Mar 29, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If #19567 is the intended issue, please close this one.

  3. perendipity commented on Mar 29, 2026

    @perendipity
    Author

    Closing as an accidental duplicate of #19567. Keeping the discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions