Install command
Not provided
Claude Code workspace depth tracker showing monorepo navigation level, project root detection, and directory depth visualization for context awareness.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
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
8/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Prerequisite readiness
6 prerequisites to line up before setup.
Safety & privacy surface
1 safety and 1 privacy notes across 1 risk area. Review closely: credentials & tokens.
#!/usr/bin/env bash
# Workspace Project Depth Indicator for Claude Code
# Tracks directory depth and project context
# Read JSON from stdin
read -r input
# Extract workspace info
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // ""')
# Handle empty workspace
if [ -z "$current_dir" ] || [ "$current_dir" = "null" ]; then
echo "📂 No workspace"
exit 0
fi
# Calculate directory depth (count of slashes)
# Remove leading slash to avoid off-by-one
dir_path="${current_dir#/}"
depth=$(echo "$dir_path" | tr -cd '/' | wc -c | tr -d ' ')
# Detect project root indicators
project_indicators=(
".git"
"package.json"
"Cargo.toml"
"go.mod"
"pom.xml"
"build.gradle"
"pyproject.toml"
"composer.json"
)
# Check if current directory is project root
IS_PROJECT_ROOT=false
PROJECT_TYPE=""
for indicator in "${project_indicators[@]}"; do
if [ -f "${current_dir}/${indicator}" ] || [ -d "${current_dir}/${indicator}" ]; then
IS_PROJECT_ROOT=true
case "$indicator" in
".git") PROJECT_TYPE="git" ;;
"package.json") PROJECT_TYPE="node" ;;
"Cargo.toml") PROJECT_TYPE="rust" ;;
"go.mod") PROJECT_TYPE="go" ;;
"pom.xml"|"build.gradle") PROJECT_TYPE="java" ;;
"pyproject.toml") PROJECT_TYPE="python" ;;
"composer.json") PROJECT_TYPE="php" ;;
esac
break
fi
done
# Find project root by walking up directory tree
PROJECT_ROOT="$current_dir"
check_dir="$current_dir"
while [ "$check_dir" != "/" ]; do
for indicator in "${project_indicators[@]}"; do
if [ -f "${check_dir}/${indicator}" ] || [ -d "${check_dir}/${indicator}" ]; then
PROJECT_ROOT="$check_dir"
break 2
fi
done
check_dir=$(dirname "$check_dir")
done
# Calculate depth relative to project root (0 = at root)
if [ "$PROJECT_ROOT" != "$current_dir" ]; then
relative_path="${current_dir#$PROJECT_ROOT/}"
relative_depth=$(echo "$relative_path" | tr -cd '/' | wc -c | tr -d ' ')
relative_depth=$((relative_depth + 1)) # +1 because we're in a subdirectory
else
relative_depth=0
fi
# Color coding based on depth
if [ $relative_depth -eq 0 ]; then
DEPTH_COLOR="\033[38;5;46m" # Green: At project root
DEPTH_ICON="📁"
DEPTH_STATUS="ROOT"
elif [ $relative_depth -le 2 ]; then
DEPTH_COLOR="\033[38;5;75m" # Blue: 1-2 levels deep (normal)
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
elif [ $relative_depth -le 4 ]; then
DEPTH_COLOR="\033[38;5;226m" # Yellow: 3-4 levels deep (moderate)
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
else
DEPTH_COLOR="\033[38;5;208m" # Orange: 5+ levels deep (deep nesting)
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}+"
fi
# Project type indicator
if [ "$IS_PROJECT_ROOT" = true ] && [ -n "$PROJECT_TYPE" ]; then
TYPE_DISPLAY="${PROJECT_TYPE}"
else
TYPE_DISPLAY=""
fi
# Extract directory name for display
dir_name=$(basename "$current_dir")
# Monorepo detection (apps/, packages/, libs/ directories)
if echo "$current_dir" | grep -qE '/(apps|packages|libs|services|modules)/'; then
MONOREPO_INDICATOR="[monorepo]"
else
MONOREPO_INDICATOR=""
fi
# Build breadcrumb visualization (last 3 directories)
if [ $relative_depth -gt 0 ]; then
breadcrumb=$(echo "$current_dir" | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' | sed 's|/$||')
else
breadcrumb="$dir_name"
fi
RESET="\033[0m"
# Output statusline
if [ -n "$TYPE_DISPLAY" ]; then
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} ${TYPE_DISPLAY} | ${breadcrumb} ${MONOREPO_INDICATOR}"
else
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} | ${breadcrumb} ${MONOREPO_INDICATOR}"
fi{
"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/workspace-project-depth-indicator.sh",
"refreshInterval": 2000
}
}
Extended version showing full path relative to project root
#!/usr/bin/env bash
# Enhanced Workspace Depth with Full Path Display
read -r input
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // .workspace.project_dir // .cwd // ""')
if [ -z "$current_dir" ] || [ "$current_dir" = "null" ] || [ "$current_dir" = "." ]; then
echo "📂 No workspace"
exit 0
fi
current_dir=$(echo "$current_dir" | sed 's|/$||')
dir_path="${current_dir#/}"
if [ -z "$dir_path" ]; then
depth=0
else
depth=$(echo "$dir_path" | tr -cd '/' | wc -c | tr -d ' ')
depth=$((depth + 1))
fi
project_indicators=(
".git"
"package.json"
"Cargo.toml"
"go.mod"
"pom.xml"
"build.gradle"
"pyproject.toml"
"composer.json"
"requirements.txt"
"setup.py"
)
IS_PROJECT_ROOT=false
PROJECT_TYPE=""
for indicator in "${project_indicators[@]}"; do
if [ -f "${current_dir}/${indicator}" ] || [ -d "${current_dir}/${indicator}" ]; then
IS_PROJECT_ROOT=true
case "$indicator" in
".git") PROJECT_TYPE="git" ;;
"package.json") PROJECT_TYPE="node" ;;
"Cargo.toml") PROJECT_TYPE="rust" ;;
"go.mod") PROJECT_TYPE="go" ;;
"pom.xml"|"build.gradle") PROJECT_TYPE="java" ;;
"pyproject.toml"|"requirements.txt"|"setup.py") PROJECT_TYPE="python" ;;
"composer.json") PROJECT_TYPE="php" ;;
esac
break
fi
done
PROJECT_ROOT="$current_dir"
check_dir="$current_dir"
while [ "$check_dir" != "/" ] && [ "$check_dir" != "" ]; do
for indicator in "${project_indicators[@]}"; do
if [ -f "${check_dir}/${indicator}" ] || [ -d "${check_dir}/${indicator}" ]; then
PROJECT_ROOT="$check_dir"
break 2
fi
done
check_dir=$(dirname "$check_dir")
if [ "$check_dir" = "$PROJECT_ROOT" ]; then
break
fi
done
if [ "$PROJECT_ROOT" != "$current_dir" ]; then
relative_path="${current_dir#$PROJECT_ROOT/}"
if [ "$relative_path" = "$current_dir" ]; then
relative_depth=$depth
else
relative_depth=$(echo "$relative_path" | tr -cd '/' | wc -c | tr -d ' ')
relative_depth=$((relative_depth + 1))
fi
else
relative_depth=0
fi
if [ $relative_depth -eq 0 ]; then
DEPTH_COLOR="\033[38;5;46m"
DEPTH_ICON="📁"
DEPTH_STATUS="ROOT"
elif [ $relative_depth -le 2 ]; then
DEPTH_COLOR="\033[38;5;75m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
elif [ $relative_depth -le 4 ]; then
DEPTH_COLOR="\033[38;5;226m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
else
DEPTH_COLOR="\033[38;5;208m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}+"
fi
if [ "$IS_PROJECT_ROOT" = true ] && [ -n "$PROJECT_TYPE" ]; then
TYPE_DISPLAY="${PROJECT_TYPE}"
else
TYPE_DISPLAY=""
fi
if echo "$current_dir" | grep -qE '/(apps|packages|libs|services|modules|workspaces|projects)/'; then
MONOREPO_INDICATOR="[monorepo]"
else
MONOREPO_INDICATOR=""
fi
# Show full relative path instead of breadcrumb
if [ "$PROJECT_ROOT" != "$current_dir" ]; then
full_relative_path="${current_dir#$PROJECT_ROOT/}"
if [ "$full_relative_path" = "$current_dir" ]; then
path_display="$current_dir"
else
path_display="$full_relative_path"
fi
else
path_display=$(basename "$current_dir" 2>/dev/null || echo "root")
fi
RESET="\033[0m"
if [ -n "$TYPE_DISPLAY" ]; then
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} ${TYPE_DISPLAY} | ${path_display} ${MONOREPO_INDICATOR}"
else
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} | ${path_display} ${MONOREPO_INDICATOR}"
fi
Version with configurable project root indicators via environment variables
#!/usr/bin/env bash
# Workspace Depth with Custom Project Indicators
read -r input
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // .workspace.project_dir // .cwd // ""')
if [ -z "$current_dir" ] || [ "$current_dir" = "null" ] || [ "$current_dir" = "." ]; then
echo "📂 No workspace"
exit 0
fi
current_dir=$(echo "$current_dir" | sed 's|/$||')
# Custom project indicators via environment variable (comma-separated)
CUSTOM_INDICATORS=${WORKSPACE_DEPTH_INDICATORS:-}
# Default project indicators
project_indicators=(
".git"
"package.json"
"Cargo.toml"
"go.mod"
"pom.xml"
"build.gradle"
"pyproject.toml"
"composer.json"
"requirements.txt"
"setup.py"
"Makefile"
"CMakeLists.txt"
)
# Add custom indicators if provided
if [ -n "$CUSTOM_INDICATORS" ]; then
IFS=',' read -ra CUSTOM_ARRAY <<< "$CUSTOM_INDICATORS"
for custom_indicator in "${CUSTOM_ARRAY[@]}"; do
project_indicators+=("$custom_indicator")
done
fi
IS_PROJECT_ROOT=false
PROJECT_TYPE=""
for indicator in "${project_indicators[@]}"; do
if [ -f "${current_dir}/${indicator}" ] || [ -d "${current_dir}/${indicator}" ]; then
IS_PROJECT_ROOT=true
case "$indicator" in
".git") PROJECT_TYPE="git" ;;
"package.json") PROJECT_TYPE="node" ;;
"Cargo.toml") PROJECT_TYPE="rust" ;;
"go.mod") PROJECT_TYPE="go" ;;
"pom.xml"|"build.gradle") PROJECT_TYPE="java" ;;
"pyproject.toml"|"requirements.txt"|"setup.py") PROJECT_TYPE="python" ;;
"composer.json") PROJECT_TYPE="php" ;;
"Makefile"|"CMakeLists.txt") PROJECT_TYPE="c" ;;
*) PROJECT_TYPE="custom" ;;
esac
break
fi
done
PROJECT_ROOT="$current_dir"
check_dir="$current_dir"
while [ "$check_dir" != "/" ] && [ "$check_dir" != "" ]; do
for indicator in "${project_indicators[@]}"; do
if [ -f "${check_dir}/${indicator}" ] || [ -d "${check_dir}/${indicator}" ]; then
PROJECT_ROOT="$check_dir"
break 2
fi
done
check_dir=$(dirname "$check_dir")
if [ "$check_dir" = "$PROJECT_ROOT" ]; then
break
fi
done
if [ "$PROJECT_ROOT" != "$current_dir" ]; then
relative_path="${current_dir#$PROJECT_ROOT/}"
if [ "$relative_path" = "$current_dir" ]; then
relative_depth=$depth
else
relative_depth=$(echo "$relative_path" | tr -cd '/' | wc -c | tr -d ' ')
relative_depth=$((relative_depth + 1))
fi
else
relative_depth=0
fi
if [ $relative_depth -eq 0 ]; then
DEPTH_COLOR="\033[38;5;46m"
DEPTH_ICON="📁"
DEPTH_STATUS="ROOT"
elif [ $relative_depth -le 2 ]; then
DEPTH_COLOR="\033[38;5;75m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
elif [ $relative_depth -le 4 ]; then
DEPTH_COLOR="\033[38;5;226m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
else
DEPTH_COLOR="\033[38;5;208m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}+"
fi
if [ "$IS_PROJECT_ROOT" = true ] && [ -n "$PROJECT_TYPE" ]; then
TYPE_DISPLAY="${PROJECT_TYPE}"
else
TYPE_DISPLAY=""
fi
dir_name=$(basename "$current_dir" 2>/dev/null || echo "unknown")
if echo "$current_dir" | grep -qE '/(apps|packages|libs|services|modules|workspaces|projects)/'; then
MONOREPO_INDICATOR="[monorepo]"
else
MONOREPO_INDICATOR=""
fi
if [ $relative_depth -gt 0 ]; then
breadcrumb=$(echo "$current_dir" | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' 2>/dev/null | sed 's|/$||' || echo "$dir_name")
else
breadcrumb="$dir_name"
fi
RESET="\033[0m"
if [ -n "$TYPE_DISPLAY" ]; then
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} ${TYPE_DISPLAY} | ${breadcrumb} ${MONOREPO_INDICATOR}"
else
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} | ${breadcrumb} ${MONOREPO_INDICATOR}"
fi
Complete setup script with project indicator verification and depth calculation testing
#!/bin/bash
# Installation script for Workspace Project Depth 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://stedolan.github.io/jq/"
fi
fi
# Check for awk (required for breadcrumb extraction)
if ! command -v awk &> /dev/null; then
echo "Warning: awk command not found - breadcrumb extraction may not work"
echo "Install awk: macOS (pre-installed), Linux (sudo apt-get install gawk or sudo yum install gawk)"
else
echo "awk command available"
fi
# Check for grep (required for monorepo detection)
if ! command -v grep &> /dev/null; then
echo "Error: grep command not found - this is a standard POSIX utility"
echo "Install coreutils: Linux (sudo apt-get install coreutils or sudo yum install coreutils)"
exit 1
else
echo "grep command available"
fi
# Check for tr (required for depth calculation)
if ! command -v tr &> /dev/null; then
echo "Error: tr command not found - this is a standard POSIX utility"
echo "Install coreutils: Linux (sudo apt-get install coreutils or sudo yum install coreutils)"
exit 1
else
echo "tr command available"
fi
# Check for wc (required for depth calculation)
if ! command -v wc &> /dev/null; then
echo "Error: wc command not found - this is a standard POSIX utility"
echo "Install coreutils: Linux (sudo apt-get install coreutils or sudo yum install coreutils)"
exit 1
else
echo "wc command available"
fi
# Test depth calculation
if echo '/foo/bar/baz' | tr -cd '/' | wc -c | tr -d ' ' | grep -q '2'; then
echo "Depth calculation working: $(echo '/foo/bar/baz' | tr -cd '/' | wc -c | tr -d ' ')"
else
echo "Warning: Depth calculation test failed"
fi
# Test breadcrumb extraction
if echo '/foo/bar/baz/qux' | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' | sed 's|/$||' | grep -q 'bar/baz/qux'; then
echo "Breadcrumb extraction working: $(echo '/foo/bar/baz/qux' | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' | sed 's|/$||')"
else
echo "Warning: Breadcrumb extraction test failed"
fi
# Test monorepo detection
if echo '/projects/monorepo/apps/web' | grep -qE '/(apps|packages|libs|services|modules)/'; then
echo "Monorepo detection working"
else
echo "Warning: Monorepo detection test failed"
fi
# Test project indicator detection
if [ -f "package.json" ] || [ -d ".git" ]; then
echo "Project indicator detected: $(test -f package.json && echo 'package.json' || echo '.git')"
else
echo "No project indicators found in current directory (this is OK if not in project root)"
fi
# Test ANSI color codes
if echo -e '\033[38;5;46mGreen\033[0m' &> /dev/null; then
echo "ANSI color codes supported: \033[38;5;46mGreen\033[0m, \033[38;5;75mBlue\033[0m, \033[38;5;226mYellow\033[0m, \033[38;5;208mOrange\033[0m"
else
echo "Warning: ANSI color codes may not display correctly"
fi
# Test emoji support
if echo -e '📁 📂' &> /dev/null; then
echo "Emoji characters supported: 📁 📂"
else
echo "Warning: Emoji characters may not display correctly"
fi
# Create statuslines directory
mkdir -p .claude/statuslines
cat > .claude/statuslines/workspace-project-depth-indicator.sh << 'SCRIPT_EOF'
#!/usr/bin/env bash
# Workspace Project Depth Indicator for Claude Code
# Tracks directory depth and project context
read -r input
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // .workspace.project_dir // .cwd // ""')
if [ -z "$current_dir" ] || [ "$current_dir" = "null" ] || [ "$current_dir" = "." ]; then
echo "📂 No workspace"
exit 0
fi
current_dir=$(echo "$current_dir" | sed 's|/$||')
dir_path="${current_dir#/}"
if [ -z "$dir_path" ]; then
depth=0
else
depth=$(echo "$dir_path" | tr -cd '/' | wc -c | tr -d ' ')
depth=$((depth + 1))
fi
project_indicators=(
".git"
"package.json"
"Cargo.toml"
"go.mod"
"pom.xml"
"build.gradle"
"pyproject.toml"
"composer.json"
"requirements.txt"
"setup.py"
"Makefile"
"CMakeLists.txt"
)
IS_PROJECT_ROOT=false
PROJECT_TYPE=""
for indicator in "${project_indicators[@]}"; do
if [ -f "${current_dir}/${indicator}" ] || [ -d "${current_dir}/${indicator}" ]; then
IS_PROJECT_ROOT=true
case "$indicator" in
".git") PROJECT_TYPE="git" ;;
"package.json") PROJECT_TYPE="node" ;;
"Cargo.toml") PROJECT_TYPE="rust" ;;
"go.mod") PROJECT_TYPE="go" ;;
"pom.xml"|"build.gradle") PROJECT_TYPE="java" ;;
"pyproject.toml"|"requirements.txt"|"setup.py") PROJECT_TYPE="python" ;;
"composer.json") PROJECT_TYPE="php" ;;
"Makefile"|"CMakeLists.txt") PROJECT_TYPE="c" ;;
esac
break
fi
done
PROJECT_ROOT="$current_dir"
check_dir="$current_dir"
while [ "$check_dir" != "/" ] && [ "$check_dir" != "" ]; do
for indicator in "${project_indicators[@]}"; do
if [ -f "${check_dir}/${indicator}" ] || [ -d "${check_dir}/${indicator}" ]; then
PROJECT_ROOT="$check_dir"
break 2
fi
done
check_dir=$(dirname "$check_dir")
if [ "$check_dir" = "$PROJECT_ROOT" ]; then
break
fi
done
if [ "$PROJECT_ROOT" != "$current_dir" ]; then
relative_path="${current_dir#$PROJECT_ROOT/}"
if [ "$relative_path" = "$current_dir" ]; then
relative_depth=$depth
else
relative_depth=$(echo "$relative_path" | tr -cd '/' | wc -c | tr -d ' ')
relative_depth=$((relative_depth + 1))
fi
else
relative_depth=0
fi
if [ $relative_depth -eq 0 ]; then
DEPTH_COLOR="\033[38;5;46m"
DEPTH_ICON="📁"
DEPTH_STATUS="ROOT"
elif [ $relative_depth -le 2 ]; then
DEPTH_COLOR="\033[38;5;75m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
elif [ $relative_depth -le 4 ]; then
DEPTH_COLOR="\033[38;5;226m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}"
else
DEPTH_COLOR="\033[38;5;208m"
DEPTH_ICON="📂"
DEPTH_STATUS="L${relative_depth}+"
fi
if [ "$IS_PROJECT_ROOT" = true ] && [ -n "$PROJECT_TYPE" ]; then
TYPE_DISPLAY="${PROJECT_TYPE}"
else
TYPE_DISPLAY=""
fi
dir_name=$(basename "$current_dir" 2>/dev/null || echo "unknown")
if echo "$current_dir" | grep -qE '/(apps|packages|libs|services|modules|workspaces|projects)/'; then
MONOREPO_INDICATOR="[monorepo]"
else
MONOREPO_INDICATOR=""
fi
if [ $relative_depth -gt 0 ]; then
breadcrumb=$(echo "$current_dir" | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' 2>/dev/null | sed 's|/$||' || echo "$dir_name")
else
breadcrumb="$dir_name"
fi
RESET="\033[0m"
if [ -n "$TYPE_DISPLAY" ]; then
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} ${TYPE_DISPLAY} | ${breadcrumb} ${MONOREPO_INDICATOR}"
else
echo -e "${DEPTH_ICON} ${DEPTH_COLOR}${DEPTH_STATUS}${RESET} | ${breadcrumb} ${MONOREPO_INDICATOR}"
fi
SCRIPT_EOF
chmod +x .claude/statuslines/workspace-project-depth-indicator.sh
# Add to settings.json
if [ ! -f .claude/settings.json ]; then
echo '{"statusLine":{"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/workspace-project-depth-indicator.sh","refreshInterval":2000}}' > .claude/settings.json
else
jq '.statusLine = {"type":"command","command":"$CLAUDE_PROJECT_DIR/.claude/statuslines/workspace-project-depth-indicator.sh","refreshInterval":2000}' .claude/settings.json > .claude/settings.json.tmp
mv .claude/settings.json.tmp .claude/settings.json
fi
echo "Workspace Project Depth Indicator installed successfully!"
echo "Note: Script detects project root by walking up directory tree"
echo "Note: Monorepo detection looks for apps/, packages/, libs/, services/, modules/ directories"
echo "Test: Verify depth calculation and project root detection work correctly"
Verify workspace.current_dir field exists: echo '$input' | jq .workspace.current_dir (should return directory path). If field missing or null, Claude Code may not be tracking workspace. Check alternative fields: echo '$input' | jq '.workspace.project_dir' or echo '$input' | jq '.cwd'. Check that session was started in a directory (not attached to running process without cwd). Verify JSON structure: echo '$input' | jq .workspace (should show workspace object). If workspace is empty string or '.', script shows 'No workspace' - this is expected behavior.
Script checks for common project indicators: .git, package.json, Cargo.toml, go.mod, pom.xml, build.gradle, pyproject.toml, composer.json, requirements.txt, setup.py, Makefile, CMakeLists.txt. If your project uses different marker (e.g., .project), add to project_indicators array. Verify indicator exists: ls -la $current_dir (should show indicator file/directory). Check file permissions: test -r "$current_dir/package.json" && echo "Readable" || echo "Not readable". Test directory walk: Script walks up directory tree until finding indicator - verify parent directories are accessible. Add custom indicator: Set WORKSPACE_DEPTH_INDICATORS environment variable with comma-separated list.
Depth calculation: relative_depth = (number of slashes in path after project root) + 1. Example: project root /foo/bar, current /foo/bar/src/lib = 2 levels deep. Check PROJECT_ROOT detection: echo $PROJECT_ROOT (should show project root path). Verify current_dir: echo $current_dir (should show current directory). Path stripping: relative_path=${current_dir#$PROJECT_ROOT/} (should remove project root prefix). Test calculation: echo '/foo/bar/baz' | tr -cd '/' | wc -c (should return 2). Verify relative_path is not empty: If relative_path equals current_dir, path doesn't start with PROJECT_ROOT - check PROJECT_ROOT detection.
Monorepo detection matches directories containing /apps/, /packages/, /libs/, /services/, /modules/, /workspaces/, or /projects/. Check path: echo '$current_dir' | grep -E '/(apps|packages|libs|services|modules|workspaces|projects)/' (should match). Add custom monorepo patterns: Modify grep pattern to include additional directories: |(custom|patterns)/. Test with sample: echo '/projects/monorepo/apps/web' | grep -qE '/(apps|packages|libs)/' && echo "Matched" (should output). Verify case sensitivity: grep is case-sensitive - ensure directory names match exactly (apps not Apps).
Breadcrumb uses awk to extract last 3 path components: awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}'. Test: echo '/foo/bar/baz/qux' | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' (should show bar/baz/qux/). Adjust NF-2 to NF-N for more/fewer levels: NF-3 for last 4 levels, NF-1 for last 2 levels. Check if path has enough components: If path has fewer than 3 components, breadcrumb shows all available. Verify awk is available: command -v awk (should return path). Test with short path: echo '/foo' | awk -F'/' '{for(i=NF-2;i<=NF;i++) if($i) printf "%s/", $i}' (should show foo/).
IS_PROJECT_ROOT flag set to true when indicator found in current_dir. Check file exists: ls $current_dir/package.json (for node projects). Verify case statement assigns PROJECT_TYPE correctly: case statement maps indicators to types (package.json -> node, .git -> git, etc.). Add debug output: echo IS_PROJECT_ROOT=$IS_PROJECT_ROOT PROJECT_TYPE=$PROJECT_TYPE to see values. Check file permissions: test -r "$current_dir/package.json" && echo "Readable" || echo "Not readable". Verify indicator detection: for indicator in "${project_indicators[@]}"; do test -f "${current_dir}/${indicator}" && echo "Found: $indicator"; done.
Verify relative_depth calculation: echo $relative_depth (should be number 0, 1, 2, 3, 4, 5+). Check color thresholds: 0 = green ROOT, 1-2 = blue L1/L2, 3-4 = yellow L3/L4, 5+ = orange L5+. Test comparison: if [ 3 -le 4 ]; then echo "Yellow"; fi (should output). Verify color codes: Green (\033[38;5;46m), Blue (\033[38;5;75m), Yellow (\033[38;5;226m), Orange (\033[38;5;208m). Test color: echo -e '\033[38;5;46mGreen\033[0m' (should display green text). Check RESET code: echo -e '\033[0m' (should reset colors). If colors not working, terminal may only support 16 colors - modify color codes to use standard ANSI.
Check loop condition: while [ "$check_dir" != "/" ] && [ "$check_dir" != "" ] (should prevent infinite loop). Verify dirname works: dirname /foo/bar (should return /foo). Test break condition: if [ "$check_dir" = "$PROJECT_ROOT" ]; then break; fi (should prevent revisiting same directory). Check for symlinks: If directory contains symlinks, dirname may not work as expected - use readlink -f to resolve. Add timeout: Set maximum iterations (e.g., max_depth=20) to prevent infinite loops. Test with sample: check_dir="/foo/bar"; while [ "$check_dir" != "/" ]; do echo "$check_dir"; check_dir=$(dirname "$check_dir"); done (should stop at /).
Show that Workspace Project Depth Indicator - Statuslines is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/statuslines/workspace-project-depth-indicator)Workspace Project Depth Indicator - Statuslines side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Claude Code workspace depth tracker showing monorepo navigation level, project root detection, and directory depth visualization for context awareness. Open dossier | A Claude Code statusline command (bash) that detects concurrent Claude Code sessions. Open dossier | WCAG-compliant accessible statusline with screen reader announcements, high-contrast colors, semantic labels, keyboard hints, and reduced motion support. Open dossier | Multi-provider AI performance dashboard with context occupancy tracking, truncation warnings, TTFT latency, tokens/min rate, and model comparison metrics. Open dossier |
|---|---|---|---|---|
| Next steps | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | statuslines | statuslines | statuslines | statuslines |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-10-25 | 2025-10-25 | 2025-10-23 | 2025-10-23 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓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 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. | ✓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 notes | ✓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. | ✓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. | ✓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, token usage, context occupancy) and renders it in the local terminal; it does not send data off-machine. |
| Prerequisites |
|
|
|
|
| Install | — | — | — | — |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.