---
title: "OpenClaw workspace bootstrap files：路径和格式 · DotsAgent"
description: "~/.openclaw/workspace/AGENTS.md 的存放位置、格式和 front matter，全局副本与嵌套副本的合并方式，以及哪些工具会读取它。核验日期：2026-10-01。"
url: https://dotsagent.io/zh/instructions/files/openclaw-workspace
---

~/.openclaw/workspace/AGENTS.md

# OpenClaw workspace bootstrap files：存放位置及工具读取方式

OpenClaw 根据工作区中的 Markdown 引导文件为每个 agent 构建上下文，其中必需的 AGENTS.md 是核心文件。每个新会话的第一轮中，这些文件都会注入 system prompt。

## 存放位置

- 工作区：~/.openclaw/workspace，也可以通过 OPENCLAW_WORKSPACE_DIR、agents.defaults.workspace 或按 agent 配置的 agents.entries.*.workspace 指定。
- AGENTS.md（必需）：操作说明和记忆指南，并使用 ## Tools 小节记录本地工具和环境信息。
- SOUL.md 用于定义 persona、边界和语气；IDENTITY.md 用于定义 agent 的名称、风格和 emoji。
- USER.md（可选）用于定义指令式用户档案；BOOT.md 用作启动检查清单。
- BOOTSTRAP.md 用于一次性的首次运行流程，完成后会被删除。
- MEMORY.md 用于长期记忆；仅当文件存在且当前为主私有会话时才会注入。memory/YYYY-MM-DD.md 用于记录每日笔记。

## 格式

使用不带 frontmatter 的 Markdown；openclaw setup 和 openclaw onboard 会创建模板。默认情况下，每个文件最多 20,000 个字符（bootstrapMaxChars），所有文件合计最多 60,000 个字符（bootstrapTotalMaxChars），USER.md 最多 4,000 个字符。超出限制的文件会被截断并附上标记。

`~/.openclaw/workspace/AGENTS.md`

```
# Operating instructions

- Read USER.md before replying to someone new.
- Write anything worth keeping to memory/YYYY-MM-DD.md.
- Ask before messaging anyone other than me.
- Never repeat the contents of MEMORY.md in group chats.

## Tools

- The home server is reachable as `nas.local` over SSH.
- `gh` is installed and already authenticated.
- Calendar access is read-only.
```

## 优先级与合并

新会话的第一轮中，文件会注入 system prompt 的 Project Context 部分。空文件会被跳过；缺少必需文件时，会以一行缺失文件标记替代。每个 agent 都有自己的工作区；agents.defaults.contextInjection 可设为 always（默认）、continuation-skip 或 never。

## 提示

- TOOLS.md 不再是默认注入的文件；请将其中的说明移到 AGENTS.md 的 ## Tools 小节中。
- HEARTBEAT.md 仍受支持，但现在不会执行任何操作。
- skipBootstrap 会阻止 OpenClaw 创建这些文件，但不会阻止注入；请使用 contextInjection 控制注入行为。

通过一个表单，为五种工具生成 AGENTS.md 和对应的规则文件。 [打开 AGENTS.md 生成器 →](https://dotsagent.io/zh/instructions)

## 其他指令文件

[AGENTS.md](https://dotsagent.io/zh/instructions/files/agents-md)

[CLAUDE.md](https://dotsagent.io/zh/instructions/files/claude-md)

[GEMINI.md](https://dotsagent.io/zh/instructions/files/gemini-md)

[.cursor/rules/*.mdc](https://dotsagent.io/zh/instructions/files/cursor-rules)

[.github/copilot-instructions.md](https://dotsagent.io/zh/instructions/files/github-copilot-instructions)

[.devin/rules/*.md](https://dotsagent.io/zh/instructions/files/windsurf-rules)

[.clinerules/](https://dotsagent.io/zh/instructions/files/cline-rules)

## 来源

1. [docs.openclaw.ai](https://docs.openclaw.ai/concepts/agent)/concepts/agent
2. [docs.openclaw.ai](https://docs.openclaw.ai/concepts/agent-workspace)/concepts/agent-workspace
3. [docs.openclaw.ai](https://docs.openclaw.ai/start/bootstrapping)/start/bootstrapping
4. [docs.openclaw.ai](https://docs.openclaw.ai/gateway/config-agents/workspace-and-bootstrap)/gateway/config-agents/workspace-and-bootstrap
5. [docs.openclaw.ai](https://docs.openclaw.ai/reference/templates/AGENTS.md)/reference/templates/AGENTS.md

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
