You can use Statusline Studio for years without reading the script. But once you know how it works, you can change it by hand, fix it faster and trust what you install. This lesson opens Generated code.
See how Claude Code runs the script
Every time the status line needs updating, Claude Code does three things:
- It runs the command named in the
statusLinesetting - It sends the command a JSON object about the session on its standard input
- It prints whatever the command writes to its standard output under the prompt
The JSON carries the session's facts. A shortened example:
{
"model": { "id": "claude-opus-5-5", "display_name": "Opus 5.5 (1M context)" },
"workspace": { "current_dir": "/home/you/Projects/app", "project_dir": "/home/you/Projects/app" },
"cost": { "total_cost_usd": 3.42, "total_duration_ms": 4512000 },
"context_window": { "used_percentage": 15, "context_window_size": 1000000 },
"rate_limits": { "five_hour": { "used_percentage": 23.5, "resets_at": 1790000000 } }
}Each segment reads one or more of these fields. The segment editor lists them under Reads. Fields that are missing (no limits on an API key, no agent name without --agent) make their segment hide instead of printing an empty label.
Read the three tabs
Generated code has three tabs:
- statusline.sh (or
.py,.js) is the script itself - settings.json is the part to merge into
~/.claude/settings.json - Install is the step-by-step manual install
Copy copies the open tab. Download saves the script as a file.
The settings part looks like this:
{
"statusLine": {
"type": "command",
"command": "bash ~/.claude/statusline.sh",
"padding": 0
}
}Two details are deliberate. The command names the interpreter (bash, python3 or node) instead of running the file directly, so the script works even when it lost its executable permission. And if your design has a segment that must tick, like Wall clock, the studio adds "refreshInterval": 10 so Claude Code reruns the script every 10 seconds, not only when something happens.
Choose Bash, Python or Node.js
The language switch above the code changes the script, not the result. All three print the same line from the same design.
| Language | Needs | Good when |
|---|---|---|
| Bash | bash and jq (some segments also use awk) | You are on macOS or Linux and have jq, the usual case |
| Python | python3 (on Windows, python or py -3 does too) | You have no jq, are on Windows, or want to edit the script in Python |
| Node.js | node | Node is already there because of your projects |
The deps badge under the preview always shows what your current design needs in the chosen language. Git segments also need git.
Install it by hand
The one-line install from Copy install command is the easy way. The manual way is useful when you manage your dotfiles yourself, or want to see each step:
- Save the script as
~/.claude/statusline.sh - Merge the
statusLineblock from the settings.json tab into~/.claude/settings.json - Restart Claude Code
You can test the script without Claude Code by sending it sample JSON:
echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"'"$PWD"'"},"cost":{"total_cost_usd":1.23},"context_window":{"used_percentage":15}}' \
| bash ~/.claude/statusline.shIf a line prints, the script works, and any remaining problem is in the settings.
Know what the install command does
The install command is plain shell you can read before you run it. It:
- Creates
~/.claudeif needed and writes the script there, keeping the script it replaces asstatusline.sh.bak - Makes it executable
- Copies your current
settings.jsontosettings.json.bak - Merges the
statusLinesetting in withjq, or with Python or Node.js ifjqis missing, keeping all your other settings
For a Python script it writes the first Python 3 that runs on your machine into the setting: python3, or on Windows, where a python.org install has no python3, python or py -3.
If your settings.json is not valid JSON (a missing comma, a comma too many), it leaves the file as it is and prints the block to add by hand instead. It does the same, and says why, when there is no jq, Python or Node.js to edit the file with.
When the script's own language does not run on your machine yet (Python 3, Node.js, or jq for the Bash script), it still installs, then says so and gives the command that installs it on your system.
Installing the same design again changes nothing, so those backups stay your old versions. To undo it, put them back:
cp ~/.claude/settings.json.bak ~/.claude/settings.json
cp ~/.claude/statusline.sh.bak ~/.claude/statusline.shThe next lesson is about what to do when the status line shows nothing.