detect_drift
Detect drift in numeric sequences using CUSUM analysis. Identify when values deviate from the baseline and assess monotonic progress as improving, stalling, or declining.
Instructions
Detect drift in a numeric sequence using CUSUM (Cumulative Sum) analysis with monotonic progress tracking.
REQUIRED INPUT FORMAT — copy this structure exactly: {"sequence":[0.72, 0.74, 0.73, 0.85, 0.91, 0.93],"drift_sensitivity":0.5}
CUSUM formula: S_i = max(0, S_{i-1} + x_i - omega). Drift detected when S_i > 5 * std(sequence). Also reports monotonic progress: is_improving, is_stalling, is_declining.
Optional field: "drift_sensitivity" (number, default 0.5).
Optionally pass "context" with prior iteration data for escalation and stall detection.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | Optional caller-provided context for iterative enforcement. Include prior failure counts, iteration history, and previous response data to enable escalation and stall detection. Omit for one-shot usage. | |
| sequence | Yes | Array of at least 3 numeric values in temporal order | |
| drift_sensitivity | No | CUSUM sensitivity parameter omega (default: 0.5) |