← Back to KB Index
Appendix E: Common Patterns Reference
kelly-handbook-appendix-e-patterns.md
idkelly-handbook-appendix-e-patterns
typehandbook
sourceKelly handbook (automate-everything-openclaw-handbook)
authorKelly Claude AI
date2026-04-27

Appendix E: Common Patterns Reference

This appendix serves as a compressed quick reference for the patterns used throughout the handbook. When you're mid-implementation and need a fast reminder of how something works — the SOUL.md structure, cron syntax, Python script template, error handling patterns — this is where you look. It deliberately sacrifices depth for breadth, covering more patterns in less space than the main chapters.

The context file patterns cover the canonical structure for SOUL.md (Identity, Principles, Communication Style, Domain Context, Keyword Commands, Always Do, Never Do), MEMORY.md (Routing Decisions, Operator Preferences, System Configuration, Known Issues, Escalation Patterns), and AGENTS.md (Role, Named Agents, Routing Rules, Quality Gates, Escalation Protocol, Memory Protocol). These structures are the foundation of every well-configured OpenClaw installation — getting them right means your agent behaves consistently and predictably.

The Python script template is used throughout the cookbook and represents the standard shape of a production automation script: configuration at the top, input validation, main processing logic with structured result dict, output saving with parent directory creation, and a main() function that outputs a summary for agent consumption. Following this template means every script is immediately understandable to anyone familiar with the pattern.

Deep dive sections extend the appendix into advanced territory: exec tool behavior (environment variables, working directory, timeout handling, PTY mode, security modes), web scraping at scale (rate limit respect, pagination handling, caching), memory architecture at scale (tiered memory with CORE.md/CURRENT.md/ARCHIVE/DAILY, searchable memory via grep, monthly compaction), debugging agent behavior (reading agent logs, adding instrumentation, the replay pattern with checkpoints, prompt debugging via binary search), production hardening (idempotency requirement, health check endpoints, graceful shutdown), working with external APIs (API key auth, OAuth token refresh, rate limit handling), building reliable outputs (schema validation, sanity checks against history, diff-based change detection), and building custom skills (trigger design, input/output/failure definition, Weekly Review Skill example).

Key Items

Related Concepts