Skip to content

feat(skill): progressive-disclosure split for the Claude skill (#1106) - #1119

Closed
TPAteeq wants to merge 3 commits into
Graphify-Labs:v8from
TPAteeq:skill-progressive-disclosure
Closed

TPAteeq wants to merge 3 commits into
Graphify-Labs:v8from
TPAteeq:skill-progressive-disclosure

Conversation

@TPAteeq

@TPAteeq TPAteeq commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Addresses #1106 (Claude-first; follow-ups noted below). Implements the design agreed in the issue thread.

What this does

Splits the monolithic skill.md (~1,156 lines, loaded in full on every /graphify) into a lean SKILL.md +
on-demand reference/ files, generated from skill.md as the single source of truth.

Per-invocation win: a /graphify query now loads SKILL.md (76 lines) + reference/query.md (~126) =
~202 lines vs 1,156 (~83% less always-on context).

How

  • graphify/skill_build.py — a fence-aware heading slicer driven by a route-by-command manifest. Two output
    modes from one source: split (lean SKILL.md + reference/{extract,update,query,add,watch}.md) for
    verified skill loaders, and flatten (a lossless single-file round-trip of skill.md) for the rest. python -m graphify.skill_build regenerates; --check is a CI drift gate.
  • Generated Claude tree committed at graphify/skill_claude/.
  • Install — the claude platform uses the split tree; _copy_skill_file copies SKILL.md + reference/
    with SKILL.md written last for crash-safety. Removal centralized in _remove_skill_tree (handles
    reference/, scoped to graphify-owned names) and routed through _remove_skill_file + the
    vscode/kiro/antigravity uninstalls. Packaged via pyproject package-data; confirmed it lands in the built
    wheel.
  • Byte-accuracy — the node-ID rule and JSON extraction contract move as verbatim slices and are pinned
    against _file_node_id in tests (not a frozen string). The skill description is preserved verbatim with a
    test asserting it.

Scope

Claude is the only loader switched to split mode; every other platform keeps its existing single-file
behavior.

Testing

  • Full suite green: 1,545 passed, 11 skipped, incl. 17 new tests in tests/test_skill_build.py.
  • Verified live in a Claude Code session: a fresh /graphify . followed reference/extract.md and built a
    real graph; /graphify query ran the constrained query-expansion procedure that lives only in
    reference/query.md — confirming on-demand loading at runtime.

Follow-ups (intentionally not in this PR)

Two pre-existing issues found while here (not changed)

  • uninstall_all (graphify uninstall) removes the gemini skill dir but not the claude skill dir (only
    strips the CLAUDE.md section). Left as-is since changing uninstall scope is a behavior decision - flagging.
  • Headless graphify extract <path> validates an LLM backend upfront ( before checking corpus content ), so it errors '
    no LLM API Key found' even for a code-only corpus that needs no LLM calls. the keyless AST-only path is 'graphify
    update --no-cluster' ( or '--backend ollama' on loopback).

Split the monolithic skill.md (~1,156 lines, loaded in full on every
/graphify) into a lean SKILL.md plus on-demand reference/ files, generated
from skill.md as the single source of truth. A /graphify query now loads
~202 lines instead of 1,156 (~83% less always-on context).

- Add graphify/skill_build.py: a fence-aware heading slicer driven by a
  route-by-command manifest. Two output modes from one source — split (lean
  SKILL.md + reference/{extract,update,query,add,watch}.md) for verified skill
  loaders, and flatten (a lossless single-file round-trip of skill.md) for the
  rest. `--check` regenerates and diffs as a CI drift gate.
- Commit the generated Claude split tree at graphify/skill_claude/.
- Install: the claude platform now uses the split tree; _copy_skill_file copies
  SKILL.md + reference/ with SKILL.md written last for crash-safety. Centralize
  removal in _remove_skill_tree (handles reference/, scoped to graphify-owned
  names) and route _remove_skill_file plus the vscode/kiro/antigravity
  uninstalls through it. Package the tree via pyproject package-data and
  confirm it lands in the built wheel.
- Byte-accuracy: the node-ID rule and JSON extraction contract move as verbatim
  slices and are pinned against _file_node_id in tests (not a frozen string),
  so the doc and code cannot drift apart.

Scope: Claude is the only loader switched to split mode; every other platform
keeps its existing single-file behavior. Verified live in a Claude Code session
— a fresh build loads reference/extract.md and /graphify query loads
reference/query.md on demand.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

@safishamsi safishamsi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work @TPAteeq — this lands the design from the thread faithfully. I merged it onto current v8 and verified the risky parts mechanically, all green:

  • Full suite passes on merged v8 (1,533 passed, 0 failed).
  • Drift gate works: python -m graphify.skill_build --check → in sync.
  • Byte-accuracy confirmed — the node-ID spec, JSON schema, and the full subagent prompt template are present verbatim in reference/extract.md; the description is identical to skill.md.
  • Lean core = 76 lines (query path ≈ 202 vs 1,156, ~82% cut).
  • Wheel ships all 6 files (skill_claude/SKILL.md + reference/*.md) — built and inspected.
  • Install lays down the tree correctly; scope is genuinely claude-only.

One change before merge — make uninstall remove the tree it now installs.

Testing surfaced that graphify claude uninstall (and bare graphify uninstall) don't remove the claude skill — they only touch CLAUDE.md. I confirmed this is pre-existing (base v8 leaves the single SKILL.md behind too), so the PR doesn't regress it — but it makes the orphan a 6-file reference/ directory instead of one file. And since this PR already builds _remove_skill_tree, the helper is right there but the actual claude uninstall path never calls it.

Could you wire the claude uninstall to call _remove_skill_tree (the gemini path already removes its skill dir — this just makes claude consistent)? That turns "uninstall orphans 6 files" into a clean removal, and the helper you wrote does exactly the right scoped thing (I verified it preserves a sibling user file). With that, this is good to merge.

Two follow-ups you already flagged — agreed, keep them separate:

  • The 8 stale flatten-mode variants with the bare-path FileNotFoundError bugs — regenerating from skill.md fixes them; worth its own PR.
  • The headless graphify extract upfront-backend-validation on code-only corpora — pre-existing, separate issue.

Thanks again — the byte-verbatim slicing + the flatten round-trip + the CI drift gate are exactly the safety net this needed.

graphify claude uninstall (and bare graphify uninstall) previously only
stripped the CLAUDE.md section, leaving the user-scope skill behind. With the
progressive-disclosure split that orphans a 6-file reference/ directory rather
than a single SKILL.md.

Route claude_uninstall through _remove_skill_file -> _remove_skill_tree (as the
gemini path already does) so a user-scope uninstall removes SKILL.md +
reference/ + the version stamp. Project scope is unchanged (it already removed
the tree) and a sibling user file is still preserved. Add a regression test for
the user-scope path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@TPAteeq

TPAteeq commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review and for verifying the risky parts — really appreciate it.

Done in 609a98c. Wired the user-scope claude_uninstall through _remove_skill_file → _remove_skill_tree
(first thing it does now, mirroring the gemini path), so graphify claude uninstall and bare graphify uninstall remove the full tree — SKILL.md + reference/ + the version stamp — instead of orphaning the
6-file directory. Project scope was already covered, and I passed project=True through that path so a project
uninstall still never touches the user-global skill. The scoped removal also preserves a sibling user file
(verified).

Added a regression test for the user-scope path. Full suite green (1,547 passed) and the drift gate (python -m graphify.skill_build --check) passes.

Also agreed on keeping the two follow-ups separate — happy to pick up the stale flatten-variant regeneration
(the bare-path FileNotFoundError fix) as the next PR once this lands.

Thanks again!

@safishamsi safishamsi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified the fix on current v8 — 609a98c does exactly the right thing:

  • graphify claude uninstall (and bare graphify uninstall) now remove the full tree — SKILL.md + reference/ + the version stamp — via _remove_skill_tree, mirroring the gemini path.
  • Scoped removal confirmed: a sibling user_notes.md I dropped in the skill dir survives the uninstall — it only removes graphify-owned names, never a blind rmtree.
  • Drift gate green (skill_build --check in sync), full suite 1534 passed.

That was the only blocker. This is clean — byte-verbatim slices, lossless flatten round-trip, preserved description, wheel ships the tree, claude-only scope. Approving. Thanks for the careful turnaround.

@TPAteeq

TPAteeq commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @safishamsi — appreciate the thorough review and the quick verification turnaround. Glad it landed
cleanly.

On next steps: regenerating the other platform variants from skill.md (which also fixes the bare-path
FileNotFoundError bugs in the stale ones) was the natural follow-up, but #1121 already covers that all-platform
rollout. Rather than overlap, I'll follow your lead — I can extend #1119's generator to the other hosts if you'd
like, or leave it to #1121.

safishamsi pushed a commit that referenced this pull request Jun 2, 2026
…or + drift fence) (#1121)

All-platform progressive-disclosure skill split + generator (addresses #1106).

Splits each platform's skill into a lean core (~615 lines, full default pipeline inline) + on-demand references/, generated from a single source via tools/skillgen with a CI/pre-commit drift gate. 13 hosts split, aider/devin stay monoliths. Also fixes the stale bare-path bugs across the previously hand-maintained variants and moves the always-on blocks into packaged markdown.

Verified: all 5 generator guards pass, byte-verbatim load-bearing slices, lean cores self-sufficient on the default path across all 13 split hosts, references gated to non-default branches, description preserves the graphify-out-query-first clause. Supersedes #1119 (Claude-first subset).

Known follow-up applied on top: harden _always_on() against a missing packaged file so a partial install can't brick the CLI.
safishamsi added a commit that referenced this pull request Jun 2, 2026
…tion

claude_uninstall only stripped the CLAUDE.md section, so `graphify uninstall`
and `graphify claude uninstall` orphaned the whole installed skill tree
(SKILL.md + references/ + version stamp) - gemini_uninstall already removes its
skill, this makes claude consistent. The #1121 split made the orphan a 10-file
directory; this restores the removal that the alternative PR #1119 had. Scoped
name removal preserves sibling user files; project-scope uninstall passes
project=True so it never touches the user-scope skill.

Verified: claude/bare uninstall now remove the tree and keep a sibling
user_notes.md; full suite 1755 passed; real extract still builds a clean graph.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@safishamsi

Copy link
Copy Markdown
Member

Thank you @TPAteeq, this was the right Claude-first reference and shaped the approach. We ended up merging the fuller all-platform version in #1121, which extends the same progressive-disclosure design to 18 hosts and adds a single-source generator (tools/skillgen/) with drift guards. That is now released in 0.8.29, so this PR is superseded. Really appreciate the work, it directly informed what shipped.

@safishamsi safishamsi closed this Jun 2, 2026
PerryLin-0420 pushed a commit to PerryLin-0420/graphify-decouple that referenced this pull request Aug 13, 2026
…or + drift fence) (Graphify-Labs#1121)

All-platform progressive-disclosure skill split + generator (addresses Graphify-Labs#1106).

Splits each platform's skill into a lean core (~615 lines, full default pipeline inline) + on-demand references/, generated from a single source via tools/skillgen with a CI/pre-commit drift gate. 13 hosts split, aider/devin stay monoliths. Also fixes the stale bare-path bugs across the previously hand-maintained variants and moves the always-on blocks into packaged markdown.

Verified: all 5 generator guards pass, byte-verbatim load-bearing slices, lean cores self-sufficient on the default path across all 13 split hosts, references gated to non-default branches, description preserves the graphify-out-query-first clause. Supersedes Graphify-Labs#1119 (Claude-first subset).

Known follow-up applied on top: harden _always_on() against a missing packaged file so a partial install can't brick the CLI.
PerryLin-0420 pushed a commit to PerryLin-0420/graphify-decouple that referenced this pull request Aug 13, 2026
…tion

claude_uninstall only stripped the CLAUDE.md section, so `graphify uninstall`
and `graphify claude uninstall` orphaned the whole installed skill tree
(SKILL.md + references/ + version stamp) - gemini_uninstall already removes its
skill, this makes claude consistent. The Graphify-Labs#1121 split made the orphan a 10-file
directory; this restores the removal that the alternative PR Graphify-Labs#1119 had. Scoped
name removal preserves sibling user files; project-scope uninstall passes
project=True so it never touches the user-scope skill.

Verified: claude/bare uninstall now remove the tree and keep a sibling
user_notes.md; full suite 1755 passed; real extract still builds a clean graph.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
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