Skip to content

manustik/auto-claude

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto-Claude 🤖⏰

Auto-Claude is a Python-based automation wrapper for the Claude CLI that allows you to schedule delayed inputs to handle rate limits automatically. Perfect for long-running conversations where you need to send "Continue" or custom messages after a specific time delay.

🎯 What Does It Do?

When working with the Claude CLI, you may encounter rate limits that require you to wait before continuing your conversation. Auto-Claude solves this by:

  • Opening Claude CLI in a separate window - Keeps your main terminal free for scheduling commands
  • Scheduling delayed inputs - Set timers to automatically send messages after a specified duration
  • Interactive wizard - Simple command interface to schedule "Continue" or custom messages
  • Automatic message injection - Uses Windows VBScript to inject keystrokes into the Claude CLI window

🚀 How It Works

Auto-Claude acts as a wrapper around the Claude CLI. Here's the workflow:

  1. Launch: Run autoclaude command in your terminal
  2. Separate Window: A new CMD window opens with the Claude CLI running
  3. Schedule Messages: In your original terminal, type !timer to schedule a delayed message
  4. Wizard Interface: Follow the prompts to set:
    • ⏱️ Duration (e.g., 5s, 10m, 1h, 5h)
    • 💬 Action (Send "Continue" or a custom message)
  5. Automatic Injection: After the timer expires, the message is automatically sent to the Claude CLI window

Technical Details

  • Process Management: Spawns a detached CMD process with the Claude CLI
  • Threading: Uses Python threads to handle user input and timer execution concurrently
  • Window Activation: Leverages VBScript's AppActivate to focus the Claude window by PID or title
  • Keystroke Injection: Uses SendKeys to inject the scheduled message and press Enter
  • Color Support: Sets environment variables (FORCE_COLOR, TERM) to preserve CLI colors

📦 Installation

Prerequisites

  • Python 3.x installed and available in your PATH
  • Claude CLI installed and configured (Anthropic Claude CLI)
  • Windows OS (uses Windows-specific VBScript for keystroke injection)

Setup

  1. Clone this repository:

    git clone https://github.com/yourusername/auto-claude.git
    cd auto-claude
  2. Run the installer script:

    .\install.ps1
  3. Reload your PowerShell profile:

    . $PROFILE

The installer creates an autoclaude alias in your PowerShell profile that points to the Python script.

🎮 Usage

Basic Usage

  1. Start Auto-Claude:

    autoclaude
  2. A new window opens with Claude CLI. Accept the initial prompt manually in that window.

  3. In your original terminal, type !timer when you want to schedule a message.

  4. Follow the wizard:

    --- ⏸️  MODO DE PROGRAMACIÓN ⏸️  ---
    ⏱️  Introduce el tiempo de espera (ej: 5s, 10m, 1h, 5h):
    > 5m
    💬 Elige acción:
      1. Enviar 'Continue'
      2. Mensaje personalizado
    > 1
    ✅ Programado: Enviar "Continue" en 300.0 segundos.
    

Time Format

  • 5s - 5 seconds
  • 10m - 10 minutes
  • 1h - 1 hour
  • 5h - 5 hours

Example Scenarios

Scenario 1: Rate Limit Handling

You: [Long conversation with Claude]
Claude: [Rate limit message - wait 5 minutes]
You: !timer
     > 5m
     > 1 (Send "Continue")
[Wait 5 minutes - Auto-Claude sends "Continue" automatically]

Scenario 2: Custom Scheduled Message

You: !timer
     > 10m
     > 2 (Custom message)
     > Please summarize our discussion
[After 10 minutes, sends "Please summarize our discussion"]

🛠️ Project Structure

auto-claude/
├── auto_claude.py      # Main Python wrapper script
├── install.ps1         # PowerShell installation script
├── .gitignore          # Git ignore patterns
└── README.md           # This file

Key Components

  • auto_claude.py: Core script that handles:

    • Process spawning and management
    • Input reading and command interception
    • Timer scheduling and execution
    • VBScript generation for keystroke injection
  • install.ps1: PowerShell installer that:

    • Creates a PowerShell function Start-AutoClaude
    • Sets up the autoclaude alias
    • Adds the configuration to your PowerShell profile

🔧 Configuration

You can modify the following constants in auto_claude.py:

TARGET_CMD = ["cmd.exe", "/K", "claude"]  # Command to launch
WINDOW_TITLE = "Claude Auto"              # Default window title prefix

🐛 Troubleshooting

Message not being sent?

  • Ensure the Claude CLI window is visible (not minimized)
  • Check that the window title matches the expected format
  • Look for debug output in the original terminal showing VBScript execution results

Window not found?

The script tries multiple fallback methods:

  1. Activate by Process ID (most reliable)
  2. Activate by unique window title
  3. Activate by "claude" keyword

If all fail, you'll see an error message with details.

Colors not working?

The script sets FORCE_COLOR=1 and TERM=xterm-256color. If colors still don't work, your terminal may not support ANSI colors.

🤝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests

📄 License

This project is open source and available under the MIT License.

🙏 Acknowledgments

  • Built for the Anthropic Claude CLI
  • Inspired by the need to automate rate limit handling in long conversations

Note: This tool is designed for Windows. For macOS/Linux support, the keystroke injection mechanism would need to be adapted (e.g., using xdotool or AppleScript).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors