遠端 Hermes 操控指南

A+B 混合方案 — 本機桌面版 GUI → 遠端主機 Hermes
方案 A:遠端 Dashboard(瀏覽器) · 方案 B:remote-worker profile(SSH 遙控)

適用對象:Hermes Desktop 用戶 遠端 OS:Linux / macOS 先決條件:SSH 可連 + 遠端有 hermes

方案總覽

這不是二選一 — A 和 B 疊在一起用效果最好。

本機
Hermes Desktop
── SSH ──▶
遠端主機
Hermes

┬──────────────────────────────┬
方案 A
Dashboard :9119
◀── HTTP ──
瀏覽器
完整 UI

方案 B
remote-worker
profile
◀── SSH stdout ──
桌面版 GUI
聊天介面
方案 A(Dashboard)方案 B(remote-worker)
介面瀏覽器開遠端 Web UI桌面版 GUI 聊天框
體驗完整 Hermes — 工具、記憶、skill 全有像在跟遠端 agent 對話
適合長時間操作、複雜任務快速下指令、看結果
安全建議 SSH tunnel純 SSH,不需開 port

方案 A Dashboard

遠端開 Hermes Dashboard,本機瀏覽器直接操控。最簡單、功能最完整。

▸ 遠端主機 — 啟動 Dashboard

1

SSH 進遠端主機

user@local ~ $ ssh user@remote-ip
2

啟動 Dashboard(背景執行)

user@remote ~ $ nohup hermes dashboard --port 9119 --host 0.0.0.0 --no-open \
  > ~/.hermes/dashboard.log 2>&1 &

確認啟動成功:

user@remote ~ $ sleep 3 && curl -s http://127.0.0.1:9119 | head -5
  
⚠ 安全第一--host 0.0.0.0 表示任何知道 IP 的人都能連。 除非你有防火牆只允許本機 IP,否則強烈建議下面兩種做法選一種。

▸ 連接方式

選項 A1 — 直連(有防火牆時)

如果遠端有 security group / firewall 只放行你 IP:

本機瀏覽器
http://remote-ip:9119

確認防火牆有放行 :9119

選項 A2 — SSH tunnel ✔ 推薦

不用開防火牆,走 SSH 加密:

本機終端機
ssh -L 9119:localhost:9119 \
    user@remote-ip -N

留著別關,瀏覽器開 http://127.0.0.1:9119

💡 日常化 — 寫個 Terminal 啟動 tunnel 的 alias/skill,一鍵建立。 也可以加到 ~/.ssh/configLocalForward 9119 localhost:9119

▸ 用後清理

user@remote ~ $ hermes dashboard --stop
user@remote ~ $ # 或直接看 PID:
user@remote ~ $ lsof -i :9119 | grep LISTEN
user@remote ~ $ kill <PID>

方案 B remote-worker Profile

在本機 desktop GUI 建一個 profile,所有指令透過 SSH 送去遠端 Hermes 執行、結果接回來顯示。不用離開聊天畫面。

▸ 步驟

1

建立 profile

user@local ~ $ hermes profile create remote-worker
user@local ~ $ hermes profile list
  default · remote-worker  ← 新的
2

寫入 SSH 遙控 skill

這個 skill 讓 profile 理解「使用者輸入 → SSH 給遠端 → 回傳結果」的工作流程。

user@local ~ $ mkdir -p ~/.hermes/profiles/remote-worker/skills/remote-exec
cat <<'SKILL' > ~/.hermes/profiles/remote-worker/skills/remote-exec/SKILL.md
---
name: remote-exec
description: SSH 到遠端主機執行 Hermes 指令並回傳結果
---

# remote-exec

當 user 下達工作指令時:

1. 用 shell 命令 SSH 到遠端主機,執行
   hermes chat -q "<使用者指令>" -Q
2. 把遠端 stdout/stderr 接回來作為回答

## SSH 連線設定

- 主機:REMOTE_IP
- 使用者:REMOTE_USER
- 認證:SSH key(需先 ssh-copy-id)

## 注意

- 每個指令都是獨立的一次性呼叫(無 session 狀態)
- 結果純文字,不含 tool call 細節
- 如果指令超過 30 秒,放寬 timeout
SKILL

然後把 REMOTE_IPREMOTE_USER 換成真實值:

user@local ~ $ sed -i '' 's/REMOTE_IP/your.remote.ip/' \
    ~/.hermes/profiles/remote-worker/skills/remote-exec/SKILL.md
user@local ~ $ sed -i '' 's/REMOTE_USER/your-username/' \
    ~/.hermes/profiles/remote-worker/skills/remote-exec/SKILL.md
3

設定 SHELL tool 的 SSH backend(可選)

這個 profile 預設的 terminal 指令也在本機執行。如果希望「檔案讀寫、目錄列表」也走遠端:

user@local ~ $ hermes --profile remote-worker config set terminal.backend ssh
user@local ~ $ hermes --profile remote-worker config set terminal.ssh.host REMOTE_IP
user@local ~ $ hermes --profile remote-worker config set terminal.ssh.user REMOTE_USER
📌 不設也沒差 — 遙控 skill 透過 SSH command 送指令給遠端 Hermes,terminal backend 只是讓檔案操作也走遠端。純遙控不需要。
4

在桌面版 GUI 切換 profile

打開 Hermes Desktop → 設定 / profile 選單 → 切到 remote-worker

或 terminal 啟動時指定:

user@local ~ $ hermes --profile remote-worker

現在在聊天框輸入任何指令,Hermes 就會 SSH 到遠端執行 hermes chat -q "..." 並回傳結果。

▸ 實際對話範例

remote-worker profile · 聊天畫面
幫我檢查遠端主機的磁碟空間
Hermes
→ SSH 到遠端...
hermes chat -q "檢查磁碟空間" -Q

📦 磁碟使用狀況 (遠端主機)
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 256G 112G 144G 44% /
暫存檔 /tmp/* 約 3.2G 可清理
幫我清一下暫存
Hermes
hermes chat -q "清理 /tmp 暫存檔案" -Q

🧹 已清理 2.8G 暫存檔案
✓ /tmp/build-cache 刪除
✓ /tmp/npm-* 刪除
釋放 2.8G,目前可用 146.8G

▸ 進階:讓 skill 自動化遙控流程

remote-exec skill 中補上執行指令的 exact command:

## 執行模式

遠端執行使用 SSH 一次性呼叫:

ssh -t REMOTE_USER@REMOTE_IP 'hermes chat -q "<指令>" -Q 2>&1'

- -t 確保 PTY 分配,避免 SSH 報錯
- -Q 讓 hermes 安靜模式,只輸出答案
- 2>&1 連錯誤一起抓回來

## 多步驟任務

如果 user 要求多步驟任務,將每一步用 SSH 順序執行,
前面的結果作為後面指令的 context 帶入。

A+B 混合使用

兩個方案不衝突 — 桌面版開 remote-worker profile 快速下指令,同時瀏覽器開 Dashboard 做深度操作。

日常工作流程

時機用哪個為什麼
「檢查狀態、跑一個指令」B — 桌面版 profile不用離開聊天,10 秒搞定
「幫我 refactor 那個 module」A — Dashboard需要完整工具鏈、檔案讀寫、多輪來回
「每天 09:00 給我報告」B + cronprofile 內的 cron job 排 SSH 指令
「我在外面,用手機看一下主機」A — tunnel + 手機瀏覽器Dashboard 響應式,手機也能用
「寫 code,本機編輯遠端跑」A+BDashboard 寫 code + profile 下 build 指令

▸ 同時啟動的工作流程

# Terminal 1 — SSH tunnel for Dashboard
ssh -L 9119:localhost:9119 user@remote-ip -N
# 瀏覽器開 http://127.0.0.1:9119

# Terminal 2 — local Hermes with remote-worker profile
hermes --profile remote-worker
# 桌面版 GUI 聊天框 ← 你在這裡
🚀 貼心提醒 — 第一次設定好之後,每天只需要:
  1. 開 ssh tunnel(寫個一鍵 script)
  2. 瀏覽器開書籤(Dashboard)
  3. 桌面版切 profile(remote-worker)
全部 30 秒搞定。

前置設定:SSH 免密碼

兩個方案都依賴 SSH,先搞定 key-based auth 省去每次打密碼。

user@local ~ $ ssh-keygen -t ed25519 -f ~/.ssh/id_remote_hermes -N ""
user@local ~ $ ssh-copy-id -i ~/.ssh/id_remote_hermes user@remote-ip
user@local ~ $ cat >> ~/.ssh/config <<'CONF'

Host remote-hermes
    HostName remote-ip
    User your-username
    IdentityFile ~/.ssh/id_remote_hermes
    LocalForward 9119 localhost:9119
CONF

之後全部簡化成:

user@local ~ $ ssh remote-hermes -N    # tunnel
user@local ~ $ ssh remote-hermes         # 登入

常見問題

遠端 Hermes 沒有 Dashboard 怎麼辦?

更新到最新版:hermes update。Dashboard 是內建功能,不需要額外安裝。

SSH 連線不穩,指令跑到一半斷掉?

方案 A 用 nohup 啟動 Dashboard 就不受 SSH 斷線影響。方案 B 每個指令獨立的,斷線重連就好。

我想讓 remote-worker profile 開機自動連 tunnel?

macOS 加 ~/.ssh/configLocalForward 然後設 launchd。Linux 用 systemd user service 或 autossh。

方案 B 的 remote-exec skill 可以讓遠端 Hermes 存取遠端的檔案系統?

對。遠端的 hermes chat -q 是在遠端主機上執行的,所以讀寫、執行都是遠端的環境。本機只負責 SSH 轉送指令和結果。