graphify icon indicating copy to clipboard operation
graphify copied to clipboard

fix: graphify install --project ships older references/query.md (103 lines, no Step 0 vocab expansion) vs graphify vscode install (249 lines)

Open burrows99 opened this issue 5 months ago • 2 comments

Summary

graphify install --project and graphify vscode install ship different versions of references/query.md in v0.8.37. The project-scoped install (used by Claude Code) gets an older, shorter file that is missing the critical Step 0 constrained vocabulary expansion. The vscode install gets the correct, full version.

This means Claude Code - the primary platform - silently runs inferior query logic compared to VS Code Copilot Chat.

Environment

  • macOS Apple Silicon
  • graphifyy 0.8.37 (installed via uv tool install graphifyy)
  • Claude Code (project-scoped skill via graphify install --project)
  • VS Code Copilot Chat (global skill via graphify vscode install)

Repro

uv tool install graphifyy
cd /path/to/any-project
graphify install --project       # Claude Code
graphify vscode install          # VS Code
wc -l .claude/skills/graphify/references/query.md        ~/.copilot/skills/graphify/references/query.md

Actual

103 .claude/skills/graphify/references/query.md
249 /Users/<user>/.copilot/skills/graphify/references/query.md

The 103-line file shipped to Claude Code is missing:

  • Step 0 - Constrained query expansion (the section marked REQUIRED before traversal)
  • Graph vocabulary extraction (the import json, re block that builds .vocab.txt)
  • The token-selection constraints (pick only tokens present in graph vocab, no invented synonyms)
  • The auditable expansion printout before traversal

Instead it has a naive fallback: [t.lower() for t in question.split() if len(t) > 3] - plain word split with no graph-vocabulary grounding.

Expected

Both graphify install --project and graphify vscode install should ship the same references/query.md. The 249-line version with Step 0 vocab expansion is the correct one.

Why it matters

The vocab expansion step is what makes graphify query useful for natural-language questions. Without it, the CLI latches onto the wrong start node (e.g. querying "how does chat streaming work" starts BFS from the Chat() UI component instead of streamText/useChat/DataStreamHandler) and returns 100+ noisy nodes with no useful signal.

The result is that Claude Code users - who are using the project-scoped install path - get systematically worse query results than VS Code Copilot users from the same graph, despite identical underlying data. This makes the tool appear broken when it is not.

Verified on

Tested on a 757-file, 11 634-node TypeScript/Next.js repo (graphify 0.8.37). After manually copying the 249-line query.md from the VS Code skill location to the Claude Code skill location, query quality improved significantly for natural-language flow questions (e.g. auth, MCP integration, artifact creation).

burrows99 avatar Jun 11 '26 08:06 burrows99

Fix submitted in PR #1256: https://github.com/safishamsi/graphify/pull/1256

One-file change - syncs graphify/skills/claude/references/query.md (103 lines) with the 249-line version already shipped to all 13 other platforms. PR targets v8 and closes this issue on merge.

burrows99 avatar Jun 11 '26 08:06 burrows99

Related MCP-surface angle on the same expansion gap (graphify v0.9.22).

On 0.9.22 the shipped references/query.md does include Step 0, so the CLI skill path looks fixed here. But agents that call the graphify --mcp query_graph tool directly (e.g. graph-first subagents) bypass Step 0 entirely — the MCP server has no LLM to run the constrained expansion. Same symptom you describe: query_graph("WhatsApp wa.me link generation") started BFS from unrelated LinkPlan / link-claim-guide-appointment.ts and returned 22–82 noisy nodes; the correct agenda-confirmation.ts neighborhood (confirmationTemplate / phoneDigits) never surfaced. Running the CLI with vocab-expanded tokens (confirmation phone link template digits) ranked those #1/#2 immediately.

Since the MCP server can't run the LLM step, two deterministic helpers would harden that path independent of any consumer:

  1. camelCase / morphology-aware matching in the matcher itself.
  2. Drop the 3-char floor for camelCase sub-tokens. waMeLink tokenizes to wa / me / link; the first two are discarded at vocab-build (3 <= len(t) <= 30), so the function is only reachable via the very-low-IDF link. Short-but-meaningful sub-tokens get silently eaten.

Consumer-side expansion before the MCP call is the other half, but (1)+(2) would help every MCP consumer without one.

rilkerfc avatar Jul 21 '26 17:07 rilkerfc