Repository navigation
Description
Summary
On a mixed corpus (personal knowledge vault, ~2,266 docs + ~736 code files) with a completed full build (AST + semantic), running the bare CLI graphify update . replaced the curated merged graph with a code-weighted rebuild:
| before (full build) | after graphify update . |
|
|---|---|---|
| nodes | 29,670 | 18,536 |
| edges | 80,239 | 21,227 |
| communities | labeled (named) | 1,970 numeric |
Exit code 0, no warning that content fidelity or graph size changed. .graphify_labels.json was overwritten with numeric placeholders and GRAPH_REPORT.md regenerated against the degraded graph.
This looks like the whole-graph-scale version of #2014 (which reports the per-file semantic→heading downgrade on the same path). Filing separately because two additional failure modes are visible here:
1. The shrink guard does not engage on the watch/update write path
The #479 shrink guard refuses to shrink graph.json on the export path, and #1951 extended protection to incomplete extract runs — but the watch._rebuild_code path (which the CLI graphify update uses; all its log lines are prefixed [graphify watch]) wrote a graph 37% smaller in nodes and 74% smaller in edges without triggering anything.
The log also self-contradicts: the fail-closed message says it kept 22,816 nodes from files that left the corpus, but the final rebuilt graph has 18,536 nodes total:
[graphify watch] fail-closed: kept 22816 node(s) from 40 file(s) that left the scan corpus but still exist on disk (ignore rules or filters changed?). Run a full re-extraction to purge them if the exclusion is intentional.
[graphify] backed up curated graph (4 files) -> 2026-07-20/
[graphify watch] Skipped graph.html: Graph has 18536 nodes - too large for HTML viz (limit: 5000). Use --no-viz, raise GRAPHIFY_VIZ_NODE_LIMIT, or reduce input size.
[graphify watch] Rebuilt: 18536 nodes, 21227 edges, 1970 communities
[graphify watch] graph.json and GRAPH_REPORT.md updated in graphify-out
Code graph updated. For doc/paper/image changes run /graphify --update in your AI assistant.
2. The pre-write backup overwrites an existing same-day snapshot
The backup step writes to a date-named directory (graphify-out/2026-07-20/). A snapshot of the just-finished full build already existed there (created hours earlier the same day). The update's backup overwrote it.
In this run that was survivable only by luck: the files it overwrote the snapshot with were the same pre-update curated files, so recovery was possible. But the general shape is bad — one graphify update run can degrade the live graph and destroy the most recent independent backup in the same operation. A time-based or uniquified suffix (2026-07-20-020347/ or 2026-07-20-2/) would fix it.
Repro
- Mixed docs+code corpus; full build via the Claude Code skill (AST pass + semantic extraction through an OpenAI-compatible backend). Result: 29,670 nodes / 80,239 edges, communities labeled.
graphify update .from the corpus root (no flags).- Compare node/edge counts and
.graphify_labels.jsonbefore/after.
Environment
- graphify 0.9.19 (pip package
graphifyy, installed viauv tool install) - Windows 11 Pro, Python from the uv tool venv
- Corpus: ~4,900 files total (Obsidian-style vault + tools/ code)
Suggestions
- Apply the shrink guard (or at least a loud warning + non-zero exit) to the watch/update rebuild write, matching the fix(extract): don't force-write a partial graph over a complete one #1951 treatment of the extract path.
- On code-only rebuilds, grow-merge over the existing graph: preserve semantic nodes/edges for files that were not re-extracted, instead of replacing the whole graph (same ask as Possible silent downgrade of semantic Markdown nodes during AST-only rebuild #2014).
- Uniquify the backup directory name so a second run on the same day cannot overwrite the previous backup.
- Related context: watch._rebuild_code stamps the whole corpus into the manifest on code-only rebuilds, making --update silently skip new docs #2015 (same
_rebuild_codepath also poisons the manifest for docs).
Activity
feat(249): shrink guard on brain-mutating commands
GL-005: shrink guard on brain-mutating commands (#269)