LoomGraph
Local code knowledge graph for AI agents. SQLite + sqlite-vec, AST-driven, no RAG framework needed. Designed as a Claude Code plugin and a CLI for any agent that needs precise structural code queries.
v0.18.0 ships fully local by default, including optional built-in semantic search (
pipx install "loomgraph[embed]"— local CPU model, zero services).pipx install loomgraphand go — no remote services, no API keys, no Docker.
Why LoomGraph
LLM agents are good at fuzzy natural-language code Q&A. They are bad at deterministic
structural queries — "every caller of authenticate() across this 200k-LoC codebase,
including indirect callers two hops deep." LoomGraph serves that class of queries
from a local graph.
- Deterministic graph queries —
find/graph/topology/impactwalk SQLite, not an LLM. Same input, same output — and the outputs tell you how much to trust them: every analysis carries aresolved_ratio(share of edges that actually resolved) and orphans are classified as truly-isolated vs unresolved-neighbor, so a resolution blind spot (dynamic dispatch, DI frameworks, path aliases) is visible instead of silently read as dead code. - AST is the source of truth — call/inherit/import edges come from tree-sitter via codeindex, not LLM inference.
- Single-file storage —
~/.loomgraph/<workspace>.db. No Postgres, no Docker, no fork of someone else's RAG framework. - Semantic search, zero or your-way — built-in local CodeRankEmbed (int8 ONNX,
MIT, auto-downloaded once) via the
[embed]extra, or bring Ollama / any OpenAI-compatible embeddings endpoint. The provider choice is sticky per workspace so embedding spaces never silently mix. - AI-Agent-shaped CLI — every command emits JSON; designed to be called by Claude Code or any agent harness.
Install
pipx install loomgraph
That's it. codeindex is pulled in automatically as the parser engine — no separate install, no direct operation. No additional services required for the structural commands.
Want zero-config semantic search too? Add the [embed] extra — a 137M code-specialized
embedding model (CodeRankEmbed, MIT, int8 ONNX, ~139MB) runs locally on CPU and
auto-downloads on first use:
pipx install "loomgraph[embed]"
The embedding provider is sticky per workspace: auto (default) probes a local
Ollama first and falls back to the built-in model; whichever wins is recorded in the
workspace, and later commands reuse the recorded choice — different models produce
incompatible vector spaces, and loomgraph refuses to mix them silently.
Multi-language repos — install the matching grammar extra
Python and PHP grammars ship by default. A pure TypeScript / JavaScript / Swift / Java / Objective-C repo indexes to 0 (or a few stray) entities unless you install the matching tree-sitter grammar — the parser skips files with a warning when the grammar is absent.
pipx install "loomgraph[typescript]" # TypeScript / TSX
pipx install "loomgraph[javascript]" # JavaScript / JSX
pipx install "loomgraph[swift]"
pipx install "loomgraph[java]"
pipx install "loomgraph[objc]" # Objective-C (.h / .m; .mm not supported)
Quotes are required —
[extra]is a shell glob in zsh/bash (no matches foundwithout them). Add several at once:pipx install "loomgraph[typescript,javascript]". Then ensure the languages are listed underlanguages:in.codeindex.yaml(the/loomgraph-setupskill generates this via codeindex's own wizard).
LLM code interpretation — codeindex --ai, not loomgraph
LoomGraph's index is pure AST (entities, relations, call graph) — no LLM, fully reproducible. If you want LLM-generated natural-language descriptions of modules/functions (richer README_AI.md, AI-completed docstrings), that's codeindex's own --ai mode, which is orthogonal to loomgraph:
# Requires ai_command in .codeindex.yaml (e.g. claude -p, deepseek, etc.)
codeindex scan . --ai # enrich README_AI.md via LLM
codeindex scan-all --ai # whole tree
- When you need it: unfamiliar large codebase where you want an LLM to narrate what each module does, or to fill in missing docstrings.
- When you don't: structural queries via loomgraph (
find/graph/topology/deps). The AST is ground truth there; LLM would only add latency and hallucination risk. - Relationship: loomgraph consumes codeindex's
graph-export(the structural AST output), never the--aienrichment. The two are independent —--aimakes codeindex's human-facing docs richer; loomgraph's graph stays structural either way.
Quick start
# Index a repo (uses codeindex under the hood for parsing)
loomgraph index .
# Structural search — fuzzy match on entity names
loomgraph find "UserService"
# Semantic search — by meaning, not name ([embed] extra or an embedding provider)
loomgraph search "where is authentication handled"
# Walk the call graph
loomgraph graph "UserService.login" --depth 2
# Topology smells (orphans, hubs, god functions) + resolution trust signal
loomgraph topology
# Change-impact analysis from a git diff
loomgraph impact HEAD --depth 2
# Cross-module dependency map
loomgraph deps
Every command outputs JSON to stdout (logs go to stderr) — pipe-friendly for agents.
Workspaces
A workspace is one indexed snapshot of a codebase, stored as a single
SQLite file at ~/.loomgraph/<workspace>.db. The name auto-derives from your
current directory and git branch:
<repo-dir>:<branch> # git repo, e.g. loomgraph:main
<repo-dir> # non-git fallback (lowercase)
So indexing the same repo on two branches gives two independent graphs —
querying feature-x won't see main's entities, and vice versa. You rarely
type a workspace name: loomgraph index . auto-detects it, and every query
command auto-targets the current branch's workspace. Override with --workspace.
loomgraph workspace list # what's indexed
loomgraph workspace info # current workspace details (auto-detected)
loomgraph workspace delete NAME --yes # remove a workspace (unlinks the .db)
If the current branch's workspace is empty (e.g. you're on a fresh branch that
was never indexed), query commands auto-fall-back to main → develop →
master so you still get results — index the current branch explicitly with
loomgraph index . when you want branch-specific data.
Configuration
LoomGraph reads .loomgraph.yaml from the current dir, then ~/.config/loomgraph/config.yaml.
Env vars (LOOMGRAPH_<SECTION>__<KEY>) override file values.
Minimal (fully local, no remote services)
storage:
backend: sqlite
db_path: "~/.loomgraph/{workspace}.db"
embedding:
enabled: false # turn on later for vec0 semantic search
Semantic search
Default provider: auto (v0.18+): a local Ollama is probed first; if absent, the
built-in model is used (and downloaded once). The choice is recorded per workspace
and reused — flipping providers mid-life would mix incompatible vector spaces, so
switching requires loomgraph index --clear ..
Built-in (zero-config, [embed] extra) — no config at all:
embedding:
enabled: true # provider: auto → builtin when Ollama is absent
Local Ollama:
# Install once: https://ollama.com
ollama pull nomic-embed-text
embedding:
enabled: true
provider: ollama
api_url: http://localhost:11434/v1
model: nomic-embed-text
dimension: 768
With OpenAI / Voyage / GLM (any OpenAI-compatible /v1/embeddings)
embedding:
enabled: true
provider: openai
api_url: https://api.openai.com/v1
api_key: sk-...
model: text-embedding-3-small
dimension: 1536
LLM provider (for overview summaries)
llm:
provider: glm # glm | openrouter | vllm
api_url: http://localhost:8000/v1
model: glm-4-flash
Most commands work without an LLM. Only loomgraph overview (module
summary mode) calls the LLM; --no-summary skips it entirely.
What's in the box
| Command | Purpose | Network calls |
|---|---|---|
loomgraph index <path> |
Index a repo | codeindex (local) + optional embedding |
loomgraph update |
Incremental from git diff | same |
loomgraph check |
Index freshness vs source files | none |
loomgraph find "<query>" |
Fuzzy entity search | none |
loomgraph search "<query>" |
Semantic search (by meaning) | embedding provider (or built-in) |
loomgraph graph "<entity>" |
Walk callers/callees | none |
loomgraph topology |
Orphans / hubs / god functions + resolved_ratio trust signal |
none |
loomgraph debt --with-git |
Multi-dimensional debt scoring | none (reads git log) |
loomgraph deps |
Module dependency graph | none |
loomgraph impact <ref> |
Deterministic change-impact | none |
loomgraph git-metrics |
Hotspots / bus-factor / churn | none (reads git log) |
loomgraph trends --entity X |
Code-rot trend prediction | none |
loomgraph overview |
Module summaries | LLM (or --no-summary) |
loomgraph workspace ... |
Multi-workspace management | none |
loomgraph compare / similar |
Cross-workspace diff / near-duplicates | none |
loomgraph embed-backfill |
Vectors for an un-embedded workspace | embedding provider |
loomgraph hooks |
Git hooks for auto-update on commit | none |
loomgraph codeindex <cmd> |
Run any codeindex command in loomgraph's pinned env | local |
loomgraph import-export <file> |
Ingest a codeindex graph-export NDJSON | none |
loomgraph mcp / install-skills / status |
Integration & diagnostics | none |
loomgraph setup-config is deprecated (v0.16+) — zero-config defaults made it redundant.
Claude Code integration
LoomGraph speaks MCP (Model Context Protocol) natively as of v0.12.0.
After pipx install loomgraph and one-time indexing (loomgraph index .):
loomgraph mcp install-config --path ~/.claude/mcp.json
Restart Claude Code. loomgraph_find / loomgraph_graph /
loomgraph_topology / loomgraph_impact / loomgraph_deps /
loomgraph_overview / loomgraph_workspace_* appear as native tools —
no subprocess overhead, no /skill-name invocation. Full reference:
docs/api/MCP_DESIGN.md.
Legacy skill commands (debt audit, sync advisor, evolution) still ship
via loomgraph install-skills for users who prefer the explicit-invoke
model.
Architecture (v0.11.0+)
codeindex (AST parse)
↓
loomgraph (map + persist)
↓
~/.loomgraph/<workspace>.db (SQLite + sqlite-vec, single file)
├── entities (functions / classes / modules)
├── relations (CALLS / INHERITS / IMPORTS / ...)
├── vec_node_descriptions (vec0, optional)
└── meta (workspace facts: embedding_provider, resolved_ratio)
↑
Claude Code / Codex / Cursor — read via CLI (JSON) or native MCP server
The full architecture rationale is in ADR-013. Chinese-language user-facing release notes live in customers/CHANGELOG.md.
Status
- v0.18.0 — Built-in zero-config embedding (
[embed]extra); trust-calculus propagation (resolved_ratio, orphan classification); single-author bus-factor suppression; test-pollution warnings - v0.17.x — MCP on mcp 2.0; graph-export fail-loud; codeindex 0.35 (Java fixes)
- v0.11.0 — Local-first rewrite: LightRAG / PostgreSQL removed, SQLite + sqlite-vec
600+ unit tests passing, ruff clean. Dogfood-benchmarked on loomgraph
(10.9k LoC, indexed in 0.88s) and codeindex (22.0k LoC, indexed in
0.93s) with sub-0.4s wall on every query — see
docs/benchmarks/dogfood.md for the full
numbers, including round-trip preservation of codeindex graph-export
artifacts (81-85% relation coverage vs direct index). Larger fixture
benchmarks (Django/FastAPI-scale) are still pending and are an honest
gap in the README's earlier claims. See CHANGELOG.md.
License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file loomgraph-0.19.0.tar.gz.
File metadata
- Download URL: loomgraph-0.19.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c159fde432362ab9b50969a8f4aa52c7bc0199668a9c7382ab737701d5cf26f8
|
|
| MD5 |
b9ea50bcf05dc5b843856e234c80daaf
|
|
| BLAKE2b-256 |
a386907d778b38bb65b95726bacce76db60ecc549f5892f9fcb0a3f99cb6d7d1
|
Provenance
The following attestation bundles were made for loomgraph-0.19.0.tar.gz:
Publisher:
release.yml on dreamlx/LoomGraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loomgraph-0.19.0.tar.gz -
Subject digest:
c159fde432362ab9b50969a8f4aa52c7bc0199668a9c7382ab737701d5cf26f8 - Sigstore transparency entry: 2496881224
- Sigstore integration time:
-
Permalink:
dreamlx/LoomGraph@d99cb88f71c14ff11e2485c76d1d63ba4470a11d -
Branch / Tag:
refs/tags/v0.19.0 - Owner: https://github.com/dreamlx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d99cb88f71c14ff11e2485c76d1d63ba4470a11d -
Trigger Event:
push
-
Statement type:
File details
Details for the file loomgraph-0.19.0-py3-none-any.whl.
File metadata
- Download URL: loomgraph-0.19.0-py3-none-any.whl
- Upload date:
- Size: 191.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cc0171833e832a414dc8db4afc67847d2cceeb71d2311483d8f01aca7a670ee
|
|
| MD5 |
4896445995a6ed4e5d2996430b1b97ec
|
|
| BLAKE2b-256 |
fc6faa44a4d997ffde97b17d4b5b32c6fb4fb9ac80b7b5680beb74fae0057050
|
Provenance
The following attestation bundles were made for loomgraph-0.19.0-py3-none-any.whl:
Publisher:
release.yml on dreamlx/LoomGraph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
loomgraph-0.19.0-py3-none-any.whl -
Subject digest:
7cc0171833e832a414dc8db4afc67847d2cceeb71d2311483d8f01aca7a670ee - Sigstore transparency entry: 2496881257
- Sigstore integration time:
-
Permalink:
dreamlx/LoomGraph@d99cb88f71c14ff11e2485c76d1d63ba4470a11d -
Branch / Tag:
refs/tags/v0.19.0 - Owner: https://github.com/dreamlx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d99cb88f71c14ff11e2485c76d1d63ba4470a11d -
Trigger Event:
push
-
Statement type: