[PATCH 4/4] agents: add legal requirements and agent attribution guidelines

Sasha Levin posted 4 patches 2 months, 1 week ago
[PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Sasha Levin 2 months, 1 week ago
And below is the first test of this scheme:

Co-developed-by: Claude claude-opus-4-20250514
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 Documentation/agents/index.rst |  3 ++-
 Documentation/agents/legal.rst | 42 ++++++++++++++++++++++++++++++++++
 Documentation/agents/main.rst  |  5 ++++
 3 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/agents/legal.rst

diff --git a/Documentation/agents/index.rst b/Documentation/agents/index.rst
index 354af3f025e5..982602db3349 100644
--- a/Documentation/agents/index.rst
+++ b/Documentation/agents/index.rst
@@ -9,4 +9,5 @@ Agents
 
    main
    core
-   coding-style
\ No newline at end of file
+   coding-style
+   legal
\ No newline at end of file
diff --git a/Documentation/agents/legal.rst b/Documentation/agents/legal.rst
new file mode 100644
index 000000000000..67e6b2cdff9d
--- /dev/null
+++ b/Documentation/agents/legal.rst
@@ -0,0 +1,42 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===============================
+Legal Requirements for Agents
+===============================
+
+This document outlines critical legal requirements that coding agents must follow when working with the Linux kernel codebase.
+
+Licensing Requirements
+----------------------
+
+**GPL-2.0 License**
+  The Linux kernel is licensed under GPL-2.0 only with a syscall exception. Coding agents MUST follow this licensing rule with no exceptions. Any code contributed must be compatible with this license.
+
+**SPDX License Identifiers**
+  All files must have proper SPDX license identifiers. For most kernel source files, this should be the first line of the file in the appropriate comment format:
+
+  - For C source/header files: ``// SPDX-License-Identifier: GPL-2.0``
+  - For scripts: ``# SPDX-License-Identifier: GPL-2.0``
+  - For documentation: ``.. SPDX-License-Identifier: GPL-2.0``
+
+Signed-off-by Restriction
+-------------------------
+
+Coding 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 coding assistant should add their ``Signed-off-by`` tag to commits. The agent's contribution is acknowledged through the ``Co-developed-by`` tag as described below.
+
+Agent Attribution Requirement
+-----------------------------
+
+When creating commits, coding agents **MUST** identify themselves by including the following tag in the commit message::
+
+    Co-developed-by: $AGENT_NAME $AGENT_MODEL $AGENT_VERSION
+
+Examples:
+
+- ``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 a coding agent was involved in the development process.
diff --git a/Documentation/agents/main.rst b/Documentation/agents/main.rst
index 8e0463794b76..9ef75978a2e6 100644
--- a/Documentation/agents/main.rst
+++ b/Documentation/agents/main.rst
@@ -15,3 +15,8 @@ Coding Style
 ------------
 
 For coding style guidelines and rules, see :doc:`coding-style`
+
+Legal Requirements
+------------------
+
+For licensing, attribution, and legal requirements, see :doc:`legal`
-- 
2.39.5
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Jeff Johnson 2 months ago
On 7/27/2025 12:58 PM, Sasha Levin wrote:
> And below is the first test of this scheme:
> 
> Co-developed-by: Claude claude-opus-4-20250514
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  Documentation/agents/index.rst |  3 ++-
>  Documentation/agents/legal.rst | 42 ++++++++++++++++++++++++++++++++++
>  Documentation/agents/main.rst  |  5 ++++
>  3 files changed, 49 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/agents/legal.rst
> 
> diff --git a/Documentation/agents/index.rst b/Documentation/agents/index.rst
> index 354af3f025e5..982602db3349 100644
> --- a/Documentation/agents/index.rst
> +++ b/Documentation/agents/index.rst
> @@ -9,4 +9,5 @@ Agents
>  
>     main
>     core
> -   coding-style
> \ No newline at end of file
> +   coding-style
> +   legal
> \ No newline at end of file
> diff --git a/Documentation/agents/legal.rst b/Documentation/agents/legal.rst
> new file mode 100644
> index 000000000000..67e6b2cdff9d
> --- /dev/null
> +++ b/Documentation/agents/legal.rst
> @@ -0,0 +1,42 @@
> +.. SPDX-License-Identifier: GPL-2.0
> +
> +===============================
> +Legal Requirements for Agents
> +===============================
> +
> +This document outlines critical legal requirements that coding agents must follow when working with the Linux kernel codebase.
> +
> +Licensing Requirements
> +----------------------
> +
> +**GPL-2.0 License**
> +  The Linux kernel is licensed under GPL-2.0 only with a syscall exception. Coding agents MUST follow this licensing rule with no exceptions. Any code contributed must be compatible with this license.
> +
> +**SPDX License Identifiers**
> +  All files must have proper SPDX license identifiers. For most kernel source files, this should be the first line of the file in the appropriate comment format:
> +
> +  - For C source/header files: ``// SPDX-License-Identifier: GPL-2.0``
> +  - For scripts: ``# SPDX-License-Identifier: GPL-2.0``
> +  - For documentation: ``.. SPDX-License-Identifier: GPL-2.0``

I believe the agent has not processed the following correctly:
https://www.kernel.org/doc/html/latest/process/license-rules.html

1) C header files use /* SPDX-License-Identifier: <expression> */
2) Contributions need not be GPL-2.0, "individual files can be provided under
a dual license, e.g. one of the compatible GPL variants and alternatively
under a permissive license like BSD, MIT etc."

These two issues jumped out at me...

/jeff
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Laurent Pinchart 2 months ago
On Tue, Aug 05, 2025 at 03:08:45PM -0700, Jeff Johnson wrote:
> On 7/27/2025 12:58 PM, Sasha Levin wrote:
> > And below is the first test of this scheme:
> > 
> > Co-developed-by: Claude claude-opus-4-20250514
> > Signed-off-by: Sasha Levin <sashal@kernel.org>
> > ---
> >  Documentation/agents/index.rst |  3 ++-
> >  Documentation/agents/legal.rst | 42 ++++++++++++++++++++++++++++++++++
> >  Documentation/agents/main.rst  |  5 ++++
> >  3 files changed, 49 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/agents/legal.rst
> > 
> > diff --git a/Documentation/agents/index.rst b/Documentation/agents/index.rst
> > index 354af3f025e5..982602db3349 100644
> > --- a/Documentation/agents/index.rst
> > +++ b/Documentation/agents/index.rst
> > @@ -9,4 +9,5 @@ Agents
> >  
> >     main
> >     core
> > -   coding-style
> > \ No newline at end of file
> > +   coding-style
> > +   legal
> > \ No newline at end of file
> > diff --git a/Documentation/agents/legal.rst b/Documentation/agents/legal.rst
> > new file mode 100644
> > index 000000000000..67e6b2cdff9d
> > --- /dev/null
> > +++ b/Documentation/agents/legal.rst
> > @@ -0,0 +1,42 @@
> > +.. SPDX-License-Identifier: GPL-2.0
> > +
> > +===============================
> > +Legal Requirements for Agents
> > +===============================
> > +
> > +This document outlines critical legal requirements that coding agents must follow when working with the Linux kernel codebase.
> > +
> > +Licensing Requirements
> > +----------------------
> > +
> > +**GPL-2.0 License**
> > +  The Linux kernel is licensed under GPL-2.0 only with a syscall exception. Coding agents MUST follow this licensing rule with no exceptions. Any code contributed must be compatible with this license.
> > +
> > +**SPDX License Identifiers**
> > +  All files must have proper SPDX license identifiers. For most kernel source files, this should be the first line of the file in the appropriate comment format:
> > +
> > +  - For C source/header files: ``// SPDX-License-Identifier: GPL-2.0``
> > +  - For scripts: ``# SPDX-License-Identifier: GPL-2.0``
> > +  - For documentation: ``.. SPDX-License-Identifier: GPL-2.0``
> 
> I believe the agent has not processed the following correctly:
> https://www.kernel.org/doc/html/latest/process/license-rules.html
> 
> 1) C header files use /* SPDX-License-Identifier: <expression> */
> 2) Contributions need not be GPL-2.0, "individual files can be provided under
> a dual license, e.g. one of the compatible GPL variants and alternatively
> under a permissive license like BSD, MIT etc."
> 
> These two issues jumped out at me...

And the text isn't properly wrapped. Also, compiling the series, I get

----------------------------------------
Documentation/agents/main.rst:3: WARNING: Title overline too short.

=====================================
Linux Kernel Development Agent Instructions
=====================================

[...]

Documentation/agents/index.rst: WARNING: document isn't included in any toctree [toc.not_included]
----------------------------------------

<irony>

Sasha, please make sure you read the kernel documentation before
submitting patches. We understand there's a learning curve, but we
expect contributors to perform due diligence to avoid wasting the time
of reviewers. I would have expected a human developer submitting patches
generated by LLMs to have proof-read the patches, compiled them, and
fixed those issues.

</irony>

-- 
Regards,

Laurent Pinchart
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Sasha Levin 2 months ago
On Wed, Aug 06, 2025 at 02:11:50AM +0300, Laurent Pinchart wrote:
>On Tue, Aug 05, 2025 at 03:08:45PM -0700, Jeff Johnson wrote:
>> On 7/27/2025 12:58 PM, Sasha Levin wrote:
>> > And below is the first test of this scheme:
>> >
>> > Co-developed-by: Claude claude-opus-4-20250514
>> > Signed-off-by: Sasha Levin <sashal@kernel.org>
>> > ---
>> >  Documentation/agents/index.rst |  3 ++-
>> >  Documentation/agents/legal.rst | 42 ++++++++++++++++++++++++++++++++++
>> >  Documentation/agents/main.rst  |  5 ++++
>> >  3 files changed, 49 insertions(+), 1 deletion(-)
>> >  create mode 100644 Documentation/agents/legal.rst
>> >
>> > diff --git a/Documentation/agents/index.rst b/Documentation/agents/index.rst
>> > index 354af3f025e5..982602db3349 100644
>> > --- a/Documentation/agents/index.rst
>> > +++ b/Documentation/agents/index.rst
>> > @@ -9,4 +9,5 @@ Agents
>> >
>> >     main
>> >     core
>> > -   coding-style
>> > \ No newline at end of file
>> > +   coding-style
>> > +   legal
>> > \ No newline at end of file
>> > diff --git a/Documentation/agents/legal.rst b/Documentation/agents/legal.rst
>> > new file mode 100644
>> > index 000000000000..67e6b2cdff9d
>> > --- /dev/null
>> > +++ b/Documentation/agents/legal.rst
>> > @@ -0,0 +1,42 @@
>> > +.. SPDX-License-Identifier: GPL-2.0
>> > +
>> > +===============================
>> > +Legal Requirements for Agents
>> > +===============================
>> > +
>> > +This document outlines critical legal requirements that coding agents must follow when working with the Linux kernel codebase.
>> > +
>> > +Licensing Requirements
>> > +----------------------
>> > +
>> > +**GPL-2.0 License**
>> > +  The Linux kernel is licensed under GPL-2.0 only with a syscall exception. Coding agents MUST follow this licensing rule with no exceptions. Any code contributed must be compatible with this license.
>> > +
>> > +**SPDX License Identifiers**
>> > +  All files must have proper SPDX license identifiers. For most kernel source files, this should be the first line of the file in the appropriate comment format:
>> > +
>> > +  - For C source/header files: ``// SPDX-License-Identifier: GPL-2.0``
>> > +  - For scripts: ``# SPDX-License-Identifier: GPL-2.0``
>> > +  - For documentation: ``.. SPDX-License-Identifier: GPL-2.0``
>>
>> I believe the agent has not processed the following correctly:
>> https://www.kernel.org/doc/html/latest/process/license-rules.html
>>
>> 1) C header files use /* SPDX-License-Identifier: <expression> */
>> 2) Contributions need not be GPL-2.0, "individual files can be provided under
>> a dual license, e.g. one of the compatible GPL variants and alternatively
>> under a permissive license like BSD, MIT etc."
>>
>> These two issues jumped out at me...
>
>And the text isn't properly wrapped. Also, compiling the series, I get
>
>----------------------------------------
>Documentation/agents/main.rst:3: WARNING: Title overline too short.
>
>=====================================
>Linux Kernel Development Agent Instructions
>=====================================
>
>[...]
>
>Documentation/agents/index.rst: WARNING: document isn't included in any toctree [toc.not_included]
>----------------------------------------
>
><irony>
>
>Sasha, please make sure you read the kernel documentation before
>submitting patches. We understand there's a learning curve, but we
>expect contributors to perform due diligence to avoid wasting the time
>of reviewers. I would have expected a human developer submitting patches
>generated by LLMs to have proof-read the patches, compiled them, and
>fixed those issues.
>
></irony>

I thought I was being smart doing that so only AI agents would see that
stuff but it wouldn't appear in any human readable documentation.

I haven't realized checkpatch would complain :)

Anyways, I need to resend this with the improvements suggested by Kees
and Greg where we instead improve and expand the README at root. Let me
go clean it up...

-- 
Thanks,
Sasha
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Konstantin Ryabitsev 2 months ago
On Sun, Jul 27, 2025 at 03:58:02PM -0400, Sasha Levin wrote:
> +- ``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``

FYI, this will break tools that expect Co-developed-by: to be in the address
header format. I will add exceptions in b4, but it *is* going to be annoying
that this trailer can be in both formats and I expect other tooling will also
have similar problems.

If it's not too late, I recommend picking a wholly new trailer instead of
overloading Co-developed-by. Examples:

    | Assisted-by: Claude claude-3-opus-20240229
    | Auxiliary-tooling: GitHub-Copilot GPT-4 v1.0.0

I like the latter, because this also allows listing multiple tools.

-K
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Sasha Levin 2 months ago
On Wed, Aug 06, 2025 at 10:12:59AM -0400, Konstantin Ryabitsev wrote:
>On Sun, Jul 27, 2025 at 03:58:02PM -0400, Sasha Levin wrote:
>> +- ``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``
>
>FYI, this will break tools that expect Co-developed-by: to be in the address
>header format. I will add exceptions in b4, but it *is* going to be annoying
>that this trailer can be in both formats and I expect other tooling will also
>have similar problems.
>
>If it's not too late, I recommend picking a wholly new trailer instead of
>overloading Co-developed-by. Examples:
>
>    | Assisted-by: Claude claude-3-opus-20240229
>    | Auxiliary-tooling: GitHub-Copilot GPT-4 v1.0.0
>
>I like the latter, because this also allows listing multiple tools.

Definitely not too late. This was brought up a few times, and I like the
idea of not changing the semantics of Co-developed-by.

-- 
Thanks,
Sasha
Re: [PATCH 4/4] agents: add legal requirements and agent attribution guidelines
Posted by Kees Cook 2 months, 1 week ago
On Sun, Jul 27, 2025 at 03:58:02PM -0400, Sasha Levin wrote:
> +Licensing Requirements
> +----------------------
> +
> +**GPL-2.0 License**
> +  The Linux kernel is licensed under GPL-2.0 only with a syscall exception. Coding agents MUST follow this licensing rule with no exceptions. Any code contributed must be compatible with this license.
> +
> +**SPDX License Identifiers**
> +  All files must have proper SPDX license identifiers. For most kernel source files, this should be the first line of the file in the appropriate comment format:
> +
> +  - For C source/header files: ``// SPDX-License-Identifier: GPL-2.0``
> +  - For scripts: ``# SPDX-License-Identifier: GPL-2.0``
> +  - For documentation: ``.. SPDX-License-Identifier: GPL-2.0``

Again, all of this is redundant. And if the SPDX stuff *isn't*
redundant, it needs to be listed somewhere else for humans.

> +Signed-off-by Restriction
> +-------------------------
> +
> +Coding 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 coding assistant should add their ``Signed-off-by`` tag to commits. The agent's contribution is acknowledged through the ``Co-developed-by`` tag as described below.

This is unique to Agents. Yes, this is fine.

> +Agent Attribution Requirement
> +-----------------------------
> +
> +When creating commits, coding agents **MUST** identify themselves by including the following tag in the commit message::
> +
> +    Co-developed-by: $AGENT_NAME $AGENT_MODEL $AGENT_VERSION
> +
> +Examples:
> +
> +- ``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 a coding agent was involved in the development process.

This is fine too.

But like I said before, you must update checkpatch.pl to not complain
about Co-developed-by missing S-o-b when C-d-b lacks email address,
and it should be part of this series.

-Kees

-- 
Kees Cook