A simple bash pipeline that gives you motivational pep talks from Claude twice every hour, spoken aloud on macOS.
Twice every hour (at ~:55 and ~:03 with slight randomness), this script:
- Asks Claude for a motivational message in Korean
- Displays the response in your terminal
- Speaks it aloud using macOS's built-in text-to-speech
The messages adapt based on the time of day:
- Morning (5am-12pm): Energizing messages to start your day
- Afternoon (12pm-6pm): Motivational cheers for the afternoon
- Evening (6pm-10pm): Encouraging words as you wrap up
- Night (10pm-5am): Warm messages for rest and tomorrow
Running claude-o-clock twice per hour has an unexpected benefit with Claude's rate limits! Since Claude's rate limit resets on a 5-hour rolling window, making regular requests means:
- When you hit your first rate limit during active use, you've been "banking" hourly requests for the past 5 hours
- Your oldest hourly request (from 5 hours ago) will roll off, freeing up capacity
- This means you can often continue using Claude within the next hour instead of waiting the full 5 hours!
- Note: This only helps with the first rate limit hit - subsequent limits still require waiting
Think of it as keeping your rate limit "warm" - you're maintaining a steady baseline of usage that creates a more predictable reset pattern.
This project showcases the power of Claude Code as a command-line tool that fits perfectly into Unix pipelines:
# Simple example: Claude output → Text-to-speech
claude -p "Tell me something inspiring" | say
# This project: Claude with dynamic prompts → Captured → Spoken
response=$(claude -p "$prompt")
say "$response"Why this matters:
- Claude Code behaves like any Unix tool - it reads input, processes it with AI, and outputs text
- You can pipe Claude's output to any command:
grep,awk,say,pbcopy, etc. - You can feed dynamic input to Claude using shell variables and command substitution
- Perfect for automation, scheduled tasks, and creative shell scripts
This simple example demonstrates how Claude Code turns AI into a composable Unix building block!
- macOS (uses the built-in
saycommand) - Claude Code installed and configured
- Bash shell
Want to try it right now? Just run this one-liner:
git clone https://github.com/beingcognitive/claude-o-clock.git && \
cd claude-o-clock && \
chmod +x claude-o-clock.sh && \
./claude-o-clock.sh- Clone this repository:
git clone https://github.com/beingcognitive/claude-o-clock.git
cd claude-o-clock- Make the script executable:
chmod +x claude-o-clock.shRun the script:
./claude-o-clock.shRun in quiet mode (text only, no voice):
./claude-o-clock.sh -qThe script will:
- Give you an immediate motivational message
- Calculate the wait time until the next target (~:55 or ~:03, with slight randomness)
- Continue running indefinitely, speaking twice per hour (unless in quiet mode)
To stop the script, press Ctrl+C.
The -q or --quiet flag disables voice output, showing only text in the terminal. This is useful for:
- Running on non-macOS systems (Linux, WSL)
- Quiet environments (offices, libraries)
- Running in the background
- Testing without audio
# Explain code and save to file
cat script.py | claude -p "Explain this code" > explanation.md
# Git commit with Claude-generated message
git diff --staged | claude -p "Write a commit message for these changes" | git commit -F -
# Daily standup generator
echo "Yesterday: $(git log --since=yesterday --oneline)" | claude -p "Write my standup update"
# Code review
git diff main..feature | claude -p "Review this code for issues" | tee review.md
# Terminal command helper
claude -p "How do I find large files?" | shEdit the prompts in the script to use your preferred language.
The script uses the Korean voice "Yuna" by default. You can see available voices:
say -v '?'Then modify the say -v Yuna line to use your preferred voice.
The script runs twice per hour at ~:55 and ~:03 (with a random jitter of +/- 2 minutes). To change the base times or randomness range, modify the target minute calculations in the scheduling section of the script.
This project demonstrates a simple but powerful Unix pipeline:
- Claude Code CLI for AI-generated content (acts as a smart text generator)
- Bash scripting for scheduling and control flow
- macOS
saycommand for text-to-speech (consumes Claude's output) - Smart time calculations for twice-per-hour execution without cron
- After Claude responds, the script picks the next target (~:55 or ~:03) with slight randomness
- Uses
sleepwith exact duration instead of cron scheduling - No crontab setup needed - just run the script and it handles timing!
It's a playful combination of "Claude" and "o'clock" - because who doesn't need an AI friend checking in twice every hour with some encouragement?
MIT
Feel free to open issues or submit PRs! Some ideas:
- Add different message types (jokes, facts, quotes)
- Support for other operating systems' TTS
- Web interface for configuration
- Integration with calendar for context-aware messages
- More creative uses of Claude Code in pipelines