Skip to content

/wiki-graph

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

From plugin
llmwiki
40018 skills18 commands
> /plugin marketplace add Pratiyush/llm-wiki
> /plugin install llmwiki@llmwiki

Command definition

wiki-graph.md

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 more
@pratiyush
Ships withllmwiki

LLM-powered knowledge base from your Claude Code, Codex CLI, Cursor, Gemini CLI, and Obsidian sessions. Built on Andrej Karpathy's LLM Wiki pattern.

Stars on GitHub

Momentum

stars in total
400
Star history of Pratiyush/llm-wiki on GitHub, a chart by star-history.com

Other commands on llmwiki.

maintainer
Auto-invoked

maintainer

Command

Meta-skill that loads all llmwiki governance docs and exposes the three maintainer slash commands.

@pratiyush@pratiyushInstall Command
review-pr
Auto-invoked

review-pr

Command

Run the canonical llmwiki code review against a pull request and post findings.

@pratiyush@pratiyushInstall Command
triage-issue
Auto-invoked

triage-issue

Command

Apply labels + milestone + priority to a new issue using the llmwiki triage rules.

@pratiyush@pratiyushInstall Command
wiki-all
Auto-invoked

wiki-all

Command

Run the full llmwiki pipeline end-to-end: build → graph → export all → lint.

@pratiyush@pratiyushInstall Command

More commands from other plugins.