agents: Add AI agent configuration for code reviews
PATCH v5 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 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 | 150 ++++++++++++++++++++++++++++++++++++ AGENTS.md | 117 ++++++++++++++++++++++++++++ 6 files changed, 785 insertions(+)
.agents/apply-patch.md new file +123 -0
@@ -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 +150 -0
150 lines not on this page · raw message
AGENTS.md new file +117 -0
117 lines not on this page · raw message
---
base-commit: f062b34785db121c841f2faed8233b0943cdff27
change-id: 20260215-agents_file-344bdc3300d0
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi,
Quoted 11 lines
.agents/skills/review/SKILL.md new file +11
-0+### Step 1.1: Load Core Files + +``` +Read: .agents/apply-patch.md +Read: .agents/ground-rules.md +``` + +### Step 1.2: Fetch and Apply Patch + +```bash +# Clean state
.agents/skills/review/SKILL.md line 33
Quoted 10 lines
.agents/skills/review/SKILL.md new file +10
-0+git checkout <base-branch> +git branch -D review/<name> 2>/dev/null + +# Fetch patch +b4 am <message-id> + +# Apply patch +git checkout -b review/<name> <base-branch> +git am <mbox-file> +```
Spotted an error in the configuration here. Now LLM is ignoring the apply-patch.md file. I will send a v7.
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp