Repository navigation
feat(skills): Add dependency-redundancy analysis to the user plugin - #14
Merged
Merged
Conversation
The user plugin can now explain where a run's time went, but not whether the graph it executed carried orderings nothing needed. The dependency viewer already computes that — an edge is redundant when a longer path implies it — and exposes it through four edge modes. What it does not do is tell a reader when its own answer is uninformative, and that is where the analysis goes wrong. Add `dependency-redundancy` to the user plugin. It orders the work so the uninformative cases are excluded before a mode is chosen: read the edge-source mix and the graph depth first, then select. A graph of depth 1 cannot contain a redundant edge at all. A graph whose edges are all `creator` cannot report one either, because structural reduction protects tensor-lifetime references unconditionally — so a zero there is a property of the mode, not a fact about the graph. That distinction is not theoretical. Walking the tool over real captures from this project's own scene tests, a 1280-edge attention graph reported `removed 0 redundant edge(s)` while 256 of its edges — a fifth of the graph — were transitively implied and retained only as lifetime references. A reader who ran one mode and stopped would have recorded "already minimal". The skill routes that case to the dataflow modes and, when those also return zero, requires the result to be stated as "nothing removable" rather than "nothing redundant". The rest is the same shape as the critical-path skill: validation before interpretation — a cycle disables the selected mode, warns on standard error, and still exits 0, so the exit status is no evidence a reduction ran — then an interpretation table that names the action each outcome licenses. Removing a redundant edge drops scheduling bookkeeping, never execution order, so the skill forbids describing it as an ordering change or promising a speedup no run measured. Note in the capture contract that a structural analysis consumes `deps.json` alone, so the two analyses now sharing that file do not both have to capture timing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A census over 64 dependency graphs, captured across this project's a2a3 scene tests rather than the three the skill was written from, moved the boundary the skill draws. The skill treated an all-`creator` graph as the shape where a structural reduction cannot report anything, implying a mixed-source graph could be trusted. It cannot. Protection is per-pair, and Step-A creator retention emits a creator row for exactly the pairs a dataflow dependency also covers, so the two sources land on the same edge as a rule rather than by accident. Measured: a graph of 5120 `creator` plus 1008 `tensormap` edges had every one of its 2032 redundant pairs creator-annotated. `reduced` reported 0 there; the dataflow mode removed 992. Across the census the documented mode surfaces 722 of 5839 structurally redundant edges, and the dataflow mode 2709. So the source mix explains a gap between the modes but never licenses skipping one, and the skill now says so as a rule: never report from `reduced` alone. Correct the closing table row with it. Two modes returning zero establishes that nothing is *removable*; redundant-but-retained edges are invisible to every mode, so it was wrong to let that outcome be reported as a minimal graph. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Hzfengsy
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The user plugin can now explain where a run's time went, but not whether the
graph it executed carried orderings nothing needed.
dependency-redundancyadds that audit over
deps.json: which edges a longer path already implies,which of those are safe to drop, and — the part the tool does not say on its
own — when its answer is uninformative and must not be reported as "already
minimal".
Changes
plugins/pypto-user/skills/dependency-redundancy/: the skill. It orders thework so uninformative cases are excluded before a mode is chosen — read the
edge-source mix and the graph depth first, then select — and covers the four
edge modes, the validation gates, and an interpretation table naming the
action each outcome licenses.
plugins/pypto-user/lib/dfx/capture.md: note that a structural analysisconsumes
deps.jsonalone, so the two analyses sharing that file do not bothhave to capture timing.
plugins/pypto-user/.codex-plugin/plugin.json: the long description coversthe fifth workflow. No version bump — that belongs to the release workflow.
tests/: register the skill inEXPECTED_USER_SKILLS.No behavior change to any existing skill; the new skill is additive.
Why the ordering matters
Census over 64 dependency graphs captured with
--enable-dep-genacrosstests/st/a2a3/{tensormap_and_ringbuffer,host_build_graph}on real silicon:reducedreportsreduced_dataflowreportsThe mechanism works — the chain cases prove it finds and prints real redundant
edges. What it cannot do is say when its own answer is uninformative. Creator
protection is per-pair, and Step-A creator retention emits a creator row for
exactly the pairs a dataflow dependency also covers, so a mixed-source graph is
no safer than an all-creator one: every one of batch paged attention's 2032
redundant pairs is creator-annotated, and the documented default mode reports
removed 0on a graph where 992 edges are provably droppable.18 of the 29 graphs that contain redundancy report 0 from every mode, because
their redundant pairs have
INPUTconsumers while the byte-level proof onlylicenses
INOUT. Those edges are correctly retained — they hold a creatoralive — but nothing in the output distinguishes that from an already-minimal
graph. The skill turns this into a rule: never report from
reducedalone, andwhen both modes return zero, say "nothing removable" rather than "nothing
redundant".
Verification
python -m unittest discover -s tests: 232 tests, OK. Run inside the pushtransaction at each pushed commit with
ruff check tests,ruff format --check tests, andpyright— all clean, 0 errors.under the shared device queue with
--enable-dep-gen, then every graphaudited by following the skill literally. The per-mode counts come from the
shipped CLI; the structural column comes from running the same reduction with
the creator protection bypassed.
1 -> 3edge:reducedandomittedboth identify and print1 -> 3;flipping that edge's source to
creatormakes both report 0, reproducing thetrap at a scale small enough to read.
graph, and exits 0 — which is why the skill tells the reader not to take the
exit status as proof a reduction ran.
deps_viewer_<mode>.txtratherthan overwriting a full-graph render beside it.