Strategie B: _room_to_text() webt kuratierte seed_data-Messages
in den Embedding-Text ein, um FAISS-Similarity zu schärfen.
Änderungen:
- room_index.py: import SEED_DATA, _room_to_text() erweitert
um Seed-Message-Einwebung (nur für Räume mit SEED_DATA-Eintrag)
- test_room_index.py: MockEmbeddingClient auf Keyword-Zählung
umgestellt (statt binär any()) — verhindert Cross-Contamination
durch längere Embedding-Texte mit Seed-Messages
Tests: 35/35 passed (22 booster + 13 room_index)
NEUES MODUL: plugin/archivar/feedback_detector.py
- RoutingWiderspruchDetector mit 4 Regex-Gruppen (Hauptmuster, Umrouting,
Verneinung, Befehle)
- ContradictionResult dataclass: has_contradiction, contradiction_type,
confidence, target_room, rejected_room, matched_pattern
- Edge Cases: 'nicht in X, sondern in Y' → X negativ, Y als Ziel
- Kein LLM-Fallback (nur Regex in v1)
EINHAENGUNG adapter_integration.py:
- ArchivarMessageHandler.__init__(): self._feedback_detector
- detect_routing_contradiction(text, origin_room_id) → ContradictionResult|None
- Bei Treffer: update_keyword_weight(feedback_type='never')
- _resolve_room_name_to_id() für Raum-Name → room_id Auflösung
EINHAENGUNG adapter.py:
- _process_incoming(): VOR classify_and_route() → contradiction-Check
- Bei Treffer: Decision überschreiben (stay_in_room=True)
- [WIDERSPRUCH]-Präfix — Nachricht NICHT schlucken, normal an Agent
- NUR wenn KEIN Button-Feedback aktiv (kein pending move-request)
Tests: 57/58 passed (1 pre-existing env-var failure unverändert)
OllamaLLMClient.generate() is async def — run_in_executor cannot
correctly execute async functions. The coroutine was never awaited.
Also fix Move-Request parser: native button '1️⃣ Rüber' was not
matched against '1️⃣' — fell through to 'stay' instead of 'move'.
- classifier.py: _llm_raw_sync → async _llm_raw, await generate()
- router.py: remove run_in_executor, direct await _llm_raw()
- adapter.py: normalize MOVE_REQ choice (extract leading digit/emoji)
- initialize() now tries load() from disk first
- If load succeeds: log 'Index von Disk geladen' + wire router
- If load fails: build_index() + save() + log 'Index gebaut + gespeichert' + wire router
- Eliminates unnecessary index rebuild on every gateway restart
- All 58 tests pass
setLevel(INFO) alone was not enough — without a handler and with
propagate=True (default), logs were accepted by the root logger
(level WARNING) but silently discarded since root has no handlers.
Now matches adapter.py pattern: StreamHandler + propagate=False,
so all submodule logs (classifier, router, room_index, booster)
are visible via the shared parent logger.
Root logger defaults to WARNING (level 30) when no basicConfig is set.
adapter_integration.py only called getLogger(__name__) without setLevel,
so all INFO logs were silently filtered. adapter.py already had its own
setLevel(INFO) + handler, which is why its logs appeared.
Fix: add logger.setLevel(logging.INFO) after getLogger(__name__) at line 94.
This restores all suppressed INFO logs:
- Initializing ArchivarMessageHandler...
- FAISS Phase-1: RoomIndexManager + KeywordBooster ready
- FAISS Phase-1: Index built
- FAISS Phase-1: Router wired
- ArchivarMessageHandler ready
Root cause: RoomIndexManager.stats() returns a dict with mixed types
(bool, int, float, str). sum() iterated over all values and crashed
when hitting built_at_iso (str) after built_at (float).
Fix: Replace stats() call with direct .size and .room_ids properties.
Also commit FAISS Phase-1 files (booster.py, room_index.py, seed_data.py)
that were deployed to Gateway but not yet in repo.
Tests: 58 passed (0 failures)
check_room_map_completeness() und _load_room_map() verwendeten
hardcodierte Pfade (~/.hermes/hermes-agent/data/room-map.json)
statt der Konstanten ROOM_MAP_PATH/DEFAULT_MAP_PATH.
Das führte dazu, dass Unit-Tests die produktive room-map.json
überschrieben — der Mock-Patch auf ROOM_MAP_PATH griff nicht,
weil save() und reload() den hardcodierten Pfad verwendeten.
Fix:
- adapter_integration.py: 2 hardcodierte Pfade → ROOM_MAP_PATH
- room_map.py: Doppelte DEFAULT_MAP_PATH-Zuweisung entfernt
Drei Routing-Bug-Fixes basierend auf Analyse des Timeout-Falls vom 15.06.2026:
FIX 1 (KRITISCH): Timeout-Fallback auf Ursprungsraum statt Catch-All
- _llm_room_lookup() gibt jetzt (RoomEntry|None, bool) zurück
- bool=True signalisiert LLM-Aufruf-Fehler (Exception/Timeout)
- Bei LLM-Fehler: stay_in_room=True, is_catch_all=False
- Nur bei explizitem CATCH_ALL vom LLM: catch_all-Raum als Ziel
FIX 2: Keyword-Matching vor LLM-Aufruf (Embedding+Keyword-Fallback)
- Nach Embedding-Vorfilter: wenn work_order mit conf < 0.9
- find_room_by_keywords() aufrufen, bei Match direkt zurückgeben
- Verhindert unnötige LLM-Calls für klare Keyword-Matches
FIX 3: find_room_by_keywords() verbessert
- keywords_100-Matches: nicht erster Treffer, sondern Raum mit
den MEISTEN 100%-Matches gewinnt (best_100_score)
- keywords_context bleibt Fallback wenn kein 100%-Match existiert
Tests: 57/58 passed (1 pre-existing env-var failure)
- 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
DocumentationStore() now uses RoomMap.fact_store_path instead of the
hardcoded ~/.hermes/.../archivar_docs default. One-line change — the
doc_store is initialized after _load_room_map() so room_map is available.
This allows per-deployment configuration: in production, fact_store_path
points to /data/Wissensdatenbank/0100 Inbox so FAKT messages land in the
Obsidian vault's inbox for StartObsidian integration.
Implements the RC-Skill's promised room-map completeness check after
Adapter.connect(). Previously the adapter subscribed to rooms but never
verified they were all present in room-map.json. New rooms were
subscribed but invisible to the Archivar router.
Scope (~450 lines, 4 files):
- adapter_integration.py: check_room_map_completeness() compares
subscribed rooms (filtered to c/p types) against RoomMap.
Single-Room-Regel: 1 relevant room → auto catch_all, no interview.
onboarding_active flag in _stats prevents re-triggering.
- room_map.py: add_or_update_room() for safe in-memory mutations,
reload() for disk-to-memory sync without gateway restart,
static save() for atomic file writes.
- adapter.py: connect() calls check after Archivar init, triggers
_start_onboarding() if rooms missing. _process_incoming() intercepts
'Raum: #Name = Thema' responses during active onboarding.
- test_auto_onboarding.py: 4 unit tests covering single-room
auto-assign, multi-room detection, DM filtering, and already-
complete map (no action).
Deployed to production: adapter.py + archivar/*.py copied to
Auslieferungspfad. Gateway restarted — no onboarding triggered
(map already complete).
Vier harte Änderungen:
1. config.py: ARCHIVAR_FAKT_ROOM existiert nicht mehr. FAKT wird
niemals in ROOM_MAPPING aufgenommen — Env-Variable obsolet.
2. router.py: FAKT-Entscheidungen werden VOR der Subscription-
Validierung als is_unrouteable markiert. Kein if/else, kein
Ermessensspielraum.
3. adapter_integration.py: classify_and_route() legt FAKT automatisch
im DocumentationStore ab (existiert bereits).
4. Env-Variable ARCHIVAR_FAKT_ROOM aus systemd env.conf entfernt.
Resultat: Nur FRAGE und ALARM werden jemals in Chat-Räume geroutet.
FAKT-Nachrichten wie 'CPU-Last bei 92%' sind reine Dokumentation —
sie landen als Markdown unter data/archivar_docs/fakt/
Harte Durchsetzung: Der Archivar darf NUR in Räume routen, die der Bot
tatsächlich abonniert hat. Alles andere ist ein Architekturfehler.
Neu:
- doc_store.py: DocumentationStore — speichert unrouteable Nachrichten
als Markdown mit YAML-Frontmatter unter data/archivar_docs/{category}/
- router.py: RoutingDecision.is_unrouteable + unrouteable_reason,
MessageRouter.set_subscribed_room_ids(), Zielraum-Validierung
- adapter_integration.py: ArchivarMessageHandler.set_subscribed_room_ids(),
classify_and_route() leitet bei is_unrouteable in doc_store um
- adapter.py: set_subscribed_room_ids() wird nach connect() mit den
realen subscribed rooms gefüttert
Verhalten: Wenn jemand 'ALARM: Server down' in einem Raum schreibt,
den der Bot nicht abonniert hat, wird die Nachricht KLASSIFIZIERT,
aber NICHT geroutet — sie landet im doc_store mit Begründung.
A: config.py auf Env-Vars umgestellt (ARCHIVAR_FAKT_ROOM, _FRAGE_ROOM, _ALARM_ROOM, _CATCHALL_ROOM, _PROJECT_ROOMS)
B: adapter.py-Kommentare von BAT-Terminologie auf generisch umgeschrieben
C: archivar/SKILL.md — Hermes-Skill-Schema mit Triggern, Architektur, Konfiguration, Pitfalls
D: classify_and_route() + send_callback in _process_incoming() integriert, chat_name mit [KATEGORIE] angereichert
E: RocketChatREST.download_file() — authentifizierter Datei-Download via X-Auth-Token, kein Security-Scanner-Trigger mehr
_download_and_inline_files() inlined [FILE]-Inhalte direkt in den Prompt
- adapter.py: recopied from production (write_file corrupted the em-dash on line 8)
- All archivar/*.py: from archivar.X → from .X for plugin-context compatibility