slurp
graphify builds the bowl. slurp serves exactly the noodles your LLM needs.
A knowledge graph is a bowl of ramen — thousands of nodes tangled together. Your LLM doesn't need the whole bowl. Slurp scores every node against your query, then greedily selects the highest-relevance subgraph that fits within your token budget — and tells you exactly what it picked and why. Works standalone or as a companion to graphify.
Counting tokens
slurp counts with tiktoken (cl100k_base), and --budget bounds that count on the
final output. Claude does not tokenize like tiktoken: measured in this project with
Anthropic's messages.count_tokens, Claude's count on slurp's output was about
1.56× the cl100k_base count. That is one measurement on one kind of text — an
estimate, not a guarantee. To budget in estimated Claude tokens, scale every count:
slurp "auth flow" --budget 4000 --token-factor 1.56 # or: export SLURP_TOKEN_FACTOR=1.56
Counts round up, so the output stays at or under the budget in the scaled unit, and
the header reports scaled tokens. For the MCP server, set it in .mcp.json:
"env": {"SLURP_TOKEN_FACTOR": "1.56"} — it is read on every call. The default is
1.0, which changes nothing.
Benchmark
Measured with slurp benchmark on a real PrismaStats codebase (graphify graph, 2,111
nodes). Both sides are the text that would be sent, counted with tiktoken: the subgraph
slurp prints for each query and budget, and the whole graph printed the same way —
117,828 tokens with the query's header and scores.
| Query | Budget 2k | Budget 4k | Budget 8k |
|---|---|---|---|
"auth flow" |
98.3% saved | 96.7% saved | 93.3% saved |
"prisma schema" |
98.3% saved | 96.7% saved | 93.3% saved |
"database pool" |
98.3% saved | 96.7% saved | 93.3% saved |
Mean savings: 96.1% · p50: 96.7% · Best case: 98.3% · Worst case: 93.3%
The output stays under the budget: 1,964–1,968 tokens at 2k, 3,926–3,928 at 4k, 7,841–7,847 at 8k
(re-measured for v1.2.0; the savings are unchanged).
On the same project's slurp index graph, slurp eval --retrieval finds 96.7% of the
labelled nodes of its 15 questions at --budget 4000 (86.7% in v1.1.1).
Before v1.1.0 these figures were not honest. The budget counted a short per-node summary and no relationships, so on this graph
--budget 8000printed 40,368–41,582 tokens while the benchmark reported 8,000; measured on the real text, savings at 2k/4k/8k were 86.1–87.4% / 72.7–75.7% / 59.5–60.6%, not the figures shown then.
Choosing a budget
The default, 4000, was checked against the alternatives with slurp eval --retrieval:
recall is the share of each question's labelled nodes inside the subgraph, and the
tokens are the measured text sent (mean per question). PrismaStats is its slurp index
graph (1,582 nodes, 15 built-in questions); slurp is its own graph (4,165 nodes, 16
questions labelled for this measurement by the same tool that tuned v1.2 — indicative,
not an independent ground truth). Measured for v1.2.0, v1.1.1 in brackets:
| Graph · format | 4000 | 6000 | 8000 | 12000 | 16000 |
|---|---|---|---|---|---|
| PrismaStats · markdown | 0.967 · 3,925 tok (0.867) | 0.967 · 5,885 (0.867) | 0.967 · 7,845 (0.867) | 0.967 · 11,764 (1.000) | 0.967 · 15,686 (1.000) |
| PrismaStats · JSON | 0.900 · 3,905 (0.589) | 0.967 · 5,866 (0.800) | 0.967 · 7,831 (0.867) | 0.967 · 11,745 (0.867) | 0.967 · 15,661 (0.867) |
| PrismaStats · YAML | 0.900 · 3,909 (0.800) | 0.967 · 5,862 (0.867) | 0.967 · 7,822 (0.867) | 0.967 · 11,738 (0.867) | 0.967 · 15,652 (0.933) |
| slurp · markdown | 0.875 · 3,925 (0.688) | 0.875 · 5,885 (0.688) | 0.938 · 7,843 (0.688) | 0.938 · 11,764 (0.688) | 1.000 · 15,685 (0.750) |
| slurp · JSON | 0.812 · 3,906 (0.562) | 0.875 · 5,874 (0.688) | 0.875 · 7,834 (0.688) | 0.875 · 11,745 (0.688) | 0.938 · 15,667 (0.688) |
| slurp · YAML | 0.875 · 3,909 (0.625) | 0.875 · 5,866 (0.688) | 0.875 · 7,824 (0.688) | 0.938 · 11,742 (0.688) | 0.938 · 15,658 (0.688) |
4000 stays the default: in markdown — what slurp QUERY prints by default and the only
format the MCP server sends — PrismaStats does not move from 4000 to 16000, and slurp
gains one question at 8000 and another at 16000. JSON and YAML spend more tokens per node
and catch up at 6000. Two things changed in v1.2: tests and import nodes no longer take
places (on slurp's own graph three nodes in four are tests), and a node lends its
neighbour boost to at most ten neighbours, so a hub's callers no longer fill the budget.
One node is lost on the way: PrismaStats's dashboard_actions module (question arch-02),
which v1.1.1 reached at 12000 only through the hundred callers of createAdminClient;
v1.2 finds the other module of that question from 4000 on.
The v1.2 changes were decided on half of each project's questions, drawn once with a
fixed seed, and checked on the other half: recall at 4000/8000 in markdown and JSON,
averaged, went from 0.812 to 1.000 (PrismaStats) and 0.750 to 1.000 (slurp) on the
tuning half, and from 0.780 to 0.893 and 0.562 to 0.750 on the held-out half.
scripts/retrieval.py reproduces every figure in this section, split included.
MRR does not depend on the budget. Its definition changed in v1.2: a relevant node's rank
now counts only the nodes slurp can return — tests and imports, left out of selection,
are left out of the ranking — because that is the order a reader meets them in. By the
old definition, ranking every node, the scores and the ranks are the same as in v1.1.1;
see slurp eval.
Performance
Latency of one slurp_query call through the MCP server's real handler (mcp._handle,
the function slurp serve runs for each request), timed with time.perf_counter, at
budget: 4000. Measured for v1.1.0 on an Apple M4, Python 3.12; three runs of each, the
range shown.
Original method (v0.7.0): the PrismaStats graphify graph (2,111 nodes, 3,421 edges),
ten queries — auth flow, prisma schema, database pool, player stats,
admin permissions, match events, dashboard data, chat context,
league standings, login logout — run once to warm the caches, then timed; the
figure is the mean of the ten. v0.7.0 recorded no script or query list, so the queries
are new; run the same way, the two releases around that change land close to the
figures published then.
| Version | Mean of 10 hot queries | Published then |
|---|---|---|
| v0.6.5 (before the caches and the heap) | 73–86 ms | 86.41 ms |
| v0.7.0 | 9.9–10.1 ms | 10.69 ms |
| v1.1.0 | 11.4–11.6 ms | — |
Current method (v1.1.0): caches cleared, then five queries three times (15 calls). Cold is the first call, which computes PageRank and costs every node it looks at; warm is the median and the maximum of the other fourteen.
| Graph | Cold | Warm median | Warm max |
|---|---|---|---|
| PrismaStats, graphify (2,111 nodes) | 65–71 ms | 11.2–11.7 ms | 21.8–22.7 ms |
PrismaStats, slurp index (1,796 nodes) |
80–83 ms | 10.4–10.7 ms | 14.2–14.5 ms |
slurp itself, slurp index (4,165 nodes) |
134–138 ms | 22.0–22.7 ms | 25.6–27.3 ms |
v1.1.0 is about 1.5 ms slower per hot query than v0.7.0 by the original method, and does more for it: the budget costs relationships as well as nodes, and the text it returns is rendered and counted before it is sent. The per-component timings v0.7.0 listed (PageRank, token counting, greedy selection) are not repeated: they were not re-measured, and the greedy one gave the same 10.69 ms as the whole query.
Reproduce these figures with scripts/latency.py, in a checkout of the repository
(the script is not shipped in the package). Each run is a fresh process, so caches start
empty:
uv run python scripts/latency.py path/to/graph.json --method both --runs 3
# Another release, on the same machine and graph:
git archive v0.7.0 slurp | tar -x -C /tmp/v070
uv run python scripts/latency.py path/to/graph.json --method original --src /tmp/v070
It prints one JSON line per run and a summary with the range of each figure. Re-run on
the same PrismaStats graph with v1.1.1: 11.35–11.55 ms by the original method, and
9.93–10.08 ms for v0.7.0 through --src.
PageRank cache — PageRank depends only on the graph, never on the query, so it is computed once per graph object instead of once per query.
Token count cache — the token cost of every node and relationship, as the formatter writes it, is memoised across queries, keyed by item, format and encoding. An item's text does not depend on the query (scores are costed at their widest), so neither does its cost.
Greedy heap — the subgraph selector used to scan every remaining candidate on
each iteration, which is O(n²). It now uses a lazy max-heap: scores still mutate
as neighbors get boosted, so a boost pushes a fresh entry and superseded entries
are discarded when they surface. Ties break by node id, which also makes the
selection deterministic — the previous scan broke ties by set iteration order,
so the same query could return a different subgraph on every process start.
Graph staleness — the MCP server records the graph file's mtime and reloads it
when it changes on disk, invalidating both caches. Before, a server started before
a re-index would keep answering from the graph it read at boot, with no way for the
client to know. Responses that triggered a reload carry "graph_reloaded": true.
Install
Quick reference:
| Situation | Command |
|---|---|
| Any project, fastest setup | uv tool install slurp-graph |
| Non-Python project (pipx user) | pipx install slurp-graph |
| Simple global install | pip install slurp-graph |
Python project (adds to pyproject.toml) |
uv add slurp-graph |
| Better TypeScript/TSX indexing | pip install "slurp-graph[ts]" |
slurp explain with OpenAI models |
pip install "slurp-graph[llm-openai]" |
Requires Python 3.12+. Don't have Python? Install uv — it bundles a Python runtime and is the fastest path.
Install uv (if you don't have Python yet):
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Then: uv tool install slurp-graph
Non-Python projects (JS, TypeScript, Go — install slurp globally so it's on your PATH):
uv tool install slurp-graph # recommended: isolated environment, no conflicts
pipx install slurp-graph # same idea if you already have pipx
pip install slurp-graph # works if Python's bin/Scripts dir is on your PATH
Windows:
pip installplacesslurp.exein Python'sScriptsfolder, which may not be on PATH by default. Ifslurpis not found after install, see adding Python Scripts to PATH, or useuv tool installinstead (it handles PATH automatically).
Python projects (adds slurp as a project dependency):
uv add slurp-graph
# or
pip install slurp-graph
When using
uv add, run slurp asuv run slurpor activate the virtual environment first. For the MCP server withuv add, see the note in MCP Integration.
PyPI package:
slurp-graph— CLI command:slurp
Check what you have with slurp --version.
📖 Full usage guide (automatic MCP mode + manual CLI): USAGE.md
Quickstart
New to slurp? Run slurp init in your project root — it detects your language, indexes your codebase, and configures the MCP server in one step.
slurp init
Then query it:
slurp "player stats" --graph graph.json --budget 4000
Real output with v1.2.0, on a 2,111-node graph of a Next.js codebase:
╭─ Slurp — Subgraph for: "player stats" (budget: 4,000 tokens) ╮
│ Selected 108/2111 nodes · 3,928/4,000 tokens used (5.1%) │
╰──────────────────────────────────────────────────────────────╯
## Relevant Nodes
### recalcularPlayerStats() · score: 0.91
→ File: lib/supabase/admin-actions.ts
### getPlayerStatsAdmin() · score: 0.91
→ File: lib/supabase/admin-actions.ts
### updatePlayerStatsAdmin() · score: 0.91
→ File: lib/supabase/admin-actions.ts
### PlayerStats · score: 0.91
→ File: types/database.ts
### PlayerStatsInsert · score: 0.91
→ File: types/database.ts
…
## Key Relationships
- admin_page_admindashboardpage → calls → supabase_admin_actions_getadminstats
- admin_page_admindashboardpage → calls → supabase_admin_actions_getultimosaccesos
- admin_page_admindashboardpage → calls → supabase_admin_actions_getusagestats
…
---
💡 1350 more nodes scored 0.15 or more but did not fit the budget — increase --budget to include them
💡 643 nodes scored below the minimum score 0.15 — a bigger budget will not include them (see --min-score)
💡 10 test nodes are left out by default — --include-tests to let them compete
The closing tip separates the reasons a node is missing: it did not fit the
budget (more budget brings it in), it scored below --min-score (no budget will),
or it is test code or an import node, left out by default (--include-tests and
--include-imports let them compete).
Nodes are ordered by relevance, and each carries the score that put it there.
A node's one-line description appears under its heading when the graph has
one — slurp index does not write descriptions, so the line is absent above.
Add --inject-code to embed the actual function body next to each node:
slurp "recalcularPlayerStats" --graph graphify-out/graph.json --budget 2000 --inject-code --min-score 0.8 --project-root .
### recalcularPlayerStats() · score: 0.91
→ File: lib/supabase/admin-actions.ts
```typescript
export async function recalcularPlayerStats(playerNombre: string, clubId: string, temporada: string) {
const adminClient = await createAdminClient();
// 1. Buscar jugador en players
const { data: player } = await adminClient
.from("players")
.select("id")
.eq("nombre", playerNombre)
.eq("club_id", clubId)
.eq("temporada", temporada)
.single();
...
}
```
… cut at 100 lines; the block continues at line 1240 of lib/supabase/admin-actions.ts
The language tag is inferred from the file path, so the block is fenced as
typescripthere without being told. Add--project-rootwhen the graph does not sit at the root of the source tree. A body is cut after 100 lines, and the line under the block says so and where the rest is:recalcularPlayerStatsis longer.
Pipe the output directly into your LLM prompt, save it to a file, or use slurp export to format it as a ready-to-paste system prompt block.
Commands
slurp init
Guided one-command setup. New to slurp? Run slurp init in your project root — it detects your language, indexes your codebase, and configures the MCP server in one step.
slurp init # from your project root — no flags needed
slurp init --yes # accept every prompt (CI / scripting)
It shows you a plan and asks for confirmation before touching anything:
- Detects the dominant language by counting
.py,.ts,.tsx,.js,.jsxand.gofiles, ignoring vendored trees likenode_modules/and.venv/inside the project (folders above the project root never count, so a project under~/code/build/indexes normally). - Indexes the project into
graphify-out/graph.jsonwith a live progress bar. If a graph already exists, it offers to reuse it instead of re-indexing. - Writes
.mcp.jsonpointing at the slurp binary it detected — works with bothuv tool installandpip installlayouts. An existing.mcp.jsonis never clobbered: slurp asks first, and other MCP servers in the file are preserved.
Finish by restarting your AI coding assistant to activate slurp.
| Flag | Default | Description |
|---|---|---|
--yes, -y |
off | Accept every confirmation prompt. Useful for CI and scripting. |
slurp QUERY
The main command. Scores all graph nodes against your query and selects the optimal subgraph within the token budget.
slurp "auth flow" --graph graph.json --budget 4000
slurp "payment processing" --format json
slurp "JWT validation" --explain
slurp "database schema" --inject-code --min-score 0.3
slurp "prisma models" --backend openai
| Flag | Default | Description |
|---|---|---|
--graph, -g |
auto-discover | Path to graph.json. Repeatable — see federation. |
--graph-label |
derived from path | Project name for each --graph, in the same order. |
--budget, -b |
4000 |
Upper bound, in tokens, on the text slurp prints — nodes, relationships, header and all, measured on the final output in the chosen format. If not even one node fits, the output is the header with the budget it would need. With --format json or yaml a node costs more, so use about 6000–8000 for the recall markdown gets at 4000 (see Choosing a budget). |
--format, -f |
markdown |
Output format: markdown, json, or yaml. |
--model, -m |
cl100k_base |
Tiktoken encoding for token counting. |
--explain |
off | Print per-node score breakdown: final / structural / semantic. |
--no-audit |
off | Skip writing to .slurp/audit.jsonl. |
--neighbor-decay |
0.7 |
Score multiplier applied to neighbors of each selected node — to at most 10 of them per node, the most relevant on their own, so a hub with a hundred callers does not lend its score to all of them. |
--min-score |
0.15 |
Minimum relevance score; nodes below this are excluded before selection. The same default applies to export, benchmark, eval, diff --budget, the MCP server and the library. On slurp index graphs every node is code and gets the +0.3 code boost, so 0.15 filters nothing there — the budget is the limit; on graphify graphs it keeps unrelated documents and concepts out. |
--token-factor |
1.0 |
Multiply every token count, for a reader that does not tokenize like tiktoken. Also $SLURP_TOKEN_FACTOR; the flag wins. See Counting tokens below. |
--viz |
off | Open an interactive graph visualization in the browser. |
--viz-output PATH |
— | Save visualization HTML to file (without opening browser). |
--ignore-file |
.slurpignore |
Path to node exclusion rules. |
--backend |
tfidf |
Scoring backend: tfidf (default) or openai (real embeddings). anthropic was retired in v1.0.7: Anthropic offers no embeddings endpoint. |
--inject-code |
off | Embed source code blocks for each selected node (requires ≤30 nodes). |
--project-root |
graph dir | Root directory for resolving source_file paths. |
--include-tests |
off | Let test code compete for a place in the subgraph. |
--include-imports |
off | Let import nodes compete for a place in the subgraph. |
Tests and imports are left out by default. Test code (anything under a tests/,
test/, __tests__/ or spec/ directory, or in a file a test runner collects — see
slurp explain) and the import nodes slurp index writes for every
import statement never take a place in the subgraph unless you pass --include-tests or
--include-imports. On slurp's own graph three nodes in four are tests: they carry the
name of what they test, outscored the code itself and filled the budget. They stay in the
graph — PageRank still counts the calls from tests, which measured better than dropping
them — and the closing tip says how many were left out. The same flags exist on
export, benchmark and eval, and as include_tests / include_imports on the MCP
tools slurp_query and slurp_suggest.
Auto-discovery (when --graph is omitted):
./graph.json./graphify-out/graph.json./.graphify/graph.json
Multi-graph federation
Query across multiple codebases simultaneously.
A system split across repos is still one system, but slurp normally sees one graph at
a time — a question about "auth flow" stops at the boundary of whichever repo you
pointed it at. Pass --graph more than once to merge them into a single queryable
graph:
slurp "auth flow" --graph prismastats/graphify-out/graph.json --graph slurp/graphify-out/graph.json
Real output with v1.2.0, federating two unrelated projects: PrismaStats, a Next.js app
(its graphify graph, 2,111 nodes), and slurp's own source at v1.2.0 (its slurp index
graph, 4,465 nodes). The top and the end of the answer:
Federated: 2 graphs · 6,576 nodes total
╭─ Slurp — Subgraph for: "auth flow" (budget: 4,000 tokens) ╮
│ Selected 79/6576 nodes · 3,923/4,000 tokens used (1.2%) │
╰───────────────────────────────────────────────────────────╯
## Relevant Nodes
### AuthResult · score: 0.71
→ File: lib/auth/actions.ts
### lib/auth/actions.ts · score: 0.70
→ File: AGENTS.md
### format_subgraph (function) · score: 0.50
→ File: slurp/formatter.py
…
## Key Relationships
- prismastats::favoritos_route_resolveclubid → calls → prismastats::supabase_admin_createadminclient
…
---
💡 2095 more nodes scored 0.15 or more but did not fit the budget — increase --budget to include them
💡 674 nodes scored below the minimum score 0.15 — a bigger budget will not include them (see --min-score)
💡 3374 test nodes and 354 import nodes are left out by default — --include-tests / --include-imports to let them compete
Node ids are namespaced automatically. Two projects can both define main or
load_graph without one silently overwriting the other — every id is prefixed with its
project, as prismastats::supabase_admin_createadminclient above. If any original ids
did appear in more than one graph, slurp says so in one line under the federation
header; these two graphs share none, so the output above has no such line.
Project names come from the graph paths by default. Since most projects keep their
graph at <project>/graphify-out/graph.json — where every file stem is just graph —
slurp walks up the path for a name that actually identifies the project. Override it
with --graph-label, one per --graph, in the same order:
slurp "auth flow" \
--graph services/auth/graphify-out/graph.json \
--graph services/api/graphify-out/graph.json \
--graph apps/web/graphify-out/graph.json \
--graph-label auth --graph-label api --graph-label frontend
The MCP server federates too, so your AI assistant can query every service at once
through the same slurp_query tool. Responses carry graphs_count when more than one
graph is being served:
slurp serve --graph services/auth/graph.json --graph services/api/graph.json
In --viz, federated nodes show a Project field in the detail panel, and the legend
gains a Projects section listing every project on screen.
One graph behaves exactly as before — no prefixes, no
_projectattribute, no federation header. Federation only engages from the second--graphonward.Merging does not invent edges between projects: if
apiimportsauth, that relationship exists in neithergraph.json, so slurp does not fabricate it. Each project stays internally connected, and neighbor expansion does not cross project boundaries.
slurp stats
Print node and edge counts for a graph file.
slurp stats --graph graph.json
Graph: graph.json
Nodes: 2111
Edges: 3421
slurp audit
Show the history of queries logged to .slurp/audit.jsonl, plus the most frequently selected nodes.
slurp audit
slurp audit --top-nodes 20
slurp audit --audit-dir /custom/.slurp
Real output with v1.2.0, after five queries at --budget 3000 on slurp's own graph
(budget selection, graph loader, mcp server, token counting, call graph extraction):
Query History (last 5 of 5)
┏━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━┓
┃ # ┃ Timestamp ┃ Query ┃ Nodes ┃ Tokens ┃
┡━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━┩
│ 1 │ 2026-11-25T20:23:50 │ budget selection │ 64 │ 2,935 │
│ 2 │ 2026-11-25T20:23:51 │ graph loader │ 64 │ 2,937 │
│ 3 │ 2026-11-25T20:23:51 │ mcp server │ 65 │ 2,937 │
│ 4 │ 2026-11-25T20:23:52 │ token counting │ 60 │ 2,945 │
│ 5 │ 2026-11-25T20:23:52 │ call graph extraction │ 66 │ 2,947 │
└──────┴─────────────────────┴───────────────────────┴───────┴────────┘
Top 10 Most Selected Nodes
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Rank ┃ Node ┃ Times Selected ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ 1 │ slurp.formatter.format_subgraph │ 5 │
│ 2 │ slurp.indexer._BaseVisitor._recurse │ 5 │
│ 3 │ slurp.loader.load_graph │ 5 │
│ 4 │ slurp.indexer._BaseVisitor.visit │ 5 │
│ 5 │ slurp.indexer.index_project │ 5 │
│ 6 │ slurp.diff.diff_graphs │ 5 │
│ 7 │ slurp.benchmark.run_benchmark │ 5 │
│ 8 │ slurp.loader.load_graph_neo4j │ 5 │
│ 9 │ slurp.scorer.score_nodes │ 4 │
│ 10 │ slurp.mcp._handle │ 4 │
└───────┴─────────────────────────────────────┴────────────────┘
Every query is appended as a JSON line (unless --no-audit is passed). Useful for tracking which parts of your codebase an AI agent visits most.
There is no savings column: savings are what slurp benchmark
measures — the whole graph printed the same way and counted — and the log does not
hold that measurement. Until v1.1.0 the column guessed it from the node count.
slurp advisor
Recommends the optimal token budget based on your query history.
Guessing at --budget costs you either way: too low truncates the answer, too high pays
for nodes the LLM never reads. Once .slurp/audit.jsonl holds a few dozen entries, the
right number is already in your data — the advisor finds the past queries that resemble
the new one and reads the budget off what they actually used.
slurp advisor "budget selection" --graph graph.json
slurp advisor "auth flow" --graph graph.json
Real output with v1.2.0 on slurp's own graph, after the five queries of the slurp audit
example and budget selection heap at --budget 1500, 2500, 4000 and 6000:
╭────────────────────────────── Budget Advisor — "budget selection" ───────────────────────────────╮
│ Based on 5 similar past queries │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Recommended budget: 3,928 tokens
Expected coverage: 93.4% of similar queries' selections
Estimated cost: $0.0118 (claude-sonnet-5)
Confidence: MEDIUM (5 similar queries)
Similar past queries:
"budget selection" → 2,935 tokens · 64 nodes
"budget selection heap" → 1,469 tokens · 35 nodes
"budget selection heap" → 2,454 tokens · 52 nodes
"budget selection heap" → 3,928 tokens · 85 nodes
"budget selection heap" → 5,884 tokens · 119 nodes
Run with recommended budget:
slurp "budget selection" --graph graph.json --budget 3928
And on PrismaStats, after twelve queries at --budget 3000 — auth flow alone and
followed by callback, cookie, guard, jwt, login, logout, middleware,
redirect, session, signup and token:
╭────────────────────────────────── Budget Advisor — "auth flow" ──────────────────────────────────╮
│ Based on 12 similar past queries │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Recommended budget: 2,948 tokens
Expected coverage: 100.0% of similar queries' selections
Estimated cost: $0.0088 (claude-sonnet-5)
Confidence: HIGH (12 similar queries)
Similar past queries:
"auth flow" → 2,947 tokens · 73 nodes
"auth flow callback" → 2,941 tokens · 72 nodes
"auth flow cookie" → 2,948 tokens · 71 nodes
"auth flow guard" → 2,948 tokens · 71 nodes
"auth flow jwt" → 2,947 tokens · 73 nodes
… and 7 more
Run with recommended budget:
slurp "auth flow" --graph graph.json --budget 2948
| Flag | Default | Description |
|---|---|---|
--graph, -g |
auto-discovered | Path to graph.json, used in the suggested command line. |
--audit-dir |
.slurp |
Directory containing audit.jsonl. |
--price-model |
claude-sonnet-5 |
Pricing model for the cost estimate (same models as slurp benchmark). |
--min-similar |
3 |
Similar queries needed before a recommendation is considered confident. |
How it works. Past queries are tokenized with the same tokenizer used to score nodes —
so authFlow, auth_flow and auth flow are one ask — and compared by TF-IDF cosine
similarity. Anything at or above 0.3 counts as similar. The recommended budget is the
75th percentile of what those queries actually consumed: it fits three out of four
comparable queries, where the mean would under-serve the heavier half and the max would
pay for one outlier every time.
| Confidence | Meaning |
|---|---|
HIGH |
10+ similar queries |
MEDIUM |
at least --min-similar (default 3) |
LOW |
fewer than --min-similar — still recommends, with a warning |
NONE |
no similar history — falls back to the 4,000-token default |
The advisor shows what each similar query used — tokens and nodes, both recorded when it ran — and no savings: the audit log does not hold the full-graph measurement that
slurp benchmarkcompares against. Until v1.1.0 it estimated one from the node count.
slurp explain
Explains any node in natural language — what it does, its architecture, and the risk of
changing it. With --no-llm, or whenever no provider is configured, it answers from the
graph alone: an architectural role inferred from the node's position, its immediate
neighbourhood, the share of the project that depends on it, and two or three commands
that continue the investigation. No API key, no network.
slurp explain "recalcularPlayerStats" --graph graph.json --no-llm
Real output with v1.2.0 on PrismaStats's graphify graph:
╭──────────────────────────── slurp explain — recalcularPlayerStats() ─────────────────────────────╮
│ code · lib/supabase/admin-actions.ts · score: 0.910 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
EXPLANATION
recalcularPlayerStats() is a code node defined in lib/supabase/admin-actions.ts:1140. Leaf — focused, with a small surface. It is called by 3 places in the project, chiefly deleteMatchEventAdmin(), insertMatchEventAdmin(), insertSubstitutionEventAdmin(). It depends on createAdminClient(). Relevance to your query: 0.910.
CONTEXT
Part of: admin-actions.ts
Used by: deleteMatchEventAdmin(), insertMatchEventAdmin(), insertSubstitutionEventAdmin()
Depends on: createAdminClient()
ARCHITECTURE
→ Called by: deleteMatchEventAdmin(), insertMatchEventAdmin(),
insertSubstitutionEventAdmin()
← Calls: createAdminClient()
RISK IF CHANGED: MEDIUM
3 production callers — 0.1% of the project.
Check each caller before changing the signature.
EXPLORE FURTHER
slurp "recalcularPlayerStats admin-actions.ts" — the surrounding context
slurp explain 'deleteMatchEventAdmin' — its most connected caller
─────────────────────────────────────────────────────────────────────
Provider: structural · Context: 439 tokens
With an LLM — slurp explain "recalcularPlayerStats" --graph graph.json and a
provider configured (see below) — the model writes the prose under EXPLANATION and
nothing else: CONTEXT, ARCHITECTURE, RISK and EXPLORE FURTHER are the ones above, and
the last line names the provider and model instead of structural.
The role is read off the graph: more than ten callers make a central utility, many
callers with few dependencies a shared utility, callers and callees both high an
orchestrator, none of either isolated. Callers that live in test files are counted
separately, so a helper exercised by sixty tests and two modules is not reported as having
sixty-two dependants. A test file is one a test runner would collect: anything under a
tests/, test/, __tests__/ or spec/ directory (or a .NET *.Tests project), a file
named like test_*.py, *_test.go, *.spec.ts or *Test.java, and Rust's
mod tests; latest_results.py is not one.
The risk band counts production callers only — the same rule slurp impact and
slurp diff use, so the three always agree. Tests get their own line under
ARCHITECTURE (→ Tested by: 72 tests in 9 files) and in the risk summary
(10 production callers, 72 in tests). A node that only tests call is LOW but never
called safe: No production callers · 12 tests call it — update them if you change its behaviour. A free-text slurp explain never lands on a test or an import node; name
one exactly and you get it.
| Flag | Default | Description |
|---|---|---|
--graph, -g |
auto-discovered | Path to graph.json. |
--provider |
auto-detected | anthropic, openai, ollama, or openai-compatible. |
--model, -m |
per-provider default | Model name. |
--endpoint |
— | Base URL for the openai-compatible provider. |
--no-llm |
off | Skip the LLM and show the structural analysis only. |
--hops |
2 |
Neighbourhood radius used to build the explanation context. |
--config-dir |
.slurp |
Directory holding config.json. |
Providers. With no --provider, slurp auto-detects in this order:
| Provider | Detected via | Default model | Notes |
|---|---|---|---|
anthropic |
ANTHROPIC_API_KEY |
claude-sonnet-5 |
Needs pip install anthropic. |
openai |
OPENAI_API_KEY |
gpt-4o-mini |
Needs the llm-openai extra: pip install "slurp-graph[llm-openai]". |
ollama |
server answering on localhost:11434 |
llama3.2 |
Fully local, no API key. |
openai-compatible |
SLURP_LLM_ENDPOINT (+ optional SLURP_LLM_API_KEY) |
local-model |
LM Studio, Together, Groq, vLLM, anything speaking the OpenAI API. |
If none are present, slurp uses the structural explanation — a deterministic description built from the graph alone. It is always produced first, so a missing SDK, an absent API key, or an unreachable endpoint degrades to it rather than failing.
Real output with v1.2.0, with nothing listening on the endpoint:
╭──────────────────────────── slurp explain — recalcularPlayerStats() ─────────────────────────────╮
│ code · lib/supabase/admin-actions.ts · score: 0.910 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
EXPLANATION
recalcularPlayerStats() is a code node defined in lib/supabase/admin-actions.ts:1140. Leaf — focused, with a small surface. It is called by 3 places in the project, chiefly deleteMatchEventAdmin(), insertMatchEventAdmin(), insertSubstitutionEventAdmin(). It depends on createAdminClient(). Relevance to your query: 0.910.
CONTEXT
Part of: admin-actions.ts
Used by: deleteMatchEventAdmin(), insertMatchEventAdmin(), insertSubstitutionEventAdmin()
Depends on: createAdminClient()
ARCHITECTURE
→ Called by: deleteMatchEventAdmin(), insertMatchEventAdmin(),
insertSubstitutionEventAdmin()
← Calls: createAdminClient()
RISK IF CHANGED: MEDIUM
3 production callers — 0.1% of the project.
Check each caller before changing the signature.
EXPLORE FURTHER
slurp "recalcularPlayerStats admin-actions.ts" — the surrounding context
slurp explain 'deleteMatchEventAdmin' — its most connected caller
─────────────────────────────────────────────────────────────────────
Provider: structural · Context: 439 tokens
Note: openai-compatible unavailable (Could not reach http://localhost:1234/v1/chat/completions: [Errno 61] Connection refused); showed structural analysis
Force it with --no-llm to get an offline, zero-cost explanation.
Architecture and risk are always computed from the graph, never written by the model. The LLM contributes only the prose under
EXPLANATION; callers, callees, and blast radius are facts slurp already has, so the model is explicitly told not to restate them.
The risk is only as good as the graph's call edges.
slurp indexextracts them, across files, for Python, TypeScript/JavaScript, Go, Java and Rust — on PrismaStats'sslurp indexgraphcreateAdminClienthas 97 production callers and readsHIGH— and the other eleven languages readUNKNOWN, notLOW. One gap: a React component rendered as JSX (<Badge />) gets nocallsedge, so most components readLOWin aslurp indexgraph (530 of 536 in PrismaStats's.tsxfiles, imports and tests aside); PrismaStats's graphify graph givesBadge()16 dependants.
slurp config
Saves LLM settings to .slurp/config.json so you don't pass flags every time.
slurp config set provider openai-compatible
slurp config set model qwen2.5-coder
slurp config set endpoint http://localhost:1234/v1
slurp config set api_key sk-... # stored, never echoed back
slurp config show
slurp config — .slurp/config.json
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Key ┃ Value ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ api_key │ ******** │
│ endpoint │ http://localhost:1234/v1 │
│ model │ qwen2.5-coder │
│ provider │ openai-compatible │
└──────────┴──────────────────────────┘
Effective provider: openai-compatible
Effective model: qwen2.5-coder
Effective endpoint: http://localhost:1234/v1
Keys: provider, model, endpoint, api_key, temperature. Precedence is flags →
saved config → environment auto-detection, so an explicit flag is never overridden by a
stored preference. slurp config show prints both what is saved and what slurp would
actually use right now.
api_keyis masked in all output but stored in plain text in.slurp/config.json, written with permissions 0600. Likeslurp init,slurp config setadds.slurp/to an existing.gitignorethat does not mention it yet; it never creates one, and a rule you wrote — including!.slurp/— is left alone. Without a.gitignore, keep.slurp/out of version control yourself, or leave the key in an environment variable instead.
slurp diff
Know exactly what changed — and what it affects.
A git diff tells you which lines moved. It cannot tell you that the helper you
just renamed is called from eleven other modules, or that the function you deleted
was the only caller keeping a service alive. slurp diff compares two versions of
your knowledge graph and reports the blast radius: what changed, what sits
downstream of it, and which nodes are central enough that a reviewer should look
at them by hand.
The workflow: before you merge
Index both sides of the change and diff them:
git checkout main && slurp index . --output main.json
git checkout feature/auth-refactor && slurp index . --output feature.json
slurp diff main.json feature.json --viz
The --viz flag opens an interactive graph where the change is colour-coded:
green for added nodes, red for removed, yellow for modified, and
grey for untouched neighbors that are still connected to the change. You can
see at a glance whether your refactor touched one isolated corner or pulled on a
thread running through half the codebase.
Text output
Without --viz you get a Markdown impact report — pipe it into a PR description,
a review checklist, or your AI assistant:
# Slurp Diff — Impact Analysis
## Summary
- **✅ Low impact change**
- **Impact score:** 0.1184 (🟢 low) — 1 production caller reached
- 14 tests in 8 files touch the change
- 1 nodes added · 1 removed · 0 modified
- 2 edges added · 17 removed
- 3 nodes in risk neighborhood
## Added Nodes (1)
### choose_subgraph (function)
→ File: slurp/budget.py
## Removed Nodes (1)
### slurp.budget.select_subgraph
## Affected Edges
**Added (2):**
- slurp.budget → contains → slurp.budget.choose_subgraph
- slurp.budget.choose_subgraph → calls → slurp.budget.build_context
**Removed (17):**
- slurp.budget → slurp.budget.select_subgraph
- slurp.budget.select_subgraph → slurp.budget.build_context
- slurp.mcp._handle_suggest → slurp.budget.select_subgraph
- tests.test_audit.TestAuditIntegration.test_pipeline_log_then_read → slurp.budget.select_subgraph
- tests.test_audit.TestAuditIntegration.test_pipeline_multiple_queries_top_nodes → slurp.budget.select_subgraph
- …
## Nodes at Risk
Direct neighbors of changed nodes:
- build_context (function) · centrality: 0.0057
- budget (module) · centrality: 0.0031
- _handle_suggest (function) · centrality: 0.0012
## What to review
Most connected nodes in the blast radius — review these first:
1. load_graph (function) · centrality: 0.0126 · slurp/loader.py
2. diff_graphs (function) · centrality: 0.0107 · slurp/diff.py
3. score_nodes (function) · centrality: 0.0103 · slurp/scorer.py
4. cli (module) · centrality: 0.0092 · slurp/cli.py
5. format_subgraph (function) · centrality: 0.0090 · slurp/formatter.py
The change above renames
select_subgraphin slurp v1.1.0 without touching its callers: seventeen edges go — fourteen from tests, one from the module that contains it, one its own call tobuild_context— so one production caller is left broken (mcp._handle_suggest) and the score is low. Until v1.0.7 the same kind of rename scored 0.0048 whatever it broke: the score was a share of the whole graph. Since v1.1.0 it counts callers — see below. The risk neighbourhood is read from the old graph where the deleted function still exists (until v1.1.1 it was looked up in the new graph and listed none of its callers), and since v1.2 it holds production code only: the fourteen tests get one line in the summary, and neither they nor import nodes appear among the nodes at risk or to review (v1.1.1 listed 17 at risk,_runnerfirst to review).
The run finishes with a colour-coded summary panel and, if you did not pass
--viz, the exact command to see the full picture:
╭───────────────────────────────────────── Impact Summary ─────────────────────────────────────────╮
│ │
│ ✅ Low impact change (impact score 0.1184) │
│ │
│ +1 added -1 removed ~0 modified │
│ │
│ See the full blast radius: │
│ slurp diff old.json new.json --viz │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Flags
slurp diff old.json new.json
slurp diff old.json new.json --hops 2 --viz
slurp diff old.json new.json --budget 4000
slurp diff old.json new.json --viz-output reports/impact.html
| Flag | Default | Description |
|---|---|---|
--hops |
2 |
Depth of impact neighborhood expansion. |
--viz |
off | Open an interactive visualizer of the affected area in the browser. |
--viz-output PATH |
— | Save visualization HTML to file (without opening browser). |
--budget, -b |
none | Token budget; selects the most relevant nodes from the affected area. |
Impact score counts what could break: the distinct production callers of every
deleted node, and of every node whose label, type or outgoing calls changed
(tests, containing modules and import nodes do not count, and adding or dropping an
import is not a change in what a node calls). It is 1 − e^(−D/k), with the scale
and bands derived from the same thresholds slurp impact and slurp explain use,
so the three always agree: 6+ callers is high, 2–5 medium, 0–1 low. Deleting a
function with 97 callers scores 1.00 (high); adding an uncalled one scores 0. If a
changed node is in a language with no call graph, a low score is reported as
unknown instead, with the reason, and the report lists the callers it counted. --hops controls how far the
blast radius is traced; --budget narrows the affected area down to what fits a
token budget, so you can hand exactly the relevant slice to a reviewer or an LLM.
This is the only tool that shows you the blast radius of your code changes before you merge.
slurp export
Export a context block ready to paste into an AI system prompt.
slurp export "auth flow" --format claude # <context> XML tags
slurp export "auth flow" --format chatgpt # [CODEBASE CONTEXT] block
slurp export "auth flow" --format claudemd # ## Codebase Context for CLAUDE.md
slurp export "auth flow" --output context.md
All three formats include query, nodes selected/total, tokens used/budget, and coverage %.
slurp serve
Start an MCP stdio server (JSON-RPC 2.0) exposing five tools — slurp_query,
slurp_explain, slurp_diff, slurp_suggest and slurp_impact.
slurp serve --graph graph.json
slurp serve --graph graph.json --no-log
| Flag | Default | Description |
|---|---|---|
--graph, -g |
auto-discover | Path to graph.json. Repeatable — see federation. |
--graph-label |
derived from path | Project name for each --graph, in the same order. |
--log / --no-log |
--log |
Append served queries to .slurp/session.log (only if .slurp/ exists). |
See MCP Integration for configuration.
slurp impact
Analyzes the blast radius of editing a file before making changes — no second snapshot
needed. Where slurp diff answers this after the fact by comparing two
graphs, slurp impact answers it beforehand from the graph you already have.
slurp impact lib/supabase/admin.ts --graph graph.json
Real output with v1.2.1 on PrismaStats's graphify graph, complete — the list stops at ten
files by design and counts the rest. AGENTS.md and all_tsx_exports.txt are text files:
graphify's graph attributes three component nodes to each, and slurp lists the files the
graph gives:
╭─ Impact Analysis — lib/supabase/admin.ts ─────╮
│ 2 definitions · RISK: HIGH · affects 69 files │
╰───────────────────────────────────────────────╯
HIGHEST RISK NODE
createAdminClient() — 130 production dependents (6.2% of codebase)
AFFECTED FILES (top 10)
lib/supabase/admin-actions.ts 31 dependents
lib/supabase/cantera-actions.ts 14 dependents
lib/supabase/dashboard-actions.ts 11 dependents
lib/supabase/reports-actions.ts 8 dependents
app/api/mis-partidos/route.ts 6 dependents
…entrenamientos/favoritos/route.ts 5 dependents
AGENTS.md 3 dependents
all_tsx_exports.txt 3 dependents
app/admin/configuracion/actions.ts 3 dependents
app/admin/clubes/page.tsx 2 dependents
… and 59 more files
RECOMMENDATION
Add integration tests before editing. 130 nodes depend on functions in this file.
─────────────────────────────────────────────────────────────────────
Direct: 130 · Transitive: 48 · Tests: 0 · Impact score: 0.0843
The risk, the dependents and the affected files count production code only, as in
slurp explain and slurp diff. The risk is rated on the direct dependents; the affected
files are every file holding a dependent within --hops, direct or transitive, and the
headline, the AFFECTED FILES list and affected_files in --output json count the same
ones; each file's count (dependents_per_file in JSON) adds both kinds. Tests that call
into the file get their own block — TESTS — 58 tests in 10 files call into this file,
with the files that hold most — and import nodes are not counted as definitions. A
SAFE TO EDIT block lists the definitions in the file that nothing calls at all, not
even a test — the other half of the question. A node only tests call is listed under
NO PRODUCTION CALLERS instead: LOW, but its tests break if it changes. A node called
only from inside the same file is in neither: contained is not the same as safe.
--output json carries safe_nodes, test_only_nodes, test_dependents and
test_files.
Risk is UNKNOWN when the file's language has no call graph. slurp extracts calls
for Python, TypeScript/JavaScript, Go, Java and Rust; the other eleven languages get
definitions and imports only, so zero callers there means "not in the graph", not
"nobody calls it". slurp impact then reports RISK: UNKNOWN with the reason, lists
nothing as safe, and --output json carries "risk_level": "UNKNOWN" plus a
risk_reason — gate on it as you would on HIGH. A graph whose calls edges cover
that language (graphify extracts them for any language) is rated as usual. slurp explain and the MCP tools slurp_impact and slurp_explain say the same.
| Flag | Default | Description |
|---|---|---|
--hops |
2 |
How far to follow dependants outward. |
--output |
text |
json emits the full result for CI gating on risk_level. |
--viz / --viz-output |
off | Interactive view of the affected nodes only. |
The path is matched on a normalised suffix, so slurp impact admin.ts finds
lib/supabase/admin.ts without you having to know how the indexer spelled its paths. An
exact match always wins over a suffix. A file with no nodes in the graph is answered, not
refused: it reports that nothing was found and suggests re-indexing if the file is new.
Also exposed over MCP as
slurp_impact(file_path, hops=2)— the tool an agent should reach for before editing anything.
--suggest
Suggests related queries to explore after a query — drill down, sibling exploration, and high-risk dependency detection. It reads the nodes that sat just outside the token budget: connected enough to be neighbours, not relevant enough to be selected, which is exactly the shape of something you have not looked at yet.
slurp "player stats" --graph graph.json --budget 4000 --suggest
The end of the output, real, with v1.2.0 on PrismaStats's graphify graph:
SUGGESTED QUERIES
slurp "recalcularPlayerStats page route" — drill down into what surrounds recalcularPlayerStats
slurp "page props client" — explore the connected area the budget left out
slurp explain 'Badge' — high-risk dependency — 16 nodes depend on it
Three kinds of suggestion, each fired only when the graph supports it:
| Kind | Fires when | Reads as |
|---|---|---|
| Drill down | the subgraph's most relevant node has neighbours that were left out | drill down into what surrounds recalcularPlayerStats |
| Sibling exploration | a themed cluster sits on the frontier | explore the connected area the budget left out |
| Risk exploration | a frontier node has six or more dependants | high-risk dependency — 16 nodes depend on it |
| Flag | Default | Description |
|---|---|---|
--suggest |
off | Append suggestions to the normal output. |
--n, --suggest-n |
3 |
How many suggestions to show. |
Query text is built from the tokens that set the frontier apart from the rest of the graph, weighted by how rare each one is graph-wide — a term common inside the frontier and uncommon outside it wins. Import placeholders are excluded: they carry the name of what they import, so they describe wiring rather than subject matter. A suggestion that says nothing the original query did not is dropped, and when the budget already covers the neighbourhood the list is simply empty.
The same graph and query always give the same suggestions. The risk suggestion names the
frontier node with the most dependants; on a tie, a definition comes before the file node
that holds it (Badge before badge.tsx above, 16 each), then the smallest node id.
Until v1.2.0 a tie went to whichever node a set happened to yield first, which changed
from one process to the next.
Also exposed over MCP as
slurp_suggest(query, budget=4000), so an agent can ask what else is worth looking at without a second round trip through the terminal.
slurp session
Shows queries processed by the MCP server in real time.
slurp session --last 10
slurp session --tail
| Flag | Default | Description |
|---|---|---|
--last N |
20 |
Number of most recent entries to show. |
--tail |
off | Follow the log in real time (Ctrl+C to stop). |
--log-dir PATH |
.slurp |
Directory containing session.log. |
Real output with v1.2.0, after an MCP client sent two slurp_query calls to
slurp serve --graph graph.json on slurp's own graph — auth flow at budget 4000 and
mcp server at 2000:
MCP Session Log — last 2 (.slurp/session.log)
┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━┓
┃ Time ┃ Query ┃ Budget ┃ Nodes ┃ Tokens ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━┩
│ 2026-11-25T20:24:09 │ auth flow │ 4,000 │ 83 │ 3,925 │
│ 2026-11-25T20:24:09 │ mcp server │ 2,000 │ 43 │ 1,967 │
└─────────────────────┴────────────┴────────┴───────┴────────┘
No savings column, and no savings_pct in the log since v1.1.0: measuring the whole
graph the way slurp benchmark does costs 70–700 ms per call,
against 4–7 ms for the query, so the server does not do it. Older logs keep their
savings_pct field, an estimate from the node count; it is not shown.
Use it to confirm your AI assistant is actually calling slurp. The log is written
only when .slurp/ already exists — running any query manually creates it, and
slurp serve --no-log turns logging off entirely.
slurp benchmark
Measure real token savings across queries and budgets.
slurp benchmark \
--graph graph.json \
--queries "auth flow" --queries "schema validation" \
--budget 2000 --budget 4000 --budget 8000
# Windows CMD: remove the backslashes and write on one line
Benchmark Results — pricing: default ($3/MTok input)
┏━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Query ┃ Budget ┃ Tokens used ┃ Full graph ┃ Savings ┃ Cost (slurp) ┃ Cost (full) ┃ Nodes sel. ┃ Nodes total ┃ Coverage ┃
┡━━━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ select subgraph │ 2,000 │ 1,949 │ 318,075 │ 99.4% │ $0.0058 │ $0.9542 │ 69 │ 4013 │ 1.7% │
└─────────────────┴────────┴─────────────┴────────────┴─────────┴──────────────┴─────────────┴────────────┴─────────────┴──────────┘
Summary
┏━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Metric ┃ Value ┃
┡━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
│ Mean savings │ 99.4% │
│ p50 savings │ 99.4% │
│ p90 savings │ 99.4% │
│ p95 savings │ 99.4% │
│ Best case │ 99.4% ('select subgraph', budget 2,000) │
│ Worst case │ 99.4% ('select subgraph', budget 2,000) │
│ Cost with slurp │ $0.0058 │
│ Cost without slurp │ $0.9542 │
│ Money saved │ $0.9484 (99.4%) │
└────────────────────┴─────────────────────────────────────────┘
Retrieval quality is not measured here: see `slurp eval --retrieval`.
One query at one budget, run against slurp's own graph (4,013 nodes) with v1.1.0.
Outputs a per-run table and aggregate stats: mean savings, p50/p90/p95, best/worst case.
Both sides are measured the same way since v1.1.0: Tokens used is the text slurp
prints for that query and budget, and Full graph is the whole graph printed by the
same formatter with the same header — so Savings compares two texts produced alike.
The former Precision column is gone: it compared the selection with the scorer's own
notion of a relevant node, which measures nothing; use slurp eval --retrieval for
recall and MRR against labelled nodes.
slurp eval
Measures response quality with and without slurp context, using an LLM judge.
slurp benchmark measures how many tokens the selector saves. It says nothing about
whether the answer is still correct. slurp eval closes that loop: each question is
answered twice — once from a budgeted subgraph, once from the entire graph — and an LLM
judge scores both against a known ground truth.
slurp eval --graph graph.json --budget 4000 --provider anthropic
slurp eval --graph graph.json --questions my-questions.json --output results.json
slurp eval --dry-run # list the questions, call no LLM
slurp eval --retrieval # recall + MRR of relevant_nodes — no LLM, no cost, reproducible
slurp eval --retrieval --format json # same, budgeted and measured as JSON
Real run with v0.9.5 against a 1,796-node Next.js codebase, 15 questions, budget 4,000 (before v1.1.0, so the slurp context was larger than the budget — see the note below):
slurp win rate: 46.7% (7/15)
Mean score with slurp: 0.770
Mean score baseline: 0.784
Token savings: 79.9%
Quality/token slurp: 0.000061
Quality/token baseline: 0.000012
The honest conclusion: slurp does not improve quality when the model has unlimited context. With the whole 62,810-token graph in the prompt, a large-context model finds the answer on its own — the baseline scored marginally higher (0.784 vs 0.770).
What slurp improves is efficiency, radically: 5× more quality per token, at 12,865 tokens per question instead of 62,810. And it improves quality when the budget is restrictive or the graph is too large to fit at all — which is the case slurp exists for.
Per-question, slurp won the multi-hop flow questions ("what is the full call chain from…") and lost the whole-graph aggregation ones ("which files concentrate the most functions") — exactly what pruning to a subgraph would predict.
| Flag | Default | Description |
|---|---|---|
--graph, -g |
auto-discovered | Path to graph.json. |
--budget, -b |
4000 |
Token budget for the slurp context. |
--questions |
built-in set | JSON file of questions (list, or {"questions": [...]}). |
--provider |
auto-detected | LLM provider — same four as slurp explain. |
--output, -o |
— | Write full results, including both answers, as JSON. |
--dry-run |
off | List the questions and exit without calling any LLM. |
--retrieval |
off | No LLM: for each question, the share of its relevant_nodes inside the selected subgraph (recall) and 1/rank of the best one by score (MRR). Same selection settings as slurp QUERY; questions whose nodes are not in the graph are reported, not scored. Each question also reports the measured tokens of the text it would send. |
--min-score |
0.15 |
Minimum score for --retrieval (the shared default). |
--format, -f |
markdown |
Format the --retrieval subgraph is budgeted and measured in (markdown, json, yaml). Refused without --retrieval: the LLM eval sends markdown. |
--include-tests, --include-imports |
off | Let tests / import nodes compete, as in slurp QUERY. |
MRR counts the nodes slurp can return. Since v1.2 the rank of a relevant node is its
position among the nodes selection may pick — tests and import nodes left out unless let
in — because that is the order a reader meets them in. The rank over every node, the
definition until v1.1.1, is reported beside it (mrr_all, first_rank_all, and a second
figure in the panel when they differ). A relevant node that is itself a test or an import
cannot be found with the defaults: it scores recall 0 and no rank.
Each question costs three LLM calls (answer with slurp, answer from the full graph, judge). The built-in set of 15 questions is therefore 45 calls; budget accordingly. The baseline context is built once and reused across questions.
In that v0.9.5 run,
--budgetcapped the node selection, not the rendered prompt: budget 4,000 produced a 12,865-token context. Since v1.1.0 the budget bounds the text sent, so the same command sends at most 4,000 tokens per question; the run has not been repeated since.
slurp index
Index the project's source code and generate graph.json without graphify or any LLM.
slurp index . # index current directory
slurp index /path/to/project # specific path
slurp index . --output custom/graph.json # custom output path
slurp index . --watch # re-index on file changes
slurp index . --smart # only re-index what changed
slurp index . --force # replace a graph another tool wrote
The default output,
graphify-out/graph.json, is also where graphify writes its own graph. If that file exists and was not written by slurp,slurp indexasks before replacing it (the default answer is no, and a non-interactive run never overwrites). Keep both with-o graphify-out/slurp-graph.json, or replace it with--force.slurp initasks the same question if you decline to reuse graphify's graph.
Real output, v1.2.0 on PrismaStats (the graph the retrieval figures use; the paths are placeholders):
Indexing /path/to/prismastats ...
✓ 1582 nodes · 1852 edges · 185 files
Parsers: Python (ast) · TypeScript (tree-sitter)
Saved: /path/to/prismastats/graphify-out/graph.json
Next: slurp "your query" --graph /path/to/prismastats/graphify-out/graph.json
What is never indexed. Dependencies, caches and build output, wherever they sit
below the project root: node_modules/, .venv/, venv/, vendor/, _vendor/,
dist/, build/, coverage/, .git/, the Python caches and *.egg-info/, minified
*.min.js bundles, and the build output of web frameworks — .next/ (Next.js),
.nuxt/ (Nuxt), .svelte-kit/ (SvelteKit), .turbo/ (Turborepo), .vercel/
(Vercel CLI) and .output/ (Nitro: Nuxt 3, SolidStart). An out/ folder is skipped
only when it holds a Next.js static export (an out/_next/ directory); otherwise it may
be real code and is indexed. Folders above the project root never count. To leave out
anything else, use .slurpignore.
Call graph — five languages (Python, TypeScript/JavaScript, Go, Java, Rust):
slurp indexextractscallsedges between functions, within a file and across them, enabling accurate risk analysis inslurp explainand impact propagation inslurp diff.
Python TypeScript / JavaScript Go Java Rust Direct calls helper()helper()helper()(same package)helper()helper()Own methods self.m(),cls.m()this.m()p.m()on the receiverthis.m()self.m()in animplInherited methods ✅ base class in the same file ✅ tree-sitter only — ✅ incl. super.m()✅ traits impld in the fileConstructors ClassName()new ClassName()&Struct{},Struct{}new ClassName()Type::new()Typed local variable x = ClassName()const x = new C(),const x: C = …x := &S{},var x SC x = …(declared)let x: T,let x = T {…}Static calls — — — ClassName.method()Type::assoc(),Self::assoc()Fields — — — ✅ declared type, incl. @Autowired✅ declared type Parameters — — — — ✅ declared type Cross-file ✅ ✅ ✅ ✅ ✅ Parser stdlib asttree-sitter, with a regex fallback regex tree-sitter, with a regex fallback tree-sitter, with a regex fallback Return type propagation:
srv := NewServer()followed bysrv.Start()now generates a call edge for Go, Rust, Java and TypeScript. The return type must be declared and must name a type defined in the project — an inferred TypeScript return, or one naming a third-party type, still emits nothing.Anything that cannot be resolved with certainty emits no edge — stdlib and third-party calls, a method on an object of unknown type, a chained or computed callee. A missing edge is a gap; a wrong edge is a lie about the codebase, so ambiguity always resolves to silence. Both endpoints of every
callsedge are guaranteed to be nodes that exist in the graph.Cross-file calls resolved in all five languages — an imported symbol followed by a call generates a direct
callsedge to the real definition, not a dead end at the import placeholder. Resolution runs after every file is indexed, so it sees the whole project.
- Python:
from X import ffollowed byf(), plusimport X as m+m.f().- TypeScript/JavaScript: named, namespace, default and aliased imports resolved.
type-only imports ignored.@/aliases and barrel exports supported.- Java: import statements resolved to their target class. Static imports and wildcard imports with unique candidates supported.
- Rust:
use crate::,use super::, and{A, B, C}multi-symbol imports resolved. Glob imports with unique candidates supported.- Go: package imports resolved by directory matching. Explicit and automatic aliases supported. Dot imports with unique candidates.
package mainexcluded from the index.An import only resolves when its module is part of the project. That single rule is what keeps
from pathlib import Pathfrom binding to a local class of the same name, andimport { useState } from 'react'from binding to a localreact.ts.Go methods are nested under their receiver, so a method's node id is
pkg.Struct.Method. A package is a directory, not a file, soauth.Login()is answered by every file inauth/, andpackage mainis excluded from the index because it is never importable. A local variable typed by a struct literal or avardeclaration resolves.Java declares every variable and field type, so nothing has to be inferred from an initialiser — a field resolves whenever its declared type is a class this file can name, which is what makes dependency-injected collaborators navigable. Method parameters are not yet read, and inheritance does not cross files: a method inherited from a base class in another file resolves to nothing.
Rust methods live in
implblocks, not in thestruct, so a method's node id ismodule.Type.methodand everyimpl Typeblock — includingimpl Trait for Type— contributes to the same type. Theselfreceiver (self,&self,&mut self) resolves to the enclosingimpl,Self::andType::to an associated function, and a trait's default method resolves throughimpl Trait for Typewhen the trait is declared in the same file. Types are declared in Rust — parameters, struct fields andletannotations — so nothing is inferred from an initialiser;Type::new()also resolves through a return type declared asSelf.Two things are deliberately silent. Macros never produce an edge, including the calls written inside them:
println!,vec!andformat!are macro invocations, and evenassert_eq!(build(), 1)yields nothing, because a macro body is an opaque token tree whose contents are not parsed as code. External traits are ignored —to_string(),clone()andinto()resolve to nothing, as does any receiver whose type is not declared in the file. A barehelper()never resolves to a method either: Rust has no implicit receiver, so insideimpl Gatewaya baresubmit()is a free function, notself.submit.A return type only propagates within one file.
srv := NewServer()resolves whenNewServeris declared in the same file as the call. A constructor imported from elsewhere does not carry its type across, sosrv.Start()emits nothing there. An explicit type — avardeclaration, alet x: Tannotation, a parameter or a field — always resolves, cross-file included. Rust is the one place a wrapper is deliberately not unwrapped:Option<Engine>is an Option, ande.run()on it does not compile, so binding through it would invent an edge the compiler rejects. Go's(T, error)is destructured at the assignment, so it binds.Without the
tsextra, TypeScript falls back to regex, which blanks comments and string literals before scanning and resolves everything above except methods inherited from a base class. Without thejavaextra, Java falls back to regex, which resolves everything above, including static imports across files. Without therustextra, Rust falls back to regex, which also resolves everything above: across 600 files from crates.io the two branches agree exactly on 589 of them. Every regex fallback is anchored on declaration lines, so two declarations sharing a single line leave the second one unseen. The remaining 11 languages still emitcontainsandimports_fromonly.
| Flag | Default | Description |
|---|---|---|
--output, -o |
<path>/graphify-out/graph.json |
Output path for graph.json. |
--watch |
off | Re-index on file changes (requires watchdog, installed by default). |
--smart |
off | Incremental re-index — re-parses only the files changed since the graph was built; runs a full index when a file or symbol is added, removed or renamed. |
--dry-run |
off | Show what --smart would re-index without making changes. |
--ignore-file |
.slurpignore |
Path to .slurpignore rules. |
--force |
off | Overwrite the output even if another tool (e.g. graphify) wrote it. With --smart, a foreign graph is replaced by a full index, never merged into. |
Incremental re-indexing with --smart
Re-parsing every file after a two-line edit is wasted work. slurp index records the
commit each graph was built from (built_at_commit); --smart asks git what changed
since that commit — committed, staged, unstaged and untracked — adds any file modified
after the graph was written, and re-parses only those files.
slurp index . --smart
Real output with v1.2.0 on a git checkout of slurp's own source, after a comment was
added inside fit_to_budget in slurp/budget.py:
Indexing /path/to/slurp (smart mode) ...
→ Detected 1 changed file since the graph was built
✓ Updated 32 nodes · 54 edges in 0.1s
Full index would take: ~0.3s (2× faster)
Saved: /path/to/slurp/graphify-out/graph.json
Next: slurp "your query" --graph /path/to/slurp/graphify-out/graph.json
The result is always the graph a full index would build. Cross-file call resolution reads symbols from every file, so an edit that adds, removes or renames a file or a definition — or changes a file's imports — can change how other files resolve their calls. Those edits run a full index instead, and say why:
Real output with v1.2.0, after a new function was appended to the same file:
Indexing /path/to/slurp (smart mode) ...
→ Detected 1 changed file since the graph was built
Full index needed: definitions or imports changed, which can change how other files resolve their calls
Indexing /path/to/slurp ...
✓ 4466 nodes · 9249 edges · 53 files
Parsers: Python (ast)
Saved: /path/to/slurp/graphify-out/graph.json
Next: slurp "your query" --graph /path/to/slurp/graphify-out/graph.json
Edits inside function bodies — the common case — stay incremental: in the first run
above, re-parsing budget.py took 0.1s where a full index would take about 0.3s. A
graph written before v1.0.7 has no recorded commit and is rebuilt once.
--dry-run lists the files it would touch and exits without writing:
slurp index . --smart --dry-run
It also falls back to a full index when there is no git repository or no existing graph to update.
Supported languages
| Language | Parser |
|---|---|
| Python | stdlib ast |
| TypeScript / JavaScript | tree-sitter |
| Java | tree-sitter |
| Rust | tree-sitter |
| C# | tree-sitter |
| Ruby | tree-sitter |
| PHP | tree-sitter |
| Kotlin | tree-sitter ⚠️ |
| Scala | tree-sitter |
| Swift | tree-sitter |
| C | tree-sitter |
| C++ | tree-sitter |
| Go | regex |
| Lua | regex |
| Elixir | regex |
| PowerShell | regex |
⚠️ Kotlin: the
tree-sitter-kotlingrammar has known parsing issues — it fails on a class with a body followed by anobjectdeclaration, which is ordinary Kotlin. Slurp detects the broken parse tree and the regex fallback is active in practice. The extra is still declared so a fixed grammar release takes effect without a code change.
Every tree-sitter language falls back to a regex parser when its grammar is not
installed. The fallback extracts strictly less — it cannot nest inner classes or
reach into method bodies — so slurp index always prints which parser it used.
Real output, v1.2.0 on PrismaStats without the ts extra (with it, the same
project indexes to 1582 nodes and 1852 edges):
✓ 1521 nodes · 1562 edges · 185 files
Parsers: Python (ast) · TypeScript (regex fallback)
Install the 'ts' extra for full TypeScript support: uv sync --extra ts
Python needs no extra (it uses the standard library). Go, Lua, Elixir and PowerShell are indexed by regex as their primary parser — no grammar is wired up for them, so their regex parser is the design rather than a degradation and is never reported as a fallback.
Optional extras
| Extra | Languages | Install |
|---|---|---|
ts |
TypeScript, JavaScript | uv sync --extra ts |
java |
Java | uv sync --extra java |
rust |
Rust | uv sync --extra rust |
csharp |
C# | uv sync --extra csharp |
ruby |
Ruby | uv sync --extra ruby |
php |
PHP | uv sync --extra php |
kotlin |
Kotlin | uv sync --extra kotlin |
scala |
Scala | uv sync --extra scala |
swift |
Swift | uv sync --extra swift |
cpp |
C, C++ | uv sync --extra cpp |
all-languages |
All of the above | uv sync --extra all-languages |
Each language records what matters for navigating that ecosystem: Java and C#
annotations/attributes (@Service, [HttpGet]) plus access modifiers, Rust
lifetimes and pub visibility, Ruby class methods and accessors, PHP magic
methods (__get, __call), Kotlin data/sealed/suspend and extension
receivers, Scala case classes and implicit, Swift computed properties and
async. Relationships become typed edges — extends, implements (including
Rust's impl Trait for Type), with (Scala), conforms_to (Swift), and
mixin for Ruby's include/extend/prepend and PHP's trait use, Elixir's
use/import/alias/require, and PowerShell's requires.
Broken-grammar guard. A tree-sitter grammar that returns a parse tree
containing ERROR nodes silently drops whole declarations. Slurp checks for that
after every parse and treats it as a parser failure: it warns on stderr and falls
back to regex, which extracts less per declaration but does not lose most of the
file.
After indexing, the full query pipeline works as usual:
slurp "auth flow" --graph graphify-out/graph.json --budget 4000
Works with graphify
Slurp is the query layer for graphify. Run graphify on your codebase, point slurp at the output.
graphify . # generates graphify-out/graph.json
slurp "auth flow" --budget 4000 # auto-discovers graphify-out/graph.json
Supported node fields:
{
"id": "authenticate_user",
"label": "authenticate_user",
"type": "function",
"description": "Validates credentials and returns JWT.",
"importance": 9,
"source_file": "src/auth/service.py",
"source_location": "L42"
}
The type, description, importance, source_file, and source_location fields are optional but improve scoring and enable --inject-code. Any graph with id + label on nodes and source/target on edges will work.
Both links (graphify/NetworkX serialization) and edges are supported. Additional formats are auto-detected by extension:
| Extension | Format |
|---|---|
.json |
graphify or generic JSON |
.graphml |
GraphML (NetworkX / yEd / Gephi) |
.csv |
Neo4j export (nodes CSV + sibling relationships CSV) |
Use slurp convert or the convert_graph() API to export between formats.
MCP Integration
Run slurp as an MCP server so Claude Code (or any MCP-compatible agent) can query the graph directly.
.mcp.json — for global installs (uv tool install, pipx, pip):
{
"mcpServers": {
"slurp": {
"command": "slurp",
"args": ["serve", "--graph", "/absolute/path/to/graphify-out/graph.json"]
}
}
}
.mcp.json — if you installed with uv add inside a Python project:
{
"mcpServers": {
"slurp": {
"command": "uv",
"args": ["run", "slurp", "serve", "--graph", "graphify-out/graph.json"]
}
}
}
Windows: Use forward slashes or escaped backslashes in the graph path:
"C:/Users/you/project/graphify-out/graph.json". Ifslurpisn't found, replace"command": "slurp"with the full path — find it withwhere slurp(CMD) orGet-Command slurp | Select-Object Source(PowerShell).
Five tools exposed. Claude Code calls them automatically, each answering a different
question. The server runs over stdio and returns formatted markdown — no HTTP, no ports.
slurp_query always answers in markdown, with budget 4000 unless the client asks for
another; see Choosing a budget.
| Tool | Answers | Claude Code reaches for it when… |
|---|---|---|
slurp_query(query, budget=4000, include_tests=false, include_imports=false) |
Where is the code that does X? | it needs to orient itself in an unfamiliar codebase, or find the code behind a feature — before reading any files |
slurp_explain(node_name, no_llm=true) |
What is this, and what breaks if I change it? | a query has pointed it at a function and it is about to modify it. Structural by default: no API key, no cost |
slurp_diff(old_graph, new_graph, hops=2) |
What does this change affect? | it is reviewing a change or preparing a merge and needs the blast radius |
slurp_suggest(query, budget=4000, include_tests=false, include_imports=false) |
What else should I look at? | an answer felt incomplete and it wants the queries that would reach what the budget left out |
slurp_impact(file_path, hops=2) |
What breaks if I edit this file? | it is about to edit a file and wants the blast radius first — no second snapshot required |
All five are declared readOnlyHint and idempotentHint. Claude Code uses those hints to
run the calls in parallel and to retry them after a reconnection, not to approve them: it
asks before each call unless you answered "don't ask again" for that tool or allow
mcp__slurp__* in your permission settings. Codex does count them: with default_tools_approval_mode = "writes"
it does not ask about read-only tools. slurp_explain reads the same graph slurp_query serves, reload check included, so
the two never answer from different snapshots in one session.
A failure inside a tool comes back as isError: true with a readable message; it never
takes the server down, and the next call still works.
.slurpignore
Exclude nodes by type, file path, or ID pattern. Create .slurpignore in your project root:
# Exclude documentation nodes
type:document
type:markdown
# Exclude test files
file:tests/**
file:**/*.test.ts
# Exclude generated code
id:generated_*
Pass a custom path with --ignore-file path/to/.slurpignore.
Design decisions
Power-iteration PageRank without numpy. nx.pagerank() requires numpy. Slurp implements a 20-line pure-Python power-iteration algorithm (convergence: Σ|rank_new − rank_old| < N × tol). Same result, no heavy dependency.
TF-IDF without scikit-learn. Hand-rolled TF-IDF with smoothed IDF (log((N+1)/(df+1)) + 1) and cosine similarity. The tokenizer splits camelCase and snake_case, so authenticate_user scores on both authenticate and user. The score_nodes() interface is backend-agnostic — swap to real embeddings with --backend openai without touching any caller. (--backend anthropic is refused since v1.0.7, and score_nodes(backend="anthropic") raises a ValueError since v1.1.0: Anthropic offers no embedding model, and its docs point to Voyage AI.)
YAML serializer without PyYAML. _yaml_scalar() renders Python primitives as valid YAML scalars using json.dumps() for strings that need quoting (JSON string literals are valid YAML 1.1). No PyYAML dependency.
lru_cache on the tiktoken encoder. tiktoken.get_encoding() reads tokenizer data from disk on first call. Caching with lru_cache(maxsize=8) means repeated token-counting calls within a single run hit memory, not disk.
+0.3 score boost for file_type == "code" nodes (clamped to 1.0). Documentation nodes compete unfairly with code in technical queries. The boost is bounded so it cannot override a genuinely high structural+semantic score.
--inject-code capped at 30 nodes. Code blocks are 50–200 tokens each. At 30 nodes, that's up to 6,000 extra tokens — manageable. At 200 nodes it would explode the context budget. The cap is enforced in both the CLI (warning message) and inject_code() (hard guard), so the formatter never receives oversized input.
Roadmap
- ✅ v0.1.0 —
loader,scorer,budget,formatter,audit— core pipeline, full tests,slurp QUERY+slurp stats - ✅ v0.2.0 —
--explain,.slurpignore,--vizinteractive HTML,--min-score, camelCase/snake_case tokenizer,--neighbor-decay - ✅ v0.3.0 —
slurp serve(MCP stdio),slurp diff,slurp export(claude/chatgpt/claudemd), PyPI publish asslurp-graph - ✅ v0.4.0 —
--backend openai|anthropic(optional embeddings),slurp benchmark, GraphML + Neo4j CSV loader,convert_graph() - ✅ v0.5.0 —
--inject-code: extract real function bodies from source files and embed them in the context output - ✅ v0.6.0 —
slurp index .: standalone static indexer (Python ast, TypeScript/JS, Go) — graphify is now optional - ✅ v0.6.1 —
slurp init: guided one-command setup — language detection, indexing and MCP config in one step - ✅ v0.6.2 —
slurp benchmarkcost estimation in USD per model,--price-model - ✅ v0.6.3 —
--viz-output: save the interactive HTML to a file without opening a browser - ✅ v0.6.4 — MCP session log,
slurp session,--log— every query the server answered, on the record - ✅ v0.6.5 —
slurp diffimpact headline, "what to review" section, CLI summary panel - ✅ v0.7.0 — MCP performance: 8.1× faster end-to-end, PageRank and token caches, deterministic greedy heap, auto-reload on a stale graph
- ✅ v0.8.0 — 16-language indexer (Java, Rust, C#, Ruby, PHP, Kotlin, Scala, Swift, C, C++, Lua, Elixir, PowerShell),
_BaseVisitorrefactor, broken-tree guard on every grammar - ✅ v0.8.1 — premium
--vizredesign: type colors, glow, smart label inference, quiet nodes, legend, project panel - ✅ v0.9.0 —
slurp index --smart(git-aware incremental, 21× faster),slurp advisor, multi-graph federation, sdist 98.7% smaller - ✅ v0.9.1 —
slurp explain: LLM node explanations across 4 providers with a structural fallback,slurp config - ✅ v0.9.2 — Python call graph:
callsedges between functions, real risk levels inslurp explain - ✅ v0.9.3 — TypeScript/JavaScript call graph, tree-sitter with a regex fallback
- ✅ v0.9.4 — Python and TypeScript/JavaScript cross-file call resolution — imports followed to the real definition
- ✅ v0.9.5 —
slurp eval: LLM-judge quality benchmark, 5× better quality per token - ✅ v0.9.6 — Go call graph: receiver methods, struct initialisers, package-local resolution
- ✅ v0.9.7 — Java and Rust call graphs: DI fields and
super/this/static for Java,implblocks,selfreceiver and trait resolution for Rust - ✅ v0.9.8 — Java and Rust cross-file call resolution: static and wildcard imports,
use crate::/super::, multi-symbol and glob imports - ✅ v0.9.9 — Go cross-file call resolution: package aliases, dot imports,
package mainexcluded — all five call-graph languages now resolve across files - ✅ v1.0.0 — Production release: complete call graph for Python, TypeScript/JS, Go, Java and Rust with cross-file resolution.
slurp explain,slurp eval,slurp advisor,slurp init, federation, smart reindex, premium viz. - ✅ v1.0.1 — Return type propagation:
srv := NewServer()followed bysrv.Start()resolves for Go, Rust, Java and TypeScript, within a file - ✅ v1.0.2 — Structural
slurp explain: architectural role, neighbourhood context, risk as a share of the project, and follow-up commands — 90 lines down to 28 - ✅ v1.0.3 — MCP gains
slurp_explainandslurp_diff - ✅ v1.0.4 —
--suggest: follow-up queries read off the subgraph's frontier, plus theslurp_suggestMCP tool - ✅ v1.0.5 —
slurp impact: blast radius of editing a file before you edit it, no second snapshot needed, plus theslurp_impactMCP tool - ✅ v1.0.6 — Security patch: an environment API key is never sent to an endpoint from a project's
.slurp/config.json;config.jsonis written 0600 andslurp initadds.slurp/to.gitignore;--inject-codestays inside the project root;slurp indexasks before replacing a graph graphify wrote (--forceto skip); the viz works offline (vis-network vendored) and graph text can no longer break its<script>; a damagedaudit.jsonlline is skipped with a warning - ✅ v1.0.7 —
slurp index --smartalways produces the graph a full index builds (it records the build commit, stays incremental for edits inside function bodies, and runs a full index when files, definitions or imports change); risk isUNKNOWN, never "safe", for the eleven languages without a call graph;--backend anthropicis refused (Anthropic has no embeddings endpoint); the viz stops its physics as soon as the layout settles; projects inside abuild/orvendor/folder index normally, and an empty index says why - ✅ v1.1.0 — The token budget bounds the text actually sent, measured;
slurp eval --retrievalscores recall and MRR with no LLM and reports the tokens each answer costs;--token-factorfor models that do not tokenize like tiktoken; one--min-scoredefault everywhere;slurp diffrates impact by the callers a change reaches; the closing tip says why nodes are missing; savings are measured or not shown; releases go to PyPI by trusted publishing - ✅ v1.1.1 — Maintenance:
slurp indexskips the build output of web frameworks (.next/,.nuxt/,.svelte-kit/,.turbo/,.vercel/,.output/, andout/when it holds a Next.js static export) and prunes skipped directories instead of walking them (PrismaStats: 4.9 s → 0.5 s, 214 fewer nodes of compiled.next/code);slurp diffreads a deleted node's risk neighbourhood from the old graph, where it still exists;slurp config setadds.slurp/to.gitignoreasslurp initdoes;scripts/latency.pyreproduces the Performance figures; the sdist ships only the package, its docs and the MITLICENSE, which the wheel now carries too - ✅ v1.2.0 — Better selection, measured: test code and import nodes no longer take places in a subgraph (
--include-tests/--include-importslet them back), and a node lends its neighbour boost to at most ten neighbours, so a hub's callers no longer fill the budget — recall at--budget 4000in markdown 0.867 → 0.967 on PrismaStats and 0.688 → 0.875 on slurp's own graph; risk bands inslurp explain,slurp impactandslurp diffcount production callers only, with tests shown apart;_is_testfollows each language's test-runner conventions;scripts/retrieval.pymeasures recall on a fixed tuning/held-out split of the questions - ✅ v1.2.1 — Fixes:
slurp index --smartno longer runs a full index on every run when.slurpignoreexcludes a whole file; every command that writesgraph.jsonreplaces it atomically, so the MCP server never loads half a graph;slurp impact's AFFECTED FILES list counts the files its headline counts;--suggestgives the same suggestions in every run;--inject-codesays when it cuts a block at 100 lines;slurp indextreats graphs written by v1.3 as its own
Upgrading to v1.2.1
A maintenance release: no change to scoring, selection or the budget, and no dependency changes.
slurp index --smartno longer runs a full index every time a.slurpignorerule excludes a whole file. It took every file on disk that no node of the graph came from for a new one, so withfile:b.pytwo--smartruns in a row both printed1 added and 0 removed or renamed files … Full index needed. Such a file now counts only if a full index would give it a node; the same goes for files excluded bytype:orid:rules and Python files that do not parse.- Every command that writes
graph.jsonreplaces it atomically —slurp index,--smart,--watchandslurp init. The new graph is written next to the old one, flushed to disk and moved into place, so a reader such asslurp servesees the old graph or the new one, never half of one. A symlinkedgraph.jsonis written through, as before, and an existing one keeps its permissions. On Windows, a graph another process holds open is retried for about two seconds. slurp impact: the AFFECTED FILES list counts the files the headline counts. On PrismaStats,slurp impact lib/supabase/admin.tssaid "affects 69 files" over a list that added up to 34: the headline (andaffected_filesin--output json) took the files of every production dependent within--hops, direct or transitive, while the list took direct dependents only. 69 was right. The list — in the MCP toolslurp_impacttoo — now shows those same files, and each file's count adds its direct and transitive dependents. For CI on--output json:affected_fileskeeps its meaning and its values; the per-file counts are new, asdependents_per_file. The risk is still rated on direct dependents.--suggestgives the same suggestions in every run. When two frontier nodes had as many dependants, the risk suggestion went to whichever a set yielded first, which changed with the process's hash seed (Badgeorbadge.tsxon PrismaStats). A tie now goes to a definition over the file node that holds it, then to the smallest node id.--inject-codesays when it cuts a block, with a line under it:… cut at 100 lines; the block continues at line 1240 of lib/supabase/admin-actions.ts.slurp indextreats graphs written by v1.3 as its own. v1.3 will add a top-levelslurpkey (a manifest of the files it indexed) tograph.json. v1.2.1 re-indexes such a graph without asking whether to replace another tool's; v1.2.0 and earlier take it for graphify's and ask (--forceskips the question). The manifest is lost in the rewrite, and v1.3 rebuilds it with one full index.- The docs no longer say that the MCP tools'
readOnlyHintlets clients auto-approve them: Claude Code uses it to run read-only calls in parallel and to retry them, not to skip the approval; Codex does count it.
Upgrading to v1.2.0
v1.2.0 changes which nodes a query selects. A query's output keeps its format, plus one
closing-tip line and two stats keys; slurp explain, slurp impact and slurp diff show
tests apart (below). No dependency changes.
Recall, measured with slurp eval --retrieval at --budget 4000 over all 31
questions (PrismaStats's slurp index graph, 15 built-in questions; slurp's own graph, 16
questions labelled for this measurement):
| Graph | Markdown, v1.1.1 → v1.2.0 | JSON, v1.1.1 → v1.2.0 |
|---|---|---|
| PrismaStats | 0.867 → 0.967 | 0.589 → 0.900 |
| slurp | 0.688 → 0.875 | 0.562 → 0.812 |
The changes were decided on half of each project's questions, drawn once with a fixed seed, and checked once on the other half; every budget and format, both halves, and the script that reproduces them are in Choosing a budget.
What changes if you already use slurp:
- Tests and import nodes no longer take a place in a query's subgraph.
slurp QUERY,export,benchmark,eval, the MCPslurp_queryandslurp_suggest, and the library'sbuild_context/select_subgraphleave them out by default.--include-testsand--include-importslet each kind back in (include_tests/include_importsover MCP and in the library). The closing tip counts what was left out, and JSON/YAML stats carrynodes_excluded_tests/nodes_excluded_importswhen there are any. PageRank still sees them, so the scores do not change. A test is what a test runner would collect:tests/,test/,__tests__/orspec/directories, files liketest_*.py,*_test.go,*.spec.tsor*Test.java, and Rust'smod tests—latest_results.pyis no longer one, and neither arecontests/orlib/respec/. - A node lends its neighbour boost to at most ten neighbours, the most relevant on
their own. On PrismaStats
createAdminClient, with 97 callers, lent its score to all of them, and they filled the budget ahead of the nodes a question asked for; with a bigger budget its 97 relationships took the room meant for new nodes. - Risk bands count production callers only, in
slurp explainandslurp impact, asslurp diffalready did, so the three agree. Until v1.1.1 explain and impact added the tests in. On slurp's own graph 137 nodes change band inslurp explain— 69 from HIGH to LOW, 34 from MEDIUM to LOW, 34 from HIGH to MEDIUM; on PrismaStats, which has almost no tests, none do. Tests are shown apart:→ Tested by: 72 tests in 9 files,10 production callers, 72 in tests, and a TESTS block inslurp impact. A CI gate onslurp impact --output jsonsees the same change:risk_level,direct_dependents,transitive_dependents,affected_filesandimpact_scoreare production-only, and the tests move totest_dependents/test_files. - SAFE TO EDIT means nothing calls it, not even a test. A definition only tests call
is LOW, listed as
test_only_nodesinslurp impactand told to update its tests inslurp explain, not reported as safe. - Import nodes are never dependants.
slurp diffno longer counts the module that declared a removed import as a caller, andslurp impactno longer counts imports as definitions of the file (slurp'sbudget.py: 29 → 19). slurp eval --retrieval's MRR has a new definition: a relevant node's rank counts only the nodes slurp can return. Tests and imports are left out of selection, so they are left out of the ranking — that is the order a reader meets the nodes in. The scores did not change, so neither did the old figure: the rank over every node is still reported, asmrr_all.
Known limitation. With the ten-neighbour boost, PrismaStats's dashboard_actions
module — one of the two nodes of question arch-02, "Which files concentrate the most
functions?" — is no longer reached at --budget 12000. v1.1.1 reached it there only
through the 97 callers of createAdminClient; v1.2.0 finds the question's other module
from 4000 on, but stays at 0.967 in markdown up to 16000, where v1.1.1 got 1.000 from
12000.
Upgrading to v1.1.0
What changes if you already use slurp:
- The same
--budgetsends less context than before. Until v1.0.7 the budget counted a short summary per node and none of the relationships, so the printed text was several times the budget: on a 2,111-node graphify graph--budget 4000printed about 29,000–32,000 tokens and--budget 800040,368–41,582. The budget is now an upper bound on the text printed — nodes, relationships and header, measured in the format you asked for — so--budget 4000prints at most 4,000 tokens (3,917–3,928 on that graph), with fewer nodes: the quickstart's"player stats"went from 402 nodes to 135. If you relied on the larger context, raise--budget;slurp eval --retrievalwith your own questions shows where recall stops improving. A budget too small for even the header is now an error that names the minimum (-32602from the MCP server). - The default budget stays 4000, for
slurp QUERYand for the MCP server'sslurp_query. It was measured against 6000, 8000 and 12000 and kept: in markdown, which both send by default, recall was the same at 4000, 6000 and 8000. JSON and YAML spend more tokens per node; with--format jsonoryamluse about 6000–8000 for the same recall. See Choosing a budget. --backend anthropicis retired. The CLI has refused it since v1.0.7; now the library does too:score_nodes(G, query, backend="anthropic")raisesValueErrorinstead of calling an endpoint that does not exist. Anthropic offers no embedding model. Usetfidf(the default) oropenai.slurp diff'simpact_scoreis on a new scale. It was the mean degree centrality of the touched nodes, which on a real graph never exceeded ~0.03: deleting a function with 97 callers scored 0.0012, "low". It is now1 − e^(−D/k), where D counts the distinct production callers the change reaches (tests and containing modules excluded), banded likeslurp impactandslurp explain: 6+ callers high (≥ 0.5), 2–5 medium (≥ ~0.17), 0–1 low; the 97-caller deletion scores 1.00. A script or CI gate comparingimpact_scorewith a fixed number needs a new threshold.GraphDiffalso carriesdependents(the callers counted),unknown_nodesandrisk_reason, and a low score that rests on a language with no call graph is reported as unknown.
Also visible:
--min-scoredefaults to 0.15 everywhere: the library (build_context,select_subgraph),slurp benchmarkandslurp evalused 0.0.- JSON and YAML output carry
nodes_over_budget,nodes_below_min_scoreandmin_scorein their stats; the markdown tip prints one line for each cause and no longer calls left-out nodes "connected". slurp audit,slurp sessionandslurp advisorshow no savings,session.logno longer writessavings_pct, andSimilarQuery.savings_pctis gone: they divided by a fixed cost per node.slurp benchmarkmeasures savings, and drops its "precision" row.slurp indexskips_vendor/directories and*.min.jsfiles, and writes no_-prefixed attributes, so re-indexed graphs can shrink.
License
Metadata
Release files for slurp-graph 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| slurp_graph-1.2.1.tar.gz | 393.0 kB | Without provenance | Details for slurp_graph-1.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| slurp_graph-1.2.1-py3-none-any.whl | Python 3 | none | any | Details for slurp_graph-1.2.1-py3-none-any.whl |
Total release size: 761.3 kB
Release files / slurp_graph-1.2.1.tar.gz
| Download URL | slurp_graph-1.2.1.tar.gz |
|---|---|
| Size | 393.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d44c2a373992fd2260c4fc391ea262a70c316a28bc8c9dad51fdb62a3a57342
|
|
BLAKE2b-256 checksum How to use checksums |
a6a7221511e36a07bdf3af4a38934c69b594c2f7c160ce43a6baf070f6f26001
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / slurp_graph-1.2.1-py3-none-any.whl
| Download URL | slurp_graph-1.2.1-py3-none-any.whl |
|---|---|
| Size | 368.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17be6976da8a50ce66fbe88d067a98ed940962a743e9a8513ba8a7d69f9a5568
|
|
BLAKE2b-256 checksum How to use checksums |
b9446cef3a6b6f60f4296d88b49f377951f89fc3b9c9849e341a75ee6318fd0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for slurp-graph 1.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.