Repository navigation
Description
Version: graphify 0.9.47
Platform: Windows 11, Python 3.14.6
Summary
graphify extract . --code-only --force deletes every existing doc/paper/image node instead of leaving them untouched. --code-only is documented as "index code (local AST, no API key) and skip doc/paper/image files" — it describes which input files get scanned this run, not that the output graph should drop node types this run doesn't touch. Combined with --force, the result is that a single code-only forced re-extract silently discards the entire semantic layer, including any hyperedges.
The tool is aware it is discarding real data — it proactively backs the nodes up to graphify-out/backup/<date>/ — but still writes a graph.json that omits them rather than merging the backup back in.
This is distinct from #2280/#2556 (dangling edge endpoints) and from #2276 (incremental rebuild drops edges while reporting success) — here whole node classes disappear from the persisted graph, not individual edges.
Reproduction
Two files: one code, one doc.
// code.js
function helper() { return 1; }
module.exports = { helper };# Sample project
This is a short document describing the project so the semantic layer has something to extract.
The helper function does one thing: return the number 1.graphify extract . --backend claude-cliResult: 6 nodes — 2 code (code, code_helper) + 4 doc/concept (readme, readme_sample_project, readme_helper_function, readme_semantic_layer).
graphify extract . --code-only --forceConsole output includes:
[graphify extract] --force: full re-scan, semantic cache reads skipped
[graphify extract] --code-only: skipping 1 non-code file(s) (1 docs, 0 papers, 0 images) — no LLM extraction
[graphify] backed up semantic graph (4 files) -> 2026-08-20/
[graphify extract] wrote .../graphify-out/graph.json: 2 nodes, 1 edges, 1 communities
Result: 2 nodes — the code nodes only. All 4 doc/concept nodes are gone from graph.json. They exist in the timestamped backup folder, but not in the live graph any subsequent query reads from.
| Run | Nodes |
|---|---|
| Normal extract (code + docs) | 6 (2 code + 4 doc) |
--code-only --force |
2 (2 code + 0 doc) |
Why this matters in practice
Found while trying to isolate the effect of an unrelated extractor fix (#2749/#2700) on an unchanged file in a real repo. --force is documented as the tool to reach for "after refactors that delete code" — a genuinely destructive-adjacent operation is already expected there. But --code-only --force reads, at a glance, like the safe combination: "just redo the code, skip the LLM." Instead it is the most destructive flag combination in the CLI for anyone with an existing semantic layer, and nothing in the command's own output frames it that way — "skipping N non-code file(s)... no LLM extraction" reads as a cost-saving notice, not a data-loss warning.
Compare to the incremental code-only path (graphify update, and the git-hook _rebuild_code), which correctly preserves existing doc nodes for unchanged files — that behavior is what a --code-only extract intuitively promises, and it's what --force --code-only should match.
Suggested fix
On a code-only run (forced or not), merge into the existing graph rather than replacing it — keep any node/hyperedge whose file_type is outside --code-only's scope (doc/paper/image and the hyperedges connected to them) exactly as graphify update's incremental path already does. Since the tool already computes and backs up the discarded set, the merge-back is likely a small change to reuse that same backup at write time instead of only saving it.
Failing that, at minimum: warn loudly when --code-only/--force is about to drop N existing non-code nodes, so the backup isn't the only record of the loss.
Activity
fix(extract): preserve existing semantic layer on --code-only --force (…
chore: bump to 0.9.49
safishamsi commentedon Aug 24, 2026
Fixed in v0.9.49: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.49. Closing as resolved.
fix(extract): rescan code with --force --code-only (#3125)
fix(rebuild): keep a --code-only graph code-only on hook/update/watch…