usage

A set of tools for querying LeanKG, a knowledge graph that maps code elements and their relationships. It can help locate code and understand how files, functions, tests, and dependencies connect.

In plain words
What is it for?
Use it to find functions and files, inspect context, trace call chains and imports, check test coverage, and calculate a change's impact radius.
Why use it?
It reduces the need to search files manually and makes it easier to estimate what may be affected by a change.

Skill for Claude CodeCodex

Install

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.

agentmods
npx agentmods add skills/freepeak/leankg/usage
Any agent
npx skills add FreePeak/LeanKG --skill usage
Clone the repo
git clone --depth 1 https://github.com/FreePeak/LeanKG

Made for: Claude Code, Codex.

Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 374 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00027 $0.00374
Opus 5 $0.00014 $0.00187
Sonnet 5 $0.00005 $0.00075
Haiku 4.5 $0.00003 $0.00037

Measured 3d ago against content hash c8061aae09c2, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

usage 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 3d 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.

.claude-plugin/skills/usage/SKILL.md · 23 lines

What it actually says

Use LeanKG tools to explore and understand code:

  • mcp_status - Check if LeanKG is initialized
  • mcp_init - Initialize LeanKG for a project: mcp_init { path: "<project>/.leankg" }
  • mcp_index - Index a directory: mcp_index { path: "<project>/src" }
  • search_code - Find code elements: search_code { query: "<function_name>" }
  • find_function - Locate a function: find_function { name: "<name>" }
  • query_file - Find files: query_file { query: "<filename>" }
  • get_impact_radius - Calculate blast radius: get_impact_radius { file: "<path>", depth: <n> }
  • get_dependencies - Get imports: get_dependencies { file: "<path>" }
  • get_dependents - Get dependents: get_dependents { file: "<path>" }
  • get_context - Get file context: get_context { file: "<path>" }
  • get_call_graph - Get call chains: get_call_graph { file: "<path>" }
  • get_tested_by - Get test coverage: get_tested_by { file: "<path>" }

Rule: Use LeanKG first, before grep/ripgrep.

LeanKG auto-initializes on first use. If .leankg does not exist, it creates one automatically. If index is stale (>5 min since last git commit), it re-indexes automatically.

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. 3d ago First seen · 23 lines · 27 tokens per session scan A c8061aae09c2

Subscribe to this mod's changes

usage is a skill published in the GitHub repository FreePeak/LeanKG (215 stars, last pushed 9d ago), licensed Apache-2.0. It adds 27 tokens to every session and 374 once invoked, about $0.0001 per session on Opus 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-30.

Related

Other skills, from other repositories

omnigraph

Store, retrieve, and query knowledge, memory, and relationships in an Omnigraph graph, and operate a local or remote Omnigraph deployment. Use when the user wants to capture or recall facts, notes, or entities, build or query a knowledge graph or agent memory, or run Omnigraph — and whenever you see Omnigraph CLI…

ModernRelay/omnigraph · 236 tokens

adding-a-language

How a new language enters Kivgraph's graph - the two routes and why one of them is almost always wrong, the four decisions that cannot be migrated later, the branches that decide what your language is without asking, and the gates that fail closed. Use when adding or extending language support, when touching…

Luqueee/kivgraph · 90 tokens

running-tests

Cómo se ejecutan y se escriben los tests de Kivgraph - las tres suites, el tag ladybug que no se invoca a mano, qué se salta y por qué, y el smoke test del binario. Usar al correr tests, al añadirlos, ante un fallo de enlazado library 'lbug' not found, ante un SKIP inesperado, o antes de cerrar una tarea.

Luqueee/kivgraph · 94 tokens

publishing-releases

Cómo y sobre todo cuándo se publica una release de Kivgraph - la versión sólo sube, los tres sitios donde vive, qué verifica CI, y la lista de cambios que NO merecen release. Usar al proponer o preparar una release, al tocar internal/version/version.go, al crear un tag vX.Y.Z, o cuando alguien pida "saca una versión".

Luqueee/kivgraph · 85 tokens

rtg-knowledge-graph-mcp

Operate the Vellis RTG Knowledge Graph MCP server for agent-driven graph work. Use when an agent has RTG MCP tools such as rtgvalidategraph, rtgapplylivegraphchanges, rtgstageknowledgechanges, rtgapplymigrationcutover, rtgexecutequery, snapshots, or ledger replay, especially for schema evolution, validation recovery…

volantlabs/vellis · 87 tokens

documentation-sync

Keep human documentation synchronized with canonical SysML v2 models, generated component and application views, implementation realizations, repository tooling, skills, and workflow rules. Use after model, code, generated-view, README, AGENTS, skill, command, or public behavior changes.

volantlabs/vellis · 57 tokens