Initial commit
This commit is contained in:
118
commands/logs.md
Normal file
118
commands/logs.md
Normal file
@@ -0,0 +1,118 @@
|
||||
---
|
||||
description: View Claude Nights Watch execution logs with filtering and follow options
|
||||
usage: /nights-watch logs [OPTIONS]
|
||||
examples:
|
||||
- /nights-watch logs
|
||||
- /nights-watch logs -f
|
||||
- /nights-watch logs --follow
|
||||
---
|
||||
|
||||
# View Nights Watch Logs
|
||||
|
||||
Display execution logs from the Claude Nights Watch daemon, including all prompts sent to Claude, responses received, and status messages.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch logs [OPTIONS]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `-f`, `--follow` - Follow log file in real-time (like `tail -f`)
|
||||
- No options - Show last 50 lines of logs
|
||||
|
||||
## What's Logged
|
||||
|
||||
### Daemon Activity
|
||||
- Start/stop events
|
||||
- Configuration loaded
|
||||
- Monitoring status updates
|
||||
- Error messages and warnings
|
||||
|
||||
### Task Execution
|
||||
- **Full Prompts**: Complete prompt sent to Claude (rules + task)
|
||||
- **Full Responses**: Everything Claude outputs during execution
|
||||
- **Timestamps**: Precise timing of all events
|
||||
- **Exit Codes**: Success/failure status
|
||||
|
||||
### Example Log Entry
|
||||
```
|
||||
[2025-10-11 14:30:00] === Claude Nights Watch Daemon Started ===
|
||||
[2025-10-11 14:30:00] PID: 12345
|
||||
[2025-10-11 14:30:00] Task directory: /path/to/project
|
||||
[2025-10-11 14:30:05] Task file found at /path/to/project/task.md
|
||||
[2025-10-11 14:30:05] Rules file found at /path/to/project/rules.md
|
||||
[2025-10-11 15:25:00] Time remaining: 2 minutes
|
||||
[2025-10-11 15:27:00] Reset imminent (2 minutes), preparing to execute task...
|
||||
[2025-10-11 15:28:00] Starting task execution from task.md...
|
||||
|
||||
=== PROMPT SENT TO CLAUDE ===
|
||||
IMPORTANT RULES TO FOLLOW:
|
||||
[... rules content ...]
|
||||
---END OF RULES---
|
||||
|
||||
TASK TO EXECUTE:
|
||||
[... task content ...]
|
||||
---END OF TASK---
|
||||
=== END OF PROMPT ===
|
||||
|
||||
=== CLAUDE RESPONSE START ===
|
||||
[... Claude's complete response ...]
|
||||
=== CLAUDE RESPONSE END ===
|
||||
|
||||
[2025-10-11 15:42:00] Task execution completed successfully
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
**View recent logs:**
|
||||
```bash
|
||||
/nights-watch logs
|
||||
```
|
||||
|
||||
**Follow logs in real-time:**
|
||||
```bash
|
||||
/nights-watch logs -f
|
||||
```
|
||||
|
||||
**Use interactive log viewer:**
|
||||
```bash
|
||||
# For more advanced viewing with filtering
|
||||
${CLAUDE_PLUGIN_ROOT}/view-logs.sh
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/claude-nights-watch-manager.sh logs "$@"
|
||||
```
|
||||
|
||||
## Interactive Log Viewer
|
||||
|
||||
For advanced log viewing with filtering options, use the interactive viewer:
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/view-logs.sh
|
||||
```
|
||||
|
||||
Features:
|
||||
- Browse all log files
|
||||
- View full logs or last 50 lines
|
||||
- Filter to see only prompts
|
||||
- Filter to see only responses
|
||||
- Search for errors
|
||||
- Real-time following
|
||||
|
||||
## Log Location
|
||||
|
||||
Logs are stored in:
|
||||
```
|
||||
${CLAUDE_PLUGIN_ROOT}/logs/claude-nights-watch-daemon.log
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch status` - Check daemon status
|
||||
- `/nights-watch task` - View current task
|
||||
|
||||
71
commands/restart.md
Normal file
71
commands/restart.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
description: Restart the Claude Nights Watch daemon to apply configuration changes
|
||||
usage: /nights-watch restart [--at TIME]
|
||||
examples:
|
||||
- /nights-watch restart
|
||||
- /nights-watch restart --at "09:00"
|
||||
---
|
||||
|
||||
# Restart Nights Watch Daemon
|
||||
|
||||
Restart the Claude Nights Watch daemon by stopping the current instance and starting a new one. Useful after modifying task or rules files.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch restart [OPTIONS]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--at TIME` - Schedule daemon to start monitoring at a specific time after restart
|
||||
- Format: `HH:MM` (today) or `YYYY-MM-DD HH:MM` (specific date/time)
|
||||
|
||||
## What It Does
|
||||
|
||||
1. Stops the currently running daemon gracefully
|
||||
2. Waits 2 seconds for clean shutdown
|
||||
3. Starts a new daemon instance
|
||||
4. Loads latest task.md and rules.md files
|
||||
5. Resumes monitoring with fresh configuration
|
||||
|
||||
## When to Restart
|
||||
|
||||
Restart the daemon when you:
|
||||
- Modified `task.md` and want to apply changes
|
||||
- Updated `rules.md` safety constraints
|
||||
- Changed environment variables
|
||||
- Troubleshooting daemon issues
|
||||
- Want to reschedule start time
|
||||
|
||||
## Examples
|
||||
|
||||
**Simple restart:**
|
||||
```bash
|
||||
/nights-watch restart
|
||||
```
|
||||
|
||||
**Restart with new schedule:**
|
||||
```bash
|
||||
/nights-watch restart --at "09:00"
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/claude-nights-watch-manager.sh restart "$@"
|
||||
```
|
||||
|
||||
## Restart vs Stop/Start
|
||||
|
||||
- **Restart**: Automated stop + start in one command
|
||||
- **Stop/Start**: Manual control over timing between operations
|
||||
|
||||
Both achieve the same result, restart is just more convenient.
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch stop` - Stop daemon only
|
||||
- `/nights-watch start` - Start daemon only
|
||||
- `/nights-watch status` - Verify restart was successful
|
||||
|
||||
130
commands/setup.md
Normal file
130
commands/setup.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
description: Interactive setup wizard for Claude Nights Watch configuration
|
||||
usage: /nights-watch setup
|
||||
examples:
|
||||
- /nights-watch setup
|
||||
---
|
||||
|
||||
# Nights Watch Setup Wizard
|
||||
|
||||
Launch the interactive setup wizard to configure Claude Nights Watch for the first time or modify existing configuration.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch setup
|
||||
```
|
||||
|
||||
## Setup Process
|
||||
|
||||
The wizard guides you through:
|
||||
|
||||
### 1. Prerequisites Check
|
||||
- ✓ Verify Claude CLI is installed
|
||||
- ✓ Check for ccusage (for accurate timing)
|
||||
- ✓ Confirm required permissions
|
||||
|
||||
### 2. Task Configuration
|
||||
- Create or edit `task.md` file
|
||||
- Enter task instructions
|
||||
- Review and modify as needed
|
||||
|
||||
### 3. Safety Rules Configuration
|
||||
- Create or edit `rules.md` file
|
||||
- Choose from default safety templates
|
||||
- Customize rules for your project
|
||||
|
||||
### 4. Daemon Configuration
|
||||
- Choose to start daemon immediately or later
|
||||
- Optionally schedule a start time
|
||||
- Configure monitoring preferences
|
||||
|
||||
### 5. Summary
|
||||
- Review all configuration
|
||||
- Display available commands
|
||||
- Optionally start daemon
|
||||
|
||||
## Interactive Prompts
|
||||
|
||||
```
|
||||
================================
|
||||
Claude Nights Watch Setup
|
||||
================================
|
||||
|
||||
Checking prerequisites...
|
||||
✓ Claude CLI found
|
||||
! ccusage not found (will use time-based checking)
|
||||
To install ccusage: npm install -g ccusage
|
||||
|
||||
=== Task Configuration ===
|
||||
task.md already exists
|
||||
Do you want to view/edit it? (y/n)
|
||||
|
||||
=== Safety Rules Configuration ===
|
||||
Do you want to create safety rules? (recommended) (y/n)
|
||||
|
||||
=== Daemon Configuration ===
|
||||
Do you want to start the daemon after setup? (y/n)
|
||||
Do you want to schedule a start time? (y/n)
|
||||
Enter start time (HH:MM for today, or YYYY-MM-DD HH:MM):
|
||||
|
||||
=== Setup Complete ===
|
||||
✓ Task file: /path/to/task.md
|
||||
✓ Rules file: /path/to/rules.md
|
||||
✓ Manager: /path/to/claude-nights-watch-manager.sh
|
||||
|
||||
Available commands:
|
||||
/nights-watch start - Start the daemon
|
||||
/nights-watch stop - Stop the daemon
|
||||
/nights-watch status - Check daemon status
|
||||
/nights-watch logs - View logs
|
||||
/nights-watch task - View current task
|
||||
|
||||
Starting daemon...
|
||||
```
|
||||
|
||||
## What Gets Created
|
||||
|
||||
### Files Created
|
||||
- `task.md` - Your task instructions (if doesn't exist)
|
||||
- `rules.md` - Safety rules (optional, if requested)
|
||||
- `logs/` - Directory for daemon logs (on first start)
|
||||
|
||||
### Files NOT Modified
|
||||
- Existing `task.md` - Only edited if you choose to
|
||||
- Existing `rules.md` - Only edited if you choose to
|
||||
- Any project files
|
||||
|
||||
## First-Time Setup
|
||||
|
||||
If you're setting up for the first time:
|
||||
|
||||
1. Run `/nights-watch setup`
|
||||
2. Create a simple test task:
|
||||
```markdown
|
||||
# Test Task
|
||||
1. Create a file called test-output.txt
|
||||
2. Write "Hello from Claude Nights Watch" to it
|
||||
3. Report success
|
||||
```
|
||||
3. Add basic safety rules (wizard provides template)
|
||||
4. Start daemon and monitor with `/nights-watch status`
|
||||
5. Check logs with `/nights-watch logs -f`
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/setup-nights-watch.sh
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- `CLAUDE_NIGHTS_WATCH_DIR` - Set custom task directory (default: current directory)
|
||||
- `EDITOR` - Preferred text editor (default: nano)
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch start` - Start daemon after setup
|
||||
- `/nights-watch task` - View configured tasks
|
||||
- Example files: `${CLAUDE_PLUGIN_ROOT}/examples/`
|
||||
|
||||
77
commands/start.md
Normal file
77
commands/start.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
description: Start the Claude Nights Watch daemon to begin autonomous task execution monitoring
|
||||
usage: /nights-watch start [--at TIME]
|
||||
examples:
|
||||
- /nights-watch start
|
||||
- /nights-watch start --at "09:00"
|
||||
- /nights-watch start --at "2025-10-12 14:30"
|
||||
---
|
||||
|
||||
# Start Nights Watch Daemon
|
||||
|
||||
Starts the Claude Nights Watch daemon to monitor your Claude usage windows and execute tasks from `task.md` automatically.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch start [OPTIONS]
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
- `--at TIME` - Schedule daemon to start monitoring at a specific time
|
||||
- Format: `HH:MM` (today) or `YYYY-MM-DD HH:MM` (specific date/time)
|
||||
- Daemon will wait until scheduled time before beginning task execution
|
||||
|
||||
## What It Does
|
||||
|
||||
1. Checks for required files (`task.md` in current directory)
|
||||
2. Starts background daemon process
|
||||
3. Begins monitoring Claude usage windows
|
||||
4. Executes tasks when approaching the 5-hour limit
|
||||
5. Logs all activity to `logs/claude-nights-watch-daemon.log`
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- `task.md` file must exist in current directory (create one if not present)
|
||||
- `rules.md` file is recommended for safety constraints (optional)
|
||||
- Claude CLI must be installed and configured
|
||||
|
||||
## Examples
|
||||
|
||||
**Start immediately:**
|
||||
```bash
|
||||
/nights-watch start
|
||||
```
|
||||
|
||||
**Start at 9 AM today:**
|
||||
```bash
|
||||
/nights-watch start --at "09:00"
|
||||
```
|
||||
|
||||
**Start at specific date and time:**
|
||||
```bash
|
||||
/nights-watch start --at "2025-10-12 14:30"
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/claude-nights-watch-manager.sh start "$@"
|
||||
```
|
||||
|
||||
## Safety Notice
|
||||
|
||||
⚠️ The daemon uses `--dangerously-skip-permissions` for autonomous execution. Always:
|
||||
- Test tasks manually first
|
||||
- Use comprehensive `rules.md` for safety constraints
|
||||
- Monitor logs regularly
|
||||
- Start with simple, non-destructive tasks
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch stop` - Stop the daemon
|
||||
- `/nights-watch status` - Check daemon status
|
||||
- `/nights-watch task` - View/edit current task
|
||||
- `/nights-watch logs` - View execution logs
|
||||
|
||||
80
commands/status.md
Normal file
80
commands/status.md
Normal file
@@ -0,0 +1,80 @@
|
||||
---
|
||||
description: Check the status of Claude Nights Watch daemon and view current configuration
|
||||
usage: /nights-watch status
|
||||
examples:
|
||||
- /nights-watch status
|
||||
---
|
||||
|
||||
# Nights Watch Status
|
||||
|
||||
Displays comprehensive status information about the Claude Nights Watch daemon, including running state, configuration, and recent activity.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch status
|
||||
```
|
||||
|
||||
## Information Displayed
|
||||
|
||||
### Daemon State
|
||||
- **Running/Stopped**: Current daemon status
|
||||
- **PID**: Process ID if running
|
||||
- **Activity Status**:
|
||||
- ✅ ACTIVE - Currently monitoring and executing tasks
|
||||
- ⏰ WAITING - Waiting for scheduled start time
|
||||
|
||||
### Configuration
|
||||
- **Task File**: Location and line count of `task.md`
|
||||
- **Rules File**: Location and line count of `rules.md` (if present)
|
||||
- **Start Time**: Scheduled start time (if configured)
|
||||
- **Time Until Start**: Countdown if waiting for scheduled time
|
||||
|
||||
### Execution Info
|
||||
- **Recent Activity**: Last 5 log entries
|
||||
- **Next Execution**: Estimated time until next task execution
|
||||
- **Time Since Last Activity**: Hours/minutes since last Claude usage
|
||||
|
||||
## Status Indicators
|
||||
|
||||
- `✅ ACTIVE` - Daemon is running and monitoring
|
||||
- `⏰ WAITING` - Daemon is running but waiting for start time
|
||||
- `❌ STOPPED` - Daemon is not running
|
||||
|
||||
## Examples
|
||||
|
||||
**Check daemon status:**
|
||||
```bash
|
||||
/nights-watch status
|
||||
```
|
||||
|
||||
**Sample Output:**
|
||||
```
|
||||
[INFO] Daemon is running with PID 12345
|
||||
[INFO] Status: ✅ ACTIVE - Task execution monitoring enabled
|
||||
|
||||
[TASK] Task file: /path/to/task.md (42 lines)
|
||||
[TASK] Rules file: /path/to/rules.md (106 lines)
|
||||
|
||||
[INFO] Recent activity:
|
||||
[2025-10-11 14:30:00] Daemon started
|
||||
[2025-10-11 14:30:05] Task file loaded
|
||||
[2025-10-11 14:30:10] Monitoring began
|
||||
[2025-10-11 14:35:00] Next check in 10 minutes
|
||||
[2025-10-11 14:45:00] Time remaining: 234 minutes
|
||||
|
||||
[INFO] Estimated time until next task execution: 3h 54m
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/claude-nights-watch-manager.sh status
|
||||
```
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch start` - Start the daemon
|
||||
- `/nights-watch logs` - View detailed logs
|
||||
- `/nights-watch task` - View current task configuration
|
||||
|
||||
55
commands/stop.md
Normal file
55
commands/stop.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
description: Stop the Claude Nights Watch daemon and halt autonomous task execution
|
||||
usage: /nights-watch stop
|
||||
examples:
|
||||
- /nights-watch stop
|
||||
---
|
||||
|
||||
# Stop Nights Watch Daemon
|
||||
|
||||
Stops the running Claude Nights Watch daemon gracefully, halting all autonomous task execution monitoring.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
/nights-watch stop
|
||||
```
|
||||
|
||||
## What It Does
|
||||
|
||||
1. Locates the running daemon process
|
||||
2. Sends graceful shutdown signal (SIGTERM)
|
||||
3. Waits up to 10 seconds for clean shutdown
|
||||
4. Force kills if necessary (SIGKILL)
|
||||
5. Cleans up PID file and resources
|
||||
|
||||
## Behavior
|
||||
|
||||
- **Graceful Shutdown**: Daemon completes current operations before stopping
|
||||
- **10-Second Timeout**: If not stopped gracefully, force kill is applied
|
||||
- **Safe**: Any running Claude task is allowed to complete
|
||||
- **Clean State**: All PID files and locks are removed
|
||||
|
||||
## Examples
|
||||
|
||||
```bash
|
||||
/nights-watch stop
|
||||
```
|
||||
|
||||
## Implementation
|
||||
|
||||
```bash
|
||||
${CLAUDE_PLUGIN_ROOT}/claude-nights-watch-manager.sh stop
|
||||
```
|
||||
|
||||
## Exit Codes
|
||||
|
||||
- `0` - Daemon stopped successfully
|
||||
- `1` - Daemon was not running or error occurred
|
||||
|
||||
## See Also
|
||||
|
||||
- `/nights-watch start` - Start the daemon
|
||||
- `/nights-watch restart` - Restart the daemon
|
||||
- `/nights-watch status` - Check if daemon is running
|
||||
|
||||
Reference in New Issue
Block a user