feat: Add agents-md plugin for AGENTS.md fallback support#29835
Open
baktybekb wants to merge 4 commits intoanthropics:mainfrom
Open
feat: Add agents-md plugin for AGENTS.md fallback support#29835baktybekb wants to merge 4 commits intoanthropics:mainfrom
baktybekb wants to merge 4 commits intoanthropics:mainfrom
Conversation
Adds a plugin that reads AGENTS.md files when no CLAUDE.md is present, enabling cross-tool compatibility with Codex, Cursor, Amp, and 20,000+ repositories that use the AGENTS.md standard. Resolves anthropics#6235
…docs - Rewrite SessionStart hook from bash+python mix to pure Python3 for consistency with hookify and security-guidance plugins - Add CLAUDE.local.md detection (skip AGENTS.md if local config exists) - Add plugin entry to plugins/README.md table - Clean up plugin README for in-repo context
- Reject symlinks to prevent reading sensitive files like /etc/shadow - Check file size before reading to prevent memory exhaustion on huge files - Add top-level exception handler to never block session start - Validate CWD is an absolute path before using it - Handle os.getcwd() failure gracefully
Author
|
Hi @dicksontsai @bcherny — would appreciate your feedback on this plugin when you have a moment. This addresses #6235 (the most upvoted issue in the repo) by adding AGENTS.md fallback support via a SessionStart hook — following the same pattern as the Happy to adjust anything based on your review. Thanks! |
- Allow symlinked AGENTS.md (consistent with CLAUDE.md native behavior, needed for monorepos and dotfile managers) - Limit directory traversal depth to 20 levels (prevent timeout on deep NFS/network paths) - Guard stdin read with isatty() check (prevent hang on manual testing) - Report errors via systemMessage instead of silent swallow (matches hookify error handling pattern) - Add explicit sys.exit(0) for defensive exit code guarantee
This was referenced Mar 2, 2026
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.
Summary
Adds a new plugin (
plugins/agents-md) that provides AGENTS.md support for Claude Code, addressing the most upvoted issue in this repository.AGENTS.mdfiles when noCLAUDE.mdis present at the same directory level<dir>/AGENTS.mdand<dir>/.claude/AGENTS.mdlocationsCLAUDE.md,.claude/CLAUDE.md,CLAUDE.local.md) before falling back to AGENTS.mdhookifyandsecurity-guidancepluginsThis enables cross-tool compatibility with 20,000+ repositories using the AGENTS.md standard (Codex, Cursor, Amp, and other AI coding tools).
Resolves #6235
Behavior matrix
Plugin structure
Test plan
.claude/AGENTS.mdnested location — loads correctly