OpenCode

OpenCode (open-source terminal coding agent) session database, logs, snapshots, and configuration

  • 13 paths
  • opencode*.db**.json*
  • Per-user data
  • Version 1
  • Eric Capuano

Paths on disk

13 paths

Notes

OpenCode uses the xdg-basedir package, which has no Windows branch, so on Windows it writes under the user profile rather

than AppData: %USERPROFILE%\.local\share\opencode (data), %USERPROFILE%\.config\opencode (config), %USERPROFILE%\.local\state\opencode

(state), %USERPROFILE%\.cache\opencode (cache). XDG_DATA_HOME / XDG_CONFIG_HOME / XDG_STATE_HOME / XDG_CACHE_HOME relocate

these; OPENCODE_CONFIG and OPENCODE_CONFIG_DIR point at alternate config. Confirmed on Windows Server 2025 with OpenCode 1.18.26

after running a real session: opencode.db, log\opencode.log, .local\state\opencode\locks and .config\opencode\opencode.jsonc were created.

Project-level opencode.json(c) and .opencode\ folders live inside repositories and are not collected; the project and

project_directory tables in opencode.db list every directory the agent was run in.

Deliberately not collected: auth.json and mcp-auth.json (API keys and OAuth tokens), repos\ (cloned plugin sources),

.cache\opencode\ (binaries and models.json), %TEMP%\opencode\.

References

5 links