Skip to content

Conversation

@Robitx
Copy link

@Robitx Robitx commented Jan 16, 2026

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

Allow users to override the data directory location via the OPENCODE_DATA_DIR environment variable. This enables full portable mode when combined with OPENCODE_CONFIG_DIR.

Closes anomalyco#4526
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@Robitx Robitx changed the title feat: add OPENCODE_DATA_DIR env var feat: add env vars for complete portable mode and isolation support Jan 16, 2026
Allow users to override the state directory location via the OPENCODE_STATE_DIR environment variable. This completes the portable mode support alongside OPENCODE_DATA_DIR, OPENCODE_CACHE_DIR, and OPENCODE_LOG_DIR.

Related to anomalyco#8963
Add documentation for the OPENCODE_STATE_DIR environment variable,
following the same pattern as the other portable mode directory variables.

Related to anomalyco#8963
Copy link

@JackDanger JackDanger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend merging.

I added one suggestion to consolidate some verbose documentation. Otherwise this looks good!

Robitx and others added 3 commits January 17, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Support OPENCODE_CACHE_DIR and OPENCODE_LOG_DIR for full isolation [FEATURE]: Full portable mode.

2 participants