Skip to content

parent folder config scope #10707

Closed as not planned
Closed as not planned

Description

@rafaeldev

Question

Is it possible use a upper config folder with project config together?

My company have:

all_project
├── project_1
│   └── opencode.json
├── project_2
│   └── opencode.json 
└── opencode.json 

The project 1 and project 2 have their opencode.json config file and inherit from all_project parent folder

I have some mcp configs about in company context, like trello and don't want repeat same config to each project and don't make sense add it to global

Activity

  1. changed the title [-]upper config scope[/-] [+]parent folder config scope[/+] on Jan 26, 2026
  2. github-actions commented on Jan 26, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. cravenceiling commented on Jan 26, 2026

    @cravenceiling
    Contributor

    I think you could do something like:

    OPENCODE_CONFIG=../opencode.json opencode

    inside of project_1 or project_2 of course.

    You can check the final config using:

    OPENCODE_CONFIG=../opencode.json opencode debug config
  4. Flare576 commented on Feb 9, 2026

    @Flare576

    Use Case: Multi-Client Consultant Structure

    I have the exact same need. My directory structure:

    ~/.config/opencode/
    ├── opencode.jsonc        # Global: core providers, personal Slack MCP
    └── AGENTS.md             # Global: base working preferences
    
    ~/Projects/
    ├── ClientA/
    │   ├── opencode.jsonc    # ClientA: Slack MCP, Atlassian MCP, model overrides
    │   ├── AGENTS.md         # "Flare's Role at ClientA"
    │   ├── project-one/      # ← git repo
    │   │   └── opencode.jsonc
    │   └── project-two/      # ← git repo
    │       └── opencode.jsonc
    ├── ClientB/
    │   ├── opencode.jsonc    # ClientB: different Slack workspace, different Atlassian
    │   ├── AGENTS.md         # "Flare's Role at ClientB"
    │   └── some-project/     # ← git repo
    └── Personal/
        ├── opencode.jsonc    # Personal: no client MCPs, different model mix
        └── ei/               # ← git repo
    

    Current behavior: When I run opencode in ~/Projects/ClientA/project-one/, it only loads:

    1. ~/.config/opencode/opencode.jsonc (global)
    2. ~/Projects/ClientA/project-one/opencode.jsonc (git root)

    It skips ~/Projects/ClientA/opencode.jsonc entirely because findUp stops at the git boundary.

    What I need: The ability to define client-level MCPs and context once, inherited by all projects under that client, without duplicating config into every git repo.

    The workaround of OPENCODE_CONFIG=../opencode.jsonc doesn't help because:

    1. It overrides rather than merges
    2. It requires manual invocation every time
    3. It doesn't support multiple levels of hierarchy

    Secondary Concern: Instruction Files

    Related to config hierarchy, I'd want instruction files (AGENTS.md) to follow the same pattern. Currently I can work around this with the instructions config field:

    // In ~/Projects/ClientA/opencode.jsonc
    {
      "instructions": ["~/Projects/ClientA/AGENTS.md"],
      "mcp": { /* client-specific MCPs */ }
    }

    If config hierarchy worked, this would "just work" - each level's config would add its own AGENTS.md via the instructions array, and since instructions arrays concatenate (per mergeConfigConcatArrays), all levels would be included.

    One implementation note: If this feature lands, relative paths in instructions (like "./AGENTS.md") would need to be resolved relative to the config file's location before merging, not relative to CWD. Otherwise users would need to use absolute paths at each level.


    Summary

    Would love to see findUp optionally continue beyond git boundaries, walking up the filesystem until it hits $HOME or a configurable stop point. This would enable:

    • Client/org-level MCP configurations
    • Tiered instruction contexts
    • Reduced duplication across related projects
  5. yoobi commented on Feb 24, 2026

    @yoobi

    That would be amazing !

  6. yoobi commented on Mar 17, 2026

    @yoobi

    @thdxr Is there anything we can do to have this PR accepted ?

  7. assigned and unassigned on Apr 26, 2026
  8. added a commit that references this issue on May 6, 2026
    86a4210
  9. added a commit that references this issue on Jun 8, 2026
    2a79f91
  10. rekram1-node commented on Jun 23, 2026

    @rekram1-node
    Contributor

    Automated: closing question issues.

    GitHub Issues are for bug reports and feature requests only — questions / support are no longer tracked here.

    If this is a bug or feature request, please open a new issue with the appropriate template.

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