Skip to content

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

Closed

Description

@insane-dreamer

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.

Activity

  1. changed the title [-][FEATURE] Add option to auto-save session to disk.[/-] [+][FEATURE] Add option to auto-save session record to disk.[/+] on Aug 12, 2025
  2. github-actions commented on Aug 12, 2025

    @github-actions
    Contributor

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

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

  3. thdxr commented on Aug 12, 2025

    @thdxr
    Member

    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

  4. insane-dreamer commented on Aug 12, 2025

    @insane-dreamer
    Author

    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).

  5. thdxr commented on Aug 12, 2025

    @thdxr
    Member

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

  6. self-assigned this
    on Aug 12, 2025
  7. LeonardoMor commented on Aug 29, 2025

    @LeonardoMor

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

  8. rekram1-node commented on Aug 29, 2025

    @rekram1-node
    Contributor

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

  9. LeonardoMor commented on Aug 30, 2025

    @LeonardoMor

    @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

  10. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

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

  11. theonesud commented on Jan 13, 2026

    @theonesud

    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

  12. jeremyakers commented on Jan 29, 2026

    @jeremyakers

    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"?

  13. soundstep commented on Apr 7, 2026

    @soundstep

    @rekram1-node I was looking for that too, can we re-open please?
    Some kind of

    opencode --autosave-session [options]

    Or config based.

  14. thefonso commented on Jun 14, 2026

    @thefonso

    Re-open pretty please?

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