Skip to content

feat(config): add OPENCODE_DISABLE_GLOBAL_CONFIG env var#10013

Open
kynnyhsap wants to merge 3 commits intoanomalyco:devfrom
kynnyhsap:feat/disable-global-config
Open

feat(config): add OPENCODE_DISABLE_GLOBAL_CONFIG env var#10013
kynnyhsap wants to merge 3 commits intoanomalyco:devfrom
kynnyhsap:feat/disable-global-config

Conversation

@kynnyhsap
Copy link
Contributor

@kynnyhsap kynnyhsap commented Jan 22, 2026

Add environment variable flag to disable loading global user configuration, mirroring the existing OPENCODE_DISABLE_PROJECT_CONFIG feature from #8093.

Fixes #10021

Use Case

Running multiple opencode processes with different versions where global config (~/.config/opencode) conflicts with local agent development.

What Gets Disabled

When OPENCODE_DISABLE_GLOBAL_CONFIG=true:

  • ~/.config/opencode/ - global config directory (config files, agents, commands, plugins)
  • ~/.opencode/ - user home .opencode directory
  • ~/.config/opencode/AGENTS.md - global rule file
  • ~/.claude/CLAUDE.md - claude compat rule file

Behavior Matrix

Flag Set Global Config Project Config OPENCODE_CONFIG_DIR
Neither Loaded Loaded Loaded (if set)
DISABLE_PROJECT Loaded Skipped Loaded (if set)
DISABLE_GLOBAL Skipped Loaded Loaded (if set)
Both Skipped Skipped Loaded (if set)

Usage

# Disable global config, use only project config
OPENCODE_DISABLE_GLOBAL_CONFIG=true opencode

# Disable both, use only custom config dir
OPENCODE_DISABLE_GLOBAL_CONFIG=true OPENCODE_DISABLE_PROJECT_CONFIG=true OPENCODE_CONFIG_DIR=/path/to/config opencode

Test Plan

  • Added 5 new tests for OPENCODE_DISABLE_GLOBAL_CONFIG
  • Verified existing OPENCODE_DISABLE_PROJECT_CONFIG tests still pass
  • Manual testing with built binary

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

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

No duplicate PRs found

Add environment variable flag to disable loading global user configuration,
mirroring the existing OPENCODE_DISABLE_PROJECT_CONFIG feature.

When set, this skips:
- ~/.config/opencode/ (global config directory)
- ~/.opencode/ (user home .opencode directory)
- Global rule files (AGENTS.md, CLAUDE.md)

Useful for running multiple opencode processes with different versions
where global config conflicts with local agent development.
…ig disabled

OPENCODE_CONFIG_DIR is an explicit override and should always be respected,
even when OPENCODE_DISABLE_GLOBAL_CONFIG is set. This ensures consistency
with how config.ts handles OPENCODE_CONFIG_DIR.
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]: env flag to disable global config loading (OPENCODE_DISABLE_GLOBAL_CONFIG)

1 participant