Skip to content

[FEATURE]: add OPENCODE_NO_PARENT_CONFIG to disable parent directory config inheritance #10025

Closed

Description

@kynnyhsap

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 opencode

This would skip:

  • opencode.json / opencode.jsonc from parent directories
  • .opencode/ directories from parent directories
  • AGENTS.md / CLAUDE.md from parent directories

Global config (~/.config/opencode/) would still be loaded unless combined with OPENCODE_DISABLE_GLOBAL_CONFIG=true.

Related

Activity

  1. changed the title [-]feat: add OPENCODE_NO_PARENT_CONFIG to disable parent directory config inheritance[/-] [+][FEATURE] add OPENCODE_NO_PARENT_CONFIG to disable parent directory config inheritance[/+] on Jan 22, 2026
  2. github-actions commented on Jan 22, 2026

    @github-actions
    Contributor

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

    While #10021 and #10025 are related (both dealing with config isolation), they address different aspects - #10021 focuses on global config, while #10025 focuses on parent directory config in the same project hierarchy. These may need coordinated implementation to provide complete isolation control.

    Feel free to ignore if your specific use case requires something different from these existing discussions.

  3. changed the title [-][FEATURE] add OPENCODE_NO_PARENT_CONFIG to disable parent directory config inheritance[/-] [+][FEATURE]: add `OPENCODE_NO_PARENT_CONFIG` to disable parent directory config inheritance[/+] on Jan 22, 2026
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