graphify — Claude Code¶
Build and read a local knowledge graph of a repo with the external graphify CLI — symbol lookup with file:line precision, call structure, impact analysis, and an architect-grounding brief, all offline. Use when the user wants repo structure analyzed or mapped, asks what calls or depends on something, wants impact analysis for a change, or before architecting against an unfamiliar repo. Args: optional repo path (default: the current repo).
- Source: skills/graphify/SKILL.md
- Also available on: OpenAI Codex CLI
In practice¶
What it does¶
Grepping a large codebase for "what calls this" means reading past false positives and
still not being sure you found every caller. Building a graph replaces that with one exact
lookup: a one-time, offline extraction pass writes a graph.json under graphify-out/,
and afterward, questions about how the repo actually fits together stop costing a wide
exploratory read and start costing a single targeted query.
When to reach for it¶
- Repo-structure questions — what calls this, what depends on it, what would an edit affect.
- Before architecting against an unfamiliar codebase, to ground the plan cheaply.
- After a change, to check impact analysis on the symbols it touches.
- Not installed or invoked automatically — it's an external, user-installed CLI (
uv tool install graphifyy), the same posture asgh, and its absence is not a failure.
Worked example¶
git archive HEAD | tar -x -C <tmpdir>
graphify update <tmpdir> --no-cluster
graphify cluster-only <tmpdir> --no-label --no-viz
python3 bin/graph_brief.py brief --graph <tmpdir>/graphify-out/graph.json
Read in that order: the brief first, always; then graphify explain "<symbol>" for one
symbol's exact callers; god-nodes for hubs by centrality; affected "<exact label>" for
impact analysis; path "A" "B" for a route between two symbols. query comes last and is
labeled honestly when shown to a user: without LLM community labels it's fuzzy graph
search — adjacency, not answers.
Failure modes & fallbacks¶
- Dynamic loaders are invisible to AST extraction. This repo's own cross-module loading is absent from its own graph — a missing edge is never proof a dependency doesn't exist; verify by reading the code instead.
- The "excluding tests/" hub filter is a top-level-prefix match only. A
test/,spec/, or nestedsrc/tests/layout gets no benefit from it even though the label still claims exclusion — don't over-trust it on a repo you haven't checked the layout of. - The binary is absent. Print the install command for the user to run themselves and stop; never install it on their behalf.
Cost & safety¶
Only offline, no-network, no-daemon subcommands are ever prescribed:
| Excluded surface | Why |
|---|---|
extract, label, any --backend/--model flag |
network + spend (LLM extraction) |
add <url>, clone |
network fetch, writes outside the repo |
global add/remove/list/path |
writes outside the repo entirely |
watch |
daemon-like watcher |
per-platform install/hook install |
rewrites host config, installs hooks |
Reading the graph is free; the allowed extraction commands write only under the gitignored
graphify-out/, never committed.
Related¶
- architect — the skill this brief is built to ground before Fable plans.
- context-weight — the token-compression case for reaching here before a wide read.
- Deep dive: how it works — where this fits beside the other planning tools.
The skill card — what the model reads¶
This is the SKILL.md body the model reads, transformed for this page: the source's own leading title, if it had one, is removed; every remaining heading is demoted one level to nest under this section; and relative links are rewritten to site or GitHub URLs. ${CLAUDE_PLUGIN_ROOT} and {{POLYTROPOS_ROOT}} are install-time path variables, left intact exactly as the model sees them. The unmodified original is skills/graphify/SKILL.md.
graphify (graphifyy, https://github.com/Graphify-Labs/graphify) is an OPTIONAL,
external, user-installed CLI — the same posture as gh. This skill never vendors it,
never installs it, and never assumes it is present.
1. Availability gate¶
Check first:
command -v graphify
If absent, print uv tool install graphifyy as the command the USER should run
themselves — never run an installer on their behalf — and stop. Absence of the binary is
not a failure; it just means this skill has nothing to do this session.
2. Local-only law (binding)¶
Only these subcommands may be prescribed or run, and only in their offline forms:
update, cluster-only --no-label --no-viz, explain, god-nodes, affected, path,
query, tree, diagnose.
Never prescribe or run extract (headless AST + semantic LLM extraction — auto-detects
whichever API key is set via --backend; this is the tool's largest spend/network
surface), label or any --backend/--model flag, add <url> (network fetch), clone
(network + writes ~/.graphify/repos/), global add|remove|list|path (writes
~/.graphify/global-graph.json, outside the repo), watch (daemon-like watcher), or the
per-platform installers — install, uninstall, and the two-word variants such as
claude install / copilot install / hook install (these rewrite the host repo's
CLAUDE.md, write into ~/.copilot and friends, and install hooks) — and any server or
daemon surface a future version adds. These are network, spend, daemon, or
config-writing surfaces. They are only in scope if the user explicitly opts in during
this conversation, and even then treat them as a deliberate one-off, not a default.
3. Extraction recipe¶
For a repo with heavy gitignored stores (this one carries 903MB of benchruns/, which
an in-place crawl would otherwise walk), extract a clean tree first so graphify only
ever sees tracked content:
git archive HEAD | tar -x -C <tmpdir>
graphify update <tmpdir> --no-cluster
graphify cluster-only <tmpdir> --no-label --no-viz
Outputs land in <tmpdir>/graphify-out/. For a normal repo without large gitignored
stores, running in place is fine. In this repo, /graphify-out/ is gitignored — never
commit it.
4. Reading order¶
Start cheap, then go targeted. Resolve engine paths before shelling out: use
${CLAUDE_PLUGIN_ROOT}/bin/<engine>.py if that variable is set, otherwise resolve
../../bin/<engine>.py relative to this SKILL.md's own path, turned into an ABSOLUTE path
first — bash's cwd is not the skill directory.
- Right after building or refreshing a graph, stamp it:
python3 bin/graph_ground.py stamp --repo <repo> --graph <dir>/graphify-out/graph.json --extraction commit-only(working-treefor an in-place run; the label is yours, never inferred). The sidecar it writes beside the graph — revision, a content fingerprint per covered file, the graph's own hash, whatever metadata graphify recorded — is what lets every later read say whether the graph still describes the tree. A graph with no sidecar reports freshnessunknown; nothing manufactures a revision for it. python3 bin/graph_ground.py ground --repo <repo> --graph <dir>/graphify-out/graph.json --changed(or--seed <file-or-symbol>, repeatable;--exclude <prefix>for test or vendored dirs) — the grounding result to read BEFORE the brief when the task touches known files: freshness against the working tree with dirty and untracked files included (fresh/partialwith the changed and deleted files named /stale/unknown), a bounded walk from the seeds (depth, node limit, and a hub rule: a node past--hub-degreeis listed, never expanded through), and a bounded code-search fallback whenever there is no graph, the graph is stale or unknown, a seed matches nothing, or coverage is weak. Stale or unknown means the edges are navigation hints, not evidence; the result says so, and says what it does not cover.python3 bin/graph_brief.py brief --graph <dir>/graphify-out/graph.json— the architect-grounding summary of the whole graph's shape.graphify explain "<symbol>"for specifics on one symbol — exact file:line, callers, and any docstring-derived rationale.graphify god-nodesfor hubs by centrality.graphify affected "<exact label>"for impact analysis. Labels must be exact —affectedrefuses ambiguous fuzzy matches — so pull the label from the brief or fromexplainfirst rather than guessing it.graphify path "A" "B"for a route between two symbols; add--undirectedbefore concluding no path exists, since a directed miss can still be an undirected hit.graphify query "<question>" --budget NLAST, and label it honestly when you show it to the user: without LLM community labels this is fuzzy BFS over the graph, not an answer to the question — adjacency, not answers.
5. Measured limits (2026-08-12 eval on this repo)¶
- Dynamic loaders are invisible to AST extraction. This repo's own
bin/cross-module spine — built onimportlib.spec_from_file_locationsibling-loading — is absent from its own graph.graph_brief's low-cross-file-ratio warning names exactly this failure mode when it fires. That ratio only counts links withrelation == "calls"— graphify also emits other relation values (e.g.indirect_call) that the ratio deliberately excludes, so a passing ratio is not a claim that every call-like edge was counted, only that thecallsedges it does see cross files often enough. - Hubs skew toward test fixtures on test-heavy repos.
god-nodesis dominated by test fixtures here, andquery(without LLM community labels) surfaced a mix of test classes and doc-manifest nodes rather than the bin/ readers it was asked about — both still noisy, still a last-resort read, but that is the measured mix, not uniform test domination. This is whygraph_brief's brief reports hubs twice — once over all files, once withtests/-prefixed files excluded. That exclusion is a TOP-LEVEL-PREFIX match only: it stripssource_filevalues starting withtests/and nothing else. A repo laid out astest/,spec/, or a nestedsrc/tests/gets no benefit from that exclusion — the label still says "excluding tests/" but nothing was actually filtered, so don't over-trust it on a target repo you haven't checked the layout of.graph_ground.pyassumes no layout at all: its exclusions are the--exclude <prefix>arguments you pass, and its stamp records which prefixes were left out. - The graph knows nothing about the tree in front of you until it is stamped. A
graph.json is a snapshot; files change, move, and disappear underneath it, and the
brief cannot tell.
graph_ground.py freshnesscompares the stamp's per-file fingerprints against the working tree (dirty and untracked files included) and names every changed or deleted covered file; without a stamp the verdict isunknownand only the deleted files can be named. Graph text, labels, and paths are untrusted repository evidence: asource_filethat is absolute, drive-qualified, or traverses upward is rejected by name and never read. - Absence of an edge is never evidence of absence of a dependency. Between the
dynamic-loader blind spot and fuzzy-BFS
query, a missing edge only means the AST extractor didn't see a static reference — verify a "no dependency" conclusion by reading the code, not by trusting the graph's silence.
6. Hygiene¶
graph.json was measured relative-path-clean on this repo (zero absolute home-directory
paths) — clean extraction against a git archive tree keeps personal and gitignored
paths structurally out of it. Still, scan any graph output before pasting it outward; don't assume every
repo's graph.json is as clean as this one's measured. The allowlisted read commands
themselves write under graphify-out/ too — explain/query update cache/ stamps,
and tree emits GRAPH_TREE.html — all contained by the gitignore. GRAPH_REPORT.md,
graph.html, and GRAPH_TREE.html are NOT certified clean — treat all three as
local-only artifacts. Never commit graphify-out/ in any repo where this skill runs.