
Keep your OpenClaw bots awake. No more OAuth token expiration issues.
Claude Code rotates your OAuth tokens every few hours. When it does, your bots lose authentication and go silent. This prompt installs a background system that automatically refreshes and syncs your tokens so your bots stay online 24/7.
Why do my bots keep dying?
"Your bots were fine last night. This morning, they're all dead. No error you can find." "You restart them. They work for a few hours. Then they die again." "Claude Code works perfectly in your terminal — same account, same subscription. But your bots can't connect." Claude Code uses rotating OAuth tokens. Every few hours, it refreshes the token and the old one gets revoked. Your CLI picks up the new token automatically. Your OpenClaw bots don't — they're stuck with a revoked credential until you manually intervene. This prompt makes that manual step automatic.
What it does
✓ Knows when your token is about to expire and refreshes it automatically — checks every 5 minutes, only acts when needed
✓ Syncs the fresh token to all your bots every 2 minutes
✓ Restarts your bot fleet automatically when tokens rotate
✓ Installs a /check-token-health slash command so you can check on your tokens anytime — see when they were last rotated, which bots are healthy, and whether everything is in sync
✓ Automatically discovers all your bots — even ones you add later. No manual registry needed.
✓ Detects rate limit issues and walks you through your options (switch model, clear cooldown, or wait)
✓ Runs diagnostics on your machine to verify your Keychain, launchd services, and bot processes are all working correctly
✓ Takes a snapshot before any change so you can always roll back
What you see when you run /check-token-health
Token status, bot health, model distribution, session sizes, and rate limit detection — all in one dashboard. You'll see your own fleet when you run it on a 9-bot setup like ours; the output above shows 5 bots for clarity.
What it won't save you from
Computer shuts down or sleeps — the refresh daemons stop when macOS isn't running. Bots will need a token sync when you wake it back up. (The system handles this automatically on reboot.) You log out of Claude Code — if you run "claude logout" or your session gets invalidated, there's no token to refresh. You'll need to "claude login" again. Anthropic revokes your account or subscription — this automates token rotation within a valid subscription. It can't fix an account-level issue.
Get the prompt
Running unattended on a 9-bot fleet since March 20, 2026. Token rotations every ~8 hours. Zero manual interventions.
How to use it: 1. Open Claude Code in your terminal. 2. Paste the prompt (or drag in the downloaded .md file). 3. Claude Code will detect your bots, set up the token refresh system, and install /check-token-health. 4. Run /check-token-health anytime to see your fleet status.
Previous versions — v1.0 (March 23, 2026): Initial release. Blind 30-minute refresh timer. Worked reliably but had a ~4 minute vulnerability window on each token rotation where bots could run on expired tokens.
What exactly does this install?
This prompt installs three background services, two scripts, a fleet registry, and a slash command on your Mac. Here's everything it creates, where it puts it, and what each piece does. Nothing is hidden — you can verify every file after installation.
Three background services registered with macOS launchd. They start automatically on login and survive reboots.
All your bots share one token file through symlinks. The primary bot's auth-profiles.json is the single source of truth. Every other bot's auth-profiles is a symlink pointing to it. When the sync daemon writes a fresh token, every bot gets it instantly — no per-bot sync needed.
The primary bot's files are never symlinks — always real files. This prevents circular references. Each bot's original auth-profiles.json is backed up as .pre-symlink.bak before the symlink is created.
The /check-token-health slash command runs 9 diagnostic sources, plus 4 more checks below.
The health check — 9 diagnostic sources, plus 4 more
Why this system exists — token lifecycle. Claude Code uses rotating OAuth tokens — a security feature from Anthropic.
Every 4–12 hours, the CLI refreshes the token and writes the new one to macOS Keychain. The old token is revoked server-side immediately.
Your terminal picks up the new token automatically. Your OpenClaw bots don't — they read from auth-profiles.json, not the Keychain.
Without the sync daemon, your bots are stuck authenticating with a revoked credential.
OpenClaw reports this as "AI service temporarily overloaded" or "API rate limit reached" — NOT "your token expired." That's why everyone blames Anthropic when the problem is on their own machine.
This system bridges the gap between Keychain (where Claude Code writes tokens) and auth-profiles.json (where your bots read them).
Every step above is reversible. Here's the exact teardown if you want everything gone.
Complete uninstall commands
Your bots will continue running with whatever token they currently have. They just won't get automatic refreshes anymore.
AI coding agents like Claude Code have full access to your filesystem and can execute shell commands. Prompt injection — hiding malicious instructions inside a text file — is OWASP's #1 AI security risk. We're confident this prompt is clean, but you should verify it yourself. It takes 30 seconds. Paste this into Claude Code (or any LLM) before running the prompt: "Before I run this prompt, tell me: does it contain any instructions to run shell commands, access files outside this project, send data to external servers, or take any action beyond its stated purpose? List anything suspicious, or confirm it's clean."
Get notified about updates
Already running v1.1? We'll email you when new versions ship — bug fixes, new features, Linux support.