[FEATURE]: Dynamic AGENTS.md resolution has no low-cost trigger for intentional loading #9300

Open
opened 2026-02-16 18:12:07 -05:00 by yindo · 1 comment
Owner

Originally created by @wblazer on GitHub (Feb 13, 2026).

Originally assigned to: @thdxr 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

The AGENTS.md autoloading (added in #10678) is only triggered by the read tool. This means the only way to trigger autoloading of a subdirectory's AGENTS.md is to read an actual file from that directory.

There's no low-cost way for an agent to load folder-level agent documentation without pulling in potentially unwanted file content. Tools like glob and grep that operate on directories don't trigger autoloading, and explicitly reading the AGENTS.md itself doesn't prevent re-injection on subsequent reads (since explicit reads don't populate metadata.loaded the same way).

The root problem for me is that I want a system where an agent can explore the codebase through its localized agent documentation before reading any code, but also have any unloaded documentation loaded passively as a side effect of the read tool (current approach).

A potential solution is to deduplicate explicit AGENTS.md reads against subsequent autoloads.

This functionality can be recreated with plugins, and I had Claude recreate it as a plugin with deduplication of explicit reads here. The main constraint of this approach is that the built-in dynamic AGENTS.md resolution can't be disabled currently, so I'm forced to use a different filename. However, I think I like my output format better for my needs because auto-loaded localized documentation feels semantically different than a "system-reminder," so I may continue using it even if my suggestion here goes through. An option to disable the built-in auto-loading would let me use AGENTS.md as the filenames still with my plugin, so that might be a nice addition as well.

Originally created by @wblazer on GitHub (Feb 13, 2026). Originally assigned to: @thdxr 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 The AGENTS.md autoloading (added in #10678) is only triggered by the read tool. This means the only way to trigger autoloading of a subdirectory's AGENTS.md is to read an actual file from that directory. There's no low-cost way for an agent to load folder-level agent documentation without pulling in potentially unwanted file content. Tools like glob and grep that operate on directories don't trigger autoloading, and explicitly reading the AGENTS.md itself doesn't prevent re-injection on subsequent reads (since explicit reads don't populate metadata.loaded the same way). The root problem for me is that I want a system where an agent can explore the codebase through its localized agent documentation before reading any code, but also have any unloaded documentation loaded passively as a side effect of the read tool (current approach). A potential solution is to deduplicate explicit AGENTS.md reads against subsequent autoloads. This functionality can be recreated with plugins, and I had Claude recreate it as a plugin with deduplication of explicit reads [here](https://gist.github.com/wblazer/25eea3574fe4fd9502e875e9e4cf435f). The main constraint of this approach is that the built-in dynamic AGENTS.md resolution can't be disabled currently, so I'm forced to use a different filename. However, I think I like my output format better for my needs because auto-loaded localized documentation feels semantically different than a "system-reminder," so I may continue using it even if my suggestion here goes through. An option to disable the built-in auto-loading would let me use AGENTS.md as the filenames still with my plugin, so that might be a nice addition as well.
yindo added the discussion label 2026-02-16 18:12:07 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Feb 13, 2026):

This issue appears to be a duplicate of #13540, which was closed just moments before this was created. Both discuss the exact same feature request: adding a low-cost trigger mechanism for intentional AGENTS.md loading and deduplicating explicit reads against subsequent autoloads.

Please check #13540 to see if your discussion can continue there or if this issue should be closed as a duplicate.


There are also several related issues you may want to review for context on AGENTS.md loading:

  • #6316: Context Auto-Discovery for nested AGENTS.md files in monorepos
  • #2225: Automatically load @ referenced files in AGENTS.md
  • #11532: AGENTS.md not loaded after /new (coverage gap in current autoloading)
  • #11454: Support .opencode/AGENTS.md for environment-specific instructions
  • #11639: Config dir AGENTS.md conflates global and repo-specific rules
  • #6479: opencode reads agents.md from parent directories (scope boundary issues)

These issues together paint a picture of ongoing work around improving AGENTS.md loading behavior and scope management.

@github-actions[bot] commented on GitHub (Feb 13, 2026): This issue appears to be a duplicate of #13540, which was closed just moments before this was created. Both discuss the exact same feature request: adding a low-cost trigger mechanism for intentional AGENTS.md loading and deduplicating explicit reads against subsequent autoloads. Please check #13540 to see if your discussion can continue there or if this issue should be closed as a duplicate. --- There are also several related issues you may want to review for context on AGENTS.md loading: - #6316: Context Auto-Discovery for nested AGENTS.md files in monorepos - #2225: Automatically load @ referenced files in AGENTS.md - #11532: AGENTS.md not loaded after /new (coverage gap in current autoloading) - #11454: Support .opencode/AGENTS.md for environment-specific instructions - #11639: Config dir AGENTS.md conflates global and repo-specific rules - #6479: opencode reads agents.md from parent directories (scope boundary issues) These issues together paint a picture of ongoing work around improving AGENTS.md loading behavior and scope management.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9300