Overview
The Agent SOUL System lets you define agent personality, capabilities, and behavioral guidelines through markdown files. Changes sync bidirectionally between the UI database and workspacesoul.md files—edit in either location and both stay in sync.
SOUL files use a simple markdown format with frontmatter-style metadata. The system automatically parses identity information and maintains consistency across your agent fleet.
Workspace Sync Architecture
Mission Control reads agent configurations fromopenclaw.json and enriches them with workspace files:
SOUL File Format
SOUL files follow a simple markdown structure:Bidirectional Sync
Changes sync automatically in both directions:1
Workspace → Database
When
syncAgentsFromConfig() runs (startup, manual sync), it reads soul.md from each agent’s workspace and writes to the database:2
Database → Workspace
When you edit SOUL content in the UI via
PUT /api/agents/[id]/soul, it writes to both locations:3
Conflict Resolution
When syncing from
openclaw.json, the system only overwrites database content if:- The workspace file has newer content
- The existing database value is null
Identity Parsing
The system extracts structured metadata from markdown:- Parser Logic
- Example Input
- Parsed Output
API Reference
Get Agent SOUL
The API returns database content by default. To read directly from workspace, the system checks if the file exists and is readable.
Update Agent SOUL
Sync from Config
Tools Configuration
The system also syncsTOOLS.md from workspaces:
Best Practices
- Structure
- Content
- Sync Workflow
- Use clear heading hierarchy (
#,##,###) - Place metadata fields (
theme:,emoji:) near the top - Keep SOUL content under 4KB for optimal performance
- Use consistent formatting across your agent fleet
Troubleshooting
1
SOUL not syncing from workspace
Check that:
OPENCLAW_HOMEenvironment variable is set correctly- Agent’s
workspacefield inopenclaw.jsonis valid - File path resolves correctly:
$OPENCLAW_HOME/[workspace]/soul.md - File has read permissions
2
UI changes not writing to workspace
Verify:
- Agent has
workspacefield in database config - Workspace directory exists and is writable
- No file system errors in Mission Control logs
3
Identity fields not parsing
Ensure:
- Fields use exact format:
theme: value(lowercase, space after colon) - Name comes from first markdown heading (
# Name) - No extra whitespace or special characters
Related
- Agent Management - Registering and managing agents
- API Reference - Complete agent API documentation
- OpenClaw Gateway - OpenClaw gateway integration