🔌 The Clutch — spend expensive compute only when reality drifts
A substrate-agnostic dual-process controller, distilled from Antti Luode's Loom Navigator to its one reusable idea:
Run a cheap cached policy by default. Only pay for an expensive planner when a surprise signal trips a gate. When things go calm, latch the fresh plan back into the cache.
clutch.py is ~120 lines, zero dependencies, and makes no assumption about what the
substrates are — you hand it three callbacks (a cheap step, an expensive plan, a scalar
error) and pick a gate. The two live demos below drive the same controller on two
unrelated problems. Do not hype. Do not lie. Just show.
An agent patrols A↔B on a 60×60 grid. Walls with a gap drop at scripted times, breaking the cached route. Every maze is guaranteed solvable, so the outcome reflects the gate, not luck.