From 853255a2279c2e0eb2422a9af20feaf5139b2741 Mon Sep 17 00:00:00 2001 From: viettranx Date: Sun, 12 Apr 2026 18:11:48 +0700 Subject: [PATCH] fix(vault): stricter classify prompt - ctx under 50 chars, compact JSON example --- internal/vault/enrich_classify_prompt.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/internal/vault/enrich_classify_prompt.go b/internal/vault/enrich_classify_prompt.go index 1c9c5488..c70febef 100644 --- a/internal/vault/enrich_classify_prompt.go +++ b/internal/vault/enrich_classify_prompt.go @@ -24,19 +24,14 @@ const classifySystemPrompt = `You classify relationships between documents in a - contradicts: A conflicts with or opposes B's content ## Rules -- Respond with EXACTLY one JSON entry per candidate, no markdown fences, no explanation -- Use SKIP when documents are similar but have no meaningful relationship -- Prefer specific types (reference, depends_on) over generic (related) -- Keep ctx under 30 words +- Respond with EXACTLY one JSON entry per candidate +- Output ONLY raw JSON array, no markdown, no explanation +- Use SKIP when no meaningful relationship exists +- Prefer specific types over "related" +- ctx MUST be under 50 characters (5-8 words max) ## Output Format -[ - {"idx":1,"type":"reference","ctx":"mentions OAuth config"}, - {"idx":2,"type":"SKIP"}, - {"idx":3,"type":"extends","ctx":"adds error handling details"}, - {"idx":4,"type":"SKIP"}, - {"idx":5,"type":"depends_on","ctx":"requires auth middleware"} -]` +[{"idx":1,"type":"reference","ctx":"cites OAuth spec"},{"idx":2,"type":"SKIP"},{"idx":3,"type":"extends","ctx":"adds error handling"},{"idx":4,"type":"SKIP"},{"idx":5,"type":"depends_on","ctx":"needs auth module"}]` // buildClassifyPrompt formats the system and user prompts for classify LLM call. func buildClassifyPrompt(source classifyDoc, candidates []classifyDoc) (system, user string) {