using-leankg

using-leankg is a skill for Claude Code, Cursor from FreePeak/LeanKG. It costs 43 tokens per session (1,278 once invoked), scanned A, original, Apache-2.0.

A code-search workflow that uses LeanKG, a local knowledge graph of a codebase, when its local service is available. If the service is unavailable, it uses ordinary file and text search instead.

In plain words
What is it for?
Use it before navigating code to search for files, functions, architecture, dependencies, and related code when LeanKG is healthy.
Why use it?
It provides a fast way to find relevant code while avoiding failed searches against an unavailable service.

Skill for Claude CodeCursor

Written for Cursor and Claude Code: a Cursor plugin manifest, but also shipped in a Claude Code plugin.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/.../leankg.

Part of the leankg plugin — 2 skills, 1 command, 1 agent, 2 hooks shipped together

Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add FreePeak/LeanKG
Claude Code
/plugin install leankg

Made for: Claude Code, Cursor.

Or install leankg, the plugin that ships this one along with the rest of its 2 skills, 1 command, 1 agent, 2 hooks.

Wrote 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.

agentmods badge for using-leankg

README.md
[![agentmods](https://agentmods.dev/badge/skills/freepeak/leankg/using-leankg.svg)](https://agentmods.dev/skills/freepeak/leankg/using-leankg)
Your own site
<a href="https://agentmods.dev/skills/freepeak/leankg/using-leankg"><img src="https://agentmods.dev/badge/skills/freepeak/leankg/using-leankg.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,278 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.01278
Opus 5 $0.00022 $0.00639
Sonnet 5 $0.00009 $0.00256
Haiku 4.5 $0.00004 $0.00128

Measured 7d ago against content hash 0b1b5c0d59c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

using-leankg 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 7d 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
.cursor-plugin/skills/using-leankg/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

LeanKG Code Search (HTTP-gated)

LeanKG is preferred when the MCP HTTP server is up. If health fails, exit this skill immediately and use default Cursor/editor tools.

Gate (ALWAYS FIRST)

curl -sf --max-time 2 http://localhost:9699/health
Result Next step
Success (2xx) Continue with LeanKG MCP below
Fail / timeout / connection refused Exit skill. Use Grep, Glob, Read. Do not call LeanKG MCP, mcp_init, or leankg CLI

Re-check health only if the user asks or you have reason to believe the server came back.


When HTTP is healthy: LeanKG MCP

Project path (Docker vs host)

When talking to Docker MCP on :9699, pass the container mount as project=:

Target project=
This LeanKG repo /workspace
Extra bind (compose override) /workspace-other (or the container side of the bind)

Do not pass a Mac host path (e.g. /Users/.../leankg) as project against Docker RocksDB.

Prefer-order (discover → exact)

Session start (overview):

get_overview_context(project=…)  # L0+L1 summary — not load_layer(L0) alone
→ optional load_layer for progressive budgets
→ get_architecture for deep single-call overview

Natural-language / domain questions (discover before query_graph):

1. mcp_status(project=…)
2. concept_search(query=…)     # domain concepts first
3. semantic_search(query=…)    # HNSW ANN if embeddings exist — REQUIRED before query_graph
4. search_code / find_function # name/type fallback
5. query_graph / explain_node / shortest_path  # only after seeds / known endpoints
6. get_context / get_impact_radius / get_dependencies / …
   on the returned qualified_name or file — never full-graph dumps

BAN: Do not call query_graph as the first NL discovery tool. Run concept_searchsemantic_search first; use query_graph to expand the frontier after hits.

Exact symbol / file known:

mcp_status → find_function / query_file → get_context → impact/deps tools

Read the full file on GitHub · 132 lines

Changes

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.

  1. 7d ago First seen · 132 lines · 43 tokens per session scan A 0b1b5c0d59c6

Subscribe to this mod's changes

using-leankg is a skill published in the GitHub repository FreePeak/LeanKG (216 stars, last pushed yesterday), licensed Apache-2.0. It adds 43 tokens to every session and 1,278 once invoked, about $0.0002 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.