You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: built‑in session persistence to avoid truncated /export markdown #39641
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:
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
github-actions commentedon Jul 30, 2026
This issue might be a duplicate of existing issues. Please check:
opencode session exportto markdown or json #9387: Feature request foropencode session exportto markdown or JSON (related export/persistence functionality)github-actions commentedon Sep 30, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.