Skip to content

Instantly share code, notes, and snippets.

@crizCraig
Created January 15, 2026 03:36
Show Gist options
  • Select an option

  • Save crizCraig/3d490b798911c81958378f5a0dfb167f to your computer and use it in GitHub Desktop.

Select an option

Save crizCraig/3d490b798911c81958378f5a0dfb167f to your computer and use it in GitHub Desktop.
{
"statusLine": {
"type": "command",
"command": "input=$(cat); model=$(echo \"$input\" | jq -r '.model.display_name'); dir=$(echo \"$input\" | jq -r '.workspace.current_dir'); user=$(whoami); git_branch=''; if git -C \"$dir\" rev-parse --git-dir > /dev/null 2>&1; then branch=$(git -C \"$dir\" --no-optional-locks branch --show-current 2>/dev/null); [ -n \"$branch\" ] && git_branch=\" [$branch]\"; fi; total_in=$(echo \"$input\" | jq -r '.context_window.total_input_tokens'); total_out=$(echo \"$input\" | jq -r '.context_window.total_output_tokens'); max_in=$(echo \"$input\" | jq -r '.context_window.context_window_size'); used_pct=$(echo \"$input\" | jq -r '.context_window.used_percentage // empty'); context_info=''; if [ \"$total_in\" != \"null\" ] && [ \"$total_out\" != \"null\" ]; then if [ \"$total_in\" -ge 1000 ]; then in_display=$(awk \"BEGIN {printf \\\"%.0fk\\\", $total_in/1000}\"); else in_display=\"$total_in\"; fi; if [ \"$total_out\" -ge 1000 ]; then out_display=$(awk \"BEGIN {printf \\\"%.0fk\\\",
$total_out/1000}\"); else out_display=\"$total_out\"; fi; if [ \"$max_in\" != \"null\" ] && [ \"$max_in\" -ge 1000 ]; then max_display=$(awk \"BEGIN {printf \\\"%.0fk\\\", $max_in/1000}\"); else max_display=\"$max_in\"; fi; if [ -n \"$used_pct\" ]; then pct_display=$(printf '%.0f' \"$used_pct\"); context_info=$(printf ' | Context: \\033[1;97m%s%%\\033[0m \\033[1;96;40m%s/%s in\\033[0m \\033[1;95;40m%s out\\033[0m' \"$pct_display\" \"$in_display\" \"$max_display\" \"$out_display\"); else context_info=$(printf ' | Context: \\033[1;96;40m%s/%s in\\033[0m \\033[1;95;40m%s out\\033[0m' \"$in_display\" \"$max_display\" \"$out_display\"); fi; fi; printf '%s | %s%s | \\033[38;5;214m%s\\033[0m%s' \"$user\" \"$dir\" \"$git_branch\" \"$model\" \"$context_info\""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment