anomalyco / anomalyco/opencode
[FEATURE]: built‑in session persistence to avoid truncated /export markdown
@kitlangton is already working on this.
Since Jul 30, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
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
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.