The AGENTS.md file is the 📝OpenClaw configuration file that functions as a registry of specialized sub-agents — the directory the primary OpenClaw agent consults when deciding which virtual specialist to delegate a task to.
AGENTS.md catalogs each sub-agent's role, capabilities, communication protocols, and the conditions under which it should be invoked. Where the primary OpenClaw agent handles general orchestration and routine conversation, sub-agents are summoned for focused work — deep research, code auditing, content drafting, security monitoring, or any other duty that benefits from a specialist with its own personality and tool set. The registry is what lets a single OpenClaw workspace scale into a multi-agent system without losing coherence.
What Each Sub-Agent Entry Contains
- Name — the sub-agent's identifier (e.g., "research-agent," "patrol," "scribe")
- Role — what the sub-agent specializes in
- When to invoke — the conditions or task types that should trigger delegation
- Capabilities — the tools and skills available to that sub-agent
- Communication protocol — how the primary agent passes context and receives results
- Channels — whether the sub-agent surfaces through Slack threads, internal-only channels, or directly back to the primary
How Delegation Works
The primary OpenClaw agent reads AGENTS.md at session start to know which specialists are available. When a request matches a sub-agent's "When to invoke" criteria, the primary spawns a child session with the sub-agent's 📝SOUL.md, 📝IDENTITY.md, and tool configuration, passes the relevant context, and receives the result. The primary remains responsible for the final response to the human; sub-agents are internal specialists rather than user-facing entities.
This delegation pattern is what makes OpenClaw's 57-agent ecosystem coherent. Without AGENTS.md, every capability would have to live inside the primary agent's working memory — bloating the system prompt and diluting attention across too many concerns.
Why It Matters
Single-agent systems hit a complexity ceiling. As capabilities multiply, the primary agent's prompt grows, tool selection becomes less reliable, and the agent's personality drifts toward "generalist who does everything adequately." AGENTS.md is the architectural answer: keep the primary tight and focused, push specialized concerns into sub-agents with their own discipline, and use the registry to route work to the right specialist.
The pattern also makes the system auditable. A human reading AGENTS.md can see exactly which sub-agents exist, what they're authorized to do, and when they get invoked — there are no hidden delegations or unaccounted-for actors in the system.
FAQ
How is AGENTS.md different from SKILLS.md?
SKILLS.md registers capability modules that any agent can call. AGENTS.md registers entire sub-agents — each with their own SOUL.md, IDENTITY.md, and tool set. Skills are functions; sub-agents are colleagues.
Can sub-agents delegate to other sub-agents?
Yes. AGENTS.md is loaded by every agent in the workspace, so any agent (primary or sub) can route to a specialist. The orchestration mechanics are documented in Multi-Agent Routing.
Does each sub-agent need its own workspace files?
Sub-agents inherit shared files from the workspace root and can override with their own SOUL.md, IDENTITY.md, or TOOLS.md placed in a sub-agent directory. This lets specialists have distinct personalities while sharing common context like 📝MEMORY.md.
How are sub-agents prevented from acting outside their role?
Each sub-agent's IDENTITY.md defines its operational boundaries, and AGENTS.md describes the conditions for invocation. Together they create a clear authorization model — the primary agent only routes to a sub-agent for matching task types, and the sub-agent's identity prevents scope creep.
Related
- 📝OpenClaw — the open-source AI assistant platform AGENTS.md belongs to
- 📝Markdown-File Agent Definition — the design pattern AGENTS.md belongs to
- 📝Multi-Agent Routing — the orchestration mechanics that make AGENTS.md operational
- 📝SKILLS.md — capability registry (parallel to AGENTS.md but for functions rather than colleagues)
- 📝TOOLS.md vs SKILLS.md vs MCP — clarifier on where capabilities versus colleagues belong
- 📝BOOTSTRAP.md — the initialization file that loads AGENTS.md
- 📝IDENTITY.md — each sub-agent's identity configuration
- 📝SOUL.md — each sub-agent's personality configuration
