graph

A command that builds a searchable map of a code repository, showing files and relationships between parts of the code. It can cache the map for reuse and create an optional wiki-style index.

In plain words
What is it for?
Use it to find all callers of a function or component, understand a long-lived repository before changing it, refresh the map incrementally, or inspect it as an interactive graph.
Why use it?
It reduces the time spent tracing how code is connected, especially in a large repository or monorepo, which is one repository containing multiple projects or services.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/pierry/harness-kit/graph
Clone the repo
git clone --depth 1 https://github.com/Pierry/harness-kit

Made for: Claude Code.

Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 689 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00020 $0.00689
Opus 5 $0.00010 $0.00345
Sonnet 5 $0.00004 $0.00138
Haiku 4.5 $0.00002 $0.00069

Measured yesterday against content hash 7cc45dbda102, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

graph scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/context/graph.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Build graphify knowledge graph for a long-lived target repo. Tree-sitter local for code (no API key). Adds semantic edges via LLM for docs/PDFs/images if present (--with-docs later, v2).

Inputs

  • Arg 1 (optional): target repo path (default = cwd)
  • --update: incremental refresh, merge with existing graph (cheap, fast)
  • --deep: aggressive edge inference (slower, higher fidelity)
  • --wiki: also build wiki-style markdown index

Pre-flight

Run command -v graphify. Missing → block with install hint:

graphify not installed
install: uv tool install graphifyy  |  pipx install graphifyy  |  pip install graphifyy
note:    PyPI pkg is graphifyy (double y), CLI cmd is graphify
docs:    https://github.com/safishamsi/graphify

Steps

  1. Bash: .claude/scripts/graph-repo.sh [target] [--update] [--deep] [--wiki]
  2. Script writes .claude/runtime/cache/graphify/{repo_slug}/graphify-out/
  3. Outputs graph.json (queryable), graph.html (interactive), GRAPH_REPORT.md (audit)
  4. Report cache path + open command for graph.html

When to use

  • Target repo touched by many features (e.g. main product monorepo): amortize build cost
  • Plan stage needs "find all callers of X", "where does Y live", graph query >> grep
  • PRP ## 4) Context → Repos and files touched discovery
  • ~71× token reduction on queries vs raw file reads (per graphify benchmarks)

When NOT to use:

  • One-off small repo, overkill
  • Hot repo with high commit churn, graph stales fast, use --update hook (see Hot-repo section)
  • No graphify binary in env

Reply format

Graph build complete.
  target:  {target_dir}
  slug:    {repo_slug}
  path:    .claude/runtime/cache/graphify/{slug}/graphify-out/
  view:    open .claude/runtime/cache/graphify/{slug}/graphify-out/graph.html
  report:  .claude/runtime/cache/graphify/{slug}/graphify-out/GRAPH_REPORT.md
  next:    /sse:plan + /sse:sdd will consult graph.json when present

Hot-repo: auto-update hook

For frequently-changing target repos, install graphify's git hook:

cd {target_repo} && graphify hook install

Each commit triggers graphify . --update. Graph stays fresh, harness-kit cache reads latest. Document this in target repo's CONTRIBUTING.

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 66 lines · 20 tokens per session scan A 7cc45dbda102

Subscribe to this mod's changes

graph is a command published in the GitHub repository Pierry/harness-kit (3 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 689 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.