optimize
Skill35 starsChanged 43 days agoApache-2.0View on GitHub
Optimize the torch job defined in contract.md with no further input. Profile, edit, and check correctness in a loop, then hand back one clean optimized branch.
76 other projects use a version of this.
Adopted by
Most recently taken up by
- ansvisor/ansvisortheir own version, first seen Nov 8, 2026
- ai-search-guru/getcito-worlds-first-open-source-aio-aeo-or-geo-tooltheir own version, first seen Nov 8, 2026
- Mrbaeksang/skillstheir own version, first seen Nov 8, 2026
- cihantopac/searvextheir own version, first seen Nov 8, 2026
- daintreehq/daintreetheir own version, first seen Nov 5, 2026
- theexperiencecompany/gaiatheir own version, first seen Nov 3, 2026
Used with
Projects with it also use arrange, teach-impeccable and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
HK-hubSkillarrange
Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy. Use when the user mentions layout feeling off, spacing issues, visual hierarchy, crowded UI, alignment problems, or wanting better composition.
Also in 14 projects that use this
HK-hubSkillteach-impeccable
One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.
Also in 17 projects that use this
zwy123zwySkillnormalize
将用户随意输入的提示词规范化为结构清晰、便于大模型执行的标准化提示词。适用于需要整理、统一提示词格式时调用。
Also in 19 projects that use this
open-coder-aiSkillpolicy-init
Create conformant Chock policy from request. args(request, target_path,
Also in 3 projects that use this
- +8 more from HK-hub
Other versions76 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 76
- Z3Prover/z3★ 13ksame name
- highcharts/highcharts★ 13ksame name
- whitecircle/halo★ 851same name
- hacan359/tonkatsu_box★ 597same name
- talesofai/cohub★ 585same name
- ai-search-guru/getcito-worlds-first-open-source-aio-aeo-or-geo-tool★ 432same name
- nexmoe/DayBee★ 424same name
- nexmoe/eve★ 424same name
- Southclaws/storyden★ 348same name
- 10xChengTu/Mux0★ 337same name
66 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- clean-upSkill
- convert-to-benchmark-scriptSkill
- diagnoseSkill
- extract-computation-graphSkill
- initSkill
- publish-prSkill
- setup-baselineSkill
- torch-profileSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 8 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 73 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Use the setup-baseline skill.
- Very specific: line 35
Claude Code: Call the CronCreate tool with cron */2 * * * * and this prompt, with the plugin root and <ws> filled in as absolute paths:
- Distinctive: line 67
If recovery requires external help, report what is needed rather than retrying indefinitely.
- Distinctive: line 76
Every change has to pass the recorder's comparison against the baseline.
- Distinctive: line 77
Use the torch-profile skill to see what the GPU is doing at runtime.
- Distinctive: line 83
Keep each optimization short so that agent can understand better where improvements come from.
- Very specific: line 84
When you get something wrong, write it to records/mistakes.md in the same turn: what you did, what caught it, and what in this plugin …
- Very specific: line 90
If one is unavailable, explain why: --peak-cpu-gb "N/A: collection failed".
- Distinctive: line 106
When either file drifts too far from the code, rebuild it, and record which commit the new one describes.
- Distinctive: line 126
No special case keyed on this model, this shape, this hardware or this benchmark.
- Very specific: line 141
Write a brief latest-report.md with a standalone status: closed line.
- Distinctive: line 142
If no candidate was worth trying, explain why from the baseline findings.
- Very specific: line 143
Run python <plugin root>/tools/workspace.py finish <ws> and resolve its findings.
- Distinctive: line 145
Run the clean-up skill to prepare the delivery branch and final handover.
“Common” is measured: kept by at least 6 in 10 of the 73 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
optimize is a sequence of steps. Work through them one at a time and mark each one done as you go.
Step 1: setup
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.
Step 2: arm the loop
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.
Step 3: optimization loop
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.
- Every change has to pass the recorder's comparison against the baseline.
- Use the torch-profile skill to see what the GPU is doing at runtime. It also analyses the profile data and reads it against the code and the computation graph built earlier, so both the surface problems and the underlying ones come out.
- Let those findings decide whether you keep or drop the change behind a commit. You write one round of optimization and create the commit.
- Keep each optimization short so that agent can understand better where improvements come from.
- When you get something wrong, write it to
records/mistakes.mdin the same turn: what you did, what caught it, and what in this plugin should have caught it sooner. - Record every commit's result clearly. workspace.py has the format, and staying consistent with it is what matters. A later reader should be able to reconstruct what changed, what was measured, and why a candidate was promoted.
- Fill all four measurements for every run, including rejected candidates.
If one is unavailable, explain why:
--peak-cpu-gb "N/A: collection failed". - Log the commits with their results and findings, in order, in
records/candidates.jsonl. The plainer performance numbers go inbenchmark.csv. - During the loop you may adjust the benchmark script, but only when the
measurement itself has broken down, never to make a candidate look better:
- profiling time or trace file size has got out of hand
- a change moved the warmup, so the window no longer sits on steady steps. The
first
torch.compilecan move it by minutes - the steady step got fast enough that 5 to 10 of them is mostly noise
- the job got fast enough to run whole, so there is nothing left to truncate
- something excluded at init has been promoted into the top few percent by everything you sped up around it
- An adjustment invalidates every number taken before it. Measure the baseline
again by running setup-baseline's step 4 under the new script, measure the
current head the same way, record the change as its own entry in
records/candidates.jsonl, and say so in the report. - When either file drifts too far from the code, rebuild it, and record which commit the new one describes.
Tradeoffs
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.
- Architecture: go through the acceleration path the codebase already has, its fused kernel, its fast attention backend, its compile flag, instead of adding one beside it.
- Breadth: prefer the fix that touches least, a dependency or a setting before a code change, and keep a code change small enough to read in one sitting.
- Memory: speed bought with memory needs the headroom to be there, so read view 5 and what the contract allows before spending it.
- Precision: the recorder decides, at the tolerance derived at setup, and a fix that needs it widened is rejected rather than re-measured.
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.
Promotion rule
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.
Step 4: closing
- Write a brief
latest-report.mdwith a standalonestatus: closedline. If no candidate was worth trying, explain why from the baseline findings. - Run
python <plugin root>/tools/workspace.py finish <ws>and resolve its findings. - In Claude Code, delete the watchdog with CronDelete.
- Run the clean-up skill to prepare the delivery branch and final handover.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

