by FreePeak
LeanKG: Stop Burning Tokens. Start Coding Lean.
# Add to your Claude Code skills
git clone https://github.com/FreePeak/LeanKGLast scanned: 5/30/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-30T15:43:50.096Z",
"npmAuditRan": true,
"pipAuditRan": true
}See how LeanKG compares with popular alternatives.
LeanKG is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by FreePeak. LeanKG: Stop Burning Tokens. Start Coding Lean. It has 221 GitHub stars.
Yes. LeanKG passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/FreePeak/LeanKG" and add it to your Claude Code skills directory (see the Installation section above).
LeanKG is primarily written in Go. It is open-source under FreePeak on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh LeanKG against similar tools.
No comments yet. Be the first to share your thoughts!
30 days in the Featured rail · terms & refunds
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
Automated security scan — not a certification.
LeanKG is a code knowledge graph for AI coding agents, shipped as a single CGO-free Go binary
(github.com/FreePeak/LeanKG, root module — see pkg.go.dev).
Where agents usually rebuild structure with grep → open files → huge context, LeanKG returns a
targeted subgraph (callers, dependents, blast radius, tests, docs) plus a team layer (env,
services, incidents, requirements) over MCP. The Rust engine was removed at the parity cutover;
build with make go-build, test with make go-test. See docs/prd.md for the
parity ledger.
| Without | With LeanKG |
|---|---|
| Many tool calls, large context | Surgical subgraph + TOON (~40% smaller payloads) |
| No blast radius | Severity-graded impact |
| Keyword only | Keyword + HNSW semantic + ontology |
| Single-repo guesswork | Multi-repo index + ops tools |
# 1. Per project: one-shot index, then an incremental embed (sqlite default — zero config,
# store at .leankg/leankg.db). In a git repo root it reads the HEAD commit's objects, so
# uncommitted, untracked and ignored files are not indexed. Add --no-embed to skip the embed.
cd your-project
leankg index .
# 2. Wire up an AI client — one command (claude-code | cursor | codex | gemini | opencode | omp).
# The stdio entry is `serve --stdio --memory`: the agent gets the code graph AND the
# markdown memory layer (per-project at <project>/.leankg/memory), no second server.
leankg install --target claude-code # `connect claude-code` is the same writer
# Restart the client afterwards so it picks the entry up.
# 3. ...or serve MCP over HTTP yourself (endpoint /mcp; GET /health returns 200 when ready)
leankg serve --http 127.0.0.1:9699 --rest 127.0.0.1:8080 --memory
leankg install --target claude-code --http --url http://127.0.0.1:9699/mcp
Semantic (L3) search is the one optional layer: it needs embeddings. Set
LEANKG_EMBED_PROVIDER (see docs/embedding.md and
.env.example); leankg index then embeds incrementally after
indexing. Until an embed runs, queries answer from exact + fuzzy matches.
Self-check any deployment: leankg doctor — prints the store path, element and
file counts and the write watermark (exit 0 pass / 2 fail).
MCP over HTTP: the server resolves the project from its process cwd — run it
from the checkout or pass --project DIR to pin one.
None — sqlite is the default storage engine. No Postgres, no Docker.
Postgres remains available as an explicit opt-in (LEANKG_DB_ENGINE=postgres + LEANKG_PG_URL) for server-scale deployments, but nothing in the default flow touches it.
Published module — the engine is a Go module, so the toolchain installs both
binaries from pkg.go.dev straight into $(go env GOPATH)/bin:
go install github.com/FreePeak/LeanKG/cmd/leankg@latest # server + CLI
go install github.com/FreePeak/LeanKG/cmd/leankg-embed@latest # embedding pipeline
Prebuilt archives — releases
carry leankg-<os>-<arch>.tgz for linux/darwin × amd64/arm64, both binaries at the
archive root plus a .sha256. leankg update follows the same channel.
From a checkout — requires Go 1.25+ and git; installs to
~/.local/bin (pass a PREFIX to change it):
git clone https://github.com/FreePeak/LeanKG.git && cd LeanKG
scripts/install-go.sh # or: make install-go
# Or fetch and run the installer directly (clones over HTTPS, same behavior):
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install-go.sh | bash
Container — Dockerfile is a three-stage CGO-free build: engine binaries, then a demo graph baked from a slice of this repo, then an unprivileged runtime that serves that store read-only.
docker build -t leankg .
docker run --rm -p 8080:10000 -e PORT=10000 leankg # dashboard + its /api on :8080
Discover with query — it routes down the ladder by default (L1 exact → L2 keyword → L3 semantic; a natural-language question goes straight from an L1 miss to L3, which fuses keyword and vector ranks), degrades instead of erroring, and every answer carries retrieval{rung,reason} + freshness.
| Question | How |
|---|---|
| Any identifier (default) | query "Alpha" (exact, then fuzzy fallback) |
| Session start memory | query action=memory args.command=session_recall |
| Session end retain | import action=memory command=session_retain |
| Blast radius | leankg impact <file> or query --action impact --to <qn> |
| Who calls X? | query --action callers --to <qn> |
| How A↔B? | query --action path --to <qn> |
| Element details | query --action explain --to <qn> |
| Pattern search | query --action pattern --pattern "func $_(...)" |
| PRD traceability | leankg prd-trace FR-3T-01 |
| File (compressed) | query --action read --path src/main.go |
3 tools: import (index/PRD/memory/session/ontology/read) · query (ladder + graph verbs + actions) · status (inventory/freshness/config).
LEANKG_DB_ENGINE=postgres + LEANKG_PG_URL)query --action ontology, POST /api/v1/ontology/match, and req↔code traceability via leankg prd / prd-tracecontains, calls, imports edges; BFS blast radius (leankg impact):9699; LEANKG_PROJECT_DIRS serves many projects, selected per request by ?project=<dir|name> (REST and MCP) or the MCP project tool argument; with neither, a multi-project server refuses rather than answering from the wrong graph. sqlite default, PG opt-inquery --action env_conflicts, per-env snapshots, leankg obsidianquery --action service_context / incidents, leankg incident / note / team-mapleankg prd / prd-trace, query --action prd, ontology traceability matrixcd ui-v2 && npm run dev; the embedded build is served by leankg serve --ui)/health answers container probes, and --ui / --http / --rest / --rpc each bind their own addressSemantic (L3) search needs embeddings; see docs/embedding.md for providers (local / openai / deterministic), the EmbeddingGemma 2 + Hugging Face Storage Bucket bulk path, and the .env.example variable list. The catalog rows (model id, pinned revision, dimensions, prefixes) live in internal/embed/catalog.go.
.github/workflows/ci.yml, per-run numbers in the ttfv-go-cold artifact.scripts/quickstart_smoke.sh runs the same steps locally (QUICKSTART_DRY_RUN=1 prints the plan).