Skip to content

beingcognitive/claude-o-clock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

🕐 claude-o-clock

A simple bash pipeline that gives you motivational pep talks from Claude twice every hour, spoken aloud on macOS.

What it does

Twice every hour (at ~:55 and ~:03 with slight randomness), this script:

  1. Asks Claude for a motivational message in Korean
  2. Displays the response in your terminal
  3. 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

Bonus: Smart Rate Limit Management

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.

Claude Code in Unix Pipelines

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!

Requirements

  • macOS (uses the built-in say command)
  • Claude Code installed and configured
  • Bash shell

Quick Start

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

Installation

  1. Clone this repository:
git clone https://github.com/beingcognitive/claude-o-clock.git
cd claude-o-clock
  1. Make the script executable:
chmod +x claude-o-clock.sh

Usage

Run the script:

./claude-o-clock.sh

Run in quiet mode (text only, no voice):

./claude-o-clock.sh -q

The 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.

Quiet Mode

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

More Claude Code Pipeline Examples

# 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?" | sh

Customization

Change the language

Edit the prompts in the script to use your preferred language.

Change the voice

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.

Adjust the timing

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.

How it works

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 say command 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 sleep with exact duration instead of cron scheduling
    • No crontab setup needed - just run the script and it handles timing!

Why "claude-o-clock"?

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?

License

MIT

Contributing

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages