词元之母TOK.MOM - 平台充值汇率 1:1 即 1 人民币充值到账 1 美元,支持一个 Key 调用近 600+ 海内外模型,限时特价模型低至 1 折,欢迎上岸!
run_agent.pyagent/prompt_builder.pytools/memory_tool.pyHERMES_HOME 中的 SOUL.md,否则回退到 prompt_builder.py 中的 DEFAULT_AGENT_IDENTITYAGENTS.md、.cursorrules、.cursor/rules/*.mdc)— 若 SOUL.md 已在第 1 步作为身份加载,则此处不再包含它skip_context_files(例如子 agent 委托)时,不会加载 SOUL.md,而是使用硬编码的 DEFAULT_AGENT_IDENTITY。# Layer 1: Agent Identity (from ~/.hermes/SOUL.md)
You are Hermes, an AI assistant created by Nous Research.
You are an expert software engineer and researcher.
You value correctness, clarity, and efficiency.
...
# Layer 2: Tool-aware behavior guidance
You have persistent memory across sessions. Save durable facts using
the memory tool: user preferences, environment details, tool quirks,
and stable conventions. Memory is injected into every turn, so keep
it compact and focused on facts that will still matter later.
...
When the user references something from a past conversation or you
suspect relevant cross-session context exists, use session_search
to recall it before asking them to repeat themselves.
# Tool-use enforcement (for GPT/Codex models only)
You MUST use your tools to take action — do not describe what you
would do or plan to do without actually doing it.
...
# Layer 3: Honcho static block (when active)
[Honcho personality/context data]
# Layer 4: Optional system message (from config or API)
[User-configured system message override]
# Layer 5: Frozen MEMORY snapshot
## Persistent Memory
- User prefers Python 3.12, uses pyproject.toml
- Default editor is nvim
- Working on project "atlas" in ~/code/atlas
- Timezone: US/Pacific
# Layer 6: Frozen USER profile snapshot
## User Profile
- Name: Alice
- GitHub: alice-dev
# Layer 7: Skills index
## Skills (mandatory)
Before replying, scan the skills below. If one clearly matches
your task, load it with skill_view(name) and follow its instructions.
...
<available_skills>
software-development:
- code-review: Structured code review workflow
- test-driven-development: TDD methodology
research:
- arxiv: Search and summarize arXiv papers
</available_skills>
# Layer 8: Context files (from project directory)
# Project Context
The following project context files have been loaded and should be followed:
## AGENTS.md
This is the atlas project. Use pytest for testing. The main
entry point is src/atlas/main.py. Always run `make lint` before
committing.
# Layer 9: Timestamp + session
Current time: 2026-03-30T14:30:00-07:00
Session: abc123
# Layer 10: Platform hint
You are a CLI AI Agent. Try not to use markdown but simple text
renderable inside a terminal.SOUL.md 位于 ~/.hermes/SOUL.md,作为 agent 的身份标识——系统 prompt 的第一个部分。prompt_builder.py 中的加载逻辑如下:load_soul_md() 返回内容时,它会替换硬编码的 DEFAULT_AGENT_IDENTITY。随后调用 build_context_files_prompt() 时传入 skip_soul=True,以防止 SOUL.md 出现两次(一次作为身份,一次作为上下文文件)。SOUL.md 不存在,系统将回退到:You are Hermes Agent, an intelligent AI assistant created by Nous Research.
You are helpful, knowledgeable, and direct. You assist users with a wide
range of tasks including answering questions, writing and editing code,
analyzing information, creative work, and executing actions via your tools.
You communicate clearly, admit uncertainty when appropriate, and prioritize
being genuinely useful over being verbose unless otherwise directed below.
Be targeted and efficient in your exploration and investigations.build_context_files_prompt() 使用优先级系统——只加载一种项目上下文类型(先匹配先赢):| 优先级 | 文件 | 搜索范围 | 说明 |
|---|---|---|---|
| 1 | .hermes.md、HERMES.md | 从 CWD 向上至 git 根目录 | Hermes 原生项目配置 |
| 2 | AGENTS.md | 仅 CWD | 常见 agent 指令文件 |
| 3 | CLAUDE.md | 仅 CWD | Claude Code 兼容性 |
| 4 | .cursorrules、.cursor/rules/*.mdc | 仅 CWD | Cursor 兼容性 |
.hermes.md 的 frontmatter 会被移除(保留供未来配置覆盖使用)ephemeral_system_promptagent/prompt_builder.py 使用优先级系统扫描并清理项目上下文文件——只加载一种类型(先匹配先赢):.hermes.md / HERMES.md(向上遍历至 git 根目录)AGENTS.md(启动时的 CWD;子目录在会话期间通过 agent/subdirectory_hints.py 逐步发现)CLAUDE.md(仅 CWD).cursorrules / .cursor/rules/*.mdc(仅 CWD)SOUL.md 通过 load_soul_md() 单独加载用于身份槽位。加载成功后,build_context_files_prompt(skip_soul=True) 会防止其出现两次。agent/prompt_builder.py 视为实现代码,而非配置入口。推荐的自定义路径是修改 Hermes 已加载的 prompt 输入,而非直接编辑 Python 模板。~/.hermes/SOUL.md — 用自定义 agent 角色和固定行为替换内置默认身份块。~/.hermes/MEMORY.md 和 ~/.hermes/USER.md — 提供应在新会话中快照的持久跨会话事实和用户配置文件数据。.hermes.md、HERMES.md、AGENTS.md、CLAUDE.md 或 .cursorrules — 注入仓库特定的工作规则。HERMES_EPHEMERAL_SYSTEM_PROMPT 或 prefill 消息 — 添加不应成为已缓存 prompt 前缀一部分的轮次级指导。agent/prompt_builder.py。该文件为每个会话组装 prompt 管道、缓存边界和注入顺序。直接编辑该文件是全局产品变更,而非针对单个用户的 prompt 自定义。SOUL.md