graph

A repository-structure map that shows how parts of a codebase relate to one another.

In plain words
What is it for?
It is for creating or refreshing a graph snapshot, reporting counts and code hotspots, and identifying dependency cycles. It can also map modules in a monorepo, which is a repository containing several related projects.
Why use it?
It gives developers a current view of the codebase instead of making them reconstruct its structure by reading files manually.

Skill for Claude CodeCodex

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 skills/drafthq/draft/graph
Any agent
npx skills add drafthq/draft --skill graph
Clone the repo
git clone --depth 1 https://github.com/drafthq/draft

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,378 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.00056 $0.01378
Opus 5 $0.00028 $0.00689
Sonnet 5 $0.00011 $0.00276
Haiku 4.5 $0.00006 $0.00138

Measured yesterday against content hash d9eaccdbc45c, 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.

skills/graph/SKILL.md · 117 lines

How it starts

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

Draft Graph

Initialize or refresh the draft/graph/ knowledge-graph snapshot for a single repository. This is the narrow "give me a fresh structural graph" command — it does not generate architecture.md/.ai-context.md and does not re-inject doc diagram slots (both are /draft:init). For scope-aware, root-first graph memory across a monorepo (root spine + module→root links), use /draft:init --graph-only.

Red Flags - STOP if you're

  • Reporting counts without actually running graph-snapshot.sh
  • Claiming the graph is built when the engine was unavailable
  • Treating an engine-unavailable result as a hard failure (it degrades gracefully)
  • Running against a path that isn't a directory

Build, then report what the tools actually returned.


Step 1: Resolve the target repo

The command takes an optional path argument: /draft:graph [path].

  • No argument → use the current directory (.).
  • With a path → use it as the repo root.
REPO="${1:-.}"
if [ ! -d "$REPO" ]; then
  echo "ERROR: '$REPO' is not a directory."
  exit 1
fi
REPO_ABS="$(cd "$REPO" && pwd)"
echo "Target repo: $REPO_ABS"

# Locate Draft's bundled helpers. Skills run with cwd = the user's project and
# ${CLAUDE_PLUGIN_ROOT} is not exported into skill Bash, so resolve DRAFT_TOOLS here
# and call helpers as "$DRAFT_TOOLS/<tool>.sh". See core/shared/tool-resolver.md.
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}/scripts/tools"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
DRAFT_SCRIPTS="${DRAFT_TOOLS%/tools}"   # parent dir holds fetch-memory-engine.sh

Step 2: Ensure the engine is present

Resolve the engine; if it is missing, fetch it once, then re-check. If it is still unavailable (e.g. offline, opted out via DRAFT_MEMORY_DISABLE), report and stop gracefully — graph features are optional everywhere in Draft.

Read the full file on GitHub · 117 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 · 117 lines · 56 tokens per session scan A d9eaccdbc45c

Subscribe to this mod's changes

graph is a skill published in the GitHub repository drafthq/draft (40 stars, last pushed 13d ago), licensed MIT. It adds 56 tokens to every session and 1,378 once invoked, about $0.0003 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-30.