Skip to content

[FEATURE]: clean opencode db #55366

Closed as duplicate
Closed as duplicate

Description

@s-b-repo

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

delete unused info from db after 6 months my db on a work laptop build upto 46 gbs i only have 500

Activity

  1. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for the request! I think this is a duplicate of #16101, which asks for automatic retention and cleanup of old session data in opencode.db (time-based cleanup, auto-archiving, reclaiming space).

    Possible duplicates and closely related issues, ordered from most to least likely:

    If your request is different from #16101, please reply here and explain how. Otherwise the bot will close this issue as a duplicate in 1 day. Please add your 46 GB data point and your OpenCode version (opencode --version) to #16101 or #33356.

  2. s-b-repo commented on Oct 14, 2026

    @s-b-repo
    Author

    Thanks for the request! I think this is a duplicate of #16101, which asks for automatic retention and cleanup of old session data in opencode.db (time-based cleanup, auto-archiving, reclaiming space).

    Possible duplicates and closely related issues, ordered from most to least likely:

    * [[FEATURE]: Session Lifecycle Management — unified storage reclamation, auto-archival, and child session cleanup #16101](https://github.com/anomalyco/opencode/issues/16101): feature request for session lifecycle management: a time limit on stored data, auto-archiving and storage reclamation. This is the same as what you're asking for.
    
    * [Unbounded growth of the `event` table: opencode.db reaches 13GB+, mostly `message.updated.1` snapshots (no retention/compaction) #33356](https://github.com/anomalyco/opencode/issues/33356): `opencode.db` grows without limit (13 GB and more) because the `event` table is never cleaned up. One commenter reports about 50 GB after a few months, so this is likely why your database got so large.
    
    * [feat(cli): add session prune command to v2 #51255](https://github.com/anomalyco/opencode/pull/51255): an open pull request that adds an `opencode session prune <duration>` command to delete sessions older than a given age.
    
    * [[FEATURE]: V2 offline SQLite inspection, verified backups and vacuum #54618](https://github.com/anomalyco/opencode/issues/54618): request for v2 tools to inspect, back up and vacuum the database.
    
    * [v2: define snapshot retention and disk GC policy #36093](https://github.com/anomalyco/opencode/issues/36093): retention and cleanup for the file snapshot store, which also takes up disk space.
    

    If your request is different from #16101, please reply here and explain how. Otherwise the bot will close this issue as a duplicate in 1 day. Please add your 46 GB data point and your OpenCode version (opencode --version) to #16101 or #33356.

    its not a session issue its the installed opencode db it self

  3. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for clarifying! You're right, this is about the opencode.db file itself. That file holds your OpenCode data: projects, sessions, messages and an internal event log. In the large databases measured in #33356, over 90% of the file was that event log. It stores a full copy of a message on every update and is never trimmed. That issue is about exactly the database file growing to many GB, and one commenter there reports about 50 GB after a few months, like yours.

    So it still looks like a duplicate, now with #33356 as the closest match. Ordered by likelihood:

    If you can, please add your OpenCode version (opencode --version) and the full path and size of the 46 GB file to #33356. If the large file turns out not to be opencode.db, for example something under the snapshot/ folder, reply here and I'll look again. Otherwise the bot will close this issue as a duplicate on 2026-10-15.

  4. s-b-repo commented on Oct 14, 2026

    @s-b-repo
    Author

    Thanks for clarifying! You're right, this is about the opencode.db file itself. That file holds your OpenCode data: projects, sessions, messages and an internal event log. In the large databases measured in #33356, over 90% of the file was that event log. It stores a full copy of a message on every update and is never trimmed. That issue is about exactly the database file growing to many GB, and one commenter there reports about 50 GB after a few months, like yours.

    So it still looks like a duplicate, now with #33356 as the closest match. Ordered by likelihood:

    * [Unbounded growth of the `event` table: opencode.db reaches 13GB+, mostly `message.updated.1` snapshots (no retention/compaction) #33356](https://github.com/anomalyco/opencode/issues/33356): `opencode.db` grows without limit because the `event` table is never cleaned up. This is the same database file.
    
    * [[FEATURE]: Session Lifecycle Management — unified storage reclamation, auto-archival, and child session cleanup #16101](https://github.com/anomalyco/opencode/issues/16101): request for automatic retention and cleanup of old data in `opencode.db`.
    
    * [[FEATURE]: V2 offline SQLite inspection, verified backups and vacuum #54618](https://github.com/anomalyco/opencode/issues/54618): request for tools to inspect, back up and vacuum the database.
    
    * [v2: define snapshot retention and disk GC policy #36093](https://github.com/anomalyco/opencode/issues/36093): retention for the separate `snapshot/` folder, in case that's where the space actually goes.
    

    If you can, please add your OpenCode version (opencode --version) and the full path and size of the 46 GB file to #33356. If the large file turns out not to be opencode.db, for example something under the snapshot/ folder, reply here and I'll look again. Otherwise the bot will close this issue as a duplicate on 2026-10-15.

    im on the latest version

  5. opencode-agent commented on Oct 14, 2026

    @opencode-agent
    Contributor

    Thanks for confirming! The latest version (currently v2.0.29) still has no automatic cleanup for opencode.db: nothing removes old data from the event log or shrinks the file. So this is still the problem tracked in #33356, with #16101 asking for the automatic cleanup you describe. Adding a 👍 and your 46 GB data point there will help maintainers see how common this is.

    This issue will still be closed as a duplicate of #33356 on 2026-10-15. If the 46 GB turns out to be something other than opencode.db (for example the snapshot/ folder next to it), reply here before then.

  6. opencode-agent commented on Oct 15, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #33356, which tracks opencode.db growing without limit because its event log is never trimmed. The request for automatic cleanup of old data is tracked in #16101. Please follow those two issues, and adding your 46 GB data point and version there would help. Thanks for the report! If the large file turns out to be something other than opencode.db, reply here and we can take another look.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions