kg-tools
Give your AI agent real-time access to the Ascend knowledge graph (KG) and 600+ official Skills — operator development, model migration, performance tuning, and debugging, without guessing from model memory.
An AI model's training data can go stale. Ascend API parameters, configuration defaults, and error-code meanings — answering them "from memory" is guessing. kg-tools connects your AI agent to the Ascend knowledge graph, a real-time authoritative data source: 6.4M+ nodes, 20M+ relationship edges, 600+ executable Skills, and 23 Plugins, covering 14 Ascend source groups + 8 Kunpeng source groups, with cross-repo links, config mappings, and error-code→source maps — real engineering knowledge beyond your training data.
Built for Ascend / Kunpeng developers (operator development, model migration, performance tuning, inference deployment, debugging) and teams that want to equip their AI agents with Ascend capabilities.
✨ Features
| Type | Use case | What the agent does |
|---|---|---|
| 🔍 Retrieval · look up facts | API params/defaults, error-code→source map, precise code location, cross-repo impact | Answers in real time, with the KG node source |
| ⚙️ Execution · get work done | Operator dev, GPU→NPU migration, perf tuning, deployment, quantization | Runs 600+ official Skill workflows |
| 🤖 Orchestration engine · auto-tune | vLLM-Ascend / SGLang-NPU / MindIE latency & throughput optimization | Ten-stage closed loop, no manual step-by-step tuning |
🚀 Quick start (3 steps, ~60 seconds)
① Install into your AI agent
Method 1 (recommended, simplest) — send this line to your agent (Claude Code / Cursor / Codex / Cline, etc.); it will clone the repo and install itself:
Clone https://gitcode.com/agent0/kg-tools and install the ascend-kg skill. If gitcode is not reachable, ask me for an offline zip of kg-tools, extract it, and continue the install. Tell me which agent to restart when done.
Method 2 (manual):
git clone https://gitcode.com/agent0/kg-tools.git && cd kg-tools
bash install.sh ascend-kg # install ascend-kg only; no arg = install all
Supports 9 agents. See Supported agents for details.
② Configure the API key
export ASCEND_KG_API_KEY="your-key"
No key yet? Apply free at ascend.wiki/register, or try the built-in test key: kg-test-1489df447809de55e30251bf59bf2d6c. If the env var is unset, the agent will ask which key to use on first activation.
③ Ask a question
/ascend-kg help me look up the parameters of the ReduceSum interface
/ascend-kg help me write a LayerNorm operator
Supported agents
| Agent | Install method | Includes subagent |
|---|---|---|
| Claude Code | skill + subagent + CLAUDE.md rule block (~/.claude/skills/ascend-kg + ~/.claude/agents/ + ~/.claude/CLAUDE.md) |
✅ |
| Cursor | rules file (.cursor/rules/ascend-kg.mdc, alwaysApply: true) |
— |
| Trae | rules file (.trae/rules/ascend-kg.md, alwaysApply: true) |
— |
| Codex (OpenAI) | rules file (AGENTS.md) |
— |
| Hermes | global skill (~/.hermes/skills/ascend-kg/) + HERMES.md trigger pointer |
— |
| Cline | rules file (.clinerules) |
— |
| OpenCode | global skill (~/.config/opencode/skills/ascend-kg/) |
— |
| OpenClaw | global skill (~/.openclaw/skills/ascend-kg/) |
— |
| GitHub Copilot | rules file (.github/copilot-instructions.md, requires --copilot / -Copilot to enable) |
— |
Install details: manual scripts / Windows / update / uninstall
Linux / macOS / Windows (Git Bash):
# 1. Clone and enter the repo
git clone https://gitcode.com/agent0/kg-tools.git
cd kg-tools
# 2. Run the installer
bash install.sh # install all tools
bash install.sh ascend-kg # install ascend-kg only
# Uninstall / update
bash install.sh ascend-kg --uninstall # uninstall ascend-kg
bash install.sh --update # update all tools (git pull + reinstall)
# 3. Restart the target agent as prompted
Windows (CMD / PowerShell): double-click install.bat, or invoke it from the command line — no permissions to set.
install.bat
install.bat ascend-kg
install.bat ascend-kg -Claude
install.bat ascend-kg -Copilot
install.bat ascend-kg -Uninstall
install.bat -Update
No argument installs everything; ascend-kg installs only that plugin; -Claude / -Copilot restrict the target agent; -Uninstall removes, -Update updates. Restart the target agent after installing.
💡 Except GitHub Copilot, all agents are auto-detected: Cursor/Trae/Codex/Cline detect their directory/file in the repo, OpenCode detects the global config
~/.config/opencode, OpenClaw detects~/.openclaw, Hermes detects~/.hermes. Copilot is not auto-detected because.githubis a shared directory — pass--copilot(bash) or-Copilot(Windows) explicitly.💡 Claude Code users: after install, verify
~/.claude/skills/ascend-kg/SKILL.md,~/.claude/agents/ascend-kg-worker.md, and~/.claude/CLAUDE.md(with the ascend-kg rule block) exist; after restart,/agentsshould listascend-kg-worker, and a new session raising an Ascend task should auto-trigger KG retrieval (no manual/ascend-kgneeded). To update later:cd kg-tools && git pull && bash install.sh --force. For Claude Code, run/reload-pluginsafter changing agents/rules.
Usage example
After install, the skill triggers automatically and the agent searches the KG first. For a retrieval-type question:
You: /ascend-kg help me look up the DataCopy repeatTimes parameter
Agent: searched KG (score 0.94) →
returns the parameter signature, default value, and notes, with the source document id.
Sample output above; actual results depend on what the search hits. The agent's answer includes the KG node
id/ source for verification.Other agents (Cursor / Codex / Cline / web): have an agent with the skill installed run the "export rules" command, then paste the prompt into the target agent.
FAQ
Do I need a local NPU/GPU? No. The KG is a cloud service; you only need a network connection.
Test key vs. dedicated key? The test key is shared at 5 RPS, good for trying things out. A dedicated key has its own quota, free to apply for, and recommended for real use.
Does it work offline? No.
Project structure
kg-tools/
├── README.md
├── README.en.md
└── skills/
└── ascend-kg/ # ascend-kg tool directory (plain skill + subagent, not a plugin)
├── SKILL.md # skill body (rule + decision paths + API cheat sheet + Skill routing + §7 anti-forgetting + §8 engine)
├── claude-memory.md # rule block injected into ~/.claude/CLAUDE.md (always-loaded decision layer)
├── agents/
│ └── ascend-kg-worker.md # subagent: carries the rule in its system prompt, resilient to context compression
├── engine/ # orchestration engine (vLLM-Ascend latency-optimization loop)
├── references/ # reference material (API cheat sheet / code retrieval / export template / first access)
├── experience/ # accumulated experience (operator/inference/cases)
└── evals/evals.json
Resources
- Toolset repo: https://gitcode.com/agent0/kg-tools
- Knowledge graph project: ascend-knowledg-graph — 6.4M+ nodes / 20M+ relationship edges / 600+ Skills / 23 Plugins, covering 14 Ascend source groups + 8 Kunpeng source groups (data from KG
/stats, as of 2026-08-19; KG keeps refreshing) - KG service: https://ascend.wiki
- API key application: https://ascend.wiki/register
- Getting started: Ascend Knowledge Graph Getting Started
Contributing
Issues and PRs welcome.