Skip to content

Agent 深入

Agent 生命周期、推理模式、模型选择。

Agent 生命周期

初始化 → 加载配置 → 加载 Skills → 加载 Workspace → 循环处理消息 → 清理

System Prompt 构建

Agent 的 System Prompt 由多个部分组成:

1. 项目上下文 (Project Context)
   ├── SOUL.md          - Agent 人格
   ├── IDENTITY.md      - Agent 身份
   ├── USER.md          - 用户信息
   ├── AGENTS.md        - 工作区规则
   ├── TOOLS.md         - 工具清单
   ├── HEARTBEAT.md     - 心跳任务
   ├── SKILL.md files   - Skills 指令
   └── Memory files     - 记忆文件

推理模式 (Reasoning)

OpenClaw 支持多种推理模式:

模式说明
off关闭推理(默认)
on启用推理,在回复前显示思考过程
stream流式推理,实时显示思考过程
bash
# 启用推理
/reasoning on

# 流式推理
/reasoning stream

模型选择

bash
# 查看当前模型
/model

# 切换模型
/model glmcode/glm-4

# 设置默认模型
/model default=glmcode/glm-5

模型推荐

用途推荐模型
日常对话glm-4.7, gpt-3.5
复杂任务glm-5, gpt-4
代码编写glm-5, claude-3-opus

← 上一节:系统架构 | 下一节:Skills 开发 →