mavend: read a spoken correction of the previous turn (V-455)

CorrectMisroute has been in the router since it was written with no caller
outside a test. repair.go is the half that reads the words: a marker saying
she was wrong plus the intent it should have been, with the negated half
skipped, and it teaches the classifier and redoes the request under the
corrected intent.
This commit is contained in:
2026-08-04 04:21:03 +04:00
parent 1558233665
commit bf6c2bf1a6
3 changed files with 220 additions and 0 deletions
+6
View File
@@ -2,6 +2,7 @@ package router
import (
"context"
"errors"
"log"
"time"
)
@@ -201,5 +202,10 @@ func (r *Router) gateLLMDecision(d *Decision) {
// retrain). Same shape as nudges.outcome tuning cooldowns: more reliable over
// time, introspectable, no model surgery.
func (r *Router) CorrectMisroute(ctx context.Context, utterance string, corrected Intent) error {
if r == nil || r.classifier == nil {
// The LLM router can run with no classifier wired. The correction has
// nowhere to land then, and the caller redoes the request anyway.
return errors.New("router: no classifier to correct")
}
return r.classifier.AddExample(ctx, corrected, utterance)
}