Skip to content

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

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

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