Optimization cron builder

From weiyangzen/b3ehive · View interactive version

Optimization cron builder is an AI agent skill from the GitHub repository weiyangzen/b3ehive. Improves a system against a declared objective. Design mode writes one research doc per refinement item; measured mode compares candidates serially under a frozen oracle. Use for performance work such as CUDA kernels, or for design refinement. 性能优化、串行比较、架构优化。

How to use this skill

Skill file

Optimization

For a user-facing choice guide, read docs/skill-selection.md. Use measured

mode when an oracle can measure a target; use design mode for research against a

design philosophy.

core v2 · loop v2; measured mode binds the frozen benchmark as the oracle and

keeps the ratchet. Read references/core.md and references/loop.md first;

this body adds only optimization rules.

Measured optimization normally compares candidates in series. It measures one

candidate, keeps or reverts it, and uses the result to choose the next

candidate. Use parallel lanes only when independent hypotheses need one

comparison round.

Modes

| Mode | Input | Output |

|---|---|---|

| design | a design philosophy and a stage blueprint | Stage_*_AR_Blueprint.md and one research doc per item |

| measured | an objective and an oracle contract | accepted changes with before/after measurements and a hypothesis ledger |

Decide the mode. A request to make something faster, smaller, or cheaper takes

measured; a request to refine architecture against a philosophy takes design.

Measured Mode

  1. Contract. Freeze the oracle contract: definition, workloads drawn from real

use, reference, tolerance, measurement method, baseline with source and

version, anti-gaming checks, oracle.fast and oracle.full, tier.

Template: references/measured-mode.md.

  1. Baseline. Measure the baseline under the contract; profile it with a bound

instrument.

  1. Hypothesis. Each entry names its profile evidence, cited canon, expected

gain, the change, its lineage, and its direction (grow, switch,

verify) with mechanism distance from the incumbent.

  1. Candidates. Run the loop: single by default, relay for stubborn targets,

and serial comparison for the normal ratchet. Use lanes when independent

hypotheses need one parallel comparison round.

  1. Re-measure. The master re-runs oracle.full on fresh inputs and recomputes

aggregates from raw rows; agent-reported speedups count for nothing. Paired,

alternating, fresh-process trials decide; a gain counts only when its

interval excludes zero and clears the minimum effect (B3_STATS).

  1. Ratchet. Keep a change only when it is correct and better than the best

accepted state; otherwise revert. Untrusted measurements stay

observed_only.

  1. Record. Log every outcome, rejected ones included; a rejected hypothesis

returns only with new evidence.

Stop on target reached, budget spent, or a written reason the target is out of

reach. Never relabel a missed target as success.

Instruments

perf, py-spy, an ncu report skill, a kernel wiki, a docs MCP server) in

instruments.tsv with a probe command; a failed probe means the instrument

is absent.

fixes → exceptions. Rank at most five priorities by expected gain over effort.

instruments.

Design Mode

  1. Capture the philosophy in one stable sentence.
  2. Generate one authoritative Docs/Stage_*_AR_Blueprint.md: one item per

optimization topic, at most 100 items (a review-capacity cap), grouped into

worker-ownable sections.

  1. Each item gets one doc under Docs/researches/Stage_*_AR/, scoped to that

item, filtered through the philosophy, grounded in mature practice and cited

canon, ending in concrete recommendations for this repository.

  1. Decide the worker count from the sections; workers own disjoint sections.
  2. An empty, broad, or off-philosophy doc keeps its item open; split or narrow

it and rerun only that section.

Product code stays downstream of design mode. Detail and repair:

references/design-mode.md.

Validation

receipts on fresh inputs; the hypothesis ledger covers every attempt.

scoped doc per accepted item.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.