Skip to content

[FEATURE]: built‑in session persistence to avoid truncated /export markdown #39641

Closed as not planned

Description

@emyasnikov

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

Problem

When sessions grow or are compacted,  opencode export  (and  /export  in the UI) can produce truncated markdown, missing the earliest turns of the conversation. This makes it hard to rely on OpenCode as a persistent knowledge base or audit log, especially for long debugging or refactoring sessions.

I ran into this while using OpenCode heavily and lost the beginning of several important sessions when exporting, most unfortunate it was my initial prompt with the scope which the model with smaller context forgot.

Proposed solution

Add a built‑in, opt‑in plugin (or core feature) that automatically persists full session data to disk as structured JSON, similar to my plugin which handles this quite good, but requires installation and is not fully tested:

https://github.com/emyasnikov/opencode-session-store

Key behavior:

  • On  session.created , create a session file under  .opencode/sessions/{sessionID}.json .
  • On  session.updated  / message/tool events, debounced sync of new turns to that file.
  • On  session.compacted , mark  compactedAt  but keep the full history intact.
  • Maintain a small index file  .opencode/sessions/index.json  for chronological listing.

This avoids any need for manual  /export  and guarantees that the full conversation (including tool calls, sub‑agents, and permission prompts) is always available.

Why this belongs in OpenCode:

  • Session durability is a core expectation for an AI coding assistant used as a “pair programmer” over days/weeks.
  • The current workflow relies on manual exports that are easy to forget and can be truncated.
  • A standard persistence mechanism would:
    • Make sessions reliably queryable by external tools.
    • Enable future features like “search my past sessions” or “replay a session” without ad‑hoc plugins.

Activity

  1. github-actions commented on Jul 30, 2026

    @github-actions
    Contributor

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

  2. github-actions commented on Sep 30, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions