昇腾、鲲鹏知识图谱的相关工具集
kg-tools
让 AI Agent 实时检索昇腾知识图谱(KG),执行 600+ 官方 Skill —— 算子开发、模型迁移、性能调优、调试排错,全程不靠模型记忆猜答案。
AI 模型的训练数据可能已过时。昇腾 API 参数、配置默认值、错误码含义,若让 Agent "凭记忆回答"就等于猜测。kg-tools 把昇腾知识图谱接入 AI Agent,提供实时权威数据源——超 640 万节点、超 2000 万关系边、600+ 可执行 Skill、23 Plugin,覆盖昇腾 14 代码组 + 鲲鹏 8 代码组,含跨仓库关联、配置映射、错误码→源码映射,是你训练数据之外的真实工程经验。
面向昇腾 / 鲲鹏开发者(算子开发、模型迁移、性能调优、推理部署、排错)与想为 AI Agent 装上「昇腾能力」的团队。
✨ 功能
| 类型 | 场景 | Agent 能帮你 |
|---|---|---|
| 🔍 检索型 · 查事实 | API 参数签名/默认值、错误码→源码映射、代码精确定位、跨仓影响面 | 实时回答,附 KG 节点来源 |
| ⚙️ 执行型 · 做任务 | 算子开发、GPU→NPU 迁移、性能调优、部署、量化 | 按 600+ 官方 Skill 工作流执行 |
| 🤖 编排引擎 · 自动调优 | vLLM-Ascend / SGLang-NPU / MindIE 服务延迟与吞吐优化 | 十阶段闭环自动执行,无需手动一步步调参 |
🚀 快速开始(3 步,约 60 秒)
① 安装到你的 AI Agent
方式一(推荐,最简单)——把下面这段话直接发给 Agent(Claude Code / Cursor / Codex / Cline 等),它会自行克隆仓库并完成安装:
克隆 https://gitcode.com/agent0/kg-tools 并安装 ascend-kg skill。如果访问 gitcode 受限,请向我索取 kg-tools 的离线 zip 包,解压后继续安装。完成后提示我重启 Agent。
方式二(手动):
git clone https://gitcode.com/agent0/kg-tools.git && cd kg-tools
bash install.sh ascend-kg # 仅装 ascend-kg;不带参数 = 安装全部
支持 9 种 Agent,安装细节见 支持的 Agent。
② 配置 API Key
export ASCEND_KG_API_KEY="你的Key"
没有 Key?免费申请,或先用内置测试 Key 体验:kg-test-1489df447809de55e30251bf59bf2d6c。未设环境变量时,Agent 首次激活会询问。
③ 开始提问
/ascend-kg 帮我查一下 ReduceSum 接口的参数
/ascend-kg 帮我写一个 LayerNorm 算子
支持的 Agent
| Agent | 安装方式 | 是否含 subagent |
|---|---|---|
| Claude Code | skill + subagent + CLAUDE.md 准则(~/.claude/skills/ascend-kg + ~/.claude/agents/ + ~/.claude/CLAUDE.md) |
✅ |
| Cursor | 规则文件(.cursor/rules/ascend-kg.mdc,alwaysApply: true) |
— |
| Trae | 规则文件(.trae/rules/ascend-kg.md,alwaysApply: true) |
— |
| Codex (OpenAI) | 规则文件(AGENTS.md) |
— |
| Hermes | 全局 skill(~/.hermes/skills/ascend-kg/)+ HERMES.md 触发指针 |
— |
| Cline | 规则文件(.clinerules) |
— |
| OpenCode | 全局 skill(~/.config/opencode/skills/ascend-kg/) |
— |
| OpenClaw | 全局 skill(~/.openclaw/skills/ascend-kg/) |
— |
| GitHub Copilot | 规则文件(.github/copilot-instructions.md,需 --copilot / -Copilot 显式启用) |
— |
安装细节:手动脚本 / Windows / 更新 / 卸载
Linux / macOS / Windows (Git Bash):
# 1. 克隆并进入仓库
git clone https://gitcode.com/agent0/kg-tools.git
cd kg-tools
# 2. 运行安装脚本
bash install.sh # 安装所有工具
bash install.sh ascend-kg # 仅安装 ascend-kg
# 卸载 / 更新
bash install.sh ascend-kg --uninstall # 卸载 ascend-kg
bash install.sh --update # 更新全部工具(git pull + 重装)
# 目录型安装(Claude Code / Hermes / OpenCode / OpenClaw)另有自动更新:每次会话首次触发
# ascend-kg skill 时检测远程仓库,有更新先征询用户确认,同意后拉取并重装(scripts/check_update.sh,
# 按安装位置自适应 Agent 旗标;保留 engine/state、domain_cache、案例 flow 等运行时数据)。
# 旧版安装(尚无 check_update.sh)时由 agent 手动执行同等检测,同样先确认再更新。
# 3. 按提示重启对应 Agent
Windows(CMD / PowerShell): 双击 install.bat 或在命令行调用,无需设置任何权限。
install.bat
install.bat ascend-kg
install.bat ascend-kg -Claude
install.bat ascend-kg -Copilot
install.bat ascend-kg -Uninstall
install.bat -Update
无参数安装全部;ascend-kg 仅装该插件;-Claude / -Copilot 限定目标 Agent;-Uninstall 卸载、-Update 更新。安装后按提示重启对应 Agent。
💡 除 GitHub Copilot 外,其余 Agent 自动检测安装:Cursor/Trae/Codex/Cline 检测仓库内对应目录/文件,OpenCode 检测全局配置
~/.config/opencode,OpenClaw 检测~/.openclaw,Hermes 检测~/.hermes。Copilot 因.github是通用目录,需显式传--copilot(bash)或-Copilot(Windows)。💡 Claude Code 用户:安装后验证
~/.claude/skills/ascend-kg/SKILL.md、~/.claude/agents/ascend-kg-worker.md、~/.claude/CLAUDE.md(含 ascend-kg 准则块)存在;重启后/agents应列出ascend-kg-worker,新会话直接提昇腾任务应自动触发 KG 检索(无需手动/ascend-kg)。 后续更新:cd kg-tools && git pull && bash install.sh --force,Claude Code 改完 agent/规则需/reload-plugins。
使用示例
安装后 skill 自动触发,Agent 会先检索 KG 再回答。以检索型问题为例:
你:/ascend-kg 帮我查一下 DataCopy 的 repeatTimes 参数?
Agent:已检索 KG(命中 score 0.94)→
返回参数签名、默认值与注意事项,附文档来源 id 供你核对。
以上为示意输出,实际以检索命中为准。Agent 的回答会附 KG 节点
id/ 来源,方便核验。其他 Agent(Cursor / Codex / Cline / 网页版):让已装 skill 的 Agent 执行「导出规则」命令,把提示词粘贴到目标 Agent 即可获得同样能力。
常见问题
需要本地 NPU / GPU 吗? 不需要。KG 是云端服务,只需网络连接。
测试 Key 和专属 Key 的区别? 测试 Key 共享 5 RPS,适合体验。专属 Key 独享配额,免费申请,推荐正式使用。
支持离线吗? 不支持。
项目结构
kg-tools/
├── README.md
├── README.en.md
└── skills/
└── ascend-kg/ # ascend-kg 工具目录(非 plugin,裸 skill + subagent)
├── SKILL.md # 技能正文(准则 + 决策路径 + API 速查 + Skill 路由 + §7 分层抗遗忘 + §8 编排引擎)
├── claude-memory.md # 注入 ~/.claude/CLAUDE.md 的准则块(始终加载的决策层)
├── agents/
│ └── ascend-kg-worker.md # subagent:自带准则 system prompt,抗上下文压缩
├── engine/ # 编排执行引擎(vLLM-Ascend 延迟优化闭环)
├── references/ # 引用资料(API 速查/代码检索/导出模板/首次接入)
├── experience/ # 经验沉淀(operator/inference/cases)
└── evals/evals.json
相关资源
- 工具集仓库:https://gitcode.com/agent0/kg-tools
- 知识图谱项目:ascend-knowledg-graph — 超 640 万节点 / 超 2000 万关系边 / 600+ Skill / 23 Plugin,覆盖昇腾 14 代码组 + 鲲鹏 8 代码组(数据来自 KG
/stats,统计于 2026-08-19,KG 持续刷新) - KG 服务:https://ascend.wiki
- API Key 申请:https://ascend.wiki/register
- 入门指南:昇腾知识图谱入门指南
贡献
欢迎提交 Issue 和 PR。