docs: make AGENTS.md hierarchical - #3773
Draft
akoumpa wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
/ok to test 044d3e5 |
Contributor
|
🌿 Preview your docs: https://nvidia-preview-preview-65d45e96c72d.docs.buildwithfern.com/nemo/automodel |
The root AGENTS.md had grown to 294 lines and carried subtree-specific rules far from the code they govern. That distance let it drift: it pointed at `_cli/app.py` (the directory is `cli/`), claimed "27+ model families" against 53 on disk, listed 7 of 20 `components/` subdirectories, and named recipe domains that omitted `dllm/` and `multimodal/`. Split it into one root file plus 12 subtree files, each next to the code it describes so a rename that invalidates guidance shows up in the same diff. The root keeps only repo-wide rules and a routing table; the drifted architecture tour is dropped in favour of `docs/repository-structure.mdx`, which is already maintained and already correct. line `@AGENTS.md`, which resolves relative to the file containing it and so picks up its own sibling. A regular file rather than a symlink: symlinks need Administrator or Developer Mode on Windows, and checkouts that do not preserve them write the literal text `AGENTS.md` instead. This also converts the existing Both tools concatenate root-to-leaf, so nested files are written additively and never contradict an ancestor; that also satisfies the agents.md spec's nearest-file-wins reading. test_agents_md_hierarchy.py enforces the sibling files, the routing table, the line budgets, and that every path named in an instruction file exists on disk. Also corrects the cicd skill, which documented a PR title format (`[model] feat: ...`) and branch naming that the Validate PR title check rejects. Signed-off-by: Alexandros Koumparoulis <akoumparouli@nvidia.com>
akoumpa
force-pushed
the
akoumparouli/docs_hierarchical_agents_md
branch
from
September 1, 2026 03:24
044d3e5 to
65d45e9
Compare
Contributor
Author
|
/ok to test 65d45e9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Splits the single 294-line root
AGENTS.mdinto a root file plus 12 subtree files placed next to the code they govern, readable by both Claude Code and Codex, with no symlinks.Changelog
AGENTS.md294 → 199 lines. Keeps only repo-wide rules plus a routing table. The 75-line architecture tour is dropped in favour ofdocs/repository-structure.mdx, which is already maintained and already correct.AGENTS.mdfiles undernemo_automodel/,_transformers/,components/{models,moe,distributed,checkpoint,datasets}/,recipes/,examples/,tests/,docs/,.github/.CLAUDE.mdbeside everyAGENTS.md, containing exactly one line:@AGENTS.md.tests/unit_tests/test_agents_md_hierarchy.py— 53 checks enforcing the invariants below.cicdskill guidance that documented a PR title format the CI check rejects.Why hierarchical
The flat file had drifted, because a fact 250 lines away from its code never appears in the diff that invalidates it. All four items below were live on
main:_cli/app.py(×2)nemo_automodel/cli/— no_cliexistscomponents/models/components/list, 7 entriesrecipes/{llm,vlm,diffusion,retrieval}dllm/,multimodal/Both agents, one source of truth, no symlinks
AGENTS.mdis the real file; Codex reads it natively. Claude Code readsCLAUDE.mdand notAGENTS.md, so each directory also holds aCLAUDE.mdwhose entire contents are the import line@AGENTS.md. An import resolves relative to the file containing it, so each one picks up its own sibling rather than the repository root — verified by loading a file incomponents/moe/and confirming the MoE rules (not the root rules) were what got injected.Deliberately a regular file rather than a symlink. Symlinks need Administrator or Developer Mode on Windows, and any checkout or archive export that does not preserve them writes the literal text
AGENTS.md, silently reducing a directory's rules to one meaningless word. This PR adds no symlinks and removes one — the pre-existing rootCLAUDE.mdsymlink is converted to the same import form, so the convention is uniform at every level. The 10.claude/skills/*directory symlinks already onmainare a separate mechanism and are untouched.Both tools concatenate root-to-leaf, so a nested file is read in addition to the root. The
agents.mdspec instead says the nearest file wins. Nested files are therefore written additively — each states only what is additionally true in its subtree and never contradicts an ancestor — so all three readings agree. Each opens withAdds to the repository root AGENTS.md, which the test enforces.The drift guard
test_agents_md_hierarchy.pyis the part that makes this pay off rather than multiplying the problem by 13:AGENTS.mdhas a siblingCLAUDE.mdcontaining exactly@AGENTS.md, and is not a symlink;It runs in L0 on every PR, so no new workflow.
Note on the pre-existing review-policy test
tests/unit_tests/test_claude_review_policy.pypins ~12 exact strings to the rootAGENTS.md(config-owned construction,MODEL_ARCH_MAPPING,_CUSTOM_CONFIG_REGISTRATIONS, …). Those are repo-wide review gates, so they stay at root verbatim and that test is unmodified and passing; the subtree files elaborate rather than relocate them.144 passedacross both files.Also fixed
.agents/contributor-skills/cicd/SKILL.mddocumentedPR title format: [{areas}] {type}: {description}and branch names likeusername/feat_add_qwen2_recipe.Validate PR titleuses the semantic-PR template, which rejects bracket-prefixed titles — and the rootAGENTS.mdsaid so explicitly, so the two files contradicted each other. The skill now matches what CI enforces.Before your PR is "Ready for review"
Pre checks:
Additional Information
Docs-only plus one new CPU unit test; no runtime code paths touched.
tools/lint_example_yamls.pystill lints 519 YAMLs clean.