Skip to contentSkip to conversation

agents: Add AI agent configuration for code reviews

PATCH In review Andrea Cervesato 3 participants 4 messages Feb 24 – Mar 10

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 agents: Add AI agent configuration for code reviews

From: Andrea Cervesato <[email protected]>

Add .agents/ directory with configuration files for automated code review assistance. The configuration includes:

- ground-rules.md: Mandatory LTP development rules
- c-tests.md: C test writing guidelines and examples
- shell-tests.md: Shell test structure and style guide
- apply-patch.md: How to download and apply patches before review

AGENTS.md at root provides project overview and links to review protocol. SKILL.md for code reviews.

---
Changes in v6:
- make sure apply-patch.md is not override by the skill definition
- Link to v5: https://lore.kernel.org/r/[email protected]

Changes in v5:
- verified models: Kimi k3.5, GLM5, MiniMax M2.5, Claude Code
- adopt SKILL.md to make reviews more deterministic
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add patches apply section
- review the entire structure using Claude Code
- support as many LLM as possible
- use an imperative language
- edit/write new tests section
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- review and fix the agents review configuration
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- rewrite the entire agents/ structure to reduce the LLM allucination
and to focus on reviews only
- AGENTS.md now is defining basic project usage and it points to the agents/review.md for review requests
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 .agents/apply-patch.md         | 123 +++++++++++++++++++++++++++++
 .agents/c-tests.md             | 170 +++++++++++++++++++++++++++++++++++++++++
 .agents/ground-rules.md        |  91 ++++++++++++++++++++++
 .agents/shell-tests.md         | 134 ++++++++++++++++++++++++++++++++
 .agents/skills/review/SKILL.md | 145 +++++++++++++++++++++++++++++++++++
 AGENTS.md                      | 117 ++++++++++++++++++++++++++++
 6 files changed, 780 insertions(+)
.agents/apply-patch.md new file +123 -0
new file mode 100644
index 0000000000000000000000000000000000000000..590c94b38ee8fd935bde3d453a4beedf806aad9a
@@ -0,0 +1,123 @@
+# Downloading and Applying Patches
+
+This file provides instructions for downloading and applying patches from
+various sources. Use the appropriate section based on the input type.
+
+## Quick Reference
+
+- **Git commit**: No download needed - checkout directly
+- **Git branch**: No download needed - checkout directly
+- **Multiple commits**: Cherry-pick the range
+- **Patchwork URL**: Use b4 or curl + git am
+- **Lore URL**: Use b4 or curl + git am
+- **Local patch file**: git am directly
+- **GitHub PR**: Use gh or git fetch
+
+## From Git Commit
+
+```sh
+git checkout -b review/<name> <commit-hash>
+```
+
+## From Git Branch
+
+```sh
+git checkout -b review/<name> <branch-name>
+```
+
+## From Multiple Commits
+
+```sh
+git checkout -b review/<name> master
+git cherry-pick <start-commit>..<end-commit>
+```
+
+## From Patchwork URL
+
+### Option 1: Using b4 (RECOMMENDED)
+
+```sh
+git checkout master && git pull origin master
+git checkout -b review/<patch-name> master
+b4 shazam <message-id>
+```
+
+To get the Message-ID: open the Patchwork patch page and find it in the details.
+
+### Option 2: Without b4
+
+```sh
+git checkout master && git pull origin master
+git checkout -b review/<patch-name> master
+curl -sL "https://patchwork.ozlabs.org/patch/<id>/mbox/" -o /tmp/patch.mbox
+git am /tmp/patch.mbox
+```
+
+## From Lore URL
+
+### Option 1: Using b4 (RECOMMENDED)
+
+```sh
+git checkout master && git pull origin master
+git checkout -b review/<patch-name> master
+b4 shazam <message-id>
+```
+
+### Option 2: Without b4
+
+```sh
+git checkout master && git pull origin master
+git checkout -b review/<patch-name> master
+curl -sL "https://lore.kernel.org/ltp/<message-id>/raw" -o /tmp/patch.mbox
+git am /tmp/patch.mbox
+```
+
+## From Local Patch File
+
+```sh
+git checkout master && git pull origin master
+git checkout -b review/<patch-name> master
+git am /path/to/patch.patch
+```
+
+## From GitHub PR
+
+### Option 1: Using gh (RECOMMENDED)
+
+```sh
+git checkout master && git pull origin master
+gh pr checkout <pr-number>
+```
+
+### Option 2: Without gh
+
+```sh
+git checkout master && git pull origin master
+git fetch origin pull/<pr-number>/head:review/pr-<pr-number>
+git checkout review/pr-<pr-number>
+```
+
+## Applying a Patch Series
+
+For multiple patches in order:
+
+```sh
+git am /tmp/patch1.mbox /tmp/patch2.mbox /tmp/patch3.mbox
+```
+
+Or concatenate:
+
+```sh
+cat /tmp/patch*.mbox | git am
+```
+
+## b4 Command Reference
+
+- `b4 shazam <msgid>`: Download and apply patches directly
+- `b4 am <msgid>`: Download patches as mbox (does not apply)
+- `b4 am -o . <msgid>`: Save mbox to current directory
+
+**Options:**
+
+- `-o <dir>`: Save mbox to specific directory
+- `-m <file>`: Use local mbox file instead of fetching
.agents/c-tests.md new file +170 -0

170 lines not on this page · raw message

.agents/ground-rules.md new file +91 -0

91 lines not on this page · raw message

.agents/shell-tests.md new file +134 -0

134 lines not on this page · raw message

.agents/skills/review/SKILL.md new file +145 -0

145 lines not on this page · raw message

AGENTS.md new file +117 -0

117 lines not on this page · raw message

---
base-commit: 52e2dad4ce4ae53554f127b3bdf01c1c632e8220
change-id: 20260215-agents_file-344bdc3300d0

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Acked-by on v6 1/1
#1 lore raw

Hi Andrea,

thanks for your work. On a first look LGTM.

I wonder if we can somehow avoid duplicity with our Ground Rules
https://linux-test-project.readthedocs.io/en/latest/developers/ground_rules.html
Ideally text would be just in a single document.

...

.agents/c-tests.md line 77

Quoted 4 lines
.agents/c-tests.md new file +4 -0
+### 6. Safe Macros
+
+- MUST use `SAFE_*` macros for system calls that must not fail
+- Safe macros are defined in `include/` directory

Actually the signatures are defined there, the code mostly not, but that's minor detail.

.agents/c-tests.md line 82

Quoted 5 lines
.agents/c-tests.md new file +5 -0
+
+### 7. Kernel Version Handling
+
+- MUST use `.min_kver` for kernel version gating
+- MUST prefer runtime checks over compile-time checks

...

I guess I should send v2 for my patch and that could be updated here
https://patchwork.ozlabs.org/project/ltp/patch/[email protected]/
https://lore.kernel.org/ltp/[email protected]/

.agents/c-tests.md line 109

Quoted 4 lines
.agents/c-tests.md new file +4 -0
+
+### 13. Deprecated Features
+
+- MUST NOT define `[Description]` in the test description section

When we handle details like this, we may want to add rule to avoid unnecessary tags e.g. .mount_device:

metadata/metaparse.c

static struct implies {
	const char *flag;
	const char **implies;
} implies[] = {
	{"mount_device", (const char *[]) {"format_device", "needs_device",
		"needs_tmpdir", NULL}},
	{"format_device", (const char *[]) {"needs_device", "needs_tmpdir",
		NULL}},
	{"all_filesystems", (const char *[]) {"needs_device", "needs_tmpdir",
		NULL}},
	{"needs_device", (const char *[]) {"needs_tmpdir", NULL}},
	{"needs_checkpoints", (const char *[]) {"needs_tmpdir", NULL}},
	{"resource_files", (const char *[]) {"needs_tmpdir", NULL}},
	{NULL, (const char *[]) {NULL}}
};

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi,

Quoted 2 lines

https://linux-test-project.readthedocs.io/en/latest/developers/ground_rules.html
Ideally text would be just in a single document.

I was thinking the same, but at the moment I don't know how to combine these two things. One is a documentation oriented format, the other is a list of rules for the agent.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Andrea,

Quoted 6 lines
Quoted 2 lines

https://linux-test-project.readthedocs.io/en/latest/developers/ground_rules.html
Ideally text would be just in a single document.

I was thinking the same, but at the moment I don't know how to combine these two things. One is a documentation oriented format, the other is a list of rules for the agent.

No problem, thanks for considering it. I was also thinking about mentioning the rules in the Patch review [1] in the Maintainers section. Probably the rules for AI review might be different from review doing by humans, but at least mention that we have some rules for AI might be useful for the maintainers who read the Patch review page.

Kind regards,
Petr

[1] https://linux-test-project.readthedocs.io/en/latest/maintainers/patch_review.html

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp