Skip to content

[Feature] Add cc-remote wrapper script for seamless tmux session management #23

@JessyTsui

Description

@JessyTsui

Feature: Tmux Session Wrapper Script

Overview

Create a convenient shell wrapper cc-remote to simplify tmux session management for Claude Code Remote users.

Problem Statement

Currently, users need to understand tmux commands and session management, even though the tool handles tmux automatically. A simpler interface would improve user experience.

Proposed Solution

Implement a shell script cc-remote that provides a clean interface for tmux session management.

Features

1. Basic Usage

# Create and attach to default session
cc-remote

# Create and attach to named session  
cc-remote my-project

# List all Claude Code Remote sessions
cc-remote list

# Attach to existing session
cc-remote attach [session_name]

# Kill session
cc-remote kill [session_name]

2. Implementation Details

Default Behavior

  • cc-remote without arguments creates a session named claude_code
  • Automatically attaches to the session after creation
  • If session exists, attaches to existing session

Named Sessions

  • cc-remote <session_name> creates/attaches to named session
  • Useful for managing multiple projects

Under the Hood

The script will:

  1. Check if tmux is installed
  2. Create session with: tmux new-session -d -s <session_name> clauderun
  3. Auto-attach: tmux attach-session -t <session_name>
  4. Handle existing sessions gracefully

3. Example Script Structure

#!/bin/bash

SESSION_NAME=${1:-claude_code}

case "$1" in
    list)
        tmux list-sessions | grep -E "claude_code|claude-taskping"
        ;;
    attach)
        tmux attach-session -t ${2:-claude_code}
        ;;
    kill)
        tmux kill-session -t ${2:-claude_code}
        ;;
    *)
        # Create or attach to session
        if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then
            echo "Attaching to existing session: $SESSION_NAME"
            tmux attach-session -t "$SESSION_NAME"
        else
            echo "Creating new session: $SESSION_NAME"
            tmux new-session -d -s "$SESSION_NAME" clauderun
            tmux attach-session -t "$SESSION_NAME"
        fi
        ;;
esac

Benefits

  1. Simplified UX - Users don't need to know tmux commands
  2. Project Management - Easy to manage multiple Claude sessions for different projects
  3. Consistency - Standardized session naming and management
  4. Backward Compatible - Doesn't break existing automation

Implementation Priority

High - This is a quick win that significantly improves user experience without changing core functionality.

Estimated Effort

  • Development: 1-2 hours
  • Testing: 1 hour
  • Documentation update: 30 minutes

Success Criteria

  • Script creates/attaches to tmux sessions seamlessly
  • Works with both default and named sessions
  • Handles edge cases (tmux not installed, session exists, etc.)
  • README updated with new usage instructions
  • Compatible with existing auto-injection system

Why this is a great first contribution:

  • Self-contained feature (just a shell script)
  • Clear requirements and examples provided
  • No deep codebase knowledge required
  • Immediate impact on user experience
  • Perfect for bash/shell scripting enthusiasts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions