Section: Using Hermes · URL: https://hermesbible.com/docs/user-guide/profiles
Profiles:運行多個 Agent
在同一台機器上運行多個獨立的 Hermes agent —— 每個都有自己的設定檔、API 金鑰、記憶體、對話紀錄、技能和 gateway 狀態。
什麼是 profile?
Profile 是一個獨立的 Hermes 主目錄。每個 profile 都有自己的目錄,包含獨立的 config.yaml、.env、SOUL.md、記憶體、對話紀錄、技能、排程任務和狀態資料庫。Profile 讓你可以針對不同用途運行不同的 agent —— 一個程式碼助理、一個個人機器人、一個研究 agent —— 這些之間的 Hermes 狀態完全分離。
當你建立一個 profile 時,它會自動成為一個獨立的指令。建立一個名為 coder 的 profile,你就立刻擁有了 coder chat、coder setup、coder gateway start 等指令。
快速入門
hermes profile create coder # 建立 profile + "coder" 指令別名
coder setup # 設定 API 金鑰和模型
coder chat # 開始對話
就這麼簡單。coder 現在就是你自己的 Hermes profile,擁有獨立的設定、記憶體和狀態。
建立 Profile
TIP
最快速的設定方式:在新 profile 內執行
hermes setup --portal,一次完成模型和工具的設定。詳見 Nous Portal。
空白 Profile
hermes profile create mybot
建立一個全新的 profile,預載內建技能。執行 mybot setup 來設定 API 金鑰、模型和 gateway 令牌。
如果你打算將這個 profile 用作看板工作者(或希望看板編排器將工作分配給它),在建立時加上 --description "<role>",讓編排器知道它的專長:
hermes profile create researcher --description "Reads source code and external docs, writes findings."
你也可以稍後用 hermes profile describe 來設定或自動產生描述 —— 完整的路由模型請參閱看板指南。
僅複製設定(--clone)
hermes profile create work --clone
將你目前 profile 的 config.yaml、.env、SOUL.md 和技能複製到新 profile。相同的 API 金鑰、模型和功能,但全新的對話紀錄和記憶體。要使用不同的 API 金鑰,請編輯 ~/.hermes/profiles/work/.env;要更換不同的人格設定,請編輯 ~/.hermes/profiles/work/SOUL.md。
複製全部(--clone-all)
hermes profile create backup --clone-all
複製所有內容 —— 設定、API 金鑰、人格設定、所有記憶體、技能、排程任務和外掛。這是一個完整的工作快照。每個 profile 的歷史紀錄(對話歷史、state.db、backups/、state-snapshots/、checkpoints/)不會被複製 —— 這些屬於來源 profile,可能高達數十 GB。如需包含歷史紀錄的完整備份,請改用 hermes profile export 或 hermes backup。
從特定 Profile 複製
hermes profile create work --clone-from coder
--clone-from <source> 直接指定來源 profile,並預設進行設定/技能/SOUL 的複製。搭配 --clone-all 可以完整複製來源 profile:
hermes profile create work-backup --clone-from coder --clone-all
TIP — Honcho 記憶體與 Profile
當啟用 Honcho 時,複製操作會自動為新 profile 建立一個專屬的 AI 對端,同時共享相同的使用者工作區。每個 profile 會建立自己的觀察紀錄和身份識別。詳見 Honcho -- Multi-agent / Profiles。
使用 Profile
指令別名
每個 profile 都會在 ~/.local/bin/<name> 自動建立一個指令別名:
coder chat # 與 coder agent 對話
coder setup # 設定 coder 的設定值
coder gateway start # 啟動 coder 的 gateway
coder doctor # 檢查 coder 的健康狀態
coder skills list # 列出 coder 的技能
coder config set model.default anthropic/claude-sonnet-4
這個別名適用於所有 hermes 子指令 —— 底層其實就是 hermes -p <name>。
-p 選項
你也可以在任何指令中明確指定 profile:
hermes -p coder chat
hermes --profile=coder doctor
hermes chat -p coder -q "hello" # 放在任何位置都有效
設定預設 Profile(hermes profile use)
hermes profile use coder
hermes chat # 現在指向 coder
hermes tools # 設定 coder 的工具
hermes profile use default # 切換回來
設定預設值,讓不帶參數的 hermes 指令都指向該 profile。類似 kubectl config use-context。
確認當前 Profile
CLI 會始終顯示目前啟用的 profile:
- 提示符:顯示
coder ❯而非❯ - 橫幅:啟動時顯示
Profile: coder hermes profile:顯示目前的 profile 名稱、路徑、模型和 gateway 狀態
Profile 與 workspace 和沙箱的區別
Profile 常常與 workspace 或沙箱混淆,但它們是不同的概念:
- Profile 是給 Hermes 一個獨立的狀態目錄:
config.yaml、.env、SOUL.md、對話紀錄、記憶體、日誌、排程任務和 gateway 狀態。 - Workspace 或工作目錄是終端機指令的起始位置。這由
terminal.cwd另外控制。 - Sandbox 是用來限制檔案系統存取的機制。Profile 不會限制 agent 的存取範圍。
在預設的 local 終端機後端上,agent 仍然擁有與你的使用者帳號相同的檔案系統存取權限。Profile 並不會阻止它存取 profile 目錄之外的資料夾。
如果你希望 profile 啟動時位於特定的專案目錄,請在該 profile 的 config.yaml 中設定明確的絕對路徑 terminal.cwd:
terminal:
backend: local
cwd: /absolute/path/to/project
在 local 後端上使用 cwd: "." 表示「Hermes 啟動時所在的目錄」,而非「profile 目錄」。
另外請注意:
SOUL.md可以引導模型行為,但不會強制執行工作區邊界。SOUL.md的變更會在新對話中立即生效。現有的對話可能仍在使用舊的提示詞狀態。- 問模型「你在哪個目錄?」並不是可靠的隔離測試。如果你需要可預測的工具起始目錄,請明確設定
terminal.cwd。
運行 Gateway
每個 profile 都會以獨立的進程運行自己的 gateway,使用自己的 bot 令牌:
coder gateway start # 啟動 coder 的 gateway
assistant gateway start # 啟動 assistant 的 gateway(獨立進程)
不同的 Bot 令牌
每個 profile 都有自己的 .env 檔案。在各個檔案中配置不同的 Telegram/Discord/Slack bot 令牌:
# 編輯 coder 的令牌
nano ~/.hermes/profiles/coder/.env
# 編輯 assistant 的令牌
nano ~/.hermes/profiles/assistant/.env
安全性:令牌鎖定
如果兩個 profile 不小心使用了相同的 bot 令牌,第二個 gateway 會被阻止並顯示明確的錯誤訊息,指出衝突的 profile 名稱。支援 Telegram、Discord、Slack、WhatsApp 和 Signal。
持久化服務
coder gateway install # 建立 hermes-gateway-coder systemd/launchd 服務
assistant gateway install # 建立 hermes-gateway-assistant 服務
每個 profile 都有自己的服務名稱。它們獨立運行。
NOTE — 官方 Docker 映像內的運作方式
每個 profile 的 gateway 由 s6-overlay(容器中的 PID 1)監管,因此
hermes profile create <name>會自動在/run/service/gateway-<name>/註冊一個 s6 服務插槽。hermes -p <name> gateway start/stop/restart會派發到s6-svc而非直接產生裸進程 —— 崩潰會自動重啟,docker restart也會保留之前運行中的 gateway 集合。詳見 Per-profile gateway supervision。
設定 Profile
每個 profile 都有自己的:
config.yaml—— 模型、供應商、工具集、所有設定.env—— API 金鑰、bot 令牌SOUL.md—— 人格設定與指令
coder config set model.default anthropic/claude-sonnet-4
echo "You are a focused coding assistant." > ~/.hermes/profiles/coder/SOUL.md
如果你希望這個 profile 預設在特定專案中工作,也請設定它自己的 terminal.cwd:
coder config set terminal.cwd /absolute/path/to/project
透過儀表板設定
網頁儀表板是一個機器層級的介面,可以透過側邊欄的 profile 切換器管理任何 profile 的設定、API 金鑰、技能、MCP 和模型 —— 不需要為每個 profile 建立獨立的儀表板。coder dashboard 會路由到機器儀表板並預先選取 coder profile。儀表板的 Chat 頁籤也會跟隨切換器,在選定 profile 的目錄下建立對話。
注意:儀表板 Profiles 頁面上的「Set as active」是未來 CLI/gateway 執行的預設值(與 hermes profile use 相同) —— 要從儀表板編輯 profile,請改用切換器。
更新
hermes update 會拉取程式碼(共享的)一次,然後自動將新的內建技能同步到所有 profile:
hermes update
# → Code updated (12 commits)
# → Skills synced: default (up to date), coder (+2 new), assistant (+2 new)
使用者修改過的技能不會被覆蓋。
管理 Profile
hermes profile list # 顯示所有 profile 及其狀態
hermes profile show coder # 顯示某個 profile 的詳細資訊
hermes profile rename coder dev-bot # 重新命名(更新別名和服務)
hermes profile export coder # 匯出為 coder.tar.gz
hermes profile import coder.tar.gz # 從封存檔匯入
刪除 Profile
hermes profile delete coder
這會停止 gateway、移除 systemd/launchd 服務、移除指令別名,並刪除所有 profile 資料。系統會要求你輸入 profile 名稱來確認。
使用 --yes 跳過確認:hermes profile delete coder --yes
NOTE
你無法刪除預設的 profile(
~/.hermes)。要完全移除所有內容,請使用hermes uninstall。
Tab 自動完成
# Bash
eval "$(hermes completion bash)"
# Zsh
eval "$(hermes completion zsh)"
將這行加入你的 ~/.bashrc 或 ~/.zshrc 以啟用持久化的自動完成功能。支援在 -p 之後完成 profile 名稱、profile 子指令和頂層指令。
運作原理
Profile 使用 HERMES_HOME 環境變數。當你執行 coder chat 時,包裝腳本會在啟動 hermes 之前設定 HERMES_HOME=~/.hermes/profiles/coder。由於程式碼庫中 119+ 個檔案透過 get_hermes_home() 解析路徑,Hermes 的狀態會自動限定在 profile 目錄內 —— 包括設定、對話紀錄、記憶體、技能、狀態資料庫、gateway PID、日誌和排程任務。
這與終端機工作目錄是分開的。工具執行從 terminal.cwd 開始(或在 local 後端使用 cwd: "." 時從啟動目錄開始),不會自動從 HERMES_HOME 開始。
在主機安裝環境中,工具子進程預設會保留你真實的 OS 使用者 HOME,因此 ~ 下的現有 CLI 憑證可以在不同 profile 間共用。Profile 資料透過 HERMES_HOME 隔離,而非透過更改 HOME。容器後端仍然使用 {HERMES_HOME}/home 作為持久化工具狀態,而需要嚴格按 profile 隔離工具設定的主機使用者可以透過 terminal.home_mode: profile 來啟用。
這意味著有兩件事容易搞混:
HERMES_HOME是 profile 的邊界。它控制 Hermes 設定、.env、記憶體、對話紀錄、技能、日誌、排程任務、gateway 狀態和其他 Hermes 資料。HOME是外部 CLI 所期望的作業系統/使用者目錄。在主機安裝中,Hermes 預設保留它為真實的使用者目錄,讓git、ssh、gh、az、npm、Claude Code 和 Codex 等工具能找到它們在你正常 shell 中使用的相同憑證。
代價是主機 profile 預設共享正常的使用者級 CLI 狀態。如果你需要每個 profile 擁有獨立的 CLI 身份,請在該 profile 的 config.yaml 中設定 terminal.home_mode: profile。在此模式下,Hermes 會以 HOME={HERMES_HOME}/home 啟動工具子進程;你需要在該 profile 的目錄內初始化或連結特定的 ~/.ssh、~/.gitconfig、~/.config/gh、雲端 CLI 認證、Claude/Codex 認證、npm 狀態等相關檔案。
Hermes 也向子進程暴露 HERMES_REAL_HOME,以便腳本在 home_mode: profile 啟用時仍能找到真實的帳號主目錄。
預設的 profile 就是 ~/.hermes 本身。無需遷移 —— 現有的安裝方式完全相同。
將 Profile 作為發行版分享
你在一台機器上建立的 profile,可以打包成一個 git repository,然後在另一台機器上用一行指令安裝 —— 你自己的工作站、隊友的筆記型電腦,或社群使用者的環境。共享的套件包含 SOUL、設定、技能、排程任務和 MCP 連線。憑證、記憶體和對話紀錄仍然是每台機器獨立的。
# 從 git repo 安裝整個 agent
hermes profile install github.com/you/research-bot --alias
# 當作者發布新版本時更新(保留你的記憶體 + .env)
hermes profile update research-bot
詳見 Profile Distributions: Share a Whole Agent 以取得完整指南 —— 包括製作、發布、更新語意、安全模型和使用場景。