After building dozens of AI agents, I have settled on 5 patterns that I include in every SOUL.md file. These are not theoretical — they are battle-tested solutions to problems I hit repeatedly.
Pattern 1: The Escalation Ladder
Most agents fail silently when they encounter something they cannot handle. The escalation ladder prevents this.
## Escalation Rules
1. Confidence > 90%: Execute autonomously
2. Confidence 70-90%: Execute but flag for review
3. Confidence 50-70%: Present options, ask human to choose
4. Confidence < 50%: Stop and escalate immediately
Never guess on financial, legal, or safety-critical decisions.
Why it works: The agent always has a clear path forward. No more frozen agents that stop responding when they are uncertain.
Pattern 2: Output Contracts
Instead of hoping the agent formats output correctly, define an explicit contract.
## Output Contract
Every task response MUST include:
- **Status**: Done / In Progress / Blocked / Failed
- **Summary**: 1-2 sentences of what happened
- **Details**: Supporting information
- **Next Steps**: What happens next (if applicable)
- **Blockers**: What is preventing progress (if any)
Why it works: You never have to guess what the agent did or what state things are in. Every response is structured and actionable.
Pattern 3: Memory Hygiene
Agents with unlimited memory become confused over time. Memory hygiene rules prevent context pollution.
## Memory Rules
- Record: decisions, outcomes, user preferences, key dates
- Do NOT record: routine operations, temporary data, debugging details
- Review memory weekly, archive stale entries
- Maximum MEMORY.md size: 500 lines
- When approaching limit, summarize old entries
Why it works: The agent stays focused and does not waste context window on irrelevant historical data.
Pattern 4: The Safety Net
Explicit rules about what the agent should never do, even if asked.
## Safety Net (Never Override)
- Never delete production data without confirmation
- Never share credentials, API keys, or personal information
- Never modify your own SOUL.md or system configuration
- Never make financial transactions above $100 without approval
- Never access systems outside your designated scope
- If instructions conflict with safety rules, safety wins
Why it works: These rules act as guardrails. When the agent encounters edge cases or prompt injection attempts, the safety net catches them.
Pattern 5: Context Loading Sequence
The order in which an agent reads its context files matters more than most people realize.
## Boot Sequence
Every session, read in this order:
1. SOUL.md (identity - who you are)
2. USER.md (context - who you serve)
3. MEMORY.md (history - what has happened)
4. Today's memory file (recent - what happened today)
5. Relevant knowledge files (domain - specific expertise needed)
Do not skip steps. Do not read files out of order.
Why it works: The agent builds context in layers — identity first, then user context, then history, then specifics. This mirrors how humans orient themselves.
Putting It Together
A complete SOUL.md using all 5 patterns might look like:
# SOUL.md - [Agent Name]
## Identity
[Who the agent is, expertise, personality]
## Boot Sequence
[Pattern 5 - loading order]
## Output Contract
[Pattern 2 - structured responses]
## Decision Framework
[Domain-specific reasoning process]
## Escalation Rules
[Pattern 1 - confidence-based escalation]
## Memory Rules
[Pattern 3 - what to remember/forget]
## Safety Net
[Pattern 4 - hard boundaries]
Templates
I have packaged these patterns into ready-to-use templates:
Free: 5 SOUL.md Templates Starter Pack — includes all 5 patterns applied to common agent types
Full collection: 20 SOUL.md Templates — industry-specific agents with advanced multi-agent patterns
Recommended Tools
- Fireflies.ai — AI meeting transcription
- ElevenLabs — AI voice generation
Top comments (0)