Commands Reference
Complete reference for all ccremote commands and options.
Global Options
These options work with all commands:
--help, -h Show help information
--version, -v Show version number
--verbose Enable verbose output
--config <path> Use specific configuration fileccremote init
Initialize ccremote configuration with interactive setup.
ccremote init [options]Options
--force Overwrite existing configuration
--global Create global configuration (~/.ccremote.env)
--local Create local configuration (./ccremote.env)Examples
# Interactive setup (chooses location)
ccremote init
# Force overwrite existing config
ccremote init --force
# Create global config
ccremote init --global
# Create local project config
ccremote init --localWhat it does
- Guides you through Discord bot creation
- Helps you get bot token and user ID
- Creates configuration file with all settings
- Tests Discord connection
- Provides next steps
ccremote start
Start a new monitored Claude Code session.
ccremote start [options]Options
--name <name> Custom session name (default: auto-generated)
--channel <id> Discord channel ID for notifications (overrides DM)
--no-attach Don't automatically attach to session
--command <cmd> Claude Code command to run (default: "claude")Examples
# Auto-generated session name
ccremote start
# Custom session name
ccremote start --name "website-redesign"
# Don't attach automatically (run in background)
ccremote start --name "background-task" --no-attach
# Use specific Discord channel
ccremote start --name "team-project" --channel "123456789012345678"
# Custom Claude Code command
ccremote start --name "test" --command "claude --debug"What it does
- Creates unique tmux session (e.g.,
ccremote-1) - Launches Claude Code inside the session
- Initializes monitoring and state tracking
- Shows session details for 5 seconds
- Attaches you to the session (unless
--no-attach) - Starts background monitoring process
Session Names
- Auto-generated:
ccremote-1,ccremote-2, etc. - Custom: Use
--namefor meaningful names - Unique: Each session gets unique tmux session ID
- Display: Custom names shown in notifications and status
ccremote schedule
Schedule daily quota window alignment with early dummy commands.
ccremote schedule --time <time> [options]Options
--time <time> Time to start daily quota window (required)
Formats: "5:00", "5am", "17:30", "7:30pm"Examples
# Schedule daily 5 AM quota window
ccremote schedule --time "5:00"
# Schedule daily 7:30 AM quota window
ccremote schedule --time "7:30am"
# Schedule daily 5 PM quota window
ccremote schedule --time "17:00"What it does
- Creates a special quota scheduling session
- Stages a message to be sent at the specified time daily
- Shows session details for 5 seconds
- Attaches you to the Claude Code session
- After 5 seconds: The message appears typed in the session
- At scheduled time: Message is sent to Claude Code automatically
- Daily recurrence: Automatically schedules next day's execution
How It Works
The schedule command optimizes your daily Claude Code usage by:
- Early quota window start: Sends a dummy message at your specified time (e.g., 5 AM)
- Quota alignment: Aligns your 5-hour usage windows with your workday
- 3 effective windows: Instead of 2 usable windows, you get 3 throughout the day
- Set and forget: Runs automatically every day without intervention
Example Workflow
# Schedule 5 AM daily quota window
ccremote schedule --time "5:00"
# Your quota windows become:
# Window 1: 5:00 AM - 10:00 AM (early start)
# Window 2: 10:00 AM - 3:00 PM (work hours)
# Window 3: 3:00 PM - 8:00 PM (afternoon/evening)ccremote list
List all ccremote sessions with their status.
ccremote list [options]Options
--all Include ended sessions in output
--json Output in JSON format (if implemented)Examples
# List all sessions
ccremote list
# Show only active sessions
ccremote list --active
# JSON output for scripting
ccremote list --jsonSample Output
ccremote Sessions:
┌─────────────┬─────────────────┬─────────────────────┬─────────────────────┐
│ Session ID │ Name │ Status │ Started │
├─────────────┼─────────────────┼─────────────────────┼─────────────────────┤
│ ccremote-1 │ website-work │ active │ 2025-01-20 10:30:00 │
│ ccremote-2 │ client-project │ waiting_limit_reset │ 2025-01-20 09:15:00 │
│ ccremote-3 │ testing │ ended │ 2025-01-20 08:00:00 │
└─────────────┴─────────────────┴─────────────────────┴─────────────────────┘ccremote status
Show detailed status for a specific session.
ccremote status --session <session_id> [options]Options
--session <id> Session ID to check (required)
--json Output in JSON format
--watch Watch mode (update every 2 seconds)Examples
# Show session status
ccremote status --session ccremote-1
# JSON output
ccremote status --session ccremote-1 --json
# Watch mode (live updates)
ccremote status --session ccremote-1 --watchSample Output
Session Status: ccremote-1
Basic Info:
Name: website-redesign
Status: active
Started: 2025-01-20 10:30:00
Duration: 2h 15m 30s
Monitoring:
State: monitoring
Last Check: 2025-01-20 12:45:30
Checks: 4,230
Errors: 0
tmux Info:
Session: ccremote-1
Windows: 1
Attached: yes (1 client)
Discord:
Notifications: enabled
Last Sent: 2025-01-20 10:30:15
Total Sent: 1ccremote stop
Stop a monitored session.
ccremote stop --session <session_id> [options]Options
--session <id> Session ID to stop (required)
--force Force stop even if active/attached
--keep-tmux Don't terminate tmux sessionExamples
# Graceful stop
ccremote stop --session ccremote-1
# Force stop active session
ccremote stop --session ccremote-1 --force
# Stop monitoring but keep tmux session running
ccremote stop --session ccremote-1 --keep-tmuxWhat it does
- Graceful stop: Warns if session is active/attached
- Monitoring stop: Stops background monitoring process
- State update: Updates session state to "stopped"
- tmux cleanup: Terminates tmux session (unless
--keep-tmux) - Discord notification: Sends stopped notification
- Resource cleanup: Frees monitoring resources
ccremote resume
Resume monitoring for existing sessions.
ccremote resume [options]Options
--session <id> Specific session to resume (optional)
--dry-run Preview what would be resumed without taking action
--all Resume all resumable sessionsExamples
# Resume specific session
ccremote resume --session ccremote-1
# Preview what would be resumed
ccremote resume --dry-run
# Resume all resumable sessions
ccremote resume --allWhat it does
- Identifies sessions that can be resumed
- Reconnects monitoring to existing tmux sessions
- Restarts Discord bot integration
- Updates session status tracking
- Resumes automated continuation and notifications
ccremote clean
Clean up old session files, orphaned tmux sessions, and Discord channels.
ccremote clean [options]Options
--dry-run Preview what would be cleaned without taking action
--force Clean without confirmation prompts
--keep-days <n> Keep sessions newer than N days (default: 7)Examples
# Interactive cleanup
ccremote clean
# Preview cleanup actions
ccremote clean --dry-run
# Clean sessions older than 3 days
ccremote clean --keep-days 3What it does
- Identifies ended or orphaned sessions
- Removes old session state files
- Cleans up orphaned tmux sessions
- Archives orphaned Discord channels (channels without active sessions)
- Removes temporary monitoring files
- Frees up disk space and resources
ccremote setup-tmux
Configure tmux settings optimized for ccremote.
ccremote setup-tmux [options]Options
--global Apply settings globally to ~/.tmux.conf
--local Apply settings to ./.tmux.conf
--dry-run Preview changes without applying themExamples
# Interactive setup
ccremote setup-tmux
# Apply global tmux settings
ccremote setup-tmux --global
# Preview what would be configured
ccremote setup-tmux --dry-runWhat it does
- Configures tmux for optimal ccremote performance
- Sets up proper mouse mode and key bindings
- Optimizes session management settings
- Ensures compatibility with Claude Code
- Creates backup of existing configuration
Session Management Commands
Attach to Session
Manually attach to an existing session:
# Direct tmux command
tmux attach -t ccremote-1Detach from Session
While inside a session, detach without stopping:
# Keyboard shortcut (default tmux)
Ctrl-b d
# Or from outside
tmux detach -t ccremote-1List tmux Sessions
See all tmux sessions (including non-ccremote):
tmux list-sessionsDiscord Commands
Once your Discord bot is set up and sessions are running, you can interact with ccremote through Discord:
Session Channel Commands
These commands work in the dedicated Discord channel for each session:
/output or output
View current session output (last 50 lines, formatted in code blocks).
/outputWhat it does:
- Captures current tmux session output
- Shows last 50 lines for reasonable context
- Formats output in Discord code blocks for easy reading
- Automatically chunks long output into multiple messages
- Works from anywhere - perfect for checking progress remotely
Example output:
📺 **Session Output**$ npm run build ✓ Building for production... ✓ Generated 15 assets ✓ Build complete in 2.3s
#### `status`
Show session status information.status
**What it does:**
- Displays current session state
- Shows tmux session status
- Reports monitoring status
- Provides basic session metadata
#### Approval Responses
Respond to approval dialogs with numbered options.1 # Select option 1 (usually "Yes" or "Approve") 2 # Select option 2 (usually "No" or "Deny") 3 # Select option 3 (if available)
**What it does:**
- Sends the selected option number to the Claude Code session
- Continues the session with your choice
- Provides immediate feedback in Discord
### Session Channels
- **Channel Creation**: Each monitored session gets its own private Discord channel (e.g., `#ccremote-session-1`)
- **Auto-Created**: Channels are automatically created when sessions start
- **Private**: Only you (and other authorized users) can see these channels
- **Auto-Archived**: Channels are automatically archived when sessions end or via the `clean` command
---
## Exit Codes
ccremote uses standard exit codes:
- **0**: Success
- **1**: General error
- **2**: Invalid arguments/usage
- **3**: Configuration error
- **4**: Discord connection error
- **5**: Session not found
- **6**: tmux error
- **130**: Interrupted by user (Ctrl-C)
## Environment Variables
Commands respect these environment variables:
```bash
# Override config file location
CCREMOTE_CONFIG_FILE=/path/to/config.env
# Enable debug output
DEBUG=ccremote:*
# Disable colors in output
NO_COLOR=1
# Override Discord settings for single command
CCREMOTE_DISCORD_BOT_TOKEN=temp_token
CCREMOTE_DISCORD_OWNER_ID=temp_user_idScripting Examples
Batch Session Management
#!/bin/bash
# Start multiple sessions for different projects
projects=("website" "api" "mobile-app")
for project in "${projects[@]}"; do
ccremote start --name "$project" --no-attach
echo "Started session: $project"
done
# List all sessions
ccremote listSession Health Check
#!/bin/bash
# Check all sessions and report status
ccremote list --json | jq -r '.[] | "\(.name): \(.status)"'
# Stop any ended sessions
ccremote list --json | jq -r '.[] | select(.status == "ended") | .id' | while read session; do
ccremote stop --session "$session"
doneAutomated Setup
#!/bin/bash
# Automated ccremote setup for CI/CD
export CCREMOTE_DISCORD_BOT_TOKEN="$CI_DISCORD_TOKEN"
export CCREMOTE_DISCORD_OWNER_ID="$CI_DISCORD_USER_ID"
ccremote start --name "ci-build-$BUILD_ID" --no-attachCommand Chaining
ccremote commands can be chained with standard shell operators:
# Start session and show status
ccremote start --name "test" && ccremote status --session ccremote-1
# Start multiple sessions
ccremote start --name "project-a" --no-attach && \
ccremote start --name "project-b" --no-attach && \
ccremote list
# Conditional operations
ccremote test-discord && ccremote start --name "verified-session"Next Steps
Now that you know all the commands:
- Troubleshooting - Solve common issues
- Configuration - Customize ccremote behavior
- Session Monitoring - Understand how monitoring works
For more examples and advanced usage, see the GitHub repository.