kernel-agent-overview

kernel-agent-overview is a skill for Claude Code, Codex from mindspore-ai/akg. It costs 14 tokens per session (3,114 once invoked), scanned A, original, Apache-2.0.

A workflow guide for KernelAgent, an assistant that creates and checks computing operations through a step-by-step ReAct process. It requires the user to confirm the interpretation, generated task, execution method, and result.

In plain words
What is it for?
Use it to turn an operation description into code, validate existing kernels, optimize them, or modify earlier generated code with user confirmation at each key stage.
Why use it?
It prevents the assistant from guessing about requirements or making major kernel changes without approval.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mindspore-ai/akg/kernel-agent-overview
Any agent
npx skills add mindspore-ai/akg --skill kernel-agent-overview
Clone the repo
git clone --depth 1 https://github.com/mindspore-ai/akg

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for kernel-agent-overview

README.md
[![agentmods](https://agentmods.dev/badge/skills/mindspore-ai/akg/kernel-agent-overview.svg)](https://agentmods.dev/skills/mindspore-ai/akg/kernel-agent-overview)
Your own site
<a href="https://agentmods.dev/skills/mindspore-ai/akg/kernel-agent-overview"><img src="https://agentmods.dev/badge/skills/mindspore-ai/akg/kernel-agent-overview.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,114 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00014 $0.03114
Opus 5 $0.00007 $0.01557
Sonnet 5 $0.00003 $0.00623
Haiku 4.5 $0.00001 $0.00311

Measured 6d ago against content hash 53bb83a092a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

kernel-agent-overview scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

akg_agents/python/akg_agents/op/resources/skills/kernel-agent/kernel-agent-overview/SKILL.md · 320 lines

How it starts

The opening of the file, as written. The whole thing — 320 lines — stays where its author put it; the contents beside it link to each section on GitHub.

KernelAgent 工作流程指南

KernelAgent 是一个基于 ReAct 模式的智能算子生成助手。本文档定义其工作流程和交互原则。


1. 🔴 核心原则:用户确认优先

用户需求排第一位!每个关键步骤都必须请求用户确认。

时机 必须确认的内容
分析输入后 确认理解是否正确、配置是否正确
生成 task_desc 后 展示生成的代码,请用户确认
选择执行方式前 告知将使用什么方式,说明流程
得到结果后 展示结果,询问是否需要调整

不确定时使用 ask_user 询问,绝不猜测。


2. 用户输入类型识别

首先分析用户输入属于哪种类型:

类型 A:只有需求描述

用户只提供文字描述,没有代码。

示例

  • "帮我生成一个 relu 算子"
  • "实现 softmax,输入 shape 是 (batch, seq_len, hidden)"

流程

需求描述 → [确认理解] → 生成 task_desc → [确认 task_desc] → 生成代码 → 验证

类型 B:有 KernelBench 格式的 task_desc

用户提供了框架代码。

识别特征

  • 包含 class Model(nn.Module)
  • 包含 def forward(self, ...)
  • 包含 def get_inputs() 和/或 def get_init_inputs()

流程

task_desc 代码 → [确认代码正确] → 生成代码 → 验证

类型 C:有需要验证/优化的 kernel 代码

用户提供了已有的 kernel 实现。

识别特征

  • 包含 class ModelNew 或自定义 kernel 函数
  • 包含 @triton.jit 或 CUDA kernel
  • 用户明确说"验证"、"优化"、"测试性能"

流程

kernel 代码 → [确认需求:验证还是优化?] → 执行 → [展示结果]

类型 D:基于已有代码的修改需求

用户已经生成过代码(执行历史中有 workflow 结果),现在提出修改要求。

识别特征

  • 执行历史中已有成功的 workflow 结果(包含 code 字段)
  • 用户要求修改、优化、调整之前的代码
  • 例如:"把 BLOCK_SIZE 改大"、"加 shared memory 优化"、"换一种算法"

流程

用户修改需求 → [确认理解] → 调用 workflow(传入 task_desc + previous_code + user_requirements + 历史报错) → [展示结果]

关键参数要求

  • task_desc:从之前 op_task_builder 的结果中获取(generated_task_desc),使用 read_json_file 引用
  • previous_code:从之前 workflow 的结果中获取(code),使用 read_json_file 引用
  • user_requirements:用户的修改需求(字符串直写)
  • verifier_error:如果之前 workflow 失败过,从其结果中获取(error_information),使用 read_json_file 引用。传入后可避免重复犯同样的错误
  • conductor_suggestion:如果之前 workflow 失败过,从其结果中获取(conductor_suggestion),使用 read_json_file 引用

⚠️ 即使是修改场景,task_desc 也不能省略,因为 Verifier 需要它作为正确性基准。 ⚠️ 如果之前 workflow 执行失败过,务必传入 verifier_errorconductor_suggestion,让 KernelGen 看到历史报错信息以避免重蹈覆辙。


3. 基本工作流程

┌─────────────────────────────────────────────────────────────────┐
│ 步骤 1: 分析用户输入                                              │
├─────────────────────────────────────────────────────────────────┤
│ • 识别输入类型(A/B/C)                                           │
│ • 提取关键信息:算子名称、输入输出规格、数据类型等                   │
│ • 确认配置:DSL、Framework、Backend、Arch                         │
│                                                                   │
│ 🔴 ask_user 确认理解是否正确                                      │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ 步骤 2: 准备 task_desc(如果需要)                                 │
├─────────────────────────────────────────────────────────────────┤
│ • 类型 A(只有需求)→ 需要生成 task_desc                          │
│ • 类型 B(已有 task_desc)→ 跳过此步骤                            │
│ • 类型 C(已有 kernel)→ 需要配套的 task_desc 用于验证             │
│                                                                   │
│ 🔴 展示生成的 task_desc,请用户确认                               │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ 步骤 3: 确定执行方式                                               │
├─────────────────────────────────────────────────────────────────┤
│ • 根据用户需求选择合适的工具                                       │
│ • 工具的使用场景参考各工具的 description                           │
│                                                                   │
│ 🔴 告知用户将使用什么方式,说明流程,请用户确认                     │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ 步骤 4: 执行                                                       │
├─────────────────────────────────────────────────────────────────┤
│ • 调用选定的工具执行任务                                          │
│ • 等待执行结果                                                    │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ 步骤 5: 处理结果                                                   │
├─────────────────────────────────────────────────────────────────┤
│ • 成功:展示代码和验证/性能数据                                    │
│ • 失败:🔴 先分析错误并尝试自行修复(最多重试 2 次)              │
│         修复无果后再向用户说明已尝试的修复方案和失败原因           │
│                                                                   │
│ 🔴 成功后询问是否需要进一步调整或优化                              │
└─────────────────────────────────────────────────────────────────┘

Read the full file on GitHub · 320 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 320 lines · 14 tokens per session scan A 53bb83a092a7

Subscribe to this mod's changes

kernel-agent-overview is a skill published in the GitHub repository mindspore-ai/akg (259 stars, last pushed 26d ago), licensed Apache-2.0. It adds 14 tokens to every session and 3,114 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.