Your First Custom Agent
Write agents.md โ the system prompt that defines your agent's personality, role, and behavior.
Here's where OpenClaw becomes yours. The file agents.md is your agent's system prompt โ the instructions that define who it is, what it does, how it communicates, and what boundaries it operates within. Every interaction your agent has starts by reading this file. It's the most important file in your workspace.
A vague agents.md produces a vague agent. "You are a helpful assistant" gives you generic ChatGPT behavior. That's not what we're building. We're building an agent with a specific role, clear boundaries, a defined communication style, and a structured output format. The difference in quality is night and day.
Start with the role. Be specific. Not "you help with coding" but "you are a TypeScript developer specializing in Next.js applications. You write tests before implementation. You use bun, never npm." The more specific the role, the more focused and useful the agent becomes. Generic agents produce generic work.
Boundaries matter more than people realize. An agent without boundaries will try to do everything โ and do nothing well. Tell it what it should NOT do. "Do not modify files outside of the /src directory." "Do not run destructive git commands without explicit approval." "Do not install new dependencies without asking first." These constraints aren't limitations; they're what make your agent trustworthy.
Output format is the secret weapon most people miss. Define exactly how your agent should respond. Should it use markdown headers? Bullet points? Code blocks with language annotations? A specific template? When you tell an agent "always respond with a Summary section, then Changes Made, then Next Steps," every response becomes predictable, scannable, and useful. Consistency is the hallmark of a well-configured agent.
Walkthrough
- 1Create
agents.mdin your workspace root:~/.openclaw/workspace/agents.md - 2Write a Role section: define exactly what your agent specializes in (e.g., 'You are a content researcher who finds, summarizes, and organizes information')
- 3Write a Boundaries section: list 3-5 things the agent should NOT do
- 4Write a Tone section: define communication style (e.g., 'Direct, concise, no filler. Use bullet points for lists.')
- 5Write an Output Format section: define the structure of every response (e.g., Summary, Details, Next Steps)
- 6Save and restart your OpenClaw session to load the new system prompt
- 7Test by giving the same task with and without the custom prompt โ notice the difference in quality
Checkpoint
You have a custom agents.md with clearly defined role, boundaries, tone, and output format. Your agent's responses are noticeably more focused and consistent compared to the default.