From 94882255568a672570f1efee368e9ab79da863e8 Mon Sep 17 00:00:00 2001 From: kami Date: Mon, 6 Jul 2026 11:51:31 +0400 Subject: [PATCH] maven: dedupe knowledge prompt to router.KnowledgePrompt (task 4 follow-up) Task 4 created and tested router.KnowledgePrompt() but the live path in LLMPhraser.PhraseQuery used a separate hardcoded copy of the same RU anti-hallucination prompt, leaving KnowledgePrompt() as dead code and two strings that could drift. Point the phraser at the tested helper so there is a single source of truth. Co-Authored-By: Claude Opus 4.8 --- internal/phraser/llmphraser.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/phraser/llmphraser.go b/internal/phraser/llmphraser.go index fa7fe51..27d1f35 100644 --- a/internal/phraser/llmphraser.go +++ b/internal/phraser/llmphraser.go @@ -16,6 +16,7 @@ import ( "github.com/kami/maven/internal/delivery" "github.com/kami/maven/internal/loop" + "github.com/kami/maven/internal/router" ) var listenRE = regexp.MustCompile(`listening on (https?://\S+)`) @@ -171,8 +172,9 @@ func (p *LLMPhraser) PhraseNudge(ctx context.Context, c loop.Candidate) (deliver // LLM error — better to give the raw data than silence. func (p *LLMPhraser) PhraseQuery(ctx context.Context, utterance string, notes []string) (string, error) { if len(notes) == 0 { - // General knowledge — no notes to ground the answer - sys := "Ты — Мавена, персональный ассистент. Ответь кратко из своих знаний. Если не знаешь — скажи \"не знаю\". Не выдумывай." + // General knowledge — no notes to ground the answer. The system + // prompt is the single tested source in router.KnowledgePrompt. + sys := router.KnowledgePrompt() prompt := fmt.Sprintf("Пользователь спрашивает: \"%s\".", utterance) resp, err := p.chatWithSystem(ctx, sys, prompt, 256) if err != nil || resp == "" {