Starts a persistent Claude Code session in tmux with --dangerously-skip-permissions --remote-control. Auto-exits after 30 minutes of inactivity via CLAUDE_CODE_EXIT_AFTER_STOP_DELAY (Claude's native idle timer). Multiple concurrent sessions supported — each gets a unique animal name.
Single session:
bash skills/claude-remote-control/scripts/start_session.sh <dir>
Multiple sessions in parallel (faster):
bash skills/claude-remote-control/scripts/start_sessions.sh <dir> <count>
# e.g. start_sessions.sh /path/to/project 3
Each session gets a friendly name like 🦊 Fox | my-project — used in tmux and the registry.
Important: After launching a session, always report the session URL (https://claude.ai/code/session_...) back to the user in your reply. The URL is printed in the script output — surface it so the user can open the remote control page immediately.
bash skills/claude-remote-control/scripts/stop_session.sh <session-label|tmux-name>
# e.g. stop_session.sh "🦊 Fox | my-project"
# stop_session.sh cc-fox-my-project
The SessionEnd hook fires automatically, handling registry update.
bash skills/claude-remote-control/scripts/list_sessions.sh
Registry stored at ~/.local/share/claude-rc/sessions.json.
tmux attach -t cc-fox-my-project # use tmux name shown on start
When a session dies (killed or idle timeout), the registry entry is marked dead and the local UUID is captured at that moment. UUIDs persist for 30 days before being pruned.
Look up the UUID:
cat ~/.local/share/claude-rc/sessions.json
Resume using the start script with --resume :
bash skills/claude-remote-control/scripts/start_session.sh <dir> --resume <uuid>
# e.g. start_session.sh /path/to/project --resume abc123-def456
Or manually in a new tmux session:
tmux new-session -d -s "cc-fox-my-project" -c "/full/path/to/my-project"
tmux send-keys -t "cc-fox-my-project" 'claude -r "<uuid>" --dangerously-skip-permissions --remote-control --name "🦊 Fox | my-project"' Enter
This restores full conversation history. A new remote control URL is issued on reconnect.
CLAUDE_CODE_EXIT_AFTER_STOP_DELAY=1800000 (30m) is set as an env var when launching Claude in tmux.SessionEnd hook.on_session_end.sh fires: marks the registry dead with UUID capture.No background watcher process — everything is driven by Claude Code's native hooks.
bash skills/claude-remote-control/scripts/send_task.sh <session-label|tmux-name> "<message>"
# e.g. send_task.sh "🦊 Fox | my-project" "Do an analysis of the codebase"
# send_task.sh cc-fox-my-project "Fix the issues you identified"
The script:
tmux send-keys -l (literal mode — safe for special characters) + EnterTip: When sending follow-up tasks to a session that already has context (e.g., it just finished an analysis), do NOT re-paste the full spec or issue list. The agent already has that in its conversation. Just reference it — e.g., "fix the issues you identified". Re-sending bloats context and wastes tokens.
https://claude.ai/code/session_...) to the user — this is the remote control link they need--remote-control is undocumented but valid — activates remote control on startupsession_0... URL is a cloud-side remote control ID — it cannot be used with claude -r. Only the local UUID from the registry works for resuming.~/.claude/projects/$(echo $WORKDIR | sed 's|/|-|g') (leading - is kept)~/.claude.json (under projects[].hasTrustDialogAccepted ) so headless sessions skip the "do you trust this folder?" dialog共 1 个版本