[BUG] Statusline not appearing when using command-line flags with Claude Code

Status Fixed / completed
Maintainer reply None cached
Activity 12 comments · opened Aug 15, 2025 · closed Dec 9, 2025

[BUG] Statusline not appearing when using command-line flags with Claude Code

Environment

  • Platform (select one):
  • [x] Anthropic API (login MAX plan)
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.81 (Claude Code)
  • Operating System: macOS (Darwin 24.6.0)
  • Terminal: iTerm2

Bug Description

The statusline does not appear when starting Claude Code with command-line flags, but works correctly when starting with just claude.

Steps to Reproduce

  1. Configure a statusline script at ~/.claude/statusline.sh with proper executable permissions
  2. Start Claude Code using claude --add-dir ~/claude-workspace --continue
  3. Observe that no statusline appears at the bottom of the interface
  4. Exit and restart using just claude
  5. Observe that the statusline now appears correctly

Expected Behavior

The statusline should appear consistently regardless of which command-line flags are used to start Claude Code.

Actual Behavior

  • Statusline appears when starting with claude
  • Statusline does not appear when starting with claude --add-dir ~/claude-workspace --continue

Additional Context

  • The statusline script is properly configured and executable
  • Settings.json is configured correctly with the statusline path
  • The issue appears to be related to how the statusline is initialized when additional flags are passed during startup
  • This affects users who regularly use workspace directories or session continuation flags

View original on GitHub ↗

12 Comments

murilo · 1 year ago

statusline only appearing when I start claude from home directory: ~/ but not when entering in a new git directory

murilo · 1 year ago

@claude can you fix it?

ecomgit1 · 1 year ago

it doesnt even work at all for me...

rusakovic · 12 months ago

Confirm the bug!

pablontiv · 11 months ago

Confirmed in Windows with or without parameters

AHMED-GAMAL-AG · 11 months ago

Confirmed the status line doesn't show for me in Windows 11 with or without flags @claude

AbhishekDas · 11 months ago

It found a solution which works for me.

First, I created a file - C:\Users\YOUR-USER-FOLDER\.claude\claude-status.ps1 and added the following code in it.

$dir = Split-Path -Leaf (Get-Location)
$branch = ""

try {
    $branch = git branch --show-current 2>$null
    if (-not $branch) {
        $branch = "no-git"
    }
} catch {
    $branch = "no-git"
}

# Read model from settings.json
$model = "sonnet"
try {
    $settingsPath = "$env:USERPROFILE\.claude\settings.json"
    if (Test-Path $settingsPath) {
        $settings = Get-Content $settingsPath | ConvertFrom-Json
        if ($settings.model) {
            $model = $settings.model
        }
    }
} catch {
    $model = "sonnet"
}

Write-Output "$branch | $dir | $model"

Then added the following to - C:\Users\YOUR-USER-FOLDER\.claude\settings.json

  "statusLine": {
    "type": "command",
    "command": "powershell -ExecutionPolicy Bypass -File \"C:\\Users\\YOUR-USER-FOLDER\\.claude\\claude-status.ps1\""
  }

So, my full settings file looks below.

{
  "model": "sonnet",
  "statusLine": {
    "type": "command",
    "command": "powershell -ExecutionPolicy Bypass -File \"C:\\Users\\YOUR-USER-FOLDER\\.claude\\claude-status.ps1\""
  }
}

Now, the status line works and shows User | Branch | Mode

Note:

  1. Remember to replace "YOUR-USER-FOLDER" in the file path and code with your actual user folder name.
  2. Do not leave an empty line in the settings.json file.
ilude · 9 months ago

Main issue with AbhishekDas solution is that it doesn't allow you to use your settings file on machines where you have different usernames. (i.e, work, personal)

it is also not cross platform, using ~\\.claude\\claude-status.ps1 does not function.

But his solution will support using the stdin if you use this:

# Read JSON input from stdin
$stdinInput = @($input) -join "`n"

# Extract values from JSON
$jsonData = $null

if ($stdinInput) {
    try {
        $jsonData = $stdinInput | ConvertFrom-Json
        $model = $jsonData.model.display_name
        $cwd = $jsonData.workspace.current_dir
    } catch {
        # If JSON parsing fails, use defaults
        $model = "input-error"
    }
}
else {
    $model = "no-input"
}
ilude · 9 months ago

So it appear that the statusline command is using cmd.exe which doesn't support variable interpolation. Since the system can clearly use bash I'm not sure why they elected to spawn a process using the platform specific cmd shell here???

anyway, the settings config below solves the issue with getting the stdin string data and allows things to at least work with different usernames across windows machines:

settings.json

"statusLine": {
    "type": "command",
    "command": "pwsh -NoProfile -Command \"$input | & \\\"$env:USERPROFILE\\.claude\\claude-status.ps1\\\"\""
  },

My full claude-status.ps1 file if anyone want to steal it and make it their own:

# Read JSON input from stdin
$stdinInput = @($input) -join "`n"

# Extract values from JSON
$jsonData = $null

if ($stdinInput) {
    try {
        $jsonData = $stdinInput | ConvertFrom-Json
        $model = $jsonData.model.display_name
        $cwd = $jsonData.workspace.current_dir
    } catch {
        # If JSON parsing fails, use defaults
        $model = "input-error"
    }
}
else {
    $model = "no-input"
}

# Find git repository root by searching up the directory tree
$currentPath = Get-Location
$searchPath = $currentPath.Path
$gitRepoPath = $null

while ($searchPath) {
    $gitPath = Join-Path $searchPath ".git"
    if (Test-Path $gitPath) {
        $gitRepoPath = $searchPath
        break
    }
    $parent = Split-Path $searchPath -Parent
    if ($parent -eq $searchPath) {
        break
    }
    $searchPath = $parent
}

# Get directory name to display
$homePath = $env:USERPROFILE

if ($gitRepoPath) {
    # Display basename of directory containing .git
    $basename = Split-Path $gitRepoPath -Leaf
    
    # Check if git repo is in home directory and preface with ~/
    if ($gitRepoPath.StartsWith($homePath, [StringComparison]::OrdinalIgnoreCase)) {
        $dir = "~/$basename"
    } else {
        $dir = $basename
    }
} else {
    # No git repo found, use current directory with ~/ prefix if in home directory
    if ($currentPath.Path.StartsWith($homePath, [StringComparison]::OrdinalIgnoreCase)) {
        $relativePath = $currentPath.Path.Substring($homePath.Length)
        if ($relativePath) {
            $dir = "~" + $relativePath.Replace('\', '/')
        } else {
            $dir = "~"
        }
    } else {
        $dir = $currentPath.Path.Replace('\', '/')
    }
}

$branch = ""

try {
    $branchName = git branch --show-current 2>$null
    if ($branchName) {
        # ANSI color codes: Yellow for brackets, Blue for branch name
        $branch = "`e[33m[`e[34m${branchName}`e[33m]`e[0m"
    }
} catch {
    $branch = ""
}

# ANSI color codes: Green for directory, Orange for model, Reset at end
# Format: green_dir yellow[blue_branch yellow] | orange_model
if ($branch) {
    Write-Output "`e[32m${dir}`e[0m${branch} | `e[38;5;208m${model}`e[0m"
} else {
    Write-Output "`e[32m${dir}`e[0m `e[38;5;208m${model}`e[0m"
}
ilude · 9 months ago

Also this issue was used to close #6526 as a duplicate of this issue, but this ticket is marked as macos, which the OP was using, but if its going to be used to track the issue across both platforms the tags should be updated to reflect this.

github-actions[bot] · 8 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] · 8 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.