fix: stop recursive AGENTS.md walk, load top-level only (#3110)

The recursive os.walk for AGENTS.md in subdirectories was undesired.
Only load AGENTS.md from the working directory root, matching the
behavior of CLAUDE.md and .cursorrules.
This commit is contained in:
Teknium
2026-03-25 18:30:45 -07:00
committed by GitHub
parent 910ec7eb38
commit 7258311710
2 changed files with 14 additions and 33 deletions

View File

@@ -464,14 +464,15 @@ class TestBuildContextFilesPrompt:
result = build_context_files_prompt(cwd=str(tmp_path))
assert "ESLint" in result
def test_recursive_agents_md(self, tmp_path):
def test_agents_md_top_level_only(self, tmp_path):
"""AGENTS.md is loaded from cwd only — subdirectory copies are ignored."""
(tmp_path / "AGENTS.md").write_text("Top level instructions.")
sub = tmp_path / "src"
sub.mkdir()
(sub / "AGENTS.md").write_text("Src-specific instructions.")
result = build_context_files_prompt(cwd=str(tmp_path))
assert "Top level" in result
assert "Src-specific" in result
assert "Src-specific" not in result
# --- .hermes.md / HERMES.md discovery ---