opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: add env vars for complete portable mode and isolation support

Open Robitx opened this issue 1 day ago • 1 comments

Summary

  • Add OPENCODE_DATA_DIR environment variable to override the data directory location
  • Add OPENCODE_CACHE_DIR environment variable to override the cache directory location
  • Add OPENCODE_LOG_DIR environment variable to override the log directory location
  • Add OPENCODE_STATE_DIR environment variable to override the state directory location
  • Enables complete portable mode when combined with OPENCODE_CONFIG_DIR
  • Allows running multiple sandboxed/independent OpenCode instances on the same device
  • Update documentation in cli.mdx, config.mdx, plugins.mdx, and troubleshooting.mdx

Use Cases

  • Portable mode: Store all OpenCode data, cache, logs, and state alongside config in a single directory for easy sync across devices (e.g., USB drive, cloud storage)
  • Isolated instances: Run multiple independent OpenCode instances on the same machine with completely separate data directories, caches, logs, and state
  • Testing/development: Sandbox OpenCode for testing without affecting your main installation
  • Custom deployments: Point all OpenCode storage to non-standard locations for containerized or restricted environments

Closes #4526 Closes #8968

Robitx avatar Jan 16 '26 21:01 Robitx