Skip to content

Latest commit

 

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleepz mascot

Sleepz

Stop wasting time waiting for sleep to finish.
A Claude Code plugin that automatically adjusts sleep durations to account for permission dialog wait time and internal processing overhead.

GitHub release License: MIT GitHub stars GitHub issues Bash only Claude Code plugin

Install · How It Works · Compatibility · Configuration


The Problem

When Claude Code proposes sleep 60 && npm run build, you have to approve it first. If you take 15 seconds to hit "Allow", the sleep still runs for the full 60 seconds — meaning 75 seconds pass instead of the intended 60.

Claude Code also adds its own processing overhead (~1s) between deciding to run a command and actually executing it. These hidden delays add up.

Sleepz fixes this. It accounts for both delays and ensures the total wall-clock time matches what was originally intended.

Install

/plugin marketplace add rafet/claude-code-sleepz
/plugin install sleepz@claude-code-sleepz

That's it. No configuration needed — it works out of the box.

Sleepz demo

How It Works

A PreToolUse hook intercepts Bash commands containing sleep, records a timestamp, and replaces sleep with a lightweight wrapper. After you approve the command, the wrapper calculates how much time already elapsed and sleeps only the remaining duration.

sleep 60 && npm run build
       │
       ▼
  Hook records timestamp ─────────────────┐
       │                                   │
       ▼                                   │
  Claude Code overhead (~1s)               │  These delays are
       │                                   │  subtracted from
       ▼                                   │  sleep duration
  Permission dialog (you wait 15s)         │
       │                                   │
       ▼                                   │
  Wrapper: 60 - 16 = 44s remaining  ──────┘
       │
       ▼
  sleep 44 && npm run build

The hook itself adds only ~15ms of overhead — negligible compared to the time it saves. Non-sleep commands are filtered out by a fast bash pre-check without spawning any extra processes.

What Gets Adjusted

Command Behavior
sleep 60 Adjusted
sleep 60 && cmd First sleep adjusted, rest of the command runs normally
sleep 0.5 Adjusted (fractional values supported)
sleep $VAR Skipped — variables can't be parsed statically
sleep 60s / sleep 1m Skipped — suffixed durations not supported
bash -c "sleep 60" Skipped — nested shells are left untouched
sleep 10 && sleep 20 Only the first sleep is adjusted
Hook or script error Original command runs unmodified — never breaks your workflow

Time Saved

Sleepz silently tracks how much time it saves you in ~/.claude/sleepz-stats. To see your stats:

~/.claude/sleepz --stats
# sleepz stats: 47 commands optimized, 3m 42s saved

The stats file is append-only and parallel-safe — no data is ever lost, even with multiple Claude sessions running simultaneously.

Configuration

Disable Sleepz temporarily with an environment variable:

export DISABLE_CC_SLEEPZ=1

Requirements

License

MIT

About

Claude Code plugin that adjusts sleep durations to account for permission dialog wait time

Resources

Stars

6 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages