[PR #10013] feat(config): add OPENCODE_DISABLE_GLOBAL_CONFIG env var #13299

Open
opened 2026-02-16 18:18:10 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10013

State: open
Merged: No


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
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10013 **State:** open **Merged:** No --- 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 ```bash # 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 - [x] Added 5 new tests for `OPENCODE_DISABLE_GLOBAL_CONFIG` - [x] Verified existing `OPENCODE_DISABLE_PROJECT_CONFIG` tests still pass - [x] Manual testing with built binary
yindo added the pull-request label 2026-02-16 18:18:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13299