wiki-graph

wiki-graph is a command for Claude Code from Pratiyush/llm-wiki. It costs 0 tokens per session (585 once invoked), scanned A, original, MIT.

A knowledge-graph generator for a wiki. A knowledge graph shows pages as nodes and links between them as connections.

In plain words
What is it for?
It scans wiki files for double-bracket links, then creates JSON data and an optional interactive HTML graph with link counts and broken-link checks.
Why use it?
It makes the wiki's structure easier to inspect and reveals missing pages, isolated pages, and heavily connected topics.

Command for Claude Code

Part of the llm-wiki plugin — 6 skills, 18 commands 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/pratiyush/llm-wiki/wiki-graph
Clone the repo
git clone --depth 1 https://github.com/Pratiyush/llm-wiki

Made for: Claude Code.

Or install llm-wiki, the plugin that ships this one along with the rest of its 6 skills, 18 commands.

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 wiki-graph

README.md
[![agentmods](https://agentmods.dev/badge/commands/pratiyush/llm-wiki/wiki-graph.svg)](https://agentmods.dev/commands/pratiyush/llm-wiki/wiki-graph)
Your own site
<a href="https://agentmods.dev/commands/pratiyush/llm-wiki/wiki-graph"><img src="https://agentmods.dev/badge/commands/pratiyush/llm-wiki/wiki-graph.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 585 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.00000 $0.00585
Opus 5 $0.00000 $0.00293
Sonnet 5 $0.00000 $0.00117
Haiku 4.5 $0.00000 $0.00059

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

Security

Grade A, and why

wiki-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 5d 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/wiki-graph.md · 53 lines

How it starts

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

Generate a knowledge graph of the wiki — nodes are pages, edges are [[wikilinks]].

Usage: /wiki-graph [format]

$ARGUMENTS is one of: json, html, or both (default: both).

The graph tool walks every file under wiki/ looking for [[wikilink]] references, builds a node-and-edge list, and writes:

  • graph/graph.json — canonical data: {nodes: [...], edges: [...]}
  • graph/graph.html — interactive vis.js visualisation you can open in a browser

Steps

  1. Ensure the Python graph builder exists at llmwiki/graph.py. If it doesn't, create it (see "Fallback" below for a pure-agent version).

  2. Run:

    python3 -m llmwiki graph $ARGUMENTS
    
  3. Read graph/graph.json after it runs and report to the user:

    • Total node count (pages)
    • Total edge count (wikilinks)
    • Top 5 most-linked pages (entities or concepts with the highest in-degree)
    • Top 5 most-linking pages (sources with the highest out-degree)
    • Any orphan nodes (zero inbound edges)
    • Any broken edges (links to pages that don't exist) — cross-check with /wiki-lint
  4. If the user asked for html or both, offer to open graph/graph.html locally with python3 -m llmwiki serve --dir graph --port 8766.

  5. Append to wiki/log.md:

    ## [YYYY-MM-DD] graph | <N> nodes, <M> edges
    

Fallback (no graph.py)

If llmwiki/graph.py doesn't exist yet, build the graph manually using Grep and Read:

  1. grep -roh '\[\[[^]]*\]\]' wiki/ | sort -u → unique wikilink targets
  2. For each wiki page, list the wikilinks found in it (out-edges)
  3. Compute the reverse index to find in-edges
  4. Write graph/graph.json with the format:
    {
      "nodes": [{"id": "slug", "label": "Display Name", "type": "source|entity|concept", "in_degree": N, "out_degree": M}],
      "edges": [{"source": "from-slug", "target": "to-slug"}]
    }
    
  5. Write graph/graph.html — a single HTML file with an inline vis.js embed that reads graph.json via fetch().

Report the same statistics as above.

Read the full file on GitHub · 53 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. 5d ago First seen · 53 lines · 0 tokens per session scan A 0538c002c03b

Subscribe to this mod's changes

wiki-graph is a command published in the GitHub repository Pratiyush/llm-wiki (383 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 585 tokens. 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.