Skip to main content
statuslinesSource-backedReview first Safety Privacy

Multi Session Overlap Indicator - Statuslines

A Claude Code statusline command (bash) that detects concurrent Claude Code sessions.

by JSONbored·added 2025-10-25·
HarnessClaude Code
Language:bash
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://code.claude.com/docs/en/statusline, https://github.com/JSONbored/awesome-claude/blob/main/content/statuslines/multi-session-overlap-indicator.mdx
Safety notes
Runs as a shell command on every statusline refresh (configured refreshInterval 2000ms), executing jq, find, grep, date and arithmetic each time., Creates the directory ~/.claude-code-sessions and writes a per-session file there on every refresh., Automatically deletes session files older than 10 minutes (configurable via SESSION_STALE_THRESHOLD in one variant) using rm., The installation-example variant installs jq via brew or apt-get/yum with sudo and rewrites .claude/settings.json; review before running.
Privacy notes
Stores the current session_id and absolute workspace path in plaintext files under ~/.claude-code-sessions, readable by other local processes., The enhanced variant additionally writes the session_id into the file contents and displays the first 8 characters of each session id in the statusline output.
Author
JSONbored
Claim status
unclaimed
Last verified
2025-10-25

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

78

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Complete

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    Registry metadata indicates a reviewed listing.

    Done

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

Config edit

Copy-ready — paste the snippet to get started.

Install command

Not provided

Config snippet

Provided

Copy snippet

Provided

Prerequisites

6 to clear

Platforms

1 listed

Difficulty

6/100

Adoption plan

Balanced adoption plan

Current risk score 16/100. Use staged verification before broader rollout.

Risk 16

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    Listing has review metadata.

    Done
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Required evidence gates are covered (5/6 signals complete).

Risk 15

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Present

Review metadata is present.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required evidence gates are covered for this preset.

Decision timeline

Decision timeline · balanced

5/6 steps complete with no blocking gaps for this preset.

Risk 14

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is available.

Done

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

No required blockers for this timeline preset.

Prerequisite readiness

Prerequisite readiness

6 prerequisites to line up before setup.

0/6 ready
Install & runtime1Network & hosting2General3

Safety & privacy surface

Safety & privacy surface

4 safety and 2 privacy notes across 3 risk areas. Review closely: credentials & tokens, permissions & scopes.

3 areas
  • SafetyExecution & processesRuns as a shell command on every statusline refresh (configured refreshInterval 2000ms), executing jq, find, grep, date and arithmetic each time.
  • SafetyCredentials & tokensCreates the directory ~/.claude-code-sessions and writes a per-session file there on every refresh.
  • SafetyCredentials & tokensAutomatically deletes session files older than 10 minutes (configurable via SESSION_STALE_THRESHOLD in one variant) using rm.
  • SafetyPermissions & scopesThe installation-example variant installs jq via brew or apt-get/yum with sudo and rewrites .claude/settings.json; review before running.
  • PrivacyCredentials & tokensStores the current session_id and absolute workspace path in plaintext files under ~/.claude-code-sessions, readable by other local processes.
  • PrivacyCredentials & tokensThe enhanced variant additionally writes the session_id into the file contents and displays the first 8 characters of each session id in the statusline output.

Safety notes

  • Runs as a shell command on every statusline refresh (configured refreshInterval 2000ms), executing jq, find, grep, date and arithmetic each time.
  • Creates the directory ~/.claude-code-sessions and writes a per-session file there on every refresh.
  • Automatically deletes session files older than 10 minutes (configurable via SESSION_STALE_THRESHOLD in one variant) using rm.
  • The installation-example variant installs jq via brew or apt-get/yum with sudo and rewrites .claude/settings.json; review before running.

Privacy notes

  • Stores the current session_id and absolute workspace path in plaintext files under ~/.claude-code-sessions, readable by other local processes.
  • The enhanced variant additionally writes the session_id into the file contents and displays the first 8 characters of each session id in the statusline output.

Prerequisites

  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, arithmetic operations, and file operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • date command with epoch timestamp support (date +%s for Unix timestamps)
  • Terminal with ANSI color code support (256-color mode recommended for color-coded alerts)
  • Write access to home directory (~/.claude-code-sessions) for persistent session tracking files

Schema details

Install type
config
Reading time
2 min
Difficulty score
6
Troubleshooting
Yes
Breaking changes
No
Skill and platform metadata
Retrieval sources
https://code.claude.com/docs/en/statuslinehttps://jqlang.github.io/jq/manual/https://man7.org/linux/man-pages/man1/bash.1.htmlhttps://man7.org/linux/man-pages/man1/date.1.htmlhttps://man7.org/linux/man-pages/man1/find.1.html
Runtime and command metadata
Script language
bash
Script body
#!/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
session_id=$(echo "$input" | jq -r '.session_id // "unknown"')
current_workspace=$(echo "$input" | jq -r '.workspace.current_dir // ""')

# Session tracking directory (stores active session metadata)
SESSION_DIR="${HOME}/.claude-code-sessions"
mkdir -p "$SESSION_DIR"

# Current session file
SESSION_FILE="${SESSION_DIR}/${session_id}.active"

# Write current session timestamp and workspace
echo "$(date +%s)|${current_workspace}" > "$SESSION_FILE"

# Cleanup stale sessions (older than 10 minutes = 600 seconds)
CURRENT_TIME=$(date +%s)
for session_file in "$SESSION_DIR"/*.active; do
  if [ -f "$session_file" ]; then
    session_timestamp=$(cut -d'|' -f1 < "$session_file")
    age=$((CURRENT_TIME - session_timestamp))
    if [ $age -gt 600 ]; then
      rm -f "$session_file"
    fi
  fi
done

# Count active sessions
active_sessions=$(find "$SESSION_DIR" -name '*.active' -type f | wc -l | tr -d ' ')

# Check for workspace collisions (multiple sessions in same workspace)
workspace_collision=false
if [ -n "$current_workspace" ]; then
  collision_count=$(grep -l "|${current_workspace}$" "$SESSION_DIR"/*.active 2>/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="\033[38;5;46m"   # Green: Single session
  SESSION_ICON="●"
  SESSION_STATUS="SOLO"
elif [ $active_sessions -le 3 ]; then
  SESSION_COLOR="\033[38;5;226m"  # Yellow: 2-3 sessions (moderate overlap)
  SESSION_ICON="●●"
  SESSION_STATUS="MULTI"
else
  SESSION_COLOR="\033[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="\033[38;5;208m⚠ WORKSPACE COLLISION\033[0m"
else
  COLLISION_WARNING=""
fi

RESET="\033[0m"

# Build session list visualization
if [ $active_sessions -gt 1 ]; then
  session_list=""
  for i in $(seq 1 $active_sessions); do
    session_list="${session_list}●"
  done
  visual="[${session_list}]"
else
  visual=""
fi

# Output statusline
if [ -n "$COLLISION_WARNING" ]; then
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual} | ${COLLISION_WARNING}"
else
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual}"
fi
Full copyable content
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-session-overlap-indicator.sh",
    "refreshInterval": 2000
  }
}

About this resource

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
  • Overlap awareness when several sessions run at once
  • Persistent session tracking via files in ~/.claude-code-sessions

Use Cases

  • Noticing when several Claude Code sessions are running at once
  • Catching accidental parallel sessions you meant to close
  • Detecting workspace collisions when two sessions share a directory
  • Staying aware of overall session count while multitasking
  • Coordinating when multiple sessions operate in the same workspace
  • Identifying forgotten background sessions still active

Requirements

  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, arithmetic operations, and file operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • date command with epoch timestamp support (date +%s for Unix timestamps)
  • Terminal with ANSI color code support (256-color mode recommended for color-coded alerts)
  • Write access to home directory (~/.claude-code-sessions) for persistent session tracking files

Configuration

{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-session-overlap-indicator.sh",
    "refreshInterval": 2000
  }
}

Examples

Enhanced Multi-Session Overlap Indicator with Session Details

Extended version showing session IDs and workspace paths for debugging

#!/usr/bin/env bash

# Enhanced Multi-Session Overlap Indicator with Session Details

read -r input

session_id=$(echo "$input" | jq -r '.session_id // "unknown"')
current_workspace=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')

SESSION_DIR="${HOME}/.claude-code-sessions"
mkdir -p "$SESSION_DIR"

SESSION_FILE="${SESSION_DIR}/${session_id}.active"

echo "$(date +%s)|${current_workspace}|${session_id}" > "$SESSION_FILE"

CURRENT_TIME=$(date +%s)
for session_file in "$SESSION_DIR"/*.active; do
  if [ -f "$session_file" ]; then
    session_timestamp=$(cut -d'|' -f1 < "$session_file" 2>/dev/null || echo "0")
    if [ -n "$session_timestamp" ] && [ "$session_timestamp" != "0" ]; then
      age=$((CURRENT_TIME - session_timestamp))
      if [ $age -gt 600 ]; then
        rm -f "$session_file"
      fi
    fi
  fi
done

active_sessions=$(find "$SESSION_DIR" -name '*.active' -type f 2>/dev/null | wc -l | tr -d ' ')

workspace_collision=false
if [ -n "$current_workspace" ]; then
  collision_count=$(grep -l "|${current_workspace}|" "$SESSION_DIR"/*.active 2>/dev/null | wc -l | tr -d ' ')
  if [ "$collision_count" -gt 1 ]; then
    workspace_collision=true
  fi
fi

if [ $active_sessions -eq 1 ]; then
  SESSION_COLOR="\033[38;5;46m"
  SESSION_ICON="●"
  SESSION_STATUS="SOLO"
elif [ $active_sessions -le 3 ]; then
  SESSION_COLOR="\033[38;5;226m"
  SESSION_ICON="●●"
  SESSION_STATUS="MULTI"
else
  SESSION_COLOR="\033[38;5;196m"
  SESSION_ICON="●●●"
  SESSION_STATUS="OVERLAP!"
fi

if [ "$workspace_collision" = true ]; then
  COLLISION_WARNING="\033[38;5;208m⚠ WORKSPACE COLLISION\033[0m"
else
  COLLISION_WARNING=""
fi

RESET="\033[0m"

if [ $active_sessions -gt 1 ]; then
  session_list=""
  for i in $(seq 1 $active_sessions); do
    session_list="${session_list}●"
  done
  visual="[${session_list}]"

  # Show session IDs (first 8 chars)
  session_ids=""
  for session_file in "$SESSION_DIR"/*.active; do
    if [ -f "$session_file" ]; then
      sid=$(basename "$session_file" .active)
      session_ids="${session_ids}${sid:0:8} "
    fi
  done
  session_ids=$(echo "$session_ids" | sed 's/ $//')
  visual="${visual} (${session_ids})"
else
  visual=""
fi

if [ -n "$COLLISION_WARNING" ]; then
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual} | ${COLLISION_WARNING}"
else
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual}"
fi

Multi-Session Overlap Indicator with Custom Stale Threshold

Version with configurable stale session timeout via environment variable

#!/usr/bin/env bash

# Multi-Session Overlap Indicator with Custom Stale Threshold

read -r input

session_id=$(echo "$input" | jq -r '.session_id // "unknown"')
current_workspace=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')

# Custom stale threshold (default 10 minutes = 600 seconds)
STALE_THRESHOLD=${SESSION_STALE_THRESHOLD:-600}

SESSION_DIR="${HOME}/.claude-code-sessions"
mkdir -p "$SESSION_DIR"

SESSION_FILE="${SESSION_DIR}/${session_id}.active"

echo "$(date +%s)|${current_workspace}" > "$SESSION_FILE"

CURRENT_TIME=$(date +%s)
for session_file in "$SESSION_DIR"/*.active; do
  if [ -f "$session_file" ]; then
    session_timestamp=$(cut -d'|' -f1 < "$session_file" 2>/dev/null || echo "0")
    if [ -n "$session_timestamp" ] && [ "$session_timestamp" != "0" ]; then
      age=$((CURRENT_TIME - session_timestamp))
      if [ $age -gt $STALE_THRESHOLD ]; then
        rm -f "$session_file"
      fi
    fi
  fi
done

active_sessions=$(find "$SESSION_DIR" -name '*.active' -type f 2>/dev/null | wc -l | tr -d ' ')

workspace_collision=false
if [ -n "$current_workspace" ]; then
  collision_count=$(grep -l "|${current_workspace}$" "$SESSION_DIR"/*.active 2>/dev/null | wc -l | tr -d ' ')
  if [ "$collision_count" -gt 1 ]; then
    workspace_collision=true
  fi
fi

if [ $active_sessions -eq 1 ]; then
  SESSION_COLOR="\033[38;5;46m"
  SESSION_ICON="●"
  SESSION_STATUS="SOLO"
elif [ $active_sessions -le 3 ]; then
  SESSION_COLOR="\033[38;5;226m"
  SESSION_ICON="●●"
  SESSION_STATUS="MULTI"
else
  SESSION_COLOR="\033[38;5;196m"
  SESSION_ICON="●●●"
  SESSION_STATUS="OVERLAP!"
fi

if [ "$workspace_collision" = true ]; then
  COLLISION_WARNING="\033[38;5;208m⚠ WORKSPACE COLLISION\033[0m"
else
  COLLISION_WARNING=""
fi

RESET="\033[0m"

if [ $active_sessions -gt 1 ]; then
  session_list=""
  for i in $(seq 1 $active_sessions); do
    session_list="${session_list}●"
  done
  visual="[${session_list}]"
else
  visual=""
fi

if [ -n "$COLLISION_WARNING" ]; then
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual} | ${COLLISION_WARNING}"
else
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual}"
fi

Multi-Session Overlap Indicator Installation Example

Complete setup script with session directory creation and Unicode character testing

#!/bin/bash
# Installation script for Multi-Session Overlap Indicator

# Check for jq (required for JSON parsing)
if ! command -v jq &> /dev/null; then
    echo "Installing jq for JSON parsing..."
    if [[ "$OSTYPE" == "darwin"* ]]; then
        brew install jq
    elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
        sudo apt-get install -y jq || sudo yum install -y jq
    else
        echo "Please install jq manually: https://jqlang.github.io/jq/"
    fi
fi

# Test date command (required for timestamps)
if date +%s &> /dev/null; then
    echo "Date command working: $(date +%s)"
else
    echo "Warning: date command may not support +%s format"
fi

# Test Unicode bullet character
if echo -e '●' &> /dev/null; then
    echo "Unicode bullet character supported: ●"
else
    echo "Warning: Unicode bullet character may not display correctly"
    echo "Terminal may need UTF-8 encoding"
fi

# Test warning emoji
if echo -e '⚠' &> /dev/null; then
    echo "Warning emoji supported: ⚠"
else
    echo "Warning: Warning emoji may not display correctly"
fi

# Create session tracking directory
mkdir -p ~/.claude-code-sessions

echo "Session tracking directory created: ~/.claude-code-sessions"

# Test write permissions
if touch ~/.claude-code-sessions/test && rm ~/.claude-code-sessions/test; then
    echo "Write permissions verified"
else
    echo "Warning: Cannot write to ~/.claude-code-sessions"
    echo "Check permissions: ls -la ~/.claude-code-sessions"
fi

# Create statuslines directory
mkdir -p .claude/statuslines

cat > .claude/statuslines/multi-session-overlap-indicator.sh << 'SCRIPT_EOF'
#!/usr/bin/env bash

# Multi-Session Overlap Indicator for Claude Code
# Detects concurrent Claude sessions running in parallel

read -r input

session_id=$(echo "$input" | jq -r '.session_id // "unknown"')
current_workspace=$(echo "$input" | jq -r '.workspace.current_dir // .cwd // ""')

SESSION_DIR="${HOME}/.claude-code-sessions"
mkdir -p "$SESSION_DIR"

SESSION_FILE="${SESSION_DIR}/${session_id}.active"

echo "$(date +%s)|${current_workspace}" > "$SESSION_FILE"

CURRENT_TIME=$(date +%s)
for session_file in "$SESSION_DIR"/*.active; do
  if [ -f "$session_file" ]; then
    session_timestamp=$(cut -d'|' -f1 < "$session_file" 2>/dev/null || echo "0")
    if [ -n "$session_timestamp" ] && [ "$session_timestamp" != "0" ]; then
      age=$((CURRENT_TIME - session_timestamp))
      if [ $age -gt 600 ]; then
        rm -f "$session_file"
      fi
    fi
  fi
done

active_sessions=$(find "$SESSION_DIR" -name '*.active' -type f 2>/dev/null | wc -l | tr -d ' ')

workspace_collision=false
if [ -n "$current_workspace" ]; then
  collision_count=$(grep -l "|${current_workspace}$" "$SESSION_DIR"/*.active 2>/dev/null | wc -l | tr -d ' ')
  if [ "$collision_count" -gt 1 ]; then
    workspace_collision=true
  fi
fi

if [ $active_sessions -eq 1 ]; then
  SESSION_COLOR="\033[38;5;46m"
  SESSION_ICON="●"
  SESSION_STATUS="SOLO"
elif [ $active_sessions -le 3 ]; then
  SESSION_COLOR="\033[38;5;226m"
  SESSION_ICON="●●"
  SESSION_STATUS="MULTI"
else
  SESSION_COLOR="\033[38;5;196m"
  SESSION_ICON="●●●"
  SESSION_STATUS="OVERLAP!"
fi

if [ "$workspace_collision" = true ]; then
  COLLISION_WARNING="\033[38;5;208m⚠ WORKSPACE COLLISION\033[0m"
else
  COLLISION_WARNING=""
fi

RESET="\033[0m"

if [ $active_sessions -gt 1 ]; then
  session_list=""
  for i in $(seq 1 $active_sessions); do
    session_list="${session_list}●"
  done
  visual="[${session_list}]"
else
  visual=""
fi

if [ -n "$COLLISION_WARNING" ]; then
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual} | ${COLLISION_WARNING}"
else
  echo -e "${SESSION_COLOR}${SESSION_ICON} ${SESSION_STATUS}${RESET}: ${active_sessions} active ${visual}"
fi
SCRIPT_EOF

chmod +x .claude/statuslines/multi-session-overlap-indicator.sh

# Add to settings.json
if [ ! -f .claude/settings.json ]; then
    echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-session-overlap-indicator.sh","refreshInterval":2000}}' > .claude/settings.json
else
    jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-session-overlap-indicator.sh","refreshInterval":2000}' .claude/settings.json > .claude/settings.json.tmp
    mv .claude/settings.json.tmp .claude/settings.json
fi

echo "Multi-Session Overlap Indicator installed successfully!"
echo "Note: Session files stored in ~/.claude-code-sessions/"
echo "View active sessions: ls -la ~/.claude-code-sessions/*.active"

Troubleshooting

Session count always showing 1 despite multiple Claude Code instances running

Verify session_id field exists in JSON: echo '$input' | jq .session_id. 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. Verify session files are created: ls -la ~/.claude-code-sessions/*.active (should show multiple files). Check file permissions: chmod 755 ~/.claude-code-sessions.

Workspace collision warning appearing incorrectly

Check workspace.current_dir field: echo '$input' | jq .workspace.current_dir. 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. Check path format: Script matches exact paths, so /home/user/project and /home/user/project/ are different. Normalize paths if needed.

Stale sessions not being cleaned up automatically

Cleanup runs every statusline update (default 2s refresh). Threshold is 600 seconds (10 minutes) of inactivity. Check session files: ls -la ~/.claude-code-sessions/.active. Verify date command works: date +%s (should return Unix timestamp). Check file format: cat ~/.claude-code-sessions/.active (should show timestamp|workspace). Manually cleanup: rm ~/.claude-code-sessions/*.active. Verify timestamp parsing: cut -d'|' -f1 < file.active (should return number).

Permission denied when creating session tracking directory

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)". Verify directory creation: mkdir -p ~/.claude-code-sessions && touch ~/.claude-code-sessions/test && rm ~/.claude-code-sessions/test. Check disk space: df -h ~.

Visual session list not displaying dots correctly

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). Set encoding: export LANG=en_US.UTF-8. Verify Unicode support: locale charmap (should be UTF-8). Alternative: Use ASCII characters like [***] instead of [●●●].

Session count showing incorrect number or negative values

Verify find command works: find ~/.claude-code-sessions -name '*.active' -type f (should list active session files). Check wc command: find ... | wc -l (should return number). Verify tr command: echo ' 5 ' | tr -d ' ' (should return 5). Check for stale files: Script cleans up files older than 10 minutes, but may miss files if date command fails. Verify arithmetic: active_sessions=$((find_count)) (should be positive integer).

Warning emoji (⚠) not displaying correctly

Verify terminal supports Unicode warning emoji: echo -e '⚠'. If not supported, replace with ASCII: COLLISION_WARNING="[!] WORKSPACE COLLISION". Check terminal encoding: locale charmap (should be UTF-8). Set encoding: export LANG=en_US.UTF-8. Test emoji: echo -e '⚠ ⚠ ⚠' (should display warning symbols). Alternative: Use text warning: "WARNING: WORKSPACE COLLISION".

Session files accumulating and not being deleted

Check cleanup logic: Script removes files older than 600 seconds (10 minutes). Verify date command: date +%s (should return current timestamp). Check timestamp extraction: cut -d'|' -f1 < file.active (should return timestamp). Verify age calculation: age=$((CURRENTTIME - session_timestamp)) (should be positive). Check file permissions: ls -la ~/.claude-code-sessions/.active (should be writable). Manually test cleanup: Delete old files manually: find ~/.claude-code-sessions -name '_.active' -mmin +10 -delete.

Source citations

Add this badge to your README

Show that Multi Session Overlap Indicator - Statuslines is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/statuslines/multi-session-overlap-indicator.svg)](https://heyclau.de/entry/statuslines/multi-session-overlap-indicator)

How it compares

Multi Session Overlap Indicator - Statuslines side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

Field

A Claude Code statusline command (bash) that detects concurrent Claude Code sessions.

Open dossier

A Claude Code statusline that reads the session JSON on stdin and splits total_duration_ms into API processing time versus network/waiting time (total minus API).

Open dossier

Claude Code workspace depth tracker showing monorepo navigation level, project root detection, and directory depth visualization for context awareness.

Open dossier

Claude 5-hour conversation block tracker with visual countdown, expiration warnings, and color-coded indicators to prevent unexpected session terminations.

Open dossier
Next steps
Trust
Review statusReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewedReviewedMaintainer reviewed
Package trustPackage not verifiedPackage not verifiedPackage not verifiedPackage not verified
Source provenanceSource-backedSource-backedSource-backedSource-backed
Submitter
Install riskReview firstReview firstReview firstReview first
Notes Safety Privacy Safety Privacy Safety Privacy Safety Privacy
Brand
Categorystatuslinesstatuslinesstatuslinesstatuslines
Sourcesource-backedsource-backedsource-backedsource-backed
AuthorJSONboredJSONboredJSONboredJSONbored
Added2025-10-252025-10-252025-10-252025-10-23
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notesRuns as a shell command on every statusline refresh (configured refreshInterval 2000ms), executing jq, find, grep, date and arithmetic each time. Creates the directory ~/.claude-code-sessions and writes a per-session file there on every refresh. Automatically deletes session files older than 10 minutes (configurable via SESSION_STALE_THRESHOLD in one variant) using rm. The installation-example variant installs jq via brew or apt-get/yum with sudo and rewrites .claude/settings.json; review before running.Configured as a command-type statusline, so the script runs automatically on every status update. The Examples "Installation" script writes .claude/statuslines/api-latency-breakdown.sh and edits .claude/settings.json, and runs brew/apt-get/yum to install bc.Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.Runs as a Claude Code statusline command on every refresh and depends on the local shell environment; a failure only affects status rendering, not your session.
Privacy notesStores the current session_id and absolute workspace path in plaintext files under ~/.claude-code-sessions, readable by other local processes. The enhanced variant additionally writes the session_id into the file contents and displays the first 8 characters of each session id in the statusline output.The Examples "Enhanced P95" variant appends every measured network time to /tmp/claude_latency_history.txt, leaving session timing data on disk until manually cleared.Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.Reads the Claude Code statusline JSON from stdin (model, workspace path, token usage) and renders it in the local terminal; it does not send data off-machine.
Prerequisites
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, arithmetic operations, and file operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • date command with epoch timestamp support (date +%s for Unix timestamps)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • bc calculator (bc 1.07+ recommended for floating point calculations, optional - script falls back to integer math)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for pattern matching, array operations, and string manipulation)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • awk command (required for breadcrumb extraction - usually pre-installed)
  • Claude Code CLI installed and configured
  • Bash shell available (bash 4.0+ recommended for arithmetic operations and C-style for loops)
  • jq command-line JSON processor (jq 1.6+ recommended for safe extraction with // defaults)
  • date command with epoch conversion support (macOS: -j flag, Linux: -d flag)
Install
Config
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/multi-session-overlap-indicator.sh",
    "refreshInterval": 2000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/api-latency-breakdown.sh"
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/workspace-project-depth-indicator.sh",
    "refreshInterval": 2000
  }
}
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/block-timer-tracker.sh",
    "refreshInterval": 1000
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.