Skip to content
Lesson 9 of 1275% of the course

How the status line script works: Bash, Python or Node.js

Understand what Statusline Studio generates: the JSON Claude Code sends the script, the statusLine setting in settings.json, and how to choose between Bash, Python and Node.js, or install by hand.

Video coming soonHow the status line script works: Bash, Python or Node.jsUntil then, the lesson below walks through every step.

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:

  1. It runs the command named in the statusLine setting
  2. It sends the command a JSON object about the session on its standard input
  3. 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
The settings.json tab.

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.

The same design in Python.
LanguageNeedsGood when
Bashbash and jq (some segments also use awk)You are on macOS or Linux and have jq, the usual case
Pythonpython3 (on Windows, python or py -3 does too)You have no jq, are on Windows, or want to edit the script in Python
Node.jsnodeNode 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:

  1. Save the script as ~/.claude/statusline.sh
  2. Merge the statusLine block from the settings.json tab into ~/.claude/settings.json
  3. 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.sh

If 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:

  1. Creates ~/.claude if needed and writes the script there, keeping the script it replaces as statusline.sh.bak
  2. Makes it executable
  3. Copies your current settings.json to settings.json.bak
  4. Merges the statusLine setting in with jq, or with Python or Node.js if jq is 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.sh

The next lesson is about what to do when the status line shows nothing.

Your progress stays in this browser only.
Contact