BOOT.md 模板
BOOT.md 定义了 Agent 每次启动时执行的初始化逻辑。它在 Agent 加载工作区文件后、开始处理消息前执行,用于环境检查、数据预加载和状态初始化。
模板
markdown
# BOOT.md
## Startup Tasks
### Environment Check
- Verify all required API keys are configured
- Check database connectivity
- Validate model provider availability
### Data Preload
- Load latest product catalog into context
- Fetch current exchange rates
- Load today's schedule and reminders
### State Initialization
- Set default language to user's preferred language
- Initialize conversation counters
- Clear any stale session locks用途说明
BOOT.md 的内容在 Agent 启动时被注入为一次性的引导提示词(Boot Prompt)。Agent 会按照指令执行初始化任务。
Agent 启动流程:
│
├─ 加载 SOUL.md (人格)
├─ 加载 AGENTS.md (指令)
├─ 加载 TOOLS.md (工具)
├─ 执行 BOOT.md (初始化) ← 此处
│
└─ 开始处理消息执行时机
BOOT.md 在每次 Agent 启动或重载时执行一次,不会在每条消息处理时重复执行。
实际示例
客服 Agent 启动脚本
markdown
# BOOT.md
## Startup
- Use knowledge_search to load the latest FAQ database version
- Verify CRM system is accessible via crm_query tool
- Load current promotion information for this week
- Set greeting message based on current time:
- 06:00-12:00: "早上好"
- 12:00-18:00: "下午好"
- 18:00-06:00: "晚上好"数据分析 Agent 启动脚本
markdown
# BOOT.md
## Startup
- Connect to the analytics database
- Load schema information for available tables
- Fetch latest data refresh timestamp
- If data is older than 24 hours, warn user about data freshness与 BOOTSTRAP.md 的区别
| 文件 | 执行时机 | 用途 |
|---|---|---|
BOOT.md | 每次 Agent 启动 | 运行时初始化 |
BOOTSTRAP.md | 首次设置或重置 | 一次性引导配置 |
何时使用 BOOT.md
需要每次启动都执行的操作放在 BOOT.md,仅需首次设置的操作放在 BOOTSTRAP.md。
最佳实践
- 保持轻量 — 启动脚本应快速执行,避免耗时操作
- 容错设计 — 即使某个初始化步骤失败,Agent 也应能正常运行
- 日志记录 — 记录启动状态便于排查问题
- 幂等操作 — 多次执行应产生相同结果
markdown
# BOOT.md - 推荐写法
## Startup
- Try to load knowledge base. If unavailable, inform user that
offline answers may not be up-to-date.
- Check model provider status. If primary is down, note that
fallback model is in use.