From ceddd88f5b4f7b888d06cef12b866daaf234e760 Mon Sep 17 00:00:00 2001 From: Seekers2001 Date: Thu, 29 Oct 2026 08:28:04 +0800 Subject: [PATCH] feat: align benchmark optimization with user outcomes --- manifests/context-packs/skill-triggers@1.json | 18 ++- skills/benchmark-optimization-loop/SKILL.md | 127 ++++++++++++++---- .../references/sources.md | 33 +++++ 3 files changed, 150 insertions(+), 28 deletions(-) create mode 100644 skills/benchmark-optimization-loop/references/sources.md diff --git a/manifests/context-packs/skill-triggers@1.json b/manifests/context-packs/skill-triggers@1.json index 34be199f4..95bbce06d 100644 --- a/manifests/context-packs/skill-triggers@1.json +++ b/manifests/context-packs/skill-triggers@1.json @@ -1,16 +1,16 @@ { "coverage": { "skills": 311, - "withTriggers": 33 + "withTriggers": 34 }, - "generatedAt": "2026-09-24T23:51:22.784Z", + "generatedAt": "2026-10-29T00:24:25.600Z", "id": "skill-triggers@1", "model": { "effort": null, "id": "hand-seeded", "source": "manual-curation-pending-regeneration" }, - "registryDigest": "846ac8826dd91e81cd838c2b55d7be536af427eb453efa127501f891e5778ff8", + "registryDigest": "367e063981853b30ad2f728f0eab4ac1dd6df83f42475f0dd07fb43a97af756b", "schemaVersion": 1, "triggers": { "skill:agent-runtime-gateway-smoke-test": [ @@ -48,6 +48,16 @@ "url path handling", "file server" ], + "skill:benchmark-optimization-loop": [ + "turn user goal into benchmark", + "optimize task completion rate", + "compare implementation variants", + "improve correctness with fixed evaluation", + "reduce cost per resolved task", + "run bounded recursive optimization", + "verify improvement on independent cases", + "keep best measured admissible result" + ], "skill:browser-qa": [ "deployed feature test", "visual regression screenshots", @@ -291,5 +301,5 @@ "before creating a pr" ] }, - "triggersDigest": "054898acb769893c46e5bd7037141f7be83fb775515ea1dbb52fb1c18aca19e6" + "triggersDigest": "aaea2b6feb88489b1652c1be094303adc984b849b8859a568925d7fce5cbeddf" } diff --git a/skills/benchmark-optimization-loop/SKILL.md b/skills/benchmark-optimization-loop/SKILL.md index f76d0d54e..7be7c32d9 100644 --- a/skills/benchmark-optimization-loop/SKILL.md +++ b/skills/benchmark-optimization-loop/SKILL.md @@ -1,6 +1,7 @@ --- name: benchmark-optimization-loop -description: Convert 'make it faster' requests into a bounded measured optimization loop — baseline first, generate one-hypothesis variants, benchmark each against a correctness gate, and promote the fastest safe variant with reproducible commands. Use when asked to speed something up, try many variants, run recursive optimization, benchmark latency/throughput/cost, or pick the best implementation by repeated measured tests. +description: >- + Turn a user's improvement goal into a bounded benchmark-guided loop: define success and hard constraints, establish a baseline, test one-hypothesis variants, and promote the best measured admissible result with reproducible commands. Use for repeated measured improvements to correctness, quality, task completion, reliability, speed, or cost, including recursive optimization and implementation comparisons. license: MIT metadata: origin: ECC @@ -9,36 +10,77 @@ tools: Read, Write, Edit, Bash, Grep, Glob # Benchmark Optimization Loop -Use this skill to convert "make it 20x faster" or "try 50 recursive -optimizations" into a bounded measured loop that can actually improve a system. +Start with what the user needs to accomplish, then choose the benchmark. A +request to improve correctness or quality need not become a speed optimization. +Requests such as "make it 20x faster" or "try 50 recursive optimizations" still +need a bounded, measurable loop. + +## When to Activate + +Use for goal-driven implementation changes that need repeated measured +comparisons, or to establish the benchmark and plan for such a task. Reuse an +existing adequate regression check for a one-off fix; do not add a search loop +without a reason. ## Required Baseline Do not optimize until these exist: -- the operation being optimized; -- the correctness gate that must stay green; -- the metric: wall time, p95 latency, rows/sec, cost/run, memory, error rate; -- the current baseline; +- the user task, operation being optimized, and desired outcome; +- the success threshold and correctness, quality, safety, or behavior constraints + that must stay green; +- the primary metric, its direction and definition: for example discrepancy + amount, task completion rate, rubric score, wall time, p95 latency, rows/sec, + cost/resolved task, memory, or error rate; +- representative inputs and independent expected results or a calibrated rubric; +- the current baseline with implementation, input, evaluator, and environment + versions sufficient to rerun it; - the search budget: max variants, max time, max spend, max data impact. +Reuse confirmed requirements and authorization. If a material success threshold +or tradeoff is missing, propose a concrete choice and obtain the user's decision. If the user asks for an unrealistic target, keep the ambition but make the loop -bounded and measurable. +bounded and measurable. A plan-only request stays a plan; paid calls, production +load, and deployment retain their existing authorization boundaries. + +Freeze the metric, sample set, expected results, and evaluator for the comparison. +Expected results must not be copied from the candidate implementation. Evaluate +hard constraints separately from aggregate scores. For subjective quality, +calibrate the rubric against accepted examples and record reviewer disagreement; +the optimizing agent's self-score alone is not acceptance evidence. + +Record why the metric represents the user outcome. A proxy may help diagnosis, +but improving it does not by itself prove that the user's task improved. ## Loop -1. Measure the baseline. -2. Identify bottlenecks from evidence. +1. Measure the baseline, reusing reliable prior evidence only when comparable. +2. Identify the gap from evidence relevant to the user goal. 3. Generate variants that test one hypothesis each. -4. Run variants with the same input shape. -5. Reject variants that fail correctness, safety, or reproducibility. -6. Promote the fastest safe variant. +4. Run variants with the same input shape and evaluation rules under comparable + conditions; record failures, timeouts, retries, and their costs. +5. Reject variants that fail correctness, other hard constraints, safety, or + reproducibility. +6. Promote the best measured admissible variant against the agreed objective. 7. Codify the winning path in a script, command, test, config, or doc. -8. Rerun the baseline and winner to confirm the delta. +8. Rerun the baseline and winner to confirm the delta, then perform the agreed + independent acceptance check before declaring the goal met. -## Variant Table +Keep a ledger for every run: hypothesis, exact command, implementation and +benchmark versions, case counts, primary result, hard-constraint results, +failures/retries, evidence location, and the keep/reject decision. Failures remain +in task-level denominators. If a statistic covers successes only, report failure +rates and timeouts beside it; distinguish single attempts from complete tasks. -Track variants like this: +Optimize the implementation rather than quietly lowering the standard. If a +sample or evaluator is wrong, document the evidence. A revision that changes the +meaning of success needs user confirmation; version it and rerun both baseline +and candidate under the revised rules, preserving the original evidence. + +## Variant Tables + +The following values are illustrative, not measured evidence or default targets. +For a speed goal, track variants like this: ```text Variant | Hypothesis | Command | Time | Correct? | Notes @@ -47,25 +89,62 @@ batch-500 | fewer round trips | npm run job -- --batch 500 | 42s | yes | winner parallel-8 | more workers | npm run job -- --workers 8 | 31s | no | rate limited ``` +For a report-correctness goal, independently supplied reconciliation totals +could define the primary measure; faster runtime would not excuse wrong totals: + +```text +Variant | Hypothesis | Critical mismatches | All periods processed? | Decision +baseline | current mapping | 4 | yes | baseline +mapping-fix | handle missing category | 0 | yes | candidate for acceptance +skip-errors | omit failing periods | 0 | no | reject: incomplete task +``` + ## Recursive Search For recursive or hyperparameter work: - persist every run to a ledger; - compare against the prior accepted winner, not only the previous run; -- keep a holdout or replay check; -- stop when improvement is within noise, correctness fails, cost exceeds the - budget, or the search starts changing more variables than it can explain. +- reserve independent acceptance cases where feasible, controlling answer + visibility; a known replay check is regression evidence, not an independent + generalization check; +- once acceptance feedback informs further tuning, treat those cases as + development evidence and obtain fresh independent cases for final acceptance; +- stop when improvement is within noise, correctness or another hard constraint + fails, cost exceeds the budget, or the search starts changing more variables + than it can explain; retain the prior accepted winner and report the gap; +- stop optional search when the requested goal is achieved. -Use phrases like "best measured safe variant" instead of "global optimum" unless -the search space was actually exhaustive. +Use phrases like "best measured admissible variant" instead of "global optimum" +unless the search space was actually exhaustive. If independent cases are +unavailable, state that limitation instead of claiming independent acceptance. ## Promotion Gate A variant cannot become the new default until: -- correctness tests pass; -- the performance delta is repeated or explained; +- correctness tests and all other hard constraints pass; +- the objective's measured delta is repeated or explained; +- the agreed acceptance check supports the user goal, with untested paths and + proxy-only results explicitly identified; - rollback is obvious; - the change is encoded in source control or a durable runbook; -- the final summary includes exact commands and measurements. +- the final summary includes exact commands, versions, measurements, and limits. + +Report benchmark success, independent acceptance, and deployed user outcomes +separately. If deployment is authorized, follow the project's release process +and verify the deployed version against the same user-outcome definition; +otherwise report the candidate's pre-deployment status. This skill does not +install a scheduler or grant release authority. + +## Related Skills and Sources + +- [benchmark](../benchmark/SKILL.md) collects browser/API/build performance + baselines; reuse it when those measurements serve the chosen goal. +- [eval-harness](../eval-harness/SKILL.md) provides agent capability/regression + evals and grader methods; reuse an appropriate existing evaluator. +- [loop-design-check](../loop-design-check/SKILL.md) designs or reviews feedback + loops and runaway prevention; this skill conducts the measured search. +- [benchmark-methodology](../benchmark-methodology/SKILL.md) scores competitors + for competitive analysis, rather than implementation variants. +- [Sources and scope](references/sources.md) records this extension's provenance. diff --git a/skills/benchmark-optimization-loop/references/sources.md b/skills/benchmark-optimization-loop/references/sources.md new file mode 100644 index 000000000..15c17c4e9 --- /dev/null +++ b/skills/benchmark-optimization-loop/references/sources.md @@ -0,0 +1,33 @@ +# Sources and Scope + +This contribution extends ECC's existing `benchmark-optimization-loop` skill. +It retains the baseline-first search, single-hypothesis variants, per-run ledger, +comparison against the prior accepted winner, noise and budget stops, obvious +rollback, durable promotion record, and reproducible commands. + +The extension starts from the user's desired outcome before choosing metrics. +It adds explicit benchmark versions, independent expectations, complete failure +accounting, fixed standards, and a distinction between known replay cases and +independent acceptance. Correctness, quality, completion, reliability, speed, +and cost are possible objectives; thresholds and tradeoffs remain task-specific. + +## Inspiration and Confirmation + +- [How we made claude.ai 3x faster in two weeks](https://claude.dev/blog/how-we-made-claude-ai-faster/), + Raymond Wang, Sam Attard, and Issac G., September 23, 2026. The relevant idea is + to establish measurements tied to user outcomes, guide changes with benchmarks, + and check whether the improvement holds in actual use. +- [huashu-flash](https://github.com/alchaincyf/huashu-flash), a performance workflow + linked by the contributor's initial reading. It is background inspiration, + not a runtime dependency. +- [docs-governance Issue #57](https://github.com/qshanx/docs-governance/issues/57), + the confirmed requirement and provenance record: define the user's goal, + establish a benchmark, and let AI iterate against it. Performance and image + handling are examples rather than mandatory workflow stages. + +The added text is an original formulation; it does not reproduce the article or +third-party skill prose. ECC's existing skill name and execution requirements +are preserved rather than adding a duplicate workflow. No external package, +scheduler, production credential, private project path, or user data is required. +The sample tables are illustrative and do not establish measured effectiveness +or cross-domain behavioral validation of the skill.