Systematic optimization hunter for lading. Finds memory optimizations AND bugs - both are valuable. Run /lading-optimize-validate when bugs are discovered.
Coordinates optimization attempts: captures baselines, implements changes, invokes review, and records all outcomes.
Hunt is the coordinator and recorder โ it captures baselines, implements changes, hands off to review, and records all outcomes.
Hunt does NOT:
Hunt DOES:
.claude/skills/lading-optimize-hunt/assets/db.yaml after review returnsRun /lading-preflight.
Run /lading-optimize-find-target.
It returns a YAML block with 6 fields: pattern, technique, target, file, bench, fingerprint - Print it out.
CRITICAL: Capture baseline metrics BEFORE making any code changes.
Use the bench and fingerprint fields from find-target's output โ they are repo-relative paths ready to use:
BENCH=<bench field without extension> # e.g. from "lading_payload/benches/syslog.rs" use "--bench syslog"
PAYLOADTOOL_CONFIG=<fingerprint field> # e.g. "ci/fingerprints/syslog/lading.yaml"
Clear any previously captured baselines so stale data cannot contaminate this run.
rm -f /tmp/criterion-baseline.log /tmp/baseline.json /tmp/baseline-mem.txt
rm -rf target/criterion
Run only the benchmark for your target:
cargo criterion --bench "$BENCH" 2>&1 | tee /tmp/criterion-baseline.log
Use the matching fingerprint config:
cargo build --release --bin payloadtool
hyperfine --warmup 3 --runs 30 --export-json /tmp/baseline.json \
"./target/release/payloadtool $PAYLOADTOOL_CONFIG"
./target/release/payloadtool "$PAYLOADTOOL_CONFIG" --memory-stats 2>&1 | tee /tmp/baseline-mem.txt
Baseline captured. These files will be consumed by review:
/tmp/criterion-baseline.log โ micro-benchmark baseline/tmp/baseline.json โ macro-benchmark timing baseline/tmp/baseline-mem.txt โ macro-benchmark memory baselineCRITICAL: All benchmarks must complete before continuing.
Make ONE change. Keep it focused and minimal.
Before proceeding, ALL changes must pass:
ci/validate
No exceptions. If ci/validate fails, fix the issue before continuing.
If ci/validate repeatedly fails on a pre-existing bug (not caused by your change), document it and stop.
Run /lading-optimize-review with the target fields as positional arguments:
/lading-optimize-review <bench> <fingerprint> <file> <target> <technique>
Where:
<bench> โ benchmark name from find-target's bench field, without path or extension (e.g. trace_agent)<fingerprint> โ repo-relative path from find-target's fingerprint field<file> โ repo-relative path from find-target's file field<target> โ function name from find-target's target field<technique> โ technique from find-target's technique fieldIt returns a YAML report. Print it out.
After review returns its YAML report, record the result. Every outcome MUST be recorded.
Write review's YAML report verbatim to .claude/skills/lading-optimize-hunt/assets/db/<id>.yaml. Do not modify, reformat, or add to the report content โ it is the authoritative record from review.
Add an entry to .claude/skills/lading-optimize-hunt/assets/db.yaml following the format in .claude/skills/lading-optimize-hunt/assets/index.template.yaml.