Hermes Agent: Profile 配置
最后更新:2026-08-31
Profile 是 Hermes Agent 的用户身份证——不同人有不同偏好,Profile 让同一个 Agent 服务多人时,每人都有自己的记忆、技能和风格。
💡 提示:Profile 不仅存储用户基本信息,还关联独立的记忆空间、技能集、用户画像和平台偏好。多用户场景下,Profile 隔离确保隐私。
📋 前置知识:第6课 记忆系统
1. 你将学到
| 编号 | 内容 |
|---|---|
| ❶ | Profile 概念与结构 |
| ❷ | 创建与管理 Profile |
| ❸ | 多用户隔离机制 |
| ❹ | 团队 Profile 与共享 |
| ❺ | Profile 迁移与备份 |
2. 故事
(1) 痛点:团队共用一个 Bot,互相干扰
Bob 和同事共用一个 Telegram Bot,但 Bob 习惯中文,同事用英文。Bob 的项目是前端,同事是后端。Agent 搞混了。
(2) 解法:每人一个 Profile
BASH
# Bob 的 Profile
hermes chat --user bob
> 你好 Bob!偏好: React + TypeScript + 中文
# 同事的 Profile
hermes chat --user carol
> Hi Carol! Preference: Python + FastAPI + English
3. Profile 结构
(1) Profile 文件
YAML
# ~/.hermes/profiles/bob.yaml
user:
id: "bob"
name: "Bob"
language: "zh-CN"
timezone: "Asia/Shanghai"
preferences:
tech_stack:
- "React"
- "TypeScript"
- "Tailwind CSS"
code_style: "concise"
communication: "direct"
model:
default: "gpt-4o"
temperature: 0.7
personality:
tone: "friendly"
verbosity: "balanced"
platforms:
telegram:
chat_id: 123456789
slack:
user_id: "U12345"
skills:
custom:
- "react-component-review"
- "git-commit-helper"
disabled:
- "java-code-review"
memory:
isolated: true # 独立记忆空间
share_with: [] # 不与他人共享
4. Profile 管理
(1) 命令行操作
BASH
# 创建 Profile
hermes profile create --name "bob"
# 交互式创建
hermes profile create --interactive
? 名字: Bob
? 语言: zh-CN
? 默认模型: gpt-4o
? 技术栈: React, TypeScript
? 沟通风格: 简洁直接
# 列出所有 Profile
hermes profile list
# 切换 Profile
hermes profile switch bob
# 查看当前 Profile
hermes profile show
# 编辑 Profile
hermes profile edit bob
# 删除 Profile
hermes profile delete bob
(2) 对话中管理
BASH
me: /profile
Agent: 当前 Profile: Bob
语言: zh-CN | 模型: gpt-4o | 技术栈: React, TypeScript
me: /profile switch carol
Agent: 已切换到 Carol 的 Profile
语言: en | 模型: claude-3.5-sonnet | 技术栈: Python, FastAPI
5. 多用户隔离机制
(1) 数据隔离
~/.hermes/
├── profiles/
│ ├── bob.yaml # Bob 的 Profile
│ ├── carol.yaml # Carol 的 Profile
│ └── team-frontend.yaml # 团队 Profile
├── memory/
│ ├── bob/ # Bob 独立记忆
│ │ ├── working/
│ │ ├── long_term/
│ │ └── user_model/
│ └── carol/ # Carol 独立记忆
│ ├── working/
│ ├── long_term/
│ └── user_model/
└── skills/
├── bob/ # Bob 自定义技能
└── carol/ # Carol 自定义技能
(2) 隔离规则
| 数据 | 隔离级别 | 说明 |
|---|---|---|
| 记忆 | 完全隔离 | 每人独立记忆空间 |
| 技能 | 选择隔离 | 自定义技能隔离,内置技能共享 |
| 用户画像 | 完全隔离 | Honcho 为每人建模 |
| 配置 | 选择隔离 | 可覆盖全局配置 |
| 平台绑定 | 完全隔离 | 每人绑定自己的平台账号 |
6. 团队 Profile 与共享
(1) 团队 Profile
YAML
# ~/.hermes/profiles/team-frontend.yaml
user:
id: "team-frontend"
name: "Frontend Team"
type: "team"
shared:
skills:
- "react-component-review"
- "eslint-rules"
- "deploy-frontend"
memory:
categories:
- "team-conventions" # 团队规范(共享)
- "project-info" # 项目信息(共享)
conventions:
code_style: "ESLint + Prettier"
commit_style: "Conventional Commits"
review_checklist:
- "TypeScript strict mode"
- "Accessibility (WCAG 2.1)"
- "Performance (Lighthouse > 90)"
(2) 共享技能
BASH
# Alice 创建技能并共享给团队
/learn --share team-frontend 审查组件时检查团队规范
# 团队成员使用共享技能
hermes chat --user bob --team team-frontend
Agent: [加载团队技能] react-component-review, eslint-rules
[加载个人记忆] Bob 的偏好和项目...
7. Profile 迁移与备份
(1) 导出与导入
BASH
# 导出 Profile(含记忆和技能)
hermes profile export bob --include-memory --include-skills
# 输出:bob-profile-20260315.tar.gz
# 包含:profile.yaml + memory/ + skills/
# 导入到另一台机器
hermes profile import bob-profile-20260315.tar.gz
(2) 同步
BASH
# Git 同步(推荐团队使用)
cd ~/.hermes
git init
git remote add origin git@github.com:team/hermes-config.git
git add profiles/ skills/
git commit -m "sync profiles"
git push
# 另一台机器拉取
git pull
❓ 常见问题
Q 默认 Profile 是什么?
A
default Profile,首次 hermes init 时创建。不指定 --user 时使用默认 Profile。Q Profile 数量有限制吗?
A 无限制。每个 Profile 独立存储,互不影响。
Q 如何实现"部分共享"?
A 团队 Profile 共享技能和规范,个人 Profile 保持独立记忆和偏好。通过
--team 参数叠加使用。Q 切换 Profile 影响正在运行的任务吗?
A 不影响已运行的任务。新对话使用切换后的 Profile。
Q Profile 中的 API Key 安全吗?
A API Key 存在环境变量或 .env 文件中,不写入 Profile YAML。Profile 只引用变量名。
Q 如何删除 Profile 及其所有数据?
A
hermes profile delete <name> --purge,删除 Profile 文件、记忆和技能。建议先导出备份。📖 小节
- Profile 是用户身份证,关联独立的记忆、技能、画像
- 多用户隔离:记忆完全隔离,技能选择隔离
- 团队 Profile:共享技能和规范,个人偏好独立
- 三种管理方式:命令行、对话中、编辑 YAML
- 支持导出导入和 Git 同步
📝 作业
- 基础题(难度⭐):创建你的个人 Profile,设置语言偏好和技术栈,验证 Agent 使用正确配置。
- 进阶题(难度⭐⭐):创建两个 Profile(工作/个人),实现不同场景下自动切换配置。
- 挑战题(难度⭐⭐⭐):设计团队 Profile 方案,包含共享技能、团队规范和成员个性化配置,实现团队协作。