# Multi Session Overlap Indicator Claude Code multi-session overlap detector showing concurrent active sessions with visual indicators, session count, and workspace collision warnings for budget management. --- ## Metadata **Title:** Multi Session Overlap Indicator **Category:** statuslines **Author:** JSONbored **Added:** October 2025 **Tags:** multi-session, parallel-sessions, overlap-detection, workspace-tracking, session-management **URL:** https://claudepro.directory/statuslines/multi-session-overlap-indicator ## Overview Claude Code multi-session overlap detector showing concurrent active sessions with visual indicators, session count, and workspace collision warnings for budget management. ## Content #!/usr/bin/env bash MULTI-SESSION OVERLAP INDICATOR FOR CLAUDE CODE DETECTS CONCURRENT CLAUDE SESSIONS RUNNING IN PARALLEL READ JSON FROM STDIN read -r input EXTRACT CURRENT SESSION INFO sessionid=$(echo "$input" | jq -r '.sessionid // "unknown"') currentworkspace=$(echo "$input" | jq -r '.workspace.currentdir // ""') SESSION TRACKING DIRECTORY (STORES ACTIVE SESSION METADATA) SESSION_DIR="${HOME}/.claude-code-sessions" mkdir -p "$SESSION_DIR" CURRENT SESSION FILE SESSIONFILE="${SESSIONDIR}/${session_id}.active" WRITE CURRENT SESSION TIMESTAMP AND WORKSPACE echo "$(date +%s)|${currentworkspace}" > "$SESSIONFILE" CLEANUP STALE SESSIONS (OLDER THAN 10 MINUTES = SECONDS) CURRENT_TIME=$(date +%s) for sessionfile in "$SESSIONDIR"/*.active; do if [ -f "$session_file" ]; then session_timestamp=$(cut -d'|' -f1 /dev/null | wc -l | tr -d ' ') if [ "$collision_count" -gt 1 ]; then workspace_collision=true fi fi COLOR CODING BASED ON SESSION COUNT if [ $active_sessions -eq 1 ]; then SESSION_COLOR="\[38;5;46m" # Green: Single session SESSION_ICON="●" SESSION_STATUS="SOLO" elif [ $active_sessions -le 3 ]; then SESSION_COLOR="\[38;5;226m" # Yellow: 2-3 sessions (moderate overlap) SESSION_ICON="●●" SESSION_STATUS="MULTI" else SESSION_COLOR="\[38;5;196m" # Red: 4+ sessions (high overlap, budget concern) SESSION_ICON="●●●" SESSION_STATUS="OVERLAP!" fi WORKSPACE COLLISION WARNING if [ "$workspace_collision" = true ]; then COLLISION_WARNING="\[38;5;208m⚠ WORKSPACE COLLISION\[0m" else COLLISION_WARNING="" fi RESET="\[0m" BUILD SESSION LIST VISUALIZATION if [ $active_sessions -gt 1 ]; then session_list="" for i in $(seq 1 $active_sessions); do sessionlist="${sessionlist}●" done visual="[${session_list}]" else visual="" fi OUTPUT STATUSLINE if [ -n "$COLLISION_WARNING" ]; then echo -e "${SESSIONCOLOR}${SESSIONICON} ${SESSIONSTATUS}${RESET}: ${activesessions} active ${visual} | ${COLLISION_WARNING}" else echo -e "${SESSIONCOLOR}${SESSIONICON} ${SESSIONSTATUS}${RESET}: ${activesessions} active ${visual}" fi KEY FEATURES ? Real-time detection of concurrent Claude Code sessions running in parallel ? Session count tracking with visual indicators (●● for multiple sessions) ? Workspace collision detection (multiple sessions in same directory) ? Automatic stale session cleanup (sessions inactive >10 minutes) ? Color-coded alerts (green solo, yellow 2-3 sessions, red 4+ sessions) ? Visual session list showing all active sessions as dots ? Budget awareness through overlap warnings (multiple 5-hour windows) ? Persistent session tracking via ~/.claude-code-sessions directory CONFIGURATION Format: bash Refresh Interval: 2000ms Position: left USE CASES ? Managing multiple overlapping 5-hour billing windows ? Preventing accidental parallel sessions that double costs ? Detecting workspace collisions when working in same directory ? Budget management for accounts with usage limits ? Team coordination when multiple developers share workspace ? Identifying forgotten background sessions still running TROUBLESHOOTING 1) Session count always showing 1 despite multiple Claude Code instances running Solution: Verify sessionid field exists in JSON: echo '$input' | jq .sessionid. Check ~/.claude-code-sessions directory is writable: ls -la ~/.claude-code-sessions. Ensure each Claude Code instance has unique session_id. If all sessions share same ID (bug), script cannot distinguish them. 2) Workspace collision warning appearing incorrectly Solution: Check workspace.currentdir field: echo '$input' | jq .workspace.currentdir. Script uses exact path matching - symlinks and relative paths may cause false positives. Verify sessions are actually in different directories with pwd. Collision is EXPECTED if multiple sessions genuinely share same workspace. 3) Stale sessions not being cleaned up automatically Solution: Cleanup runs every statusline update (default 2s refresh). Threshold is seconds (10 minutes) of inactivity. Check session files: ls -la ~/.claude-code-sessions/.active. Verify date command works: date +%s. Manually cleanup: rm ~/.claude-code-sessions/.active. 4) Permission denied when creating session tracking directory Solution: Script creates ~/.claude-code-sessions on first run. Ensure HOME environment variable is set: echo $HOME. Check write permissions: mkdir -p ~/.claude-code-sessions. If permission denied, change location in script: SESSION_DIR="/tmp/claude-sessions-$(whoami)". 5) Visual session list not displaying dots correctly Solution: Ensure terminal supports Unicode bullet character (●). Test with: echo -e '●●●'. If unsupported, replace with ASCII: SESSION_ICON='*' and visual characters. Check terminal encoding is UTF-8: echo $LANG (should show UTF-8). TECHNICAL DETAILS Documentation: https://docs.claude.com/en/docs/claude-code/statusline PREVIEW ●● MULTI: 2 active [●●] | ⚠ WORKSPACE COLLISION --- Source: Claude Pro Directory Website: https://claudepro.directory URL: https://claudepro.directory/statuslines/multi-session-overlap-indicator This content is optimized for Large Language Models (LLMs). For full formatting and interactive features, visit the website.