You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[DOCS] Document nested AGENTS.md awareness in the CLI #853
The CLI now makes the model aware of nested AGENTS.md files, following the agents.md standard. The project-root AGENTS.md is still injected whole into the system prompt. Nested files in subdirectories are pointed at, not injected. When they exist, the PROJECT INSTRUCTIONS (AGENTS.md) section gains a one-line rule: a nested AGENTS.md takes precedence over the root file for its directory, so the model reads it before working there. When the project tree (agent.context.tree_enabled) is in the prompt it already shows where they are, so only the rule is added. With the tree off, their paths are listed, capped at 20 entries.
The in-repo reference (docs/configuration-reference.md, agent.agents_md section) was updated in the source PR. The standalone docs site needs the same coverage.
Affected pages: the CLI configuration reference and the system-prompt documentation wherever agent.agents_md or AGENTS.md injection is described.
The CLI docs site states that the root AGENTS.md is injected and capped by agent.agents_md.max_lines and max_chars, which apply to that file only.
The docs describe nested AGENTS.md discovery. Files are pointed at rather than injected, up to 4 levels deep, with hidden and node_modules/vendor trees skipped.
The docs state the precedence rule: a nested AGENTS.md takes precedence over the root file for its directory.
The docs explain the project tree interaction. With agent.context.tree_enabled on, only the rule is added. With it off, paths are listed, at most 20.
changed the title [-][DOCS] Document nested AGENTS.md injection in the CLI[/-][+][DOCS] Document nested AGENTS.md awareness in the CLI[/+]on Sep 28, 2026
Inspect CLI implementation (internal/agent/utils.go at the merged source PR: buildAgentsMDInfo, rootAgentsMD, findNestedAgentsMD, nestedAgentsMDListing, projectTreeShown)
Locate coverage on the docs site (there was none - agent.agents_md was undocumented here)
Write docs
Validate: bun run lint:md, bun run format:check, bun run build all pass
Commit + open PR
What changed
New cli.md section How AGENTS.md reaches the model, placed right after "Generating AGENTS.md", plus a pointer bullet under Agent Configuration in Key Configuration Areas.
Covered, matching the implementation:
Root AGENTS.md injected whole as PROJECT INSTRUCTIONS (AGENTS.md) after custom instructions; capped by max_lines (399) / max_chars (8000) with a truncation marker; caps apply to that file only; enabled switch, YAML snippet, three env vars.
Nested files are pointed at, not injected - read on demand with the Read tool. Discovery is 4 levels deep, skipping hidden dirs and node_modules/vendor, lexical walk for a byte-stable prompt.
Precedence rule: a nested AGENTS.md takes precedence over the root file for its directory.
Tree interaction: agent.context.tree_enabled on -> rule only (the PROJECT STRUCTURE listing already shows them); off -> paths listed, at most 20, with an overflow note.
Two details from the code worth stating: nested files are not subject to the caps, and discovery still runs when there is no root file.
Activity
[-][DOCS] Document nested AGENTS.md injection in the CLI[/-][+][DOCS] Document nested AGENTS.md awareness in the CLI[/+]feat(agent): point the agent at nested AGENTS.md files (#1392)
edenreich commentedon Sep 28, 2026
@claude Can you work on this? check the implementation before writing the docs.
inference-gateway-maintainer commentedon Sep 28, 2026
Claude finished @edenreich's task in 3m 38s —— View job •
docs/issue-853-20260928-2333• [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-853-20260928-2333?quick_pull=1&title=Issue%20%23853%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23853%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)Nested AGENTS.md docs - done
internal/agent/utils.goat the merged source PR:buildAgentsMDInfo,rootAgentsMD,findNestedAgentsMD,nestedAgentsMDListing,projectTreeShown)agent.agents_mdwas undocumented here)bun run lint:md,bun run format:check,bun run buildall passWhat changed
New
cli.mdsection How AGENTS.md reaches the model, placed right after "Generating AGENTS.md", plus a pointer bullet under Agent Configuration in Key Configuration Areas.Covered, matching the implementation:
AGENTS.mdinjected whole asPROJECT INSTRUCTIONS (AGENTS.md)after custom instructions; capped bymax_lines(399) /max_chars(8000) with a truncation marker; caps apply to that file only;enabledswitch, YAML snippet, three env vars.node_modules/vendor, lexical walk for a byte-stable prompt.AGENTS.mdtakes precedence over the root file for its directory.agent.context.tree_enabledon -> rule only (thePROJECT STRUCTURElisting already shows them); off -> paths listed, at most 20, with an overflow note.PR: #854 (Closes #853)
Nothing left out.
| Branch
inference-gateway-releaser commentedon Sep 30, 2026
🎉 This issue has been resolved in version 0.9.19 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀