Skip to content

linux-test-project/ltp-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

248 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LTP Agent

AI agent configuration for reviewing, converting, and testing Linux Test Project patches.

Supported AI coding agents:

Setup

  1. Clone this repository and install the skills for your agent:

    git clone <this-repo-url> ltp-agent
    ./ltp-agent/setup.sh <agent>

    <agent> is one of: claude, pi, opencode, gemini, copilot. The skills are copied into the agent's native skill directory. For opencode, the multi-agent conversion pipeline is also installed into ~/.config/opencode/agent/. The LTP source tree is not touched.

  2. Clone the LTP source tree:

    git clone --recurse-submodules https://github.com/linux-test-project/ltp.git
  3. Start your AI coding agent from the LTP directory. The skills are discovered automatically from their installed location.

Entry Point

The ltp skill is an automatic entry point. When you work inside an LTP tree, it loads on its own and makes the agent aware that LTP-specific rules apply to every code change, review, analysis, and commit message. It routes the agent to the relevant rule files under rules/ and to the specialized skills (ltp-review, ltp-analyze, ltp-convert). You do not invoke it directly; it activates whenever the working directory looks like an LTP tree.

Usage

Reviewing a Patch

With the patches applied into your development branch, invoke the review skill inside your agent:

/ltp-review

This performs a deep code review against all LTP rules and writes the resulting inline email reply to review-inline.txt at the LTP tree root.

Analyzing a Test

To perform a deep, read-only analysis of an LTP test (quality, robustness, and coverage):

/ltp-analyze <file path or test name>

The skill works on any LTP test (old API, new API, or shell). It produces a report covering test intent, value, robustness, coverage gaps, API/style compliance, and prioritized recommendations. No files are modified.

Converting Old Tests to New API

To convert a test from the legacy test.h API to the modern tst_test.h API:

/ltp-convert

For every test the skill evaluates two conversion strategies (a semantic rewrite using new-API idioms, or a faithful port that preserves the original structure), chooses the best one, and presents a Conversion Plan that you must confirm before any file is changed. The original test intent is never dropped.

Note

Converted test is just a draft, most of the times the developer will need to update the test by hand.

To find candidates for conversion, scan the tree with:

python3 ltp-agent/tools/scan-old-api.py --root-dir <ltp directory>

Multi-agent conversion (opencode)

On opencode, an orchestrated multi-agent pipeline is also installed. Switch to the ltp-converter primary agent and give it a test path or name. It delegates to five subagents:

  • ltp-analyzer builds a punctual Intent Contract and decides the strategy.
  • ltp-creator implements the converted test, bound to that contract.
  • ltp-builder compiles the converted test with the LTP build system and reports errors and warnings before review.
  • ltp-runner (opt-in) runs the original and converted test in a sandbox and compares their outcomes when the test is sandbox-runnable.
  • ltp-reviewer audits the result against the contract and LTP rules.

The orchestrator loops create/build/(run)/review until the intent is fully preserved, and still stops for Conversion Plan approval before writing any file.

Pinning models per agent

The pipeline ships with no model: pinning so it runs anywhere opencode does. To pin a model per role, put an agent block in your opencode config (global ~/.config/opencode/opencode.json/.jsonc, or per-project .opencode/opencode.json in your LTP checkout). The keys are the agent file basenames. Example:

{
  "$schema": "https://opencode.ai/config.json",
  "agent": {
    "ltp-converter": { "model": "<provider>/claude-sonnet-5" },
    "ltp-analyzer":  { "model": "<provider>/claude-opus-4.8" },
    "ltp-creator":   { "model": "<provider>/claude-opus-4.8" },
    "ltp-builder":   { "model": "<provider>/claude-haiku-4-5@20251001" },
    "ltp-runner":    { "model": "<provider>/claude-haiku-4-5@20251001" },
    "ltp-reviewer":  { "model": "<provider>/claude-sonnet-5" }
  }
}

Replace <provider> with the provider key from your provider block (e.g. google-vertex, anthropic, opencode). Anything you leave out falls back to the primary agent's model (opencode default for subagents). This repo intentionally does not ship model IDs.

Rule Files

The rules/ directory contains rule files that the agent loads on demand based on the task:

File Description
ground-rules.md Mandatory rules for all LTP code.
c-tests.md Rules for LTP C tests.
shell-tests.md Rules for LTP shell tests.
openposix.md Rules for Open POSIX Test Suite.
classify.md Classify rules for LTP files.
dispatch.md Maps classifications to rule files.
commit-message.md Rules for LTP commit messages.
build-system.md Rules for LTP Makefiles and build system.
git.md Rules for LTP git configuration files.
documentation.md Rules for LTP Sphinx docs and doc-comments.
false-positive-guide.md Verification checklist applied after review.
email-template.md Complete format of a review reply email.
conversion-strategy.md Choosing an old-to-new API conversion path.

Continuous Integration

The .github/workflows/ci-copilot-review.yml workflow runs /ltp-review automatically against LTP Patchwork series using GitHub Copilot CLI, posts the verdict back to Patchwork as a check, and (if SMTP credentials are configured) sends the inline review to the mailing list as a reply to the original submission. It is triggered manually by series ID via workflow_dispatch.

Additional Resources

License

This project is licensed under the GNU General Public License v2.0 or later. See COPYING for the full license text.

About

Linux Test Project Agent configuration

Resources

License

Stars

4 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors