feat(agents-init): retire CLAUDE.md, discover and normalize AGENTS.md in every subdirectory #177
Merged
rootiest
merged 12 commits from 2026-09-24 04:56:06 +00:00
docs/retire-claude-md-for-agents-md into main
No Reviewers
Labels
Clear labels
Area/CI
Area/Completions
Area/Components
Area/Config
Area/Docs
Area/Functions
Area/Integrations
Area/Prompt & Theme
Area/Scripts
Area/Tests
Compat/Breaking
Kind/Bug
Kind/Chore
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Performance
Kind/Refactor
Kind/Security
Kind/Testing
good first issue
help wanted
.github/workflows and repository automation
completions/ - tab-completion scripts
The opinionated-component system (C1-C6)
config.fish and conf.d/ - startup and environment
docs/manual/ and the generated manual, man page, and site
functions/ - user-facing functions and helpers
integrations/ - third-party tool wiring
themes/ and prompt appearance
scripts/ - standalone helper scripts
tests/ - the syntax lint and functional suite
Breaking change that won't be backward compatible
Something is not working
Tooling, dependencies, and housekeeping
Documentation changes
Improve existing functionality
New functionality
Makes existing behavior faster or lighter
Restructures code without changing behavior
This is security issue
Issue or pull request related to testing
Well-scoped and self-contained; a good place to start
Maintainer is looking for someone to pick this up
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Milestone
No items
No Milestone
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: rootiest/fish-config#177
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
claude-codenow readsAGENTS.mdnatively when noCLAUDE.mdis present, soagents-initno longer needs to create or maintainCLAUDE.mdanywhere. This retires it entirely and generalizes the root-onlyAGENTS.md/CLAUDE.mdhandling into a per-directory sync that discovers any directory with scoped agent instructions (not just the root) and settles each one onAGENTS.md-only.Spec:
AGENTS/specs/2026-09-23-retire-claude-md-design.mdPlan:
docs/superpowers/plans/2026-09-23-retire-claude-md.mdChanges
functions/_agents_init_sync_instructions.fish— per-directory sync helper. Handles four states in order: an inverted mirror (CLAUDE.mdreal,AGENTS.mdsymlinked to it — this repo'sdocs//functions/shape before this PR), adopting a lone real file (a loneCLAUDE.mdis renamed, never preserved under its own name), byte-identical duplicates (keepAGENTS.md, dropCLAUDE.md), and differing duplicates (touch neither, warn to stderr, skip — never silently discard real content).functions/agents-init.fish's--agentsmode replaces the old root-only inline logic with a discovery loop calling the helper above, once per directory found. Discovery is repo-wide but contained: a non-git root syncs only itself (no recursion at all), and a git root's walk prunes nested repos/submodules, any dot-directory (.git,.claude,.gemini,.github, …), any directory namedAGENTS,node_modules, and generated-output directories (build,dist,out,target).functions/_agents_init_path_is_protected.fish— a realAGENTS.md/CLAUDE.mdis left alone (not adopted, not symlinked over) when it's deliberately tracked: staged or committed in git's index, in a project whose.gitignoreis actually populated. An untracked file is always safe to adopt regardless of ignore state, and a tracked file in a project with no established ignore conventions at all is treated as an adoptable first-run/bootstrap case rather than a deliberate choice. This closes the "team/shared repo" gap flagged in review (see below) — a subdirectory's intentionally-committedCLAUDE.mdin someone else's repo is no longer touched..gitignoremanagement switched from anchored/AGENTS.md+/CLAUDE.mdpatterns to a single unanchoredAGENTS.mdpattern (covers every discovered depth), with a migration step that also cleans up the old anchored lines on a project agents-init previously scaffolded.functions/claude.fish,functions/agy.fish, and the C1 command-shadows manual page had their "auto-links AGENTS.md as CLAUDE.md" wording dropped — that job no longer exists.AGENTS/AGENT-TEMPLATE.md(gitignored sub-repo, separate commit there) had itsCLAUDE.mdwarning dropped, keeping the unrelatedGEMINI.mdmention.tests/test-agents-init.fish.docs/manual/16-agent-tooling.md— a full concept/behavior/purpose write-up of this whole system as its own manual section (separate from the auto-generated function reference in Section 5): the AGENTS.md convention, the AGENTS/ sub-repository's layout/versioning/hooks, per-directory discovery and its four-state normalization, both safety mechanisms, a scenario reference (two tables covering every combination of what a directory can hold crossed with its git-tracked state, and what happens in each case), the plans/specs/devlogs wiring, and the launch lifecycle. Inserted before Attribution/License (now Sections 17/18) — the only placement that doesn't disturb any of the manual's existing prose cross-references to other section numbers.docs/fish-config.indexupdated to match.manual-section(<slug>)CLASSIFICATIONtag, so a function with a dedicated manual section (like this one) is grep-able and machine-checked instead of relying on someone reading itsNOTES.docs/build-manual.pyresolves the tag's target page fresh at build time (title, not a hardcoded section number, so a later renumbering — this section has already been renumbered twice on this branch — never requires touching the tag) and renders a "See also" line on the function's generated Section 5 entry, a real link on the site.docs/verify-manual.pyfails the suite if a tag's slug doesn't resolve to a real page — the actual enforcement half, since the build itself stays silent about a bad one.CONTRIBUTING.mdanddocs/function-classification-schema.mddocument the tag and the now-widened, general-purpose framing ofCLASSIFICATIONitself (not just hazard/shadow tags anymore).CLAUDE.mdsymlinks) anddocs//functions/(previously-inverted mirrors) were migrated live by running the finished tool against the actual checkout.Safety notes
Three rounds of review on this branch (each dispatched independently, several with live fixture reproduction rather than just reading the diff) found and closed:
~) it would have walked the entire subtree; inside a git repo it didn't stop at nested repos/submodules/.claude. Fixed as described above.CLAUDE.md/AGENTS.md) was silently deleted with no comparison — a regression from the old code, which at least errored. Fixed by applying the same identical/differ-and-warn logic used elsewhere in the helper.--literal-pathspecs).Testing
tests/run-tests.fish: 882/882 assertions passed, exit 0 (syntax/indent lint, shadow-classification lint,test-agents-init.fish,test-agents-vault.fish— no regressions — and every other suite).docs/verify-manual.py: 88/89 passed — the one failure (test_concat_roundtrips_original) is the expected, pre-existing PR-branch state (regeneration of the generateddocs/fish-config.mdis a main-branch-only CI step). The scenario-reference tables and the manual-section See-also rendering were both independently verified againstbuild-manual.py's real parser/build logic and the generated Starlight site output, not just visually.