claude-auto-resume
CLAUDE.md823 starsChanged 17 months agoMITView on GitHub
This is a shell script utility called claude-auto-resume.sh that automatically resumes Claude CLI tasks after usage limits are lifted. The script monitors for Claude usage limits, waits for the restriction period to end, and then automatically continues the task. ⚠️ SECURITY NOTE: This script uses --dangerously-skip-permissions flag, which bypasses all safety prompts and allows Claude to execute commands automatically without user confirmation. Use only in trusted environments. The project follows a single-file architecture: - claude-auto-resume.sh: Main script containing all logic…
The file
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a shell script utility called claude-auto-resume.sh that automatically resumes Claude CLI tasks after usage limits are lifted. The script monitors for Claude usage limits, waits for the restriction period to end, and then automatically continues the task.
⚠️ SECURITY NOTE: This script uses --dangerously-skip-permissions flag, which bypasses all safety prompts and allows Claude to execute commands automatically without user confirmation. Use only in trusted environments.
Installation
Method 1: Using Makefile (Recommended)
# Install globally
sudo make install
# Install to custom location
sudo make install PREFIX=/opt/local
# Uninstall
sudo make uninstallMethod 2: Manual Installation
# 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 symlink
sudo ln -s $(pwd)/claude-auto-resume.sh /usr/local/bin/claude-auto-resumeMethod 3: Direct Usage
# Make executable and run directly
chmod +x claude-auto-resume.sh
./claude-auto-resume.shKey Commands
claude-auto-resume- Start new session with default prompt "continue"claude-auto-resume "custom prompt"- Start new session with custom promptclaude-auto-resume -p "prompt"- Start new session with custom prompt using flagclaude-auto-resume -c "continue task"- Continue previous conversation with custom promptclaude-auto-resume -c -p "prompt"- Continue previous conversation with custom prompt using flagclaude-auto-resume --help- Show help and usage examples./claude-auto-resume.sh- Execute the script locallychmod +x claude-auto-resume.sh- Make the script executablemake test- Test script syntax
Architecture
The project follows a single-file architecture:
- claude-auto-resume.sh: Main script containing all logic
- Makefile: Simple installation/uninstallation script
- docs/: Documentation including PRD, architecture, and user stories
Core Logic Flow
- Parses command line arguments for custom prompt and session type (new vs continue)
- Runs
claude -p 'check'command - Parses output for usage limit messages with format:
Claude AI usage limit reached|<timestamp> - Calculates wait time from timestamp
- Displays countdown timer and waits
- Automatically runs either:
claude --dangerously-skip-permissions -p '<custom-prompt>'(new session, default)claude -c --dangerously-skip-permissions -p '<custom-prompt>'(continue conversation with -c flag)
Dependencies
- Standard Unix utilities:
grep,date,sleep,awk claudeCLI tool (must be installed and in PATH)- Cross-platform compatibility (Linux/macOS date command differences handled)
Error Handling
The script includes robust error handling for:
- Invalid timestamp extraction (exit code 2)
- Claude CLI execution failures (exit code 1)
- Resume command failures (exit code 4)
- Cross-platform date formatting differences
Testing
Manual testing is used as specified in the PRD. The script is designed to be deterministic and handles various output scenarios from the Claude CLI.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

