Skip to content

[DOCS] Document nested AGENTS.md awareness in the CLI #853

Closed

Description

Summary

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.

Source change: inference-gateway/cli#1392 (resolves inference-gateway/cli#1385)

Acceptance Criteria

  • 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.

Activity

  1. added
    documentation
    on Sep 28, 2026
  2. added theissue type on Sep 28, 2026
  3. moved this to Todo in 2026on Sep 28, 2026
  4. 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
  5. edenreich commented on Sep 28, 2026

    @edenreich
    Contributor

    @claude Can you work on this? check the implementation before writing the docs.

  6. inference-gateway-maintainer commented on Sep 28, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    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

    • Add issue to Roadmap board (In progress -> QA)
    • 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.

    PR: #854 (Closes #853)

    Nothing left out.
    | Branch

  7. inference-gateway-releaser commented on Sep 30, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.19 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions