Skip to content

[FEATURE]: Hierarchical rules triggered by file-related tool calls for progressive disclosure #9511

Closed as duplicate

Description

@bailey-busc

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

Claude Code looks up nested CLAUDE.md files based on what files are being read, allowing for progressive disclosure based on what Claude is working on (docs link). This seems small, but I think this is a killer feature because context bloat is so undesirable and degrades model performance so aggressively.

Implementation:

  • Rules files are matched based on the regex (.+[-_\.])?AGENTS.md, allowing for files such as python.AGENTS.md, backend_AGENTS.md, typescript.AGENTS.md, and the normal AGENTS.md to match
  • Read, edit, grep tools trigger rule lookup + injection
  • When the tool calls that introduced a rule are pruned during compaction, the rules themselves are pruned as well
  • Rules support a paths parameter via YAML frontmatter, which is a list of file globs. If present, the rule will only be loaded if the globs match the file(s) being loaded. This is analogous to Claude Code's path-specific rules feature.

I'm in the process of implementing this, and have a functional prototype with the exception of:

  • Rules that have been loaded are missing from the web UI message interface
  • List of all rules loaded in a session in the context panel in the web UI

Open questions/feedback I'm requesting:

  • Is "hierarchical" the right word to describe this? I'm not really settled on if this is what this should be called.
  • Are rules different conceptually from the current instructions implementation? Should I merge the two concepts somehow?
  • Should the regular expression for rule loading be configurable? In either case, does the default regex (.+[-_\.])?AGENTS.md make sense?
  • The paths frontmatter thinge feels like it possibly should be split off into it's own feature and supported in instructions as well, but I'm not totally sure.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 19, 2026
  2. github-actions commented on Jan 19, 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. bailey-busc commented on Jan 19, 2026

    @bailey-busc
    Author

    Github issue search sucks ass, I'll just discuss my implementation in #6316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions