pub fn detect_pattern(
history: &[(String, String, f32)],
window_size: usize,
) -> PatternStateExpand description
Detect a pattern in a history of (tool, args_hash, quality) triples.
Only the last window_size entries are examined.
Returns PatternState::Single for an empty or single-entry history.
§Why a free function?
The logic is stateless — window_size is the only parameter. A wrapper
struct added no encapsulation and hurt discoverability (KISS).