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.
npx agentmods add rules/freepeak/leankg/leankg-graph-firstgit clone --depth 1 https://github.com/FreePeak/LeanKGWrote 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/freepeak/leankg/leankg-graph-first)<a href="https://agentmods.dev/rules/freepeak/leankg/leankg-graph-first"><img src="https://agentmods.dev/badge/rules/freepeak/leankg/leankg-graph-first.svg" alt="Measured on agentmods" 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 | $0.00522 | $0.00522 |
| Opus 5 | $0.00261 | $0.00261 |
| Sonnet 5 | $0.00104 | $0.00104 |
| Haiku 4.5 | $0.00052 | $0.00052 |
Grade A, and why
leankg-graph-first scanned grade A with 1 finding 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 5d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -sf --max-time 2 http://localhost:9699/health What it actually says
LeanKG Graph-First (HTTP-gated)
Gate (once per session)
curl -sf --max-time 2 http://localhost:9699/health
| Health | Mode |
|---|---|
| OK | LeanKG MCP with container project= (e.g. /workspace for Docker) |
| Fail / timeout | Grep / Glob / Read only — do not call LeanKG MCP |
Prefer-order (discover before connection verbs)
For fuzzy / natural-language / “where is X?” questions, discover first — do not open with query_graph.
1. get_overview_context(project=…) # session start
2. mcp_status(project=…)
3. concept_search → semantic_search → search_code / find_function
4. Connection verbs (only with known seeds / endpoints / symbols):
path → shortest_path | explain → explain_node | query → query_graph
5. get_context / get_impact_radius / get_dependencies / get_dependents
6. Fallback to Grep/Glob/Read only when LeanKG is down or returns empty
| Question type | First tools |
|---|---|
| Fuzzy / meaning / domain NL | concept_search → semantic_search → search_code |
| Exact symbol / file name | find_function / search_code / query_file |
| How A↔B? (known endpoints) | shortest_path |
| What is this known symbol? | explain_node |
| Expand subgraph after seeds | query_graph (after semantic/concept hits) |
BAN: Do not call query_graph as the first tool for NL discovery when embeddings/concepts may answer. Use semantic_search (and concept_search) first; then query_graph to expand the frontier.
Rules
- Do not pass host Mac paths as
project=against Docker MCP on:9699 - Do not grep for code navigation when LeanKG is healthy and returns hits
- Prefer
get_contextover reading entire source files when exploring indexed code - Hard-removed:
wake_up,search_by_environment,mcp_hello,mcp_impact,get_doc_for_file,find_clones
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.
- 5d ago First seen · 49 lines · 522 tokens per session scan A c89afb2ace9b
leankg-graph-first is a cursor rule published in the GitHub repository FreePeak/LeanKG (215 stars, last pushed 11d ago), licensed Apache-2.0. It adds 522 tokens to every session, about $0.0026 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
04-spatial-parser
Guidelines for Spatial RAG and Markdown parsing.
02-python-standards
Python coding standards, libraries, and concurrency safety.
session-memory
Use at conversation wrap-up or when the user explicitly indicates end-of-session — capture residual lessons not captured in-flight.
codebase
Forensic codebase brief for AI agents.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.