Skip to content

[FEATURE]: for splitting config across multiple files #19353

Closed as not planned
Closed as not planned

Description

@mynameistito

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

I want to split my opencode.jsonc into separate files. Right now if you have a lot of MCP servers, agent configs, or provider settings, the single config file gets long and messy. You can work around it with .opencode/ directory configs and OPENCODE_CONFIG env vars, but those are workarounds, not a proper composition mechanism.

I'd like a field that lets you reference other JSON/JSONC files and have them merged in

Examples:

// opencode.jsonc
{
  "": ["./mcp.jsonc", "./agents.jsonc"],
  "model": "anthropic/claude-sonnet-4-20250514",
  "share": "auto"
}
// mcp.jsonc
{
  "mcp": {
    "github": {
      "type": "remote",
      "url": "https://mcp.github.com/...",
      "enabled": true
    },
    "filesystem": {
      "type": "local",
      "command": ["npx", "@anthropic/fs-mcp", "/tmp/projects"],
      "timeout": 10000
    }
  }
}
// agents.jsonc
{
  "agent": {
    "reviewer": {
      "model": "anthropic/claude-haiku-4-20250414",
      "description": "Code review agent"
    }
  }
}

Extended files would merge in array order, with the main config taking precedence on conflicts. Extended files should be able to their own files too, with circular reference detection so it doesn't loop forever.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 27, 2026
  2. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    This issue does not fully meet our contributing guidelines.

    What needs to be fixed:

    • The feature request is missing the required verification checkbox: - [x] I have verified this feature I'm about to request hasn't been suggested before.
    • The issue title appears incomplete — it reads [FEATURE]: for splitting config across multiple files, with a blank where the feature name should be (e.g. [FEATURE]: extends support for splitting config across multiple files)

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Mar 27, 2026
  4. github-actions commented on Mar 27, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! The verification checkbox is now checked and the description clearly explains the problem and desired feature. The issue looks good — appreciate you taking the time to fix it.

  5. ariane-emory commented on Mar 27, 2026

    @ariane-emory
    Contributor

    FWIW, you can already currently split your config between an opencode.json and opencode.jsonc file, which will be merged.

  6. mynameistito commented on Mar 27, 2026

    @mynameistito
    ContributorAuthor

    FWIW, you can already currently split your config between an opencode.json and opencode.jsonc file, which will be merged.

    Hmm, interesting. Cheers for that, Ariane.

    Would I just put some of the stuff in opencode.json and then some of the other stuff in opencode.jsonc?

    The main reason for this was to split up my models, due to having a lot of blacklists for different providers and what not, as shown here, in my opencode.jsonc.

  7. ariane-emory commented on Mar 27, 2026

    @ariane-emory
    Contributor

    @mynameistito Essentially, yes: just put whatever config content you'd like to in either file.

    The same also applies to tui.json and tui.jsonc, valid content can be split between either of the two files.

  8. mynameistito commented on Mar 27, 2026

    @mynameistito
    ContributorAuthor

    @mynameistito Essentially, yes: just put whatever config content you'd like to in either file.

    The same also applies to tui.json and tui.jsonc, valid content can be split between either of the two files.

    Hmm ty for that! will check it out 😅

    Then when I've got some tokens to burn, I'll attempt a non slop PR of this 🤣

  9. ariane-emory commented on Mar 27, 2026

    @ariane-emory
    Contributor

    @mynameistito I was playing with a similar idea with an {import:somefile.json} syntax, but I got distracted and so there's some things I didn't finish (I'd wanted to add glob support and make things like {import:./conf-parts/*.json} work), but what's there worked correctly so far as I was able to observe while I was messing around with it: ariane-emory#150

  10. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  11. github-actions commented on Jul 5, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  12. voronkovich commented on Nov 8, 2026

    @voronkovich

    I made it with jq and Makefile:

    src=$(wildcard opencode.d/*.json)
    
    opencode.json: $(src)
    	@jq -s 'reduce .[] as $$obj ({}; . * $$obj)' $(src) > opencode.json

    See: voronkovich/dotfiles@8c1e18b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions