feat(archivar): Auto-Onboarding v2 — strukturiertes 4-Fragen-Interview pro Raum

Ersetzt den v1-Text-Flow ('Name = Thema') durch ein strukturiertes
Interview mit 4 Fragen pro fehlendem Raum:

1. theme — 'Worum geht es in diesem Raum? (1–2 Sätze)'
2. keywords_100 — 'Welche Begriffe treffen SICHER zu? (Sofort-Match)'
3. keywords_context — 'Welche Begriffe deuten auf das Thema hin? (Kontext-Match)'
4. catch_all — 'Soll dieser Raum der Catch-All sein? (Ja/Nein)'

Änderungen:
- adapter.py: _start_onboarding() sendet Buttons pro Raum
  [Projektraum einrichten] [Überspringen] [Später]
- adapter.py: _onboarding_state dict steuert Interview-Phasen
- adapter.py: _process_onboarding_response() verarbeitet Button-Klicks
  (ONBOARD:<room_id>::<action>) und Text-Antworten auf die 4 Fragen
- adapter.py: _ask_onboarding_question(), _onboarding_next_room(),
  _finish_onboarding() für den strukturierten Ablauf
- adapter.py: _process_incoming() erkennt ONBOARD:-Prefix und
  prüft Operator-Raum-Zugehörigkeit
- room_map.py: RoomMap.save() mit fcntl.flock File-Lock gegen
  parallele Schreibzugriffe
- room_map.py: add_or_update_room() akzeptiert keywords_100 und
  keywords_context getrennt (v2-Schema)
- room-map.schema.json: version minimum=2, keywords→keywords_100
  + keywords_context
- room-map.json: generische Platzhalter (öffentliches Repo)
- Tests: 4 neue v2-Tests (keyword-Trennung, File-Lock, reload,
  Single-Room v2-Felder), bestehende Tests auf v2-Schema migriert

Invarianten erhalten: Single-Room-Regel, DM-Ignorierung,
onboarding_active-Flag, kein Dauer-Check.
This commit is contained in:
Bernd (Hermes)
2026-06-15 19:39:04 +02:00
parent 6e02a12431
commit 2eb723fb63
5 changed files with 519 additions and 217 deletions
+11 -5
View File
@@ -2,14 +2,14 @@
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hermes-agent.nousresearch.com/schemas/room-map.schema.json",
"title": "Archivar Room Map",
"description": "Schema for the Archivar room-map.json — the single source of truth for thematic message routing.",
"description": "Schema for the Archivar room-map.json — the single source of truth for thematic message routing. Version 2 splits keywords into keywords_100 (exact-match routing) and keywords_context (contextual routing).",
"type": "object",
"required": ["version", "rooms"],
"properties": {
"version": {
"type": "integer",
"description": "Schema version for future migrations.",
"minimum": 1
"minimum": 2
},
"rooms": {
"type": "object",
@@ -28,9 +28,15 @@
"description": "Theme / purpose of the room.",
"minLength": 1
},
"keywords": {
"keywords_100": {
"type": "array",
"description": "Keywords for keyword-based routing.",
"description": "Keywords for exact-match routing (high-confidence, low false-positive).",
"items": { "type": "string", "minLength": 1 },
"default": []
},
"keywords_context": {
"type": "array",
"description": "Keywords for contextual / semantic routing (broader match, may need disambiguation).",
"items": { "type": "string", "minLength": 1 },
"default": []
},
@@ -56,7 +62,7 @@
},
"keyword_overrides": {
"type": "object",
"description": "Admin-corrected keyword→room mappings (learned from !r overrides).",
"description": "Admin-corrected keyword→room mappings (learned from !r overrides). Optional.",
"additionalProperties": { "type": "string" }
}
},