From 44121da702ce0cba236ee12d864f4bf0754ff6ee Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Sun, 14 Jun 2026 13:59:22 +0200 Subject: [PATCH] =?UTF-8?q?docs:=20Archivar=20v4=20=E2=80=94=20README=20+?= =?UTF-8?q?=20Community=20Post=20aktualisiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Archivar v3 β†’ v4: LLM-basierter Raum-Router statt IntentClassifier - 2-stage pipeline: Embedding pre-filter + LLM room router - Keywords as anchors, zero DeepSeek tokens for routing - 10s timeout, CATCH_ALL fallback, Butler principle - Operating stage log dokumentiert --- COMMUNITY_POST.md | 22 ++++++++------- README.md | 70 +++++++++++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 39 deletions(-) diff --git a/COMMUNITY_POST.md b/COMMUNITY_POST.md index 7aedc3f..0596cc7 100644 --- a/COMMUNITY_POST.md +++ b/COMMUNITY_POST.md @@ -41,15 +41,17 @@ The agent knows what happened in ALL rooms. It routes tasks to the right room. I - Structured payloads: `question_id::choice` β€” the agent always knows what you clicked - REST-first: native buttons always tried first; text fallback only on HTTP error -### 🧭 Smart Room Routing (Archivar v3) +### 🧭 Smart Room Routing (Archivar v4) -The agent understands **where messages belong**, not just what category they are. +The agent understands **where messages belong** β€” and routes them there, with your permission. -- **3-stage classifier:** Keyword β†’ Embedding β†’ LLM (optional) -- **Bidirectional routing:** Messages flow between rooms, but answers always stay where you asked -- **Move-Requests with buttons:** When a task belongs elsewhere, you get clickable options β€” not text prompts -- **Sticky rooms:** Tell the agent "always stay here" and it remembers -- **Catch-All room:** Nothing gets lost β€” unclassified messages land in a designated fallback +- **2-stage pipeline:** Embedding pre-filter (nomic-embed-text, <100ms) β†’ LLM room router (qwen2.5:7b, ~2.4s) +- **LLM-based room router** β€” The LLM receives the full message + room list with keywords and returns the target room ID directly. No intent categories, no fuzzy matching. +- **Keywords as anchors** β€” Room-specific keywords in the LLM prompt give precise hints. "RC" at the end of a sentence is recognized. +- **Move-Requests with buttons:** When a task belongs elsewhere, you get βœ…Ja / πŸ“Hier β€” clickable options, never text prompts +- **Zero token cost for routing** β€” The entire routing process runs on local models. Your primary LLM never spends tokens on figuring out where to reply. +- **Timeout & fallback:** 10s LLM timeout β†’ automatic CATCH_ALL. **No answer is not an option.** +- **Butler principle:** The agent suggests, you decide. Nothing is silently rerouted. ### πŸ†• Auto-Onboarding @@ -129,13 +131,13 @@ Hermes Agent is powerful β€” but the CLI isn't where conversations happen. Teams | 7 REST API tools | βœ… Stable | | Interactive buttons | βœ… Stable | | Button-Garantie | βœ… Enforced | -| Archivar v3 room routing | βœ… Deployed | +| Archivar v4 room routing | βœ… Deployed (2026-06-14) | | Auto-onboarding | βœ… Stable | | FAKT β†’ Obsidian Vault | βœ… Stable | | File upload/download/list | βœ… Stable | | `install.sh` one-click setup | βœ… Stable | -**In progress:** `install.sh` deployment path alignment, button verification tests. +**In progress:** `install.sh` deployment path alignment. --- @@ -160,7 +162,7 @@ A: Yes β€” the bot listens in all subscribed rooms. One agent session handles al A: No. A regular user with `bot` role is sufficient. The bot needs `create-d`, `create-p`, and `upload-file` permissions (standard for bot role). **Q: What happens if the gateway restarts?** -A: The bot reconnects automatically. Sticky room preferences are in-memory (reset on restart). The room-map.json persists. There's a known Discovery Bug where Rocket.Chat may not reconnect after SIGTERM β€” workaround is clearing state files before restart. +A: The bot reconnects automatically. The room-map.json persists. There's a known Discovery Bug where Rocket.Chat may not reconnect after SIGTERM β€” workaround is clearing state files before restart. The Archivar v4 initializes immediately after reconnect with the operating stage log: `Archivar Stufe 1: Embedding-Vorfilter + LLM-Raum-Router aktiv (5 RΓ€ume)`. **Q: Is this an official Nous Research product?** A: No β€” it's a community plugin maintained independently. Public Domain license. diff --git a/README.md b/README.md index 4b1cf76..5e91bf6 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,15 @@ This plugin is maintained independently. Use at your own risk. See [LICENSE](LIC - πŸ”— **`question_id::choice` correlation** β€” Button clicks return structured payloads the agent can resolve - πŸ“ **Desktop-safe labels** β€” Emoji+text pattern (βœ…Ja, ❌Nein) with ~7 char truncation awareness -### Smart Room Routing (Archivar v3) -- 🧭 **Intent-based classification** β€” Understands WHAT the user wants (question, task, fact), not just keyword matching -- πŸ”„ **Bidirectional routing** β€” Messages can flow between rooms, but the agent's answer ALWAYS stays in the origin room (User-Flow C) -- πŸ€– **3-stage classifier:** Keyword pre-filter β†’ Embedding (nomic-embed-text) β†’ LLM (qwen2.5:7b, optional) -- πŸ“Œ **Sticky rooms** β€” User can pin a room: "always stay here" (persists until gateway restart) -- 🧹 **Move-Request with native buttons** β€” When a task belongs in another room, the agent asks with βœ…Ja / πŸ“Hier / πŸ“ŒGenerell buttons β€” never raw text +### Smart Room Routing (Archivar v4) +- 🧭 **LLM-based room router** β€” Determines the TARGET ROOM directly, not an intent category. The LLM receives the full message text + room list with keywords and returns the room ID. +- ⚑ **2-stage pipeline:** Embedding pre-filter (nomic-embed-text, <100ms) β†’ LLM room router (qwen2.5:7b, ~2.4s median) +- 🎯 **Keywords as anchors** β€” Room-specific keywords in the LLM prompt give precise hints. "RC" at the end of a sentence is recognized. +- πŸ›‘οΈ **Butler principle** β€” Before routing: Move-Request button (βœ…Ja / πŸ“Hier). The human decides, never the machine. +- πŸ’° **Zero DeepSeek tokens for routing** β€” The entire routing process runs on local models (nomic-embed-text + qwen2.5:7b). DeepSeek only receives the final answer context. +- ⏱️ **Timeout & fallback:** 10s LLM timeout (covers cold starts up to 7.8s). Fallback: CATCH_ALL room. **No answer is not an option.** - 🏠 **Catch-All room** β€” Unclassified messages land in a designated fallback room, not lost -- πŸ“Š **Confidence framework** β€” Low-confidence decisions escalate to LLM or ask the user +- πŸ“Š **Operating stage log:** `Archivar Stufe 1: Embedding-Vorfilter + LLM-Raum-Router aktiv (5 RΓ€ume)` ### Auto-Onboarding - πŸ†• **New rooms auto-detected** β€” When the bot is added to a new channel/group/DM, it starts an onboarding interview @@ -104,10 +105,10 @@ Hermes Gateway (plugin) β”œβ”€β”€ __init__.py β€” Plugin registration, button builders β”œβ”€β”€ tools.py β€” 7 REST API tools └── archivar/ β€” Smart room routing subsystem - β”œβ”€β”€ classifier.py β€” 3-stage intent classifier - β”œβ”€β”€ router.py β€” Bidirectional router with confidence - β”œβ”€β”€ config.py β€” Thresholds, categories, room-map - β”œβ”€β”€ archivar_state.py β€” Persistent state (sticky rooms, decisions) + β”œβ”€β”€ classifier.py β€” Embedding pre-filter (nomic-embed-text) + β”œβ”€β”€ router.py β€” LLM-based room router (qwen2.5:7b) + β”œβ”€β”€ config.py β€” LLM_ROOM_PROMPT, thresholds, room-map + β”œβ”€β”€ room_map.py β€” Room-map.json loader + keyword matching β”œβ”€β”€ doc_store.py β€” FAKT β†’ Obsidian Vault integration └── adapter_integration.py β€” Archivar ↔ Adapter bridge ↕ @@ -194,31 +195,42 @@ Requires `qwen2.5:7b` pulled via Ollama (~4.7 GB). Without this, the Archivar ru ## Room Routing β€” How It Works -### The Archivar (v3) +### The Archivar (v4) The Archivar is a **thematic room router**, not a category classifier. It answers: "Which room does this message belong in?" β€” not "Is this a fact, question, or alarm?" -**3-stage pipeline:** +**2-stage pipeline:** -| Stage | Method | Speed | Accuracy | -|-------|--------|-------|----------| -| 0 | Keyword pre-filter | <1ms | High recall | -| 1 | Embedding (nomic-embed-text, 768-dim) | ~50ms | High precision | -| 2 | LLM (qwen2.5:7b) | ~2s | Borderline cases | +| Stage | Method | Speed | Role | +|-------|--------|-------|------| +| 0 | Embedding pre-filter (nomic-embed-text, 768-dim) | <100ms | Binary: Smalltalk β†’ stay. Everything else β†’ LLM router | +| 1 | LLM room router (qwen2.5:7b) | ~2.4s median | Full message + room list + keywords β†’ room ID | + +**The LLM receives:** +- The complete message text +- All available rooms with their IDs, names, and keywords +- Keywords act as anchors β€” "RC" at the end of a sentence is recognized + +**The LLM returns:** A single room ID (or `CATCH_ALL`). No categories, no fuzzy matching. **Routing decisions:** -| Intent | Behavior | -|--------|----------| -| **Question** (thematic match) | Silent copy to target room. Answer stays in origin room. | -| **Task/Auftrag** (thematic match) | Move-Request with buttons: βœ…Ja (copy+work there) / πŸ“Hier (stay) / πŸ“ŒGenerell (always stay) | -| **No clear match** | Falls to Catch-All room | -| **DM task** | Never routed β€” stays in DM | -| **Button click** | Never routed β€” always stays in origin room | +| Scenario | Behavior | +|----------|----------| +| **Smalltalk / greeting** | Embedding pre-filter catches it β†’ stays in origin room | +| **Clear topic match** | LLM returns room ID β†’ Move-Request button (βœ…Ja / πŸ“Hier) | +| **User clicks βœ…Ja** | Message copied to target room. Agent answers there. | +| **User clicks πŸ“Hier** | No routing. Answer stays in origin room. | +| **No clear match** | LLM returns CATCH_ALL β†’ falls to designated catch-all room | +| **LLM timeout (10s)** | Automatic fallback to CATCH_ALL. **No answer is not an option.** | -### User-Flow C +### Zero Token Cost for Routing -The agent's answer **always stays in the origin room**. Only the user's message is copied (with permission). This prevents the "where did the answer go?" problem. +The entire routing process runs on **local models** (nomic-embed-text + qwen2.5:7b). Your primary LLM (DeepSeek, Claude, etc.) receives only the final answer context β€” it never spends tokens on figuring out where to reply. + +### Butler Principle + +The agent **suggests**, the human **decides**. Before any routing, a Move-Request button appears. Nothing is silently rerouted. --- @@ -249,14 +261,14 @@ The agent's answer **always stays in the origin room**. Only the user's message ## Project Status -**Active development.** Current focus: Archivar v3 stabilization, Button-Garantie enforcement, install.sh path fix. +**Active development.** Current focus: Archivar v4 stabilization, install.sh path fix. | Component | Status | |-----------|--------| | DDP/WebSocket messaging | βœ… Production | | REST API tools (7) | βœ… Production | | Interactive buttons | βœ… Production | -| Archivar v3 (room routing) | βœ… Deployed | +| Archivar v4 (LLM room router) | βœ… Deployed (2026-06-14) | | Button-Garantie | βœ… Enforced (2026-06-12) | | Move-Request buttons | βœ… Native (2026-06-12) | | Auto-Onboarding | βœ… Production |