docs: Archivar v4 — README + Community Post aktualisiert

- 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
This commit is contained in:
Bernd (Hermes)
2026-06-14 13:59:22 +02:00
parent 170f7e6096
commit 44121da702
2 changed files with 53 additions and 39 deletions
+41 -29
View File
@@ -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 |