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
infer injects only ./AGENTS.md into the system prompt: buildAgentsMDInfo in internal/agent/agent_utils.go reads that single file. The AGENTS.md spec (https://agents.md) recommends nested files for subprojects, where the file closest to the edited code takes precedence. Claude Code (v2.1.277+) loads a subdirectory AGENTS.md on demand when it reads files in that directory, and Codex concatenates the files from the root down to the working directory.
This repository now ships nested agent briefs (internal/tools/AGENTS.md and internal/presentation/AGENTS.md) that infer cannot see, so they only help agents that walk the tree. Loading the nearest ancestors of the files a task touches would make those files useful to infer and to this repository's own bot.
Acceptance Criteria
infer discovers an AGENTS.md in a subdirectory of the project and injects it alongside the root ./AGENTS.md.
Precedence follows the AGENTS.md spec: the file closest to the edited code takes precedence over the root file.
The combined injected instructions stay within DefaultInstructionsMaxChars in config/config.go, with a clear truncation rule when the cap is hit.
Discovery is on demand or budgeted, so a large monorepo does not inflate every turn's system prompt.
The behaviour is covered by tests, and the agent.agents_md section of the configuration reference documents it.
All work is complete and verified. Let me finalize the todo list:
Done. Issue #1385 is implemented and shipped in PR #1392 (ready for review): #1392
What changed
buildAgentsMDInfo in internal/agent/agent_utils.go now injects nested AGENTS.md files alongside the project root one, per the agents.md standard:
Discovery: one bounded filepath.WalkDir below the working directory (up to 4 levels; hidden dot-trees and node_modules/vendor skipped), so a large monorepo cannot inflate prompt assembly.
Precedence: files are labeled with their directory (internal/tools/AGENTS.md (applies to internal/tools/ and below):) and a one-line note states the file closest to the edited code takes precedence over shallower ones.
Truncation rule: each file keeps its existing per-file max_lines cap, then the combined text is budgeted at agent.agents_md.max_chars (default 8000) deepest-file-first - the nearest file keeps its instructions while shallower files are truncated ([truncated at N chars to fit agent.agents_md.max_chars]) or dropped (a note lists the dropped paths).
No config schema changes: rides on the existing agent.agents_md.enabled / max_lines / max_chars knobs.
Tests: new subtests in TestBuildAgentsMDInfo cover nested injection/order, nearest-first budget truncation, budget-exhausted drop note, and skip rules; all existing subtests pass unchanged.
Docs: the agent.agents_md section in docs/configuration-reference.md documents the nested behavior, and the stale "infer injects only this root file" line in the root AGENTS.md was refreshed.
Verification
task fmt, task vet, task lint (0 issues) and the full task test suite all pass. Follow-up docs ticket filed in the docs repo: inference-gateway/docs#853.
Skipped: per-file max_chars config and a session-level walk cache (per-turn bounded walk is ~1ms on this repo) - add only if a giant monorepo shows it in profiles.
Activity
docs: split README and AGENTS.md into topic and package docs (#1384)
edenreich commentedon Sep 28, 2026
@infer Can you work on this? use /ponytail:ponytail
inference-gateway-maintainer commentedon Sep 28, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1392
✅ Infer Result: Success
All work is complete and verified. Let me finalize the todo list:
Done. Issue #1385 is implemented and shipped in PR #1392 (ready for review): #1392
What changed
buildAgentsMDInfoininternal/agent/agent_utils.gonow injects nested AGENTS.md files alongside the project root one, per the agents.md standard:filepath.WalkDirbelow the working directory (up to 4 levels; hidden dot-trees andnode_modules/vendorskipped), so a large monorepo cannot inflate prompt assembly.internal/tools/AGENTS.md (applies to internal/tools/ and below):) and a one-line note states the file closest to the edited code takes precedence over shallower ones.max_linescap, then the combined text is budgeted atagent.agents_md.max_chars(default 8000) deepest-file-first - the nearest file keeps its instructions while shallower files are truncated ([truncated at N chars to fit agent.agents_md.max_chars]) or dropped (a note lists the dropped paths).agent.agents_md.enabled/max_lines/max_charsknobs.TestBuildAgentsMDInfocover nested injection/order, nearest-first budget truncation, budget-exhausted drop note, and skip rules; all existing subtests pass unchanged.agent.agents_mdsection indocs/configuration-reference.mddocuments the nested behavior, and the stale "infer injects only this root file" line in the rootAGENTS.mdwas refreshed.Verification
task fmt,task vet,task lint(0 issues) and the fulltask testsuite all pass. Follow-up docs ticket filed in the docs repo: inference-gateway/docs#853.Skipped: per-file max_chars config and a session-level walk cache (per-turn bounded walk is ~1ms on this repo) - add only if a giant monorepo shows it in profiles.
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 11m 2sTokens: 3,550,851 in · 37,455 out · 3,588,306 total (38 requests)
Tool calls: 52 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
feat(agent): inject nested AGENTS.md briefs from subdirectories
feat(agent): inject nested AGENTS.md briefs from subdirectories
feat(agent): point the agent at nested AGENTS.md files (#1392)
inference-gateway-releaser commentedon Sep 28, 2026
🎉 This issue has been resolved in version 0.218.0 🎉
The release is available on:
Your semantic-release bot 📦🚀