Schedule low-cost Claude Code wake-up requests so Claude Pro/Max 5-hour usage windows line up better with your working day.
This repository is a fork of weidwonder/claude-waker. This fork adds reset-time lookup, conditional wake-up, an isolated wake worker, request budget limits, model selection, and safer cron management.
Claude Pro/Max usage windows are usually counted from the first use in a window. If that first use happens at an awkward time, the next reset can land in the middle of your workday.
Claude Waker runs from cron at the hours you configure. On each run, it:
- Reads each account from
config.yaml. - Uses
session_key, when configured, to query claude.ai forfive_hour_resets_at. - Skips the account when the current 5-hour window has not reset yet.
- Sends a low-cost Claude Code request when the window has reset, or when reset-time lookup fails.
This keeps the schedule fixed while avoiding unnecessary wake-up requests whenever the current usage window is still active.
- Handles multiple Claude accounts sequentially.
- Looks up 5-hour and 7-day reset times with a claude.ai
sessionKey. - Wakes only after the 5-hour window has reset; falls back to waking when lookup fails.
- Runs Claude requests in
wake_worker.pyso OAuth tokens are not exposed in command-line arguments. - Supports custom wake hours, prompt, model, and per-request budget.
- Installs a local
.venv, dependencies, a Claude CLI symlink, and a managed crontab block. - Supports macOS and Linux.
Use an always-on machine, such as:
- Home NAS
- VPS or cloud server
- Always-on Mac or Linux computer
- Raspberry Pi or another small server
Claude Waker relies on cron. If the machine is shut down or asleep, scheduled runs will not happen.
-
Python 3.8+
-
curl -LsSf https://astral.sh/uv/install.sh | sh -
Claude Code CLI
npm install -g @anthropic-ai/claude-code
Verify it is available:
claude --version
Each account needs a Claude Code OAuth token:
claude setup-tokenAfter browser authentication, the terminal prints a token like:
Your OAuth token: sk-ant-oat03-...
Copy it into the token field in config.yaml.
For multiple Claude accounts, switch or sign out in the browser, then run claude setup-token again.
session_key is used to query the current reset time. Claude Waker still works without it, but each scheduled run will directly attempt a wake-up request.
To get it:
- Sign in to claude.ai.
- Open your browser developer tools.
- Find the
sessionKeycookie for claude.ai. - Copy the value into the
session_keyfield inconfig.yaml.
The session_key can expire. When that happens, Claude Waker logs a warning and falls back to waking directly.
Run the setup script once to create config.yaml from the example:
./setup.shThen edit config.yaml:
accounts:
- name: "Main Account"
token: "sk-ant-oat03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
session_key: "sk-ant-sid01-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- name: "Backup Account"
token: "sk-ant-oat03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
session_key: "sk-ant-sid01-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Scheduled hours. Cron always runs at minute 05 of each hour.
wake_hours: "7,12,17"
# Prompt used for the low-cost wake request.
wake_prompt: "In one short sentence, confirm this scheduled Claude Code session is active and ready for use."
# Maximum budget for one wake request.
wake_max_budget_usd: 0.03
# Claude Code CLI model alias or full model name. Leave empty to use the CLI default.
wake_model: "haiku"Run setup again:
./setup.shThe script will:
- Create
.venv - Install
requirements.txt - Link the available
claudeorclaude-buncommand to.venv/bin/claude - Validate
config.yaml - Create or replace the managed
Claude Wakercrontab block
./.venv/bin/python3 ./waker.pyQuery all configured accounts with session_key:
./.venv/bin/python3 ./reset_time_fetcher.pyQuery one account:
./.venv/bin/python3 ./reset_time_fetcher.py --account "Main Account"Or provide a sessionKey directly:
CLAUDE_SESSION_KEY="sk-ant-sid01-..." ./.venv/bin/python3 ./reset_time_fetcher.pyApplication log:
tail -f waker.logCron stdout/stderr:
tail -f waker.cron.logcrontab -l | grep -A 2 -B 1 "Claude Waker"- Edit
wake_hoursinconfig.yaml. - Run
./setup.shagain. - Replace the existing Claude Waker cron task when prompted.
| Field | Required | Description |
|---|---|---|
accounts |
Yes | Claude account list. Each account needs at least name and token. |
accounts[].name |
Yes | Account name shown in logs. |
accounts[].token |
Yes | Claude Code OAuth token used for wake-up requests. |
accounts[].session_key |
No | claude.ai sessionKey cookie used for reset-time lookup. |
wake_hours |
Yes | Comma-separated hours from 0 to 23. Runs at minute 05. |
wake_prompt |
No | Prompt sent by the wake-up request. Uses the built-in default when omitted. |
wake_max_budget_usd |
No | Maximum budget for one wake request. Defaults to 0.03. |
wake_model |
No | Claude Code CLI model alias or full model name. |
# Morning, noon, evening
wake_hours: "7,12,17"
# Before work, after lunch, evening
wake_hours: "9,14,19"
# Once in the morning
wake_hours: "8"The actual cron run happens at minute 05 of each configured hour. For example, 7,12,17 means 7:05, 12:05, and 17:05.
setup.sh creates a daily crontab entry. To run only on weekdays, edit it manually:
crontab -eChange the Claude Waker schedule to:
5 7,12,17 * * 1-5 cd /path/to/claude-waker && PATH=.venv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ./.venv/bin/python3 ./waker.py >> ./waker.cron.log 2>&11-5 means Monday through Friday.
Remove the crontab task:
./uninstall.shThe uninstall script only removes the Claude Waker crontab block. It does not delete project files, .venv, or config.yaml.
Run tests after installing dependencies:
./.venv/bin/python3 -m pytestMain files:
waker.py: Main scheduling flow, config loading, wake decision, and summary.wake_worker.py: Isolated Claude CLI / SDK worker.reset_time_fetcher.py: claude.ai reset-time lookup helper.setup.sh: Dependency installation and crontab management.uninstall.sh: Crontab removal.
config.yamlcontains OAuth tokens and session keys. Do not commit it to a public repository.- If a token may have leaked, sign in again or regenerate it.
- Browser
sessionKeycookies can expire. Refresh them when reset-time lookup starts failing. - This tool sends real Claude requests. Make sure the usage fits your account terms and workflow.
See the original project license and this fork's repository settings.