docs: README + Community-Post komplett überarbeitet

README.md (13026 bytes):
- Archivar v3 dokumentiert (3-stage classifier, User-Flow C, Button-Garantie)
- Move-Request mit nativen Buttons (✅Ja/📍Hier/📌Generell)
- Auto-Onboarding, FAKT→Obsidian, Sticky Rooms
- Deployment-Pfad-Klärung (~/.hermes/... vs /usr/local/lib/...)
- Troubleshooting um 5 neue Einträge erweitert (Discovery Bug, __pycache__,
  install.sh path mismatch, Button-Text-Fallback, ENOTFOUND https)
- Button-Garantie als eigenes Feature hervorgehoben

COMMUNITY_POST.md (6857 bytes) — NEU:
- Use-Case-getriebener Community-Beitrag (DevOps, Personal Assistant, PM)
- Button-Garantie als Alleinstellungsmerkmal
- FAQ-Sektion (SaaS, Multi-User, Permissions, Gateway-Restarts)
- Quick-Start mit install.sh
This commit is contained in:
Hermes Agent
2026-06-12 08:30:32 +02:00
parent 6348578678
commit 6eda62b94c
2 changed files with 307 additions and 192 deletions
+122 -163
View File
@@ -1,63 +1,75 @@
# Hermes Rocket.Chat Plugin — Community Release
# Hermes Agent × Rocket.Chat — Your AI Assistant, Now in Every Room
> **Nützliches Add-on für [Hermes Agent](https://hermes-agent.nousresearch.com/)**
> Verbindet Hermes Agent mit einem selbst-gehosteten Rocket.Chat-Server.
**Connect your Hermes Agent to a self-hosted Rocket.Chat server and talk to it from any channel, group, or DM — with native buttons, smart room routing, and file sharing.**
---
## ⚠️ HAFTUNGSAUSSCHLUSS
## What This Plugin Does
**DIESES PLUGIN WIRD OHNE JEGLICHE GEWÄHRLEISTUNG BEREITGESTELLT.**
You run [Hermes Agent](https://github.com/NousResearch/hermes-agent) — a personal AI agent that remembers across sessions, delegates to subagents, and drives a real terminal and browser. Normally you talk to it through a CLI or TUI.
- Die Nutzung erfolgt **ausschließlich auf eigene Gefahr**.
- Der Autor übernimmt **keinerlei Haftung** für Schäden, Datenverluste, Sicherheitsvorfälle, fehlerhafte Konfigurationen oder sonstige Nachteile, die aus der Installation oder Nutzung dieses Plugins entstehen können.
- Dieses Plugin ist ein **inoffizielles Community-Projekt**. Es steht in keiner Verbindung zu Rocket.Chat (Rocket.Chat Technologies Corp.) oder Nous Research.
- Vor dem Produktiveinsatz sind **eigene Sicherheitsprüfungen und Tests** zwingend erforderlich.
- Das Plugin wird unter der [Unlicense](LICENSE) veröffentlicht — es kommt **wie gesehen ("as-is")**, ohne Mängelgewähr und ohne Support-Garantie.
This plugin connects Hermes to **Rocket.Chat**, so you can talk to your agent from **any room** on your self-hosted chat server. One agent, all rooms, one memory.
**Wer dieses Plugin installiert oder einsetzt, erklärt sich mit diesen Bedingungen einverstanden.**
### The Experience
```
You (in #devops): "What's the status of the BAT stack?"
Agent (in #devops): "5/5 containers UP. API :3001, Web :3003, DB healthy.
Gateway connected to rocketchat.thomander.de."
You (in DM): "StartObsidian"
Agent (in DM): "Vault clean. No new FAKT files. Last daily: 08.06.
BAT: 5/5 UP, RC-Plugin: Archivar v3 deployed."
You (in #general): "Deploy the new adapter fix"
Agent (in #general): "Dein Auftrag passt thematisch besser in #rocketchat-plugin."
[✅Ja] [📍Hier] [📌Generell]
```
The agent knows what happened in ALL rooms. It routes tasks to the right room. It asks before moving things. And you always click buttons — never type numbers.
---
## Was ist das?
## Key Features
Dieses Plugin verwandelt Hermes Agent in einen **nativen Rocket.Chat-Benutzer** — mit Echtzeit-Nachrichten über das Hermes Gateway, Präsenz-Status und interaktiven Buttons.
### 🎯 Button-Garantie (Button Guarantee)
**Das Besondere:** Ein einziger Agent kann in beliebig vielen Räumen gleichzeitig präsent sein — Kanäle, Gruppen, DMs — und behält trotzdem den Überblick. Inhalte landen automatisch im richtigen Raum, Themen bleiben sauber getrennt, und nichts geht im Multi-Room-Chaos unter.
**Every user interaction uses native Rocket.Chat buttons.** No raw text input, no "type 1/2/3", no confusion.
- **Eingehend**: WebSocket/DDP (`stream-room-messages`) für sofortige Nachrichten
- **Ausgehend**: REST-API für Antworten, Buttons, Dateien
- **Gateway-nativ**: Registriert sich als `rocketchat-platform` im Hermes Gateway — kein Standalone-Daemon mehr
- **Multi-Room-fähig**: Ein Agent-Session für alle Räume mit geteiltem Kontext
- Built-in templates: Yes/No, Confirm/Cancel, OK, Multi-Choice
- Custom buttons with emoji labels: `✅Ja`, `❌Nein`, `🟡Später`
- 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)
The agent understands **where messages belong**, not just what category they are.
- **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
### 🆕 Auto-Onboarding
Add the bot to a new room and it introduces itself, asks for a room name and topic, and configures routing automatically. No manual config files.
### 📚 Knowledge Integration
Pure facts and documentation are automatically saved to your Obsidian Vault — not dumped in chat rooms. Your morning `StartObsidian` routine processes them into themed documents.
### 📎 File Attachments
Upload files to rooms, download files users attach, browse room file lists — all with native Rocket.Chat rendering.
### 🌐 Multi-Room, One Memory
The agent maintains a single context across all rooms. Knowledge from `#devops` is available in `#general`. You never have to re-explain.
---
## Features
| Feature | Beschreibung |
|---------|-------------|
| 🚀 Echtzeit-Streaming | DDP/WebSocket für instant eingehende Nachrichten |
| 🟢 Präsenz | Grüner Online-Status im Rocket.Chat |
| 🌐 Multi-Room | Ein Agent über alle Räume — Kanäle, Gruppen, DMs. Geteilter Kontext, kein Kontext-Verlust beim Raumwechsel |
| 🧭 Smart Room Routing | Der Agent lernt beim ersten Start, welche Themen in welchen Raum gehören. Kein manuelles Konfigurieren — ein kurzes Interview, danach landet alles automatisch am richtigen Ort |
| ✍️ Markdown | Fett, kursiv, `Code`, Blöcke, Links |
| 🔘 Interaktive Buttons | Ja/Nein, Bestätigen/Abbrechen, Mehrfachauswahl |
| 🔌 7 REST-Tools | `rocketchat_rooms`, `rocketchat_users`, `rocketchat_dm`, `rocketchat_send`, `rocketchat_upload`, `rocketchat_download`, `rocketchat_files` |
| 📎 Datei-Anhänge | Upload, Download, Datei-Listing — nativ im Rocket.Chat gerendert |
| 🌍 Bilingual | Installer auf Deutsch & Englisch (`--lang de|en`), Agent erkennt Systemsprache automatisch |
| 📦 Zero-Dependency | Nutzt ausschließlich Python-Standardbibliothek |
---
## Schnellstart
### 1. Voraussetzungen
- Hermes Agent installiert ([Setup-Guide](https://hermes-agent.nousresearch.com/docs))
- Laufender Rocket.Chat-Server (v5+ empfohlen)
- Bot-Benutzer auf Rocket.Chat mit Login-Daten
### 2. Plugin herunterladen & installieren
## Quick Start
```bash
git clone https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin.git
@@ -65,147 +77,94 @@ cd Hermes_rocket.chat_Plugin
./install.sh
```
Der Installer führt interaktiv durch:
- Rocket.Chat Server URL
- **Bot Username** (der Bot-Account auf dem Server)
- Bot Passwort
- Home Channel (Name oder ID)
The installer walks you through:
1. Rocket.Chat server URL
2. Bot username and password
3. Home channel
Bei bestehender Installation werden alle Werte angezeigt und können bestätigt (ENTER) oder geändert werden.
**Optionen:**
**That's it.** The gateway restarts, the bot appears online (green dot), and you can start talking.
```bash
./install.sh --help # Alle Optionen anzeigen
./install.sh --lang en # Englisch
./install.sh --lang de # Deutsch (Standard)
./install.sh --non-interactive # Batch-Mode (RC_URL, RC_BOT_USER, RC_BOT_PASS, RC_HOME_CHANNEL)
```
# Update without reconfiguring
./install.sh --update-only
### 3. Pairing
Nach der Installation gibt der Gateway einen **Pairing-Code** aus. Diesen im Home-Channel eingeben, um den Bot zu aktivieren. (Identisch zum Telegram-Integrations-Pattern.)
---
## Architektur
```
┌─────────────┐ ┌─────────────────┐
│ Hermes Agent│ Hermes Gateway │ Rocket.Chat │
│ (Plugin) │◄── DDP/WebSocket ──────►│ Server │
│ │◄── REST API ──────►│ (v5+) │
└─────────────┘ └─────────────────┘
```
**Plugin-Dateien:**
| Datei | Größe | Funktion |
|-------|-------|----------|
| `plugin/adapter.py` | ~27 KB | DDP-Client, Session-Handling, Nachrichten-Parsing, Reconnect, Button-Rendering |
| `plugin/__init__.py` | ~4,5 KB | Plugin-Registrierung, Interaction Templates |
| `plugin/tools.py` | ~43 KB | 7 Rocket.Chat REST-Tools für Agent-Kontext |
| `plugin/plugin.yaml` | 0,8 KB | Metadaten, Env-Vars |
---
## Button-Templates
| Template | Nutzung |
|----------|---------|
| `yes_no` | ✅ Ja / ❌ Nein |
| `confirm_cancel` | ✅ Bestätigen / 🚫 Abbrechen |
| `ok` | 👍 OK |
| `multi_choice_3` | 1. Links / 2. Rechts / 3. Zwei Runden |
| `custom` | Beliebige Labels via `custom_buttons` |
**Button-Label-Regeln:**
- Desktop-App schneidet bei **~5–7 Zeichen** ab
- **NIEMALS Underscores (`_`)** in Button-Texten — zerstört Rendering
- Leerzeichen sind erlaubt: `1. Links`
- Pattern: Lange Optionen im Text, Buttons mit Kurzreferenz (`1. Links`, `2. Rechts`)
Details: [docs/BUTTON_GUIDE.md](docs/BUTTON_GUIDE.md)
---
## Konfiguration (Referenz)
`install.sh` schreibt automatisch. Manuelle Referenz:
```yaml
# ~/.hermes/config.yaml
plugins:
enabled:
- rocketchat-platform
gateway:
platforms:
rocketchat:
enabled: true
extra:
base_url: "https://rocketchat.example.com"
home_channel:
platform: rocketchat
chat_id: "69f4e..."
name: "ki-assistent"
toolsets:
- rocketchat
```
```bash
# ~/.config/hermes/rocketchat.env (chmod 600)
ROCKETCHAT_BASE_URL=https://rocketchat.example.com
ROCKETCHAT_USER=botuser
ROCKETCHAT_PASSWORD=...
ROCKETCHAT_ALLOW_ALL_USERS=true
GATEWAY_ALLOW_ALL_USERS=true
# Non-interactive (CI/CD, scripts)
./install.sh --non-interactive
```
---
## Aktueller Status
## Requirements
- **Version**: 2.3.0
- **Stabilität**: Produktiv im Einsatz (seit Mai 2026)
- **Getestet mit**: Rocket.Chat v5.x, Hermes Agent Gateway
- **Lizenz**: [Unlicense](LICENSE) — Public Domain
- **Hermes Agent** installed and running
- **Self-hosted Rocket.Chat** (v5+)
- A **bot user account** on your Rocket.Chat server
- Python 3.10+ (comes with Hermes)
**Optional but recommended:**
- `nomic-embed-text` via Ollama — enables embedding-based room routing
- `qwen2.5:7b` via Ollama — enables LLM-based routing for borderline cases
---
## Changelog
## Why This Exists
### v2.3.0 (30. Mai 2026)
- **Attachment-Tools:** `rocketchat_upload`, `rocketchat_download`, `rocketchat_files`
- **Upload-Fix:** 2-Step-Flow für RC 8.4.1 — `rooms.media` + `chat.postMessage` mit `title_link`
- **DDP-Adapter:** Erkennt eingehende Attachments automatisch (`file`/`attachments` im Event)
Hermes Agent is powerful — but the CLI isn't where conversations happen. Teams live in Rocket.Chat. This plugin brings your AI assistant to where you already are.
### v2.2.0 (30. Mai 2026)
- **Room Topic Discipline:** Agent trennt Inhalte strikt nach Raum-Thema
- **Catch-All-Raum:** Interaktive Erstinitialisierung bei >1 Raum
**Use cases:**
- **DevOps team:** Ask the agent for container status, deploy fixes, check logs — from your team channel
- **Personal assistant:** Morning briefing (`StartObsidian`), knowledge capture, task routing
- **Project management:** Multi-room coordination — the agent knows what's happening across all project channels
- **Self-hosted everything:** No cloud dependencies. Your agent, your chat server, your data.
### v2.1.0 (29. Mai 2026)
- **Cross-Room Session Sharing:** Ein Agent über alle Räume, gemeinsamer Kontext. Zero Core Changes — rein plugin-basiert
---
### v2.0.0 (Mai 2026)
- Gateway-natives Plugin (kein Standalone-Daemon mehr)
- `tools.py`: 4 Rocket.Chat REST-Tools für Agent-Kontext
- Neuer bilingualer `install.sh` (DE/EN, `--help`, `--non-interactive`, Re-Install-Erkennung)
- "Bot Username"-Prompt statt "Username"
- `BasePlatformAdapter`-Vererbung, DDP `added`-Events, case-insensitive Filter
## Current Status
### v1.0.0 (Mai 2026)
- Initialer Standalone-Daemon-Release
**Active development — production-ready core, expanding features.**
| Feature | Status |
|---------|--------|
| Real-time DDP messaging | ✅ Stable |
| 7 REST API tools | ✅ Stable |
| Interactive buttons | ✅ Stable |
| Button-Garantie | ✅ Enforced |
| Archivar v3 room routing | ✅ Deployed |
| 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.
---
## Links
- **Hermes Agent**: https://hermes-agent.nousresearch.com/
- **Rocket.Chat**: https://www.rocket.chat/
- **Dieses Repo**: https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin
- **Repository:** [gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin](https://gitea.myowntools.org/andreas/Hermes_rocket.chat_Plugin)
- **Hermes Agent:** [github.com/NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent)
- **Rocket.Chat:** [rocket.chat](https://rocket.chat)
- **License:** Public Domain (Unlicense)
---
> *Erstellt von der Hermes Agent Community — für die Rocket.Chat Community.*
## FAQ
**Q: Does this work with Rocket.Chat SaaS (cloud.rocket.chat)?**
A: It's designed for self-hosted instances. SaaS may work but hasn't been tested — the plugin needs WebSocket/DDP access which SaaS tiers may restrict.
**Q: Can multiple users talk to the same bot?**
A: Yes — the bot listens in all subscribed rooms. One agent session handles all users. Each user's rooms are collapsed into a virtual `user:username` session so the agent maintains per-user context.
**Q: Does the bot need admin permissions?**
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.
**Q: Is this an official Nous Research product?**
A: No — it's a community plugin maintained independently. Public Domain license.
---
*Built with ❤️ for the self-hosting community. Zero external dependencies. Pure Python + WebSocket.*
+185 -29
View File
@@ -6,18 +6,66 @@
**⚠️ Community Add-on — not an official Nous Research product.**
This plugin is maintained independently. Use at your own risk. See [LICENSE](LICENSE).
---
## Features
### Core Messaging
- 🟢 **Real-time messaging** via DDP/WebSocket (`stream-room-messages`)
- 💬 **Interactive buttons** — Native Rocket.Chat attachments with `question_id::choice` correlation
- 🔌 **7 REST tools** — `rocketchat_rooms`, `rocketchat_users`, `rocketchat_dm`, `rocketchat_send`, `rocketchat_upload`, `rocketchat_download`, `rocketchat_files`
- 🧭 **Smart Room Routing** — Automatically learns which topics belong in which rooms. Keeps conversations organized across channels, groups, and DMs. One agent, many rooms, zero confusion.
- 📎 **File Attachments** — Upload, download, and list files with native Rocket.Chat rendering
- 🌐 **Multi-Room Presence** — One agent session across all rooms. Shared context, clean delivery.
- 🟢 **Online presence** — Green dot via DDP `UserPresence`
- ♻️ **Auto-reconnect** with exponential backoff
- 🌍 **Bilingual installer** — German & English (`--lang de|en`)
### Interactive Buttons (Button-Garantie)
- 💬 **Native Rocket.Chat Action Buttons** — All user interactions use clickable buttons, never raw text input
- 🎯 **Button-Garantie (Button Guarantee):** REST-Path first, text fallback only on HTTP error. Every clarify prompt, every move request, every multi-choice question uses native buttons
- 📋 **Built-in templates:** `yes_no`, `confirm_cancel`, `ok`, `multi_choice_3`, `custom`
- 🔗 **`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
- 🏠 **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
### Auto-Onboarding
- 🆕 **New rooms auto-detected** — When the bot is added to a new channel/group/DM, it starts an onboarding interview
- 📝 **Room-map.json** — Persistent room configuration (names, topics, keywords, sticky status)
- 🔑 **`#Name =` parser** — Users set room names inline during onboarding
### Knowledge Integration (FAKT)
- 📚 **FAKT → Obsidian Vault** — Pure facts (documentation, not communication) are automatically saved to the user's Obsidian Vault inbox
- 🗂️ **`StartObsidian` workflow** — Morning routine processes FAKT files into themed documents via WikiLinks
- 🚫 **No chat-room pollution** — Facts never appear in chat rooms; they go straight to the knowledge base
### File Attachments
- 📎 **Upload** (`rocketchat_upload`) — Send files to any room with native Rocket.Chat rendering
- 📥 **Download** (`rocketchat_download`) — Retrieve files users attach to messages
- 📋 **List** (`rocketchat_files`) — Browse all files in a room
### REST Tools (7 total)
| Tool | Function |
|------|----------|
| `rocketchat_rooms` | List, create, archive, delete rooms; invite/kick users; fetch history |
| `rocketchat_users` | List all users, get user info, search by name |
| `rocketchat_dm` | Open or send direct messages |
| `rocketchat_send` | Send messages with optional interactive buttons |
| `rocketchat_upload` | Upload files with message and description |
| `rocketchat_download` | Download files by ID |
| `rocketchat_files` | List files in a room with pagination |
### Multi-Room Architecture
- 🌐 **One agent, all rooms, one memory** — The agent maintains a single context across all subscribed rooms
- 🧠 **Shared session** — Knowledge from one room is available in all others
- 🎯 **Virtual chat IDs** — `user:alice` collapses all of Alice's rooms into one Hermes session
- 🔀 **Butler principle** — The agent suggests, the human decides. Nothing is silently rerouted
---
## Quick Install
```bash
@@ -37,27 +85,42 @@ The installer will ask for:
### Options
```
./install.sh --help # Show all options
./install.sh --lang en # English
./install.sh --lang de # German (default)
./install.sh --non-interactive # Batch mode (reads from env vars)
./install.sh --help # Show all options
./install.sh --lang en # English
./install.sh --lang de # German (default)
./install.sh --non-interactive # Batch mode (reads from env vars)
./install.sh --update-only # Update plugin files without reconfiguring
```
---
## Architecture
```
Rocket.Chat Server
↕ WebSocket/DDP + REST
Hermes Gateway (plugin)
├── adapter.py — DDP client, message routing, button handling
├── __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)
├── doc_store.py — FAKT → Obsidian Vault integration
└── adapter_integration.py — Archivar ↔ Adapter bridge
↕
Hermes Agent ← → LLM inference
```
The plugin registers as `rocketchat-platform` in Hermes' bundled plugin path (`hermes-agent/plugins/platforms/rocketchat/`).
The plugin registers as `rocketchat-platform` in Hermes' plugin path. **Deployment note:** The gateway loads from `~/.hermes/hermes-agent/plugins/platforms/rocketchat/`. The `install.sh` copies files there. A secondary path at `/usr/local/lib/hermes-agent/plugins/platforms/rocketchat/` exists for system-wide installs but is not the active path for user-level gateway runs.
---
## Interactive Buttons
The plugin supports native Rocket.Chat buttons. The agent sends them via `send_message` with metadata:
The plugin supports native Rocket.Chat Action Buttons. The agent sends them via `send_message` with metadata:
```python
send_message(
@@ -67,48 +130,141 @@ send_message(
"template": "custom",
"question_id": "confirm_42",
"button_title": "Choose:",
"custom_buttons": ["✅ Yes", "❌ No"]
"custom_buttons": ["✅Ja", "❌Nein"]
}
)
```
User click returns: `confirm_42::✅ Yes`
User click returns: `confirm_42::✅Ja`
**Button label rules:**
- Max ~7 visible characters on desktop (mobile shows full text)
- **NO underscores** — breaks Rocket.Chat rendering
- Spaces allowed: `1. Left`, `2. Right`
- Prefix with number/keyword for distinguishability
### Built-in Templates
| Template | Buttons | Use Case |
|----------|---------|----------|
| `yes_no` | ✅Ja / ❌Nein | Binary decisions |
| `confirm_cancel` | ✅Bestätigen / 🚫Abbrechen | Destructive actions |
| `ok` | 👍OK | Acknowledgement |
| `multi_choice_3` | 1. Links / 2. Rechts / 3. Zwei Runden | Directional choices |
| `custom` | User-defined | Any multi-choice scenario |
### Button Label Rules
1. **NO underscores (`_`)** — destroys button rendering completely
2. **Desktop truncation at ~7 chars** — first 7 characters must be distinguishable
3. **Mobile shows full text** — but design for desktop-first
4. **Spaces ARE allowed** — `1. Links` works; `1._Links` breaks
5. **Emoji+Text pattern preferred:** `✅Ja`, `❌Nein`, `🟡Später`
See [docs/BUTTON_GUIDE.md](docs/BUTTON_GUIDE.md) for full details.
---
## Environment Variables
Set in `~/.config/hermes/rocketchat.env` (generated by install.sh):
Set in `~/.hermes/.env` (generated by install.sh):
```bash
ROCKETCHAT_BASE_URL=https://rocketchat.example.com
ROCKETCHAT_BASE_URL=rocketchat.thomander.de # WITHOUT https:// prefix!
ROCKETCHAT_USER=botuser
ROCKETCHAT_PASSWORD=...
ROCKETCHAT_ROOM_NAME=ki-assistent
ROCKETCHAT_ALLOW_ALL_USERS=true
GATEWAY_ALLOW_ALL_USERS=true
```
> ⚠️ **Important:** `ROCKETCHAT_BASE_URL` must NOT include the protocol (`https://`). The DDP client prepends `wss://` automatically. Including `https://` causes `getaddrinfo ENOTFOUND https` and the gateway will crash-loop.
### Optional: Archivar LLM Stage
```bash
ARCHIVAR_ENABLE_LLM=1 # Enable LLM stage for borderline classifications
```
Requires `qwen2.5:7b` pulled via Ollama (~4.7 GB). Without this, the Archivar runs in 2-stage mode (Keyword + Embedding only).
---
## Requirements
- Hermes Agent installed
- Self-hosted Rocket.Chat server (V5+)
- Bot user account on the Rocket.Chat server
- Hermes Agent installed and running
- Self-hosted Rocket.Chat server (v5+)
- Bot user account on the Rocket.Chat server with `bot` role
- Python 3.10+ (hermes-agent venv)
- **Optional:** `nomic-embed-text` via Ollama for embedding-based routing
- **Optional:** `qwen2.5:7b` via Ollama for LLM-based routing (set `ARCHIVAR_ENABLE_LLM=1`)
---
## Room Routing — How It Works
### The Archivar (v3)
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:**
| 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 |
**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 |
### User-Flow C
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.
---
## Troubleshooting
| Symptom | Cause | Fix |
|---------|-------|-----|
| `No module named 'hermes_plugins.rocketchat_platform.tools'` | `__init__.py` has hard `from .tools import register_tools` but `tools.py` missing | Wrap import in `try/except ImportError` and guard `register_tools(ctx)` call |
| `Failed to load plugin 'rocketchat-platform': No module named 'archivar'` | Plugin submodule uses **absolute imports** (`from archivar.X import Y`) — these only work when the module is on global `sys.path`, not in Hermes' Plugin-Loader context | **All imports within the plugin package MUST be relative.** Rule: `from archivar.X` → `from .X` (inside submodule), `from archivar.X` → `from .archivar.X` (from `adapter.py`). Affects ALL `.py` files in the submodule. 2026-06-03: 11 imports in 5 files affected |
| Gateway shows `No adapter available for rocketchat`, only Telegram active | Plugin loading failed silently — check `errors.log` for the exact import error | Fix the import, then `systemctl --user restart hermes-gateway`. Verify: `journalctl --user -u hermes-gateway | grep "Subscribed to"` |
| Gateway shows `No adapter available for rocketchat` | Plugin loading failed — missing `plugin.yaml` or `__init__.py` in plugin path, or ImportError in plugin code | Check `~/.hermes/hermes-agent/plugins/platforms/rocketchat/` has both files. Clear `__pycache__`. Check `journalctl --user -u hermes-gateway` for import errors. |
| Gateway loses Rocket.Chat after restart (Discovery Bug) | `gateway_state.json` corruption after SIGTERM | `rm ~/.hermes/gateway_state.json ~/.hermes/.gateway_state_*.tmp && systemctl --user reset-failed hermes-gateway && systemctl --user start hermes-gateway` |
| Gateway crash-loops after restart | Auto-resume of interrupted sessions | Same fix as Discovery Bug — clearing state files also clears interrupted session markers |
| `getaddrinfo ENOTFOUND https` | `ROCKETCHAT_BASE_URL` contains `https://` prefix | Remove the protocol: `rocketchat.thomander.de` (not `https://rocketchat.thomander.de`) |
| Buttons show as text options instead of native buttons | Old plugin version in `~/.hermes/...` path, or stale `__pycache__` | `cp` updated `adapter.py` to `~/.hermes/hermes-agent/plugins/platforms/rocketchat/`, clear `__pycache__`, restart gateway |
| `Built user-room map: 0 users` after restart | Timing: user-map built before DDP fully connected | Usually self-heals on next message. If persistent, restart gateway with state-file cleanup. |
| `install.sh --update-only` deploys to wrong path | `install.sh` targets `/usr/local/lib/...` but gateway loads from `~/.hermes/...` | Manually `cp` to `~/.hermes/hermes-agent/plugins/platforms/rocketchat/` after install. Don is fixing `install.sh`. |
| Plugin import fails after code changes | Stale `.pyc` bytecode in `__pycache__/` | `find ~/.hermes/hermes-agent/plugins/platforms/rocketchat -name '__pycache__' -type d -exec rm -rf {} +` |
---
## Known Limitations
- **Desktop button truncation:** Rocket.Chat desktop app truncates button labels at ~7 characters. Use short emoji+text labels.
- **Gateway Discovery Bug:** After SIGTERM, the gateway may lose the Rocket.Chat platform. Workaround: clear state files before restart. Root cause in Hermes Core — not fixable in the plugin.
- **`install.sh` path mismatch:** Currently deploys to `/usr/local/lib/...` but the user-level gateway loads from `~/.hermes/...`. Manual `cp` needed after `--update-only`. Being fixed.
- **User-Map timing:** After cold start, user-room map may show 0 users briefly. Self-heals on first message.
- **No multi-user bot support:** One bot user = one agent session. Multiple bot users on the same server are not tested.
---
## Project Status
**Active development.** Current focus: Archivar v3 stabilization, Button-Garantie enforcement, install.sh path fix.
| Component | Status |
|-----------|--------|
| DDP/WebSocket messaging | ✅ Production |
| REST API tools (7) | ✅ Production |
| Interactive buttons | ✅ Production |
| Archivar v3 (room routing) | ✅ Deployed |
| Button-Garantie | ✅ Enforced (2026-06-12) |
| Move-Request buttons | ✅ Native (2026-06-12) |
| Auto-Onboarding | ✅ Production |
| FAKT → Obsidian Vault | ✅ Production |
| File attachments | ✅ Production |
| `install.sh` path fix | 🔧 In progress (Don) |
---
## License