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/kipill/KPKnowledgeGraphWrote 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/rules/kipill/kpknowledgegraph/cursor-kg)<a href="https://agentmods.dev/rules/kipill/kpknowledgegraph/cursor-kg"><img src="https://agentmods.dev/badge/rules/kipill/kpknowledgegraph/cursor-kg/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/rules/kipill/kpknowledgegraph/cursor-kg"><img src="https://agentmods.dev/badge/rules/kipill/kpknowledgegraph/cursor-kg.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.00759 | $0.00759 |
| Opus 5.5 | $0.00304 | $0.00304 |
| Sonnet 5.5 | $0.00152 | $0.00152 |
| Haiku 4.5 | $0.00076 | $0.00076 |
Grade A, and why
cursor-kg 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.
What it actually says
知识图谱(kg)使用约定
本项目装有 KPKnowledgeGraph——一个「先查图谱再读代码」的成长型知识索引。
图谱数据在 .claude/kg/,唯一出入口是 kg MCP 工具(server 名 kg)。
何时先查图谱(满足任一,动代码前)
- 新功能开发:「加一个 X」「实现 Y」
- 跨模块改动:涉及联动 / 同步 / 触发 / 跨服 / 通知
- 不熟悉的系统名,或重构 / 迁移某系统
小改动(改单个方法 / 调数值 / 加 log)、bug 排查、性能调优、纯问答 → 跳过。
怎么查
kg_query(query="关键词")直接搜——一次返回代码路径 / 踩坑 / 出边入边。- 无命中或可疑时
kg_catalog()拿全量轻量目录,用语义判断哪些 entry 相关, 再kg_get_entry(entry_id=...)取详情。字面无命中 ≠ 图谱没有。 - 造新行为的需求(「加个能做 Y 的功能」),先
kg_scout_reuse(requirement=...)做复用分诊:是配现成能力还是真要开发——转述给用户 + 给选项,等人拍板, 绝不自行采纳推荐就写代码。
写图谱(⚠ Cursor 无 hook 拦截,靠本约定自律)
- 禁止直接 Edit / Write
graph*.json/reverse_index.json/*.jsonl—— 它们只能经 kg MCP 写工具(自带 schema 校验 + changelog + 反向索引重建)。 绕过会破坏图谱一致性,且丢失 changelog。 entries/*.md深度文档可直接编辑,不受限。- 写工具:
kg_add_entry/kg_update_entry/kg_add_relation/kg_add_pitfall/kg_verify_edge/kg_add_capability_catalog/kg_add_capability_members。 每个写操作的reason参数要写清「哪个任务 / 发现了什么」。
任务完成后
- 对实际用过的每个 entry 调
kg_feedback(entry_id, accurate, note)(遥测,不改图谱, 无需问用户):路径直达 / 联动正确 →accurate=true;漂移 / 误导 →false并写明。 - 发现新踩坑 / 验证了 draft 边 / 新增了系统 → 建议用户更新图谱(不自动改), 同意后走对应 MCP 写工具。
- 图谱路径和实际代码对不上时:代码是 source of truth,顺手
kg_update_entry修正 (会强校验新路径真实存在)。
MCP 不可用时
查询可退化为直接 Read .claude/kg/graph*.json;写操作不许退化为直接编辑文件,
报告用户 MCP 异常。
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 · 46 lines · 759 tokens per session scan A 4cc5e976f5c7
cursor-kg is a cursor rule published in the GitHub repository kipill/KPKnowledgeGraph (9 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 759 tokens to every session, about $0.0030 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-08-31.
Other cursor rules, from other repositories
mempalace-recall-always
Always-on MemPalace recall — search the palace before answering about past work, people, projects, or prior decisions.
dreamd-recall
Search dreamd at the start of a task and quote a hit. Append when the user corrects you or states a decision.
session-memory
Use at conversation wrap-up or when the user explicitly indicates end-of-session — capture residual lessons not captured in-flight.
common_memory_bank
I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read…
self-improving-obsidian-llm-wiki
LLM Wiki OS operating rules.
memsprout
Cursor rule "memsprout" from memsprout/agents, covering using memsprout, search first, capturing, spaces and topics and files.