Skip to main content

slurp logo

slurp

tests python license pypi

graphify builds the bowl. slurp serves exactly the noodles your LLM needs.

Website: imjuank.dev/slurp-web

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 8000 printed 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.

Finding the code to change needs more. A later study (slurp v1.3.0, 14 open-source projects, 1,525 questions taken from commit history: the commit subject as the question, the definitions the commit changed as the answer, on the graph of its parent) looked for the budget past which more tokens find nothing new. For architecture questions like the ones above, the default is enough. For pinning down the specific function a change touches, recall keeps growing, about 10 points per doubling, up to 32000 with no plateau, in projects with more than about 2,000 candidate nodes (those slurp may return: no tests, no imports). There, in markdown, 4000 finds 34–68 % of the changed definitions, 16000 finds 52–75 % and 32000 finds 59–81 %. The default stays 4000: doubling the context for ten points is a trade-off, not an optimum. slurp_query's description tells the agent to pass 16000–32000 when it is after one specific function in a large project. v1.4.0 ranks better for exactly these questions: on six projects of that study it was not tuned on, recall at 4000 goes from 0.543 to 0.674 with the same tokens (Upgrading to v1.4.0). Details, in Spanish: conclusiones.md.

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]"
slurp explain with Anthropic models pip install "slurp-graph[llm-anthropic]"

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 install places slurp.exe in Python's Scripts folder, which may not be on PATH by default. If slurp is not found after install, see adding Python Scripts to PATH, or use uv tool install instead (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 as uv run slurp or activate the virtual environment first. For the MCP server with uv 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.4.0, on a 2,111-node graph of a Next.js codebase:

╭─ Slurp — Subgraph for: "player stats" (budget: 4,000 tokens) ╮
│ Selected 103/2111 nodes · 3,926/4,000 tokens used (4.9%)     │
╰──────────────────────────────────────────────────────────────╯

## Relevant Nodes

### PlayerStatsInsert · score: 0.96
→ File: types/database.ts

### PlayerStats · score: 0.96
→ File: types/database.ts

### recalcularPlayerStats() · score: 0.95
→ File: lib/supabase/admin-actions.ts

### updatePlayerStatsAdmin() · score: 0.94
→ File: lib/supabase/admin-actions.ts

### getPlayerStatsAdmin() · score: 0.94
→ File: lib/supabase/admin-actions.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
…

---
💡 1356 more nodes scored 0.15 or more but did not fit the budget — increase --budget to include them
💡 642 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: 1.00
→ 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 typescript here without being told. Add --project-root when 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: recalcularPlayerStats is 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 builds a graph that keeps itself current, registers the MCP server, approves it for Claude Code and tells your agent when to use it.

slurp init                          # from your project root — no flags needed
slurp init --yes                    # accept the plan as shown (CI / scripting)
slurp init --keep-graphify          # serve graphify's graph instead of building slurp's
slurp init --instructions versioned # paragraph in CLAUDE.md / AGENTS.md instead of CLAUDE.local.md

It shows the whole plan and asks before writing anything:

  1. Builds slurp's own graph, refreshed before every answer (see Keeping the graph current). With no graph yet it goes to graphify-out/graph.json; next to a graph slurp did not build — graphify's — it goes to graphify-out/slurp-graph.json and graphify's file is never touched (--keep-graphify serves graphify's instead, read-only); a graph slurp built is reused. The language is detected by counting indexable files, ignoring vendored trees like node_modules/ and .venv/ (folders above the project root never count).
  2. Writes .mcp.json pointing at the slurp binary it detected — works with both uv tool install and pip install layouts. An existing .mcp.json is never clobbered: slurp asks first, and other MCP servers in the file are preserved.
  3. Approves slurp for Claude Code in .claude/settings.local.json at the git root: "enabledMcpjsonServers": ["slurp"] (the project server) and "mcp__slurp__*" in permissions.allow (its tools) — the two approvals .mcp.json alone does not give. It merges without duplicating, never touches a file that is not valid JSON (it prints the fragment instead), keeps a server listed in disabledMcpjsonServers disabled and leaves deny/ask rules about slurp in place, and says so.
  4. Tells the agent when to use slurp: a short paragraph, by default in CLAUDE.local.md (local, not versioned). When the project has only an AGENTS.md, the new file starts with @AGENTS.md so Claude Code keeps reading it. --instructions versioned writes to CLAUDE.md and/or AGENTS.md instead, none writes nothing. Running init again replaces the block between its markers; a file that already mentions slurp_query is left alone.
  5. Keeps local files out of git: .slurp/, .claude/settings.local.json and CLAUDE.local.md go to an existing .gitignore unless git already ignores them — and so does the lock file beside slurp's graph (graphify-out/.slurp-graph.json.lock) when the project versions graphify-out/. With no .gitignore nothing is created and the summary says so. Claude Code ignores a .claude/settings.local.json that git tracks, so in a project that versions it the approval from step 3 does not apply: init says so and prints the exact git rm --cached command, and leaves taking the file out of git to you.

The summary also prints the configuration for Codex, Gemini CLI and Cursor, to copy by hand — slurp does not write them. Finish by restarting your AI coding assistant. The workspace-trust dialog Claude Code shows the first time you open a folder is still Claude Code's.

Flag Default Description
--yes, -y off Accept the plan as shown and every confirmation prompt. Useful for CI and scripting.
--keep-graphify off Next to a graph slurp did not build, serve that one (slurp won't refresh it) instead of building slurp's beside it.
--instructions local Where the agent's paragraph goes: local (CLAUDE.local.md), versioned (CLAUDE.md / AGENTS.md), or none.

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.
--no-refresh off Do not refresh slurp's own graph first; only warn if it is out of date. Also SLURP_REFRESH=0. See Keeping the graph current.
--refresh-timeout S 2 Seconds to wait for a refresh before answering from the previous graph; 0 never waits. Also SLURP_REFRESH_TIMEOUT.

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):

  1. ./graph.json
  2. ./graphify-out/slurp-graph.json — slurp's own graph next to graphify's; it exists only if you or slurp init chose it, so it comes first
  3. ./graphify-out/graph.json
  4. ./.graphify/graph.json

export, explain, impact, stats and advisor take the same --no-refresh and --refresh-timeout.


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.4.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 119/6576 nodes · 3,929/4,000 tokens used (1.8%)  │
╰───────────────────────────────────────────────────────────╯

## Relevant Nodes

### actions.ts · score: 1.00
→ File: lib/auth/actions.ts

### route.ts · score: 0.84
→ File: app/auth/callback/route.ts

### GET() · score: 0.84
→ File: app/auth/callback/route.ts

…

## Key Relationships
- prismastats::asistencia_page_asistenciapage → calls → prismastats::supabase_admin_createadminclient
…

---
💡 2057 more nodes scored 0.15 or more but did not fit the budget — increase --budget to include them
💡 672 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 _project attribute, no federation header. Federation only engages from the second --graph onward.

Merging does not invent edges between projects: if api imports auth, that relationship exists in neither graph.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.4.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-27T22:23:23 │ budget selection      │    62 │  2,948 │
│ 2    │ 2026-11-27T22:23:24 │ graph loader          │    69 │  2,943 │
│ 3    │ 2026-11-27T22:23:24 │ mcp server            │    54 │  2,948 │
│ 4    │ 2026-11-27T22:23:24 │ token counting        │    64 │  2,948 │
│ 5    │ 2026-11-27T22:23:25 │ call graph extraction │    73 │  2,938 │
└──────┴─────────────────────┴───────────────────────┴───────┴────────┘
                      Top 10 Most Selected Nodes
┏━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Rank  ┃ Node                                       ┃ Times Selected ┃
┡━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ 1     │ slurp.cli                                  │              5 │
│ 2     │ slurp.loader.load_graph                    │              5 │
│ 3     │ slurp.mcp.FederatedGraphState.check_reload │              5 │
│ 4     │ slurp.mcp.GraphState.check_reload          │              5 │
│ 5     │ slurp.budget.full_graph_tokens             │              4 │
│ 6     │ slurp.budget.clear_node_token_cache        │              4 │
│ 7     │ slurp.cli.run                              │              4 │
│ 8     │ slurp.mcp._handle                          │              4 │
│ 9     │ slurp.scorer.score_nodes                   │              4 │
│ 10    │ slurp.cli._find_graph                      │              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.4.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,923 tokens
Expected coverage:   93.3% of similar queries' selections
Estimated cost:      $0.0118  (claude-sonnet-5)
Confidence:          MEDIUM  (5 similar queries)

Similar past queries:
  "budget selection"      → 2,948 tokens · 62 nodes
  "budget selection heap" → 1,477 tokens · 36 nodes
  "budget selection heap" → 2,453 tokens · 60 nodes
  "budget selection heap" → 3,923 tokens · 75 nodes
  "budget selection heap" → 5,882 tokens · 102 nodes

Run with recommended budget:
  slurp "budget selection" --graph graph.json --budget 3923

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,946 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,946 tokens · 97 nodes
  "auth flow callback" → 2,946 tokens · 85 nodes
  "auth flow cookie"   → 2,943 tokens · 97 nodes
  "auth flow guard"    → 2,943 tokens · 97 nodes
  "auth flow jwt"      → 2,947 tokens · 98 nodes
  … and 7 more

Run with recommended budget:
  slurp "auth flow" --graph graph.json --budget 2946
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 benchmark compares 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.4.0 on PrismaStats's graphify graph:

╭──────────────────────────── slurp explain — recalcularPlayerStats() ─────────────────────────────╮
│ code · lib/supabase/admin-actions.ts · score: 1.000                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

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: 1.000.

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 the llm-anthropic extra (since v1.5): pip install "slurp-graph[llm-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.4.0, with nothing listening on the endpoint:

╭──────────────────────────── slurp explain — recalcularPlayerStats() ─────────────────────────────╮
│ code · lib/supabase/admin-actions.ts · score: 1.000                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯

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: 1.000.

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 index extracts them, across files, for Python, TypeScript/JavaScript, Go, Java and Rust — on PrismaStats's slurp index graph createAdminClient has 97 production callers and reads HIGH — and the other eleven languages read UNKNOWN, not LOW. A React component rendered as JSX (<Badge />) gets a renders edge since v1.5, and the pages that render it count as its dependants: on PrismaStats's slurp index graph, Button has 32 and reads HIGH. Until v1.4 JSX made no edge, and 530 of the 536 nodes in PrismaStats's .tsx files read LOW.


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_key is masked in all output but stored in plain text in .slurp/config.json, written with permissions 0600. Like slurp init, slurp config set adds .slurp/ to an existing .gitignore that 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_subgraph in 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 to build_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, _runner first 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 every tool call to .slurp/session.log (only if .slurp/ exists). See slurp session.
--no-refresh off Serve the graph as it is; answers still warn when it is out of date. Also SLURP_REFRESH=0.
--refresh-timeout S 2 Seconds a call waits for a refresh. Also SLURP_REFRESH_TIMEOUT.

Before each call the server refreshes slurp's own graph if the working tree changed — see Keeping the graph current. 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.4.0 on PrismaStats's graphify graph:

SUGGESTED QUERIES
  slurp "page props client"     — explore the connected area the budget left out
  slurp explain 'createClient'  — high-risk dependency — 36 nodes depend on it

Three kinds of suggestion, each fired only when the graph supports it (above, the drill-down does not):

Kind Fires when Reads as
Drill down the subgraph's most relevant node has neighbours that were left out drill down into what surrounds NODE
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 — N 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 (in v1.2.0's answer to this query, Badge before badge.tsx, 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 what your AI assistant asked the MCP server — every call to any of the five tools.

slurp session --last 10
slurp session --tail
slurp session --sessions     # one row per server session
Flag Default Description
--last N 20 Number of most recent entries (or sessions) to show.
--tail off Follow the log in real time (Ctrl+C to stop).
--sessions off Summarise each server session: client, duration, calls per tool, when the first call came, files changed before it, edits that had a slurp_impact or slurp_explain on that file first, answers with a warning, p95 refresh time.
--log-dir PATH .slurp Directory containing session.log.

Real output, 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                ┃ Tool        ┃ Asked      ┃ Budget ┃ Nodes ┃ Tokens ┃ Graph ┃
┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━┩
│ 2026-11-27T22:23:33 │ slurp_query │ auth flow  │  4,000 │    83 │  3,925 │ fresh │
│ 2026-11-27T22:23:33 │ slurp_query │ mcp server │  2,000 │    33 │  1,955 │ fresh │
└─────────────────────┴─────────────┴────────────┴────────┴───────┴────────┴───────┘

Each line of .slurp/session.log (JSON) records the session (process and start time), the client and protocol revision, the tool and its arguments in short, how long the call took, the graph's state, the refresh time and the files that changed, nodes and tokens, and the error if it failed. A start event names the graph and its owner; an end event, when the client disconnects, lists every file that changed during the session — in a task an agent did, its edits. Lines written before v1.3 are still read.

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. It measures the graph as it is: it never refreshes it, and warns on stderr when slurp's own graph is out of date.

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. Like slurp benchmark, it never refreshes the graph it measures and warns when it is out of date.

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, --budget capped 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                     # keep the graph current until Ctrl+C
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 index asks 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 init builds slurp's graph in graphify-out/slurp-graph.json by default when graphify's is there.

Real output, v1.5.1 on PrismaStats (the paths are placeholders). The retrieval figures in Choosing a budget use this project's v1.2.0 graph, 1,582 nodes and 1,852 edges; v1.5's React components add 56 nodes and the renders edges:

Indexing /path/to/prismastats ...
✓ 1638 nodes · 2285 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 index extracts calls edges between functions, within a file and across them, enabling accurate risk analysis in slurp explain and impact propagation in slurp 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 receiver this.m() self.m() in an impl
Inherited methods ✅ base class in the same file ✅ tree-sitter only — ✅ incl. super.m() ✅ traits impld in the file
Constructors 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 S C 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 ast tree-sitter, with a regex fallback regex tree-sitter, with a regex fallback tree-sitter, with a regex fallback

React components: renders (v1.5). A JSX usage of a component of the project, <Badge />, is a renders edge from the function that renders it: a component defined in the same file or imported from another (named, default when the symbol is named like the binding, or <Dialog.Root /> through import * as Dialog), and one loaded with React.lazy or next/dynamic. Lower-case tags (<div>), components of libraries and a component passed as a prop (icon={Badge}) make none. A component wrapped in React's memo or forwardRef (const Button = React.forwardRef(...)) is a node, so its renderers count too. One edge per pair: a component that is also called as a function keeps calls. renders counts wherever calls does — dependants and risk in explain, impact and diff, and the ranking's walk. JSX in a .js file is read by the regex fallback, with the same rules: the TypeScript grammar does not parse it.

Return type propagation: srv := NewServer() followed by srv.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 calls edge 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 calls edge 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 f followed by f(), plus import 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 main excluded from the index.

An import only resolves when its module is part of the project. That single rule is what keeps from pathlib import Path from binding to a local class of the same name, and import { useState } from 'react' from binding to a local react.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, so auth.Login() is answered by every file in auth/, and package main is excluded from the index because it is never importable. A local variable typed by a struct literal or a var declaration 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 impl blocks, not in the struct, so a method's node id is module.Type.method and every impl Type block — including impl Trait for Type — contributes to the same type. The self receiver (self, &self, &mut self) resolves to the enclosing impl, Self:: and Type:: to an associated function, and a trait's default method resolves through impl Trait for Type when the trait is declared in the same file. Types are declared in Rust — parameters, struct fields and let annotations — so nothing is inferred from an initialiser; Type::new() also resolves through a return type declared as Self.

Two things are deliberately silent. Macros never produce an edge, including the calls written inside them: println!, vec! and format! are macro invocations, and even assert_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() and into() resolve to nothing, as does any receiver whose type is not declared in the file. A bare helper() never resolves to a method either: Rust has no implicit receiver, so inside impl Gateway a bare submit() is a free function, not self.submit.

A return type only propagates within one file. srv := NewServer() resolves when NewServer is declared in the same file as the call. A constructor imported from elsewhere does not carry its type across, so srv.Start() emits nothing there. An explicit type — a var declaration, a let x: T annotation, 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, and e.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 ts extra, 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 the java extra, Java falls back to regex, which resolves everything above, including static imports across files. Without the rust extra, 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 emit contains and imports_from only.

Flag Default Description
--output, -o <path>/graphify-out/graph.json Output path for graph.json.
--watch off Keep the graph current until Ctrl+C: checks every second, refreshes after a quiet second. See --watch.
--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, or .slurpignore changes.
--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. Every graph slurp index writes carries a manifest — the files it indexed, with stat and content hash — and --smart compares it with the disk: no git needed. Only the files whose content changed are re-parsed.

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 new, deleted or renamed file, a changed .slurpignore, another --ignore-file, another slurp version or a newly installed grammar run a full index, and say so.

A graph written by slurp ≤ 1.2 has no manifest: for it --smart asks git what changed since the commit the graph was built from (built_at_commit) — committed, staged, unstaged and untracked — plus any file modified after the graph was written, and falls back to a full index without a repository or a recorded commit. The rewritten graph carries a manifest from then on.

--dry-run lists the files it would touch and exits without writing:

slurp index . --smart --dry-run

It also runs a full index when there is no existing graph to update.

Keeping the graph current with --watch

slurp index . --watch

After indexing, --watch checks the manifest every second and refreshes once a whole second passes with nothing else changing — so a save that writes twice, or a git checkout of a hundred files, is one refresh. New, deleted and renamed files and .slurpignore changes are all seen; skipped directories (node_modules/ and the rest) never wake it. It prints one line per refresh — ↻ 1 file changed (lib/util.py) — smart update in 0.1s — and stops with Ctrl+C. It needs no file-system events and no extra package (watchdog is no longer a dependency).

You only need it for tools that read graph.json outside slurp: the MCP server and the query commands keep the graph current on their own (see Keeping the graph current).

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-kotlin grammar has known parsing issues — it fails on a class with a body followed by an object declaration, 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.5.1 on PrismaStats without the ts extra (with it, the same project indexes to 1638 nodes and 2285 edges):

✓ 1577 nodes · 2114 edges · 185 files
  Parsers: Python (ast) · TypeScript (regex fallback)
  Install the 'ts' extra for full TypeScript support:
    pip install "slurp-graph[ts]"
    uv tool install "slurp-graph[ts]"
  uv tool install replaces the extras installed before: name every extra you use in one command, as in "slurp-graph[ts,java]".

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

Install an extra with the tool you installed slurp with. pip adds it to what is already installed; uv tool install replaces the extras of the earlier install, so name every extra you want in one command: uv tool install "slurp-graph[ts,java]".

Extra Languages pip uv tool
ts TypeScript, JavaScript pip install "slurp-graph[ts]" uv tool install "slurp-graph[ts]"
java Java pip install "slurp-graph[java]" uv tool install "slurp-graph[java]"
rust Rust pip install "slurp-graph[rust]" uv tool install "slurp-graph[rust]"
csharp C# pip install "slurp-graph[csharp]" uv tool install "slurp-graph[csharp]"
ruby Ruby pip install "slurp-graph[ruby]" uv tool install "slurp-graph[ruby]"
php PHP pip install "slurp-graph[php]" uv tool install "slurp-graph[php]"
kotlin Kotlin pip install "slurp-graph[kotlin]" uv tool install "slurp-graph[kotlin]"
scala Scala pip install "slurp-graph[scala]" uv tool install "slurp-graph[scala]"
swift Swift pip install "slurp-graph[swift]" uv tool install "slurp-graph[swift]"
cpp C, C++ pip install "slurp-graph[cpp]" uv tool install "slurp-graph[cpp]"
all-languages All of the above pip install "slurp-graph[all-languages]" uv tool install "slurp-graph[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 — calls, renders (a JSX usage of a component), 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

Keeping the graph current

slurp's own graph follows the working tree. Before every answer — each MCP call, and slurp QUERY, export, explain, impact, stats and advisor in the terminal — slurp checks whether any file changed since the graph was built, and if one did it refreshes the graph before answering: edits, new, deleted and renamed files and .slurpignore changes included, uncommitted work too. The answer is the one a full index would give.

  • The check costs a few stat calls. Every graph slurp writes carries a manifest (a top-level "slurp" key in graph.json): the files it indexed with their size, mtime and a content hash, and the mtime of every directory it walked. A file is read only when its stat moved; a touch or an identical rewrite changes nothing. Measured on throwaway copies: 0.4 ms per call on PrismaStats (185 files), 0.2 ms on slurp's own source.
  • A refresh takes the fast path when it can. An edit inside function bodies re-parses only that file (30 ms on PrismaStats, 84 ms on slurp); anything else runs a full index (0.29 s and 0.59 s). Without git: the manifest is enough.
  • A call waits at most 2 seconds for a refresh. Past that it is answered from the previous graph, with a warning first in the answer (over MCP) or on stderr (in the terminal), and the refresh goes on; the next call gets the new graph. In the terminal the command finishes the refresh before it exits — finishing graph refresh… (Ctrl+C to skip; the graph stays as it was).
  • --refresh-timeout S (or SLURP_REFRESH_TIMEOUT) changes the limit; 0 never waits. --no-refresh (or SLURP_REFRESH=0) turns refreshing off — slurp still checks, and warns when the graph is out of date. For the MCP server, set them in the env block of .mcp.json or in its args.
  • slurp benchmark and slurp eval never refresh: a measurement needs a fixed graph. They warn on stderr when it is out of date. slurp diff reads the two files you give it.
  • Graphs slurp did not build are read-only. graphify's graph — or any graph without the manifest — is served as it is, never rewritten and never locked. When files it covers changed after it was built, answers say so: 2 files this graph covers changed after it was built; slurp doesn't rebuild graphify graphs — rerun graphify. A graph written by slurp ≤ 1.2 is adopted (one full index writes its manifest) when nine in ten of its files exist under the project; otherwise it is read-only too, and slurp index once fixes that.
  • Writing is safe. A new graph is written to a temporary file next to the old one and moved into place, so a reader sees one graph or the other, never half of one; a writer whose graph changed under it (graphify, another slurp) drops its result and reloads instead of overwriting. An advisory lock (.graph.json.lock beside the graph, never deleted) keeps two slurp processes from indexing the same project at once; slurp index run by hand waits for it.

The state of the graph behind each MCP answer is also in its _meta, under dev.imjuank.slurp/graph: status (fresh, refreshed, stale, failed or readonly), refresh_ms and changed_files. .slurp/audit.jsonl and the session log record the same status.


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"
}

slurp never rebuilds or rewrites graphify's graph: it is served read-only, and answers say when files it covers changed after it was built. For a graph that keeps up with your edits, let slurp init build slurp's own beside it (graphify-out/slurp-graph.json) — see Keeping the graph current.

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". If slurp isn't found, replace "command": "slurp" with the full path — find it with where slurp (CMD) or Get-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. Its description and the server's instructions tell the agent that the default answers architecture questions and that pinning down one specific function in a large project needs 16000–32000; 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) (also target or path) 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; Codex does count them: with default_tools_approval_mode = "writes" it does not ask about read-only tools. They stay read-only although a call may refresh graph.json — a cache derived from the code, never the code. slurp_explain reads the same graph slurp_query serves, so the two never answer from different snapshots in one session.

No approvals. slurp init writes what Claude Code needs to call the tools without asking: the project server enabled (enabledMcpjsonServers) and mcp__slurp__* allowed, in .claude/settings.local.json. Without it Claude Code asks once for the server and before each call unless you answer "don't ask again".

When to call which tool. The server's instructions — what Claude Code and Codex read before the first call — say when to reach for slurp before grep, and which tool fits which moment: slurp_query when starting a task, slurp_impact before editing a file, slurp_explain before changing a function. Each tool's description says the same from its side; slurp_query is marked anthropic/alwaysLoad, so with tool search on its description is there from the start. With graphify's graph the texts say slurp does not rebuild it.

Protocol versions. The server answers initialize with the revision the client asks for when it speaks it — 2025-11-25, 2025-06-18, 2025-03-26 or 2024-11-05 — and with 2025-11-25 otherwise. A client of revision 2026-07-28 names it in each request and is served without a session (server/discover answers too). From 2025-11-25 on, invalid arguments — a negative budget, a missing query, a budget too small for one node — come back as a tool error (isError: true) the model can read and correct; earlier revisions get JSON-RPC -32602, as an unknown tool always does.

The graph is current. Before each call the server checks the working tree and refreshes slurp's own graph if something changed (see Keeping the graph current); the check runs in the background at startup and never holds initialize. slurp serve takes --no-refresh and --refresh-timeout, or SLURP_REFRESH / SLURP_REFRESH_TIMEOUT in the env block.

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

A ranking that reads paths and follows the query (v1.4). The semantic part compares the query with a node's name and also with the terms of its file path and of the class or module that holds it (generic ones such as src, lib or index left out), at the name's weight. The structural part is a PageRank personalised on the query: a walk that restarts at the ten best production matches and follows calls (and, since v1.5, renders) and contains both ways, computed by local push so that it only touches their neighbourhood. A query that matches nothing keeps the global PageRank. Chosen on 1,525 questions from commit history and validated once on six projects it was not chosen on — see Upgrading to v1.4.0.

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, --viz interactive 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 as slurp-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 benchmark cost 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 diff impact 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), _BaseVisitor refactor, broken-tree guard on every grammar
  • ✅ v0.8.1 — premium --viz redesign: 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: calls edges between functions, real risk levels in slurp 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, impl blocks, self receiver 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 main excluded — 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 by srv.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_explain and slurp_diff
  • ✅ v1.0.4 — --suggest: follow-up queries read off the subgraph's frontier, plus the slurp_suggest MCP tool
  • ✅ v1.0.5 — slurp impact: blast radius of editing a file before you edit it, no second snapshot needed, plus the slurp_impact MCP tool
  • ✅ v1.0.6 — Security patch: an environment API key is never sent to an endpoint from a project's .slurp/config.json; config.json is written 0600 and slurp init adds .slurp/ to .gitignore; --inject-code stays inside the project root; slurp index asks before replacing a graph graphify wrote (--force to skip); the viz works offline (vis-network vendored) and graph text can no longer break its <script>; a damaged audit.jsonl line is skipped with a warning
  • ✅ v1.0.7 — slurp index --smart always 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 is UNKNOWN, never "safe", for the eleven languages without a call graph; --backend anthropic is refused (Anthropic has no embeddings endpoint); the viz stops its physics as soon as the layout settles; projects inside a build/ or vendor/ folder index normally, and an empty index says why
  • ✅ v1.1.0 — The token budget bounds the text actually sent, measured; slurp eval --retrieval scores recall and MRR with no LLM and reports the tokens each answer costs; --token-factor for models that do not tokenize like tiktoken; one --min-score default everywhere; slurp diff rates 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 index skips the build output of web frameworks (.next/, .nuxt/, .svelte-kit/, .turbo/, .vercel/, .output/, and out/ 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 diff reads a deleted node's risk neighbourhood from the old graph, where it still exists; slurp config set adds .slurp/ to .gitignore as slurp init does; scripts/latency.py reproduces the Performance figures; the sdist ships only the package, its docs and the MIT LICENSE, 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-imports let 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 4000 in markdown 0.867 → 0.967 on PrismaStats and 0.688 → 0.875 on slurp's own graph; risk bands in slurp explain, slurp impact and slurp diff count production callers only, with tests shown apart; _is_test follows each language's test-runner conventions; scripts/retrieval.py measures recall on a fixed tuning/held-out split of the questions
  • ✅ v1.2.1 — Fixes: slurp index --smart no longer runs a full index on every run when .slurpignore excludes a whole file; every command that writes graph.json replaces it atomically, so the MCP server never loads half a graph; slurp impact's AFFECTED FILES list counts the files its headline counts; --suggest gives the same suggestions in every run; --inject-code says when it cuts a block at 100 lines; slurp index treats graphs written by v1.3 as its own
  • ✅ v1.3.0 — slurp over MCP with no intervention: the graph follows the working tree in the CLI and over MCP (a manifest in graph.json, checked before every answer in 0.4 ms, refreshed within 2 s, graphify's graphs left read-only); slurp init builds slurp's own graph, approves the server and its tools for Claude Code and tells the agent when to use them; --watch polls instead of depending on watchdog; the MCP server negotiates protocol revisions up to 2026-07-28; the session log records every call; measured with agents: 9 of 10 sessions called slurp unprompted, with no approval asked
  • ✅ v1.4.0 — A better ranking, measured: the semantic score reads a node's path and scope as well as its name, and the structural score is a PageRank personalised on the query — recall at --budget 4000 0.543 → 0.674 on six held-out projects of a 1,525-question bank from commit history, with the same tokens; warm queries 1.4–3.2× faster on all but the smallest reference graph, the first query on a freshly loaded graph up to 1.54× slower; slurp explain finds a graphify function by its name; slurp_query tells the agent when to pass 16000–32000
  • ✅ v1.5.0 — React components have dependants: a JSX usage is a renders edge and components wrapped in React's memo or forwardRef are nodes — on PrismaStats, Button goes from no node to 32 production dependants and HIGH; recall at --budget 4000 0.674 → 0.677 on the six held-out projects of the bank, none lower; the TypeScript regex fallback no longer gives one function's calls to another; graphs from v1.4 are rebuilt before the first answer; anthropic becomes the llm-anthropic extra and pathspec goes
  • ✅ v1.5.1 — Three older TypeScript call-graph fixes: an import type no longer hides the value import of the same module (#107); a name declared twice in one scope is silent on both branches instead of collecting every copy's calls, and the regex fallback keeps the edges of overloads and get/set pairs; a default import resolves only through a default import. The bank's recall does not move. Language extras install with pip or uv tool, and every install hint gives both forms

Upgrading to v1.5.1

v1.5.1 fixes three ways the TypeScript call graph lost edges or put them on the wrong node, all older than v1.5. The first query after the upgrade re-indexes a graph v1.5.0 wrote (its manifest names the version); a graphify graph is never touched. What changes:

  • An import type no longer hides the value import of the same module (#107).
    • import type { X } from "./m" written before import { Y } from "./m" (on tree-sitter, also import "./m") left no calls and no renders from that file to ./m, on both TypeScript branches.
    • Now the value import counts wherever it stands. A type-only import alone still makes no edge.
    • On the 14 projects of the question bank: 90 edges more, 83 of them in hono.
  • A name declared twice in one scope no longer collects every copy's calls.
    • tree-sitter gave all the declarations of one name the first one's node: hono declares const App 103 times in one test file, each in its own test callback, and every copy's calls and renders sat on the first.
    • Such a name is now silent, as the regex fallback has been since v1.5: no edge points at it, and the calls in its bodies go to the definition that holds them.
    • Overload signatures, a getter with its setter, and methods of different classes are not duplicates. The regex fallback used to drop every edge of function and method overloads and of get/set pairs, and now keeps them.
    • On the bank: 181 edges removed, 98 of them in one minified JavaScript bundle that caddy keeps as test data and 71 in hono's tests. Of 20 drawn and checked by hand, 14 were false and 6 were real calls of the first copy: silence costs those.
    • A gap is left: a function declared inside a const whose value is not a function (in const x = new X(function () { function f() {} })) is still read under another f's node. On the bank, 15 edges, all in that bundle.
  • A default import resolves only through a default import. After import { other } from "./m", the line import D from "./m" made D() an edge to other. That default now makes no edge. No file of the bank has it.
  • Measured on the 1,525-question bank, every parent graph re-indexed, with the criterion of v1.5 fixed again before measuring. No question's recall changes: validation stays at 0.677 and derivation at 0.737, and the labelled questions stay at 0.933 (PrismaStats) and 0.938 (slurp). Of 20 added edges drawn and checked by hand, 20 are right.
  • Language extras install with pip or uv tool. The extras table, and the hint slurp index prints when a language falls back to regex, used to give uv sync --extra …, which only works in a clone of the repository.
    • Both now give pip install "slurp-graph[ts]" and uv tool install "slurp-graph[ts]".
    • uv tool install replaces the extras of an earlier install, so name every extra in one command ("slurp-graph[ts,java]").
    • The hint names the extras of the languages that fell back. It used to name ts whatever the language: a Java project without the java extra was told to install ts.
    • The hints for a missing LLM package (slurp explain with anthropic or openai, and the openai embeddings backend) gave pip install alone. They now give both forms too, from the same place as slurp index's.
  • Nothing else changes: the same commands, flags, MCP tools and graph.json format.

Measurement records, in Spanish: design, measurement, hand check.

Upgrading to v1.5.0

v1.5.0 gives React components the dependants they have. Until v1.4 a JSX usage, <Badge />, made no edge, so in a React project almost every component read LOW in explain, impact and diff. What changes if you already use slurp:

  • JSX is a renders edge. A component of the project rendered as JSX is a renders edge from the function that renders it, under the call graph's rule: only what resolves with certainty (see slurp index for what is covered).

    • On PrismaStats's slurp index graph, the nodes of its .tsx files (imports and tests left out) read 530 LOW, 5 MEDIUM and 1 HIGH of 536 with v1.4. Now they read 540, 40 and 12 of 592, counting the new nodes.
    • Button has 32 production dependants and reads HIGH, Badge 17 and Input 13. On excalidraw, IconButton has 30.
  • Components wrapped in React's memo or forwardRef are nodes. const Button = React.forwardRef(...) was no node, so the most used components of a shadcn/ui project had nothing a usage could point at. The calls in their bodies are now theirs, not their module's. PrismaStats gains 56 nodes and excalidraw 49.

  • Your graph is rebuilt before the first answer. A graph v1.4 wrote says so in its manifest, so the first query, explain, impact or MCP call re-indexes it in full and then answers. A graphify graph is never touched.

    • slurp diff between a graph v1.4 wrote and one v1.5 writes shows the upgrade, not a change of yours. On PrismaStats: 56 nodes and 448 edges added, 16 calls moved from the shadcn/ui modules to their components, and a high impact.
    • Compare graphs built by the same version.
  • What it does to the ranking. The personalised walk follows renders like calls. This was checked on the 1,525-question bank, with every parent graph re-indexed by v1.5 and the criterion fixed before measuring: the mean recall of the six validation projects at --budget 4000 in markdown may drop at most 0.01, and no project more than 0.03. Only the projects with TypeScript move:

    Project v1.4 v1.5
    PrismaStats 0.527 0.610
    hono 0.891 0.893
    excalidraw 0.583 0.599
    prometheus 0.535 0.539
    Validation mean (6) 0.674 0.677
    • No project is lower. The ten projects without JSX give v1.4's figures question by question.
    • hono's gain comes from the regex fixes below, not from JSX.
    • On the labelled architecture questions at 4000 in markdown, PrismaStats falls from 0.967 to 0.933 and slurp stays at 0.938. PrismaStats loses one question, arch-02, which shares no word with its answer: the new nodes move the global PageRank enough to leave its module out.
  • The TypeScript regex fallback is fixed. It indexes TypeScript without the ts extra, and any file whose tree breaks (a .js file with JSX, or syntax the grammar does not know).

    • Blanking a multi-line comment or template string moved every later declaration onto the wrong line, so a function took the body and the calls of another.
    • function Page({ title }) lost its calls to the destructured parameter.
    • A name declared twice in a file sent the calls of one copy to the other.
    • Against tree-sitter, calls attributed to the wrong function went from 20 to 0 on PrismaStats and from 100 to 0 on excalidraw. Java's fallback keeps its lines too.
  • anthropic is no longer installed by default (#23). Only slurp explain with the anthropic provider needs it: pip install "slurp-graph[llm-anthropic]" (or uv tool install "slurp-graph[llm-anthropic]"). Without it, explain answers with the structural analysis and a note that names that command. pathspec, which nothing imported, is gone too (#44).

  • Indexing takes 3–4 % longer: PrismaStats 0.33 → 0.35 s, excalidraw 1.82 → 1.88 s.

  • Nothing else changes: the same commands, flags and MCP tools (their descriptions now name renders), and graph.json with one more relation.

Measurement records, in Spanish: design, bank, hand check.

Upgrading to v1.4.0

v1.4.0 changes the order in which slurp ranks nodes, so the same budget holds more of what a question needs. On six open-source projects the ranking was not chosen on, recall at the default budget went from 0.543 to 0.674 with the same number of tokens. What changes if you already use slurp:

  • A new ranking. The semantic part of a node's score reads the terms of its file path and of the class or module that holds it, at the weight of its name; until v1.3 it read the name only. The structural part is a PageRank personalised on the query — a walk from the ten best production matches along calls and contains, both ways — instead of one PageRank for the whole graph; a query that matches nothing keeps the global one. Every answer changes: the scores, the order and often the selection. In --explain, the Structural column now depends on the query.

  • How it was chosen and checked. On a bank of 1,525 questions taken from the history of 14 open-source projects (a commit's subject as the question, the definitions it changed as the answer, on the graph of its parent commit), with the release criterion fixed before measuring. Variants were compared on 7 projects (recall 0.532 → 0.725), then the one candidate was checked once on the other 6, in markdown at --budget 4000:

    Project v1.3 v1.4
    gin 0.779 0.824
    click 0.610 0.775
    ripgrep 0.421 0.587
    excalidraw 0.428 0.583
    commons-lang 0.678 0.740
    prometheus 0.344 0.535
    Mean 0.543 0.674

    The answers use the same ~98 % of the budget as before. Commit subjects are not an agent's questions, so the criterion also required the two labelled sets of architecture questions not to lose more than one question at 4000 in markdown: PrismaStats stays at 0.967 and slurp goes from 0.875 to 0.938, with no question worse.

  • What gets worse, on those labelled questions. Outside the figure the criterion fixed:

    • PrismaStats's MRR falls from 0.405 to 0.337: the first relevant node ranks lower on average, though at 4000 no question finds fewer of its labelled nodes;
    • in JSON at 4000, PrismaStats falls from 0.900 to 0.867 (the equivalent of half a question) and slurp from 0.812 to 0.750 (one question);
    • in markdown at 16000, slurp falls from 1.000 to 0.938 (one question).
  • Faster from the second query on, slower on the first. With the encoder loaded, on six reference graphs measured beside v1.3 in the same session:

    • warm queries (the median of 20) take 0.31–0.71× v1.3's time on hono, slurp, tokio, prometheus and sqlalchemy (sqlalchemy, 59,518 nodes: 278 → 87 ms); on PrismaStats, the smallest, 10.2 → 14.4 ms;
    • the first query on a freshly loaded graph takes up to 1.54× (hono: 41.9 → 64.4 ms; tokio 1.41×, prometheus 0.99×); the new ranking builds once per graph the terms of every name and path and the walk's adjacency, which is what makes every later query faster. The criterion allowed 1.5× on that first query; the author's rule, fixed before measuring again, accepts up to 1.67× on it alone when warm queries and the first query after an MCP refresh stay within their limits on all six graphs, and they do;
    • the first slurp_query after the MCP server refreshes the graph takes 1.03–1.45× v1.3's.
  • The budget costs fewer nodes, with the same output. Once the budget is nearly full, a node that cannot fit any more is told apart by a lower bound on its cost instead of being tokenized. The answers to all 1,556 bank and labelled questions are byte for byte those of the v1.4 ranking without it (markdown with cl100k_base and o200k_base; JSON, YAML and other encodings cost every node as before).

  • slurp explain finds a graphify function by its name. graphify labels functions recalcularPlayerStats() and Python methods .save(), and the name never matched that label: relevance chose. On PrismaStats's graphify graph, explain by name found the function for 85.5 % of the 337 functions whose name no other node has with v1.3, and 65.0 % with the new ranking alone; now 100 %. Labels are compared as written, then without that decoration, the same case first (so get finds get, not one of eight GET handlers). A node id still wins over every label, so a function named like its module's id — PrismaStats's middleware in middleware.ts — resolves to the module; a name shared by a function X() and a type or variable X resolves to X.

  • slurp_query says when to ask for more budget. Its description, its budget parameter and the server's instructions now say that the default answers architecture questions and that pinning down one specific function in a large project takes 16000–32000; they used to suggest 8000–12000 for broad architecture questions. See Choosing a budget.

  • Nothing else changes: the same commands, flags, MCP tools and graph.json.

Measurement records, in Spanish: design, validation, latency.

Upgrading to v1.3.0

v1.3.0 makes slurp usable over MCP with no intervention: the graph follows the working tree, in the CLI and over MCP, and slurp init sets Claude Code up to call slurp without asking for approval. No change to scoring, selection or the budget. What changes if you already use slurp:

  • The graph is always fresh, in the CLI and over MCP. The MCP server and the query commands check slurp's own graph before every answer (0.4 ms on PrismaStats) and refresh it when files changed — edits, new, deleted and renamed files, .slurpignore — rewriting graph.json within 2 s. See Keeping the graph current. Turn it off with --no-refresh or SLURP_REFRESH=0; change the 2 s limit with --refresh-timeout or SLURP_REFRESH_TIMEOUT. graphify's graphs are never touched: they are served read-only.
  • Compatibility with slurp ≤ 1.2.0. graph.json carries a manifest — a top-level "slurp" key with the files the index read (stat and content hash), the directories it walked, the ignore file and the parsers. PrismaStats's graph grows by 39 KB (0.77 → 0.81 MB). slurp ≤ 1.2.0 sees these graphs as written by another tool: its slurp index asks before overwriting one (--force skips the question). v1.2.1 already treats them as its own; it drops the manifest when it rewrites one, and v1.3.0 rebuilds it with one full index.
  • Answers may start with a warning — a refresh still running, a refresh that failed, or files a read-only graph covers that changed since it was built. The graph's state is also in each MCP answer's _meta (dev.imjuank.slurp/graph); the graph_reloaded field the server added until v1.2.1 is gone.
  • slurp index --smart needs no git for graphs with a manifest, and detects .slurpignore changes. Git and built_at_commit remain for graphs from slurp ≤ 1.2.
  • --watch without watchdog. It polls instead of listening for file-system events, and watchdog is no longer a dependency. It also sees new, deleted and renamed files and .slurpignore, and refreshes once per burst of changes.
  • slurp init with no friction. It builds slurp's own graph by default — in graphify-out/slurp-graph.json when graphify's graph is there (--keep-graphify keeps serving graphify's) — registers the server in .mcp.json, approves it and its tools for Claude Code in .claude/settings.local.json, tells the agent when to use slurp in CLAUDE.local.md (nothing is written when a CLAUDE.md or AGENTS.md already mentions slurp), and adds those files and .slurp/ to an existing .gitignore.
  • Claude Code ignores a .claude/settings.local.json that git tracks, so in a project that versions it the approval slurp init writes there does not apply and Claude Code keeps asking before it uses slurp. init says so and prints the exact command — git rm --cached .claude/settings.local.json — and leaves taking the file out of git to you.
  • Auto-discovery looks for graphify-out/slurp-graph.json before graphify-out/graph.json. A project with both now uses slurp's.
  • The MCP server negotiates the protocol revision (2024-11-05 to 2026-07-28) and answers server/discover. From revision 2025-11-25 on, invalid arguments and a budget too small come back as isError: true instead of JSON-RPC -32602; an unknown tool is still -32602. A graph that changed on disk and cannot be reloaded is answered from the previous graph with a warning, no longer as an error.
  • The server's instructions and tool descriptions are new, written for the model; only slurp_query is marked anthropic/alwaysLoad. The instructions name the argument of the two tools a client loads later — slurp_impact(file_path=...), slurp_explain(node_name=...) — and slurp_impact also accepts target and path, the names agents guessed in the measurement below (file_path wins if both are given).
  • readOnlyHint does not approve anything in Claude Code — it parallelises and retries read-only calls; approvals come from .claude/settings.local.json, which slurp init writes. The tools stay marked read-only although a call may refresh graph.json: that file is a cache derived from the code.
  • The session log changes format: one line per call to any of the five tools (failed calls included), start and end events, and slurp session --sessions. Older lines are still read; slurp session shows a Tool column.
  • .slurp/audit.jsonl records the graph's state ("graph") with each query.

Measured with agents

Before the release, ten claude -p sessions (Claude Code 2.1.331, Claude Opus 5.5) each did one task in a fresh clone set up with slurp init --yes — five on slurp itself, five on PrismaStats. No prompt mentioned slurp. Against a criterion fixed before measuring:

  • 9 of 10 sessions called slurp on their own (8 needed), all 9 before their first edit.
  • 0 approvals: no slurp tool was denied, and in an interactive session Claude Code asked for none either.
  • All 10 tasks were completed: the project's checks pass and the diff does what the task asked.

Its limits:

  • n = 10, from a single run, and the model varies from one run to the next.
  • The refresh was barely exercised. Agents call slurp when they start, before editing: 15 of the 16 calls found the graph current and one refreshed it, in 325 ms. The evidence for the always-fresh graph is verificacion.md (concurrent re-indexing, 0 half-written reads in 4,155), not this measurement.
  • The one session without slurp (sl-1) had a prompt that named both symbols to change and the component they live in. The agent grepped for them: with the names given, the task was finding them, not working out where the code lives, which is what slurp_query is for.
  • Only 4 of the 26 files edited had a slurp_impact or slurp_explain first.

Per-session table and the rest of the findings, in Spanish: conclusiones.md.

Upgrading to v1.2.1

A maintenance release: no change to scoring, selection or the budget, and no dependency changes.

  • slurp index --smart no longer runs a full index every time a .slurpignore rule excludes a whole file. It took every file on disk that no node of the graph came from for a new one, so with file:b.py two --smart runs in a row both printed 1 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 by type: or id: rules and Python files that do not parse.
  • Every command that writes graph.json replaces it atomically — slurp index, --smart, --watch and slurp init. The new graph is written next to the old one, flushed to disk and moved into place, so a reader such as slurp serve sees the old graph or the new one, never half of one. A symlinked graph.json is 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.ts said "affects 69 files" over a list that added up to 34: the headline (and affected_files in --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 tool slurp_impact too — now shows those same files, and each file's count adds its direct and transitive dependents. For CI on --output json: affected_files keeps its meaning and its values; the per-file counts are new, as dependents_per_file. The risk is still rated on direct dependents.
  • --suggest gives 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 (Badge or badge.tsx on PrismaStats). A tie now goes to a definition over the file node that holds it, then to the smallest node id.
  • --inject-code says 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 index treats graphs written by v1.3 as its own. v1.3 will add a top-level slurp key (a manifest of the files it indexed) to graph.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 (--force skips 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' readOnlyHint lets 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 MCP slurp_query and slurp_suggest, and the library's build_context / select_subgraph leave them out by default. --include-tests and --include-imports let each kind back in (include_tests / include_imports over MCP and in the library). The closing tip counts what was left out, and JSON/YAML stats carry nodes_excluded_tests / nodes_excluded_imports when 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__/ or spec/ directories, files like test_*.py, *_test.go, *.spec.ts or *Test.java, and Rust's mod tests — latest_results.py is no longer one, and neither are contests/ or lib/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 explain and slurp impact, as slurp diff already 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 in slurp 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 in slurp impact. A CI gate on slurp impact --output json sees the same change: risk_level, direct_dependents, transitive_dependents, affected_files and impact_score are production-only, and the tests move to test_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_nodes in slurp impact and told to update its tests in slurp explain, not reported as safe.
  • Import nodes are never dependants. slurp diff no longer counts the module that declared a removed import as a caller, and slurp impact no longer counts imports as definitions of the file (slurp's budget.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, as mrr_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 --budget sends 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 4000 printed about 29,000–32,000 tokens and --budget 8000 40,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 4000 prints 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 --retrieval with your own questions shows where recall stops improving. A budget too small for even the header is now an error that names the minimum (-32602 from the MCP server).
  • The default budget stays 4000, for slurp QUERY and for the MCP server's slurp_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 json or yaml use about 6000–8000 for the same recall. See Choosing a budget.
  • --backend anthropic is retired. The CLI has refused it since v1.0.7; now the library does too: score_nodes(G, query, backend="anthropic") raises ValueError instead of calling an endpoint that does not exist. Anthropic offers no embedding model. Use tfidf (the default) or openai.
  • slurp diff's impact_score is 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 now 1 − e^(−D/k), where D counts the distinct production callers the change reaches (tests and containing modules excluded), banded like slurp impact and slurp 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 comparing impact_score with a fixed number needs a new threshold. GraphDiff also carries dependents (the callers counted), unknown_nodes and risk_reason, and a low score that rests on a language with no call graph is reported as unknown.

Also visible:

  • --min-score defaults to 0.15 everywhere: the library (build_context, select_subgraph), slurp benchmark and slurp eval used 0.0.
  • JSON and YAML output carry nodes_over_budget, nodes_below_min_score and min_score in their stats; the markdown tip prints one line for each cause and no longer calls left-out nodes "connected".
  • slurp audit, slurp session and slurp advisor show no savings, session.log no longer writes savings_pct, and SimilarQuery.savings_pct is gone: they divided by a fixed cost per node. slurp benchmark measures savings, and drops its "precision" row.
  • slurp index skips _vendor/ directories and *.min.js files, and writes no _-prefixed attributes, so re-indexed graphs can shrink.

License

MIT © Juan Carlos Vallejo Ruiz

Metadata

Release files for slurp-graph 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slurp-graph 1.5.1
File Size Uploaded Provenance Actions
slurp_graph-1.5.1.tar.gz 470.7 kB Without provenance Details for slurp_graph-1.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for slurp-graph 1.5.1
File Interpreter ABI Platform Actions
slurp_graph-1.5.1-py3-none-any.whl Python 3 none any Details for slurp_graph-1.5.1-py3-none-any.whl

Total release size: 906.5 kB

Release files / slurp_graph-1.5.1.tar.gz

Download URL slurp_graph-1.5.1.tar.gz
Size 470.7 kB
Tags Source
SHA-256 checksum
How to use checksums
820d1143e06f7772fcb7286274aee92fbb84f9bca10f127e72000f6dd5d7f746
BLAKE2b-256 checksum
How to use checksums
c20a0dced2a54d9be940b4d49dd9d02f25c8e0ac1aec6392aa4befb12be0402a
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.5.1-py3-none-any.whl

Download URL slurp_graph-1.5.1-py3-none-any.whl
Size 435.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88fb2546d85fbde528eeca62c37e7945c17d15438fa28bdc517593af06d347ab
BLAKE2b-256 checksum
How to use checksums
cbe8a36eccb289137545ec0705a43e10211fcdde95ad0b686b0c7ea685e84e8c
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.5.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.

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page