Chapter 14: Designing Your Stack
Designing an automation system that actually works requires discipline: start small with the one repetitive daily task you hate most, not with a grand multi-phase pipeline. The key insight is the 10x rule—if a task takes 10 hours per month, it's worth automating even if setup takes 10 hours. The prerequisites for automation are a stable, well-defined process (run it manually 5-10 times first), clear success criteria, manageable error cost, and consistency (if the process changes frequently, automation overhead exceeds benefit). Good candidates happen regularly, take more than 5 minutes, have consistent steps, and don't require nuanced judgment. Bad candidates are one-off tasks, highly variable processes, require complex human judgment, or have high stakes if errors occur.
Four architecture patterns cover most use cases. Simple Pipeline (trigger → process → output) is for sequential data processing like daily sales reports. Hub and Spoke (router → handler A/B/C) is for routing different request types to appropriate handlers, as in WhatsApp command routing. Pipeline with Gates (phase → gate → phase → gate) is for multi-phase work where quality at each stage matters, like the Kelly Router software factory. Event-Driven (event source → detector → decision → action) is for real-time reactions to state changes, like location-triggered home automation. Real systems combine multiple patterns—Kelly Router uses Hub and Spoke for routing, Pipeline with Gates for project phases, Simple Pipeline for individual tasks, and Event-Driven for heartbeats and alerts.
Version control applies to all automation code: scripts in /scripts/, templates in /templates/, SOUL.md, AGENTS.md, MEMORY.md, and openclaw.json. Never version-control /secrets/, /logs/, /reports/, or /drafts/. Git init the workspace, set up .gitignore for sensitive directories, and commit with messages that describe what changed and why (not just "update"). The AGENTS.md should have a quick start section at the top covering running status, main entry point, key commands, and currently running cron jobs. Document decisions, not just processes—the "why" ages much better than the "what." A CHANGELOG tracking what changed and when is essential for surviving the gap between building and debugging months later.
Key Patterns
- **Start with your worst daily grind:** Pick the one repetitive task you hate most; automate it completely first
- **10x rule for prioritization:** 10 hours/month task worth automating even with 10-hour setup; 1 hour/month needs <2-hour setup
- **Run manually 5-10 times before automating:** If the process is still being figured out, you'll rewrite the automation constantly
- **Four architecture patterns:** Simple Pipeline (sequential data), Hub and Spoke (routing), Pipeline with Gates (multi-phase QA), Event-Driven (state triggers)
- **Version control your stack:** git init workspace, .gitignore secrets/logs/reports, commit with meaningful messages explaining why
Related Concepts
- [[kelly-handbook-ch11-business-automation]] for the Kelly Router software factory as a reference for Pipeline with Gates
- [[kelly-handbook-ch7-multi-agent]] for the Hub and Spoke routing pattern with named leads
- [[kelly-handbook-ch6-cron]] for Event-Driven automation like heartbeat monitoring
- [[kelly-handbook-ch15-troubleshooting]] for debugging and long-term maintenance of your designed stack