feat(profiler/behave_shell): emit motor.error_correction

BEHAVE-EXTRACTOR.md Phase B Step B.3. Replaces the prototype's
two-line "0 vs >0 backspaces" placeholder with a backspace-timing
classifier that honours the registry's full vocabulary.

* SessionContext gains backspace_count, backspace_iats (IAT from
  each backspace back to the preceding non-backspace input event),
  and kill_line_count (^U / ^W). Built by _scan_correction_signals,
  which retains only counts and timing aggregates — no character
  data leaves the helper, in line with the BEHAVE PII discipline.
* _features/motor.py:error_correction(ctx) emits one Observation
  in {immediate, deferred, absent, route_around}.
  - 0 backspaces + ≥1 ^U/^W → route_around (rewrite, not correct)
  - 0 backspaces + 0 kill-lines → absent
  - backspaces with median IAT ≤ 500 ms → immediate
  - slower → deferred
  Confidence 0.65 / 0.65 / 0.55 / 0.55.
* < 3 inputs → skip emit.
* Calibration grid widened to include motor.error_correction;
  green across all five shards.

Tests cover all four buckets, the < 3 inputs skip, and the PII
regression (raw command body never appears in the serialised
observation).
This commit is contained in:
2026-05-03 21:27:46 -04:00
parent 0737fcfe93
commit d04f91cd8c
6 changed files with 167 additions and 0 deletions

View File

@@ -98,3 +98,9 @@ MIN_INPUTS_FOR_CADENCE: int = 5
# of sub-floor IATs flags double-press / motor twitch / stuck-key.
TREMOR_FAST_FLOOR_S: float = 0.030
TREMOR_RATE_MIN: float = 0.10 # ≥10% sub-floor → tremor
# ── motor.error_correction (Step B.3) ───────────────────────────────────────
# Backspace within this many seconds of the preceding key = "caught the
# typo mid-keystroke" (immediate). Beyond this = the operator paused,
# noticed, then went back (deferred).
BACKSPACE_IMMEDIATE_MAX_S: float = 0.50