Misunderstanding detection
Reported and inferred signal types, timing rules, failure classification, and confidence values.
Failures come from explicit outcome telemetry or narrow inference over tenant and session-scoped gate streams. Each event stores source as reported or inferred.
#Reported signals
| Event | Failure rule | Confidence |
|---|---|---|
correction | Always misunderstanding. | 1.0 |
rephrase | Failure when token-set similarity is above 0.6 within five minutes of latest gate. | Similarity, fallback 0.9 |
regenerate | Second and later regenerate in session. | 0.9 |
abandon | Failure when session has prior gate. | 0.9 |
accept | Not failure. | 1.0 |
#Inferred signals
New gate within five minutes of prior gate can infer:
correctionwhen request begins withno,not that,I meant, oractually;rephrasewhen token-set similarity exceeds0.6.
Inferred correction confidence is 0.95. Inferred rephrase confidence is similarity clamped to 0.65–0.95.
Suspected abandon is materialized on next tenant read, not background job, when session has exactly one gate, no event, gate is at least 30 minutes old, and ambiguity crosses threshold. Confidence is 0.4.
#Weighting
Reports count reported failures at weight 1.0. Inferred failures use confidence × 0.5. This changes ranking/cost estimates, not raw failure count.
abandon can be unrelated. Treat inferred events as lower-confidence evidence.
backend/app/main.pybackend/app/inference.pybackend/app/detector.py