Skip to content

Commit 12fc496

Browse files
yiyixuxuclaude
andauthored
keep the agent symlinks (#13968)
* Commit root AGENTS.md/CLAUDE.md symlinks so agents auto-load conventions Track the root AGENTS.md/CLAUDE.md symlinks (-> .ai/AGENTS.md) instead of generating them via `make claude`/`make codex`, so a fresh clone auto-loads the agent guide with no setup step (matching transformers). The make targets now only wire up skills; .ai/AGENTS.md, the contribution doc, and the PR template are updated to match. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add documentation-impact check to PR review rules During review, scan related usage docs and agent docs and flag (advisory) any that should be updated based on the PR — outdated/missing usage docs, or a rule/pattern/gotcha worth recording in the agent guides. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8aca5f7 commit 12fc496

8 files changed

Lines changed: 20 additions & 11 deletions

File tree

.ai/AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Diffusers — Agent Guide
22

3+
## Setup
4+
5+
- Local Claude Code agents: run `make claude` after cloning to wire the [skills](#skills) under `.claude/`.
6+
- Local OpenAI Codex agents: run `make codex` after cloning to wire the [skills](#skills) under `.agents/`.
7+
38
## Coding style
49

510
Strive to write code as simple and explicit as possible.

.ai/review-rules.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ Common mistakes are covered in the common-mistakes / gotcha sections in [AGENTS.
1515

1616
- **Ephemeral context.** Comments, docstrings, and files that only made sense to the current PR's author or reviewer don't help a future reader/user/developer. Examples: `# per reviewer comment on PR #NNNN`, `# as discussed in review`, `# TODO from offline chat`, debug printouts. Same for files: parity harnesses, comparison scripts, anything in `scripts/` with hardcoded developer paths or imports from the reference repo. State the *reason* so the comment stands alone, or drop it.
1717

18+
## Documentation impact
19+
20+
A PR can leave existing docs stale or surface a pattern worth recording. Scan the docs related to what the PR touches and flag updates as a **suggestions / additional info** section (not blocking):
21+
22+
- **Usage docs.** New or changed public behavior — a new pipeline/model, a new argument, changed defaults, a renamed API — should have matching updates in `docs/`, docstrings, and examples. Flag any that now describe outdated behavior or that are missing for the new surface.
23+
- **Agent docs.** If the review turns up a rule, pattern, or common gotcha that isn't written down yet — especially one the author got wrong or that you had to reason out — propose adding it to the relevant agent guide ([AGENTS.md](AGENTS.md), [models.md](models.md), [pipelines.md](pipelines.md), [modular.md](modular.md), a skill, or this file) so the next contributor/agent gets it for free instead of repeating the mistake.
24+
1825
## Dead code analysis (new models)
1926

2027
When reviewing a PR that adds a new model, trace how the model is actually called from the pipeline to identify likely dead code. Include the results as a **suggestions / additional info** section in your review (not as blocking comments — the findings are advisory).

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Fixes # (issue)
1717

1818
## Before submitting
1919
- [ ] Did you use an AI agent (Claude Code, Codex, Cursor, etc.) to help with this PR? If so:
20-
- [ ] Did you point it at the project conventions in [`.ai/`](https://github.com/huggingface/diffusers/tree/main/.ai) (e.g. via `make claude` / `make codex`)? See [Coding with AI agents](https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents).
20+
- [ ] Did you read the [Coding with AI agents](https://huggingface.co/docs/diffusers/main/en/conceptual/contribution#coding-with-ai-agents) guide?
2121
- [ ] Did you self-review the diff against [`.ai/review-rules.md`](https://github.com/huggingface/diffusers/blob/main/.ai/review-rules.md)?
2222
- [ ] Did you read the [contributor guideline](https://huggingface.co/docs/diffusers/main/en/conceptual/contribution)?
2323
- [ ] Did you read our [philosophy doc](https://huggingface.co/docs/diffusers/main/en/conceptual/philosophy)? (important for complex PRs)

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,5 @@ tags
184184
wandb
185185

186186
# AI agent generated symlinks
187-
/AGENTS.md
188-
/CLAUDE.md
189187
/.agents/skills
190188
/.claude/skills

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.ai/AGENTS.md

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.ai/AGENTS.md

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,14 @@ post-patch:
107107
# AI agent symlinks
108108

109109
codex:
110-
ln -snf .ai/AGENTS.md AGENTS.md
111110
mkdir -p .agents
112111
rm -rf .agents/skills
113112
ln -snf ../.ai/skills .agents/skills
114113

115114
claude:
116-
ln -snf .ai/AGENTS.md CLAUDE.md
117115
mkdir -p .claude
118116
rm -rf .claude/skills
119117
ln -snf ../.ai/skills .claude/skills
120118

121119
clean-ai:
122-
rm -f AGENTS.md CLAUDE.md
123120
rm -rf .agents/skills .claude/skills

docs/source/en/conceptual/contribution.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ For documentation strings, 🧨 Diffusers follows the [Google style](https://goo
570570

571571
## Coding with AI agents
572572

573-
The repository keeps AI-agent configuration in [`.ai/`](https://github.com/huggingface/diffusers/tree/main/.ai) and exposes local agent files via symlinks. If you use a coding agent (Claude Code, OpenAI Codex, etc.) to help with a contribution, point it at this directory — it contains the project conventions and on-demand task knowledge maintainers expect contributors to follow.
573+
The repository keeps AI-agent configuration in [`.ai/`](https://github.com/huggingface/diffusers/tree/main/.ai). Run `make claude` / `make codex` to additionally wire up the on-demand task skills for your tool.
574574

575-
- **Read-only for contributors**`.ai/` is maintained by the core maintainers. Please do not edit files under `.ai/` (or the generated root-level `AGENTS.md`, `CLAUDE.md`, `.agents/skills`, `.claude/skills`, which are symlinks) in your PR. If you find something missing or wrong, open an issue or flag it on the PR and a maintainer will update it.
575+
- **Read-only for contributors**`.ai/` is maintained by the core maintainers. Please do not edit files under `.ai/` (or the root-level `AGENTS.md` / `CLAUDE.md` symlinks, or the generated `.agents/skills` / `.claude/skills`) in your PR. If you find something missing or wrong, open an issue or flag it on the PR and a maintainer will update it.
576576
- **Guidelines** (loaded into every agent session):
577577
- [`.ai/AGENTS.md`](https://github.com/huggingface/diffusers/blob/main/.ai/AGENTS.md) — top-level coding guidelines
578578
- [`.ai/models.md`](https://github.com/huggingface/diffusers/blob/main/.ai/models.md) — attention pattern, model implementation rules, common conventions
@@ -583,9 +583,9 @@ The repository keeps AI-agent configuration in [`.ai/`](https://github.com/huggi
583583
- `model-integration` — adding a new model or pipeline to diffusers end-to-end (file structure, integration checklist, testing layout, weight conversion)
584584
- `self-review` — review your changes against the project rules before opening a PR
585585
- **Setup commands**:
586-
- `make codex`symlink guidelines + skills for OpenAI Codex
587-
- `make claude`symlink guidelines + skills for Claude Code
588-
- `make clean-ai` — remove all generated symlinks
586+
- `make codex`wire up skills for OpenAI Codex (under `.agents/`)
587+
- `make claude`wire up skills for Claude Code (under `.claude/`)
588+
- `make clean-ai` — remove the generated skills symlinks
589589

590590
### AI-assisted and agentic contributions
591591

0 commit comments

Comments
 (0)