OpenCode session data can consume substantial disk space
A report based on an online post says OpenCode’s persistent, project-specific session data—not ordinary provider cache—can account for substantial disk use because the records preserve complete, replayable histories. It recommends using du to inspect OpenCode’s data and cache directories, clearing ~/.cache/opencode when appropriate, and archiving session data before deletion. The post’s headline claim of 100GB was not independently verified in the supplied report.
The report offers a way for users to distinguish rebuildable provider cache from persistent session records that may be needed to resume work, review changes, hand off context, or preserve team history.
磁盘少了上百 G,很多人第一反应是去查模型缓存、查 IDE 插件,翻到最后才发现,元凶是那个天天在用的 Coding Agent。热点帖《opencode 的"恶果"来了,吃掉 100G 空间》里,作者就是被自己的 Agent 工具悄悄占满了硬盘。这篇文章拆开 Agent 工具的本地数据目录,说清空间都花在哪、哪些能删、哪些删了会后悔,最后给一条今天就能跑的排查命令。
会话数据是最大的一块,而且它不是缓存
Coding Agent 吃空间的主体,是按项目全量落盘的会话数据,而不是通常意义上的缓存。
机制要从工作方式说起:Agent 必须把每一轮对话、每一次工具调用的输入输出都记下来。你想恢复一个会话继续改代码,靠的就是这些持久化记录;工具要在长会话里重建上下文,同样依赖它们。所以这类数据的设计目标是完整、可回放,而不是用完就扔。它不像浏览器缓存有上限、有淘汰策略,只要你一直用,它就一直涨。