Repository navigation
Description
Summary
The skill's only existing-graph check (top of SKILL.md) is "does graphify-out/graph.json exist," used to decide whether to take the query-only fast path. For a git-tracked corpus, this has two blind spots:
- Staleness:
graph.jsoncarries abuilt_at_commitfield, but nothing compares it against the corpus's currentHEADbefore trusting an existing graph (fast path) or before starting a fresh build. A graph built at an old commit can be materially wrong — missing entire subsystems added since — while still passing every other health check. - Interrupted runs: if a prior invocation reached Step 4 (graph built, report generated) but stopped before Step 5/6/9 (labeling, HTML export, cleanup), the
graphify-out/directory is left with orphaned.graphify_chunk_*.json/.graphify_extract.json/ etc. temp files and a report full of genericCommunity Nlabels. Nothing in the skill detects or surfaces this state; a subsequent run (or a human) has to notice by inspection.
What happened
I found exactly this: an existing graphify-out/ with a fully-formed graph.json and GRAPH_REPORT.md, generic community labels, no HTML, and five leftover .graphify_*.json temp files. built_at_commit pointed to a commit from before a significant amount of subsequently-merged work — the existing graph was silently missing an entire subsystem. Diagnosing this took several manual steps (checking built_at_commit against git log, checking for an active writer process via lsof/ps, inspecting the detect.json file-type breakdown) that the skill gave no guidance for.
I chose to discard the existing state and rebuild fresh in an isolated worktree rather than trust or resume it, given the ambiguity.
Proposed fix
- At the top of
SKILL.md, before the fast-path check: if the corpus root is a git repository, comparegraph.json'sbuilt_at_commitagainstgit rev-parse HEAD(or the working tree's dirty state). If they differ, do not silently take the fast path — surface the staleness and suggest--updateor a rebuild. - If
graphify-out/contains leftover.graphify_chunk_*.json/.graphify_extract.json/.graphify_ast.json/.graphify_semantic.json/.graphify_analysis.jsonat the start of a new invocation (i.e. before this run created them), that's diagnostic of an interrupted prior run. Surface this explicitly rather than letting Step 1-3 silently overwrite or ignore them. - This matters more than it might look: any workflow where multiple processes/sessions could plausibly invoke
/graphifyagainst a shared working directory (CI, multi-agent fleets, a team repo) will hit this.
Activity
hopstreax commentedon Aug 18, 2026
Sparrow-56 commentedon Aug 29, 2026
Hit this independently on 0.8.39 (AST-only build, git corpus). Two refinements on top of the state machine in the comment above, both from the shape of the failure I actually got.
1.
STALEis two states, and the remedies differA comparison of
built_at_commitagainstHEADcatches staleness but flattens two situations that need different handling:built_at_commitis an ancestor ofHEAD, N commits back. A valid older view of this line of development. Incremental--updateis the right remedy.built_at_commitis not an ancestor ofHEAD. The graph was built on a branch that diverged — in my case, one that was abandoned and never merged. This is not an older view of the current tree, it is a view of a different tree.Mine was the second. The graph sat in the repo for five weeks pointing at a commit from a dead feature branch. Every existence check passed, and the content it described was work that never landed.
Worth splitting out as its own state (
DIVERGENT?) rather than folding intoSTALE, because I don't think--updaterecovers it: given #2908 (--updateleaves stale nodes when files leave scan scope) and #2418 (post-merge phantom nodes are never healed), an incremental pass over a divergent graph seems likely to leave symbols from the abandoned branch behind. That case probably needs a full rebuild. Would be good to know whether the maintainers agree — if--updatecan reconcile it, this collapses back into one state and the point is moot.The test is one command:
git merge-base --is-ancestor "$built_at_commit" HEADbuilt_at_commitvsHEADFRESHFRESH(report the lag)--updateSTALE--updateDIVERGENTUNVERIFIABLE2.
GRAPH_REPORT.mdis a second consumer, and it currently prints the check instead of running itThe comment above integrates the state check into "the skill's existing-graph fast path." Worth confirming the report generator moves with it, because every generated
GRAPH_REPORT.mdcurrently contains:The generator has
built_at_commit, is running in the corpus, and emits a two-command comparison for the reader to perform by hand — then doesn't perform it.In practice nobody performs it. This file is read by an agent, and an agent reading line 2 has no reason to treat "run this and compare" as a precondition rather than as prose. That is exactly how mine went unnoticed: the report told every reader how to detect the problem, in the same section that contained the answer.
Since the generator already holds both values, it could emit the verdict instead of the instructions:
Note this is not #2696 or #2534 —
built_at_commitis stamped correctly in my case. The field is right; nothing consumes it.For what it's worth, I worked around this outside the tool, with a
PreToolUsehook that runs themerge-basecheck and declines to endorse the graph when it fails. That works, but it means every user has to reimplement the check in their own hook config against a field the tool already writes — which is the argument for #2841 landing.munishjindal931 commentedon Sep 10, 2026
A third case for the state table in the comment above: commit identity is the wrong predicate when
graphify-out/is tracked inside the corpus it indexes.Every row of that table compares
built_at_committoHEADby ancestry. That holds when the graph lives outside the tree. Whengraphify-out/is committed — the only way the graph shows up in review diffs — the index can never name its own commit: committing the rebuilt graph movesHEADone past the stamp it just wrote. The stamp is therefore permanently an ancestor, and that lag is structural rather than evidence of anything.Concretely, on 0.9.54 with a tracked
graphify-out/and the convention of a separate reindex commit:Against the table that classifies as
ancestor, ≤ N commits→FRESH (report the lag)— the right verdict for the wrong reason, and it decays. Both commits between those two SHAs touched nothing butgraphify-out/(a reindex and a label refresh), and a repo whose post-commit hook reindexes routinely accumulates them without bound, pushing the count past any fixedNintoSTALEwith no source having changed. There is no correctN, because the quantity being thresholded is not a measure of staleness.The fix is to stop asking about commits and ask about content:
Exit 0 is fresh. Three properties the ancestry check doesn't have:
HEAD-to-HEADcomparison misses that entirely — the first comment lists "relevant dirty-worktree changes" as a separate concern, and this collapses it into the same command. Verified both ways: appending a line to a tracked source file flips it to stale, reverting flips it back.DIVERGENT. On a divergent branch the diff is non-empty, so it reports stale with nomerge-basecall. Keepinggit merge-base --is-ancestoris still worthwhile to name that state, since divergence wants a full rebuild rather than--update— but as a classifier applied after the freshness verdict, not as the verdict itself.On
GRAPH_REPORT.mdprinting the check rather than running it: agreed, and worth noting the printed check carries this same defect, so emitting a verdict fixes both halves at once. I've patchedreport.pylocally to emit the source-scoped command instead of therev-parseinstruction, which is the shape I'd suggest, but it belongs inside whatever state-machine work lands here rather than as a change of its own.One caveat against my own suggestion: the exclusion is
graphify-outby convention andGRAPHIFY_OUTby configuration, but a graph written elsewhere via--outis covered by neither at report time. Deriving the excluded path from the actual output directory would be more robust than reading the env var.