Skip to content

Turn any codebase, with its docs, SQL schemas, configs, and PDFs, into a queryable knowledge graph. A /graphify skill for Claude Code, Cursor, Codex, and Gemini CLI: local deterministic AST parsing, every edge explained, no vector store.

fix worktree hook crash, prune isolated code nodes, restore rationale-node prohibition

Safi91f4d120b630
diff --git a/graphify/build.py b/graphify/build.py
index 0975d7a50..ca3c0f8f2 100644
--- a/graphify/build.py
+++ b/graphify/build.py
@@ -28,6 +28,15 @@ def build_from_json(extraction: dict) -> nx.Graph:
hyperedges = extraction.get("hyperedges", [])
if hyperedges:
G.graph["hyperedges"] = hyperedges
+ # Strip degree-0 code nodes — they are bundled/synthetic symbols with no
+ # connections and only inflate god-node centrality and clustering noise.
+ # Document, paper, and image nodes are kept even when isolated since they
+ # may be leaf concepts intentionally referenced by the skill.
+ isolated_code = [
+ n for n in list(G.nodes())
+ if G.degree(n) == 0 and G.nodes[n].get("file_type") == "code"
+ ]
+ G.remove_nodes_from(isolated_code)
return G
diff --git a/graphify/hooks.py b/graphify/hooks.py
index 0c86f969a..f66c60cc3 100644
--- a/graphify/hooks.py
+++ b/graphify/hooks.py
@@ -75,8 +75,21 @@ def _hooks_dir(root: Path) -> Path:
return p
except (OSError, FileNotFoundError):
pass
+ # In a linked worktree .git is a file not a directory, so we ask git
+ # for the real hooks path rather than constructing it ourselves.
+ try:
+ result = subprocess.run(
+ ["git", "-C", str(root), "rev-parse", "--path-format=absolute", "--git-path", "hooks"],
+ capture_output=True, text=True,
+ )
+ if result.returncode == 0:
+ d = Path(result.stdout.strip())
+ d.mkdir(parents=True, exist_ok=True)
+ return d
+ except (OSError, FileNotFoundError):
+ pass
d = root / ".git" / "hooks"
- d.mkdir(exist_ok=True)
+ d.mkdir(parents=True, exist_ok=True)
return d
diff --git a/graphify/skill.md b/graphify/skill.md
index 865b34297..c9683689f 100644
--- a/graphify/skill.md
+++ b/graphify/skill.md
@@ -195,7 +195,10 @@ Rules:
Code files: focus on semantic edges AST cannot find (call relationships, shared data, arch patterns).
Do not re-extract imports - AST already has those.
-Doc/paper files: extract named concepts, entities, citations.
+Doc/paper files: extract named concepts, entities, citations. For rationale (WHY decisions were made,
+ trade-offs, design intent): store as a `rationale` attribute on the relevant concept node — do NOT
+ create a separate rationale node. Valid `file_type` values are ONLY `code|document|paper|image` —
+ never emit `file_type:"rationale"` or `file_type:"concept"`.
Image files: use vision to understand what the image IS - do not just OCR.
UI screenshot: layout patterns, design decisions, key elements, purpose.
Chart: metric, trend/insight, data source.