[FEATURE]: Support .opencode/AGENTS.md for environment-specific instructions #8135

Open
opened 2026-02-16 18:09:14 -05:00 by yindo · 4 comments
Owner

Originally created by @skabillium on GitHub (Jan 31, 2026).

Originally assigned to: @skabillium on GitHub.

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

Currently, opencode only loads AGENTS.md from the project root or parent directories, not from the .opencode/ directory (unlike Claude Code, which supports a .claude/ directory). This prevents users from keeping environment-specific configurations separate from the main project, especially when those configurations should not be checked into Git.

Proposed change:
Support .opencode/AGENTS.md files similar to how Claude Code handles .claude/CLAUDE.md. When present, both the root AGENTS.md and .opencode/AGENTS.md should be loaded, allowing:

  • Environment-specific configs in .opencode/ that can be gitignored
  • Shared project rules in root AGENTS.md that are committed

Implementation:
If this is approved, I can create a PR to add this.

Originally created by @skabillium on GitHub (Jan 31, 2026). Originally assigned to: @skabillium on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request Currently, opencode only loads AGENTS.md from the project root or parent directories, not from the .opencode/ directory (unlike Claude Code, which supports a .claude/ directory). This prevents users from keeping environment-specific configurations separate from the main project, especially when those configurations should not be checked into Git. **Proposed change:** Support `.opencode/AGENTS.md` files similar to how Claude Code handles `.claude/CLAUDE.md`. When present, both the root `AGENTS.md` and `.opencode/AGENTS.md` should be loaded, allowing: - Environment-specific configs in `.opencode/` that can be gitignored - Shared project rules in root `AGENTS.md` that are committed **Implementation:** If this is approved, I can create a PR to add this.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 31, 2026):

This issue is related to several existing feature requests about supporting environment-specific and modular configuration. Please check:

  • #6316: Context Auto-Discovery: Load AGENTS.md from Directories When Accessing Files - proposes auto-loading AGENTS.md from nested directories
  • #9062: Support config.d/ directory for modular configuration - proposes splitting opencode.json into multiple config files
  • #8158: Support loading Claude Code plugins from .claude/ directory - discusses Claude Code compatibility layer
  • #10737: Support loading MCP configs from separate files (mcps/*.json) - similar pattern for organizing MCP configurations

These issues share a common theme of supporting modular, environment-specific configurations in separate directories/files. Your proposal specifically targets AGENTS.md in .opencode/, which complements these broader modularization efforts.

@github-actions[bot] commented on GitHub (Jan 31, 2026): This issue is related to several existing feature requests about supporting environment-specific and modular configuration. Please check: - #6316: Context Auto-Discovery: Load AGENTS.md from Directories When Accessing Files - proposes auto-loading AGENTS.md from nested directories - #9062: Support config.d/ directory for modular configuration - proposes splitting opencode.json into multiple config files - #8158: Support loading Claude Code plugins from .claude/ directory - discusses Claude Code compatibility layer - #10737: Support loading MCP configs from separate files (mcps/*.json) - similar pattern for organizing MCP configurations These issues share a common theme of supporting modular, environment-specific configurations in separate directories/files. Your proposal specifically targets AGENTS.md in .opencode/, which complements these broader modularization efforts.
Author
Owner

@MichaelYochpaz commented on GitHub (Feb 2, 2026):

Are you sure about this not being supported? According to the docs this is already an existing feature.

@MichaelYochpaz commented on GitHub (Feb 2, 2026): Are you sure about this not being supported? According to [the docs](https://opencode.ai/docs/rules/#global) this is already an existing feature.
Author
Owner

@skabillium commented on GitHub (Feb 3, 2026):

Are you sure about this not being supported? According to the docs this is already an existing feature.

@MichaelYochpaz This is what the docs say:

When opencode starts, it looks for rule files in this order:
Local files by traversing up from the current directory (AGENTS.md, CLAUDE.md)
Global file at ~/.config/opencode/AGENTS.md
Claude Code file at ~/.claude/CLAUDE.md (unless disabled)
The first matching file wins in each category. For example, if you have both AGENTS.md and CLAUDE.md, only AGENTS.md is used. Similarly, ~/.config/opencode/AGENTS.md takes precedence over ~/.claude/CLAUDE.md.

So it does not look in the local .opencode directory for an AGENTS.md file at all.

@skabillium commented on GitHub (Feb 3, 2026): > Are you sure about this not being supported? According to [the docs](https://opencode.ai/docs/rules/#global) this is already an existing feature. @MichaelYochpaz This is what the docs say: When opencode starts, it looks for rule files in this order: Local files by traversing up from the current directory (AGENTS.md, CLAUDE.md) Global file at ~/.config/opencode/AGENTS.md Claude Code file at ~/.claude/CLAUDE.md (unless disabled) The first matching file wins in each category. For example, if you have both AGENTS.md and CLAUDE.md, only AGENTS.md is used. Similarly, ~/.config/opencode/AGENTS.md takes precedence over ~/.claude/CLAUDE.md. So it does not look in the local `.opencode` directory for an `AGENTS.md` file at all.
Author
Owner

@rekram1-node commented on GitHub (Feb 3, 2026):

@skabillium yeah u can pr it, plz update docs and add test case for it too

@rekram1-node commented on GitHub (Feb 3, 2026): @skabillium yeah u can pr it, plz update docs and add test case for it too
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8135