feat: V8.2 — P1 Fix + Onboarding-Widerspruch + Strategie-Modus + Lern-Persistenz + DM-Butler

P1 DIAGNOSE:
- Gateway auf .45 nicht deployed (Bare-VM ohne Hermes-Installation)
- Kein Code-Problem, sondern Deployment-Problem (Pfad-Diskrepanz)
- Rainer hatte recht: kein Code-Fix nötig

A1 — Onboarding-Widerspruchsprüfung:
- RoomMap.check_keyword_conflicts() prüft 100%-Keywords gegen andere Räume
- Bei Konflikt: User wird gefragt ob Keyword trotzdem gesetzt werden soll

A2 — Butler-Nachklärung bei Ablehnung (STRATEGIE-MODUS):
- stay_once (Nur diesmal) → Nachklärung mit Strategie-Buttons
- Strategie-Themen (absprache, planung, strategie, entscheidung) → Ring-State 'jetzt' (30 Min TTL), KEIN Lernen
- ANDERER GRUND → normale Lernfunktion
- ArchivarState: set_ring_state(), get_ring_state(), is_ring_state_active()

A3 — Lernfunktion-Persistenz:
- RoomMap.add_keyword_context(): 1x 'Hier bleiben' → keywords_context
- RoomMap.promote_to_keywords_100(): 3x stays → keywords_100
- RoomMap.demote_stale_keywords(): 90 Tage kein Match → auto-demote zu keywords_context
- FAISS is_stale() erkennt Version-Change nach Keyword-Änderung

A4 — Butler in Catch-All DM:
- DM-Guard erlaubt jetzt Butler-Routing (kein sofortiges stay_in_room mehr)
- Strategie-Themen in DM → Strategie-Modus, kein Lernen
- Nicht-Strategie-Themen → normales Lernen

Tests: 19 neue Tests (A1: 4, A2: 7, A3: 5, A4: 3)
427 passed, 1 pre-existing fail (test_no_env_vars)
This commit is contained in:
Bernd (Hermes)
2026-07-14 21:18:51 +02:00
parent 74f8b14a49
commit 39a5041621
5 changed files with 739 additions and 16 deletions
+10 -14
View File
@@ -371,21 +371,17 @@ class BidirectionalRouter:
try:
# ── Schritt 0: DM-Guard (VOR allem anderen) ──────────────────
# DMs haben origin_room_id=''. Der Origin-First Guard greift
# nicht für DMs. LLM kann Projektraum vorschlagen → Guard 3 →
# Move-Request im DM → Antwort landet in Projektraum statt DM.
# DMs sollen nie vom Routing betroffen sein — sie bleiben IMMER
# im DM. (Release-blockierend)
# V8.2 A4: DMs erlauben jetzt Butler-Routing.
# Der alte DM-Guard (stay_in_room für alle DMs) wird durch
# einen modifizierten Guard ersetzt, der LLM-basiertes Routing
# aus DMs erlaubt. Der Archivar schlägt Zielräume vor,
# der User bestätigt via Move-Request-Button.
# Strategie-Themen (absprache, planung, strategie, entscheidung)
# → Strategie-Modus, KEIN Lernen.
if not origin_room_id:
logger.debug("DM-Guard: origin_room_id leer → stay_in_room (DM)")
routing_counter.increment('no_match_stay')
logger.info("ROUTING DECISION: reason=no_match_stay, origin_room=%s, target_room=, stay=True, butler_mode=False", origin_room_id)
return RoutingDecision(
category="direct_question",
target_room="",
confidence=0.0,
stay_in_room=True,
)
# DM: Erlaube Routing, aber markiere als DM-Kontext
logger.debug("DM-Guard V8.2: origin_room_id leer → DM-Routing erlaubt (A4)")
# Kein sofortiges stay_in_room — normaler Flow mit Butler
# ── Schritt 0: Excluded rooms check ──────────────────────────
if origin_room_id and self._room_map.is_excluded(origin_room_id):