Discussion about this post

User's avatar
Simon Holmes's avatar

"What do you currently have in context from our conversation? Give me a summary." - I hadn't thought of this! What a great prompt/question to ask.

Joel Becker's avatar

Great article! I just went through a fun adventure customizing the Claude Code status line on Windows and wanted to share what I learned in case it helps anyone.

The goal: Show working directory, model name, and context usage % in the status line.

What I discovered (the hard way):

1. The status line command in ~/.claude/settings.json does NOT run in a normal shell — $VARIABLE expansion and $(command) substitution don't work by default.

2. On Windows, when you invoke bash, it runs through WSL, not Git Bash. The PATH uses /mnt/c/... paths.

3. WSL may not have jq, python, or node installed, so you can't rely on those.

4. Stdin (the JSON with session data) IS available, but only when you explicitly invoke bash -c or bash script.sh.

The solution: Pure bash string parsing with no external dependencies.

In ~/.claude/settings.json:

"statusLine": {

"type": "command",

"command": "bash /mnt/c/Users/YOURUSER/.claude/statusline-command.sh"

}

And in ~/.claude/statusline-command.sh:

#!/bin/bash

read -t 1 line

cwd=${line#*\"cwd\":\"}

cwd=${cwd%%\"*}

model=${line#*\"display_name\":\"}

model=${model%%\"*}

pct=${line#*\"used_percentage\":}

pct=${pct%%[,\}]*}

pct=${pct%%.*}

echo "$cwd | $model | Context: ${pct:-0}%"

This gives you a status line like: J:\My Drive\Project | Opus 4.6 | Context: 12%

The debugging process itself was a great example of Claude Code in action — it took us a while to figure out the WSL + no-stdin + no-external-tools constraints, but we got there

iteratively!

11 more comments...

No posts

Ready for more?