Prompt file imported from jepegit/cellpy (
.cursor/commands/build.md). Copyright stays with the author.
Rebuild the project's knowledge graph (/build)
/build rebuilds the graphify knowledge graph for this project so the assistant can navigate by graph instead of grepping through files. Outputs land in graphify-out/ (graph.html, GRAPH_REPORT.md, graph.json).
This is an off-path command — the lifecycle dispatcher (/iflow) never auto-runs it. Invoke it explicitly when the project's structure has changed enough that the existing graph is stale (new modules, large refactors, new docs/papers added).
Input
Optional free-form text after the command. The first word, if it is a recognized graphify build subcommand, picks the action; otherwise the default is update. Trailing tokens forward verbatim. Common combinations:
- No extra text — AST-only build (
graphify update <project>). No LLM API key required, so this works on a fresh machine. Produces the fullgraphify-out/(graph.json, graph.html, GRAPH_REPORT.md). The default. extract— AST + semantic LLM pass (graphify extract <project>). Richer cross-file relationships, but requires an LLM backend: setGEMINI_API_KEY/GOOGLE_API_KEY,ANTHROPIC_API_KEY,OPENAI_API_KEY, orMOONSHOT_API_KEY— or pass--backend ollamafor a local LLM via Ollama. Use after large refactors or when the AST-only graph misses important relationships.watch— long-running file watcher that auto-rebuilds on save (graphify watch <project>).cluster-only— rerun clustering on the existinggraph.jsonwithout re-extraction (graphify cluster-only <project>)../subdir— scan a sub-directory instead of the project root (graphify update ./subdir).- Trailing flags (e.g.
--force,--no-cluster,--no-viz,--backend ollama) — passed straight through to the chosen subcommand. Seegraphify --helpfor the per-subcommand flag set.
See the graphify CLI reference for the full subcommand and flag list.
Steps
-
Preferred path:
issue-flow build. From the project root, run:issue-flow buildThis runs
graphify update .— no API key needed. To pick a different subcommand or pass flags, append them, e.g.issue-flow build extract(full LLM pass),issue-flow build cluster-only --no-viz, orissue-flow build extract --backend ollama(local LLM). To scan a project other than the current directory, useissue-flow build -C <project_dir>. Extra args are forwarded verbatim. -
Fallback: call
graphifydirectly ifissue-flowis not on PATH:graphify update .graphifyis subcommand-based —graphify .on its own is not valid and will fail withunknown command '.'. Always pick a subcommand (update,extract,watch,cluster-only, …). -
Verify outputs. After a successful run there should be a
graphify-out/folder with at leastgraph.html,GRAPH_REPORT.md, andgraph.json. SkimGRAPH_REPORT.mdonce to confirm the run picked up new modules or docs. -
If
graphifyis not installed (issue-flow buildexits with a "not on PATH" error), suggest the user install it:uv tool install graphifyy # recommended pipx install graphifyy pip install graphifyygraphifyy(double-y) is the official PyPI package; the CLI is stillgraphify. After installing, re-runissue-flow init(orissue-flow update) sographify cursor installregisters the graphify Cursor skill. -
If
graphify extractcomplains about a missing LLM API key, the user picked the semantic-pass subcommand without configuring a backend. Suggest one of:- Set an API key for one of the supported backends (
GEMINI_API_KEY/GOOGLE_API_KEY,ANTHROPIC_API_KEY,OPENAI_API_KEY,MOONSHOT_API_KEY) and re-run. - Use a local LLM:
issue-flow build extract --backend ollama(requires Ollama installed and a model pulled, e.g.ollama pull qwen2.5-coder). - Drop the
extractarg and use the defaultissue-flow build(AST-onlyupdate, no LLM).
Cursor's own LLM is not available to subprocesses, so graphify cannot reuse it.
- Set an API key for one of the supported backends (
Constraints
- Do not run
/buildautomatically from/issue-start,/issue-close, or/iflow. The user opts in. - Do not commit
graphify-out/cost.jsonorgraphify-out/manifest.json; both are local-only. The graph itself (graph.json,graph.html,GRAPH_REPORT.md) is fine to commit so teammates start with a map. - Long-running modes (
watch) keep the process running; ask the user before launching them in an agent context.
Output to user
Report:
- whether the build ran (or was skipped because graphify is missing)
- the exit code from
graphify - the size / mtime of
graphify-out/graph.json(rough freshness check) - a short summary of new highlights from
GRAPH_REPORT.mdif the user asked for one
