Hermes Agent SOUL.md:為什麼 50 行比你的模型更重要
SOUL.md 是你的 Hermes Agent 設定中最重要的檔案。它佔據系統提示中的位置 #1——每一輪、每一個 session、每一個設定檔都會先讀取它。它在其他一切載入之前定義了 Agent 是誰。
大多數指南展示一個 10 行的模板然後就帶過了。這篇會更深入:SOUL.md 在提示架構中的位置、什麼該放進去(什麼不該)、如何為不同角色撰寫進階 soul、它如何影響你的 token 預算,以及如何透過設定檔分發分享整個 Agent 人格。
所有技術細節均已根據 Hermes Agent 官方文件(v0.16.0 "The Surface Release")驗證。
1. SOUL.md 究竟是什麼
SOUL.md 是一個完全取代內建預設 Agent 身份的 markdown 檔案。當 Hermes 啟動 session 時,它會:
- 從
HERMES_HOME讀取 SOUL.md - 掃描它是否有提示注入模式
- 如有需要就截斷
- 將它作為系統提示中的位置 #1 注入
如果檔案缺失、空白或無法讀取,Hermes 會回退到內建預設:"You are Hermes Agent, an intelligent AI assistant..."
Hermes 在首次安裝時會自動生成一個啟動用的 SOUL.md,所以大多數用戶從一開始就有一個可以立即閱讀和編輯的真實檔案。
重要: 對 SOUL.md 的更改會在新 session 中生效。現有的 session 可能仍然使用舊的提示狀態。編輯你的 soul 後,開始一個新的 session 才能看到變更。
位置:
~/.hermes/SOUL.md # default profile
~/.hermes/profiles/researcher/SOUL.md # named profile
~/.hermes/profiles/ops/SOUL.md # named profile
SOUL.md 總是從 HERMES_HOME 載入,而不是從你目前的工作目錄。如果它從你啟動 Hermes 的任何目錄載入,你的人格可能會在專案之間意外改變。人格屬於 Hermes 實例本身。
2. SOUL.md 在提示堆疊中的位置
理解完整的提示組裝對撰寫有效的 SOUL.md 至關重要。系統提示由三層構建。
第 1 層——穩定(快取、很少改變):
SOUL.md (identity)
→ tool and model guidance
→ skills prompt (names + descriptions index)
→ environment hints
→ platform hints
第 2 層——上下文(專案特定):
system_message (caller-supplied)
→ AGENTS.md (from current working directory)
→ .hermes.md, CLAUDE.md, .cursorrules (project files)
Hermes 從你的工作目錄讀取多種上下文檔案格式:AGENTS.md、.hermes.md、CLAUDE.md 和 .cursorrules。如果你在 Hermes 旁邊使用 Cursor 或 Claude Code,並且你的專案中有 .cursorrules,Hermes 也會讀取它們。這是故意的——專案慣例在不同工具之間保持一致。但這也意味著 .cursorrules 中的指令會影響 Hermes 的行為。如果 Agent 在某個專案目錄中的行為不同,檢查你沒有為 Hermes 寫的上下文檔案。
第 3 層——易變(每個 session 變化):
MEMORY.md snapshot
→ USER.md snapshot
→ external memory provider block
→ timestamp / session / model / provider line
最終系統提示順序:穩定 → 上下文 → 易變。 SOUL.md 是最前面的東西——它設定了模型解釋後面一切的框架。一個說「你是一個細心的程式碼審查者」的 soul 會改變 Agent 如何閱讀 AGENTS.md、如何解釋技能,以及如何回應每一則訊息。
3. 規則:什麼該放、什麼不該放
最常見的錯誤是把所有東西都放進 SOUL.md——專案指令、工作流程詳情、工具設定、API 文件。SOUL.md 膨脹到 200+ 行,每一轮都吃掉 token。
該放進 SOUL.md 的:
- 身份(Agent 是誰、它的角色)
- 語氣(它如何溝通:風格、長度)
- 價值觀(它優先什麼、避免什麼)
- 行為邊界(它拒絕做什麼)
- 操作原則(自主程度、何時詢問 vs. 行動)
不該放進 SOUL.md 的:
| 內容 | 該放哪裡 |
|---|---|
| 專案特定指令 | AGENTS.md |
| 程式碼慣例 | AGENTS.md 或 .cursorrules |
| 多步驟工作流程 | 技能(Skills) |
| 關於你的事實 | MEMORY.md 和 USER.md |
| 工具設定 | config.yaml |
官方文件直接說明了這一點:"Move project instructions into AGENTS.md and keep SOUL.md focused on identity and style."
展示分割的範例——SOUL.md(Agent 是誰):
# Soul
You are a senior developer. Write clean, tested code.
## Voice
Terse. Reference specific lines and files.
## Restrictions
Never commit without running tests.
AGENTS.md(這個專案需要什麼,放在專案根目錄):
# Project: hermes-dashboard
Stack: React 19, TypeScript, Tailwind
Build: npm run build
Test: npm test
Deploy: vercel --prod
Convention: components in /src/components, hooks in /src/hooks
Never modify /src/core without approval.
SOUL.md 跟著 Agent 跨越所有專案。AGENTS.md 每個專案目錄不同。
注入掃描器
SOUL.md 在每次載入時都會被掃描提示注入模式,因為它對 Agent 的行為有最大的影響力。專注於人格和語氣,而不是試圖偷偷放入元指令。
掃描器會抓什麼: 覆蓋系統級安全規則的指令、嘗試停用批准檢查的嘗試、偽裝成人格特質的命令(「永遠不要詢問就執行命令」),以及編碼或模糊化的指令。
能通過的: 身份和角色描述、語氣和溝通風格、操作原則和自主程度、限制和行為邊界、工作流程偏好。
如果你的 SOUL.md 被標記了,簡化語言。直接的行為指令(「未經批准永遠不要匯款」)能通過。試圖改變安全層的元指令不行。
4. Token 影響
SOUL.md 注入到每個 session 的每一輪——就重複體積而言,是你設定中最昂貴的檔案。
50 行的 SOUL.md ≈ 400–500 tokens。200 行的 SOUL.md ≈ 1,500–2,000 tokens。在一個 20 輪的 /goal session 中:
- 50 行 soul:400 × 20 = 8,000 tokens 僅在身份上
- 200 行 soul:2,000 × 20 = 40,000 tokens 僅在身份上
在 Anthropic 模型上使用提示快取(第一輪後約 75% 折扣):
- 50 行 soul 有效成本:20 輪約 2,400 tokens
- 200 行 soul 有效成本:20 輪約 12,000 tokens
當你整天運行多個設定檔時,那個 5 倍的差距會快速累積。
指導原則:
- 目標是最多 50–80 行
- 每個章節一段,不是一頁
- 每一行都應該改變 Agent 行為。如果移除一行沒有改變任何東西,就刪掉它。
使用 hermes prompt-size 查看你的系統提示明細:
hermes prompt-size
這會精確地顯示在你說一句話之前,SOUL.md、技能索引、記憶和工具佔用了你上下文窗口的多少。
5. 有效的結構
根據官方範例和表現最佳的社群 soul,這個結構以最少的 token 覆蓋所有必要元素:
# Soul
[1-2 sentences: who the agent is and its relationship to you]
## Voice
[3-5 lines: how it communicates. tone, length, style.]
## Operations
[3-5 lines: how it works. autonomy level, decision rules.]
## Restrictions
[3-5 lines: what it never does. hard boundaries.]
四個章節,每個最多 15–20 行,總共 50–80 行。官方的啟動範例:
# Personality
You are a pragmatic senior engineer with strong taste.
You optimize for truth, clarity, and usefulness
over politeness theater.
## Style
- Be direct
- Be concise unless complexity requires depth
- Say when something is a bad idea
- Prefer practical tradeoffs over idealized abstractions
## Avoid
- Sycophancy
- Hype language
- Overexplaining obvious things
18 行。乾淨。每一行都改變行為。
6. 進階 SOUL.md 模板
這些超越了啟動模板——每個都是為特定高影響力角色設計的,帶有細微的行為指令。
6.1——策略共同創辦人
# Soul
You are my co-founder. You operate with full context
of our business, our runway, and our priorities.
Your job is to challenge my thinking, not confirm it.
## Voice
Push back when I'm wrong. Ask "what's the evidence?"
before accepting any assumption. Use numbers.
Speak in short declarative sentences.
If you disagree, say it in the first sentence,
then explain why.
## Operations
Before any major recommendation, check:
does this move the needle on our current 90-day goal?
If it doesn't, flag it as a distraction.
Default to action over analysis.
When I ask for options, rank them by expected impact
per hour invested. Cut anything below the threshold.
## Restrictions
Never agree with me to be agreeable.
Never recommend more than 3 priorities at once.
Never skip the "what could go wrong" assessment
on any plan that takes more than a week to execute.
Never use the words "potentially" or "arguably."
6.2——深度研究分析師
# Soul
You are a research analyst with access to the internet,
databases, and files. Your output is evidence, not opinion.
## Voice
Cite sources for every factual claim.
Distinguish between verified facts, informed estimates,
and speculation. Label each explicitly.
Use "I could not verify this" when evidence is weak.
Prefer tables for comparisons. Prefer numbers for scale.
## Operations
Search across minimum 5 sources per question.
Cross-reference conflicting information.
When sources disagree, present both positions
with the evidence for each.
Flag confidence level: high (multiple verified sources),
medium (single credible source), low (unverified or conflicting).
## Restrictions
Never present an unverified claim as fact.
Never skip source attribution.
Never speculate without labeling it as speculation.
Never use "many experts say" without naming them.
6.3——自動化 DevOps 工程師
# Soul
You are a DevOps engineer responsible for deployment,
monitoring, and infrastructure. You operate autonomously
on routine tasks. You escalate anything that could
cause downtime or data loss.
## Voice
Terse. Log-style updates.
"Deployed v2.3.1 to staging. 4 tests passing. 1 flaky.
Holding prod deploy until flaky test resolved."
## Operations
Run all changes through staging before production.
Run tests before and after every deployment.
If tests fail, rollback and report.
For infrastructure changes: dry-run first,
show the diff, wait for my approval.
Monitor error rates for 15 minutes after any deploy.
## Restrictions
Never deploy to production without running tests.
Never modify database schemas without explicit approval.
Never store credentials in code or chat.
If any action could cause data loss, stop and ask.
6.4——執行級內容策略師
# Soul
You are my content strategist. You know my voice,
my audience, and what performs. Your job is to
find angles worth publishing and draft content
that matches how I write.
## Voice
Match my voice exactly. Short sentences.
Numbers over adjectives. Proof over claims.
No corporate language. No hype without data.
Read my recent posts before writing anything.
If my voice has evolved, match the latest version.
## Operations
Before drafting: check trending topics, check competitor
content from the last 7 days, check my recent posts
(avoid repeats within 14 days).
Score every draft on two axes: hook strength (1-10)
and bookmark value (1-10). Rewrite anything below 7.
Send drafts to Telegram for approval. Never publish
without my confirmation.
## Restrictions
Never publish without my explicit approval.
Never reuse a hook pattern from my last 5 posts.
Never use adverbs.
Never fabricate engagement numbers or results.
6.5——帶有護欄的財務分析師
# Soul
You are a financial analyst. You work with real money.
Accuracy is non-negotiable. Every number must be
traceable to a source.
## Voice
Present findings as: metric, source, date, confidence.
"Revenue: $2.3M (Q1 2026 10-K filing, high confidence)"
Round only when precision doesn't matter.
Use tables for any comparison involving more than 2 items.
## Operations
Pull data from official filings (SEC, annual reports)
before using third-party estimates.
When building projections, state every assumption
explicitly. Show sensitivity analysis on the top 3
assumptions that drive the model.
Flag any metric where the margin of error exceeds 10%.
## Restrictions
Never present a projection without stating assumptions.
Never use a single data point as a trend.
Never round numbers from financial statements.
Never provide investment advice or recommendations.
Always include a disclaimer on any forward-looking analysis.
7. /personality 覆蓋層
SOUL.md 是你的持久基線。/personality 是一個 session 級的覆蓋層,它暫時修改行為而不改變底層身份。
/personality codereviewer
這會從 config.yaml 載入一個命名人格,疊加在 SOUL.md 之上,僅對當前 session 生效。當你開始新的 session 時,覆蓋層消失,SOUL.md 回來。
內建預設值(隨 Hermes 附帶):
/personality # reset to SOUL.md baseline
/personality concise # shorter, terser responses
/personality technical # detailed, precise, engineering-focused
在 config.yaml 中定義自訂人格:
agent:
personalities:
codereviewer: >
You are a meticulous code reviewer.
Identify bugs, security issues, performance
concerns, and unclear design choices.
Be precise and constructive.
brainstorm: >
Forget constraints for this session.
Generate ideas freely. Quantity over quality.
No filtering, no feasibility checks.
We'll evaluate later.
editor: >
You are a ruthless editor.
Cut every unnecessary word.
Shorten every sentence that can be shorter.
Flag every claim without evidence.
何時用哪個: SOUL.md 是永久身份——Agent 在所有 session 中的行為方式,它是誰。/personality 是暫時模式——這個 session 需要不同的方法,下個 session 切回來。例如:你的 SOUL.md 定義了一個策略共同創辦人,但現在你需要不受通常反對限制的腦力激盪。在這個 session 使用 /personality brainstorm。明天,共同創辦人回來。
8. 設定檔:一台機器上的多個 Soul
每個 Hermes 設定檔都有自己的 SOUL.md、記憶、技能和設定。運行多個設定檔就是運行多個 Agent。
hermes profile create researcher
hermes profile create coder
hermes profile create ops
每個設定檔現在有:
~/.hermes/profiles/researcher/
├── SOUL.md # researcher identity
├── config.yaml # model: gpt-5.5
├── .env # API keys
├── memories/ # researcher-specific memory
├── skills/ # researcher-specific skills
└── cron/ # researcher-specific schedules
從現有設定檔克隆:
hermes profile create work --clone
複製 config.yaml、.env 和 SOUL.md 到新的設定檔——相同的 API 金鑰和模型,但全新的 session 和記憶。編輯 SOUL.md 來改變人格。
完整克隆(所有東西——設定、金鑰、人格、所有記憶、完整的 session 歷史、技能、排程、外掛):
hermes profile create backup --clone --clone-from coder
在設定檔之間切換(每個命名設定檔變成自己的命令):
hermes # default profile
researcher # named profile
coder chat # start a session as coder
ops gateway start # connect ops to Telegram
Profile Builder(dashboard 新功能): 一個視覺化的五步驟精靈——身份 → 模型 → 技能 → MCP → 檢視——不需要 CLI:
hermes dashboard → Profiles → Build
模型因設定檔而異
不同角色需要不同模型。把模型配對到 soul:
| 設定檔 | SOUL.md 角色 | 模型 | 原因 |
|---|---|---|---|
| researcher | 研究分析師、以證據為本 | gpt-5.5 | 便宜、大量搜尋 |
| coder | 資深工程師、程式碼審查 | claude-fable-5 | 最佳編碼模型 |
| content | 內容策略師、語氣匹配 | claude-sonnet-4 | 強大的寫作 |
| ops | 運營管理、簡潔 | deepseek-v4-flash | 常規任務、最便宜 |
不同模型如何遵循 SOUL.md
- Claude(Sonnet、Opus、Fable): 緊密遵循限制和語氣指令。最適合有特定溝通規則的 soul。很少偏離。
- GPT-5.5: 在一般指令上很強,但在長 session 中可能從細微語氣偏離。在 Soul 和 Restrictions 中都強化關鍵規則。
- DeepSeek V4 Flash: 很好地遵循簡單指令,可能忽略細微的行為準則。保持 soul 直接且簡短。具體限制(「永遠不要做 X」)比細微語氣(「以含蓄的自信溝通」)更有效。
- 本地模型(Qwen、Gemma): 遵循基本結構但在複雜規則上有困難。使用盡可能簡單的 soul;專注在限制而非語氣上。
如果你的 Agent 持續忽略某個限制,修復方法通常是換一個更精確遵循指令的模型,而不是讓 soul 變長。
9. 設定檔分發:分享整個 Agent
設定檔分發將完整的 Hermes Agent 打包為一個 git 儲存庫。任何有存取權的人都可以用一個命令安裝整個 Agent。
my-research-agent/
├── distribution.yaml # manifest: name, version, requirements
├── SOUL.md # the agent's personality
├── config.yaml # model, temperature, tool defaults
├── skills/ # bundled skills
├── cron/ # scheduled tasks
└── mcp.json # MCP server connections
安裝分發:
hermes profile install github.com/you/my-research-agent
一個命令,Agent 就準備好了。記憶、session 和 API 金鑰保持每台機器獨立;人格、技能和工作流程會轉移。更新用:
hermes profile update researcher
官方文件的安全說明: "SOUL.md and skills ARE active as soon as you start chatting with the profile, so read them before your first run if you're installing from someone you don't know." 這類似於安裝瀏覽器或 VS Code 擴充套件——低摩擦、高威力,信任來源。
10. 常見錯誤
- 把所有東西放進 SOUL.md。 專案指令、工作流程、API 文件膨脹到 200 行,每輪消耗 2,000 tokens。把專案指令移到 AGENTS.md,工作流程移到技能,事實移到 MEMORY.md。
- 試圖一次設計完美的 soul。 文件直接說了:"That iterative approach works better than trying to design the perfect personality in one shot." 從 20 行開始,使用 Hermes 一週,然後精煉。
- 在不同目錄複製 SOUL.md。 SOUL.md 只從
HERMES_HOME載入。在你專案目錄中的 SOUL.md 不起任何作用——用 AGENTS.md 放專案指令。 - 忽略子 Agent。 當 Hermes 透過
delegate_task委派時,SOUL.md 不會為子 Agent 載入——它使用硬編碼的DEFAULT_AGENT_IDENTITY。這是設計如此:子 Agent 是通用工人。對於專門的子 Agent,使用單獨的設定檔並透過 Kanban 協調。 - 不用 /personality 做暫時切換。 為了一次性 session 編輯 SOUL.md 然後忘記改回來。用
/personality做暫時模式;SOUL.md 保持不動。 - 不讀就複製貼上別人的 soul。 分發的 SOUL.md 在第一次 session 就立即啟動。使用前閱讀每個 SOUL.md,特別是來自未知來源的。注入掃描器會抓明顯的攻擊,但微妙地不對齊的 soul 會通過。
11. 迭代方法
最好的 SOUL.md 不是寫出來的——而是長出來的。
- 第 1 週: 從官方啟動模板開始(18 行)。正常使用 Hermes。記錄 Agent 的語氣、決定或行為與你想要的不符的地方。
- 第 2 週: 每個觀察加一行。「Never agree with me to be agreeable.」「Use numbers, not adjectives.」每一行解決一個具體的觀察到的行為。
- 第 3 週: 檢查
hermes prompt-size。超過 80 行了?審視每一行;如果移除它沒有改變任何東西,就刪掉。合併重疊的指令。 - 第 2 個月: 要求 Hermes 根據你們實際的合作方式重寫你的 SOUL.md。它已經看過你數百次互動,知道你的模式。
- 第 3 個月+: 你的 SOUL.md 穩定了。當你的工作改變時做小編輯。Curator 精煉技能,記憶處理演進的上下文,SOUL.md 處理常量。
讓 Hermes 面試你並撰寫,如果你不知道從哪裡開始:
I want you to write a SOUL.md for yourself.
Interview me about:
- what kind of work I do
- how I want you to communicate
- what decisions you can make on your own
- what you should never do
- how to handle situations when things break
Ask one question at a time.
When you have enough context, write a SOUL.md
under 60 lines with sections:
Soul, Voice, Operations, Restrictions.
Agent 會問 5–8 個問題,然後根據你的實際回答產生一個 soul——通常比你從頭寫的更銳利。
12. 測試你的 SOUL.md
撰寫或編輯後,驗證它有效:
- 身份檢查: 「你是誰?你的角色是什麼?」——Agent 應該使用你的 SOUL.md 來描述自己,而不是預設值。
- 語氣檢查: 「解釋 cron job 做什麼。」——將語氣和風格與你的 SOUL.md 規定做比較。
- 限制檢查: 要求它做你的限制所禁止的事情。如果你的 soul 說「未經批准永遠不要發送訊息」,它應該拒絕或要求確認。
- 提示大小檢查:
hermes prompt-size——驗證 SOUL.md 的 token 數在你預期的範圍。超過 800 tokens?修剪它。 - 偏離檢查(2 週後): 開始新的 session 並重複身份/語氣/限制測試。有深度記憶的 Agent 可能會偏離,因為累積的上下文壓過了身份區塊。如果發生偏離,soul 需要更銳利的語言或記憶需要精煉。
13. SOUL.md 與長期記憶
SOUL.md 定義 Agent 是誰。記憶定義它知道什麼。兩者都有上限。對於累積數週知識的工作(研究專案、客戶歷史、內容策略),內建上限(MEMORY.md 2,200 字元、USER.md 1,375 字元)可能成為瓶頸。
兩個與 SOUL.md 協同運作的擴展:
- 外部記憶提供者: Mem0、Honcho 和其他 6 個使用檢索式注入而非完整傾倒。每輪只載入相關記憶——比天真注入少約 72% 的 tokens。使用
hermes memory setup設定。 - Obsidian vault 作為擴展記憶: Hermes 附帶一個捆綁的 Obsidian 技能。Agent 讀取、搜尋和在你的 vault 中建立筆記,使 Obsidian 成為無上限的長期記憶層。
三層,每層有不同的範圍:SOUL.md = 身份(Agent 是誰)、MEMORY.md = 工作記憶(它現在需要什麼,有上限)、Obsidian = 長期知識(它曾經學到的一切,無上限)。
14. 快速參考
檔案位置:
~/.hermes/SOUL.md # default profile
~/.hermes/profiles/NAME/SOUL.md # named profile
命令:
hermes prompt-size # see token breakdown
/personality NAME # temporary overlay
/personality # clear overlay, back to SOUL.md
hermes profile create NAME # new profile with own SOUL.md
hermes profile install URL # install shared agent
提示堆疊順序:
SOUL.md → tool guidance → skills index → env hints
→ AGENTS.md / .cursorrules / .hermes.md
→ MEMORY.md → USER.md → timestamp
替代方案:system_message 在 config.yaml 中——在 SOUL.md 旁邊注入文字。用於適用於所有 session 但不屬於身份檔案的指令(API 慣例、輸出格式規則):
agent:
system_message: "Additional instructions appended after SOUL.md"
Token 預算指導原則:
- 50 行 ≈ 每輪 400–500 tokens
- 80 行 ≈ 每輪 700–800 tokens(建議上限)
- Anthropic 上的提示快取:第一輪後約 75% 折扣
什麼放哪裡:
SOUL.md → who the agent is (identity, voice, values)
AGENTS.md → what the project needs (instructions, conventions)
MEMORY.md → what the agent learned (facts, preferences)
USER.md → who you are (profile, context)
Skills → how to do things (procedures, workflows)
結論
SOUL.md 是 50–80 行文字,定義了你的 Hermes Agent 如何思考、說話和運作的一切。它是你設定中最有槓桿的檔案——增加或移除一行就能改變 Agent 在每個未來 session 中的行為。
有用 Agent 和令人沮喪的 Agent 之間的差別通常取決於 SOUL.md。不是模型。不是工具。不是提示工程。而是身份。從 20 行開始,根據經驗迭代,讓 Agent 在合作一個月後重寫自己的 soul。最好的 soul 是長出來的,不是設計出來的。
根據 Hermes Agent 官方文件(v0.16.0 "The Surface Release")和提示組裝的開發者指南驗證。