You kick off a batch HTML landing-page generation from Telegram on the subway. You lock your phone, switch apps, or lose signal—and with a browser chat tab, the run would die and your context would evaporate. That is the 2026 pain for solo hackers and developers who remote-control agents from mobile but need work to continue on an always-on host.
Hermes Agent from Nous Research solves this with a single Gateway process: one long-lived daemon on your Mac or VPS that connects to Telegram, Discord, Slack, WhatsApp, Signal, Email, and more via platform adapters and webhooks. The agent loop runs on the server, not in your phone browser. Sessions persist in a per-chat store until you /reset or idle-timeout—default idle reset is 1440 minutes (24 hours) per upstream docs, configurable per platform in ~/.hermes/gateway.json.
This guide focuses on Hermes Agent Gateway configuration for cross-device flow: start a long task from Telegram, walk into the office, open Discord, and pick up files, background results, and named sessions from the same gateway. For install prerequisites, see our guide de configuration Hermes macOS; for parallel subagent workers, see délégation subagents Hermes. Low NodeMac pitch—upstream paths only.
Pourquoi les onglets navigateur échouent et le Gateway survit
| Failure mode | Web chat / local script | Hermes Gateway on always-on host |
|---|---|---|
| Phone app backgrounded | SSE/WebSocket often drops | Gateway process keeps running |
| Laptop lid closed | Process suspended | launchd/systemd keeps gateway alive |
| Long tool run (30+ min) | Tab timeout, lost context | Agent loop on server; optional /background |
| Switch Telegram → Discord | N/A (different products) | Same gateway, shared workspace + memory |
| Cron / scheduled jobs | Requires separate scheduler | Built-in cron ticks every 60 seconds inside gateway |
Quotable: Hermes Gateway is one background process that connects all configured platforms, routes each message through a per-chat session store, dispatches to AIAgent, and runs the cron scheduler—upstream architecture docs, June 2026.
Source: Hermes Messaging Gateway.
Architecture Gateway: adapters, sessions, webhooks
┌─────────────────────────────────────┐
Telegram webhook ──►│ Hermes Gateway (single process) │
Discord gateway ──►│ ├─ Platform adapters │
Slack events ──►│ ├─ Per-chat session store │
│ ├─ AIAgent tool loop (server-side) │
│ ├─ Cron scheduler (60s tick) │
│ └─ ~/.hermes/ state + workspace │
└─────────────────────────────────────┘
│
Files, memory, skills on disk
│
Phone (Telegram) Desktop (Discord)
same user, different reads outputs / /resume
chat sessions named session
Each platform adapter receives inbound messages (Telegram bot API, Discord gateway events, Slack webhooks), maps them to a session key (platform + chat ID), and enqueues agent turns. Tool progress can stream back to the chat (display.tool_progress: all in ~/.hermes/config.yaml).
Important nuance for cross-device UX: Telegram DM and Discord DM are separate sessions by default—they do not magically mirror every message. Continuity comes from three mechanisms working together:
/background— Fire-and-forget tasks; results deliver to the chat where you started the command, while your main session stays responsive.- Shared workspace — Generated HTML, logs, and artifacts land on the gateway host filesystem; any platform can ask the agent to read them.
/title+/resume— Name a session on Telegram, resume the named session from Discord (same gateway user).
Configure longer idle resets so a commute does not wipe context:
{
"reset_by_platform": {
"telegram": { "mode": "idle", "idle_minutes": 480 },
"discord": { "mode": "idle", "idle_minutes": 240 }
}
}
Path: ~/.hermes/gateway.json per session management docs.
Scénario: métro Telegram → office Discord
Goal: From Telegram mobile, assign "Generate 5 HTML landing page variants in ~/projects/landing-batch/". At the desk, Discord shows progress and file previews.
Recommended path:
| Step | Where | Action |
|---|---|---|
| 1 | Server (once) | Gateway running 24/7 via hermes gateway install + launchd |
| 2 | Telegram | /background Build 5 HTML landing variants in ~/projects/landing-batch/ using brand colors from MEMORY.md |
| 3 | Telegram | Gateway ack: Task ID: bg_HHMMSS_xxxx — phone can lock |
| 4 | Discord | /resume landing-batch if you /title landing-batch first, OR ask: List files in ~/projects/landing-batch and summarize |
| 5 | Discord | Enable display.tool_progress: all to see tool status during active turns |
| 6 | Either | /status shows session info; /platform list shows adapter health |
For live streaming in Discord while the task runs, start the job in Discord with display.busy_input_mode: queue so follow-ups queue instead of interrupting—or run the heavy work via /background on Telegram and poll from Discord using filesystem tools.
Pair with délégation subagents Hermes when one landing page needs parallel research + codegen subagents; Gateway delivers human messages, delegation handles fan-out.
Runbook de configuration Gateway
1. Install Hermes
If missing: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash, then hermes doctor. Details: guide de configuration Hermes macOS.
2. Run gateway wizard
hermes gateway setup
Walk through Telegram bot token (from @BotFather), Discord bot token + intents, allowlists. Upstream recommends DM pairing or TELEGRAM_ALLOWED_USERS / DISCORD_ALLOWED_USERS—never GATEWAY_ALLOW_ALL_USERS=true on bots with terminal access.
3. Approve your phone Telegram user
hermes pairing approve telegram XKGH5N7P
4. Install gateway as a persistent service
hermes gateway install
hermes gateway start
hermes gateway status
Equivalent to launchd plist under ~/Library/LaunchAgents/ per upstream; logs in ~/.hermes/logs/.
5. Configure display + session policy
display:
tool_progress: all
busy_input_mode: queue
busy_ack_enabled: true
Edit ~/.hermes/gateway.json for idle timeouts (JSON block in architecture section).
6. Set Discord home channel
/sethome
Circuit-breaker trip notifications and gateway restart messages route to configured home_chat_id per platform.
7. Test cross-device handoff
Telegram: /title commute-test then start a 2-minute task. Discord: /resume commute-test. If empty, verify same allowed user ID on both platforms.
8. Harden for production
gateway:
platforms:
discord:
extra:
allow_from: ["YOUR_DISCORD_USER_ID"]
allow_admin_from: ["YOUR_DISCORD_USER_ID"]
telegram:
extra:
allow_from: ["YOUR_TELEGRAM_USER_ID"]
Restart: hermes gateway stop && hermes gateway start or launchctl kickstart -k gui/$(id -u)/com.hermes.gateway.
Hardware note: Apple Mac mini specifications list 16 GB base RAM—enough for gateway + one active agent; 24 GB if you add subagents or MCP servers concurrently.
Troubleshooting
Gateway running but Telegram bot silent
Symptom: hermes gateway status shows running; DMs never reply.
Fix: Complete DM pairing (hermes pairing list). Confirm bot token in env survived launchd—launchctl print gui/$(id -u)/com.hermes.gateway | grep -i telegram. Restart gateway after token changes.
Discord connects but no message streaming
Symptom: Final answers appear; no tool progress lines.
Fix: Set display.tool_progress: all in ~/.hermes/config.yaml. Enable Message Content Intent in Discord Developer Portal.
/platform list shows adapter paused-by-breaker
Symptom: One platform stops after repeated API errors.
Fix: Check ~/.hermes/logs/gateway.log. Wait for upstream recovery, then /platform resume telegram. Breakers do not auto-resume by design.
Background task finished but Discord sees nothing
Symptom: Telegram received background complete; Discord empty.
Expected behavior: Background results deliver to the originating chat. From Discord, run /status or ask the agent to read output paths.
Gateway vs CLI: when to use which
| Use CLI (hermes) | Use Gateway |
|---|---|
| Local debugging, slash command dev | Mobile + multi-platform access |
| Ephemeral experiments | 24/7 cron + messaging delivery |
| No bot tokens needed | Telegram/Discord/Slack integration |
Both share ~/.hermes/ memory, skills, and model config—/model works on either surface per CLI vs Messaging quick reference.
Lecture associée
- guide de configuration Hermes macOS — install, first tokens, launchd on macOS
- délégation subagents Hermes — parallel subagents via
delegate_task - tutoriel Hermes Mac mini M4 — always-on Mac mini / headless hosting patterns
FAQ
Does Hermes Gateway sync the same conversation across Telegram and Discord automatically?
Not as a single mirrored thread. Each platform+chat has its own session store. Continuity comes from shared disk workspace, memory files, /background task IDs, and /title + /resume named sessions on the same gateway—not from duplicating every message to both apps.
What happens when I lock my phone mid-task?
The gateway keeps executing on the host. In-progress tool calls run server-side. Use /background for fire-and-forget long jobs, or set busy_input_mode: queue so accidental taps do not interrupt. Phone disconnect does not kill the gateway process.
How many platforms can one Gateway run?
Upstream supports 20+ adapters in one process (Telegram, Discord, Slack, WhatsApp, Signal, Matrix, Feishu, Teams, etc.). Typical solo setups run 2–3. Each adds webhook traffic—monitor with /platform list.
Do I need a cloud Mac or VPS?
You need some always-on host—a desk Mac mini, home server, or rented macOS/Linux VM. A sleeping laptop pauses gateway delivery.
How is this different from the macOS setup guide?
The setup guide covers install, first tokens, launchd. This article covers multi-device workflow architecture, session handoff, /background, and Telegram + Discord together for commuters and solopreneurs.