Optimize Op
Read .agents/guidance/OPTIMIZATION_GUIDELINES.md and follow it as the source of
truth. Use tools/optimize_op.py for the deterministic gates and the versioned
MR summary. Do not duplicate or weaken the guidance here.
Workflow
Run
python3 tools/optimize_op.py <Op> --phase preflight. Resolve every readinessGAPin a separate non-perf:coverage commit before optimizing.Survey and baseline the full union expanded from all declared
basicandadvancedconfigurations. Iterate profile → lead → one change → correctness/performance evaluation → review/refactor. Runpython3 tools/refactor_op.py <Op> --phase assessbefore every keptperf:commit. Re-profile after each win and stop only at the guidance's measured ridge or three-post-win-strike condition.Initialize the concise v1 MR summary from exact optimized case keys:
python3 tools/optimize_op.py <Op> --phase summary \ --benchmark-base <ref> --optimized-cases-file <file> \ --state provisional --bottleneck Memory-bound \ --profile-evidence '<measured evidence>' --out <description>Use
Compute-boundwhen supported by the profile. Keep the human-authored assessment, six hard-evidence checklist lines, and one to five learnings current. Regenerate scope, categories, per-SKU Impact, and Layout comparison; do not hand-edit those derived fields. Maintain the canonical companion## Memory footprintsection outside the bounded v1 block; check its summary item only after ODO-9 passes.Refresh the description with reference-SKU evidence and finalize it:
python3 tools/optimize_op.py <Op> --phase summary \ --results <description> --state final --out <description>Require every configured reference SKU. Keep the visible warning for any non-reference local SKU retained for context.
Run the final gate:
python3 tools/optimize_op.py <Op> --phase evidence \ --base <ref> --results <description>Require pixelwise-equality evidence for every changed configuration, updated and non-regressing comparable baselines, full-surface profile/lead coverage (agent-verified per the guidance; the gate does not check it), hard evidence for all six checklist items, exhausted leads, stable API/ABI, and
perf:commit hygiene. Treat ODO-9 as the memory-footprint authority; itsMANUALresult requires explicit human review before submission. Resolve everyGAPand unresolvedMANUAL, then rerun. Never weaken or silently retune tests, fabricate baselines, check an evidence item without its hard proof, weaken the ODO-9 memory policy, or change public API/ABI.