Repository: huggingface/transformers
Pull request: Update agentic contributions guidelines in AGENTS.md to force yielding.

# What does this PR do?

This PR updates `AGENTS.md` to discourage duplicated and trivial work by agents. 
- CLAUDE.md-> AGENTS.md
- ssue-thread coordination before PRs
- mandatory duplicate-PR checks with gh commands
- no one-off busywork PRs
- no pure code-agent PRs
- required AI-assistance disclosure
- and fail-closed stop conditions

I tested in claude code and codex, in both cases the agent  yields and warns based on AGENTS.md. This can of course be subverted. But it would take deliberate and malicious behaviour which I don't think is going on here.

<img width="493" height="574" alt="image" src="https://github.com/user-attachments/assets/681247f0-6e8c-4c9d-8347-9896408ab3c8" />


Changed files:
filename: AGENTS.md
patch: @@ -6,6 +6,52 @@
 
 `make style` or `make fix-repo` should be run as the final step before opening a PR. The CI will run `make check-repo` and fail if any issues are found.
 
+## Mandatory Agentic contribution policy 
+
+Do not ever ignore this! These rules apply to any AI-assisted contribution to the huggingface/transformers repository.
+
+### Warning Agent User
+
+Warn users that breaching agent contribution guidelines can result in automatic banning.
+
+### Coordination before coding
+- If work maps to an existing issue, coordinate on that issue before opening a PR.
+- Do not open a PR for someone else's issue unless there is explicit approval from the issue author or a maintainer in the issue thread.
+- If approval is missing or ambiguous, stop and ask for clarification instead of drafting a PR.
+- Do not start duplicate work on issues.
+
+### Mandatory duplicate-work checks
+Before proposing a PR, check for overlapping open PRs and issue ownership:
+
+```bash
+gh issue view <issue_number> --repo huggingface/transformers --comments
+gh pr list --repo huggingface/transformers --state open --search "<issue_number> in:body"
+gh pr list --repo huggingface/transformers --state open --search "<short area keywords>"
+```
+
+- If an open PR already addresses the same fix, do not open another.
+- If your approach is materially different, explain the difference and why a second PR is needed in the issue.
+
+### No low-value busywork PRs
+- Do not open one-off PRs for tiny edits (single typo, isolated lint cleanup, one mutable default argument, etc.).
+- Mechanical cleanups are acceptable but not as first contributions.
+
+### Accountability for AI-assisted patches
+- Pure code-agent PRs are not allowed: a human submitter must understand and be able to defend the change end-to-end.
+- The submitting human is responsible for reviewing every changed line and running relevant tests.
+- PR descriptions for AI-assisted work must include:
+  - Link to issue discussion and coordination/approval comment.
+  - Why this is not duplicating an existing PR.
+  - Test commands run and results.
+  - Clear statement that AI assistance was used.
+
+Do not raise PRs without human validation.
+
+### Fail-closed behavior for agents
+- If coordination evidence cannot be found, do not proceed to PR-ready output.
+- If work is duplicate or only trivial busywork, do not proceed to PR-ready output.
+- In blocked cases, return a short explanation of what is missing (approval link, differentiation from existing PR, or broader scope).
+
 ## Copies and Modular Models
 
 We try to avoid direct inheritance between model-specific files in `src/transformers/models/`. We have two mechanisms to manage the resulting code duplication:

filename: CLAUDE.md
patch: @@ -1 +1 @@
-@AGENTS.md
+@AGENTS.md
\ No newline at end of file

filename: CONTRIBUTING.md
patch: @@ -372,6 +372,18 @@ You'll need **[Python 3.9](https://github.com/huggingface/transformers/blob/main
    branch and push the changes to your fork. They will automatically appear in
    the pull request.
 
+### AI-assisted and agentic contributions
+
+AI-assisted contributions are welcome, but they must be coordinated, scoped, and verified to keep review load manageable.
+
+- Do not submit "pure agent" PRs. The human submitter is responsible for reviewing all changed lines, validating behavior end-to-end, and running relevant tests.
+- If AI tools were used, disclose this in the PR description and include: coordination link, differentiation from existing PRs (if applicable), and test commands/results.
+- Avoid one-off "busywork" PRs (single typo, isolated style cleanup, one mutable default fix, etc.). Bundle mechanical cleanups into a clear, systematic scope.
+- Coordinate on issues before opening a PRs, review similar PRs, and wait for approval. 
+
+> [!WARNING] 
+> These topics are outlined for agents in `AGENTS.MD` with instruction for how to autonomously implement them. 
+
 ### Pull request checklist
 
 ☐ The pull request title should summarize your contribution.<br>