Skip to content

skill: graph-health gate (Step 4.5) + anchor caches on the scan root#1437

Closed
bahcgscateringsa-design wants to merge 1 commit into
Graphify-Labs:v8from
bahcgscateringsa-design:feat/skill-graph-health-cache-root
Closed

skill: graph-health gate (Step 4.5) + anchor caches on the scan root#1437
bahcgscateringsa-design wants to merge 1 commit into
Graphify-Labs:v8from
bahcgscateringsa-design:feat/skill-graph-health-cache-root

Conversation

@bahcgscateringsa-design

Copy link
Copy Markdown
Contributor

Two integrity improvements to the core skill runbook (edited in
tools/skillgen/fragments/core/core.md, artifacts + expected/ regenerated via
python -m tools.skillgen / --bless). These are independent — happy to split,
drop, or cherry-pick either one (see note at the bottom).

1. Anchor the caches on the scan root (consistency fix)

The skill currently passes cache_root=Path('.') to AST extraction and lets
check_semantic_cache / save_semantic_cache default to . — i.e. it keys the
cache on the cwd. The CLI extract path keys on the scan root:
ast_kwargs = {"cache_root": out_root} and check/save_semantic_cache(root=out_root),
with out_root = out_dir or target. build_from_json() / save_manifest() already
take root='INPUT_PATH' in the runbook (#1361).

This change makes the runbook match the CLI: both AST and semantic caches anchor on
INPUT_PATH. Without it, running graphify from a cwd ≠ scan root cold-misses the
cache (every file re-extracts) and can even split AST vs semantic cache locations.

2. Step 4.5 — read-only graph-health gate (proposal)

graphify/diagnostics.py (diagnose_extraction / format_diagnostic_report) is a
ready integrity checker that isn't wired into the default pipeline. This adds a
read-only Step 4.5 after build / before labeling that surfaces dangling /
missing / self-loop and same-endpoint-collapsed edges — the silent-corruption modes
of incremental updates and AST/LLM id mismatches. It never aborts; it just makes
an integrity issue visible (per the Honesty Rules) instead of letting users query a
silently-broken graph.

Tests

  • Full suite: 2229 passed, 28 skipped.
  • tests/test_skillgen.py: 53 passed (check / audit-coverage / monolith-roundtrip /
    lean-core invariants all hold), tests/test_cache.py: 27 passed.

Note on scope

I know the skill is mid lean-core split. #1 is a straightforward CLI-parity fix and
stands alone. #2 adds a step to the core, which may be at odds with the lean-core
direction — totally fine to take only #1, or to treat #2 as a discussion. Tell me
how you'd like it sliced and I'll adjust.

Two integrity improvements to the core skill runbook (rendered via skillgen):

1. Graph-health gate (new Step 4.5): runs diagnostics.diagnose_extraction
   read-only after build, before labeling, and surfaces dangling/missing/
   self-loop and same-endpoint-collapsed edges — the silent-corruption modes of
   incremental updates and AST/LLM id mismatches. Never aborts.
2. Anchor the AST and semantic caches on the scan root (root/cache_root=
   'INPUT_PATH') instead of the cwd, matching the CLI extract path
   (ast cache_root=out_root, check/save_semantic_cache(root=out_root)) and
   build_from_json/save_manifest (Graphify-Labs#1361 parity). Without this, running from a
   cwd != scan root cold-misses the cache and can split AST vs semantic caches.

Source edited in tools/skillgen/fragments/core/core.md; artifacts + expected/
regenerated via 'python -m tools.skillgen' (+ --bless). Full suite green
(2229 passed); skillgen + cache suites green (80 passed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
safishamsi added a commit that referenced this pull request Jun 23, 2026
…nchor merges

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@safishamsi

Copy link
Copy Markdown
Collaborator

Merged into v8 as e7ba16b (cherry-picked). Verified all five skillgen guards pass on the PR (check / audit-coverage / schema-singleton / monolith-roundtrip / always-on-roundtrip) — the fragment was edited and artifacts regenerated/blessed correctly, and since the PR branched off current v8 it already carries the #1417/#1419 core.md fixes (no conflict, no stale artifacts). The cache anchoring is consumer-side only (passes root= into the already-shipped check_semantic_cache/save_semantic_cache), no conflict with the graphify.paths work. Step 4.5 calls a real diagnose_extraction API and never aborts. Thanks @bahcgscateringsa-design!

@safishamsi safishamsi closed this Jun 23, 2026
safishamsi added a commit that referenced this pull request Jun 23, 2026
Query perf, a skill graph-health gate, and a batch of install/extraction fixes:
- #1431 trigram query prefilter (faster, results unchanged)
- #1437 Step 4.5 graph-health gate + semantic-cache anchored on the scan root
- #1411 CUDA (.cu/.cuh) via the C++ extractor
- #1402 cross-file type-annotation refs no longer duplicate nodes
- #1403 hermes install -> %LOCALAPPDATA% on Windows
- #1409 no punctuation-only Obsidian/Canvas filenames
- #1413 opencode reminder backtick command-substitution fix
- #1428 graphify extract --cargo handles missing Cargo.toml
- #1429 prs.py F821 cleanup

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants