Skip to content

[FEATURE]: Auto-selection of nested AGENTS.md based on file/directory context #7576

Closed

Description

@YourTechBud

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

I’ve been working in a monorepo and noticed that the agent often misses the specific instructions we have in subdirectories because it mostly sticks to the root AGENTS.md file.

I’d love it if the agent could just "auto-pick" the nearest AGENTS.md file whenever it starts working in a specific part of the tree.

Specifically:

  • If the agent is reading or writing a file inside a subdirectory, the agent should automatically check for a local AGENTS.md in that folder (or the closest parent) and pull that context in.
  • If I mention a specific folder or path in my prompt, it should be smart enough to go grab the instructions for that area before it starts.

Right now, it’s a bit of a manual process to make sure the agent is following the right local rules for different parts of the repo. It would be much smoother if this happened automatically based on whatever files or folders I'm actually touching.

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Jan 10, 2026
  2. YourTechBud commented on Jan 10, 2026

    @YourTechBud
    Author

    Just checked. This is supposed to be a part of the Agents.md spec as well.

    4. Large monorepo? Use nested AGENTS.md files for subprojects

    Place another AGENTS.md inside each package. Agents automatically read the nearest file in the directory tree, so the closest one takes precedence and every subproject can ship tailored instructions. For example, at time of writing the main OpenAI repo has 88 AGENTS.md files.

  3. github-actions commented on Jan 10, 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.

  4. YourTechBud commented on Jan 10, 2026

    @YourTechBud
    Author

    Seems like #6316 already exists for this

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