kagent-subagent:基于 Claude 与 Python 的内核补丁跟踪与集成代理套件项目

可用于 Kunpeng 补丁跟踪和 openEuler 集成管理,包含 Claude 子代理定义与 Python 后端,支持补丁影响分析、批量扫描、图谱初始化、合并提交流程及报告生成,全栈版本控制便于协作与回溯。【此简介由AI生成】

Branch1Tags6

KAgent — Full-Stack Kernel Patch Agent Suite

This repository manages the complete Kernel Agent stack used for Kunpeng patch tracking and openEuler integration:

  • Claude subagent prompts (agents/) — the natural-language agent definitions that Claude Code loads
  • Python backend (backend/) — graph extraction, batch filtering, semantic analysis, report generation, and patch submission helpers

Everything that affects how the agent reasons and executes is versioned here. Large generated data files (knowledge graphs, CSV reports) are excluded — they are reproducible from the code and upstream kernel sources.

Purpose

Versioning the entire stack in one repository makes it possible to:

  • Track changes to both prompt logic and Python implementation together
  • Roll back to a known-good agent+backend combination
  • Tag releases that correspond to pipeline milestones
  • Share the full system across machines and team members
  • Review prompt and code changes with normal git diffs

Repository Layout

.
├── agents/                    # Claude Code subagent definitions
│   ├── kpit.md                # Kunpeng Patch Impact Tree analyzer (v6.0.0)
│   ├── kunpeng-batch.md       # Batch hybrid filter + semantic analysis (v6.0.0)
│   ├── kunpeng-init.md        # Pre-computed graph/data initializer (v6.0.0)
│   ├── kernel-patch-merge.md  # Cherry-pick / merge agent (v1.0.0)
│   ├── kernel-patch-report.md # Test report generator (v1.0.0)
│   └── kernel-patch-submit.md # PR submission agent (v1.0.0)
├── backend/
│   ├── kpit/                  # Core Python modules
│   │   ├── batch.py           # v6.0 batch filtering engine
│   │   ├── suspicious_detector.py
│   │   ├── semantic_analyzer.py
│   │   ├── graph_evidence.py / graph_evidence_sqlite.py
│   │   ├── config.py
│   │   └── ...
│   ├── scripts/               # Build/extract/scan helper scripts
│   │   ├── build_kernel_graph.py
│   │   ├── extract_kunpeng_full.py
│   │   ├── batch_semantic_verify.py
│   │   └── ...
│   ├── README.md              # Backend-specific notes
│   └── .env.example           # Environment template
├── scripts/
│   └── install.sh             # Symlink agents into Claude agents dir
├── docs/
│   └── versioning.md          # Versioning policy
├── CHANGELOG.md
└── README.md

Agent Inventory

Agent Version Purpose Trigger Phrase
kpit 6.0.0 Single-commit Kunpeng impact analysis (L1-L6 rules + LLM semantic judgment) "分析 commit <hash> 影响鲲鹏吗"
kunpeng-batch 6.0.0 Batch scan commits for Kunpeng relevance with v6.0 rules + semantic analysis "扫描 2024 年鲲鹏 patch"
kunpeng-init 6.0.0 One-shot setup of knowledge graph, reverse calls, ops mappings, Kconfig closure "初始化图谱"
kernel-patch-merge 1.0.0 Cherry-pick a patch into the openEuler source tree "帮我 merge 这个 patch 到 openEuler"
kernel-patch-report 1.0.0 Generate structured markdown test / impact reports "生成测试报告"
kernel-patch-submit 1.0.0 Create and submit a PR for the merged patch "帮我提 PR"

Component Version Mapping

Component Current Version Description
kpit agent 6.0.0 Prompt logic
kunpeng-batch agent 6.0.0 Prompt logic
Python backend (batch.py) v6.1 Rule engine (includes refactor detection, framework migration)
Knowledge graph 2026-06-02 Based on openEuler kernel snapshot
Scan target kernel linux-6.6.y ~ v6.13-rc1 Mainline version range

Backend Quick Start

cd backend
# Copy and edit environment variables
cp .env.example .env
# Install dependencies (add a requirements.txt if needed)
pip install -r requirements.txt
# Run batch filter
python3 -m kpit.batch /path/to/kernel since until out_dir

Installation

To activate the Claude agents in your local environment:

./scripts/install.sh

This symlinks the canonical agent definitions from agents/ into the active Claude Code agents directory (~/.claude/projects/kernel-agent/.claude/agents/ by default).

Versioning Policy

  • Semantic versioning (MAJOR.MINOR.PATCH):
    • MAJOR — behavior change that would produce materially different results
    • MINOR — new capability, additional rule, or extended coverage
    • PATCH — bug fix in instructions, corrected example, or wording clarification
  • Each agent frontmatter contains a version: field.
  • Python backend shares the same agent major version while it implements that generation of rules.
  • Git tags follow the pattern <agent>-v<version>, e.g. kpit-v6.0.0.

Typical Workflow

  1. Edit an agent under agents/ and/or Python under backend/.
  2. Bump version: or backend version notes according to the change severity.
  3. Record the change in CHANGELOG.md.
  4. Commit with a message like feat(kpit): add L3.10 macro reverse dependency scoring.
  5. Tag the release: git tag kpit-v6.1.0.
  6. Run ./scripts/install.sh to refresh the active agents.

What Is NOT in This Repo

  • Generated knowledge graphs (*.json / *.jsonl / *.csv / *.db) — excluded by .gitignore. These are produced by running backend/scripts/build_*.py against a kernel checkout.
  • Raw kernel source trees — assumed to live on a remote build machine or local workspace.
  • Patch reports — outputs go to a reports/ directory that is also ignored.

Introduction

可用于 Kunpeng 补丁跟踪和 openEuler 集成管理,包含 Claude 子代理定义与 Python 后端,支持补丁影响分析、批量扫描、图谱初始化、合并提交流程及报告生成,全栈版本控制便于协作与回溯。【此简介由AI生成】

Customize your domain