extract-computation-graph

extract-computation-graph is a skill for Claude Code from wenhaochai/claude-plugins. It costs 162 tokens per session (994 once invoked), scanned A, original, MIT.

A code-reading workflow that describes what a PyTorch job computes and when and where it computes it. PyTorch is a machine-learning framework; the workflow writes a computation graph and execution schedule for comparison with measured profiler traces.

In plain words
What is it for?
Use it to record modules and operations with code locations and repetition counts, plus execution order, devices, transfers, and synchronization points.
Why use it?
It provides a map from measured operations, device transfers, and idle gaps back to the code structure that caused them.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the who-ate-my-flops plugin — 9 skills shipped together

Good fit Use it to record modules and operations with code locations and repetition counts, plus execution order, devices, transfers, and synchronization points.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wenhaochai/claude-plugins/extract-computation-graph
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add wenhaochai/claude-plugins --skill extract-computation-graph
Clone the repo
git clone --depth 1 https://github.com/wenhaochai/claude-plugins

Made for: Claude Code.

Or install who-ate-my-flops, the plugin that ships this one along with the rest of its 9 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for extract-computation-graph

README.md
[![agentmods](https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/extract-computation-graph/github.svg)](https://agentmods.dev/skills/wenhaochai/claude-plugins/extract-computation-graph)
Your own site
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/extract-computation-graph"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/extract-computation-graph/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for extract-computation-graph

Your own site · 80×15
<a href="https://agentmods.dev/skills/wenhaochai/claude-plugins/extract-computation-graph"><img src="https://agentmods.dev/badge/skills/wenhaochai/claude-plugins/extract-computation-graph.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 162 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 994 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00162 $0.00994
Opus 5.5 $0.00065 $0.00398
Sonnet 5.5 $0.00032 $0.00199
Haiku 4.5 $0.00016 $0.00099

Measured 14d ago against content hash 654c9d50c52a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

extract-computation-graph scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 14d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

who-ate-my-flops/skills/extract-computation-graph/SKILL.md · 58 lines

How it starts

The opening of the file, as written. The whole thing — 58 lines — stays where its author put it; the contents beside it link to each section on GitHub.

extract-computation-graph

In: the job's code, at a known commit. Out: records/computation_graph.json and records/execution_schedule.json in the workspace’s records/ directory.

This runs nothing. It records what you expect the job to do. The profile records what it actually did, and you read one against the other.

Two files, and what each is for

records/computation_graph.json records/execution_schedule.json
says what is computed when and where it is computed, and what moves between devices
lets you attribute a measured kernel back to the module, layer or op that issued it, times its repeat count a measured idle gap back to the copy, collective or sync point behind it
lets you check whether the cost sits where the structure says the work is whether what the code meant to overlap actually did

The fields below are examples. Add what this job needs.

records/computation_graph.json

field why it is there
job_type: training, inference serving, or batch each has a different skeleton. Do not assume training
commit every file:line below means nothing without the sha it was read at
entrypoint the step function, as a file:line
modules, down to op level (model -> modules -> layers -> ops), each naming its enclosing parent and its execution order findings land on ops, not on files
shapes on the boundaries you can read shape decides which kernel gets picked and how much memory the tensor takes
code_anchor on every entry, written model/dit.py:DiTBlock.forward:214 this is where a root cause has to land later. Symbol before line, so it survives an edit above it
repeat on every unit that repeats: the unit and its count a cost inside a unit multiplies by N. Rank by per-unit cost x N, never by one instance: forty blocks turn a millisecond into forty

records/execution_schedule.json

field what to record
phases startup, data, forward, backward, optimizer, periodic eval or checkpoint, teardown. Each with a kind of one-off, repeated or periodic, and who it runs_on
data_path every hop from disk to device: worker processes, collation, pinned staging, the copy itself. Mark which hops are asynchronous and which block the step
host_device the H2D and D2H copies, whether their source is pinned or pageable, and every sync point: .item(), .cpu(), .numpy(), .tolist(), torch.cuda.synchronize(), printing a tensor, any Python branch that reads one
device_device the collectives, each tagged with the parallelism it serves (data, tensor, pipeline, expert, sequence) and whether the call blocks or was issued with async_op=True
compute forward, backward, which blocks recompute under activation checkpointing, gradient accumulation, the optimizer step, and the torch.compile regions with the graph breaks between them
overlap what is supposed to run at the same time as what, and on which stream

Read the full file on GitHub · 58 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 14d ago Changed · +162 tokens per session 654c9d50c52a
  2. 17d ago First seen · 58 lines · 0 tokens per session scan A 8ca75c9cd1e4

Subscribe to this mod's changes

extract-computation-graph is a skill published in the GitHub repository wenhaochai/claude-plugins (17 stars, last pushed 2d ago), licensed MIT. It adds 162 tokens to every session and 994 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-01.

Related

Other skills, from other repositories

trace

Evidence-driven tracing lane that orchestrates competing tracer hypotheses in Claude built-in team mode.

Yeachan-Heo/oh-my-claudecode · 18 tokens

smiles-validation

Strict SMILES validation, structural comparison, and modification verification. Catches invalid LLM-generated molecules.

synthetic-sciences/openscience · 24 tokens

nonlinear-solvers

Select and configure nonlinear solvers for f(x)=0 or min F(x). Use for Newton methods, quasi-Newton (BFGS, L-BFGS), Broyden, Anderson acceleration, diagnosing convergence issues, choosing line search vs trust region, and analyzing Jacobian quality.

beita6969/ScienceClaw · 63 tokens

linear-solvers

Select and configure linear solvers for systems Ax=b in dense and sparse problems. Use when choosing direct vs iterative methods, diagnosing convergence issues, estimating conditioning, selecting preconditioners, or debugging stagnation in GMRES/CG/BiCGSTAB.

beita6969/ScienceClaw · 55 tokens

numerical-stability

Analyze and enforce numerical stability for time-dependent PDE simulations. Use when selecting time steps, choosing explicit/implicit schemes, diagnosing numerical blow-up, checking CFL/Fourier criteria, von Neumann analysis, matrix conditioning, or detecting stiffness in advection/diffusion/reaction problems.

beita6969/ScienceClaw · 61 tokens

social-physics-filter

Unified boundary enforcement, interpersonal diagnostic, and relational audit engine. Absorbs 40 psychology + 2 social protocols and all relationship case studies.

winstonkoh87/Athena-Public · 34 tokens