系统提示词
What the OpenClaw system prompt contains and how it is assembled
OpenClaw 为每次代理运行构建自定义系统提示。该提示是 **OpenClaw 拥有的**,不使用 p-coding-agent 默认提示。
提示由 OpenClaw 组装并注入到每个代理运行中。
構造
提示有意保持紧凑,并使用固定部分:
- 工具:现在的工具列表+簡潔那说明。
- **Safety**: short guardrail reminder to avoid power-seeking behavior or bypassing oversight.
- **Skills** (when available): tells the model how to load skill instructions on demand.
- **OpenClaw Self-Update**: how to run `config.apply` and `update.run`.
- **Workspace**: working directory (`agents.defaults.workspace`).
- **Documentation**: local path to OpenClaw docs (repo or npm package) and when to read them.
- **Workspace Files (injected)**: indicates bootstrap files are included below.
- **Sandbox** (when enabled): indicates sandboxed runtime, sandbox paths, and whether elevated exec is available.
- 现在的日期和时间:用户的本地时间、时区、时间形式。
- **Reply Tags**: optional reply tag syntax for supported providers.
- 心跳:心跳提示词和ack动作。
- **Runtime**: host, OS, node, model, repo root (when detected), thinking level (one line).
- 推理:现在的可见性级别+ /推理切里替得提示词。
系统提示中的安全护栏是建议性的。它们指导模型行为,但不强制执行策略。使用工具策略、执行批准、沙箱和通道允许列表进行硬性强制;操作员可以按设计禁用这些。
Prompt modes
OpenClaw 可以为子代理渲染更小的系统提示。运行时为每次运行设置 `promptMode`(不是面向用户的配置):
`promptMode` per execution (not a user-facing config):
- `full` (default): includes all sections above.
- `minimal`: used for sub-agents; omits **Skills**, **Memory Recall**, **OpenClaw Self-Update**, **Model Aliases**, **User Identity**, **Reply Tags**,
自己更新、模型别名、用户ID、回复标签**、
**Messaging**, **Silent Replies**, **Heartbeats**. Tooling, **Safety**,
Workspace, Sandbox, Current Date & Time (when known), Runtime, and injected
context stay available.
- `none`: returns only the base identity line.
When `promptMode=minimal`, extra injected prompts are labeled **Subagent Context** instead of **Group Chat Context**.
Context** instead of **Group Chat Context**.
工作区引导注入
引导文件被修剪并附加在**项目上下文**下,以便模型无需显式读取即可看到身份和配置文件上下文:
- `AGENTS.md`
- `SOUL.md`
- `TOOLS.md`
- `IDENTITY.md`
- `USER.md`
- `HEARTBEAT.md`
- `BOOTSTRAP.md` (only on brand-new workspaces)
大文件会被截断并带有标记。每个文件的最大大小由 `agents.defaults.bootstrapMaxChars` 控制(默认:20000)。缺失的文件会注入一个简短的缺失文件标记。
controlled by `agents.defaults.bootstrapMaxChars` (default: 20000). Missing files inject a
short missing-file marker.
内部钩子可以通过 `agent:bootstrap` 拦截此步骤,以更改或替换注入的引导文件(例如,将 `SOUL.md` 替换为另一个角色)。
bootstrap files (for example swapping `SOUL.md` for an alternate persona).
要检查每个注入文件的贡献量(原始 vs 注入、截断以及工具模式开销),请使用 `/context list` 或 `/context detail`。参见 [Context](/concepts/context)。
時間処理
当用户时区已知时,系统提示包含一个专门的**当前日期和时间**部分。为了保持提示缓存稳定,它现在只包含**时区**(没有动态时钟或时间格式)。
user timezone is known. To keep the prompt cache-stable,
it now only includes the **time zone** (no dynamic clock or time format).
当代理需要当前时间时使用 `session_status`;状态卡片包含时间戳行。
includes a timestamp line.
设置:
- `agents.defaults.userTimezone`
- `agents.defaults.timeFormat` (`auto` | `12` | `24`)
完全那动作的详情关于是、''日期和时间''请参阅。
技能
当存在符合条件的技能时,OpenClaw 会注入一个紧凑的**可用技能列表**(`formatSkillsForPrompt`),其中包含每个技能的**文件路径**。提示指示模型使用 `read` 在列出的位置(工作区、托管或捆绑)加载 SKILL.md。如果没有符合条件的技能,则省略技能部分。
(`formatSkillsForPrompt`) that includes the **file path** for each skill.
提示指示模型使用 `read` 在列出的位置加载 SKILL.md
location (workspace, managed, or bundled). If no skills are eligible,
技能部分钟是省略被。
这可以保持基础提示较小,同时仍然启用针对性的技能使用。
文档
When available, the system prompt includes a **Documentation** section that points to the local OpenClaw docs directory (either `docs/` in the repo workspace or the bundled npm package docs) and also notes the public mirror, source repo, community Discord, and ClawHub (https://clawhub.com) for skills discovery. The prompt instructs the model to consult local docs first for OpenClaw behavior, commands, configuration, or architecture, and to run `openclaw status` itself when possible (asking the user only when it lacks access).
local OpenClaw docs directory (either `docs/` in the repo workspace or the bundled npm
package docs) and also notes the public mirror, source repo, community Discord, and
ClawHub (https://clawhub.com) for skills discovery. The prompt instructs the model to consult local docs first
for OpenClaw behavior, commands, configuration, or architecture, and to run
`openclaw status` itself when possible (asking the user only when it lacks access).