Render the project knowledge base as an architecture diagram (Mermaid or DOT/SVG) from graph.jsonl, with optional push to connected diagramming MCPs.
/kb-diagram [--format=mermaid|dot] [--output=PATH] [--no-ingest] [--push <adapter>|auto] [--help]
Also triggers on the phrases “architecture diagram”, “kb architecture”, “knowledge diagram”, or “diagram knowledge” if you’d rather describe the task than type the command.
.claude/knowledge/shared/ — how conventions, domain rules, and patterns connect/calibrate run, to review the knowledge base at a glance.claude/wikis/ (wiki-knowledge-base); or diagramming your application code/kb-diagram
What you’ll see: the knowledge graph is (re)ingested from your KB files, then a Mermaid diagram is written to .claude/knowledge/diagrams/kb-architecture.mmd, clustered by node type with a legend.
/kb-diagram # Mermaid output (default) → .mmd
/kb-diagram --format=dot # DOT source → .dot; SVG too if `dot` is installed
/kb-diagram --output=my-kb # override the output file basename
/kb-diagram --no-ingest # skip re-indexing, use existing graph.jsonl
/kb-diagram --push auto # push to the first connected diagramming MCP
| Flag | Values | Default | What it does |
|---|---|---|---|
--format |
mermaid, dot |
mermaid |
Output format; dot also renders SVG when Graphviz is on PATH |
--output |
path | kb-architecture |
Override the output file basename |
--no-ingest |
— | off | Skip the knowledge-graph re-index, render from the existing graph.jsonl |
--push |
<adapter>, auto |
off | Push the diagram to a connected diagramming MCP; auto detects the first one |
--help |
— | — | Show usage |
.claude/knowledge/shared/*.md files into the knowledge graph (graph.jsonl), unless --no-ingest is set.--push, sends the diagram to a connected diagramming MCP server; --push auto reports what’s detected.A PostToolUse hook also re-renders the diagram automatically in the background whenever you save a .claude/knowledge/shared/*.md file — no watch flag needed.
| Path | When |
|---|---|
.claude/knowledge/diagrams/kb-architecture.mmd |
--format=mermaid (default) |
.claude/knowledge/diagrams/kb-architecture.dot |
--format=dot |
.claude/knowledge/diagrams/kb-architecture.svg |
--format=dot and Graphviz dot on PATH |
| Problem | Fix |
|---|---|
KB directory .claude/knowledge/shared/ not found (exit 2) |
Run /calibrate first to create the project knowledge base |
Knowledge graph has 0 nodes (exit 3) |
Add ## / ### headings to your KB files — headings become graph nodes |
| Required dependency missing (exit 4) | Install jq and/or python3 |
--push finds no adapter |
The target MCP server must be connected in ~/.claude.json or project .mcp.json; run --push auto to see what’s detected |
No SVG produced with --format=dot |
Install Graphviz so dot is on PATH; the .dot source is still written |
Note: --filter and --depth flags for very large KBs (> 40 nodes) are not yet implemented.