Skip to content

konveyor/ai-rule-gen

Repository files navigation

ai-rule-gen

Generate Konveyor analyzer migration rules from any migration guide. Point your AI coding agent at a guide and get validated, tested rules ready for the konveyor/rulesets repo.

Install

Prerequisites

Add the skill

git clone https://github.com/konveyor/ai-rule-gen.git

Skills follow the Agent Skills format and are bundled in the repo. Open the repo in your agent — no registration step needed.

Usage

Two commands are available:

Command What it does
/generate-rules Generate rules only (no testing)
/generate-rules-with-test Full pipeline with test generation and validation

Claude Code

/generate-rules https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
/generate-rules-with-test https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

OpenCode

/generate-rules https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
/generate-rules-with-test https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

Goose

/skills generate-rules https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
/skills generate-rules-with-test https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

Codex

$generate-rules checkpoint_behavior=stop_after_extract https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide
$generate-rules checkpoint_behavior=continue https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

Any other agent

Read and follow agents/generate-rules/SKILL.md. Input: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

By default, the agent prompts at checkpoint whether to continue with testing. Pass checkpoint_behavior=stop_after_extract (rules only) or checkpoint_behavior=continue (full pipeline) to skip the prompt.

The input can be a URL, a file path, or pasted migration guide text.

To add tests to rules generated with /generate-rules, use the resume mechanism:

/generate-rules-with-test resume_from=scaffold migration_dir=output/<source>-to-<target>-<timestamp>

You can optionally pass explicit source and target labels (multiple of each are supported):

/generate-rules sources=["spring-boot3","spring-boot"] targets=["spring-boot4","spring-boot"] https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-4.0-Migration-Guide

Each source and target becomes its own konveyor.io/source= or konveyor.io/target= label on every generated rule, matching the konveyor/rulesets label conventions. If omitted, sources and targets are auto-detected from the guide.

The agent runs the full pipeline automatically:

  1. Ingest the migration guide into clean markdown
  2. Extract every migration pattern (API changes, dependency updates, config renames, POM structure)
  3. Construct Konveyor rule YAML files from the patterns
  4. Scaffold test directories and generate test source code
  5. Run kantra to validate every rule finds incidents
  6. Fix any failing rules (up to 3 iterations)
  7. Report final pass rate and output locations

Output

output/
└── <primary-source>-to-<primary-target>-<timestamp>/
    ├── guide.md          # Ingested migration guide
    ├── patterns.json     # Extracted migration patterns (sources/targets arrays)
    ├── rules/            # Rule YAML files ready for konveyor/rulesets
    │   ├── ruleset.yaml  # Ruleset with all source/target labels
    │   ├── web.yaml
    │   └── ...
    ├── tests/            # Kantra test suites
    └── report.yaml       # Summary report

All LLM orchestration lives in agent skills. The Go CLI is purely deterministic — no LLM calls, no API keys, no prompt templates.

Migration Guide → Agent extracts patterns → CLI constructs rules → CLI scaffolds tests
    → Agent generates test code → kantra validates → Agent fixes failures → Tested rules
Layer What LLM?
Agent skills (agents/) Read guides, extract patterns, generate test code, fix failures Yes
CLI commands (cmd/) Ingest, construct, validate, scaffold, sanitize, test, report No

Agent skills

Skill Role
generate-rules Orchestrates the full end-to-end pipeline
rule-writer Reads migration guide, extracts migration patterns into patterns.json
test-generator Reads manifest.json, generates compilable test source code
rule-validator Runs kantra, interprets results, generates fix hints
eval One-stop eval — runs deterministic checks + LLM judge, finds missed patterns and false positives

Each skill follows the Agent Skills format with a SKILL.md and optional references/ directory.

Eval

See docs/howto/eval.md for how to measure rule quality, app coverage, and run regression comparisons.

Related Projects

License

Apache-2.0

About

Generates, validates, and tests migration rules for Konveyor. It ingests source documentation, uses LLMs to extract migration patterns, constructs YAML rules, generates test data, and scores rule quality via kantra functional tests and optional LLM-as-judge.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages