Claude
Skills
Sign in
Back

graphify-knowledge-graph

Included with Lifetime
$97 forever

```markdown

Writing & Docs

What this skill does

```markdown
---
name: graphify-knowledge-graph
description: Build queryable knowledge graphs from code, docs, papers, and images using AI coding assistant skills
triggers:
  - "graphify my codebase"
  - "build a knowledge graph"
  - "turn my files into a graph"
  - "understand this codebase with graphify"
  - "run graphify on this folder"
  - "query the knowledge graph"
  - "install graphify skill"
  - "extract relationships from my code"
---

# graphify-knowledge-graph

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

graphify turns any folder of code, docs, papers, or images into a queryable knowledge graph. It runs as an AI coding assistant skill — type `/graphify` in Claude Code, Codex, OpenCode, or OpenClaw to extract structure, relationships, and design rationale from your files into an interactive graph you can navigate and query without re-reading raw files.

---

## Install

```bash
pip install graphifyy && graphify install
```

> The PyPI package is `graphifyy`; the CLI and skill command remain `graphify`.

### Platform-specific install

```bash
graphify install                        # Claude Code (default)
graphify install --platform codex       # Codex
graphify install --platform opencode    # OpenCode
graphify install --platform claw        # OpenClaw
```

### Always-on assistant integration (recommended)

Run once per project so your assistant consults the graph before searching files:

```bash
graphify claude install      # writes CLAUDE.md section + PreToolUse hook (Claude Code)
graphify codex install       # writes AGENTS.md (Codex)
graphify opencode install    # writes AGENTS.md (OpenCode)
graphify claw install        # writes AGENTS.md (OpenClaw)
```

Undo with the matching uninstall command:

```bash
graphify claude uninstall
```

### Manual install (curl, no pip)

```bash
mkdir -p ~/.claude/skills/graphify
curl -fsSL https://raw.githubusercontent.com/safishamsi/graphify/v3/graphify/skill.md \
  > ~/.claude/skills/graphify/SKILL.md
```

Add to `~/.claude/CLAUDE.md`:

```
- **graphify** (`~/.claude/skills/graphify/SKILL.md`) - any input to knowledge graph. Trigger: `/graphify`
When the user types `/graphify`, invoke the Skill tool with `skill: "graphify"` before doing anything else.
```

---

## Core workflow

### 1. Build the graph

```bash
# In your AI coding assistant
/graphify .                        # current directory
/graphify ./src                    # specific folder
/graphify ./raw --mode deep        # aggressive INFERRED edge extraction
/graphify ./raw --no-viz           # skip HTML, produce report + JSON only
```

### 2. Outputs

```
graphify-out/
├── graph.html       # interactive — click nodes, search, filter by community
├── GRAPH_REPORT.md  # god nodes, surprising connections, suggested questions
├── graph.json       # persistent graph — query later without re-reading files
└── cache/           # SHA256 cache — re-runs only process changed files
```

### 3. Query the graph

```bash
/graphify query "what connects attention to the optimizer?"
/graphify query "what connects attention to the optimizer?" --dfs        # trace a path
/graphify query "what connects attention to the optimizer?" --budget 1500  # cap tokens
/graphify path "DigestAuth" "Response"      # shortest path between two nodes
/graphify explain "SwinTransformer"         # expand a single node
```

---

## Key commands reference

### Building

| Command | What it does |
|---|---|
| `/graphify .` | Build graph from current directory |
| `/graphify ./folder` | Build from a specific folder |
| `/graphify ./folder --mode deep` | More aggressive INFERRED edge extraction |
| `/graphify ./folder --update` | Re-extract only changed files, merge into existing graph |
| `/graphify ./folder --cluster-only` | Rerun clustering without re-extraction |
| `/graphify ./folder --watch` | Auto-sync as files change (code: instant AST; docs: notifies you) |

### Ingesting remote content

```bash
/graphify add https://arxiv.org/abs/1706.03762          # fetch a paper, add to graph
/graphify add https://x.com/karpathy/status/...         # fetch a tweet
/graphify add https://... --author "Andrej Karpathy"    # tag original author
/graphify add https://... --contributor "Your Name"     # tag who added it
```

### Querying

```bash
/graphify query "why does the auth layer depend on redis?"
/graphify query "what implements the retry protocol?" --dfs
/graphify path "Transformer" "AdamW"
/graphify explain "DigestAuth"
```

### Exporting

```bash
/graphify ./folder --svg              # export graph.svg
/graphify ./folder --graphml          # export graph.graphml (Gephi, yEd)
/graphify ./folder --neo4j            # generate cypher.txt for Neo4j import
/graphify ./folder --neo4j-push bolt://localhost:7687   # push to live Neo4j
/graphify ./folder --obsidian         # generate Obsidian vault (opt-in)
/graphify ./folder --wiki             # build agent-crawlable wiki (index.md + per-community articles)
/graphify ./folder --mcp              # start MCP stdio server
```

### Git hooks

```bash
graphify hook install     # post-commit + post-checkout: auto-rebuild on commit/branch switch
graphify hook uninstall
graphify hook status
```

---

## Supported file types

| Type | Extensions | Extraction method |
|---|---|---|
| Code | `.py .ts .js .go .rs .java .c .cpp .rb .cs .kt .scala .php .swift .lua` | AST via tree-sitter + call graph + docstring/comment rationale (no LLM) |
| Docs | `.md .txt .rst` | Concepts + relationships + design rationale via Claude |
| Papers | `.pdf` | Citation mining + concept extraction |
| Images | `.png .jpg .webp .gif` | Claude vision — screenshots, diagrams, any language |

---

## How it works

graphify runs in **two passes**:

1. **AST pass (deterministic, no LLM):** Extracts classes, functions, imports, call graphs, docstrings, and rationale comments from code files.
2. **Semantic pass (parallel Claude subagents):** Extracts concepts, relationships, and design rationale from docs, papers, and images.

Results are merged into a **NetworkX graph**, clustered with **Leiden community detection** (topology-based — no embeddings or vector database), and exported as HTML, JSON, and a plain-language audit report.

### Edge provenance tags

Every relationship is tagged so you always know what was found vs guessed:

| Tag | Meaning | Confidence |
|---|---|---|
| `EXTRACTED` | Found directly in source | Always 1.0 |
| `INFERRED` | Reasonable inference | 0.0–1.0 score |
| `AMBIGUOUS` | Flagged for human review | — |

---

## Python API

graphify is primarily a CLI/skill tool, but the graph output (`graph.json`) is standard NetworkX JSON you can load and traverse:

```python
import json
import networkx as nx

# Load the persistent graph
with open("graphify-out/graph.json") as f:
    data = json.load(f)

G = nx.node_link_graph(data)

# Find god nodes (highest degree)
god_nodes = sorted(G.degree(), key=lambda x: x[1], reverse=True)[:10]
for node, degree in god_nodes:
    print(f"{node}: {degree} connections")

# Find all EXTRACTED edges (high confidence, found in source)
extracted_edges = [
    (u, v, d) for u, v, d in G.edges(data=True)
    if d.get("provenance") == "EXTRACTED"
]

# Find INFERRED edges above a confidence threshold
high_confidence_inferred = [
    (u, v, d) for u, v, d in G.edges(data=True)
    if d.get("provenance") == "INFERRED" and d.get("confidence_score", 0) > 0.85
]

# Shortest path between two concepts
try:
    path = nx.shortest_path(G, source="DigestAuth", target="Response")
    print(" -> ".join(path))
except nx.NetworkXNoPath:
    print("No path found")

# Get all nodes in a community
communities = {}
for node, data in G.nodes(data=True):
    community_id = data.get("community")
    if community_id is not None:
        communities.setdefault(community_id, []).append(node)

for cid, members in sorted(communities.items()):
    print(f"Community {cid}: {', '.join(members[:5])}{'...' if len(members) > 5 else ''}")
```

### Wo

Related in Writing & Docs