Skip to main content
Glama

new_target

Scaffold a benchmark target from your PyTorch function by generating baseline, editable candidate, and contract files, then bench the baseline and verify the candidate before edits.

Instructions

Scaffold a target from the user's own PyTorch function so the loop can run on it: writes <out_dir>/_baseline.py (the function as the baseline plus the Target definition: inputs, seed, fp32 reference, dtype-default tolerances, rotation, timer), <out_dir>/_candidate.py (the file to edit; starts as the baseline) and the vendored hotkernel_contract.py (protocol 3) they import, so they run in HOTKERNEL_PYTHON without hotkernel installed there. from: 'torch.nn.functional:gelu' or './mykernels.py:fused'; shape: the primary input x, e.g. '4096x8192'; extra: more inputs in call order like ['w:8192', 'b:8192'] (random tensors of the same dtype); rotate: inputs that stream through memory (default ['x']); flops: nominal flops per call for roofline(); reference: a different 'module:function' to run in fp32 as the reference when the baseline cannot run in fp32 (a backend-forced SDPA call, a bf16-only library kernel). For inputs randn cannot draw (a quantized weight): derive: a 'module:function' from the dict of raw random tensors to the dict of tensors the call takes, in call order; inputs: the names it returns, e.g. ['x', 'w_q', 'scales'] or 'x,w_q,scales', which become the candidate's signature; reference is then required and gets the derived inputs as they are (it must do its own fp32 math); min_bytes: the bytes one call must read (one weight layout), which sizes the rotation K. Same as the CLI hotkernel new. Then bench() the baseline and verify() the blank candidate (expect 'inconclusive') before changing anything.

Input Schema

NameRequiredDescriptionDefault
atolNo
rtolNo
seedNo
dtypeNobf16
extraNo
flopsNo
forceNo
from_Yes
itersNo
shapeYes
deriveNo
inputsNo
rotateNo
targetYes
out_dirNo.
min_bytesNo
referenceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses a lot: exact output files, vendored `_hotkernel_contract.py`, baseline/candidate contents, and that they run in HOTKERNEL_PYTHON without hotkernel installed. However, it omits overwrite behavior (`force` is never mentioned), return values, and whether scaffolding is idempotent or destructive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The content is front-loaded with the main action, but it is a dense run-on paragraph mixing file outputs, parameter explanations, and workflow instructions. For a 17-parameter tool, some length is warranted, but the lack of structure makes it harder to scan than necessary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, no annotations, no output schema, and zero schema description coverage, the description is fairly complete on file outputs and core parameters. It is still missing key operational details such as `force` overwrite behavior, iteration/timing controls, and what the call returns, leaving meaningful gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for 17 parameters. It explains the major ones (`from_`, `shape`, `extra`, `rotate`, `flops`, `reference`, `derive`, `inputs`, `min_bytes`) in useful detail, but leaves `force`, `iters`, and the exact roles of `atol`/`rtol` vague; `seed` and `dtype` are only lightly implied.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: scaffold a target from the user's PyTorch function and write baseline/candidate/contract files. It also distinguishes this setup step from bench() and verify() by naming them as follow-up actions, though it does not explicitly say when not to use this tool versus those siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear workflow context: use this to scaffold a target so the loop can run, then bench() the baseline and verify() the blank candidate before editing. The CLI equivalent `hotkernel new` is named. It lacks explicit exclusions or a direct comparison to alternative setup paths, but the intended usage is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.