router/semantic: slice 23 corpus fast-path reconciliation — DeriveFastPath over the real router replaces the regex mirror, factory/merge validated, corpus rebuilt (dataset_hash unchanged), drift diagnostic and rerun tooling

This commit is contained in:
2026-09-08 04:02:00 +04:00
parent bb6bd8efb9
commit be71ac406b
12 changed files with 8460 additions and 7890 deletions
@@ -5,6 +5,7 @@ import (
"os"
"github.com/kami/maven/internal/router"
"github.com/kami/maven/internal/router/semantic"
)
// headsMain runs the deployed cascade minus the resident LLM: stage-0
@@ -48,7 +49,7 @@ func headsMain(poolPath, outPath string) {
}
defer heads.Close()
acts := router.DefaultActMatcher{Fns: actVerbList()}
acts := router.DefaultActMatcher{Fns: semantic.ExperimentActVerbs()}
r := router.New(router.Config{
Grammars: router.StageZeroGrammars(acts),
Classifier: cls,
@@ -10,6 +10,7 @@ import (
"strings"
"github.com/kami/maven/internal/router"
"github.com/kami/maven/internal/router/semantic"
)
// Seed loading replicated from cmd/mavend/voicewire.go (seedClassifier) and
@@ -23,26 +24,13 @@ var seedIntents = []router.Intent{
router.IntentNote, router.IntentQuery, router.IntentChat, router.IntentSystem,
}
// actVerbList mirrors the eval fixture's static allowlist
// (internal/router/semantic/helpers_test.go). The production matcher's
// allowlist is the deployment's enabled tools; an act grammar can only catch
// a row whose first tokens match an allowlisted verb, and the experiment's
// act allowlist is the one the accepted slice-21 methodology used.
func actVerbList() []string {
return []string{
"перезапусти", "перезагрузи", "выключи", "включи", "останови", "запусти",
"закрой", "открой", "сделай", "поставь",
"restart", "reboot", "stop", "start", "turn off", "turn on", "open", "close",
}
}
// buildMinimalRouter reproduces internal/router/semantic/buildMinimalRouter:
// the daemon's grammar set, a hash-embedder classifier seeded from
// models/seeds, and the deployed 0.55 threshold. Deterministic and
// reproducible. The ONNX embedder and the routing heads score elsewhere;
// this is the floor the eval fixture reports as the legacy baseline.
func buildMinimalRouter() *router.Router {
acts := router.DefaultActMatcher{Fns: actVerbList()}
acts := router.DefaultActMatcher{Fns: semantic.ExperimentActVerbs()}
cls := router.NewClassifier(router.NewHashEmbedder(1024))
seedClassifier(cls)
return router.New(router.Config{