blog.rust.gay

Btrfs wants an AGENTS.md for better patches

Btrfs developer Qu Wenruo of SUSE has proposed adding an AGENTS.md file to the fs/btrfs directory in the Linux kernel. The file would set expectations for patch submissions from newcomers and AI/LLM agents: how to write code comments, cover letters, visual aids and charts, patch versions, and tests. The patch is out for review, not merged. Phoronix reports that the motivation is reviewers spending too much time on low-value fixes wrapped in long paragraphs and useless test results.

The proposal is a small documentation change with a large subtext. Large open-source projects are not short of people who can generate a patch. They are short of maintainers who can review one. AI coding tools have made the generation side cheaper, and the review side has not scaled with it. An AGENTS.md file is an attempt to put the norms where the agents will read them before generating another patch. Whether that works depends on whether the norms are specific enough to change behavior, and whether the project is willing to enforce them.

What the patch actually proposes

The file is aimed at two audiences at once: AI agents and human newcomers. That is a sensible pairing. The failure modes are similar. A new contributor may not know that a Btrfs patch needs a clear reproduction, a focused diff, and a concise changelog. An agent may produce a plausible-looking patch with a long explanation, a vague test plan, and no understanding of the subsystem's conventions. Both waste reviewer time in the same way.

Phoronix says the documentation covers code comments, cover letters, visual aids and chart rules, patch versioning, and testing. Those categories are not arbitrary. Code comments are where generated patches often over-explain obvious lines or restate the function name. Cover letters are where they bury the actual change under a page of context. Visual aids are useful for filesystem work, but only if they clarify the on-disk layout or the failure mode. Patch versioning matters because a reviewer needs to know what changed since the last round. Testing matters because "it compiles" is not a test.

The patch message is blunt. Qu Wenruo wrote:

I believe btrfs is not the most affected sub-system, but a lot of newbies without common senses are doing more harm than help. E.g. wasting a lot of human review time on very low value fixes, filled with long paragraphs and useless test steps/results.

He added:

So it would be better to let those agents to stop being stupid and follow the more common practices here, and hopefully those newbies can build some common sense.

And:

I hope the agent file is clear and short enough, that is not only readable for LLMs, but also for humans who want to be long term contributers.

The tone is frustrated. That is worth noting, but it should not obscure the operational point. A maintainer's time is finite. If a subsystem receives ten low-quality patches for every useful one, the useful one waits longer. The proposal is an attempt to shift some of the filtering from the reviewer to the contributor's tooling.

The real bottleneck is review

The economics of AI-assisted coding are strange. Generating a patch is now cheap. Reviewing it is not. A model can produce a diff in seconds, but a maintainer still has to understand the change, check the locking, run the tests, and decide whether it is correct. If the patch is wrong in a subtle way, the review takes longer than writing the patch would have. That is the opposite of the usual productivity story.

Btrfs is particularly exposed because it is a filesystem. A bad patch can corrupt data, and a bad test can miss the corruption. The subsystem has a reputation for complexity, and its reviewers are a small group. A flood of low-value changes is not just annoying; it can crowd out the work that actually needs attention. The same pattern is visible in other kernel subsystems, which is why the proposal is likely to be watched beyond Btrfs.

An AGENTS.md file cannot solve the underlying imbalance. It can only change the default behavior of the tools that read it. If an agent is configured to read repository documentation, the file can tell it to keep the diff small, include a reproducer, and avoid speculative refactors. If the agent ignores the file, nothing happens. If a human contributor ignores it, a maintainer can point to it in review. That is a modest but real improvement in the cost of saying "this is not ready."

Why a file, and why now

Repository-level instruction files have become common in AI-assisted development. They are a way to encode project conventions in a place that both humans and agents can find. The Linux kernel already has Documentation/process/ and subsystem-specific guides. An AGENTS.md in fs/btrfs is more local and more direct. It can say "for this subsystem, do these things" without pretending to be a general kernel policy.

The timing is not accidental. AI coding agents are now capable enough to produce patches that look plausible, which makes triage harder. A patch that is obviously broken is easy to reject. A patch that compiles, passes a superficial test, and has a confident commit message takes real effort to evaluate. The cost of a false positive is high, and the volume is rising. A short, specific file is a cheap intervention compared with hiring more reviewers or adding a formal gate.

There is also a social function. The file tells human newcomers what the project values. It can demystify the review process and reduce the number of rounds a good-faith contributor needs. That is a benefit that has nothing to do with AI. A well-written AGENTS.md is a contribution guide with a new name and a new audience.

The risk of gatekeeping

The phrase "newbies without common senses" is going to bother people, and it should. It frames the problem as a personal deficiency rather than a mismatch between the contributor's context and the subsystem's expectations. A newcomer who has never worked on a filesystem does not know what a useful test looks like. That is not a lack of common sense; it is a lack of experience. A good guide should teach, not just complain.

There is also a risk that the file becomes a checklist that excludes people who do not know the magic words. If the review process requires a specific cover-letter format, a specific chart style, and a specific test harness, the project may filter out contributors who would have learned quickly. The best version of the file is short, concrete, and linked to examples. The worst version is a long list of rules that nobody reads until a patch is rejected.

The AI angle adds another layer. A project can legitimately decide that it does not want low-effort AI-generated patches. But "AI-generated" is hard to detect reliably, and a policy that tries can produce false accusations. The more durable approach is to judge the patch on its content: does it fix a real problem, is the diff minimal, is the test meaningful, and is the explanation honest? Those criteria apply to humans and agents alike.

What a useful patch looks like

The Btrfs proposal is a good excuse to restate the basics, because they are not specific to Btrfs. A useful patch starts with a problem statement: what is broken, how it was observed, and why the fix is needed. It includes a minimal reproducer or a clear description of the conditions. It changes as little as possible. It explains the trade-offs, especially for a filesystem where a correctness fix may cost performance. It includes a test that would fail without the patch and pass with it. And it keeps the commit message focused on the change, not on the contributor's journey.

Those norms are simple to state and hard to follow. An AI agent can follow them if it is prompted well, but it can also produce a convincing imitation. The reviewer's job is to check the substance, not the format. An AGENTS.md file can reduce the formatting noise, but it cannot replace the reviewer's judgment. That is why the proposal should be judged by whether it reduces review time, not by whether it makes the project feel more disciplined.

How to tell whether it worked

The proposal is easy to evaluate in principle and hard to evaluate in practice. The obvious metric is the number of patches that are rejected for style or completeness, but that number can move for reasons unrelated to the file. A better metric is review latency for patches that are eventually accepted. If the file reduces the number of rounds between a contributor and a maintainer, it is doing its job. If it only changes the wording of the first rejection, it is not.

A second metric is the quality of the first submission. A patch that includes a reproducer, a focused diff, and a real test is cheaper to review even if it is not accepted. A patch that requires three rounds of clarification is expensive regardless of whether it is AI-generated. The file should be judged by whether it shifts the distribution toward the former, not by whether it makes every submission perfect.

One practical addition would be a short section on provenance. If a patch was generated with an assistant, the contributor should say so, not because the patch is automatically suspect, but because the reviewer may want to ask different questions. Which parts were generated? Which tests were run by the model, and which by a human? Was the model given the subsystem documentation? Those answers help a maintainer calibrate trust. They also make the disclosure normal rather than adversarial.

There is also a human cost that is harder to measure. A newcomer who reads a hostile guide may decide not to contribute at all. A guide that says \"stop being stupid\" may be memorable, but it is not welcoming. The best version of the file would keep the concrete rules and drop the insult. The goal is to teach the norms, not to win an argument about who is responsible for the current review load.

What to watch

The first question is whether the patch is merged and in what form. A short file that points to existing documentation is more likely to survive than a long rulebook. The second is whether other subsystems adopt the same pattern. If Btrfs, XFS, and the networking tree each write their own AGENTS.md, the kernel may end up with a fragmented set of norms. A shared template with subsystem-specific sections would be more coherent, but it is also harder to agree on.

The third question is the effect on contributors. If the file reduces the number of low-quality patches and shortens review cycles, it will be copied. If it mainly gives reviewers another reason to reject patches, it will be ignored or resented. The outcome will depend on tone as much as content. The proposal's frustrated framing is understandable, but the file itself needs to be generous enough to teach.

For now, the useful takeaway is that AI has moved the bottleneck. Writing code is cheaper; reviewing it is not. Projects that want to benefit from the cheaper part have to invest in the expensive part. An AGENTS.md file is a small investment. It is not a solution, but it is a reasonable place to start.

Sources


← back to posts