OpenClaw

OpenClaw SOUL.md & Agent PersonašŸ‘Øā€šŸ’»

OpenClaw agents are shaped by a set of bootstrap files that define their persona, knowledge, and behavior. SOUL.md is the primary file that defines who the agent is -- its personality, tone, boundaries, and core instructions. IDENTITY.md provides factual information about the agent itself, and USER.md stores knowledge about the user. Together with AGENTS.md and other bootstrap files, they form the system prompt architecture that makes each agent unique and consistent.

Key Takeaways

  • 1SOUL.md is the agent's core persona definition. It controls personality, tone, expertise areas, boundaries (what the agent will and will not do), and behavioral guidelines. It is the most important bootstrap file.
  • 2IDENTITY.md provides factual metadata about the agent: its name, version, creator, and capabilities. This is what the agent references when asked 'who are you?' or 'what can you do?'
  • 3USER.md stores knowledge about the specific user or audience the agent serves. Preferences, technical background, timezone, and communication style go here.
  • 4Bootstrap files live in the agent's workspace directory at `~/.openclaw/agents/<agentId>/workspace/`. They are loaded in a specific order and injected into every conversation as part of the system prompt.
  • 5The system prompt is composed from bootstrap files in a defined order: SOUL.md first (persona), then IDENTITY.md (self-knowledge), USER.md (user context), AGENTS.md (tool instructions), and MEMORY.md (persistent knowledge).
  • 6SOUL.md is not a one-time setup. It evolves as you discover what works. The best agent personas are refined iteratively -- start simple, observe conversations, and adjust tone, boundaries, and instructions based on real interactions.

Master openclaw soul.md & agent persona

Take the Personalizing Your OpenClaw Agent course with hands-on lessons and challenges.

Examples

SOUL.md — Defining a coding assistant persona

markdown

This SOUL.md creates a focused, professional coding assistant. The personality section controls tone. Boundaries define hard limits the agent will never cross. Code style preferences ensure consistent recommendations. Every conversation this agent has will be informed by these instructions.

IDENTITY.md — Agent self-knowledge

markdown

IDENTITY.md gives the agent factual answers to self-referential questions. When a user asks 'what can you do?', the agent references this file. Listing limitations explicitly prevents the agent from overpromising capabilities it does not have.

USER.md — User context and preferences

markdown

USER.md personalizes the agent's responses. Instead of generic advice, the agent knows Sarah uses TypeScript with Next.js and can tailor its suggestions accordingly. This avoids repetitive 'what stack are you using?' questions at the start of every conversation.

Workspace directory structure with all bootstrap files

bash

This is the complete workspace layout for an agent. Bootstrap files in the workspace directory are loaded in order and compose the system prompt. Sessions store conversation history. Auth holds authentication profiles for tools that need credentials. Optional files like BOOT.md and TOOLS.md add specialized startup behavior and custom tool definitions.

System prompt composition order

bash

The order matters. SOUL.md comes first because persona instructions should take precedence in the model's attention. MEMORY.md comes last because it changes most frequently. The openclaw agent prompt command lets you preview the fully assembled system prompt for debugging.

Common Mistakes

Mistake:

Writing a SOUL.md that is too long and detailed, causing the system prompt to consume most of the token budget and leaving little room for conversation

Fix:

Keep SOUL.md focused and concise. Aim for 200-500 words. Every instruction should be essential. If you find yourself writing paragraphs of edge cases, simplify. The model follows clear, short instructions better than long documents.

Mistake:

Defining boundaries that are too vague, like 'be helpful' or 'be safe', instead of specific actionable rules

Fix:

Write concrete boundaries: 'Never execute rm -rf without explicit user confirmation' is actionable. 'Be safe with commands' is vague and unreliable. Models follow specific instructions more consistently than abstract guidelines.

Mistake:

Putting user-specific context in SOUL.md instead of USER.md, making the agent hard to share or repurpose for different users

Fix:

SOUL.md defines the agent's universal persona. USER.md holds per-user context. This separation lets you share the same SOUL.md across multiple agent instances while customizing USER.md for each user.

Mistake:

Never updating SOUL.md after initial creation, even when the agent consistently misbehaves in certain scenarios

Fix:

SOUL.md is a living document. Monitor agent conversations, identify patterns of unwanted behavior, and update the persona file iteratively. The best agents are refined over weeks of observation.

Best Practices

  • Start with a minimal SOUL.md (personality, 3-5 boundaries, core instructions) and expand only when you observe specific problems. Premature detail leads to bloated prompts.
  • Test your persona by asking the agent to describe itself, respond to edge cases, and handle off-topic requests. This reveals gaps in your SOUL.md before real users find them.
  • Separate concerns across files: SOUL.md for personality, IDENTITY.md for capabilities, USER.md for context, MEMORY.md for knowledge. This makes each file focused and maintainable.
  • Use the `openclaw agent prompt` command to preview the assembled system prompt. This is essential for debugging when the agent behaves unexpectedly.
  • Version-control all bootstrap files alongside your gateway configuration. Changes to SOUL.md can dramatically alter agent behavior -- treat them with the same rigor as code changes.
  • When an agent serves multiple users, keep SOUL.md and IDENTITY.md shared (same persona for everyone) and customize USER.md per user. This scales persona management efficiently.

Summary

OpenClaw agents are defined by bootstrap files: SOUL.md (persona and boundaries), IDENTITY.md (self-knowledge), USER.md (user context), AGENTS.md (tool instructions), and MEMORY.md (persistent knowledge). These files compose the system prompt in a defined order, with SOUL.md taking precedence. Keep SOUL.md concise with specific, actionable instructions. Separate persona from user context. Iterate on your persona based on real conversations. Version-control all bootstrap files.

Practice OpenClaw with hands-on challenges

Learn openclaw soul.md & agent persona hands-on in your IDE

Interactive lessons and challenges on Stanza, practice in VS Code, Cursor, or the web.

Related Concepts

Related Cheatsheets

Master OpenClaw with Stanza

Interactive lessons and challenges, right in your code editor.

Check the free courses. No credit card.