codex/skills/lift/SKILL.md
Performance optimization with measurement-driven latency, throughput, memory/GC, tail, algorithmic, systems, and micro-architectural work; profile evidence, score-gated experiments, behavior proofs, golden oracles, and regression guards. Use for optimize, speed up, reduce p95/p99, increase throughput/QPS, lower CPU/memory/allocations/GC/syscalls/round trips, profiling, bottlenecks, algorithmic improvement, or benchmarked perf passes. Without a runnable workload, operate in labelled UNMEASURED mode with exact benchmark/profiling/proof commands. Prove Zig-only bench_stats/perf_report CLI iteration before shipping.
npx skillsauth add tkersey/dotfiles liftInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deliver aggressive performance improvements while preserving behavior, safety, determinism, and maintainability. Lift is the umbrella optimization skill for product workloads, service latency, batch/offline throughput, memory pressure, tail behavior, algorithmic complexity, data layout, concurrency, I/O, and runtime or compiler tuning.
Profile first. Prove behavior unchanged. Change one lever at a time. Measure before and after on the same workload. Ship only with a regression guard.
Every optimization pass must produce evidence for five questions:
Lift lives in Define -> Deliver.
UNMEASURED:
and provide exact commands. Do not claim wins.bench_stats, perf_report) and
prove compatibility with marker checks before use.Use measured mode whenever a proof workload can run.
UNMEASURED:. Provide hypotheses and the exact
commands that would generate baseline, profile, correctness, and after data.If the user did not provide a numeric target, define the contract as:
Improve
<primary metric>on<workload>versus baseline; report delta and do not regress<correctness + secondary metrics>.
Default primary metric:
Pick the first representative runnable proof workload available:
UNMEASURED
mode and specify the missing workload requirements.0. PREFLIGHT -> environment, workload, correctness oracle, warmup sanity
1. BASELINE -> repeated samples, p50/p95/p99/max or throughput/RSS/allocs
2. PROFILE -> CPU, allocation, I/O, lock, queue, or tail evidence
3. PROVE -> golden outputs, invariants, property tests, or differential run
4. SCORE -> opportunity matrix: Impact x Confidence / Effort
5. IMPLEMENT -> one lever only, smallest reversible diff
6. VERIFY -> correctness gate, golden checksum/diff, benchmark rerun
7. REPROFILE -> confirm bottleneck moved or score next opportunity
8. GUARD -> benchmark budget, CI gate, monitor, or perf report
Default benchmark examples:
hyperfine --warmup 3 --runs 10 'command'
hyperfine --warmup 3 --runs 30 --export-json baseline.json 'command'
/usr/bin/time -v command 2>&1 | tee time.txt
Default behavior oracle examples:
mkdir -p golden_outputs
for input in test_inputs/*; do ./program "$input" > "golden_outputs/$(basename "$input").out"; done
sha256sum golden_outputs/* > golden_checksums.txt
sha256sum -c golden_checksums.txt
Only implement a candidate when the score is at least 2.0, unless the user explicitly requests exploratory work.
Score = (Impact x Confidence) / Effort
Impact: 1=<5%, 2=5-10%, 3=10-25%, 4=25-50%, 5=>50%
Confidence: 1=speculative, 3=plausible, 5=profile-confirmed
Effort: 1=minutes, 3=hours, 5=>1 day or high complexity
| Opportunity | Hotspot evidence | Impact | Confidence | Effort | Score | Decision |
|---|---:|---:|---:|---:|---:|---|
| <change> | <profile/trace/counter> | | | | | accept/reject |
For every accepted change, document an isomorphism proof before claiming success.
Use references/behavior-proof.md for full guidance.
## Behavior proof: <change>
- Inputs covered:
- Old behavior:
- New behavior:
- Ordering preserved:
- Tie-breaking unchanged:
- Floating-point semantics:
- RNG/time/concurrency determinism:
- Error handling and edge cases:
- Golden outputs / differential check:
- Correctness command(s):
Common proof obligations:
Move down only after higher-leverage tiers are exhausted.
Each round starts with a fresh profile because bottlenecks shift.
| Tier | Pattern | When | Proof concern | |---|---|---|---| | 1 | N+1 -> batch | Sequential external calls | Result ordering and retry semantics | | 1 | Linear scan -> index/hash | Repeated keyed lookup | Key equality and observable order | | 1 | Memoization | Repeated pure computation | Cache key, invalidation, bounds | | 1 | Buffer/prealloc reuse | Allocation in hot loop | Aliasing and lifetime safety | | 2 | Binary search/two-pointer | Sorted or monotone data | Precondition validation | | 2 | Prefix sums/sliding window | Repeated range queries | Static data or update semantics | | 2 | Priority queue/top-k | Scheduling or ranking | Tie-breaking and stability | | 3 | Arena/pool/SmallVec/SoA | Allocation or locality bound | Lifetime, ownership, memory cap | | 3 | Bloom/sketch/HLL | Membership/counting at scale | Error bound and acceptance | | 3 | Lock sharding/queues | Contention/tail bound | Races, fairness, backpressure |
| Ecosystem | First profiler | Allocation/memory | Fast grep signals |
|---|---|---|---|
| Rust/Zig/C/C++ | perf, flamegraph, Instruments | heaptrack, DHAT, massif | clones/copies, boxes, formatting, allocs |
| Go | go tool pprof, go tool trace | heap/alloc profiles, GODEBUG=gctrace=1 | interface{}, defer in loops, fmt.Sprintf |
| Node/TypeScript | clinic flame, node --prof | DevTools heap, event-loop delay | JSON parse/stringify, sync fs, await-in-loop |
| Python | py-spy, cProfile, scalene | memory_profiler, tracemalloc | iterrows, string +=, list membership |
| JVM | JFR, async-profiler | allocation/lock events, GC logs | boxing, reflection, synchronized hot path |
When iterating on the Zig-backed bench_stats / perf_report helper CLI path,
use these two repos:
skills-zig ($HOME/workspace/tk/skills-zig): source for bench_stats and
perf_report, build/test wiring, and release tags.homebrew-tap ($HOME/workspace/tk/homebrew-tap): Homebrew formula updates
and checksum bumps for released lift binaries.For Lift-owned CLIs, prove marker compatibility before use:
command -v bench_stats && bench_stats --help 2>&1 | grep -q bench_stats.zig
command -v perf_report && perf_report --help 2>&1 | grep -q perf_report.zig
bench_stats --input samples.txt --unit ms
perf_report --title "Perf pass" --owner "team" --system "service" --output /tmp/perf-report.md
run_lift_tool() {
local subcommand="${1:-}"
if [ -z "$subcommand" ]; then
echo "usage: run_lift_tool <bench-stats|perf-report> [args...]" >&2
return 2
fi
shift || true
local bin="" marker=""
case "$subcommand" in
bench-stats) bin="bench_stats"; marker="bench_stats.zig" ;;
perf-report) bin="perf_report"; marker="perf_report.zig" ;;
*) echo "unknown lift subcommand: $subcommand" >&2; return 2 ;;
esac
install_lift_direct() {
local repo="${SKILLS_ZIG_REPO:-$HOME/workspace/tk/skills-zig}"
if ! command -v zig >/dev/null 2>&1; then
echo "zig not found. Install Zig and retry." >&2
return 1
fi
if [ ! -d "$repo" ]; then
echo "skills-zig repo not found at $repo." >&2
echo "clone it with: git clone https://github.com/tkersey/skills-zig \"$repo\"" >&2
return 1
fi
(cd "$repo" && zig build -Doptimize=ReleaseSafe) || return 1
[ -x "$repo/zig-out/bin/$bin" ] || return 1
mkdir -p "$HOME/.local/bin"
install -m 0755 "$repo/zig-out/bin/$bin" "$HOME/.local/bin/$bin"
}
if command -v "$bin" >/dev/null 2>&1 && "$bin" --help 2>&1 | grep -q "$marker"; then
"$bin" "$@"
return
fi
if [ "$(uname -s)" = "Darwin" ]; then
command -v brew >/dev/null 2>&1 || { echo "homebrew is required on macOS" >&2; return 1; }
brew install tkersey/tap/lift || return 1
else
install_lift_direct || return 1
fi
if command -v "$bin" >/dev/null 2>&1 && "$bin" --help 2>&1 | grep -q "$marker"; then
"$bin" "$@"
return
fi
echo "missing compatible $bin binary after install attempt" >&2
return 1
}
If unmeasured, prefix the response with UNMEASURED: and fill the sections with
an exact measurement/profiling/proof plan. Do not claim deltas.
Output these sections, numbers first:
Performance contract
Baseline
Bottleneck evidence
Opportunity matrix
Behavior proof
Experiments
Result
Regression guard
Validation
lift_compliance: mode=<measured|unmeasured|audit>; workload=<cmd>; baseline=<yes/no>; after=<yes/no>; correctness=<yes/no>; bottleneck_evidence=<yes/no>; behavior_proof=<yes/no>; score_gate=<yes/no>
references/playbook.md — master flow, doctrine, and loop.references/measurement.md — benchmarking, statistics, noise, and reporting.references/profiling-tools.md — tool matrix and evidence artifacts.references/behavior-proof.md — golden outputs, invariants, isomorphism proof.references/opportunity-matrix.md — impact/confidence/effort score gate.references/optimization-tactics.md — tactical catalog by layer.references/algorithms-and-data-structures.md — algorithmic and structural levers.references/systems-and-architecture.md — CPU, memory, OS, network tactics.references/latency-throughput-tail.md — queueing, variance, and backpressure.references/language-specific.md — ecosystem-specific profilers and red flags.references/advanced-techniques.md — round-2/round-3 advanced patterns.references/checklists.md — fast triage and validation checklists.references/anti-patterns.md — traps to reject.assets/perf-report-template.md — ready-to-edit measured or unmeasured report.assets/experiment-log-template.md — one-variable experiment ledger.assets/isomorphism-proof-template.md — per-change behavior proof.assets/opportunity-matrix-template.md — score-gated opportunity table.assets/golden-output-manifest.md — golden-output capture checklist.tools
Convert markdown plans into beads with dependencies using br CLI. Use when creating task graphs, polishing beads before implementation, or bridging planning to agent swarm execution.
development
Orchestrate Codex skill optimization during active sessions through $cas goal control, $shadow single-session evidence, $tune diagnosis/refinement briefs, and the skill-optimizer custom subagent. Trigger for $opt, skill optimization loops, session-driven skill tuning, meta-skill audits, or explicit validated skill edits. Do not use for general code optimization, product optimization, or performance tuning.
development
Run a targeted fresh-eyes blunder pass over code, specs, plans, adjudications, closure gates, skill edits, or negative-evidence ledgers. Trigger when asked to reread with fresh eyes, find obvious bugs, catch mistakes/oversights/omissions, check for embarrassing misses, or perform a second independent blunder pass before closure. Do not use as a substitute for implementation, adjudication, or verification; use it as the final falsification/check pass for those workflows.
development
Explicitly shadow, tail, watch, follow, monitor, supervise, or companion exactly one Codex session id/path through `$seq`, then apply a named target skill as an interpretation/reporting/proposal/action lens until the watched session stops.