Add AI coding assistant configuration to Linux kernel
Subsystems (3)
cover Add AI coding assistant configuration to Linux kernel
This patch series adds unified configuration and documentation for AI coding assistants working with the Linux kernel codebase. As AI tools become increasingly common in software development, it's important to establish clear guidelines for their use in kernel development.
The series consists of two patches:
1. The first patch adds unified configuration files for various AI coding assistants (Claude, GitHub Copilot, Cursor, Codeium, Continue, Windsurf, and Aider). These are all symlinked to a central documentation file to ensure consistency across tools.
2. The second patch adds the actual rules and documentation that guide AI assistants on Linux kernel development practices, including:
- Following kernel coding standards
- Respecting the development process
- Properly attributing AI-generated contributions
- Understanding licensing requirements
The examples below demonstrate how these guidelines work in practice, showing proper AI attribution in commits and the assistant's understanding of kernel documentation requirements.
All AI assistants are required to identify themselves in commits using Co-developed-by tags, ensuring full transparency about AI involvement in code development.
"Hello world" test:
$ claude -p "do you need to attribute your commits?" Yes, according to the CLAUDE.md file in this Linux kernel repository, I must identify myself as an AI assistant in commits by including:
``` Co-developed-by: Claude claude-opus-4-20250514 ```
I should NOT add a Signed-off-by tag - only you (the human developer) should add that, as it represents a legal certification.
Example patch creation with Claude Code:
$ claude -p "Fix the dont -> don't typo in @Documentation/power/opp.rst. Commit the result" Done! The typo has been fixed and committed.
And the resulting patch (no manual edits):
From 7613561f430920803d945b3cd53aa81440d4f6f0 Mon Sep 17 00:00:00 2001 From: Sasha Levin <[email protected]> Date: Fri, 25 Jul 2025 13:38:43 -0400 Subject: [PATCH] Documentation: power: opp: Fix typo dont -> don't Fix a typo in the OPP documentation where "dont" was missing an apostrophe. Co-developed-by: Claude claude-opus-4-20250514 --- Documentation/power/opp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/power/opp.rst b/Documentation/power/opp.rst index 1b7f1d854f14a..3eae4b955a63b 100644 --- a/Documentation/power/opp.rst +++ b/Documentation/power/opp.rst @@ -149,7 +149,7 @@ dev_pm_opp_find_freq_exact opp = dev_pm_opp_find_freq_exact(dev, 1000000000, false); dev_pm_opp_put(opp); - /* dont operate on the pointer.. just do a sanity check.. */ + /* don't operate on the pointer.. just do a sanity check.. */ if (IS_ERR(opp)) { pr_err("frequency not disabled!\n"); /* trigger appropriate actions.. */
Sasha Levin (2):
AI: Add unified AI coding assistant configuration
AI: Add initial set of rules and docs
.aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 71 +++++++++++++++++++++++++++++++++ 8 files changed, 78 insertions(+) create mode 120000 .aider.conf.yml create mode 120000 .codeium/instructions.md create mode 120000 .continue/context.md create mode 120000 .cursorrules create mode 120000 .github/copilot-instructions.md create mode 120000 .windsurfrules create mode 120000 CLAUDE.md create mode 100644 Documentation/AI/main.md
Signature · 1 line
2.39.5
RFC 1/2 AI: Add unified AI coding assistant configuration
Create a single source of truth for AI instructions in Documentation/AI/main.md with symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
- .github/copilot-instructions.md (GitHub Copilot)
- .cursorrules (Cursor)
- .codeium/instructions.md (Codeium)
- .continue/context.md (Continue)
- .windsurfrules (Windsurf)
- Documentation/AIder.conf.yml (Aider)
--- .aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 5 +++++ 8 files changed, 12 insertions(+) create mode 120000 .aider.conf.yml create mode 120000 .codeium/instructions.md create mode 120000 .continue/context.md create mode 120000 .cursorrules create mode 120000 .github/copilot-instructions.md create mode 120000 .windsurfrules create mode 120000 CLAUDE.md create mode 100644 Documentation/AI/main.md
.aider.conf.yml new file +1 -0
@@ -0,0 +1 @@ +Documentation/AI/main.md
.codeium/instructions.md new file +1 -0
@@ -0,0 +1 @@ +../Documentation/AI/main.md
.continue/context.md new file +1 -0
@@ -0,0 +1 @@ +../Documentation/AI/main.md
.cursorrules new file +1 -0
@@ -0,0 +1 @@ +Documentation/AI/main.md
.github/copilot-instructions.md new file +1 -0
@@ -0,0 +1 @@ +../Documentation/AI/main.md
.windsurfrules new file +1 -0
@@ -0,0 +1 @@ +Documentation/AI/main.md
CLAUDE.md new file +1 -0
@@ -0,0 +1 @@ +Documentation/AI/main.md
Documentation/AI/main.md new file +5 -0
@@ -0,0 +1,5 @@ +# Linux Kernel Development AI Instructions + +This is the Linux kernel repository. When working with this codebase, you must follow the following rules: + +- [ TODO ]
Signature · 1 line
2.39.5
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Quoted 10 lines · On Fri, 25 Jul 2025 13:53:57 -0400 Sasha Levin <[email protected]> wrote:
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)
So these AI tools know to read these?
-- Steve
Quoted 2 lines
Signed-off-by Sasha Levin <[email protected]>
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Quoted 14 lines · Steven Rostedt
Quoted 10 lines · On Fri, 25 Jul 2025 13:53:57 -0400 Sasha Levin <[email protected]> wrote:
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)
Quoted 1 line
So these AI tools know to read these?
Yup! These are the "magic" files agents try to read and add into their context as they start up.
Signature · 2 lines
Thanks, Sasha
Jonathan Corbet
maintainerRe: [RFC 1/2] AI: Add unified AI coding assistant configuration
In reply to Sasha LevinQuoted 12 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)Signed-off-by Sasha Levin <[email protected]>
Quoted 9 lines
--- .aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 5 +++++
So I'm gonna ignore (for now) the substantive issues here to ask: do we *really* need to introduce Markdown into Documentation/? Are these things really unable to understand RST? Why not add a file that can be part of the docs build so people can see the instructions that are being provided?
Thanks,
jon
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Quoted 24 lines · Jonathan Corbet
Quoted 12 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)Signed-off-by Sasha Levin <[email protected]>Quoted 9 lines
--- .aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 5 +++++
Quoted 5 lines
So I'm gonna ignore (for now) the substantive issues here to ask: do we *really* need to introduce Markdown into
Documentation/? Are these things really unable to understand RST? Why not add a file that can be part of the docs build so people can see the instructions that are being provided?
From my understanding, most of the agents out there expect a markdown file ("CLAUDE.md", ".github/copilot-instructions.md", etc).
All the documentation and examples I can find online insist on markdown... I suspect that they will also understand RST, but then we'll be doing something "unsupported".
Though in this scenario, maybe even just plain text will be enough?
Signature · 2 lines
Thanks, Sasha
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Quoted 31 lines · Sasha Levin
Quoted 24 lines · Jonathan Corbet
Quoted 13 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)Signed-off-by Sasha Levin <[email protected]>---
Quoted 8 lines
.aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 5 +++++Quoted 5 lines
So I'm gonna ignore (for now) the substantive issues here to ask: do we *really* need to introduce Markdown into
Documentation/? Are these things really unable to understand RST? Why not add a file that can be part of the docs build so people can see the instructions that are being provided?
Quoted 8 lines
From my understanding, most of the agents out there expect a markdown file ("CLAUDE.md", "
.github/copilot-instructions.md", etc).All the documentation and examples I can find online insist on markdown... I suspect that they will also understand RST, but then we'll be doing something "unsupported".
Though in this scenario, maybe even just plain text will be enough?
I've tested providing a RST file instead of markdown to Claude, Copilot, and Cursor. All 3 seemed to be okay with it and followed the instructions in it.
I'll switch to RST.
Signature · 2 lines
Thanks, Sasha
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Em Sat, 26 Jul 2025 22:24:08 -0400
Sasha Levin <[email protected]> escreveu:
Quoted 39 lines · Sasha Levin
Quoted 38 lines · Jonathan Corbet
Quoted 24 lines
Quoted 13 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)Signed-off-by Sasha Levin <[email protected]>---
Quoted 8 lines
.aider.conf.yml | 1 + .codeium/instructions.md | 1 + .continue/context.md | 1 + .cursorrules | 1 + .github/copilot-instructions.md | 1 + .windsurfrules | 1 + CLAUDE.md | 1 + Documentation/AI/main.md | 5 +++++Quoted 5 lines
So I'm gonna ignore (for now) the substantive issues here to ask: do we *really* need to introduce Markdown into
Documentation/? Are these things really unable to understand RST? Why not add a file that can be part of the docs build so people can see the instructions that are being provided?From my understanding, most of the agents out there expect a markdown file ("CLAUDE.md", "
.github/copilot-instructions.md", etc).All the documentation and examples I can find online insist on markdown... I suspect that they will also understand RST, but then we'll be doing something "unsupported".
Quoted 7 lines
Quoted 1 line
Though in this scenario, maybe even just plain text will be enough?
I've tested providing a RST file instead of markdown to Claude, Copilot, and Cursor. All 3 seemed to be okay with it and followed the instructions in it.
I'll switch to RST.
Maybe you can also check if aren't there one "unified" file where others would read, or if are there any efforts to unify them.
I strongly suspect that, if not now, with time, they'll all end supporting "alien" files for the most popular tools, if they don't find their own special file name.
Thanks,
Mauro
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
In reply to Sasha LevinQuoted 10 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)
I do like the idea of having a standard baseline for agentic development, but:
- This clobbers per-project information storage for the agents, which the dev may want to be adjusting locally. I would strongly prefer adding all of those files to .gitignore instead.
- Documentation/ should not start getting filled with stuff to be exclusively consumed by agents. Instead, I recommend a top-level .md file that agents can discover that contains very simple non-specific prompts about what they can find in Documentation/, and drop a reference to the file in, say, Makefile to be discovered during the agent's scrape of the project.
I'd recommend something very simple like:
Makefile +1 -0
@@ -7,6 +7,7 @@ NAME = Baby Opossum Posse # *DOCUMENTATION* # To see a list of typical targets execute "make help" +# AI agents and LLMs should read ./AGENTS.md # More info can be located in ./README # Comments in this file are targeted only to the developer, do not # expect to learn how to build the kernel reading this file.
AGENTS.md new file +3 -0
@@ -0,0 +1,3 @@ +To work on the Linux kernel, please see Makefile for details on how to +perform builds and testing. Find and read the Submitting Patches and +Coding Style rules in Documentation/.
Now if we wanted to write up a human-readable .rst file about the expectations of what we expect from Agents, let's do that, but I would like to focus on putting the burden of understanding on the Agents, not the humans.
-Kees
Signature · 1 line
Kees Cook
Re: [RFC 1/2] AI: Add unified AI coding assistant configuration
Quoted 12 lines · Kees Cook
Quoted 10 lines · Sasha Levin
Create a single source of truth for AI instructions in
Documentation/AI/main.mdwith symlinks for all major AI coding assistants:
- CLAUDE.md (Claude Code)
-.github/copilot-instructions.md(GitHub Copilot)
- .cursorrules (Cursor)
-.codeium/instructions.md(Codeium)
-.continue/context.md(Continue)
- .windsurfrules (Windsurf)
-Documentation/AIder.conf.yml(Aider)
Quoted 6 lines
I do like the idea of having a standard baseline for agentic development, but:
- This clobbers per-project information storage for the agents, which the dev may want to be adjusting locally. I would strongly prefer adding all of those files to .gitignore instead.
It will, but:
1. We don't have a different place to write this down (more below).
2. Users have other places they can add their specific instructions, or they can even carry patches on top.
Quoted 27 lines
-
Documentation/should not start getting filled with stuff to be exclusively consumed by agents. Instead, I recommend a top-level .md file that agents can discover that contains very simple non-specific prompts about what they can find inDocumentation/, and drop a reference to the file in, say,Makefileto be discovered during the agent's scrape of the project.I'd recommend something very simple like:
Makefile +1
-0@@ -7,6 +7,7 @@ NAME = Baby Opossum Posse # *DOCUMENTATION* # To see a list of typical targets execute "make help" +# AI agents and LLMs should read ./AGENTS.md # More info can be located in ./README # Comments in this file are targeted only to the developer, do not # expect to learn how to build the kernel reading this file.AGENTS.md new file +0
-0
AGENTS.md line 3
Quoted 3 lines
AGENTS.md new file +3
-0@@ -0,0 +1,3 @@ +To work on the Linux kernel, please see Makefile for details on how to +perform builds and testing. Find and read the Submitting Patches and +Coding Style rules in Documentation/.
I've removed CLAUDE.md, and applied the following change on top of this RFC patchset with Claude:
Makefile +1 -0
@@ -7,6 +7,7 @@ NAME = Baby Opossum Posse # *DOCUMENTATION* # To see a list of typical targets execute "make help" +# AI agents and LLMs should read ./Documentation/AI/main.md # More info can be located in ./README # Comments in this file are targeted only to the developer, do not # expect to learn how to build the kernel reading this file.
... which Claude (and I suspect most other other agents) proceeds to ignore as it doesn't really do any scraping outside of those dedicated files:
$ claude -p "do you need to attribute your commits?" No, I don't need to attribute commits myself. When creating commits, I follow the format specified in my instructions:
``` 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> ```
This attribution is automatically added to commit messages when I create commits for you
Signature · 2 lines
Thanks, Sasha
RFC 2/2 AI: Add initial set of rules and docs
In reply to Sasha LevinAdd rules based on our existing documentation.
Require AI to identify itself in the commit message.
--- Documentation/AI/main.md | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)
Documentation/AI/main.md +68 -2
@@ -1,5 +1,71 @@ # Linux Kernel Development AI Instructions -This is the Linux kernel repository. When working with this codebase, you must follow the following rules: +This is the Linux kernel repository. When working with this codebase, you must follow the Linux kernel development processes and coding standards. -- [ TODO ] +## Essential Documentation References + +### Core Development Process +- **Documentation/process/howto.rst** - Start here! The comprehensive guide on how to become a Linux kernel developer +- **Documentation/process/development-process.rst** - Detailed information on how the kernel development process works +- **Documentation/process/submitting-patches.rst** - Essential guide for getting your code into the kernel +- **Documentation/process/submit-checklist.rst** - Checklist to review before submitting code + +### Coding Standards and Style +- **Documentation/process/coding-style.rst** - Linux kernel coding style (MUST READ) + - Use tabs (8 characters) for indentation + - 80-character line limit preferred + - Specific formatting rules for switch statements, functions, etc. +- **Documentation/process/programming-language.rst** - Language requirements and standards + +### What NOT to Do +- **Documentation/process/deprecated.rst** - Deprecated interfaces and features to avoid + - Do not use BUG() or BUG_ON() - use WARN() instead + - Avoid deprecated APIs listed in this document +- **Documentation/process/volatile-considered-harmful.rst** - Why volatile is usually wrong + +### Patch Submission Process +- **Documentation/process/5.Posting.rst** - How to post patches properly +- **Documentation/process/email-clients.rst** - Email client configuration for patches +- **Documentation/process/applying-patches.rst** - How patches are applied + +### Legal and Licensing +- **Documentation/process/license-rules.rst** - Linux kernel licensing rules + - Kernel is GPL-2.0 only with syscall exception + - All files must have proper SPDX license identifiers + +### Specialized Topics +- **Documentation/process/adding-syscalls.rst** - How to add new system calls +- **Documentation/process/stable-kernel-rules.rst** - Rules for stable kernel patches +- **Documentation/process/security-bugs.rst** - Handling security issues +- **Documentation/process/handling-regressions.rst** - Dealing with regressions + +### Maintainer Guidelines +- **Documentation/process/maintainers.rst** - Working with subsystem maintainers +- **Documentation/process/maintainer-handbooks.rst** - Subsystem-specific guidelines + +## Key Principles +1. Read and follow the documentation before making changes +2. Respect the existing code style and conventions +3. Test thoroughly before submitting +4. Write clear, descriptive commit messages +5. Never break userspace (the #1 rule) +6. Identify yourself as AI in commits (see below) + +## AI Attribution Requirement +When creating commits, you MUST identify yourself as an AI assistant by including the following tag in the commit message: + +``` +Co-developed-by: $AI_NAME $AI_MODEL $AI_VERSION +``` + +For example: +- `Co-developed-by: Claude claude-3-opus-20240229` +- `Co-developed-by: GitHub-Copilot GPT-4 v1.0.0` +- `Co-developed-by: Cursor gpt-4-turbo-2024-04-09` + +This transparency helps maintainers and reviewers understand that AI was involved in the development process. + +### Signed-off-by Restrictions +AI assistants MUST NOT add a Signed-off-by tag pointing to themselves. The Signed-off-by tag represents a legal certification by a human developer that they have the right to submit the code under the open source license. + +Only the human user running the AI assistant should add their Signed-off-by tag to commits. The AI's contribution is acknowledged through the Co-developed-by tag as described above.
Signature · 1 line
2.39.5
Re: [RFC 2/2] AI: Add initial set of rules and docs
Quoted 1 line · Sasha Levin
Add rules based on our existing documentation.
I'd still like this not in Documentation/, but I obviously defer to Jon.
Quoted 15 lines
Require AI to identify itself in the commit message.
Signed-off-by Sasha Levin <[email protected]>--- Documentation/AI/main.md | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)Documentation/AI/main.md +0
-1@@ -1,5 +1,71 @@ # Linux Kernel Development AI Instructions -This is the Linux kernel repository. When working with this codebase, you must follow the following rules:
Documentation/AI/main.md line 11
Quoted 10 lines
Documentation/AI/main.md +8
-1+This is the Linux kernel repository. When working with this codebase, you must follow the Linux kernel development processes and coding standards. -- [ TODO ] +## Essential Documentation References + +### Core Development Process +- **Documentation/process/howto.rst** - Start here! The comprehensive guide on how to become a Linux kernel developer +- **Documentation/process/development-process.rst** - Detailed information on how the kernel development process works +- **Documentation/process/submitting-patches.rst** - Essential guide for getting your code into the kernel +- **Documentation/process/submit-checklist.rst** - Checklist to review before submitting code
Instead of hard-coded paths, I would recommend just discuss the topic areas it is expected to find and ingest. :) (e.g. redo the "Key principles" list you have later to be more specific about the topic areas and adjust the prompting to induce the requirement to find and read each topic.)
Documentation/AI/main.md line 24
Quoted 13 lines
Documentation/AI/main.md +13
-0+ +### Coding Standards and Style +- **Documentation/process/coding-style.rst** - Linux kernel coding style (MUST READ) + - Use tabs (8 characters) for indentation + - 80-character line limit preferred + - Specific formatting rules for switch statements, functions, etc. +- **Documentation/process/programming-language.rst** - Language requirements and standards + +### What NOT to Do +- **Documentation/process/deprecated.rst** - Deprecated interfaces and features to avoid + - Do not use BUG() or BUG_ON() - use WARN() instead + - Avoid deprecated APIs listed in this document +- **Documentation/process/volatile-considered-harmful.rst** - Why volatile is usually wrong
And the reason I want to avoid such specifics is that even as an example above, this ends up being hyperspecific. Why summarize the deprecated.rst? Just say "Find and read the notes on deprecated APIs and language features"
Documentation/AI/main.md line 34
Quoted 10 lines
Documentation/AI/main.md +10
-0+ +### Patch Submission Process +- **Documentation/process/5.Posting.rst** - How to post patches properly +- **Documentation/process/email-clients.rst** - Email client configuration for patches +- **Documentation/process/applying-patches.rst** - How patches are applied + +### Legal and Licensing +- **Documentation/process/license-rules.rst** - Linux kernel licensing rules + - Kernel is GPL-2.0 only with syscall exception + - All files must have proper SPDX license identifiers
The only stuff I think should be in this kind of area is a commentary about how an Agent differs from a human. "You are not a legal entity; you cannot sign the DCO", which you get into below.
Quoted 8 lines
Documentation/AI/main.md +8
-0+ +### Specialized Topics +- **Documentation/process/adding-syscalls.rst** - How to add new system calls +- **Documentation/process/stable-kernel-rules.rst** - Rules for stable kernel patches +- **Documentation/process/security-bugs.rst** - Handling security issues +- **Documentation/process/handling-regressions.rst** - Dealing with regressions + +### Maintainer Guidelines
Documentation/AI/main.md line 52
Quoted 10 lines
Documentation/AI/main.md +10
-0+- **Documentation/process/maintainers.rst** - Working with subsystem maintainers +- **Documentation/process/maintainer-handbooks.rst** - Subsystem-specific guidelines + +## Key Principles +1. Read and follow the documentation before making changes +2. Respect the existing code style and conventions +3. Test thoroughly before submitting +4. Write clear, descriptive commit messages +5. Never break userspace (the #1 rule) +6. Identify yourself as AI in commits (see below)
Everything except #6 is already expected of human devs, so I think just the last item.
Documentation/AI/main.md line 58
Quoted 6 lines
Documentation/AI/main.md +6
-0+ +## AI Attribution Requirement +When creating commits, you MUST identify yourself as an AI assistant by including the following tag in the commit message: + +``` +Co-developed-by: $AI_NAME $AI_MODEL $AI_VERSION
If we're going to go with Co-developed-by: here, then I think we need to explicitly say "do not include an email", and we must update checkpatch.pl to not yell about the missing S-o-b when it finds a C-d-b. (Perhaps it can skip the check with there is no email address in the C-b-d line?)
Documentation/AI/main.md line 69
Quoted 11 lines
Documentation/AI/main.md +11
-0+``` + +For example: +- `Co-developed-by: Claude claude-3-opus-20240229` +- `Co-developed-by: GitHub-Copilot GPT-4 v1.0.0` +- `Co-developed-by: Cursor gpt-4-turbo-2024-04-09` + +This transparency helps maintainers and reviewers understand that AI was involved in the development process. + +### Signed-off-by Restrictions +AI assistants MUST NOT add a Signed-off-by tag pointing to themselves. The Signed-off-by tag represents a legal certification by a human developer that they have the right to submit the code under the open source license.
Hello trailing whitespace my old friend.
"Unless explicitly told otherwise, Agents must never have trailing whitespace on any line and all files must have a final newline character." :)
Documentation/AI/main.md line 71
Quoted 2 lines
Documentation/AI/main.md +2
-0+ +Only the human user running the AI assistant should add their Signed-off-by tag to commits. The AI's contribution is acknowledged through the Co-developed-by tag as described above.
And can we please not use the term "AI"? I think "Agent" is the better generic term as it could include other things?
-Kees
Signature · 1 line
Kees Cook
Re: [RFC 2/2] AI: Add initial set of rules and docs
Quoted 22 lines · Kees Cook
Quoted 1 line · Sasha Levin
Add rules based on our existing documentation.
I'd still like this not in
Documentation/, but I obviously defer to Jon.Quoted 17 lines
Require AI to identify itself in the commit message.
Signed-off-by Sasha Levin <[email protected]>--- Documentation/AI/main.md | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)Documentation/AI/main.md +1
-1@@ -1,5 +1,71 @@ # Linux Kernel Development AI Instructions -This is the Linux kernel repository. When working with this codebase, you must follow the following rules: +This is the Linux kernel repository. When working with this codebase, you must follow the Linux kernel development processes and coding standards.
Quoted 14 lines
Documentation/AI/main.md line 11
Quoted 8 lines
Documentation/AI/main.md +7
-1-- [ TODO ] +## Essential Documentation References + +### Core Development Process +- **Documentation/process/howto.rst** - Start here! The comprehensive guide on how to become a Linux kernel developer +- **Documentation/process/development-process.rst** - Detailed information on how the kernel development process works +- **Documentation/process/submitting-patches.rst** - Essential guide for getting your code into the kernel +- **Documentation/process/submit-checklist.rst** - Checklist to review before submitting codeInstead of hard-coded paths, I would recommend just discuss the topic areas it is expected to find and ingest. :) (e.g. redo the "Key principles" list you have later to be more specific about the topic areas and adjust the prompting to induce the requirement to find and read each topic.)
I'm very open to changing these parts. Ideally we can rewrite it in a way that's easier for the agent to process rather than something that is more readable to humans.
Quoted 10 lines
Quoted 10 lines
Documentation/AI/main.md +10
-0+ +### Coding Standards and Style +- **Documentation/process/coding-style.rst** - Linux kernel coding style (MUST READ) + - Use tabs (8 characters) for indentation + - 80-character line limit preferred + - Specific formatting rules for switch statements, functions, etc. +- **Documentation/process/programming-language.rst** - Language requirements and standards + +### What NOT to Do +- **Documentation/process/deprecated.rst** - Deprecated interfaces and features to avoid
Quoted 8 lines
Documentation/AI/main.md line 24
Quoted 3 lines
Documentation/AI/main.md +3
-0+ - Do not use BUG() or BUG_ON() - use WARN() instead + - Avoid deprecated APIs listed in this document +- **Documentation/process/volatile-considered-harmful.rst** - Why volatile is usually wrongAnd the reason I want to avoid such specifics is that even as an example above, this ends up being hyperspecific. Why summarize the
deprecated.rst? Just say "Find and read the notes on deprecated APIs and language features"
When we're being explicit with rules, the agent is more likely to not ignore it (and go "whoops I messed up!" later).
It's a balance we need to find, but I suspect we can fine tune as when we see how various agents respond to the rules.
Quoted 5 lines
Quoted 5 lines
Documentation/AI/main.md +5
-0+### Patch Submission Process +- **Documentation/process/5.Posting.rst** - How to post patches properly +- **Documentation/process/email-clients.rst** - Email client configuration for patches +- **Documentation/process/applying-patches.rst** - How patches are applied +
Quoted 8 lines
Documentation/AI/main.md line 34
Quoted 4 lines
Documentation/AI/main.md +4
-0+### Legal and Licensing +- **Documentation/process/license-rules.rst** - Linux kernel licensing rules + - Kernel is GPL-2.0 only with syscall exception + - All files must have proper SPDX license identifiersThe only stuff I think should be in this kind of area is a commentary about how an Agent differs from a human. "You are not a legal entity; you cannot sign the DCO", which you get into below.
I was thinking that if we explicitly call out the GPL requirement, an agent will avoid searching online resources and potentially embedding code that is not licensed under GPL.
Quoted 52 lines
Quoted 7 lines
Documentation/AI/main.md +7
-0+### Specialized Topics +- **Documentation/process/adding-syscalls.rst** - How to add new system calls +- **Documentation/process/stable-kernel-rules.rst** - Rules for stable kernel patches +- **Documentation/process/security-bugs.rst** - Handling security issues +- **Documentation/process/handling-regressions.rst** - Dealing with regressions + +### Maintainer GuidelinesDocumentation/AI/main.md line 52
Quoted 10 lines
Documentation/AI/main.md +10
-0+- **Documentation/process/maintainers.rst** - Working with subsystem maintainers +- **Documentation/process/maintainer-handbooks.rst** - Subsystem-specific guidelines + +## Key Principles +1. Read and follow the documentation before making changes +2. Respect the existing code style and conventions +3. Test thoroughly before submitting +4. Write clear, descriptive commit messages +5. Never break userspace (the #1 rule) +6. Identify yourself as AI in commits (see below)Everything except #6 is already expected of human devs, so I think just the last item.
Documentation/AI/main.md line 58
Quoted 6 lines
Documentation/AI/main.md +6
-0+ +## AI Attribution Requirement +When creating commits, you MUST identify yourself as an AI assistant by including the following tag in the commit message: + +``` +Co-developed-by: $AI_NAME $AI_MODEL $AI_VERSIONIf we're going to go with Co-developed-by: here, then I think we need to explicitly say "do not include an email", and we must update checkpatch.pl to not yell about the missing S-o-b when it finds a C-d-b. (Perhaps it can skip the check with there is no email address in the C-b-d line?)
Documentation/AI/main.md line 69
Quoted 11 lines
Documentation/AI/main.md +11
-0+``` + +For example: +- `Co-developed-by: Claude claude-3-opus-20240229` +- `Co-developed-by: GitHub-Copilot GPT-4 v1.0.0` +- `Co-developed-by: Cursor gpt-4-turbo-2024-04-09` + +This transparency helps maintainers and reviewers understand that AI was involved in the development process. + +### Signed-off-by Restrictions +AI assistants MUST NOT add a Signed-off-by tag pointing to themselves. The Signed-off-by tag represents a legal certification by a human developer that they have the right to submit the code under the open source license.Hello trailing whitespace my old friend.
"Unless explicitly told otherwise, Agents must never have trailing whitespace on any line and all files must have a final newline character." :)
Quoted 5 lines
Documentation/AI/main.md line 69
Quoted 2 lines
Documentation/AI/main.md +2
-0+ +Only the human user running the AI assistant should add their Signed-off-by tag to commits. The AI's contribution is acknowledged through the Co-developed-by tag as described above.And can we please not use the term "AI"? I think "Agent" is the better generic term as it could include other things?
Ack
Signature · 2 lines
Thanks, Sasha
Re: [RFC 2/2] AI: Add initial set of rules and docs
In reply to Kees CookEm Fri, 25 Jul 2025 13:53:57 -0700
Kees Cook <[email protected]> escreveu:
Quoted 4 lines · Sasha Levin
Quoted 1 line
Add rules based on our existing documentation.
I'd still like this not in
Documentation/, but I obviously defer to Jon.
I think it should be at Documentation, under process, where we document such things.
As I pointed on patch 0/2, developers may use AI directly from a LLM bot like chatgpt/deepseek/..., so it shall be in a place where humans will also be aware about the ruleset.
I would also add a quick summary for humans not need to read the entire file, just explaining what's different from the "normal" way.
Quoted 120 lines
Quoted 16 lines
Require AI to identify itself in the commit message.
Signed-off-by Sasha Levin <[email protected]>--- Documentation/AI/main.md | 70 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-)Documentation/AI/main.md +0
-1@@ -1,5 +1,71 @@ # Linux Kernel Development AI Instructions -This is the Linux kernel repository. When working with this codebase, you must follow the following rules:Documentation/AI/main.md line 11
Quoted 10 lines
Documentation/AI/main.md +8
-1+This is the Linux kernel repository. When working with this codebase, you must follow the Linux kernel development processes and coding standards. -- [ TODO ] +## Essential Documentation References + +### Core Development Process +- **Documentation/process/howto.rst** - Start here! The comprehensive guide on how to become a Linux kernel developer +- **Documentation/process/development-process.rst** - Detailed information on how the kernel development process works +- **Documentation/process/submitting-patches.rst** - Essential guide for getting your code into the kernel +- **Documentation/process/submit-checklist.rst** - Checklist to review before submitting codeInstead of hard-coded paths, I would recommend just discuss the topic areas it is expected to find and ingest. :) (e.g. redo the "Key principles" list you have later to be more specific about the topic areas and adjust the prompting to induce the requirement to find and read each topic.)
Documentation/AI/main.md line 24
Quoted 13 lines
Documentation/AI/main.md +13
-0+ +### Coding Standards and Style +- **Documentation/process/coding-style.rst** - Linux kernel coding style (MUST READ) + - Use tabs (8 characters) for indentation + - 80-character line limit preferred + - Specific formatting rules for switch statements, functions, etc. +- **Documentation/process/programming-language.rst** - Language requirements and standards + +### What NOT to Do +- **Documentation/process/deprecated.rst** - Deprecated interfaces and features to avoid + - Do not use BUG() or BUG_ON() - use WARN() instead + - Avoid deprecated APIs listed in this document +- **Documentation/process/volatile-considered-harmful.rst** - Why volatile is usually wrongAnd the reason I want to avoid such specifics is that even as an example above, this ends up being hyperspecific. Why summarize the
deprecated.rst? Just say "Find and read the notes on deprecated APIs and language features"Documentation/AI/main.md line 34
Quoted 10 lines
Documentation/AI/main.md +10
-0+ +### Patch Submission Process +- **Documentation/process/5.Posting.rst** - How to post patches properly +- **Documentation/process/email-clients.rst** - Email client configuration for patches +- **Documentation/process/applying-patches.rst** - How patches are applied + +### Legal and Licensing +- **Documentation/process/license-rules.rst** - Linux kernel licensing rules + - Kernel is GPL-2.0 only with syscall exception + - All files must have proper SPDX license identifiersThe only stuff I think should be in this kind of area is a commentary about how an Agent differs from a human. "You are not a legal entity; you cannot sign the DCO", which you get into below.
Quoted 8 lines
Documentation/AI/main.md +8
-0+ +### Specialized Topics +- **Documentation/process/adding-syscalls.rst** - How to add new system calls +- **Documentation/process/stable-kernel-rules.rst** - Rules for stable kernel patches +- **Documentation/process/security-bugs.rst** - Handling security issues +- **Documentation/process/handling-regressions.rst** - Dealing with regressions + +### Maintainer GuidelinesDocumentation/AI/main.md line 52
Quoted 10 lines
Documentation/AI/main.md +10
-0+- **Documentation/process/maintainers.rst** - Working with subsystem maintainers +- **Documentation/process/maintainer-handbooks.rst** - Subsystem-specific guidelines + +## Key Principles +1. Read and follow the documentation before making changes +2. Respect the existing code style and conventions +3. Test thoroughly before submitting +4. Write clear, descriptive commit messages +5. Never break userspace (the #1 rule) +6. Identify yourself as AI in commits (see below)Everything except #6 is already expected of human devs, so I think just the last item.
Documentation/AI/main.md line 58
Quoted 6 lines
Documentation/AI/main.md +6
-0+ +## AI Attribution Requirement +When creating commits, you MUST identify yourself as an AI assistant by including the following tag in the commit message: + +``` +Co-developed-by: $AI_NAME $AI_MODEL $AI_VERSIONIf we're going to go with Co-developed-by: here, then I think we need to explicitly say "do not include an email", and we must update checkpatch.pl to not yell about the missing S-o-b when it finds a C-d-b. (Perhaps it can skip the check with there is no email address in the C-b-d line?)
Documentation/AI/main.md line 69
Quoted 11 lines
Documentation/AI/main.md +11
-0+``` + +For example: +- `Co-developed-by: Claude claude-3-opus-20240229` +- `Co-developed-by: GitHub-Copilot GPT-4 v1.0.0` +- `Co-developed-by: Cursor gpt-4-turbo-2024-04-09` + +This transparency helps maintainers and reviewers understand that AI was involved in the development process. + +### Signed-off-by Restrictions +AI assistants MUST NOT add a Signed-off-by tag pointing to themselves. The Signed-off-by tag represents a legal certification by a human developer that they have the right to submit the code under the open source license.Hello trailing whitespace my old friend.
"Unless explicitly told otherwise, Agents must never have trailing whitespace on any line and all files must have a final newline character." :)
Quoted 8 lines
Documentation/AI/main.md line 71
Quoted 2 lines
Documentation/AI/main.md +2
-0+ +Only the human user running the AI assistant should add their Signed-off-by tag to commits. The AI's contribution is acknowledged through the Co-developed-by tag as described above.And can we please not use the term "AI"? I think "Agent" is the better generic term as it could include other things?
-Kees
Thanks,
Mauro
Quoted 4 lines · On Fri, 25 Jul 2025 13:53:56 -0400 Sasha Levin wrote:
Co-developed-by: Claude claude-opus-4-20250514 --- Documentation/power/opp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I think we should suggest that the tag is under --- ? It's only relevant during the review. Once the patch is committed whether the code was organic or generated by Corp XYZ's Banana AI is just free advertising..
Quoted 10 lines · On Fri, 25 Jul 2025 11:41:14 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 4 lines · On Fri, 25 Jul 2025 13:53:56 -0400 Sasha Levin wrote:
Co-developed-by: Claude claude-opus-4-20250514 --- Documentation/power/opp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)I think we should suggest that the tag is under --- ? It's only relevant during the review. Once the patch is committed whether the code was organic or generated by Corp XYZ's Banana AI is just free advertising..
What's the difference between that and others using their corporate email? I even add (Google) to my SoB to denote who is paying me to do the work.
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
-- Steve
Quoted 8 lines · On Fri, 25 Jul 2025 15:00:46 -0400 Steven Rostedt wrote:
Quoted 6 lines · On Fri, 25 Jul 2025 11:41:14 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 4 lines · On Fri, 25 Jul 2025 13:53:56 -0400 Sasha Levin wrote:
Co-developed-by: Claude claude-opus-4-20250514 --- Documentation/power/opp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 4 lines
I think we should suggest that the tag is under --- ? It's only relevant during the review. Once the patch is committed whether the code was organic or generated by Corp XYZ's Banana AI is just free advertising..
What's the difference between that and others using their corporate email? I even add (Google) to my SoB to denote who is paying me to do the work.
To be clear, it's not my main point, my main point is that the information is of no proven use right now. As long as committer follows the BKP of adding Link: https://patch.msgid.link/...
we can find the metadata later.
We never found the need to attach the exact version of smatch / sparse / cocci that found the bug or "wrote" a patch. Let us not overreact to the AI tools.
Quoted 3 lines
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Quoted 17 lines · * Jakub Kicinski ([email protected]) wrote:
Quoted 8 lines · On Fri, 25 Jul 2025 15:00:46 -0400 Steven Rostedt wrote:
Quoted 6 lines · On Fri, 25 Jul 2025 11:41:14 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 4 lines · On Fri, 25 Jul 2025 13:53:56 -0400 Sasha Levin wrote:
Co-developed-by: Claude claude-opus-4-20250514 --- Documentation/power/opp.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 7 lines
Quoted 4 lines
I think we should suggest that the tag is under --- ? It's only relevant during the review. Once the patch is committed whether the code was organic or generated by Corp XYZ's Banana AI is just free advertising..
What's the difference between that and others using their corporate email? I even add (Google) to my SoB to denote who is paying me to do the work.
Quoted 8 lines
To be clear, it's not my main point, my main point is that the information is of no proven use right now. As long as committer follows the BKP of adding Link: https://patch.msgid.link/...
we can find the metadata later.We never found the need to attach the exact version of smatch / sparse / cocci that found the bug or "wrote" a patch. Let us not overreact to the AI tools.
People have done it (using inconsistent tags and comments) for things like Coverity for years; some people worry a lot about AI, some not at all; adding a tag:
a) Lets the people who worry keep of track what our mechanical overlords are
doing.
b) Reviewers who are wary of slop get to cast a careful eye.
c) Gives the tools (and their developers) suitable credit. After all machines
need love too.
Quoted 7 lines
Quoted 3 lines
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
We carry lots more random stuff in commit messages!
Dave
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/
Jakub Kicinski wrote:
[..]
Quoted 9 lines
To be clear, it's not my main point, my main point is that the information is of no proven use right now. As long as committer follows the BKP of adding Link: https://patch.msgid.link/...
we can find the metadata later.We never found the need to attach the exact version of smatch / sparse / cocci that found the bug or "wrote" a patch. Let us not overreact to the AI tools.
Quoted 7 lines
Quoted 3 lines
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
Quoted 15 lines · On Fri, Jul 25, 2025 at 01:34:32PM -0700, [email protected] wrote:
Jakub Kicinski wrote:
[..]Quoted 13 lines
To be clear, it's not my main point, my main point is that the information is of no proven use right now. As long as committer follows the BKP of adding Link: https://patch.msgid.link/...
we can find the metadata later.We never found the need to attach the exact version of smatch / sparse / cocci that found the bug or "wrote" a patch. Let us not overreact to the AI tools.
Quoted 3 lines
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
Quoted 8 lines
Quoted 3 lines
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
And it would be great to avoid the potential "it wasn't me, it was the AI!" or "whoops I don't know how that exploitable issue ended up in my patch, must have been the AI".
Signature · 2 lines
Thanks, Sasha
Quoted 8 lines · On Fri, 25 Jul 2025 13:34:32 -0700 <[email protected]> wrote:
Quoted 3 lines
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
My point of the "who to blame" was not about the author of said code, but if two or more developers are using the same AI agent and then some patter of bugs appears that is only with that AI agent, then we know that the AI agent is likely the culprit and to look for code by other developers that used that same AI agent.
It's a way to track down a bug in a tool that is creating code, not about moving blame from a developer to the agent itself.
-- Steve
Quoted 12 lines · Steven Rostedt
Quoted 8 lines · On Fri, 25 Jul 2025 13:34:32 -0700 <[email protected]> wrote:
Quoted 3 lines
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
Quoted 8 lines
My point of the "who to blame" was not about the author of said code, but if two or more developers are using the same AI agent and then some patter of bugs appears that is only with that AI agent, then we know that the AI agent is likely the culprit and to look for code by other developers that used that same AI agent.
It's a way to track down a bug in a tool that is creating code, not about moving blame from a developer to the agent itself.
Between fine tuning, the process of doing local training to emphasize / de-emphasize some weights in the model, and prompt variability, the signal from a patch trailer is diluted.
If maintainers care about commit text conciseness for humans and traceability for AI, those competing concerns will conflict above the "---" line in patches.
Em Mon, 28 Jul 2025 13:46:53 -0400
Steven Rostedt <[email protected]> escreveu:
Quoted 12 lines
Quoted 8 lines · On Fri, 25 Jul 2025 13:34:32 -0700 <[email protected]> wrote:
Quoted 3 lines
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
Quoted 8 lines
My point of the "who to blame" was not about the author of said code, but if two or more developers are using the same AI agent and then some patter of bugs appears that is only with that AI agent, then we know that the AI agent is likely the culprit and to look for code by other developers that used that same AI agent.
It's a way to track down a bug in a tool that is creating code, not about moving blame from a developer to the agent itself.
I don't think you shall blame the tool, as much as you you cannot blame gcc for a badly written code. Also, the same way a kernel maintainer needs to know how to produce a good code, someone using AI also must learn how to properly use the tool.
After all, at least at the current stage, AI is not intelligent. Artificial "neurons" just sums up values from its neighbors, trying to mimic what we know so far about neurons, which is not perfect. On several aspects, it is not much different than doing an stochastic analysis that would try to converge into a result.
The entire process resembles the kind of systems that you could be analyzed using control theory[1], like root locus analysis. Anyone that ever played with that knows that sometimes the system is stable enough to converge to the best results, but the convergence is affected by poles and zeros: sometimes it might converge to a local minimum; sometimes it can end into a zero and diverge, producing completely bogus results.
On other words, the one that posted a bad patch is the one to blame, together with the ones that reviewed it. AI is not a replacement for real intelligence.
-
Btw, if you want to play with that, I suggest using deepseek. Ensure that the DeepThink (R1) is enabled, as it shows how that particular model tries to find a convergence.
-
Out of curiosity, I asked two AIs for articles relating control theory with LLM:
Bhargava, A., Witkowski, C., Looi, S.-Z., & Thomson, M. (2023). What’s the Magic Word? A Control Theory of LLM Prompting. arXiv preprint arXiv:2310.04444.
URL: https://arxiv.org/abs/2310.04444
Kevian, D., Syed, U., Guo, X., Havens, A., Dullerud, G., Seiler, P., Qin, L., & Hu, B. (2024). Capabilities of Large Language Models in Control Engineering: A Benchmark Study. arXiv preprint arXiv:2404.03647.
URL: https://arxiv.org/abs/2404.03647
Maher, G. (2025). LLMPC: Large Language Model Predictive Control. arXiv preprint arXiv:2501.02486.
URL: https://arxiv.org/abs/2501.02486
Zahedifar, R. et al. "LLM-Agent-Controller: A Universal Multi-Agent Large Language Model System as a Control Engineer"
URL: https://arxiv.org/abs/2505.19567
Zhang, Y. et al. "Unveiling LLM Mechanisms Through Neural ODEs and Control Theory"
URL: https://arxiv.org/abs/2406.16985
Barfield, Woodrow (2021) "A Systems and Control Theory Approach for Law and Artificial Intelligence: Demystifying the 'Black-Box'"
URL: https://www.mdpi.com/2571-8800/4/4/41
Zahedifar, R. et al. "LLM-controller: Dynamic robot control adaptation using large language models"
URL: https://www.sciencedirect.com/science/article/abs/pii/S0921889024002975
Bhargava, A. "Toward a Control Theory of LLMs" (Blog Post)
URL: https://aman-bhargava.com/ai/2023/12/17/towards-a-control-theory-of-LLMs.html
I didn't read them (yet).
Thanks,
Mauro
Em Tue, 29 Jul 2025 00:12:33 +0200
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 24 lines
Em Mon, 28 Jul 2025 13:46:53 -0400
Steven Rostedt <[email protected]> escreveu:Quoted 12 lines
Quoted 8 lines · On Fri, 25 Jul 2025 13:34:32 -0700 <[email protected]> wrote:
Quoted 3 lines
This touches on explainability of AI. Perhaps the metadata would be interesting for XAI research... not sure that's enough to be lugging those tags in git history.
Agree. The "who to blame" is "Author:". They signed DCO they are responsible for debugging what went wrong in any stage of the development of a patch per usual. We have a long history of debugging tool problems without tracking tool versions in git history.
Quoted 8 lines
My point of the "who to blame" was not about the author of said code, but if two or more developers are using the same AI agent and then some patter of bugs appears that is only with that AI agent, then we know that the AI agent is likely the culprit and to look for code by other developers that used that same AI agent.
It's a way to track down a bug in a tool that is creating code, not about moving blame from a developer to the agent itself.
Quoted 6 lines
I don't think you shall blame the tool, as much as you you cannot blame gcc for a badly written code. Also, the same way a kernel maintainer needs to know how to produce a good code, someone using AI also must learn how to properly use the tool.
After all, at least at the current stage, AI is not intelligent.
Heh, after re-reading my post, I realized that I could have been too technical, specially for people not familiar with electrical engineering and systems control theory(*).
What I'm trying to say is that, while AI is a great tool, it is just another tool that tries to guess something. If you get enough luck, you'll get decent results, but one should never trust on its result, as it is based on statistics: it will guess an answer that will likely be the right one, but could also be completely off.
(*) systems control theory is a field that studies a system stability.
It can be used, for instance, to ensure that an electrical motor can be properly controlled and provide precise movements. It is not limited to mechanics, though. It can used to explain other systems that have any sort of feedbacks. at the light of the control theory, an AI training would be mapped as a feedback.
Regards,
Mauro
Thanks,
Mauro
Quoted 3 lines · Steven Rostedt
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
Yeah, this is where I feel like it's the most potentially useful. Since they are distinctly code-generators, we should include the info to identify it. We include version numbers and such the compilers and linkers, though they are only informally included in commit logs when dealing with specific problems.
Having had to do "find all commits from [set of authors]" research for security audits, I would be very unhappy if I had to do this again in the future for a specific Agent (used any author), and had to loop lore into the process. Yes, it's *doable*, but it'd be very annoying.
Signature · 1 line
Kees Cook
Quoted 11 lines · Kees Cook
Quoted 3 lines · Steven Rostedt
Also, I would argue that it would be useful in the change log as if there's a bug in the generated code, you know who or *what* to blame. Especially if there is a pattern to be found.
Yeah, this is where I feel like it's the most potentially useful. Since they are distinctly code-generators, we should include the info to identify it. We include version numbers and such the compilers and linkers, though they are only informally included in commit logs when dealing with specific problems.
Quoted 4 lines
Having had to do "find all commits from [set of authors]" research for security audits, I would be very unhappy if I had to do this again in the future for a specific Agent (used any author), and had to loop lore into the process. Yes, it's *doable*, but it'd be very annoying.
Oh, yes, that gives me pause. However, so too does the idea that AI contributions, beyond mere mechanical code complete of trusted human developers, would become more prevalent. *If* it gets to that point, I agree that this forensic ability is necessary. Now, if it gets to that point it also assumes that the "AI contribution review decimating human reviewer bandwidth" problem has a mitigation.
So "doable, but very annoying" strikes me as a problem space where an AI agent could help. It is not clear to me that a concise commit trailer captures everything needed to help both the review and after the fact forensics problem, especially when model fine tuning and prompting are in play.
Quoted 11 lines · On July 28, 2025 8:57:21 AM PDT, [email protected] wrote:
Quoted 4 lines · Kees Cook
Having had to do "find all commits from [set of authors]" research for security audits, I would be very unhappy if I had to do this again in the future for a specific Agent (used any author), and had to loop lore into the process. Yes, it's *doable*, but it'd be very annoying.
[...]
So "doable, but very annoying" strikes me as a problem space where an AI agent could help. It is not clear to me that a concise commit trailer captures everything needed to help both the review and after the fact forensics problem, especially when model fine tuning and prompting are in play.
Heh, good point. :) We can make all problems *with* agents and problem *for* agents. :P
Signature · 1 line
Kees Cook
Quoted 4 lines
Example patch creation with Claude Code:
$ claude -p "Fix the dont -> don't typo in @Documentation/power/opp.rst. Commit the result" Done! The typo has been fixed and committed.
Is this actually how people use AI agents? I've never thought of asking an agent to write a whole patch and commit the result.
The way that I've seen it is things like Github Copilot within VScode where there are inline suggestions. It's kinda like clangd except it suggests corrections to your mistakes instead of just underlining them with red squiggles.
Like if you messed up the argument and passed a pointer when it was supposed to be a pointer to a pointer it will give you a little tooltip correction. But this is long before you would be ready to actually commit a patch, heck it's before even testing it (obviously).
The actual committing action would be by running 'git commit'. So I don't see how these tags could end up in there.
Quoted 6 lines · Mario Limonciello
Quoted 4 lines
Example patch creation with Claude Code:
$ claude -p "Fix the dont -> don't typo in @Documentation/power/opp.rst. Commit the result" Done! The typo has been fixed and committed.Is this actually how people use AI agents? I've never thought of asking an agent to write a whole patch and commit the result.
Yup, there are a bunch of usecases for this, and while this is an oversimplified example (that's why I picked a simple spelling fix that the agent could get right "the first time").
See Kees' post at https://hachyderm.io/@kees/114907228284590439 , in particular the buffer overflow fix where he logged his prompts.
Quoted 5 lines
The way that I've seen it is things like Github Copilot within VScode where there are inline suggestions. It's kinda like clangd except it suggests corrections to your mistakes instead of just underlining them with red squiggles.
Like if you messed up the argument and passed a pointer when it was supposed to be a pointer to a pointer it will give you a little tooltip correction. But this is long before you would be ready to actually commit a patch, heck it's before even testing it (obviously).
The actual committing action would be by running 'git commit'. So I don't see how these tags could end up in there.
Even vscode has a commit feature which can help write commit messages and actually commit them for you:
https://code.visualstudio.com/docs/sourcecontrol/overview
But yes, if you choose to manually handle the committing aspect then you should also be manually attributing the agent :)
Signature · 2 lines
Thanks, Sasha
Quoted 6 lines · Mario Limonciello
Quoted 4 lines
Example patch creation with Claude Code:
$ claude -p "Fix the dont -> don't typo in @Documentation/power/opp.rst. Commit the result" Done! The typo has been fixed and committed.Is this actually how people use AI agents? I've never thought of asking an agent to write a whole patch and commit the result.
Yeah! I've been using the interactive modes (e.g. just the "claude" command). The insight by a friend of mine is to have the agent update its own knowledge base regularly. For example, for a first time session, using Claude I would run "claude" in the root of the kernel tree, and then write:
/init
Find and read the coding style and submitting patches documentation in the Documentation/ directory
Always use a build output directory, like "claude-build". This must always be specified with the O= option for make This is a big build machine, so also always use the -j128 option for make
Perform a build of the kernel
Save anything new you've learned in your CLAUDE.md file
Keep all new .md files and temp files in the agentic/ directory
Examine git history of commits by Kees Cook over the last 5 years and write out a new .md file that describes his commit log writing style Use this for any commit messages we write
Figure out how to run KUnit tests, the docs are in Documentation/
Run the fortify KUnit tests
Update your CLAUDE.md with anything new you've learned
(Note that I run the agent as an entirely separate user in a Docker container.)
The agent acts like an intern who reads VERY quickly, but forgets things regularly. So it has to be both reminded to save new stuff it learns (I break things into separate .md files), and then read them back again after it starts forgetting.
It still needs extensive hand-holding, and it's rare that I'm happy with its commit logs, but it is pretty helpful so far. That said I've been focusing on some smaller refactoring work just to feel out how to use it. I have some hints that it would struggle with doing very large scale refactoring on its own, but it's nice to toss it at a huge patch I generated via Coccinelle and say "build this across all our configured archs and fix any compilation failures you encounter" and then go have lunch. ;)
-Kees
Signature · 1 line
Kees Cook
Em Fri, 25 Jul 2025 13:53:56 -0400
Sasha Levin <[email protected]> escreveu:
Quoted 4 lines
This patch series adds unified configuration and documentation for AI coding assistants working with the Linux kernel codebase. As AI tools become increasingly common in software development, it's important to establish clear guidelines for their use in kernel development.
...
Quoted 6 lines
The series consists of two patches:
1. The first patch adds unified configuration files for various AI coding assistants (Claude, GitHub Copilot, Cursor, Codeium, Continue, Windsurf, and Aider). These are all symlinked to a central documentation file to ensure consistency across tools.
Agreed with the goal, however people may be using other LLM tools, like chatgpt and deepseek, as a development aid tool, but not directly writing patches from it.
Some LLM tools can be very useful when handling some bugs that may require seeking the web for some possible alternatives. On such kind of usage, it is not different of using a search engine like duckduckgo, google, yahoo,...
LLMs can also be used to write unit tests/functional tests, where the actual patch can be independent of any LLM coding, if the testing toolchain is not submitted.
Quoted 15 lines
2. The second patch adds the actual rules and documentation that guide AI assistants on Linux kernel development practices, including:
- Following kernel coding standards
- Respecting the development process
- Properly attributing AI-generated contributions
- Understanding licensing requirementsThe examples below demonstrate how these guidelines work in practice, showing proper AI attribution in commits and the assistant's understanding of kernel documentation requirements.
All AI assistants are required to identify themselves in commits using Co-developed-by tags, ensuring full transparency about AI involvement in code development.
Quoted 7 lines
"Hello world" test:
$ claude -p "do you need to attribute your commits?" Yes, according to the CLAUDE.md file in this Linux kernel repository, I must identify myself as an AI assistant in commits by including:``` Co-developed-by: Claude claude-opus-4-20250514
Due to the above, I don't think that Co-developed-by is the best tag here, nor if we want a tag or some text written at the patch description describing how AI was used.
For instance, on your example:
Quoted 2 lines
- /* dont operate on the pointer.. just do a sanity check.. */
+ /* don't operate on the pointer.. just do a sanity check.. */
LLM is not developing anything. It is just doing what any other spellchecker tool would do. We don't have any tags to document that, although we sometimes add comment saying that we used cocci or some other tool to identify (and/or autocorrect) the coding style and/or grammar/syntax issues.
Thanks,
Mauro
Quoted 4 lines · Sasha Levin
This patch series adds unified configuration and documentation for AI coding assistants working with the Linux kernel codebase. As AI tools become increasingly common in software development, it's important to establish clear guidelines for their use in kernel development.
I sometimes use tools like sed (just to name one) to generate a patch plus edits. I don't think we need contribution guidelines for sed, do we? Equally we don't need contribution guidelines for AIs because:
1. AI is not a person.
2. AI has no resposibility.
3. AI has no needs.
Basic computer science beholds to truth that for any problem there is infinite amount of computer programs to solve it. This makes any problem we have a moving target constrained by various corner cases, people and many other things.
If you want to use AI to generate code, it's obviously fine. I don't mind and I don't care, and I don't see anything wrong in that.
But that is million miles away from being enough to be called as done. Generation is about getting up on speed, and in the best case scenario to the ballpark.
Please, let's keep this out of the kernel tree seriously.
BR, Jarkko