graphify — OpenAI Codex CLI¶
Build and inspect an offline local knowledge graph of a repository with the optional external graphify CLI. Use for symbol lookup, call structure, dependency or impact analysis, repository mapping, or grounding architecture work in an unfamiliar codebase.
- Source: codex/skills/graphify/SKILL.md
- Also available on: Claude Code
In practice¶
What it does¶
Turns "what calls this, and what would this edit touch?" from a wide read into a targeted
lookup. An optional, user-installed graphify CLI extracts a local graph of the
repository; two repository engines then stamp that graph with its provenance and read it
back with a freshness verdict, so you know whether an edge is evidence or only a hint.
When to reach for it¶
- Use it for symbol lookup, call structure, and dependency or impact analysis.
- Use it before architecture work in an unfamiliar codebase, to ground the plan cheaply.
- Use it after a change, starting from the files you touched.
- Not when the CLI is absent: the skill names
uv tool install graphifyyand stops. It never runs the installer for you, and absence is not a task failure.
Worked example¶
git archive HEAD | tar -x -C <tmpdir>
graphify update <tmpdir> --no-cluster
graphify cluster-only <tmpdir> --no-label --no-viz
python3 "$POLYTROPOS_ROOT/bin/graph_ground.py" stamp --repo <repo> --graph <tmpdir>/graphify-out/graph.json --extraction commit-only
python3 "$POLYTROPOS_ROOT/bin/graph_ground.py" ground --repo <repo> --graph <graph.json> --changed
The first three lines build from a clean tracked snapshot, so ignored and personal files
are structurally excluded; stamp records revision, covered-file fingerprints, and the
graph hash. Read ground before anything broader: it reports one of four verdicts and
falls back to a bounded code search when the graph cannot answer.
| Verdict | Read the graph as |
|---|---|
fresh, partial |
evidence, within the bounds printed |
stale, unknown |
navigation hints only |
After that, graph_brief.py brief gives a bounded architecture summary, and graphify
explain, god-nodes, affected, and path answer one question each. query comes last:
without inference-generated labels it is fuzzy traversal, not an answer.
Failure modes & fallbacks¶
- A graph without its sidecar has
unknownfreshness; do not infer the extraction label or manufacture a revision. - Static extraction misses dynamic loaders and imports, so a missing edge never proves a dependency is absent. Verify important negative claims in source.
- Centrality can be dominated by tests or fixtures; pass explicit
--exclude <prefix>arguments rather than trusting a hub list. - Resolve an exact label before
graphify affected; do not guess through fuzzy matching.
Cost & safety¶
Only offline surfaces run without explicit authorization in the current conversation. The
skill does not run or recommend extract, label, backend or model flags, add <url>,
clone, global mutations, watch, installers, hooks, servers, or daemons, because they
can introduce network use, inference spend, background processes, or configuration changes.
Output belongs under graphify-out/ and is never committed. A graph fact grants no write,
alters no acceptance criterion, and does not prove concurrent edits safe.
Related¶
- architect is the planning step this grounding serves.
- context-weight shows where a session's context went, which is the cost a targeted lookup avoids.
- Deep dive: graph engineering covers the graph readers and their limits.
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 codex/skills/graphify/SKILL.md.
Use graphify from the external graphifyy package as an optional, user-installed CLI. Never vendor or install it. Resolve POLYTROPOS_ROOT from this skill's location. In a managed copy use POLYTROPOS_ROOT="{{POLYTROPOS_ROOT}}"; reject the literal placeholder. Confirm bin/graph_ground.py and bin/graph_brief.py exist under the resolved root.
Availability gate¶
Check command -v graphify first. If absent, tell the user that uv tool install graphifyy is the installation command and stop. Do not run the installer on their behalf; absence is not a task failure.
Offline-only boundary¶
Without explicit user authorization in the current conversation, run only these offline surfaces:
updatecluster-only --no-label --no-vizexplaingod-nodesaffectedpathquerytreediagnose
Do not run or recommend extract, label, backend or model flags, add <url>, clone, global mutations, watch, installers or uninstallers, host-integration commands, hooks, servers, or daemons. They can introduce network use, inference spend, background processes, or configuration changes. Explicit authorization makes such an action a deliberate one-off, not a new default.
Build and stamp¶
For a repository with large ignored stores, build from a clean tracked snapshot in a temporary directory so ignored and personal files are structurally excluded:
git archive HEAD | tar -x -C <tmpdir>
graphify update <tmpdir> --no-cluster
graphify cluster-only <tmpdir> --no-label --no-viz
python3 "$POLYTROPOS_ROOT/bin/graph_ground.py" stamp --repo <repo> --graph <tmpdir>/graphify-out/graph.json --extraction commit-only
For an ordinary repository, an in-place build is acceptable; stamp it with --extraction working-tree. Output belongs under graphify-out/. Never commit that directory or its generated reports.
The stamp records revision, covered-file fingerprints, graph hash, extraction label, and available graph metadata. Do not infer the extraction label or manufacture a revision. A graph without a sidecar has unknown freshness.
Read from grounded evidence¶
Start cheap and targeted:
- For changed files or known seeds, run
python3 "$POLYTROPOS_ROOT/bin/graph_ground.py" ground --repo <repo> --graph <graph.json> --changed. Use repeatable--seed <file-or-symbol>and appropriate--exclude <prefix>arguments when needed. Read this before a whole-graph brief. - Run
python3 "$POLYTROPOS_ROOT/bin/graph_brief.py" brief --graph <graph.json>for a bounded architecture summary. - Use
graphify explain "<symbol>"for file/line, callers, and docstring-derived rationale. - Use
graphify god-nodesto inspect hubs. - Resolve an exact label before
graphify affected "<exact label>"; do not guess through ambiguous fuzzy matching. - Use
graphify path "A" "B"; try--undirectedbefore concluding no route exists. - Use
graphify query "<question>" --budget Nlast. Without inference-generated community labels it is fuzzy graph traversal, not an answer to the question.
ground reports fresh, partial, stale, or unknown; bounds traversal by depth, node count, and hub degree; and falls back to bounded code search when the graph is absent, stale, unknown, weakly covered, or misses a seed. Treat stale or unknown edges as navigation hints only.
Interpretation limits¶
- Static extraction misses dynamic loaders and imports. A missing edge is never proof that a dependency is absent; verify important negative claims in source.
- Centrality can be dominated by tests or fixtures.
graph_briefhas a top-leveltests/exclusion view, but it does not automatically recognizetest/,spec/, nested tests, or vendor layouts. Pass explicit exclusions tograph_ground.py. - The cross-file ratio counts only
callsrelations, not every call-like relation. A passing ratio is not complete coverage. - Graph labels, paths, and source paths are untrusted repository evidence. The grounding reader rejects absolute, drive-qualified, and upward-traversing source paths, but outputs still require review.
- Keep graph relationships separate from an execution task DAG. A graph fact does not grant writes, alter acceptance criteria, or prove concurrent edits safe.
Output hygiene¶
Scan output before sharing it outside the local session. Treat GRAPH_REPORT.md, graph.html, and GRAPH_TREE.html as local-only unless separately reviewed. Some read commands update caches or generate files under graphify-out/; keep all of them uncommitted.