by terryso
A shell script utility that automatically resumes Claude CLI tasks when usage limits are lifted.
# Add to your Claude Code skills
git clone https://github.com/terryso/claude-auto-resumeA shell script utility that automatically resumes Claude CLI tasks when usage limits are lifted, or executes custom shell commands after waiting periods. It detects Claude usage restrictions, waits intelligently, and resumes task execution automatically.
English | 中文
| 平台 | 类型 | 服务 | 扫码拼团 |
|:---|:---|:---|:---|
| ctok.ai | 🤝 合作伙伴 | ✅ Claude Code✅ Codex CLI |
|
This script uses --dangerously-skip-permissions flag when executing Claude commands and can execute arbitrary shell commands, which means:
Recommended Usage:
No comments yet. Be the first to share your thoughts!
This script is particularly useful when using Claude Code for development in the following scenarios:
Claude usage limit reached. but your task is not yet completely finishedclaude-auto-resume in your project's root directory, and when the usage limit is lifted, the script will automatically let Claude Code continue executing your previously unfinished taskLinux/macOS installation steps are identical to the original upstream repository and are kept unchanged below.
wget -qO- https://raw.githubusercontent.com/terryso/claude-auto-resume/refs/heads/develop/claude-auto-resume.sh | sudo tee /usr/local/bin/claude-auto-resume >/dev/null && sudo chmod +x /usr/local/bin/claude-auto-resume
# Global installation
sudo make install
# Install to custom location
sudo make install PREFIX=/opt/local
# Uninstall
sudo make uninstall
# Copy to system path
sudo cp claude-auto-resume.sh /usr/local/bin/claude-auto-resume
sudo chmod +x /usr/local/bin/claude-auto-resume
# Or create symbolic link
sudo ln -s $(pwd)/claude-auto-resume.sh /usr/local/bin/claude-auto-resume
# Make script executable
chmod +x claude-auto-resume.sh
# Run directly
./claude-auto-resume.sh
These Windows steps are specific to this fork. Linux/macOS users should use the methods above.
# From the repo root
$dest = Join-Path $env:USERPROFILE "bin"
New-Item -ItemType Directory -Force -Path $dest | Out-Null
Copy-Item .\claude-auto-resume.ps1, .\claude-auto-resume.cmd $dest
Ensure the destination folder is on your user PATH, then run:
claude-auto-resume --help
Notes:
.cmd wrapper lets you run claude-auto-resume directly from PowerShell or CMD.pwsh if available, otherwise falls back to Windows PowerShell.Windows uses the same command-line options and flags as Linux/macOS.
# Start new session with default prompt "continue"
claude-auto-resume
# Start new session with custom prompt
claude-auto-resume "implement user authentication"
# Start new session with custom prompt using flag
claude-auto-resume -p "write unit tests"
# Continue previous conversation with custom prompt
claude-auto-resume -c "please continue the previous task"
# Continue previous conversation with custom prompt using flag
claude-auto-resume -c -p "resume where we left off"
# Execute custom command after wait period
claude-auto-resume -e "npm run dev"
# Execute custom command with alias flag
claude-auto-resume --cmd "python app.py"
# Show help
claude-auto-resume --help
# Ensure script is executable
chmod +x claude-auto-resume.sh
# Start new session with default prompt
./claude-auto-resume.sh
# Start new session with custom prompt
./claude-auto-resume.sh "create login page"
# Continue previous conversation
./claude-auto-resume.sh -c "continue with the implementation"
# Execute custom command after wait period
./claude-auto-resume.sh -e "make build"
claude -p 'check' commandClaude AI usage limit reached|<timestamp> format messagesclaude --dangerously-skip-permissions -p "<custom-prompt>" (new session, default)claude -c --dangerously-skip-permissions -p "<custom-prompt>" (continue conversation with -c flag)-e/--execute or --cmd flagsclaude-auto-resume "implement feature")claude-auto-resume -p "write tests")claude-auto-resume -e "npm run dev")claude-auto-resume --cmd "python app.py")Uses claude without -c for fresh conversation:
claude-auto-resume # New session with "continue"
claude-auto-resume "new feature" # New session with custom prompt
claude-auto-resume -p "write tests" # New session with flag
Uses claude -c to continue the last conversation:
claude-auto-resume -c "keep going" # Continue with custom prompt
claude-auto-resume -c -p "resume work" # Continue with flag
Execute any shell command after the wait period:
claude-auto-resume -e "npm run dev" # Start development server
claude-auto-resume --cmd "python app.py" # Run Python application
claude-auto-resume -e "make build && ./app" # Complex command with operators
claude-auto-resume -e "ls -la | grep '.js' | wc -l" # Pipeline commands
claude-auto-resume -e "echo 'Step 1'; echo 'Step 2'" # Multiple commands
Use the built-in test mode for development and validation:
claude-auto-resume --test-mode 5 -e "echo 'Test command'" # Test with 5-second wait
claude-auto-resume --test-mode 10 --cmd "npm run test" # Test build process
grep, date, sleep, awk (usually pre-installed)This script uses --dangerously-skip-permissions to enable unattended operation. This means:
The script includes comprehensive error handling:
# Syntax check
make test
# Or use bash directly
bash -n claude-auto-resume.sh
claude-auto-resume/
├── claude-auto-resume.sh # Main script
├── claude-auto-resume.ps1 # Windows PowerShell script
├── claude-auto-resume.cmd # Windows wrapper
├── Makefile # Installation