[FEATURE] Add option to auto-save session record to disk. #1266

Closed
opened 2026-02-16 17:30:12 -05:00 by yindo · 10 comments
Owner

Originally created by @insane-dreamer on GitHub (Aug 12, 2025).

Originally assigned to: @thdxr on GitHub.

It would be very useful to have the option to automatically save a record of each session (prompts + the model's commentary) to disk, for future reference. Claude Code has this in its settings.

Could be something like

  "sessions": {
    "autosave": true,
    "path": "/myproject/.opencode/sessions"
  }

this would automatically create a file (timestamp in file name) in the path at the start of a session and continuously write to it with each prompt/response.

Originally created by @insane-dreamer on GitHub (Aug 12, 2025). Originally assigned to: @thdxr on GitHub. It would be very useful to have the option to automatically save a record of each session (prompts + the model's commentary) to disk, for future reference. Claude Code has this in its settings. Could be something like ``` "sessions": { "autosave": true, "path": "/myproject/.opencode/sessions" } ``` this would automatically create a file (timestamp in file name) in the path at the start of a session and continuously write to it with each prompt/response.
yindo closed this issue 2026-02-16 17:30:12 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Aug 12, 2025):

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

  • #376: Requests a manual /export command for local session storage, which addresses similar functionality but focuses on manual export vs automatic saving

If none of these address your specific case for automatic session saving, please let us know how this issue differs.

@github-actions[bot] commented on GitHub (Aug 12, 2025): 👋 This issue might be a duplicate of existing issues. Please check: - #376: Requests a manual /export command for local session storage, which addresses similar functionality but focuses on manual export vs automatic saving If none of these address your specific case for automatic session saving, please let us know how this issue differs.
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

we actually do write everything in ~/.local/share/opencode but it's not in the best format. we're reworking our storage structure a bunch and we'll probably add opencode query <some simple language> to query out session data

@thdxr commented on GitHub (Aug 12, 2025): we actually do write everything in `~/.local/share/opencode` but it's not in the best format. we're reworking our storage structure a bunch and we'll probably add `opencode query <some simple language>` to query out session data
Author
Owner

@insane-dreamer commented on GitHub (Aug 12, 2025):

Nice! Would a plain markdown text file per session be an option? (I.e., the settings could allow the user to select the storage format).

@insane-dreamer commented on GitHub (Aug 12, 2025): Nice! Would a plain markdown text file per session be an option? (I.e., the settings could allow the user to select the storage format).
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

the storage will be raw format but we can transform it into markdown - the current /export command might work for you

@thdxr commented on GitHub (Aug 12, 2025): the storage will be raw format but we can transform it into markdown - the current `/export` command might work for you
Author
Owner

@LeonardoMor commented on GitHub (Aug 29, 2025):

But are previous sessions recalled as of right now? Is it a fresh start every time I open opencode?

@LeonardoMor commented on GitHub (Aug 29, 2025): But are previous sessions recalled as of right now? Is it a fresh start every time I open opencode?
Author
Owner

@rekram1-node commented on GitHub (Aug 29, 2025):

@LeonardoMor are you asking if memory is built in? Answer there is no as of now

@rekram1-node commented on GitHub (Aug 29, 2025): @LeonardoMor are you asking if memory is built in? Answer there is no as of now
Author
Owner

@LeonardoMor commented on GitHub (Aug 29, 2025):

@LeonardoMor are you asking if memory is built in? Answer there is no as of now

I see. So I'm right in not closing opencode for now lol

@LeonardoMor commented on GitHub (Aug 29, 2025): > @LeonardoMor are you asking if memory is built in? Answer there is no as of now I see. So I'm right in not closing opencode for now lol
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Author
Owner

@theonesud commented on GitHub (Jan 13, 2026):

i would like an option to save my sessions related to a codebase in that same folder. it'll be useful to recognize patterns around what i'm asking, and how is the agent responding. we can also use those sessions to improve the agents.md file

@theonesud commented on GitHub (Jan 13, 2026): i would like an option to save my sessions related to a codebase in that same folder. it'll be useful to recognize patterns around what i'm asking, and how is the agent responding. we can also use those sessions to improve the agents.md file
Author
Owner

@jeremyakers commented on GitHub (Jan 29, 2026):

Why was this closed? This would be a really useful feature. It could be used to help keep context small as well if we could keep conversation history on disk while compacting the in-memory context. Then if the agent needs to recall something it did earlier (Something that's now no longer in context) it could go search the on-disk history. Ideally if this could be stored in a vector database, indexed by timestamp to allow contextual search by time period, so you could do things like "Can you re-run that elaborate command you ran yesterday around this time that compiled these specific source files with that debugging flag we need"?

@jeremyakers commented on GitHub (Jan 29, 2026): Why was this closed? This would be a really useful feature. It could be used to help keep context small as well if we could keep conversation history on disk while compacting the in-memory context. Then if the agent needs to recall something it did earlier (Something that's now no longer in context) it could go search the on-disk history. Ideally if this could be stored in a vector database, indexed by timestamp to allow contextual search by time period, so you could do things like "Can you re-run that elaborate command you ran yesterday around this time that compiled these specific source files with that debugging flag we need"?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1266