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
+12 -10
View File
@@ -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 - 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 - 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) - **2-stage pipeline:** Embedding pre-filter (nomic-embed-text, <100ms) → LLM room router (qwen2.5:7b, ~2.4s)
- **Bidirectional routing:** Messages flow between rooms, but answers always stay where you asked - **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.
- **Move-Requests with buttons:** When a task belongs elsewhere, you get clickable options — not text prompts - **Keywords as anchors** — Room-specific keywords in the LLM prompt give precise hints. "RC" at the end of a sentence is recognized.
- **Sticky rooms:** Tell the agent "always stay here" and it remembers - **Move-Requests with buttons:** When a task belongs elsewhere, you get ✅Ja / 📍Hier — clickable options, never text prompts
- **Catch-All room:** Nothing gets lost — unclassified messages land in a designated fallback - **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 ### 🆕 Auto-Onboarding
@@ -129,13 +131,13 @@ Hermes Agent is powerful — but the CLI isn't where conversations happen. Teams
| 7 REST API tools | ✅ Stable | | 7 REST API tools | ✅ Stable |
| Interactive buttons | ✅ Stable | | Interactive buttons | ✅ Stable |
| Button-Garantie | ✅ Enforced | | Button-Garantie | ✅ Enforced |
| Archivar v3 room routing | ✅ Deployed | | Archivar v4 room routing | ✅ Deployed (2026-06-14) |
| Auto-onboarding | ✅ Stable | | Auto-onboarding | ✅ Stable |
| FAKT → Obsidian Vault | ✅ Stable | | FAKT → Obsidian Vault | ✅ Stable |
| File upload/download/list | ✅ Stable | | File upload/download/list | ✅ Stable |
| `install.sh` one-click setup | ✅ 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). 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?** **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?** **Q: Is this an official Nous Research product?**
A: No — it's a community plugin maintained independently. Public Domain license. A: No — it's a community plugin maintained independently. Public Domain license.
+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 - 🔗 **`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 - 📏 **Desktop-safe labels** — Emoji+text pattern (✅Ja, ❌Nein) with ~7 char truncation awareness
### Smart Room Routing (Archivar v3) ### Smart Room Routing (Archivar v4)
- 🧭 **Intent-based classification** — Understands WHAT the user wants (question, task, fact), not just keyword matching - 🧭 **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.
- 🔄 **Bidirectional routing** — Messages can flow between rooms, but the agent's answer ALWAYS stays in the origin room (User-Flow C) - ⚡ **2-stage pipeline:** Embedding pre-filter (nomic-embed-text, <100ms) → LLM room router (qwen2.5:7b, ~2.4s median)
- 🤖 **3-stage classifier:** Keyword pre-filter → Embedding (nomic-embed-text) → LLM (qwen2.5:7b, optional) - 🎯 **Keywords as anchors** — Room-specific keywords in the LLM prompt give precise hints. "RC" at the end of a sentence is recognized.
- 📌 **Sticky rooms** — User can pin a room: "always stay here" (persists until gateway restart) - 🛡️ **Butler principle** — Before routing: Move-Request button (✅Ja / 📍Hier). The human decides, never the machine.
- 🧹 **Move-Request with native buttons** — When a task belongs in another room, the agent asks with ✅Ja / 📍Hier / 📌Generell buttons — never raw text - 💰 **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 - 🏠 **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 ### Auto-Onboarding
- 🆕 **New rooms auto-detected** — When the bot is added to a new channel/group/DM, it starts an onboarding interview - 🆕 **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 ├── __init__.py — Plugin registration, button builders
├── tools.py — 7 REST API tools ├── tools.py — 7 REST API tools
└── archivar/ — Smart room routing subsystem └── archivar/ — Smart room routing subsystem
├── classifier.py — 3-stage intent classifier ├── classifier.py — Embedding pre-filter (nomic-embed-text)
├── router.py — Bidirectional router with confidence ├── router.py — LLM-based room router (qwen2.5:7b)
├── config.py — Thresholds, categories, room-map ├── config.py — LLM_ROOM_PROMPT, thresholds, room-map
├── archivar_state.py — Persistent state (sticky rooms, decisions) ├── room_map.py — Room-map.json loader + keyword matching
├── doc_store.py — FAKT → Obsidian Vault integration ├── doc_store.py — FAKT → Obsidian Vault integration
└── adapter_integration.py — Archivar ↔ Adapter bridge └── 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 ## 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?" 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 | | Stage | Method | Speed | Role |
|-------|--------|-------|----------| |-------|--------|-------|------|
| 0 | Keyword pre-filter | <1ms | High recall | | 0 | Embedding pre-filter (nomic-embed-text, 768-dim) | <100ms | Binary: Smalltalk → stay. Everything else → LLM router |
| 1 | Embedding (nomic-embed-text, 768-dim) | ~50ms | High precision | | 1 | LLM room router (qwen2.5:7b) | ~2.4s median | Full message + room list + keywords → room ID |
| 2 | LLM (qwen2.5:7b) | ~2s | Borderline cases |
**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:** **Routing decisions:**
| Intent | Behavior | | Scenario | Behavior |
|--------|----------| |----------|----------|
| **Question** (thematic match) | Silent copy to target room. Answer stays in origin room. | | **Smalltalk / greeting** | Embedding pre-filter catches it → stays in origin room |
| **Task/Auftrag** (thematic match) | Move-Request with buttons: ✅Ja (copy+work there) / 📍Hier (stay) / 📌Generell (always stay) | | **Clear topic match** | LLM returns room ID → Move-Request button (✅Ja / 📍Hier) |
| **No clear match** | Falls to Catch-All room | | **User clicks ✅Ja** | Message copied to target room. Agent answers there. |
| **DM task** | Never routed — stays in DM | | **User clicks 📍Hier** | No routing. Answer stays in origin room. |
| **Button click** | Never routed — always 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 ## 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 | | Component | Status |
|-----------|--------| |-----------|--------|
| DDP/WebSocket messaging | ✅ Production | | DDP/WebSocket messaging | ✅ Production |
| REST API tools (7) | ✅ Production | | REST API tools (7) | ✅ Production |
| Interactive buttons | ✅ Production | | Interactive buttons | ✅ Production |
| Archivar v3 (room routing) | ✅ Deployed | | Archivar v4 (LLM room router) | ✅ Deployed (2026-06-14) |
| Button-Garantie | ✅ Enforced (2026-06-12) | | Button-Garantie | ✅ Enforced (2026-06-12) |
| Move-Request buttons | ✅ Native (2026-06-12) | | Move-Request buttons | ✅ Native (2026-06-12) |
| Auto-Onboarding | ✅ Production | | Auto-Onboarding | ✅ Production |