name: kg-canvas description: "This skill should be used when the user asks to visualize the kg wiki, create an Obsidian Canvas, knowledge map, graph view, mindmap, community map, or invokes /kg-canvas. Exports read-only .canvas JSON views — never modifies content pages." trigger: /kg-canvas
/kg-canvas — Visual Knowledge Export
Produces .canvas JSON files that Obsidian renders natively. No plugins required.
Activate When
- User invokes
/kg-canvas [mode] [arg] - User asks for a "knowledge map", "concept map", "Obsidian Canvas", "mindmap", "community map"
- After ingest spree to visualize new structure
- Before presentation or sharing of project knowledge
Do Not Activate When
- User wants to query content →
/kg-query - User wants to analyze structure programmatically →
/kg-connector graphify CLI - Wiki is empty (no pages to visualize) → suggest
/kg-ingestfirst
Preconditions
- Wiki must be bootstrapped (
wiki/exists with content pages) - For
communitymode:graphify-out/GRAPH_REPORT.mdmust exist. If absent, suggestoverviewor[folder]mode instead - If wiki doesn't exist, tell user to run
/kg-initfirst
Modes
/kg-canvas overview
Full wiki overview. One node per page, grouped by folder/page_kind.
/kg-canvas [folder]
Single folder deep-dive. Shows pages + their wikilink connections.
/kg-canvas community [N]
Graph community N from GRAPH_REPORT.md. Nodes = community members, edges = graph edges.
/kg-canvas query "<topic>"
Focused canvas around a topic:
- BM25 lookup for the topic via
~/.claude/skills/kg/schema/tools/build_search_index.py - Include top 10 pages
- Include 1-hop wikilinks
- Include related Decision and Heuristic pages
- Write
wiki/canvas-<topic-slug>.canvas
Canvas JSON Structure (JSON Canvas 1.0)
{
"nodes": [
{
"id": "unique-id",
"type": "file",
"file": "wiki/concepts/register-pressure.md",
"x": 0, "y": 0,
"width": 400, "height": 200,
"color": "4"
}
],
"edges": [
{
"id": "edge-id",
"fromNode": "source-id",
"toNode": "target-id",
"label": "implements"
}
]
}
Color Scheme (page_kind -> JSON Canvas 1.0 preset)
- entity-page:
"1"(red) - concept-page:
"4"(green) - procedure-page:
"5"(cyan) - experience-page:
"3"(yellow) - heuristic-page:
"6"(purple) - decision-page:
"2"(orange) - source-page: omit (Obsidian default)
Auto-Layout
- Group nodes by folder (or community)
- Grid within group:
cols = ceil(sqrt(count)) - Node size: 400x200 default, scale up for high-degree nodes
- Group spacing: 600px
- Edges auto-routed by Obsidian
graphify integration (alternate visual exports when available)
graphify v0.8.x produces additional visualization/export formats from the same graph.json. All of these are bare-CLI export subcommands (Bash-callable, offline, read the existing graph — no LLM):
graphify export callflow-html # Mermaid architecture / call-flow HTML
graphify export svg # graph.svg (Notion, GitHub embed) — requires matplotlib
graphify export graphml # graph.graphml (Gephi, yEd)
graphify export obsidian # Obsidian vault export of the graph
graphify export wiki # agent-crawlable markdown wiki articles
graphify export neo4j # cypher.txt (add --push bolt://localhost:7687 to push live)
graphify export falkordb # cypher.txt (add --push falkordb://localhost:6379 to push live)
graphify export html # standalone interactive HTML
graphify tree # graphify-out/GRAPH_TREE.html (D3 v7 collapsible tree)
The /graphify <path> --svg|--graphml|--neo4j|--obsidian|--falkordb|--wiki flag spellings are just the orchestrator shorthand for the same exports (the slash form is the graphify SKILL; the --neo4j-push/--falkordb-push flag variants live there too). Two cautions about the bare CLI: (1) it has no --svg/--graphml/… flags — graphify --svg (non-path) returns error: unknown command; (2) graphify <path> --svg does NOT error and does NOT export — an existing path is rewritten to graphify extract <path>, so it runs an AST extraction and silently ignores the flag (no SVG produced). Use the export <format> subcommand spelling. graph.html is also generated by default on any /graphify <path> build.
export callflow-htmlauto-regenerates on git commit only if all three hold: the graphify hook is installed, a*-callflow.htmlwas already generated once (opt-in by existence — never created from scratch), and the commit actually changes the code graph.
/kg-canvas produces Obsidian Canvas (wiki-aware, page-level). Use the graphify exports above for code-structure-aware views.
Output Contract
Canvas export: PASS | FAIL
Mode: overview | folder | community | query
Output file: wiki/<name>.canvas
Nodes: <N>
Edges: <M>
Groups: <K>
Color-coded by page_kind: yes
Skipped:
- archived pages: <N>
- unresolved wikilinks: <N>
Confidence: high | medium | low
Caveats:
- <large graph warning if N>200 | community mode unavailable | none>
Next command:
- <none | open in Obsidian | /kg-canvas community <N>>
Exceptions and Escalation
- Wiki absent → stop and suggest
/kg-init. - Community mode requested but
GRAPH_REPORT.mdabsent → suggest/kg-updatefirst OR fallback tofoldermode. - Node count > 200 → warn the user; ask to narrow mode (folder or query) unless explicit "yes, full overview".
- NEVER modify wiki content pages. This skill writes only
.canvasfiles (which are generated views, safe to overwrite). - Existing
.canvasfile with same name → overwrite (canvases are regenerable).
Limitations
- Static snapshot. Re-run to update.
- Large wikis (>200 nodes) may be slow to render. Use folder or query mode.
- Read-only export. Does not modify wiki pages.
Quality Gates
Before final answer:
- Output file path is under
wiki/(not outside the wiki root) - No content page was modified
- Every node references an existing wiki file
- Color scheme applied per page_kind