# Btrfs wants its own AGENTS.md: rules so AI-made patches stop wasting reviewers' time

- **Published on:** 2026-11-18
- **Category:** News
- **Original page:** https://free-linux.com/articles/btrfs-agents-md-ai-patch-rules

Qu Wenruo, one of the most active Btrfs developers, has sent a patch that adds fs/btrfs/AGENTS.md: 136 lines of rules for AI agents and the people using them. Short messages, ASCII charts instead of paragraphs, no testing steps for minor bugs, and check what Sashiko says. It would be the first file of its kind inside a kernel subsystem.

---

On 17 November, **Qu Wenruo**, a SUSE engineer and one of the names that shows up most in Btrfs history, sent an unusual patch to the file system's mailing list. It doesn't touch a single line of C. It adds a text file, `fs/btrfs/AGENTS.md`, with rules on how comments, commit messages and cover letters should be written for patches aimed at Btrfs.

It has two readers in mind: the AI agents that generate patches, which load `AGENTS.md` files on their own, and the people who use them without knowing the project's habits. Qu's own explanation is blunt: "I believe btrfs is not the most affected sub-system, but a lot of newbies without common senses are doing more harm than help." In his words, they waste a lot of review time on very low value fixes, "filled with long paragraphs and useless test steps/results."

## What Qu Wenruo is proposing

<figure>
  <img src="/articles/btrfs-agents-md/btrfs-agents-parche.webp" alt="Terminal running three commands on the qu-agents.patch file: grep shows &quot;create mode 100644 fs/btrfs/AGENTS.md&quot;, awk with wc -l counts 136 added lines and a final grep lists the file's six sections: Code comments, Commit messages and cover letters, Visual aids, Versioned patches, Sashiko review and Testing steps" loading="lazy" decoding="async">
  <figcaption>The patch creates a single 136-line file with six sections · Own screenshot</figcaption>
</figure>


The patch is titled "btrfs: add a per-subsystem agent file" and creates a single 136-line file. We downloaded it from the list's public mirror and checked its contents: six sections that come, as the first line says, on top of the kernel's top-level `AGENTS.md` and `Documentation/process/coding-assistants.rst`, the general rules for AI assistants.

In the patch description, Qu says he wants the agents "to stop being stupid" and follow common practice, and hopes the newcomers behind them build some common sense. He also wants the text to be clear and short enough to work for any human who wants to be a long-term contributor, not just for a machine.

There's a curious detail. Although the subject says `[PATCH]`, below the `---` line there's a "Reason for RFC" section (request for comments). There Qu admits that some rules are personal preferences, such as ASCII charts or short sentences, that other Btrfs developers may not share, and asks the veterans for feedback.

## The six rules, one by one

**Code comments.** Only when the code isn't obvious on its own, for example a locking rule, a required ordering or the reason for a workaround. No restating what the next line does and no narrating the change with comments like "fix for…" or "new helper to…". Comments that carry no information can go, but only in the lines being touched. And kernel-doc only for complex functions.

**Commit messages and cover letters.** A human has to understand them first. Short sentences, one idea per sentence, no filler, no long background. The `[BUG]`, `[CAUSE]` and `[FIX]` tags are kept for complex bugs; simple ones get plain paragraphs. The subject starts with `btrfs: `, lower case and imperative, lines stay within 75 columns and quoted text (dmesg, stack traces) is never folded. Before drafting, look at `git log -- fs/btrfs` and copy the style.

**Visual aids.** This is the most personal part. To explain a race, an error-handling bug seen from several callers or a call chain across layers, the file asks for an ASCII chart rather than a paragraph, with function names and no file paths or line numbers. It includes two examples. This is the one for a race between a write completion and an `fsync`:

```
 CPU0 (endio)                       CPU1 (fsync)
 end_bbio_data_write()
 |-btrfs_folio_clear_writeback()
 |                                  btrfs_sync_file()
 |                                  |-filemap_fdatawait_range()
 |                                  | Returns after writeback finished
 |                                  |
 |                                  \-test_and_clear_bit(COW_WRITE_ERROR)
 |                                    Still 0, skips waiting
 \-set_bit(COW_WRITE_ERROR)
   Too late.
```

**Versioned patches.** Always the full history, newest version first, in the cover letter or below the `---` line, never in the commit message body.

**Sashiko review.** Whoever sends a patch should check what Sashiko said about it. If the report is right, fix it in the next version. If it's wrong, it can be ignored, and a reply on the list only makes sense when the reason isn't obvious.

**Testing steps.** For minor bugs, none. The file defines "minor" as anything that doesn't affect normal use: an unlikely error path, a corner case that needs fault injection, a tracepoint or a debug-only problem. Testing steps only make sense for complex bugs that can be hit in normal use or have a deep impact, and only when they help reproduce them.

## Sashiko: AI reviewing AI

The fifth rule takes for granted something not many people outside the kernel know about. [Sashiko](https://github.com/sashiko-dev/sashiko) is an agentic AI code review system, open source (Apache 2.0) and hosted by the Linux Foundation. It reads patches posted to mailing lists, reviews them and publishes the results on [sashiko.dev](https://sashiko.dev), where Btrfs has its own page. According to the project, Google pays for the infrastructure and tokens of the public instance.

It's already leaving a mark on mainline: recent commits carry a `Reported-by: Sashiko <sashiko-bot@kernel.org>` line and a link to its review. There's some irony in it. Qu's file asks the agents that generate patches to listen to another agent that reviews them, and asks the humans to decide which of the two is right.

## It fits what the kernel already says

<figure>
  <img src="/articles/btrfs-agents-md/btrfs-agents-arbol-kernel.webp" alt="Terminal running git ls-tree on the kernel's v7.4-rc3 tag: the only AGENTS.md in the tree is the top-level one, a symlink (mode 120000); Documentation/process contains coding-assistants.rst and generated-content.rst, and searching fs/btrfs for &quot;agents&quot; returns 0" loading="lazy" decoding="async">
  <figcaption>Linux 7.4-rc3 has a single AGENTS.md, the top-level one, and none in fs/btrfs · Own screenshot</figcaption>
</figure>


Btrfs isn't starting from scratch. The kernel has spent all of 2026 writing rules about AI, and the Btrfs `AGENTS.md` builds on them:

- **`Documentation/process/generated-content.rst`**, by Dave Hansen, landed in Linux 7.0. It asks for transparency when a meaningful part of a patch was generated by a tool, and points out that reviewers' time is a scarce resource.
- **`Documentation/process/coding-assistants.rst`** is the rulebook for assistants. It forbids agents from adding `Signed-off-by`, because only a person can certify where the code comes from. In August, Willy Tarreau added a nine-step procedure for finding and fixing bugs with AI: reproduce the bug, write the fix, build it, test it and state clearly what couldn't be done, because maintainers "waste too much time" on unverified reports.
- **Linux 7.4-rc1** brought two changes from Sasha Levin. One removed the `Assisted-by` tag: according to the commit, only about 10% of the 18,533 commits in 7.3 carried it even though actual LLM use is far more widespread, so it didn't work as a signal. The other added a **top-level `AGENTS.md`** that is a symlink to `README`, because agents load that file on their own and so end up reading the rules.

We checked the 7.4-rc3 tree: there is only one `AGENTS.md` in the whole kernel, the top-level one, and none inside `fs/btrfs`. If Qu's patch is merged, Btrfs would be the **first subsystem with its own rules file for agents**.

The underlying problem is the same across the kernel. Just this morning we covered how Microsoft's FORGE lab [needed five months of human work](/articles/microsoft-forge-ai-59-linux-kernel-bugs) to turn two weeks of AI scanning into 59 useful reports. And [the debate over Rust and C in Linux 7.4](/articles/linux-7-4-rust-c-ai-fixes) showed the same thing: AI finds bugs very fast, and the bottleneck is the people who have to review them.

## What it needs to get in

For now it's only a proposal. The Btrfs maintainer is **David Sterba**, with **Chris Mason** as reviewer, and neither had said anything on the list at the time of writing. The only public reply comes from **Leon Romanovsky**, the kernel's InfiniBand maintainer, who says the rules look like "general descriptions" that could fit other subsystems too.

He has a point. Almost everything the file asks for (short sentences, well-formed subjects, no padding) is already in `submitting-patches.rst` and in the habits of any kernel list. What's specific to Btrfs comes down to the ASCII charts, the `[BUG]`/`[CAUSE]`/`[FIX]` tags and the Sashiko reference. The discussion may end with a shorter Btrfs file or with shared rules for the whole kernel. It may also stay as it is.

## Our take

It's a practical way to deal with a problem that isn't going away. Banning AI-made patches doesn't work: nobody can check it, and the kernel maintainers dropped the `Assisted-by` tag for that very reason. What you can do is explain the rules to whoever is going to read them, and today part of those sending patches are agents that read `AGENTS.md` before anything else.

Qu's tone has drawn attention ("newbies without common senses", agents that should "stop being stupid"), but the rules are reasonable and nearly all of them apply to anyone sending their first patch, AI or not. Our favourite is the one about testing steps: a ten-paragraph report about an error path that never happens takes longer to review than to write, and with AI in the loop that multiplies.

If you use Btrfs, nothing changes: it's a document for developers and doesn't touch the code. If you want to know more about the file system, we compare it with ext4 and ZFS in [this article](/articles/ext4-btrfs-zfs-filesystems).

## How we tested this

On 18 November, from a Mac with git 2.56.1 and gh 2.104.0:

- We downloaded the original message from the public linux-btrfs mirror on spinics.net (lore.kernel.org asks for an anti-bot check), saved the patch as `qu-agents.patch` and counted its lines and sections.
- We cloned Linus Torvalds' tree at the `v7.4-rc3` tag without downloading the files, only the structure, and searched for every `AGENTS.md`:

```sh
git clone --depth 1 --filter=blob:none --no-checkout \
    --branch v7.4-rc3 https://github.com/torvalds/linux.git
cd linux
git ls-tree -r --name-only v7.4-rc3 | grep -E '(^|/)AGENTS\.md$'
git ls-tree -r --name-only v7.4-rc3 fs/btrfs | grep -ci agents
```

- We read `coding-assistants.rst`, `generated-content.rst` and the `README` of that release, and used `gh api repos/torvalds/linux/compare/<commit>...<tag>` to check which release each change landed in: `generated-content.rst` in 7.0, and the top-level `AGENTS.md` and the removal of `Assisted-by` in 7.4-rc1.
- We took the Btrfs maintainers and Leon Romanovsky's subsystems from the `MAINTAINERS` file of the same release.

**Sources:** [btrfs: add a per-subsystem agent file](https://lore.kernel.org/linux-btrfs/df1c1fa031ba7e66486348dc37d1a7be53c18e43.1794894953.git.wqu@suse.com/), Qu Wenruo, linux-btrfs (17 Nov 2026; [mirror on spinics.net](https://www.spinics.net/lists/linux-btrfs/msg170447.html)) and [Leon Romanovsky's reply](https://www.spinics.net/lists/linux-btrfs/msg170465.html); [coding-assistants.rst](https://github.com/torvalds/linux/blob/master/Documentation/process/coding-assistants.rst) and [generated-content.rst](https://github.com/torvalds/linux/blob/master/Documentation/process/generated-content.rst) in Linus Torvalds' tree; commits [docs: add AGENTS.md as a symlink to README](https://github.com/torvalds/linux/commit/90d9f76ccb72) and [docs: remove Assisted-by references](https://github.com/torvalds/linux/commit/1e035297ffda), by Sasha Levin; [Sashiko](https://github.com/sashiko-dev/sashiko) and its [linux-btrfs page](https://sashiko.dev/#/?list=org.kernel.vger.linux-btrfs). Checked on 18 Nov 2026.
