Skip to content

[ci] claude in ci.#13297

Open
sayakpaul wants to merge 2 commits intomainfrom
claude-ci-integration-plan
Open

[ci] claude in ci.#13297
sayakpaul wants to merge 2 commits intomainfrom
claude-ci-integration-plan

Conversation

@sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Mar 20, 2026

What does this PR do?

Use Claude for PR reviews. Some choices / comments:

  • A GitHub Actions workflow (using anthropics/claude-code-action) that auto-reviews PRs touching src/diffusers/** and responds to @claude mentions from folks with write access to the repo.
  • An initial .ai/review-rules.md file distilled from the existing AGENTS.md, model-integration skill, and parity-testing pitfalls. It currently covers: covering code style, dependencies, models, pipelines, and copied code.
  • A "compounding engineering" workflow where maintainers add new review rules directly from PR comments (e.g., @claude add to review-rules.md to never use einops) — Claude commits the rule update to the PR branch, so rules accumulate over time with zero friction. This is inspired by https://x.com/bcherny/status/2007179842928947333.
  • Access control: only users with write access can invoke @claude.
  • Cost control: path-filtered to src/diffusers/** only.

How to use?

  • Claude only runs when explicitly invoked via review any PR that changes files under src/diffusers/**.
  • Ask Claude a question: Comment @claude on any PR to ask Claude about the code, the diff, or the review rules.
  • Add a new rule: When you spot a recurring mistake, comment something like:
    @claude add to .ai/review-rules.md to never use numpy operations in forward methods, always use torch equivalents. Claude will update the rules file and commit it to the PR branch.

@sayakpaul sayakpaul requested review from DN6, dg845 and yiyixuxu March 20, 2026 06:43
Copy link
Collaborator

@yiyixuxu yiyixuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this!
great start

@@ -0,0 +1,34 @@
# PR Review Rules
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a lot of overlaps from https://github.com/huggingface/diffusers/blob/main/.ai/skills/model-integration/SKILL.md

I think maybe we have a separate subdoc for models.md that contains the gotchas, common conventions, rules, structures etc and we can link it from everywhere: for now both AGENTS.md and the model-integration skills

what do you think? cc @stevhliu here too

these contents that are already in AGENTS.md does not need to be included here again, I think claude CI would have read the AGENTS.md. anyways no?


on:
issue_comment:
types: [created]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also be able to @claude on the pr review comment? (not just issue comments) this gives it more context for stuff like we want it to add a rule based on this pattern eetc

@yiyixuxu yiyixuxu requested a review from stevhliu March 20, 2026 20:46
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: |
--append-system-prompt "Review this PR against the rules in .ai/review-rules.md. Focus on correctness, not style (ruff handles style). Only review changes under src/diffusers/."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add something like
only commit changes when explicitly asked using words/phrase blah blah - then maybe we can come up with a safe word for it lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants