Repository navigation
Description
Problem
If a user accidentally initializes a .git repo in a very high-level directory like $HOME or a broad workspace root, OpenCode's snapshot system can treat that whole tree as one giant repo and snapshot far too much data.
I hit this in practice after accidentally creating a git repo in my home directory. OpenCode then kept snapshotting that repo and the snapshot store ballooned massively.
What happened
On macOS, my machine suddenly dropped from hundreds of GB free to almost no free space.
The culprit ended up being OpenCode snapshot data:
du -sh ~/.local/share/opencode/snapshot/* | sort -hrOutput looked like this:
424G .../snapshot/global
1.2G .../snapshot/a36e09...
164M .../snapshot/17143e...
The global snapshot directory was a bare git repo with roughly 401GB of pack files.
Root cause on my side: I had accidentally created a .git repo in $HOME, so OpenCode was effectively snapshotting everything under it - caches, binaries, node_modules, NuGet packages, and other large directories.
I just reproduced the same class of mistake again in another parent folder (~/Developer/bradystroud) and caught it before it blew up, which suggests this is an easy footgun.
Why this seems worth fixing
This is partly user error, but it feels like a very expensive failure mode for a common mistake:
- accidentally creating a repo in
$HOME - accidentally creating a repo in a broad workspace root
- opening/running OpenCode there and letting snapshots accumulate silently
The storage growth can be extreme before the user realizes what is happening.
Suggested improvements
Any one of these would help a lot:
- detect and warn when the git root is unusually broad (
$HOME, desktop, top-level workspace folder, etc.) - refuse or require confirmation before snapshotting repos above a certain size / file count threshold
- exclude known heavy directories more aggressively (
node_modules, package caches, build outputs, SDKs, etc.) when the repo root is suspiciously broad - surface snapshot size growth in the UI/CLI so users notice it earlier
- add a cleanup command or documented recovery flow for oversized snapshot stores
Recovery
What fixed it for me was deleting the oversized snapshot contents and removing the accidental top-level .git repo.
Context
I also wrote up the incident here with the exact numbers and cleanup steps:
https://bradystroud.dev/blogs/opencode-ate-my-storage
Activity
github-actions commentedon Mar 24, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue might be a duplicate of existing issues. Please check:
.gitin home dir, snapshot fills disk), same suggested fixesIf you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Mar 24, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.