You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: support config.d/ directory for modular configuration #9062
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Problem
Currently, all OpenCode configuration must be in a single opencode.json file. This becomes unwieldy when managing complex setups with many providers, MCP servers, permissions, and custom settings. Users cannot easily:
Share partial configurations across machines (e.g., just permissions or just theme)
Keep sensitive configuration separate from version-controlled settings
Organize configuration logically by concern (providers, permissions, plugins, etc.)
Manage large sections of granular permissions across multiple files (e.g., 10-permissions-git.json, 11-permissions-test-tools.json, 12-permissions-deploy.json)
Proposed Solution
Add support for a config.d/ directory that allows splitting configuration into multiple files:
~/.config/opencode/config.d/ for global configuration fragments
.opencode/config.d/ for project-specific fragments
Files would be loaded alphabetically and merged after the main config file, following the common Unix pattern (similar to /etc/sudoers.d/, /etc/apt/sources.list.d/, etc.).
Use Cases
Granular permissions: Split permissions by tool category (10-permissions-git.json, 11-permissions-test-tools.json, 12-permissions-deploy.json)
Plugin organization: Maintain 50-plugins.json for all plugin definitions
Sensitive data: Store API keys in a non-versioned fragment file
Shared configs: Symlink common fragments across projects
I think my PR for this problem has broken due to updates. But I've been thinking, that the config.d solution is great for breaking up opencode.json, which is already great. But it does not allow sharing configuration options between agents.
Case in point this is one of my agents and this is my opencode.jsonc. My config philosophy is that opencode should be allowed to do anything that is more-or-less read only and asks for anything else. Obviously, I have a growing list of standard unix tools in the allow list, that I would like to share with almost all of my agents, since in general there is no problems with them reading stuff.
The biggest problem here is that this actually requires that agents also merge some other files. So I could imagine that we go forward with config.d which is loaded completely by the main agent, but that sub-agents reference them.
Hmm, in that case it would probably be better if the configuration in general got an extra option, which is a list, where you can list other jsonc files that are merged with the current config (probably supporting glob would be great). So your main config could say something like
I am also in favor of conf.d logic. Why?
For security reasons alone.
Although I generally believe that agents should be allowed to read everything, there are exceptions. For example, *.env, *credential, or even tool calls such as "docker inspect *". And these can also be folder/project specific. Security confs could be shared separately. This is not currwntly feasible.
For all the same reasons it's such a popular pattern elsewhere, this would be very helpful in OpenCode too. There are multiple use cases both for global and per-project config, e.g.
Have one main config file tracked in git, then allow local per-machine overrides which can be git-ignored:
Keep MCP API tokens out of git
Override default bash permission of ask with allow on a sandbox machine
Install an extra plugin only on one machine
Allow global config to be constructed from multiple git repos via GNU Stow
I have a slightly different angle on this. I'm managing my OpenCode config through chezmoi, and my global config (~/.config/opencode/) is heavily tailored to software development: coding-specific agents, skills, commands, and AGENTS.md directives. But I also want to use OpenCode for completely unrelated tasks (legal research, writing, etc.) where none of that coding context applies.
OPENCODE_CONFIG_DIR supplements the global config dir but doesn't replace it, so there's no clean way to swap contexts today. The config.d/ proposal could solve this if modules are structured as self-contained directories rather than just jsonc fragments:
~/.config/opencode/
opencode.jsonc # core: providers, model, permissions, theme
AGENTS.md # universal principles (voice, style)
config.d/
coding/ # activate for dev work
opencode.jsonc
AGENTS.md
agents/
skills/
commands/
legal/ # activate for legal work
opencode.jsonc
AGENTS.md
agents/
skills/
commands/
The core config stays universal. Each config.d/ subdirectory is a complete module with its own agents, skills, commands, and config overrides. You activate whichever module fits the task.
This needs some form of selective activation (only load specific config.d/ entries, not all of them). But it fits naturally with the composability model this issue is proposing, and it solves a real problem that OPENCODE_CONFIG_DIR can't handle today.
Hey @thdxr I assume you guys are mighty busy, but this seems to be the type of issue where input from the maintainers' side would be appreciates on where you would like to go with this. I sort of assume most people with meticulous dotfiles will be gravitating towards opencode so probably worth doing something well aligned with your plans.
That being said, there were two PR-s already trying to address this, and if I remember correctly @ariane-emory also had a branch somewhere with a different take on this. Have you put any thought into this or is this not the right time to be talking about a more controllable configuration system?
Activity
github-actions commentedon Jan 17, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if #9062 addresses your specific needs differently (such as the config.d/ pattern specifically).
ferdinandyb commentedon Jan 30, 2026
I think my PR for this problem has broken due to updates. But I've been thinking, that the config.d solution is great for breaking up
opencode.json, which is already great. But it does not allow sharing configuration options between agents.Case in point this is one of my agents and this is my opencode.jsonc. My config philosophy is that opencode should be allowed to do anything that is more-or-less read only and asks for anything else. Obviously, I have a growing list of standard unix tools in the allow list, that I would like to share with almost all of my agents, since in general there is no problems with them reading stuff.
The biggest problem here is that this actually requires that agents also merge some other files. So I could imagine that we go forward with
config.dwhich is loaded completely by the main agent, but that sub-agents reference them.Hmm, in that case it would probably be better if the configuration in general got an extra option, which is a list, where you can list other
jsoncfiles that are merged with the current config (probably supporting glob would be great). So your main config could say something likewhile a subagent could go
3x3cut0r commentedon Feb 25, 2026
I am also in favor of conf.d logic. Why?
For security reasons alone.
Although I generally believe that agents should be allowed to read everything, there are exceptions. For example, *.env, *credential, or even tool calls such as "docker inspect *". And these can also be folder/project specific. Security confs could be shared separately. This is not currwntly feasible.
aspiers commentedon Mar 4, 2026
Yes please, this is a much-needed feature!
For all the same reasons it's such a popular pattern elsewhere, this would be very helpful in OpenCode too. There are multiple use cases both for global and per-project config, e.g.
bashpermission ofaskwithallowon a sandbox machine3x3cut0r commentedon Mar 7, 2026
I have created a pull request to solve this issue:
#16525
3x3cut0r commentedon Mar 16, 2026
How long does it usually take for PRs to be at least reviewed? Or how can I see if this is on scope or being discussed?
rcdailey commentedon Mar 27, 2026
I have a slightly different angle on this. I'm managing my OpenCode config through chezmoi, and my global config (
~/.config/opencode/) is heavily tailored to software development: coding-specific agents, skills, commands, and AGENTS.md directives. But I also want to use OpenCode for completely unrelated tasks (legal research, writing, etc.) where none of that coding context applies.OPENCODE_CONFIG_DIRsupplements the global config dir but doesn't replace it, so there's no clean way to swap contexts today. Theconfig.d/proposal could solve this if modules are structured as self-contained directories rather than just jsonc fragments:The core config stays universal. Each
config.d/subdirectory is a complete module with its own agents, skills, commands, and config overrides. You activate whichever module fits the task.This needs some form of selective activation (only load specific
config.d/entries, not all of them). But it fits naturally with the composability model this issue is proposing, and it solves a real problem thatOPENCODE_CONFIG_DIRcan't handle today.ferdinandyb commentedon Mar 27, 2026
Hey @thdxr I assume you guys are mighty busy, but this seems to be the type of issue where input from the maintainers' side would be appreciates on where you would like to go with this. I sort of assume most people with meticulous dotfiles will be gravitating towards opencode so probably worth doing something well aligned with your plans.
That being said, there were two PR-s already trying to address this, and if I remember correctly @ariane-emory also had a branch somewhere with a different take on this. Have you put any thought into this or is this not the right time to be talking about a more controllable configuration system?
github-actions commentedon Jul 6, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.