overmind-mcp
Version:
Orchestrateur universel agents IA multi-modeles via MCP. Inclut le protocole 'Custom-Nickname' pour identifier vos agents avec des surnoms originaux (The Chaos Prophet, Shadow Sniper, etc.), l'isolation mรฉmoire (Private Memory Context) et le support pour
776 lines (620 loc) โข 23.5 kB
Markdown
# ๐ก Documentation โ Hermes Gateway
> Gateway multi-plateforme de Hermes Agent par Nous Research
> Version : 2.1+ | Derniรจre MAJ : 2026-05-30
## 1. Architecture Gรฉnรฉrale
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HERMES GATEWAY โ
โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โ โTelegram โ โ Discord โ โ Slack โ โWhatsApp โ โ
โ โ Adapter โ โ Adapter โ โ Adapter โ โ Adapter โ โ
โ โโโโโโฌโโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โ
โ โ โ โ โ โ
โ โโโโโโผโโโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโโโผโโโโโ โ
โ โ SESSION ROUTER (state.db) โ โ
โ โ โข Route messages to agent sessions โ โ
โ โ โข Channel โ Session mapping โ โ
โ โ โข Topic/Thread support โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ AGENT LOOP (run_agent.py) โ โ
โ โ โข System prompt construction โ โ
โ โ โข LLM API calls (OpenAI format) โ โ
โ โ โข Tool dispatch (MCP + native) โ โ
โ โ โข Context compression โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ TOOL LAYER โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โ Terminal โ โ File I/O โ โ Browser โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โ Web/HTTP โ โ Cron โ โ Delegat. โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ MCP Servers (HTTP/stdio) โ โ โ
โ โ โ memory, discord, postgres, x, etc. โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ SERVICES ANNEXES โ โ
โ โ โข Cron Scheduler (jobs.py + scheduler.py) โ โ
โ โ โข Curator (skill lifecycle) โ โ
โ โ โข Kanban (multi-agent work queue) โ โ
โ โ โข TTS / STT โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Composants clรฉs
| Composant | Fichier | Rรดle |
|-----------|---------|------|
| Gateway runner | `gateway/run.py` | Boucle principale, dispatch messages |
| Platform adapters | `gateway/platforms/*.py` | Un adapter par plateforme |
| Session router | `hermes_state.py` | SQLite state.db, routing |
| Agent loop | `run_agent.py` | Conversation LLM + tools |
| Tool dispatch | `model_tools.py` | Appels outils natifs + MCP |
| Cron scheduler | `cron/scheduler.py` | Jobs planifiรฉs |
| Curator | `skills/curator.py` | Maintenance skills |
## 2. Plateformes Supportรฉes
| Plateforme | Adapter | Auth requise | Features |
|------------|---------|-------------|----------|
| **Telegram** | `telegram.py` | Bot Token | Topics, DMs, groupes, inline |
| **Discord** | `discord.py` | Bot Token | Embeds, threads, rรฉactions, boutons |
| **Slack** | `slack.py` | Bot Token + Signing Secret | Channels, DMs, threads |
| **WhatsApp** | `whatsapp.py` | WhatsApp Business API | Messages, mรฉdias |
| **Signal** | `signal.py` | signal-cli | Messages, groupes |
| **Email** | `email.py` | IMAP/SMTP | Envoi/rรฉception, piรจces jointes |
| **SMS** | `sms.py` | Twilio / Vonage | Envoi/rรฉception SMS |
| **Matrix** | `matrix.py` | Homeserver + Token | Rooms, DMs |
| **Mattermost** | `mattermost.py` | Bot Token | Channels, DMs |
| **Home Assistant** | `homeassistant.py` | HA Webhook | Intentions, contrรดle |
| **DingTalk** | `dingtalk.py` | App Key/Secret | Messages, groupes |
| **Feishu (Lark)** | `feishu.py` | App ID/Secret | Messages, docs |
| **WeCom** | `wecom.py` | Corp ID + Secret | Messages |
| **BlueBubbles** | `bluebubbles.py` | BB Server URL | iMessage |
| **Weixin (WeChat)** | `weixin.py` | App ID/Secret | Messages |
| **API Server** | `api_server.py` | Clรฉ API custom | REST endpoint |
| **Webhooks** | `webhook.py` | Route config | POST entrants |
| **Open WebUI** | via API Server | Clรฉ API | Interface web |
### Configuration plateforme
```bash
# Setup interactif
hermes gateway setup
# Ou รฉdition manuelle
hermes config edit
```
Exemple config Discord :
```yaml
discord:
bot_token: ${DISCORD_BOT_TOKEN}
enabled: true
prefix: "!"
allowed_channels: [] # vide = tous
```
## 3. Commandes CLI Gateway
```bash
# Dรฉmarrer le gateway (foreground)
hermes gateway run
# Installer comme service systรจme
hermes gateway install
# Contrรดle du service
hermes gateway start
hermes gateway stop
hermes gateway restart
# รtat du gateway
hermes gateway status
# Configuration initiale
hermes gateway setup
```
### Options avancรฉes
```bash
# Lancer avec un profil spรฉcifique
hermes gateway run --profile sniper
# Mode verbose (debug)
hermes gateway run --verbose
# Port custom pour API server
hermes gateway run --port 8080
```
## 4. Configuration (config.yaml)
### Sections pertinentes pour le gateway
```yaml
# === MODรLE ===
model:
default: glm-5.2
provider: z-ai
context_length: 128000
# === AGENT ===
agent:
max_turns: 90
tool_use_enforcement: true # Oblige ร utiliser les outils
# === TERMINAL ===
terminal:
backend: local # local, docker, ssh
timeout: 180
# === COMPRESSION ===
compression:
enabled: true
threshold: 0.50 # Dรฉclenche ร 50% du context
target_ratio: 0.20 # Cible 20% du context
# === TTS ===
tts:
provider: elevenlabs
voice: charlie
voice_id: IKne3meq5aSn9XLyUdCD
model: eleven_multilingual_v2
# === STT ===
stt:
enabled: true
provider: local # local, groq, openai, mistral
local:
model: base
# === MรMOIRE ===
memory:
memory_enabled: true
user_profile_enabled: true
provider: built-in # built-in, honcho, mem0
# === SรCURITร ===
security:
redact_secrets: false
tirith_enabled: true
website_blocklist: []
# === APPROBATIONS ===
approvals:
mode: manual # manual, smart, off
# === MCP ===
mcp_servers:
memory-server:
url: "http://localhost:3099/mcp"
discord-server:
url: "http://localhost:3141/mcp"
# === DรLรGATION ===
delegation:
max_concurrent_children: 3
max_spawn_depth: 1
# === CRON ===
# Gรฉrรฉ via l'outil cronjob, pas de config yaml directe
# === CANVAS ===
display:
skin: default
tool_progress: true
show_reasoning: false
show_cost: false
```
## 5. Slash Commands (Mode Gateway)
### Contrรดle de session
```
/new (/reset) Nouvelle session
/clear Effacer + nouvelle session
/retry Renvoyer dernier message
/undo Annuler dernier รฉchange
/title [name] Nommer la session
/compress Compression manuelle du contexte
/stop Tuer processus en arriรจre-plan
/rollback [N] Restaurer checkpoint filesystem
```
### Configuration
```
/config Afficher config
/model [name] Changer de modรจle
/personality [name] Changer personnalitรฉ
/reasoning [level] Niveau de raisonnement (noneโxhigh)
/verbose Cycle verbose
/voice [on|off|tts] Mode vocal
/yolo Bypass approbations
/status Info session
```
### Outils & Skills
```
/tools Gรฉrer outils (CLI)
/skills Installer skills
/skill <name> Charger un skill
/reload Recharger .env
/reload-mcp Recharger serveurs MCP
/cron Gรฉrer cron jobs
```
### Gateway
```
/approve Approuver commande en attente
/deny Refuser commande
/restart Redรฉmarrer gateway
/sethome Dรฉfinir canal home
/update MAJ Hermes
/platforms Statut plateformes
```
### Info
```
/help Aide
/commands Lister toutes les commandes
/usage Utilisation tokens
/insights [days] Analytics
/debug Upload rapport debug
/profile Info profil actif
```
## 6. Cron Jobs
### Fonctionnement
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CRON SCHEDULER โ
โ โโโ cron/jobs.py โ Stockage jobs โ
โ โโโ cron/scheduler.py โ Tick loop โ
โ โโโ .tick.lock โ Anti-doublon โ
โ โ
โ CHAQUE TICK : โ
โ 1. Vรฉrifie .tick.lock โ
โ 2. Charge jobs actifs โ
โ 3. Pour chaque job รฉligible : โ
โ โ Nouvelle session fraรฎche โ
โ โ Injecte le prompt โ
โ โ Exรฉcute l'agent โ
โ โ Dรฉlivre le rรฉsultat โ
โ โ Dรฉtruit la session โ
โ 4. Libรจre .tick.lock โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Syntaxe de planification
| Format | Exemple | Signification |
|--------|---------|---------------|
| Durรฉe | `30m` | Toutes les 30 minutes |
| Every | `every 2h` | Toutes les 2 heures |
| Every day | `every monday 9am` | Chaque lundi ร 9h |
| Cron | `0 9 * * *` | Tous les jours ร 9h |
| ISO timestamp | `2026-06-01T10:00:00` | Une seule fois |
### Options par job
```python
cronjob(
action="create",
name="analyse_crypto", # Nom unique
schedule="every 2h", # Planification
prompt="Analyse BTC...", # Prompt auto-suffisant
skills=["web", "terminal"], # Skills ร charger
deliver="origin", # Livraison (origin, all, platform:chat:thread)
model={"model": "glm-5.2"}, # Override modรจle
workdir="/path/to/project", # Rรฉpertoire de travail
enabled_toolsets=["web", "terminal", "file"], # Restreindre outils
context_from=["job_id_abc"], # Chaรฎner avec sortie d'un autre job
script="collect_data.sh", # Script pre-run (data collection)
no_agent=False, # True = script seul, pas d'agent
repeat=None, # None = rรฉcurrent, int = nombre de runs
)
```
### Invariants cron
- **Timeout hard** : 3 minutes par run
- **skip_memory=True** par dรฉfaut (pas de mรฉmoire auto)
- **Pas de cron en chaรฎne** : un cron ne peut pas crรฉer d'autres cron
- **Lock file** empรชche doubles ticks
- **Session fraรฎche** ร chaque tick (pas d'injection dans session active)
## 7. Intรฉgration MCP
### Architecture MCP dans le gateway
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AGENT SESSION โ
โ โ โ
โ โโโ Outils natifs (terminal, file...) โ
โ โ โ
โ โโโ MCP Servers โ
โ โโโ HTTP Stream โ
โ โ โโโ memory-server :3099 โ
โ โ โโโ discord-server :3141 โ
โ โ โโโ x-mcp-server :3142 โ
โ โ โโโ postgresql-server :5433 โ
โ โ โ
โ โโโ stdio (si configurรฉ) โ
โ โโโ custom-command --mcp โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### Configuration MCP
**3 niveaux par agent :**
1. **`.mcp.json`** โ Dรฉclare les serveurs disponibles
```json
{
"mcpServers": {
"memory-server": {
"type": "http",
"url": "http://localhost:3099/mcp"
}
}
}
```
2. **`settings.json`** โ Active/filtre les serveurs
```json
{
"enabledMcpjsonServers": ["memory-server", "discord-server"],
"enableAllProjectMcpServers": false
}
```
3. **`config.yaml`** โ Gateway runtime
```yaml
mcp_servers:
memory-server:
url: "http://localhost:3099/mcp"
```
### Rechargement MCP
```
/reload-mcp # Recharger sans restart
/restart # Restart complet du gateway
```
## 8. Sรฉcuritรฉ
### Redaction des secrets
```bash
# Masquer les API keys dans le context
hermes config set security.redact_secrets true
# Dรฉsactiver
hermes config set security.redact_secrets false
```
โ ๏ธ **Restart requis** โ ne prend pas effet mid-session.
### Redaction PII
```bash
# Hasher les user IDs, strip numรฉros de tรฉlรฉphone
hermes config set privacy.redact_pii true
```
### Modes d'approbation
| Mode | Comportement |
|------|-------------|
| `manual` | Prompt avant chaque commande risquรฉe (dรฉfaut) |
| `smart` | LLM auxiliaire auto-approuve les commandes safe |
| `off` | Bypass total (รฉquivalent `--yolo`) |
```bash
hermes config set approvals.mode smart
```
### Allowlist shell hooks
Fichier : `~/.hermes/shell-hooks-allowlist.json`
Premiรจre exรฉcution d'un hook โ prompt interactif.
## 9. Gestion des Sessions
### Architecture
```
~/.hermes/
โโโ state.db # Session store (SQLite + FTS5)
โโโ sessions/
โ โโโ routing.json # Channel โ Session mapping
โ โโโ *.jsonl # Transcripts (optionnel)
โโโ logs/
โโโ gateway.log # Logs gateway
```
### Cycle de vie
```
Message entrant
โ
โโโ Canal connu ? โ Router vers session existante
โ โโโ Topic/Thread ? โ Sous-session
โ โโโ Canal principal โ Session principale
โ
โโโ Nouveau canal โ Crรฉer nouvelle session
โโโ Charger config agent
โโโ Initialiser outils + MCP
โโโ Dรฉmarrer boucle agent
```
### Commandes session
```bash
hermes sessions list # Lister sessions rรฉcentes
hermes sessions browse # Picker interactif
hermes sessions export OUT # Exporter en JSONL
hermes sessions rename ID T # Renommer
hermes sessions delete ID # Supprimer
hermes sessions prune # Nettoyer vieilles sessions
hermes sessions stats # Statistiques du store
```
## 10. Webhooks
### Configuration
```bash
# Crรฉer une route webhook
hermes webhook subscribe myhook
# โ Crรฉe /webhooks/myhook
# Lister
hermes webhook list
# Supprimer
hermes webhook remove myhook
# Test
hermes webhook test myhook
```
### Payload entrant
```json
POST /webhooks/myhook
{
"message": "Analyse le marchรฉ BTC",
"source": "external_app",
"metadata": {
"priority": "high"
}
}
```
Le gateway traite le payload comme un message utilisateur normal.
## 11. Profils
### Concept
Les profils permettent de faire tourner plusieurs instances Hermes isolรฉes :
```
~/.hermes/ # Profil default
~/.hermes/profiles/
โโโ sniper/ # Profil sniper
โ โโโ config.yaml
โ โโโ .env
โ โโโ skills/
โ โโโ sessions/
โโโ researcher/ # Profil researcher
โโโ config.yaml
โโโ ...
```
### Commandes
```bash
hermes profile list # Lister profils
hermes profile create sniper # Crรฉer (--clone, --clone-all)
hermes profile use sniper # Dรฉfinir comme dรฉfaut
hermes profile show sniper # Dรฉtails
hermes profile delete sniper # Supprimer
hermes profile rename A B # Renommer
hermes profile export sniper # Export tar.gz
hermes profile import file.tar.gz # Importer
```
### Lancer avec un profil
```bash
hermes --profile sniper
hermes gateway run --profile sniper
```
## 12. Credential Pools
Rotation automatique des clรฉs API pour รฉviter les rate limits.
```bash
hermes auth add # Ajouter credential (wizard)
hermes auth list [PROVIDER] # Lister credentials
hermes auth remove P INDEX # Supprimer par provider + index
hermes auth reset PROVIDER # Reset exhaustion status
```
### Comportement
- Hermes essaie KEY_1 โ si 429/401 โ KEY_2 โ si 429 โ KEY_3
- Marque les clรฉs รฉpuisรฉes, les rรฉessaie aprรจs cooldown
- Configurรฉ dans `.env` avec clรฉs numรฉrotรฉes
## 13. TTS / STT en Gateway
### TTS (Text โ Voice)
| Provider | Variable | Coรปt |
|----------|----------|------|
| Edge TTS | Aucune | Gratuit (dรฉfaut) |
| ElevenLabs | `ELEVENLABS_API_KEY` | Freemium |
| OpenAI | `VOICE_TOOLS_OPENAI_KEY` | Payant |
| MiniMax | `MINIMAX_API_KEY` | Payant |
| Mistral | `MISTRAL_API_KEY` | Payant |
Commandes :
```
/voice on # Voice-to-voice
/voice tts # Toujours voice
/voice off # Dรฉsactiver
```
### STT (Voice โ Text)
Transcription automatique des messages vocaux entrants.
| Provider | Variable | Coรปt |
|----------|----------|------|
| Local faster-whisper | Aucune | Gratuit |
| Groq Whisper | `GROQ_API_KEY` | Freemium |
| OpenAI Whisper | `VOICE_TOOLS_OPENAI_KEY` | Payant |
| Mistral Voxtral | `MISTRAL_API_KEY` | Payant |
## 14. Troubleshooting
### Gateway ne dรฉmarre pas
```bash
hermes doctor # Diagnostic complet
hermes gateway status # รtat du service
cat ~/.hermes/logs/gateway.log | tail -50
```
### Bot Discord silencieux
1. Vรฉrifier le **Message Content Intent** dans Discord Developer Portal
2. Vรฉrifier `discord.bot_token` dans config
3. Tester : `hermes gateway status`
### Bot Telegram silencieux
1. Vรฉrifier `telegram.bot_token`
2. Tester : `curl https://api.telegram.org/bot<TOKEN>/getMe`
### Gateway meurt aprรจs SSH logout
```bash
sudo loginctl enable-linger $USER
```
### Gateway crash loop (systemd)
```bash
systemctl --user reset-failed hermes-gateway
hermes gateway restart
```
### Outils MCP non disponibles
```bash
hermes mcp list # Voir serveurs configurรฉs
hermes mcp test NAME # Tester connexion
/reload-mcp # Recharger en session
```
### Modรจle auxiliaire (vision, compression) ne fonctionne pas
```bash
hermes config set auxiliary.vision.provider openrouter
hermes config set auxiliary.vision.model anthropic/claude-sonnet-4
```
### Memory non persistante
```bash
hermes memory status # รtat du provider mรฉmoire
hermes config set memory.memory_enabled true
```
## 15. Variables d'Environnement (.env)
Fichier : `~/.hermes/.env`
```bash
# === PROVIDERS ===
OPENROUTER_API_KEY=sk-or-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
DEEPSEEK_API_KEY=sk-...
XAI_API_KEY=xai-...
GLM_API_KEY=xxx.zai...
MINIMAX_API_KEY=xxx
ELEVENLABS_API_KEY=sk_...
# === CREDENTIAL POOL ===
OPENROUTER_API_KEY_2=sk-or-...
OPENROUTER_API_KEY_3=sk-or-...
# === PLATEFORMES ===
DISCORD_BOT_TOKEN=MTk...
TELEGRAM_BOT_TOKEN=123456:ABC...
SLACK_BOT_TOKEN=xoxb-...
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
# === MCP ===
POSTGRES_CONNECTION_STRING=postgresql://...
```
## 16. Chemins Importants
| Chemin | Contenu |
|--------|---------|
| `~/.hermes/config.yaml` | Configuration principale |
| `~/.hermes/.env` | Secrets et clรฉs API |
| `~/.hermes/skills/` | Skills installรฉs |
| `~/.hermes/sessions/` | Routing + transcripts |
| `~/.hermes/state.db` | Session store SQLite |
| `~/.hermes/logs/` | Logs gateway |
| `~/.hermes/auth.json` | OAuth + credential pools |
| `~/.hermes/hermes-agent/` | Code source |
| `~/.hermes/shell-hooks-allowlist.json` | Allowlist hooks |
## 17. Flux de Message Complet
```
1. Utilisateur envoie message sur Discord
โ
2. Discord Adapter reรงoit via Gateway Intent
โ
3. Session Router lookup (channel_id โ session_id)
โ
โโโ Session existe โ Continue conversation
โโโ Nouvelle session โ Crรฉe session fraรฎche
โ
4. Construction du system prompt
โโโ Config agent (model, tools, persona)
โโโ Memory injectรฉe (user profile + memory notes)
โโโ Skills chargรฉs
โโโ MCP tools dรฉcouverts
โ
5. Appel LLM (OpenAI format)
โ
6. Si tool_calls โ Dispatch via model_tools.py
โโโ Outils natifs (terminal, file, web...)
โโโ MCP tools (HTTP request au serveur MCP)
โ
7. Rรฉsultat outil โ Ajoutรฉ au context โ Retour รฉtape 5
โ
8. Rรฉponse texte finale
โ
9. Gateway envoie via Platform Adapter
โโโ Texte simple โ Message texte
โโโ Structurรฉ โ Embed Discord / HTML Telegram
โโโ Mรฉdia โ Upload fichier
โโโ TTS โ Audio + transcription
โ
10. Logs + mรฉtriques mis ร jour
```
*Documentation gรฉnรฉrรฉe par SniperBot Analyst โ Overmind Ecosystem*
*Source : Hermes Agent v2.1+ by Nous Research*