ByteNoteByteNote

字节笔记本

2026年5月16日

Hermes Agent SOUL.md:为 AI Agent 注入个性与灵魂

API中转
¥120

Hermes Agent 的 SOUL.md 是为 AI Agent 定义身份与个性的核心机制。通过编写 SOUL.md 文件,你可以塑造 Agent 的语气、行为风格和对话方式,让它成为一个真正独一无二的助手。本文将详细介绍 SOUL.md 的用途、编写方法、最佳实践,以及它与 AGENTS.md、/personality 的区别。

SOUL.md 的定位

SOUL.md 是 Hermes 实例的首要身份定义。它是 system prompt 中的第一项内容——定义了 Agent 是谁、如何说话、以及避免做什么。

如果你希望 Hermes 每次对话都保持一致的助手风格,或者想用自己设计的角色完全替换 Hermes 的默认人设,SOUL.md 就是你要编辑的文件。

SOUL.md 适合写什么

SOUL.md 适合定义以下内容:

  • 语气(tone)
  • 个性(personality)
  • 沟通风格(communication style)
  • Hermes 应该多直接或多温暖
  • Hermes 应该在风格上避免什么
  • Hermes 如何面对不确定性、分歧和模糊性

一句话总结:

  • SOUL.md 定义的是 Hermes 是谁、怎么说话

SOUL.md 不适合写什么

以下内容不要放在 SOUL.md 中:

  • 项目特定的编码规范
  • 文件路径
  • 命令
  • 服务端口
  • 架构说明
  • 项目工作流指令

这些属于 AGENTS.md

一个好用的判断规则:

  • 如果某条规则应该全局生效,放进 SOUL.md
  • 如果只属于某个项目,放进 AGENTS.md

文件存放位置

Hermes 只使用当前实例的全局 SOUL 文件:

~/.hermes/SOUL.md

如果你使用自定义主目录运行 Hermes,路径变为:

$HERMES_HOME/SOUL.md

首次运行行为

Hermes 会在首次启动时自动生成一个初始 SOUL.md(如果文件尚不存在)。

这意味着大多数用户一开始就拥有一个可以立即阅读和编辑的真实文件。

需要注意:

  • 如果你已有 SOUL.md,Hermes 不会覆盖它
  • 如果文件存在但为空,Hermes 不会将其内容添加到 prompt 中

Hermes 如何使用 SOUL.md

当 Hermes 启动一个会话时,它会从 HERMES_HOME 读取 SOUL.md,扫描是否存在 prompt 注入模式,必要时进行截断,然后将其作为 Agent 身份——system prompt 中的第 1 号插槽。这意味着 SOUL.md 会完全替换内置的默认身份文本。

如果 SOUL.md 缺失、为空或无法加载,Hermes 会回退到内置的默认身份。

文件内容不会被包裹任何额外说明。内容本身至关重要——用你希望 Agent 思考和说话的方式来编写。

第一次编辑建议

如果你只想做最小的改动,打开文件改几行就能让 Agent 感觉不同。

例如:

markdown
You are direct, calm, and technically precise.
Prefer substance over politeness theater.
Push back clearly when an idea is weak.
Keep answers compact unless deeper detail is useful.

仅仅这些改动就能显著改变 Hermes 的对话感觉。

示例风格

1. 务实工程师

markdown
You are a pragmatic senior engineer.
You care more about correctness and operational reality than sounding impressive.

## 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

2. 研究伙伴

markdown
You are a thoughtful research collaborator.
You are curious, honest about uncertainty, and excited by unusual ideas.

## Style
- Explore possibilities without pretending certainty
- Distinguish speculation from evidence
- Ask clarifying questions when the idea space is underspecified
- Prefer conceptual depth over shallow completeness

3. 老师 / 讲解者

markdown
You are a patient technical teacher.
You care about understanding, not performance.

## Style
- Explain clearly
- Use examples when they help
- Do not assume prior knowledge unless the user signals it
- Build from intuition to details

4. 严格评审者

markdown
You are a rigorous reviewer.
You are fair, but you do not soften important criticism.

## Style
- Point out weak assumptions directly
- Prioritize correctness over harmony
- Be explicit about risks and tradeoffs
- Prefer blunt clarity to vague diplomacy

什么样的 SOUL.md 是好的?

一个优秀的 SOUL.md 应该是:

  • 稳定的
  • 广泛适用的
  • 语气具体明确的
  • 不堆砌临时指令的

一个糟糕的 SOUL.md 通常有这些问题:

  • 充满项目细节
  • 自相矛盾
  • 试图微管理每一次回复的格式
  • 大量泛泛的废话,如"要有帮助"和"要清晰"

Hermes 本来就会尽量有帮助和清晰。SOUL.md 应该添加真正的个性和风格,而不是重述默认行为。

推荐结构

你不必使用标题,但标题有助于组织内容。

一个简单有效的结构:

markdown
# Identity
Who Hermes is.

# Style
How Hermes should sound.

# Avoid
What Hermes should not do.

# Defaults
How Hermes should behave when ambiguity appears.

SOUL.md 与 /personality 的关系

两者是互补的。

SOUL.md 用于持久的基线人格。 /personality 用于临时的模式切换。

示例:

  • 你的默认 SOUL 是务实直接的
  • 某次会话中使用 /personality teacher
  • 之后切回来,无需修改基线人格文件

SOUL.md 与 AGENTS.md 的区别

这是最常见的混淆点。

放在 SOUL.md 中

  • "Be direct."
  • "Avoid hype language."
  • "Prefer short answers unless depth helps."
  • "Push back when the user is wrong."

放在 AGENTS.md 中

  • "Use pytest, not unittest."
  • "Frontend lives in frontend/."
  • "Never edit migrations directly."
  • "The API runs on port 8000."

如何编辑

bash
nano ~/.hermes/SOUL.md

或者

bash
vim ~/.hermes/SOUL.md

编辑后重启 Hermes 或开启新会话即可生效。

实践工作流

  1. 从自动生成的默认文件开始
  2. 删掉不像你想要的声音的内容
  3. 添加 4-8 行明确定义语气和默认行为的规则
  4. 和 Hermes 对话一段时间
  5. 根据感觉不对的地方继续调整

这种迭代方式比一次性设计完美人格效果更好。

常见问题排查

编辑了 SOUL.md 但 Hermes 听起来还是一样

检查以下几点:

  • 你编辑的是 ~/.hermes/SOUL.md$HERMES_HOME/SOUL.md
  • 而不是某个仓库本地的 SOUL.md
  • 文件不为空
  • 编辑后重启了会话
  • 没有 /personality 覆盖层在起作用

Hermes 忽略了 SOUL.md 的部分内容

可能原因:

  • 更高优先级的指令覆盖了它
  • 文件中包含相互矛盾的指导
  • 文件太长被截断了
  • 部分文本类似 prompt 注入内容,可能被扫描器阻止或修改

SOUL.md 变得过于项目特定

将项目指令移入 AGENTS.md,保持 SOUL.md 聚焦于身份和风格。

分享: