From b21a8bec191fe7b67df3678a958dadaf88b183b6 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Tue, 9 Jun 2026 21:13:27 +0200 Subject: [PATCH] feat(archivar): zweistufige Keyword-Optimierung mit min_score=2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - find_room_by_keywords() mit min_score Parameter (default=2) Nur wenn best_score >= min_score → Raum returned, sonst None → Router fällt zu Embedding/LLM-Klassifikator durch - verhindert Fehlrouting bei einzelnen Keyword-Treffern (plugin, etc.) Architektur: Rainer | Implementierung: Miguel | QG: Rainer F1-F5 bestanden --- plugin/archivar/room_map.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/archivar/room_map.py b/plugin/archivar/room_map.py index da8b4b3..eb293f0 100644 --- a/plugin/archivar/room_map.py +++ b/plugin/archivar/room_map.py @@ -137,15 +137,17 @@ class RoomMap: # ── Lookup Methods ──────────────────────────────────────────────── - def find_room_by_keywords(self, text: str) -> Optional[RoomEntry]: + def find_room_by_keywords(self, text: str, min_score: int = 2) -> Optional[RoomEntry]: """Find the room with the most keyword matches for *text*. Args: text: The message text to classify. + min_score: Minimum score required to return a room (default: 2). Returns: The ``RoomEntry`` with the highest match score, or ``None`` - if no room has any matching keywords. + if no room has any matching keywords or if the best score + is below the minimum threshold. """ best_room: Optional[RoomEntry] = None best_score: int = 0 @@ -158,7 +160,9 @@ class RoomMap: best_score = score best_room = room - return best_room + if best_room is not None and best_score >= min_score: + return best_room + return None def is_excluded(self, room_id: str) -> bool: """True if *room_id* is in the excluded list (e.g. Multi-Agent-Raum)."""