wh:graph-link

wh:graph-link is a command for Claude Code from maxwellsdm1867/wheeler. It costs 30 tokens per session (2,047 once invoked), scanned A, original, MIT.

A command for grouping newly created graph records that have no recorded source into proposed work executions, then linking them after approval.

In plain words
What is it for?
It helps review orphan records from the current session, group them by likely origin, and add approved provenance links in Neo4j, a graph database.
Why use it?
It reduces the number of separate provenance decisions when many records came from the same work. It also avoids guessing or changing existing graph data without approval.

Command for Claude Code

Part of the wh plugin — 12 skills, 40 commands, 2 agents, 3 hooks, 5 MCP servers shipped together

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/maxwellsdm1867/wheeler/graph-link
Clone the repo
git clone --depth 1 https://github.com/maxwellsdm1867/wheeler

Made for: Claude Code.

Or install wh, the plugin that ships this one along with the rest of its 12 skills, 40 commands, 2 agents, 3 hooks, 5 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for wh:graph-link

README.md
[![agentmods](https://agentmods.dev/badge/commands/maxwellsdm1867/wheeler/graph-link.svg)](https://agentmods.dev/commands/maxwellsdm1867/wheeler/graph-link)
Your own site
<a href="https://agentmods.dev/commands/maxwellsdm1867/wheeler/graph-link"><img src="https://agentmods.dev/badge/commands/maxwellsdm1867/wheeler/graph-link.svg" alt="Measured on agentmods" height="20"></a>
Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,047 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.00030 $0.02047
Opus 5 $0.00015 $0.01024
Sonnet 5 $0.00006 $0.00409
Haiku 4.5 $0.00003 $0.00205

Measured 3d ago against content hash d9792b8c7638, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

wh:graph-link 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 3d ago.

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/wh/graph-link.md · 163 lines

How it starts

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

Connectivity Check

Before proceeding: call graph_health. If it returns "status": "offline", STOP. Tell the user Neo4j is not running and provide the remediation steps from the error response. Offer to retry after they start it. Do not continue with other work.

You are Wheeler, running a session-scoped provenance grouping pass. Your job: find orphan nodes (no WAS_GENERATED_BY link) created in the current session, group them by inferred provenance, propose Execution nodes that capture the work, and apply the links only after the scientist approves the whole batch.

This is a complement to /wh:close, not a replacement. /wh:close finds orphans and walks the scientist through one-by-one fixes; this command groups them upfront so the scientist makes one decision per logical Execution instead of N decisions per node.

Safety Rules: READ THESE FIRST

  • NEVER auto-create links. Always present the full grouped proposal and wait for approval.
  • NEVER fabricate provenance. If you cannot infer a sensible Execution from the orphan cluster, propose adding it to a "needs scientist review" group.
  • NEVER delete nodes or modify existing relationships. This command only adds.
  • Papers are never orphans. They are reference entities, not produced by Wheeler.
  • Executions are never orphans. They ARE the provenance.

Phase 1: Scope the Sweep

Determine the orphan set:

  1. Parse $ARGUMENTS:

    • --session <id>: scope to nodes with n.session_id = <id>
    • --last <hours>: scope to nodes with coalesce(n.updated, n.date) >= datetime() - duration({hours: <N>})
    • Default (no args): use --last 4 (matches /wh:close window) AND scope to current MCP session_id when known
  2. Find orphans with the corresponding Cypher (substitute parameters from args):

    MATCH (n)
    WHERE coalesce(n.updated, n.date) IS NOT NULL
      AND datetime(coalesce(n.updated, n.date)) >= datetime() - duration({hours: $hours})
      AND NOT n:Execution AND NOT n:Paper
      AND NOT (n)-[:WAS_GENERATED_BY]->(:Execution)
    RETURN n.id AS id, labels(n)[0] AS type, n.title AS title,
           n.path AS path, n.session_id AS session,
           coalesce(n.updated, n.date) AS timestamp
    ORDER BY type, timestamp
    

Read the full file on GitHub · 163 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. 3d ago First seen · 163 lines · 30 tokens per session scan A d9792b8c7638

Subscribe to this mod's changes

wh:graph-link is a command published in the GitHub repository maxwellsdm1867/wheeler (10 stars, last pushed 2d ago), licensed MIT. It adds 30 tokens to every session and 2,047 once invoked, about $0.0002 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.