Autonomous task execution daemon that monitors Claude usage windows and executes predefined tasks automatically. Keep Claude working 24/7 on your projects.
This plugin is not yet in any themed marketplace. To install it, you'll need to add it from GitHub directly.
This plugin uses advanced features that require additional trust:
Only install plugins from repositories you trust. Review the source code before installation.
Choose your preferred installation method below
A marketplace is a collection of plugins. Every plugin gets an auto-generated marketplace JSON for individual installation, plus inclusion in category and themed collections. Add a marketplace once (step 1), then install any plugin from it (step 2).
One-time setup for access to all plugins
When to use: If you plan to install multiple plugins now or later
Step 1: Add the marketplace (one-time)
/plugin marketplace add https://claudepluginhub.com/marketplaces/all.json
Run this once to access all plugins
Step 2: Install this plugin
/plugin install claude-nights-watch@all
Use this plugin's auto-generated marketplace JSON for individual installation
When to use: If you only want to try this specific plugin
Step 1: Add this plugin's marketplace
/plugin marketplace add https://claudepluginhub.com/marketplaces/plugins/claude-nights-watch.json
Step 2: Install the plugin
/plugin install claude-nights-watch@claude-nights-watch
๐ NEW: Now available as a Claude Code Plugin! ๐
Autonomous task execution system for Claude CLI that monitors your usage windows and executes predefined tasks automatically. Built on top of the claude-auto-renew concept but instead of simple renewals, it executes complex tasks from a task.md file.
โ ๏ธ Warning: This tool uses --dangerously-skip-permissions
for autonomous execution. Use with caution!
Choose your preferred installation method:
/nights-watch start/stop/status/logs/task/setup/restart
Claude Nights Watch extends the auto-renewal concept to create a fully autonomous task execution system. When your Claude usage window is about to expire, instead of just saying "hi", it reads your task.md
file and executes the defined tasks autonomously.
rules.md
npm install -g ccusage
# Method 1: From marketplace (when available)
claude plugins marketplace add https://github.com/aniketkarne/claude-plugins-marketplace
claude plugins add claude-nights-watch
# Method 2: Direct from GitHub
claude plugins add https://github.com/aniketkarne/ClaudeNightsWatch
# Method 3: From local directory (for development)
claude plugins add /path/to/ClaudeNightsWatch
# Interactive setup
/nights-watch setup
# Start daemon
/nights-watch start
# Check status
/nights-watch status
# View logs in real-time
/nights-watch logs -f
# Stop daemon
/nights-watch stop
Plugin Features:
/nights-watch start/stop/status/logs/task/setup/restart
Clone this repository:
git clone https://github.com/aniketkarne/ClaudeNightsWatch.git
cd ClaudeNightsWatch
Make scripts executable:
chmod +x *.sh
Run the interactive setup:
./setup-nights-watch.sh
Create your task file (task.md
):
# Daily Development Tasks
1. Run linting on all source files
2. Update dependencies to latest versions
3. Run the test suite
4. Generate coverage report
5. Create a summary of changes
Create safety rules (rules.md
):
# Safety Rules
- Never delete files without backing up
- Only work within the project directory
- Always create feature branches for changes
- Never commit sensitive information
Start the daemon:
./claude-nights-watch-manager.sh start
Legacy Commands:
./claude-nights-watch-manager.sh start [--at TIME] # Start daemon
./claude-nights-watch-manager.sh stop # Stop daemon
./claude-nights-watch-manager.sh status # Check status
./claude-nights-watch-manager.sh logs [-f] # View logs
./claude-nights-watch-manager.sh task # View task/rules
./claude-nights-watch-manager.sh restart # Restart daemon
The task file contains the instructions that Claude will execute. It should be clear, specific, and well-structured. See examples/task.example.md
for a comprehensive example.
The rules file defines safety constraints and best practices. It's prepended to every task execution to ensure safe autonomous operation. See examples/rules.example.md
for recommended rules.
CLAUDE_NIGHTS_WATCH_DIR
: Set the directory containing task.md and rules.md (default: current directory)When using as a Claude Code plugin, use slash commands:
# Start the daemon
/nights-watch start
# Start with scheduled time
/nights-watch start --at "09:00"
/nights-watch start --at "2025-01-28 14:30"
# Stop the daemon
/nights-watch stop
# Check status
/nights-watch status
# View logs
/nights-watch logs
/nights-watch logs -f # Follow mode
# View current task and rules
/nights-watch task
# Interactive setup
/nights-watch setup
# Restart daemon
/nights-watch restart
For standalone daemon usage:
# Start the daemon
./claude-nights-watch-manager.sh start
# Start with scheduled time
./claude-nights-watch-manager.sh start --at "09:00"
./claude-nights-watch-manager.sh start --at "2025-01-28 14:30"
# Stop the daemon
./claude-nights-watch-manager.sh stop
# Check status
./claude-nights-watch-manager.sh status
# View logs
./claude-nights-watch-manager.sh logs
./claude-nights-watch-manager.sh logs -f # Follow mode
# Use interactive log viewer
./view-logs.sh
# View current task and rules
./claude-nights-watch-manager.sh task
# Restart daemon
./claude-nights-watch-manager.sh restart
Built-in AI agent that helps with:
Usage:
User: "Help me create an autonomous code review workflow"
Agent: Provides expert guidance and can execute /nights-watch commands
User: "My daemon isn't working, help debug"
Agent: Analyzes logs and suggests solutions
Provides 8 programmatic tools for Claude:
get_daemon_status
- Query daemon statestart_daemon
- Start with optional schedulestop_daemon
- Stop the daemonget_logs
- Retrieve log entriesread_task
- Read task.md contentread_rules
- Read rules.md contentwrite_task
- Update task.mdwrite_rules
- Update rules.mdAutomatic integration with Claude Code sessions:
These hooks run silently in the background, enhancing your workflow.
rules.md
and task.md
, combining them into a single promptclaude --dangerously-skip-permissions
logs/claude-nights-watch-daemon.log
IMPORTANT: This tool runs Claude with the --dangerously-skip-permissions
flag, meaning it will execute tasks without asking for confirmation.
When installed as a Claude Code plugin, the following structure is used:
claude-nights-watch/
โโโ .claude-plugin/ # Plugin metadata (NEW!)
โ โโโ plugin.json # Plugin manifest
โโโ commands/ # Slash command definitions (NEW!)
โ โโโ bin/nights-watch # Command wrapper
โ โโโ start.md # Start command documentation
โ โโโ stop.md # Stop command documentation
โ โโโ status.md # Status command documentation
โ โโโ logs.md # Logs command documentation
โ โโโ task.md # Task command documentation
โ โโโ setup.md # Setup command documentation
โ โโโ restart.md # Restart command documentation
โโโ agents/ # AI agents (NEW!)
โ โโโ task-executor.md # Autonomous task planning agent
โโโ hooks/ # Event handlers (NEW!)
โ โโโ hooks.json # Hook configuration
โ โโโ scripts/ # Hook implementation scripts
โ โโโ check-daemon-status.sh # Session start hook
โ โโโ session-end-prompt.sh # Session end hook
โ โโโ log-file-changes.sh # File modification hook
โโโ mcp-server/ # Model Context Protocol (NEW!)
โ โโโ nights-watch-server.sh # MCP server implementation
โโโ .mcp.json # MCP server configuration (NEW!)
โโโ [original files continue below...]
The original standalone daemon structure:
claude-nights-watch/
โโโ claude-nights-watch-daemon.sh # Core daemon process
โโโ claude-nights-watch-manager.sh # Daemon management interface
โโโ setup-nights-watch.sh # Interactive setup script
โโโ view-logs.sh # Interactive log viewer
โโโ README.md # This file
โโโ LICENSE # MIT License
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ CHANGELOG.md # Version history
โโโ SUMMARY.md # Project summary
โโโ .gitignore # Git ignore file
โโโ .github/ # GitHub templates
โ โโโ ISSUE_TEMPLATE/
โ โ โโโ bug_report.md
โ โ โโโ feature_request.md
โ โโโ pull_request_template.md
โโโ logs/ # All logs stored here (created on first run)
โโโ examples/ # Example files
โ โโโ task.example.md # Example task file
โ โโโ rules.example.md # Example rules file
โโโ test/ # Test scripts and files
โโโ README.md # Testing documentation
โโโ test-immediate-execution.sh # Direct task execution test
โโโ test-simple.sh # Simple functionality test
โโโ test-task-simple.md # Simple test task
โโโ test-rules-simple.md # Simple test rules
โโโ test-plugin-comprehensive.sh # Plugin functionality tests (NEW!)
โโโ test-functional-realworld.sh # Real-world testing suite (NEW!)
All logs are stored in the logs/
directory within the project. Each log contains:
Use the interactive log viewer:
./view-logs.sh
Features:
Comprehensive test suites for the Claude Code plugin:
cd test
# Run comprehensive plugin structure tests
./test-plugin-comprehensive.sh
# Run functional and real-world testing
./test-functional-realworld.sh
# Run immediate execution test (no waiting)
./test-immediate-execution.sh
# Run simple functionality test
./test-simple.sh
cd test
./test-simple.sh # Run a simple test
See test/README.md
for detailed testing instructions.
New Testing Features:
Plugin not loading:
# Check plugin installation
claude plugins list | grep claude-nights-watch
# Reinstall if needed
claude plugins remove claude-nights-watch
claude plugins add https://github.com/aniketkarne/ClaudeNightsWatch
# Debug mode
claude --debug
Commands not working:
# Verify command scripts are executable
ls -la ~/.claude/plugins/claude-nights-watch/commands/bin/
# Make executable if needed
chmod +x ~/.claude/plugins/claude-nights-watch/commands/bin/nights-watch
Agent not responding:
agents/task-executor.md
Daemon won't start:
which claude
./claude-nights-watch-manager.sh logs
Tasks not executing:
ccusage blocks
Timing issues:
npm install -g ccusage
.claude-last-activity
timestampPermission errors:
# Ensure all scripts are executable
chmod +x *.sh
chmod +x commands/bin/nights-watch
chmod +x hooks/scripts/*.sh
chmod +x mcp-server/*.sh
Missing dependencies:
npm install -g ccusage
(recommended)which bash
Configuration issues:
Contributions are welcome! Please follow these steps:
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)Please ensure:
See CONTRIBUTING.md for detailed guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
If you're currently using the standalone daemon and want to migrate to the plugin:
Install the plugin:
claude plugins add https://github.com/aniketkarne/ClaudeNightsWatch
Copy your existing files:
# Copy your task.md and rules.md to the new location
cp task.md rules.md ~/.claude/plugins/claude-nights-watch/
Update your workflow:
./claude-nights-watch-manager.sh start
with /nights-watch start
./claude-nights-watch-manager.sh logs
with /nights-watch logs
/nights-watch setup
for configurationBenefits you'll gain:
If you prefer the standalone approach:
Install as daemon:
git clone https://github.com/aniketkarne/ClaudeNightsWatch.git
cd ClaudeNightsWatch
chmod +x *.sh
Copy your plugin files:
# Copy from plugin location to daemon location
cp ~/.claude/plugins/claude-nights-watch/task.md .
cp ~/.claude/plugins/claude-nights-watch/rules.md .
Use daemon commands:
./claude-nights-watch-manager.sh start
Note: The plugin method is recommended for new users due to better integration and enhanced features.
Remember: With great automation comes great responsibility. Always review your tasks and rules carefully before enabling autonomous execution! ๐จ
1.0.0