Status line
The terminal UI can show a status line above its footer: the output of a script you own, run with the session’s state on its standard input. It can show anything a script can find out, such as the branch, the context in use or the cost so far.
Have zelk write it
Section titled “Have zelk write it”Type /statusline and say what to show:
/statusline show the branch and context usezelk writes the script at .zelk/statusline.sh in the workspace and tests
it against sample input. Writing under .zelk/ always asks for your
approval, since it is a protected path. When the run ends done, the terminal
UI installs the script as ~/.config/zelk/statusline.sh, makes it
executable, removes it from the workspace and turns the status line on in
config.json. A run that doesn’t finish changes nothing.
On Windows, the /statusline script generator needs Git for Windows.
With nothing after /statusline, zelk bases the line on your shell prompt:
your PS1, or a starship or oh-my-posh configuration.
To change the line, run /statusline again with what to change: the
script in use is copied to the workspace for zelk to edit.
/statusline off turns the line off and keeps the script.
Write it yourself
Section titled “Write it yourself”Set status_line in ~/.config/zelk/config.json:
{"status_line": {"command": "~/bin/line.sh", "padding": 0, "refresh_interval": 10, "timeout": 5}}| Key | Means |
|---|---|
command |
the command to run; required |
padding |
extra columns to indent its lines by, 0 to 20 |
refresh_interval |
also run it this often, in seconds; 0 runs it only when the session changes |
timeout |
how long one run may take, in seconds, up to 60; 0 means 5 |
zelk runs the command with your environment in the workspace after each
model call and when the session changes. It uses /bin/sh on Unix.
On Windows it uses Git Bash when available and PowerShell otherwise.
What the script gets
Section titled “What the script gets”Standard input is one JSON object in Claude Code’s status line format, so a status line script written for Claude Code works as it is:
{ "cwd": "/home/me/project", "session_id": "6f1c…", "session_name": "Fix the flaky test", "model": {"id": "claude-sonnet-5-5", "display_name": "claude-sonnet-5-5"}, "workspace": {"current_dir": "/home/me/project", "project_dir": "/home/me/project", "git_worktree": "feature-x"}, "version": "0.3.0", "cost": {"total_cost_usd": 0.42, "total_duration_ms": 183000}, "context_window": { "total_input_tokens": 52000, "total_output_tokens": 300, "context_window_size": 200000, "used_percentage": 26, "remaining_percentage": 74, "current_usage": {"input_tokens": 1200, "output_tokens": 300, "cache_creation_input_tokens": 800, "cache_read_input_tokens": 50000} }, "exceeds_200k_tokens": false, "effort": {"level": "high"}}session_name,workspace.git_worktree,cost.total_cost_usdandeffortmay be missing: a session with no title, a checkout that isn’t a linked worktree, a model with no known price, a model that decides its own effort.used_percentage,remaining_percentageandcurrent_usagearenullbefore the first model call and after a compaction until the next one; the percentages are alsonullwhen the window isn’t known.COLUMNSandLINEShold the terminal’s size.
A small script with jq:
#!/bin/shinput=$(cat)dir=$(printf '%s' "$input" | jq -r '.workspace.current_dir')used=$(printf '%s' "$input" | jq -r '.context_window.used_percentage // empty')branch=$(git -C "$dir" --no-optional-locks branch --show-current 2>/dev/null)printf '%s%s\n' "$branch" "${used:+ · context $used%}"What zelk shows
Section titled “What zelk shows”zelk shows up to three lines, each cut to the screen’s width. ANSI colours and OSC 8 links come through; other escape sequences are dropped. A script that exits with an error, or runs past its timeout, leaves the line as it was, and zelk says it failed. Keep the script fast: anything over the network, or slow, holds the line back.