7 Commits

Author SHA1 Message Date
Bernd (Hermes) 5027738342 chore(F-542): @implements Batch 1 — 10 Dateien mechanisch nachgeruestet @implements: [F-542] 2026-09-17 14:34:51 +02:00
Bernd (Hermes) 374e2e7700 P-028 Mitigation: split keyword matching — match_keyword_exact for kw100, match_keyword for kwctx
TEIL 1 — booster.py:
- Split _keyword_to_rooms into _kw100_to_rooms + _kwctx_to_rooms
- keywords_100 matched via match_keyword_exact (no fuzzy/stemming, hyphen-insensitive)
- keywords_context matched via match_keyword (fuzzy/stemming preserved)
- _build_mapping() builds both mappings separately
- boost() uses separate matchers per keyword type
- _count_unique_matches() checks both mappings with respective matchers
- _record_matches() now takes only matched_kw100 (context keywords never tracked)
- cleanup_orphaned_rooms() rebuilds both mappings

TEIL 2 — room-map.json (data, not in git):
- Removed 39 space-variant dual keywords (e.g. 'presence engine' removed,
  'presence-engine' kept). No longer needed since match_keyword_exact
  is hyphen-insensitive.
- Backup: .bak-pre-curation-20260805

Tests: 35/35 passed (pytest -k booster)
2026-08-05 05:43:14 +02:00
Bernd (Hermes) b8a76b6337 booster: replace substring matching with hyphen-insensitive keyword_matcher
Replace naive 'kw in text_lower' substring matching (lines 104-106)
with match_keyword() from keyword_matcher, which provides:

- Strategy 1: Exact substring match (case-insensitive, normalized)
- Strategy 1b: Hyphen-insensitive match ('presence-engine' matches
  'Presence Engine' in text)
- Strategy 2: Stemming match (snowballstemmer German)
- Strategy 3: Fuzzy match (Levenshtein)

Changes:
- Import match_keyword from .keyword_matcher
- matched_keywords now uses match_keyword(kw, text) instead of kw in text_lower
- _count_unique_matches: same replacement
- _record_matches: parameter renamed text_lower -> text (no logic change)
- Removed now-unused text_lower = text.lower() line

All 35 booster tests pass.
2026-08-05 04:55:23 +02:00
Bernd (Hermes) 6a701dcce4 feat: V8.5 — P1-Points: 90-Tage-Demotion + ::curate run Routine 2026-07-19 11:07:44 +02:00
Bernd (Hermes) 3179ce8b7b M13: Vollständige Garbage Collection — FAISS-Rebuild + KeywordBooster-Reset + ArchivarState-Bereinigung + Onboarding-StayTracker-Cleanup
Erweitert _sync_room_map_with_membership() um die von Andreas geforderten
Bereinigungsschritte nach room-map.json-GC:

1. FAISS-Index: rebuild + save (war bereits in M13, jetzt robuster)
2. KeywordBooster: cleanup_orphaned_rooms() — baut _keyword_to_rooms
   Mapping aus bereinigter RoomMap neu
3. ArchivarState: cleanup_orphaned_rooms() — entfernt stay_decision,
   keyword_weights, sticky_keywords, manual_overrides, promotion_candidates
   für gelöschte Räume
4. Onboarding _stay_tracker: entfernt Einträge für gelöschte Räume

Reihenfolge im Gateway-Start (adapter.py connect()):
  DDP connect → _sync_room_map_with_membership() → DDP subscribe →
  Archivar init → Auto-Onboarding

Alle neuen Methoden sind idempotent und mit Tests abgedeckt:
- test_archivar_state.py: +8 Tests (cleanup_orphaned_rooms)
- test_booster.py: +4 Tests (cleanup_orphaned_rooms)
2026-07-12 15:49:17 +02:00
Bernd (Hermes) d005eb769d feat(archivar): Booster-Gewichtung verstärkt — FAISS + Keywords
Booster-Strategie: IMMER aktiv (nicht nur bei Konflikten)
- router.py: Konfliktbedingung entfernt, Booster auf alle FAISS-Treffer
- booster.py: Boost +0.05→+0.10, zusätzlich +0.05 pro weiterem unique Keyword
- config.py: FAISS_AUTO_ROUTE 0.85→0.70

Kombiniert semantische Breite (FAISS) mit präziser Keyword-Diskriminierung.
Ziel: granulare Raum-Entscheidungen bei überlappenden Themen.
2026-06-18 07:55:14 +02:00
Bernd (Hermes) 03d3bb44df BUGFIX: FAISS Phase-1 TypeError float+str in adapter_integration.py:292
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)
2026-06-16 20:31:57 +02:00