# Automations README

Three new automations ready to deploy! 🦀

## 🚀 Quick Start

**Already set up!** ✅ All cron jobs are configured and running.

Your Telegram bot token is saved in `automations/.env`. The jobs will:
- Send you Telegram notifications directly
- Run via OpenClaw's cron system (spawns lightweight sub-agents)

**To verify:**
```bash
openclaw cron list
```

**Active schedules:**
| Job | Time | What it does |
|-----|------|--------------|
| FreshRSS Daily Digest | 7:00 AM | AI-ranked RSS summary |
| Home Stack Daily Report | 8:00 AM | Service health report |
| Birthday Tracker | 9:00 AM | Birthday reminder check |
| Home Stack Monitor | Every 15 min | Health checks + alerts |

---

## 📰 FreshRSS Smart Digest

**What it does:**
- Pulls unread articles from your FreshRSS
- Ranks by relevance to your interests (AI, politics, EVs, LGBTQ, Perth/WA news)
- Categorizes as "Must Read" / "Skimmable"
- Delivers via Telegram at 7:00 AM

**Location:** `automations/freshrss-digest/`

**To customize interests:** Edit the `INTERESTS` array in `daily-digest.sh`

---

## 🎂 Birthday & Gift Tracker

**What it does:**
- Tracks family birthdays with smart reminders
- 2 weeks before: "Start thinking about gifts"
- 1 week before: "Time to plan something"
- Day of: "Don't forget to call!" + gift suggestions
- Logs past gifts to avoid repeats

**Pre-loaded with:**
- Grace (Mum) - June 2
- Harvey (Dad) - Dec 8
- Elizabeth (Sister) - Sept 11
- Alexander (Godson) - July
- Mia (Doggo) 🐕

**Location:** `automations/birthday-tracker/`

**Manual commands:**
```bash
# Add new person
./birthday-tracker.sh add "Friend Name" "Friend" "MM-DD" "Notes"

# Log a gift you gave
./birthday-tracker.sh gift "Grace Martin" "Flower subscription" 2025

# List all birthdays
./birthday-tracker.sh list
```

---

## 🔧 Home Stack Monitor

**What it does:**
- Checks Gitea, n8n, Home Assistant, FreshRSS every 15 minutes
- Alerts via Telegram + Gotify when services go down
- Attempts auto-recovery (where possible)
- Daily 8 AM health report with uptime stats
- Cooldowns prevent spam (1 hour between alerts)

**Location:** `automations/home-stack-monitor/`

**Manual commands:**
```bash
# Force a check now
./monitor.sh check

# Generate report
./monitor.sh report

# View status
./monitor.sh status

# Reset stats
./monitor.sh reset-stats
```

---

## 🔧 How It Works

**Cron Job Flow:**
```
OpenClaw Cron → Spawns sub-agent → Runs bash script → Sends you Telegram message
```

Each automation is a standalone bash script that:
1. Runs independently (no LLM cost for execution)
2. Sends Telegram notifications directly
3. Stores state in local JSON files
4. Gets triggered by OpenClaw's cron system

**Why sub-agents?**
OpenClaw's cron system spawns isolated sessions to run the scripts. This gives you:
- Clean execution environment
- Error isolation (one failing doesn't break others)
- Automatic logging via OpenClaw's system

**The notifications come straight to YOU** — just reply to me (Krilly) if you want to adjust anything!

---

## 🔮 Future Enhancements

Ideas for when you're ready:

1. **FreshRSS + AI Briefing Merge:** Combine both into one super morning digest
2. **Smart Home Integration:** Trigger HA scenes based on calendar/mood
3. **Proxmox SSH:** Enable container restart for true self-healing
4. **Gift Shopping:** Auto-search Amazon/Kogan when birthdays approach
5. **Social CRM:** Track last contact with friends, suggest catch-ups

---

## 📝 Notes

- All state files are in JSON format and stored alongside scripts
- Logs use `.gitignore` patterns to avoid committing secrets
- Each script is standalone - can run manually or via cron
- Alert cooldowns prevent notification spam

**Need help?** Just ask Krilly! 🦀

Ideas for when you're ready:

1. **FreshRSS + AI Briefing Merge:** Combine both into one super morning digest
2. **Smart Home Integration:** Trigger HA scenes based on calendar/mood
3. **Proxmox SSH:** Enable container restart for true self-healing
4. **Gift Shopping:** Auto-search Amazon/Kogan when birthdays approach
5. **Social CRM:** Track last contact with friends, suggest catch-ups

---

## 📝 Notes

- All state files are in JSON format and stored alongside scripts
- Logs use `.gitignore` patterns to avoid committing secrets
- Each script is standalone - can run manually or via cron
- Alert cooldowns prevent notification spam

**Need help?** Just ask Krilly! 🦀
