eca icon indicating copy to clipboard operation
eca copied to clipboard

Support nested AGENTS.md discovery

Open Ramblurr opened this issue 1 year ago • 4 comments

ECA sould support resolving multiple AGENTS.md files in a repository, similar to the behavior described in https://agents.md

This would improve usability in large repositories by allowing each package or subproject to ship its own tailored agent configuration, while still inheriting higher-level defaults.

  1. "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."

Proposed behavior:

  • Discover AGENTS.md files recursively from the current working directory up to (but not including) repo root.
  • Apply the nearest AGENTS.md first, with higher-level ones providing fallback context.
  • Allow multiple AGENTS.md files to coexist in different subprojects of a monorepo.
  • This should occur in the ECA harness without extra tool calls for speed and context efficiency.

Ramblurr avatar Sep 30 '25 15:09 Ramblurr

Thanks, the time I added support for AGENTS.md they didn't have this hehe, but my idea is fully support agents.md standard.

Problems I see with that is: ECA process always start at workspace root (and allow multiple workspaces), which is the cwd as well, so where we should look for AGENTS.md besides the workspace roots?

ericdallo avatar Sep 30 '25 21:09 ericdallo

My understanding of this is if you have this directory structure:

./my-project/
├── modules/
│   ├── featureA/
│   │   ├── src/
│   │   │   └── code.clj
│   │   ├── AGENTS.md
│   │   └── deps.edn
│   └── featureB/
│       ├── src/
│       │   └── code.clj
│       ├── AGENTS.md
│       └── deps.edn
└── AGENTS.md

then when you open the "my-project" your editor and ECA, ./AGENTS.md is read right away.

then later when either:

  1. the user @s the ./modules/featureA/src/code.clj into the context or the ./modules/featureA/deps.edn)
  2. OR, via normal tool use the agent discovers/reads/edits one of those files

-> then the ./modules/featureA/AGENTS.md is automatically inserted into the context

Is it ever removed from the context? 🤷 Most coding agents sadly use an append-only context strategy so they probably never considered this question.

but my idea is fully support agents.md standard.

I think that is great, however I also think it is unfortunately a far cry from a standard with underspecified language :(

Ramblurr avatar Oct 01 '25 06:10 Ramblurr

the user @s the ./modules/featureA/src/code.clj into the context or the ./modules/featureA/deps.edn)

Not sure I got this one, if I got this right, that would be possible after #140 right?

OR, via normal tool use the agent discovers/reads/edits one of those files

I can't see how that works, imagine the case, LLM decides to edit file foo.clj, we will only know that when it calls a read/edit/whatever tool with that path to foo.clj, only after that in next requests we could add a new context, but then it doesn't matter anymore since the tool was already called, I don't know, I'd like to know how that works for other ECA like projects, which do not operate over specific files, but over projects.

I think that is great, however I also think it is unfortunately a far cry from a standard with underspecified language :(

Yeah, I see that, but it's the best we have so far I believe.

ericdallo avatar Oct 02 '25 19:10 ericdallo

I've found very useful info. https://gist.github.com/0xdevalias/f40bc5a6f84c4c5ad862e314894b2fa6#agentsmd

It looks like the Codex reads nested AGENTS.md just by the instructions in the system prompt. Does it use tools to discover/read them?

zikajk avatar Nov 28 '25 09:11 zikajk