| name | optimise |
| description | Read the latest benchmark results from the linux-system-optimisation benchmark folder, then propose and apply tuning — CPU governor + EPP, power-profiles-daemon profile, GPU power profile (NVIDIA / AMD / Intel vendor-specific), per-disk I/O scheduler, swappiness, vm.* sysctls, transparent hugepages, zswap/zram. Shows a before/after diff before applying. Persistent changes (/etc/sysctl.d, systemd units) require explicit confirmation; runtime-only changes apply directly. Triggers on "optimise my system", "tune based on benchmark", "apply optimisations". |
Optimise
Read benchmark output → propose tuning → diff → apply.
Config
${CLAUDE_USER_DATA:-${XDG_DATA_HOME:-$HOME/.local/share}/claude-plugins}/linux-system-optimisation/config.json
benchmarks_dir points to the result store. Read the most recent results.json (highest ISO timestamp). If none exist → call benchmark first.
What to tune
Map findings → actions. Only propose actions backed by an actual benchmark observation; don't speculate.
| Observation | Proposed action |
|---|
| CPU thermal throttling under load | Set governor to performance only when on AC; otherwise schedutil. EPP balance_performance. Check thermal paste / fan curve as a non-software follow-up. |
Low CPU events/sec, governor was powersave | Switch governor (cpupower frequency-set -g performance or via power-profiles-daemon). |
| GPU hitting power cap on NVIDIA | nvidia-smi -pm 1 + raise power limit within hardware max via nvidia-smi -pl <W>. |
| AMD GPU stuck at low pstate | Set /sys/class/drm/card*/device/power_dpm_force_performance_level to auto or high. |
| Disk IOPS far below class baseline (NVMe < 50k randread) | Switch I/O scheduler: NVMe → none; SATA SSD → mq-deadline; HDD → bfq. Apply via udev rule. |
| Memory pressure / heavy swap | Lower vm.swappiness (default 60 → 10 on workstations with ≥16 GB RAM). Enable zram if not already. |
| Many minor faults / slow allocations | Enable transparent hugepages madvise mode. |
| Lots of dirty page writeback stalls | Tune vm.dirty_ratio / vm.dirty_background_ratio. |
Apply protocol
- Compute the diff. For each proposed change, capture current value (e.g.
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor) and target value. Present as a unified table.
- Classify each change as runtime (lost on reboot) or persistent (survives reboot — udev rule, sysctl.d file, systemd unit).
- Apply runtime changes directly — the autonomy directive covers reversible local actions. Note each one as it happens.
- For persistent changes, write to a single dedicated file per category so they're easy to revert:
/etc/sysctl.d/99-linux-system-optimisation.conf
/etc/udev/rules.d/60-linux-system-optimisation-ioscheduler.rules
/etc/systemd/system/linux-system-optimisation-gpu.service (only if GPU tuning needs persistence)
Confirm once before writing the batch — not per file.
- Reload the relevant subsystem:
sysctl --system, udevadm control --reload && udevadm trigger, systemctl daemon-reload && systemctl enable --now <unit>.
- Re-run
benchmark and write a delta summary into the new result folder noting which tunings preceded it.
Safety
- Never raise GPU power limit above the hardware max reported by
nvidia-smi -q | grep 'Max Power Limit'.
- Don't disable thermal protection. Don't write to
/sys/class/thermal/*.
- Don't change CPU microcode or undervolt — out of scope.
- Always keep a backup of the original sysctl values inside the same benchmark result folder (
pre-optimise-sysctl.conf).