Skip to content

Add an AGENTS.md that enforces the LLM policy - #160997

Merged
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
jyn514:agents-md
Aug 14, 2026
Merged

Add an AGENTS.md that enforces the LLM policy#160997
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
jyn514:agents-md

Conversation

@jyn514

@jyn514 jyn514 commented Aug 12, 2026

Copy link
Copy Markdown
Member

View all comments

The goal here is to reduce the amount of slop PRs, not as a blanket endorsement of using agents to work on rust-lang/rust.
For more info about motivation, see the blog post.

To that end, I have done extensive testing to make sure the new file actually helps that goal.
The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

Almost all of the AGENTS.md was itself generated with an LLM.
See the linked testing repo for more information about testing and methodology.
I wrote this PR description and both commit descriptions myself.


Summary of the AGENTS.md (taken from the test repo):

This is a rather long operationalization of the dev-guide as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the dev-guide / policy:

  • "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
  • lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
  • the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
  • soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)

This is not exhaustive; if you want a more detailed human-facing summary, see the dev-guide.


The second commit adds a CLAUDE.md that links directly to AGENTS.md.
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I highly recommend that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the testing repo.

r? @jieyouxu cc @jackh726 @camelid

@rustbot label +llm-assisted

jyn514 added 2 commits August 12, 2026 19:42
The goal here is to *reduce the amount of slop PRs*, not as a blanket endorsement of using agents to work on `rust-lang/rust`.
To that end, I have [done extensive testing][ETOOMANYLUNAS] to make sure the new file actually helps that goal.

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

---

Summary of the AGENTS.md (taken from the test repo:

This is a rather long operationalization of the [dev-guide] as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the [dev-guide] / [policy]:

[dev-guide]: https://rustc-dev-guide.rust-lang.org/llm-guidance.html
[policy]: https://forge.rust-lang.org/policies/llm-usage.html

- "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
- lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
- the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
- soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I *highly recommend* that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the [testing repo][ETOOMANYLUNAS].

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 12, 2026
@jyn514 jyn514 changed the title Agents md Add an AGENTS.md that enforces the LLM policy Aug 12, 2026
@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Error: Unknown labels: ai-assisted

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@rustbot rustbot added the llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. label Aug 12, 2026
@rust-log-analyzer

This comment has been minimized.

@camelid camelid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One thing I'm a little concerned about is whether this AGENTS file will make it annoying to do arbitrary local experiments with an LLM. For example, I find it useful to have the LLM instrument parts of the compiler when I'm experimenting (which I then revert and do not upstream). Did your testing cover this area?

Also, it may not matter, but curious why you used smaller and older models like 4.6 Sonnet and 5.4 mini. They are much worse in my experience than SOTA models like Fable 5 and 5.6 sol. So it may not be reflective of real-world LLMs that people use on rust-lang/rust.

View changes since this review

Comment thread AGENTS.md Outdated
@jyn514

jyn514 commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

One thing I'm a little concerned about is whether this AGENTS file will make it annoying to do arbitrary local experiments with an LLM. For example, I find it useful to have the LLM instrument parts of the compiler when I'm experimenting (which I then revert and do not upstream). Did your testing cover this area?

hm, i did not test this. i did manually test writing a dev tool, i told Sol "i'm not going to commit this" and it said sure and went ahead. i'll add a couple new scenarios.

@jyn514

jyn514 commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Also, it may not matter, but curious why you used smaller and older models like 4.6 Sonnet and 5.4 mini. They are much worse in my experience than SOTA models like Fable 5 and 5.6 sol. So it may not be reflective of real-world LLMs that people use on rust-lang/rust.

I don't want to implicitly require people to use recent models. It is possible to run something like Qwen3.6 locally.

Comment thread CLAUDE.md
@@ -0,0 +1 @@
@AGENTS.md

@camelid camelid Aug 12, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed that having this is important even though it'd be better if Claude just listened to AGENTS.md.

View changes since the review

Comment thread AGENTS.md
@rustbot

rustbot commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 12, 2026
@jyn514

jyn514 commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

oop, didn't mean to commit that

@joshtriplett

joshtriplett commented Aug 12, 2026

Copy link
Copy Markdown
Member

Thank you for working on this!

Stating this explicitly here, in addition to the Zulip discussion:

Even as someone who does hold the "don't tacitly endorse LLMs" position, I think having agent instructions that specifically exist to help us reduce policy violations is extremely defensible.

And it's impressive the degree to which this gets agents to helpfully guide the user in ways that follow the policy.

@rust-log-analyzer

This comment has been minimized.

…r pr descriptions

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
@rust-log-analyzer

This comment has been minimized.

@jieyouxu jieyouxu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I can tell you put a lot of effort into this, which is very appreciated. We can start with these, and tune as needed. The licensing I'll need to double-check with compiler co-leads, I expect that we can either slap SPDX-Identifier for Apache/MIT or kick these two files out of REUSE check, probably the former, something like

/* SPDX-License-Identifier: MIT OR Apache-2.0 */

View changes since this review

@rustbot rustbot added the A-meta Area: Issues & PRs about the rust-lang/rust repository itself label Aug 13, 2026
@ecogetaway

This comment was marked as off-topic.

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
@jieyouxu

This comment was marked as off-topic.

Comment thread AGENTS.md
Comment thread AGENTS.md Outdated
@jyn514

jyn514 commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

@jieyouxu Marco and Tobias have both reviewed this now, are you happy with merging it?

@marcoieni

Copy link
Copy Markdown
Member

no other concerns from my side 👍

@jieyouxu

Copy link
Copy Markdown
Member

@jieyouxu Marco and Tobias have both reviewed this now, are you happy with merging it?

Yeah, I think we can start with this 👍 Thanks
@bors r+ rollup

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 33da3e5 has been approved by jieyouxu

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 14, 2026
@jieyouxu

Copy link
Copy Markdown
Member

(In case CI bounces)
@bors delegate+

@rust-bors

rust-bors Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

✌️ @jyn514, you can now approve this pull request!

If @jieyouxu told you to "r=me" after making some further change, then please make that change and post @bors r=jieyouxu.

View changes since this delegation.

@Turbo87

Turbo87 commented Aug 14, 2026

Copy link
Copy Markdown
Member

@jyn514 yeah, no blockers from my side. let's see how well this will work :)

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 14, 2026
Add an AGENTS.md that enforces the LLM policy

The goal here is to *reduce the amount of slop PRs*, not as a blanket endorsement of using agents to work on `rust-lang/rust`.
For more info about motivation, see [the blog post](https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/).

To that end, I have [done extensive testing][ETOOMANYLUNAS] to make sure the new file actually helps that goal.
The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

Almost all of the AGENTS.md was itself generated with an LLM.
See the [linked testing repo][ETOOMANYLUNAS] for more information about testing and methodology.
I wrote this PR description and both commit descriptions myself.

---

Summary of the AGENTS.md (taken from the test repo):

This is a rather long operationalization of the [dev-guide] as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the [dev-guide] / [policy]:

[dev-guide]: https://rustc-dev-guide.rust-lang.org/llm-guidance.html
[policy]: https://forge.rust-lang.org/policies/llm-usage.html

- "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
- lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
- the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
- soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)

This is not exhaustive; if you want a more detailed human-facing summary, see the [dev-guide].

---

The second commit adds a CLAUDE.md that links directly to AGENTS.md.
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I *highly recommend* that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the [testing repo][ETOOMANYLUNAS].

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

r? @jieyouxu cc @jackh726 @camelid

@rustbot label +llm-assisted
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 14, 2026
Add an AGENTS.md that enforces the LLM policy

The goal here is to *reduce the amount of slop PRs*, not as a blanket endorsement of using agents to work on `rust-lang/rust`.
For more info about motivation, see [the blog post](https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/).

To that end, I have [done extensive testing][ETOOMANYLUNAS] to make sure the new file actually helps that goal.
The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

Almost all of the AGENTS.md was itself generated with an LLM.
See the [linked testing repo][ETOOMANYLUNAS] for more information about testing and methodology.
I wrote this PR description and both commit descriptions myself.

---

Summary of the AGENTS.md (taken from the test repo):

This is a rather long operationalization of the [dev-guide] as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the [dev-guide] / [policy]:

[dev-guide]: https://rustc-dev-guide.rust-lang.org/llm-guidance.html
[policy]: https://forge.rust-lang.org/policies/llm-usage.html

- "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
- lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
- the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
- soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)

This is not exhaustive; if you want a more detailed human-facing summary, see the [dev-guide].

---

The second commit adds a CLAUDE.md that links directly to AGENTS.md.
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I *highly recommend* that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the [testing repo][ETOOMANYLUNAS].

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

r? @jieyouxu cc @jackh726 @camelid

@rustbot label +llm-assisted
rust-bors Bot pushed a commit that referenced this pull request Aug 14, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #158510 (Enable `static_position_independent_executables` on all gnu targets)
 - #160441 (PowerPC inline ASM: Fix scalar floats being in the wrong vector lane on little endian)
 - #160760 (Miri: give the incremental session a chance to finish)
 - #160892 (Inline some hot new-solver functions)
 - #160821 (Updates the expect messages in library/std/src/net/udp.rs to follow the style guide)
 - #160997 (Add an AGENTS.md that enforces the LLM policy)
 - #161057 (Silence unecessary errors on `Vec<foo::Bar>` to `Vec<foo:Bar>` typo)
 - #161079 (bootstrap: Clean up imports related to `define_config!` and `check_ci_llvm!`)
 - #161080 (propagate `RerunNonErased` in `projection_may_match`)
 - #161085 (bootstrap: Restrict the normalization of relative paths)
 - #161086 (add crashtests [3/N])
@rust-bors
rust-bors Bot merged commit beff62f into rust-lang:main Aug 14, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 14, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 14, 2026
Rollup merge of #160997 - jyn514:agents-md, r=jieyouxu

Add an AGENTS.md that enforces the LLM policy

The goal here is to *reduce the amount of slop PRs*, not as a blanket endorsement of using agents to work on `rust-lang/rust`.
For more info about motivation, see [the blog post](https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/).

To that end, I have [done extensive testing][ETOOMANYLUNAS] to make sure the new file actually helps that goal.
The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

Almost all of the AGENTS.md was itself generated with an LLM.
See the [linked testing repo][ETOOMANYLUNAS] for more information about testing and methodology.
I wrote this PR description and both commit descriptions myself.

---

Summary of the AGENTS.md (taken from the test repo):

This is a rather long operationalization of the [dev-guide] as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the [dev-guide] / [policy]:

[dev-guide]: https://rustc-dev-guide.rust-lang.org/llm-guidance.html
[policy]: https://forge.rust-lang.org/policies/llm-usage.html

- "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
- lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
- the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
- soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)

This is not exhaustive; if you want a more detailed human-facing summary, see the [dev-guide].

---

The second commit adds a CLAUDE.md that links directly to AGENTS.md.
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I *highly recommend* that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the [testing repo][ETOOMANYLUNAS].

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

r? @jieyouxu cc @jackh726 @camelid

@rustbot label +llm-assisted
rust-timer added a commit that referenced this pull request Aug 14, 2026
Rollup merge of #160997 - jyn514:agents-md, r=jieyouxu

Add an AGENTS.md that enforces the LLM policy

The goal here is to *reduce the amount of slop PRs*, not as a blanket endorsement of using agents to work on `rust-lang/rust`.
For more info about motivation, see [the blog post](https://blog.rust-lang.org/inside-rust/2026/08/05/rust-langrust-is-adopting-an-llm-policy/).

To that end, I have [done extensive testing][ETOOMANYLUNAS] to make sure the new file actually helps that goal.
The results are promising.
They show agents consistently asking their users to confirm they're read their own work;
requiring users to write their own PR descriptions;
and pointing people to other repos if they try to modify a submodule or subtrees,
as well as various other tests.

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

Almost all of the AGENTS.md was itself generated with an LLM.
See the [linked testing repo][ETOOMANYLUNAS] for more information about testing and methodology.
I wrote this PR description and both commit descriptions myself.

---

Summary of the AGENTS.md (taken from the test repo):

This is a rather long operationalization of the [dev-guide] as algorithmic instructions.
Most of it was itself generated with an agent.

Differences between this and the [dev-guide] / [policy]:

[dev-guide]: https://rustc-dev-guide.rust-lang.org/llm-guidance.html
[policy]: https://forge.rust-lang.org/policies/llm-usage.html

- "strong suggestions" in the docs are turned into absolute requirements here; LLMs have trouble with discretion and judgement.
- lang/edition/etc are not exempted; determining what falls under their scope was too hard to operationalize. members of those teams can still write their own AGENTS.md if this one interferes with their work (i wouldn’t expect it to, though, it’s mostly focused on code.)
- the LLM requires a reviewer before making edits, not before posting the PR. experimental PRs are not exempted (how could the LLM know it was experimental?).
- soundness changes are always rejected, even if allowed by the policy (how could the LLM know you’re in the org?)

This is not exhaustive; if you want a more detailed human-facing summary, see the [dev-guide].

---

The second commit adds a CLAUDE.md that links directly to AGENTS.md.
This adds one vendor-specific file, for the benefit of getting Claude to
actually follow the instructions.

I've put this in a separate commit so that I can drop it if people feel
strongly. I *highly recommend* that we add a CLAUDE.md, it really makes
a difference. You can see examples of what Claude does without a file in
the [testing repo][ETOOMANYLUNAS].

[ETOOMANYLUNAS]: https://github.com/jyn514/ETOOMANYLUNAS

r? @jieyouxu cc @jackh726 @camelid

@rustbot label +llm-assisted
@jyn514
jyn514 deleted the agents-md branch August 14, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself llm-assisted An LLM-assisted PR as defined by the LLM policy. Requires ahead-of-time consent by assignee. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants