workflows.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Mario Limonciello <superm1@kernel.org>,
	Sasha Levin <sashal@kernel.org>,
	workflows@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: rostedt@goodmis.org, konstantin@linuxfoundation.org,
	corbet@lwn.net, josh@joshtriplett.org
Subject: Re: [RFC 0/2] Add AI coding assistant configuration to Linux kernel
Date: Sat, 26 Jul 2025 09:36:08 -0700	[thread overview]
Message-ID: <48E7949A-F137-4412-8F96-B4BC2F915206@kernel.org> (raw)
In-Reply-To: <77782f57-6131-4968-95dc-088329cc50f7@kernel.org>



On July 26, 2025 2:07:40 AM PDT, Mario Limonciello <superm1@kernel.org> wrote:
>> 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

-- 
Kees Cook

  parent reply	other threads:[~2025-07-26 16:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 17:53 Sasha Levin
2025-07-25 17:53 ` [RFC 1/2] AI: Add unified AI coding assistant configuration Sasha Levin
2025-07-25 18:19   ` Steven Rostedt
2025-07-25 22:11     ` Sasha Levin
2025-07-25 18:27   ` Jonathan Corbet
2025-07-25 22:15     ` Sasha Levin
2025-07-27  2:24       ` Sasha Levin
2025-07-28 16:56         ` Mauro Carvalho Chehab
2025-07-25 20:40   ` Kees Cook
2025-07-25 22:25     ` Sasha Levin
2025-07-25 17:53 ` [RFC 2/2] AI: Add initial set of rules and docs Sasha Levin
2025-07-25 20:53   ` Kees Cook
2025-07-25 22:10     ` Sasha Levin
2025-07-28 17:00     ` Mauro Carvalho Chehab
2025-07-25 18:41 ` [RFC 0/2] Add AI coding assistant configuration to Linux kernel Jakub Kicinski
2025-07-25 19:00   ` Steven Rostedt
2025-07-25 19:59     ` Jakub Kicinski
2025-07-25 20:32       ` Dr. David Alan Gilbert
2025-07-25 20:34       ` dan.j.williams
2025-07-25 22:28         ` Sasha Levin
2025-07-28 17:46         ` Steven Rostedt
2025-07-28 18:20           ` dan.j.williams
2025-07-28 22:12           ` Mauro Carvalho Chehab
2025-07-29  0:18             ` Mauro Carvalho Chehab
2025-07-25 21:03     ` Kees Cook
2025-07-28 15:57       ` dan.j.williams
2025-07-28 16:41         ` Kees Cook
2025-07-26  9:07 ` Mario Limonciello
2025-07-26 11:53   ` Sasha Levin
2025-07-26 16:36   ` Kees Cook [this message]
2025-07-28 16:49 ` Mauro Carvalho Chehab
2025-11-11  2:23 ` Jarkko Sakkinen
2025-07-27  9:37 Sabyrzhan Tasbolatov
2025-07-27 15:23 ` Kees Cook
2025-07-27 15:45   ` Dr. David Alan Gilbert
2025-07-28  6:40     ` Kees Cook
2025-07-28 16:43       ` Sabyrzhan Tasbolatov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48E7949A-F137-4412-8F96-B4BC2F915206@kernel.org \
    --to=kees@kernel.org \
    --cc=corbet@lwn.net \
    --cc=josh@joshtriplett.org \
    --cc=konstantin@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashal@kernel.org \
    --cc=superm1@kernel.org \
    --cc=workflows@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox