All Posts

Automation - Claude Works While You Sleep | Claude Code Series

January 2, 2026    10 min read

Automation

Birthday reminders, daily digests, and cron jobs for the AI age.

You wake up Monday morning. Before you even open your laptop:

  • A digest email sits in your inbox with this week's priorities
  • Your team birthdays for the week are flagged
  • That report you promised last Friday? Already drafted and waiting for review
  • Voice notes from your weekend walk are transcribed and sorted

You didn't do any of this. Claude did. While you slept.

This is automation - the final piece that turns Claude Code from a tool into a system. Let's build it.


The Automation Stack

Automation combines everything from this series:

┌─────────────────────────────────────────────────────┐
│                    AUTOMATION                           │
├─────────────────────────────────────────────────────┤
│  Triggers        →  Commands        →  Actions          │
│  (cron, events)     (Part 2)           (email, files)   │
├─────────────────────────────────────────────────────┤
│  + Voice Input (Part 3)                                 │
│  + Skills (Part 4)                                      │
└─────────────────────────────────────────────────────┘

We'll cover:

  1. Cron jobs - Schedule Claude to run at specific times
  2. Daily digests - Automated morning briefings via email
  3. Reminders - Birthdays, anniversaries, deadlines
  4. File watchers - React to new files automatically
  5. Image generation - DALL-E for cards and presentations

Cron Jobs: Schedule Anything

Cron is the Unix scheduler. It runs commands at specified times. Combined with Claude Code, you can schedule any AI task.

Cron Basics

# Edit your crontab
crontab -e

# Format: minute hour day month weekday command
# ┌───────────── minute (0-59)
# │ ┌───────────── hour (0-23)
# │ │ ┌───────────── day of month (1-31)
# │ │ │ ┌───────────── month (1-12)
# │ │ │ │ ┌───────────── day of week (0-6, Sunday=0)
# │ │ │ │ │
# * * * * * command

Common Schedules

Schedule Cron Expression
Every day at 7am 0 7 * * *
Every Monday at 9am 0 9 * * 1
Every hour 0 * * * *
Every weekday at 6pm 0 18 * * 1-5
First day of month 0 9 1 * *

Running Claude Code via Cron

Create a wrapper script ~/bin/claude-cron.sh:

#!/bin/bash
# claude-cron.sh - Run Claude Code commands via cron

COMMAND="$1"
LOG_DIR="$HOME/.claude/logs"
LOG_FILE="$LOG_DIR/cron-$(date +%Y%m%d).log"

mkdir -p "$LOG_DIR"

echo "=== $(date) ===" >> "$LOG_FILE"
echo "Running: $COMMAND" >> "$LOG_FILE"

# Run Claude Code in non-interactive mode
claude --command "$COMMAND" >> "$LOG_FILE" 2>&1

echo "=== Done ===" >> "$LOG_FILE"

Make executable:

chmod +x ~/bin/claude-cron.sh

Add to crontab:

# Morning briefing at 7am weekdays
0 7 * * 1-5 ~/bin/claude-cron.sh "start_my_day"

# Weekly report Friday at 5pm
0 17 * * 5 ~/bin/claude-cron.sh "weekly_report"

# Check birthdays daily at 8am
0 8 * * * ~/bin/claude-cron.sh "check_birthdays"

Daily Digest Email

Get a summary email every morning without lifting a finger.

Step 1: Create the Digest Command

File: ~/.claude/commands/daily_digest.md

# Daily Digest Command

Generate my daily digest and send it to my email.

## Gather Information

### 1. Calendar
Check my calendar for today:
- Meetings scheduled
- All-day events
- Deadlines

### 2. Tasks
From my task system (Jira/Todoist/etc):
- Overdue items
- Due today
- Due this week

### 3. Recent Activity
- Emails needing response (if accessible)
- Slack mentions (if accessible)
- PR reviews waiting

### 4. Context
- Weather for my location
- Any holidays or special dates

## Format

Subject: Daily Digest - [Day, Date]

Good morning!

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TODAY'S SCHEDULE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
09:00 - Team standup (30 min)
14:00 - Product review (1 hr)
[No meetings after 3pm - deep work time]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PRIORITIES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. [Most important task]
2. [Second priority]
3. [Third priority]

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OVERDUE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- [Task from last week] - 3 days overdue

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TEAM BIRTHDAYS THIS WEEK
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- Sarah (Wednesday)
- Thomas (Friday)

Have a great day!

## Send Email

Send to: [email protected]
Use: system mail command or email API

Step 2: Email Sending Script

Create ~/bin/send-email.sh:

#!/bin/bash
# send-email.sh - Send email via command line

TO="$1"
SUBJECT="$2"
BODY="$3"

# Option 1: macOS mail command
echo "$BODY" | mail -s "$SUBJECT" "$TO"

# Option 2: Using msmtp (cross-platform)
# echo -e "Subject: $SUBJECT\n\n$BODY" | msmtp "$TO"

# Option 3: Using SendGrid API
# curl -X POST "https://api.sendgrid.com/v3/mail/send" \
#   -H "Authorization: Bearer $SENDGRID_API_KEY" \
#   -H "Content-Type: application/json" \
#   -d "{\"personalizations\":[{\"to\":[{\"email\":\"$TO\"}]}],\"from\":{\"email\":\"[email protected]\"},\"subject\":\"$SUBJECT\",\"content\":[{\"type\":\"text/plain\",\"value\":\"$BODY\"}]}"

Step 3: Schedule It

# Daily digest at 6:30am
30 6 * * * ~/bin/claude-cron.sh "daily_digest"

Birthday & Anniversary Reminders

Never forget a team birthday again.

Step 1: Create Data File

File: ~/.claude/data/team_dates.json

{
  "birthdays": [
    {"name": "Sarah", "date": "03-15", "notes": "Loves chocolate"},
    {"name": "Thomas", "date": "07-22", "notes": "Coffee enthusiast"},
    {"name": "Maria", "date": "11-08", "notes": "Plant lover"}
  ],
  "anniversaries": [
    {"name": "Sarah", "date": "2022-06-01", "type": "work"},
    {"name": "Thomas", "date": "2021-03-15", "type": "work"}
  ],
  "company_dates": [
    {"name": "Company founding", "date": "2015-09-01"},
    {"name": "Annual review period", "date": "12-01", "duration": "2 weeks"}
  ]
}

Step 2: Create Reminder Command

File: ~/.claude/commands/check_dates.md

# Check Important Dates

Read ~/.claude/data/team_dates.json and check for upcoming dates.

## Check

### This Week
- Any birthdays in next 7 days?
- Any work anniversaries in next 7 days?
- Any company dates in next 7 days?

### Today
- Is today anyone's birthday?
- Is today anyone's anniversary?

## Actions

### For Today's Birthdays
1. Draft a birthday message (warm, personal)
2. Suggest gift ideas based on notes
3. Remind to post in team Slack

### For Upcoming (3-5 days out)
1. Remind to plan celebration
2. Suggest ordering cake/gift
3. Check if PTO is scheduled

### For Anniversaries
1. Note the years of service
2. Draft congratulations message
3. Remind about recognition program

## Output Format

BIRTHDAY ALERT
━━━━━━━━━━━━━━━━━
TODAY: Sarah's birthday!
→ She loves chocolate
→ Draft message ready below

THIS WEEK:
- Thomas (Friday) - 3 days away

ANNIVERSARIES
━━━━━━━━━━━━━━━━━
- Sarah: 3 years on June 1st (next week)

SUGGESTED MESSAGE
━━━━━━━━━━━━━━━━━
Happy birthday Sarah! Wishing you a wonderful
day filled with joy (and maybe some chocolate!).
Thanks for being such a great teammate.

Step 3: Schedule

# Check dates at 8am every weekday
0 8 * * 1-5 ~/bin/claude-cron.sh "check_dates"

File Watchers: React to New Files

Automatically process files when they appear in a folder.

Use Case: Voice Notes

When a voice memo syncs from phone to laptop, automatically transcribe and process it.

Setup with fswatch (Mac/Linux)

Install:

# Mac
brew install fswatch

# Linux
apt-get install fswatch

Create watcher script ~/bin/watch-voice-notes.sh:

#!/bin/bash
# watch-voice-notes.sh - Process new voice notes automatically

WATCH_DIR="$HOME/Dropbox/VoiceNotes"
PROCESSED_DIR="$WATCH_DIR/processed"
LOG_FILE="$HOME/.claude/logs/voice-watch.log"

mkdir -p "$PROCESSED_DIR"
mkdir -p "$(dirname $LOG_FILE)"

echo "Watching $WATCH_DIR for new audio files..."

fswatch -0 "$WATCH_DIR" | while read -d "" file; do
  # Only process audio files
  if [[ "$file" =~ \.(m4a|mp3|wav|ogg)$ ]]; then
    echo "[$(date)] New file: $file" >> "$LOG_FILE"

    # Process with Claude
    claude --command "process_meeting $file" >> "$LOG_FILE" 2>&1

    # Move to processed
    mv "$file" "$PROCESSED_DIR/"

    echo "[$(date)] Processed: $file" >> "$LOG_FILE"
  fi
done

Run as background service:

# Start watcher
nohup ~/bin/watch-voice-notes.sh &

# Or add to crontab to start on boot
@reboot ~/bin/watch-voice-notes.sh

Use Case: Screenshot Processing

Automatically OCR and organize screenshots:

#!/bin/bash
# watch-screenshots.sh

WATCH_DIR="$HOME/Desktop"

fswatch -0 "$WATCH_DIR" | while read -d "" file; do
  if [[ "$file" =~ Screenshot.*\.png$ ]]; then
    claude --command "Analyze this screenshot and suggest a descriptive filename: $file"
  fi
done

Image Generation for Cards & Presentations

Use DALL-E to generate custom images automatically.

Birthday Card Generator

File: ~/.claude/commands/generate_birthday_card.md

# Generate Birthday Card

Create a custom birthday card image for: $ARGUMENTS

## Steps

### 1. Generate Image
Use DALL-E API to create a birthday card image:
- Style: Warm, professional, friendly
- Include: Birthday cake or balloons
- Colors: Cheerful but not childish
- Text space: Leave room for message overlay

Prompt template:
"A beautiful birthday card background with subtle [theme based on person's interests], watercolor style, warm colors, professional and elegant, space for text in center"

### 2. API Call

curl https://api.openai.com/v1/images/generations \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "[generated prompt]",
    "n": 1,
    "size": "1024x1024",
    "quality": "standard"
  }'

### 3. Save and Notify
- Save image to ~/Pictures/birthday-cards/
- Filename: [name]-birthday-[year].png
- Notify that card is ready

Presentation Graphics

File: ~/.claude/commands/generate_slide_image.md

# Generate Slide Image

Create a professional image for presentation slide.

Topic: $ARGUMENTS

## Style Guidelines
- Clean, minimal design
- Corporate-appropriate
- White or light background preferred
- No text in image (will be added in slides)
- 16:9 aspect ratio

## Generate
Use DALL-E with size 1792x1024 for widescreen slides.

Full Automation Example: Weekly Report

Putting it all together - a fully automated weekly report.

The Command

File: ~/.claude/commands/weekly_report.md

# Weekly Report Generator

Generate and send my weekly report automatically.

## Data Gathering

### 1. Git Activity
git log --since="1 week ago" --author="[email protected]" --oneline

### 2. Jira Tickets
- Tickets completed this week
- Tickets in progress
- Tickets blocked

### 3. Meetings
- Count of meetings attended
- Key decisions made (from meeting notes)

### 4. PRs
- PRs merged
- PRs reviewed

## Report Format

Subject: Weekly Report - [Name] - Week of [Date]

# Weekly Report
Week of [Date]

## Accomplishments
- [Achievement 1 with metric if possible]
- [Achievement 2]
- [Achievement 3]

## In Progress
- [Task 1] - [% complete or status]
- [Task 2] - [expected completion]

## Blockers
- [Blocker 1] - [what's needed to unblock]

## Next Week Focus
- [Priority 1]
- [Priority 2]
- [Priority 3]

## Metrics
- Tickets closed: X
- PRs merged: X
- PRs reviewed: X
- Meeting hours: X

## Actions
1. Generate report
2. Save to ~/Documents/weekly-reports/[date].md
3. Send via email to manager
4. Post summary to team Slack

The Cron Job

# Every Friday at 4:30pm
30 16 * * 5 ~/bin/claude-cron.sh "weekly_report"

The Result

Every Friday at 4:30pm, without any action from you:

  1. Claude gathers your week's activity
  2. Generates a professional report
  3. Saves it locally
  4. Emails it to your manager
  5. Posts a summary to Slack

You're already heading into the weekend.


Automation Best Practices

Start Small

Begin with one automation. Get it working perfectly. Then add more.

Log Everything

Always write to log files. When something fails at 3am, you need to know why.

LOG_FILE="$HOME/.claude/logs/$(date +%Y%m%d).log"
command >> "$LOG_FILE" 2>&1

Fail Gracefully

Add error handling to scripts:

if ! claude --command "daily_digest"; then
  echo "Digest failed at $(date)" | mail -s "Automation Error" [email protected]
fi

Monitor Costs

Automated Claude commands use tokens. Monitor usage:

# Add to weekly cron
0 9 * * 1 claude --command "Show my token usage for last 7 days"

Test Before Scheduling

Always run manually first:

# Test the command
~/bin/claude-cron.sh "weekly_report"

# Check the log
tail -f ~/.claude/logs/cron-*.log

Quick Reference

┌─────────────────────────────────────────────────────┐
│           AUTOMATION QUICK REFERENCE                │
├─────────────────────────────────────────────────────┤
│ Edit cron:     crontab -e                           │
│ List cron:     crontab -l                           │
│ Logs:          ~/.claude/logs/                      │
├─────────────────────────────────────────────────────┤
│ Common schedules:                                   │
│ 0 7 * * *      Daily at 7am                        │
│ 0 9 * * 1      Monday at 9am                       │
│ 0 17 * * 5     Friday at 5pm                       │
│ 0 * * * *      Every hour                          │
├─────────────────────────────────────────────────────┤
│ TIP: Start with daily_digest. It's the gateway     │
│ automation that makes you want more.               │
└─────────────────────────────────────────────────────┘

Series Conclusion

You've now built a complete AI-powered productivity system:

  1. Part 1: Understanding Claude Code and the smart worker philosophy
  2. Part 2: Custom commands for instant workflows
  3. Part 3: Voice input for effortless capture
  4. Part 4: Skills that enforce your standards automatically
  5. Part 5: Automation that works while you sleep

The people who thrive in the AI age aren't the ones who work harder. They're the ones who build systems that multiply their impact.

Every repetitive task you automate is time returned to you. Every standard you encode is a mistake prevented. Every voice note that transcribes itself is mental energy saved.

Claude Code is just a tool. But in your hands, it becomes a system. A system that handles the mundane so you can focus on what matters.

Now go build something.


Previous: Skills - Embed Your Rules


About this series: Part 5 of 5 in the Claude Code Series. Written for managers, product owners, data leads, and anyone who works smart.