-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Problem
When running opencode in a subdirectory that has its own opencode.json, the config from parent directories is automatically merged via findUp. This can cause unwanted config inheritance.
Example:
~/project/opencode.json # parent config with MCP servers A, B, C
~/project/agent/opencode.json # child config with MCP server D
Running from ~/project/agent/ loads both configs and sees all MCP servers (A, B, C, D), even when you only want the local config.
Use Case
When developing multiple agents locally, each with their own config, you want isolation - only the config in the current directory should be loaded, not inherited from parent directories.
Proposed Solution
Add OPENCODE_NO_PARENT_CONFIG environment variable that limits findUp to only search the current directory, not walk up to parent directories.
OPENCODE_NO_PARENT_CONFIG=true opencodeThis would skip:
opencode.json/opencode.jsoncfrom parent directories.opencode/directories from parent directoriesAGENTS.md/CLAUDE.mdfrom parent directories
Global config (~/.config/opencode/) would still be loaded unless combined with OPENCODE_DISABLE_GLOBAL_CONFIG=true.
Related
- [FEATURE]: env flag to disable global config loading (
OPENCODE_DISABLE_GLOBAL_CONFIG) #10021 - Request forOPENCODE_DISABLE_GLOBAL_CONFIG - feat(config): add OPENCODE_DISABLE_GLOBAL_CONFIG env var #10013 - PR implementing
OPENCODE_DISABLE_GLOBAL_CONFIG