agents: Add AI agent configuration for code reviews
PATCH v4 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
- review.md: Review protocol for AI agents
- apply-patch.ms: How to download and apply patches before review
AGENTS.md at root provides project overview and links to review protocol.
---
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.md | 117 ++++++++++++++++++++++++++++++++++ agents/apply-patch.md | 123 +++++++++++++++++++++++++++++++++++ agents/c-tests.md | 170 +++++++++++++++++++++++++++++++++++++++++++++++++ agents/ground-rules.md | 91 ++++++++++++++++++++++++++ agents/review.md | 108 +++++++++++++++++++++++++++++++ agents/shell-tests.md | 134 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 743 insertions(+)
AGENTS.md new file +117 -0
@@ -0,0 +1,117 @@ +# Linux Test Project (LTP) + +LTP delivers tests to the open source community that validate the +reliability, robustness, and stability of the Linux kernel and related +features. Tests are written in C or portable POSIX shell. The project uses +GNU Autotools for its build system and follows the Linux kernel coding style. + +**License**: GPL-2.0-or-later (`SPDX-License-Identifier: GPL-2.0-or-later`) + +## Technology Stack + +- **Languages**: C (primary), portable POSIX shell +- **Build system**: GNU Autotools (autoconf, automake, make) +- **Compiler**: gcc (clang also supported in CI) +- **Coding style**: Linux kernel coding style +- **Test runner**: kirk (replacing legacy `runltp`) +- **Documentation**: reStructuredText + Sphinx + +## Project Structure + +- `testcases/` — All test binaries (C and shell) + - `testcases/kernel/syscalls/` — Syscall and libc wrapper tests + - `testcases/open_posix_testsuite/` — Open POSIX testsuite fork + - `testcases/lib/` — Shell test library and shell loader +- `include/` — LTP library headers (`tst_test.h` is the main API) + - `include/lapi/` — Fallback kernel API definitions for older systems + - `include/mk/` — Build system include files +- `lib/` — LTP C library source (`tst_*.c` files) + - `lib/newlib_tests/` — LTP library self-tests +- `runtest/` — Runtest files defining test suites (e.g. `syscalls`, `mm`) +- `scenario_groups/` — Default sets of runtest files +- `doc/` — Sphinx documentation (RST format) +- `scripts/` — Helper scripts +- `ci/` — CI dependency installation scripts +- `.github/workflows/` — GitHub Actions CI workflows +- `tools/` — Release and maintenance tools +- `agents/` — AI agent configuration files + +## Environment Setup + +### Prerequisites + +- git +- autoconf, automake, m4 +- make +- gcc +- pkgconf / pkg-config +- libc headers +- linux headers + +### Download Source + +```sh +git clone --recurse-submodules https://github.com/linux-test-project/ltp.git +cd ltp +``` + +### Build from Source + +```sh +make autotools +./configure +make +``` + +### Install (default prefix: /opt/ltp) + +```sh +make install +``` + +## Agent Instructions + +All agent configuration files are in the `agents/` directory. + +### Task: Patch Review + +**Trigger**: User requests a review of a patch, commit, branch, PR, or patchwork/lore URL. + +**Action**: Load `agents/review.md` and follow its instructions. + +### Task: Write or Modify C Tests + +**Trigger**: User asks to write, fix, or modify a C test. + +**Action**: Load `agents/c-tests.md` and `agents/ground-rules.md` before writing code. + +### Task: Write or Modify Shell Tests + +**Trigger**: User asks to write, fix, or modify a shell test. + +**Action**: Load `agents/shell-tests.md` and `agents/ground-rules.md` before writing code. + +### Task: General Questions + +**Trigger**: User asks about LTP architecture, APIs, or how to do something. + +**Action**: Use the project structure and documentation paths below to find answers. + +## Additional Resources + +- Documentation: https://linux-test-project.readthedocs.io/ +- Source code: https://github.com/linux-test-project/ltp +- Mailing list: https://lore.kernel.org/ltp/ +- Patchwork: https://patchwork.ozlabs.org/project/ltp/list/ +- Kirk (test runner): https://github.com/linux-test-project/kirk +- Linux kernel coding style: https://www.kernel.org/doc/html/latest/process/coding-style.html + +### In-Repository Documentation + +- Development guide: `doc/developers/` +- Maintenance guide: `doc/maintenance/` +- User guide: `doc/users/` +- C API reference: `doc/developers/api_c_tests.rst` +- Shell API reference: `doc/developers/api_shell_tests.rst` +- Build system: `doc/developers/build_system.rst` +- Test writing tutorial: `doc/developers/test_case_tutorial.rst`
agents/apply-patch.md new file +123 -0
123 lines not on this page · raw message
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/review.md new file +108 -0
108 lines not on this page · raw message
agents/shell-tests.md new file +134 -0
134 lines not on this page · raw message
---
base-commit: 4ebee67c1563b7a4282f37bfea1d4325b391d6db
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,
I think this configuration is working pretty well as a starting point.
---
The setup I'm using to test it is the following:
1. install OpenCode from https://opencode.ai/ (npm is the fastest way)
2. open OpenCode in the LTP repo folder
3. configure OpenCode to make sure we can modify the current repo
$ cat .config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"*": "ask",
}
}In this way, we make sure that we have control on what the LLM will do on our folder. The LLM will ask for permissions when it will read/write files or download patches in our system.
I know it's possible to give sudo permissions, but it sounds like a bad idea to me.
4. setup OpenCode in Build mode (TAB), so it's possible to modify the current folder. This is needed in order to apply patches in the current LTP directory.
5. CTRL+x-m to select the Model we want to use.
6. provide to the LLM a link to patchwork/lore to start a code review on a developer patch
7. provide the commit/branch on the local repo if you want to review the current work you are working on
---
To test this patch, it's better to apply it on a new branch and explicitly tells to the LLM that we want to always start a review from this new branch containing the agents configuration. For example, tells to LLM:
"ALWAYS start a review from the branch <my branch> instead of master"
All reviews will create a new branch starting with "review/" prefix and they won't be removed lately. In this way, it's possible to review logic flaws in the patch after an initial LLM review.
---
Please take a look at it and let me know what we can improve. I would like to merge this patch-set pretty soon in order to start using it and save a lot of time to review the most common errors.
Kind regards,
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
I forgot to mention what models seem to work pretty well.
- Kimi K2.5: this is the Free option and it's ok. It catches most of the issues and the coding errors. Pretty effective
- MiniMax M2.4: Free and quite minimalistic.
- Claude Code: insanely good for many reasons, but it allucinate a bit or produce too much stuff that is actually un-needed
I didn't have the chance to try many models, but I would stick to Kimi for now. It's good enough and it's free/open source. It learns pretty fast and it doesn't allucinate too much.
Signature · 7 lines
Andrea Cervesato SUSE QE Automation Engineer Linux [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp