Swapping AI Personalities with the SOUL Evil Hook
Sometimes I find myself stuck in a loop of manual testing. I want to see how my agent reacts to a different set of instructions, but I don’t want to overwrite my main files or manage multiple branches for a simple experiment. It is frustrating to manually swap content back and forth just to test a specific edge case or a temporary personality shift.
The SOUL Evil hook handles this by swapping your SOUL.md content with an alternate file in memory. It happens during a specific “purge” window or based on a random chance you define.
What You’ll Need
Section titled “What You’ll Need”- OpenClaw installed and configured.
- A
SOUL.mdfile in your agent workspace root.
Quick Start
Section titled “Quick Start”I recommend this setup if you want to test alternate behaviors without permanent changes. Here is how to get it running in four steps:
-
Enable the hook Run this command in your terminal:
Terminal window openclaw hooks enable soul-evil -
Create your alternate soul file Create a file named
SOUL_EVIL.mdin your agent workspace root. Place it right next to your originalSOUL.md. -
Configure the swap logic Add the configuration to your JSON file. This example sets a 10% random chance and a scheduled window:
{"hooks": {"internal": {"enabled": true,"entries": {"soul-evil": {"enabled": true,"file": "SOUL_EVIL.md","chance": 0.1,"purge": { "at": "21:00", "duration": "15m" }}}}}} -
Run your agent When
agent:bootstrapruns, the system checks these rules. If the purge window is active or the random chance hits, OpenClaw uses the content fromSOUL_EVIL.mdinstead of your standard soul.
The system uses agents.defaults.userTimezone for the schedule if you have it set. If not, it defaults to your host timezone. Note that the purge window always takes precedence over the random chance setting.
Troubleshooting
Section titled “Troubleshooting”- Hook has no effect on sub-agents: Sub-agent runs do not include
SOUL.mdin their bootstrap files. This hook only works for the primary agent bootstrap process. - Warning in logs: If
SOUL_EVIL.mdis missing or empty, OpenClaw logs a warning. It will keep using your normalSOUL.mdso the agent doesn’t break. - Files on disk aren’t changing: This is intended behavior. The hook only replaces content in memory before the system prompt is assembled.
- SOUL.md is ignored: If
SOUL.mdis not in the bootstrap list, the hook does nothing.
Need help with your specific configuration? Ask the AI Setup Assistant.
What’s Next
Section titled “What’s Next”OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.