/who-ate-my-flops:optimizefrom who-ate-my-flops
Optimizes a torch job defined in contract.md by profiling, editing, and checking correctness in a loop until a clean optimized branch is produced.
Ships in who-ate-my-flops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
optimize is a sequence of steps. Work through them one at a time and mark each one done as you go.
Use the setup-baseline skill. It builds the worktree and the workspace, has
extract-computation-graph write records/computation_graph.json and
records/execution_schedule.json, then measures the base commit for speed, memory and
correctness, profiles it in full with torch-profile, and records it with
workspace.py add --verdict base. diagnose begins the same way, which is why
that work lives in one skill and not in this one.
Setup can fail in a way worth handing back, and setup-baseline says so when it does. Stop there rather than arming a campaign on a baseline that did not hold.
Arm once setup has passed, and from there the campaign runs until finish says
it is over.
python <plugin root>/tools/workspace.py arm <ws>
That records which session owns the campaign, read from CODEX_THREAD_ID
or CLAUDE_CODE_SESSION_ID. What keeps the loop turning depends on the
client you are in:
Claude Code. Call the CronCreate tool with cron */2 * * * * and this
prompt, with the plugin root and <ws> filled in as absolute paths:
Campaign watchdog. Run `python <plugin root>/tools/workspace.py finish <ws>`.
If it exits non-zero, pick the optimization loop up where it stopped and
keep going. If it passes, delete this job with CronDelete and stop.
The job fires whenever the session is idle, so a turn that ends before the campaign is finished is picked up again within a couple of minutes. It lives in this session only, on no disk, invisible to every other session, and it expires after seven days.
Codex. Continue the optimization loop in the current turn. Before stopping,
run python <plugin root>/tools/workspace.py finish <ws>. If it reports
outstanding work, address it and continue; do not stop merely to summarize
progress. Stop when it passes, the user asks you to stop, or a blocker requires
user input or an unavailable external resource. In that case, report what is
blocked and what is needed to resume. No Stop hook is installed.
workspace.py finish <ws> is the loop condition, and it hands back what is
outstanding: the contract settled, the graph and schedule built, a baseline
and any candidates recorded, every rejection carrying its reason,
each measurement filled in or explained, the report closed with a
status: closed line, and records/candidates.jsonl in step with benchmark.csv.
Once it passes it takes the campaign off the registry itself.
The user settled everything before the loop began. If you find yourself
about to ask them something, re-read <ws>/contract.md, take the reading it
supports, say in one line which one you took, and continue. If the node was
taken or the job stopped running, explain the blocker and attempt recovery.
If recovery requires external help, report what is needed rather than retrying
indefinitely.
Profile the current code, analyze and find what can be improved, and keep the profile and edit loop turning until nothing worth doing is left.
records/mistakes.md in the same turn: what
you did, what caught it, and what in this plugin should have caught it sooner.--peak-cpu-gb "N/A: collection failed".records/candidates.jsonl. The plainer performance numbers go in benchmark.csv.torch.compile can move it by minutesrecords/candidates.jsonl, and say so in the report.Stay within the scope of changes agreed in contract.md.
Most findings have more than one fix. Speed is the goal, but do not give these up unless you have to.
No special case keyed on this model, this shape, this hardware or this benchmark. A change that only pays off at the benchmark's shape is rejected for that reason.
Promote a candidate only when it satisfies the contract and there is evidence that it improved the target metric, or at least held it. Between two candidates with the same gain the less invasive one wins, and a code change that a dependency or a setting could have replaced is rejected with that as the reason. When a candidate is rejected, write down why instead of quietly dropping it.
latest-report.md with a standalone status: closed line.
If no candidate was worth trying, explain why from the baseline findings.python <plugin root>/tools/workspace.py finish <ws> and resolve its findings.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/clean-upDeliver a finished optimization run as a branch the user can merge. Cherry-pick the commits that changed the workload onto the base, hardcode the A/B flags, re-verify on the shipped code, strip the checkpoint calls in a last commit, and leave the user standing on that branch with a handover./convert-to-benchmark-scriptTurn the script a user really runs into a benchmark script an optimization loop can run over and over. Same shape as the real job, a few minutes long, repeatable, and leaving nothing behind. It produces the script and a table of what changed, and it does not run it./diagnoseProfile the job defined in contract.md, name the one thing it loses most time to, and propose a single fix with a measured number behind it. It stops at the first finding. optimize is this same work repeated until nothing worth doing is left./extract-computation-graphRead a PyTorch job's code into two files in the workspace’s records/ directory. records/computation_graph.json says what is computed: the module tree down to op level, with a code anchor and a repeat count on every entry. records/execution_schedule.json says when and where it is computed and what moves between devices: phases, the data path onto the GPU, host to device copies and their sync points, the collectives between GPUs, and which overlaps are intended. It reads code and runs nothing. Use it to build either file, and to rebuild one when the code has moved under it./initWork with the user to pin down which PyTorch job gets optimized, write contract.md, and put the correctness instrumentation in place. The optimize skill later reads the contract.md written here and optimizes on its own. Every piece of alignment with the user happens in init, all of it./publish-prWrite the pull request description and one issue for a finished campaign into proposed-pr-description.md and proposed-issue.md, for the user to review and post. Says what the PR may claim, what goes in each section and in what order, and how it is worded. Fills template/pr-description.md and template/issue.md; the filled examples are the .example.md files next to them. It pushes nothing and opens nothing.npx claudepluginhub openperfagent/who-ate-my-flops --plugin who-ate-my-flopsOther plugins' skills for the same job