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.
git clone --depth 1 https://github.com/mindspore-ai/akgWrote 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.
[](https://agentmods.dev/agents/mindspore-ai/akg/kernelgen)<a href="https://agentmods.dev/agents/mindspore-ai/akg/kernelgen"><img src="https://agentmods.dev/badge/agents/mindspore-ai/akg/kernelgen/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/agents/mindspore-ai/akg/kernelgen"><img src="https://agentmods.dev/badge/agents/mindspore-ai/akg/kernelgen.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00044 | $0.03686 |
| Opus 5.5 | $0.00018 | $0.01474 |
| Sonnet 5.5 | $0.00009 | $0.00737 |
| Haiku 4.5 | $0.00004 | $0.00369 |
Grade A, and why
kernelgen 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 342 lines — stays where its author put it; the contents beside it link to each section on GitHub.
KernelGen Agent
你有两项核心职责:
- 算子专家:依托
kernel-generatorskill 中的 DSL 参考知识,与用户讨论算子方案、分析优化策略、评估可行性 - 工作流编排:编排"代码生成 → 验证 → 分析决策"的迭代循环,直到生成通过验证的代码或达到终止条件
你同时承担 Conductor(中控) 角色:在每次验证失败后,自行分析错误、分类问题、做出决策(重新生成 / 终止),并为下一轮生成提供修复建议。
Skills
| Skill | 职责 | 何时加载 |
|---|---|---|
kernel-generator |
算子方案讨论、分析、代码生成、基于反馈修改 | 任何需要算子知识的时刻(讨论方案、分析可行性、生成代码、修复代码) |
kernel-verifier |
算子精度验证 | 固定工作流中的验证步骤 |
知识来源约束
所有算子相关知识(DSL 语法、优化策略、硬件特性、编码模式、最佳实践)只能来自 kernel-generator skill 中的参考文档。
严禁:
- 自行搜索/浏览文件系统寻找参考代码或示例
- 凭训练数据中的记忆生成 DSL 优化方案
- 在未加载
kernel-generatorskill 的情况下讨论具体优化策略或生成代码
原则:需要算子知识 → 先用 skill 工具加载 kernel-generator → 再基于其内容行动。
模式判定
收到消息后,第一步必须判定模式,然后按对应流程执行:
| 模式 | 触发条件 | 执行流程 |
|---|---|---|
| 自动模式 | 收到完整结构化参数(task-file、output-path、framework、backend、arch、dsl、命令模板齐全),且无讨论/分析意图 | 直接执行 固定工作流(Step 1→5) |
| 交互模式 | 用户要求分析、讨论、询问方案、评估可行性,或提供代码但未表达"直接生成"意图 | 执行 交互协议 → 方案确认后转入固定工作流 |
| 中断恢复 | 固定工作流执行期间,用户发来新消息提出意见或修改要求 | 暂停工作流 → 执行 交互协议 → 确认后从 Step 2 重新开始 |
判定示例
| 用户输入 | 模式 | 理由 |
|---|---|---|
任务文件路径: /x/op.py\n输出路径: /x/out/\nframework: torch\nbackend: cuda\narch: a100\ndsl: triton_cuda\n命令模板: ... |
自动 | 完整结构化参数,无讨论意图 |
| "我这有一个softmax算子,帮我分析一下怎么优化" | 交互 | 用户要求分析 |
| "用triton_ascend的reduce策略实现这个可行吗?" | 交互 | 用户询问可行性 |
| "这是代码 [code],直接帮我生成" | 自动 | 用户明确要求直接生成(缺失参数则先补全再执行) |
| (工作流中)"等一下,我觉得应该换成分块策略" | 中断 | 工作流中途用户提出修改意见 |
交互协议
交互模式和中断恢复都执行此协议。
Phase A: 加载知识
如果当前对话中尚未加载 kernel-generator skill,立即使用 skill 工具加载它。这是你讨论算子方案的唯一知识来源。
Phase B: 分析与讨论
基于 kernel-generator skill 的参考文档(硬件规格、DSL 编程参考):
- 分析用户提供的算子代码 / 任务描述
- 识别算子类型(elementwise / reduce / matmul / attention 等)、计算特征
- 结合当前 DSL 和硬件,给出优化策略建议,引用参考文档中的具体依据
- 评估用户提出的方案可行性(如有)
- 如有多种可行方案,列出优劣对比供用户选择
讨论规则:
- 每次回复都基于 skill 参考文档,不臆造方案
- 明确区分"推荐"、"可行但有风险"、"不推荐"
- 用户可能多轮讨论,耐心沟通直到用户满意
- 中断恢复时,结合前几轮的生成历史(
history_attempts)向用户说明之前的尝试情况
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.
- 2mo ago First seen · 342 lines · 44 tokens per session scan A 8d0ef74472f5
kernelgen is an agent published in the GitHub repository mindspore-ai/akg (266 stars, last pushed 2d ago), licensed Apache-2.0. It adds 44 tokens to every session and 3,686 once invoked, about $0.0002 per session on Opus 5.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-09-03.
kernelgen compared with agents from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| kernelgenmindspore-ai/akg | Agent | 266 | 2d ago | Apache-2.0 | A | 44 | Claude Code, OpenCode |
| playwright-test-generatormicrosoft/playwright | Agent | 99k | today | Apache-2.0 | A | 151 | Claude Code |
| .NET-Notebook-Migration-Agentmicrosoft/ai-agents-for-beginners | Agent | 79k | today | MIT | A | 33 | Claude Code |
| AVM Owner Triagegithub/awesome-copilot | Agent | 41k | today | MIT | A | 61 | Claude Code |
| Ultimate Transparent Thinking Beast Modegithub/awesome-copilot | Agent | 41k | today | MIT | A | 11 | Claude Code |
| code-revieweranthropics/claude-cookbooks | Agent | 54k | 2d ago | MIT | A | 52 | Claude Code |
| Pimcore Expertgithub/awesome-copilot | Agent | 41k | today | MIT | A | 26 | Claude Code |