Omniscio

OmniscioGuidesStatus line examplesGit branch

Claude Code status line with your git branch

This is the whole script and the whole settings entry, so you can paste both and stop reading. Under them is what each field in the JSON input is, how to check the row actually renders, and the two failures a git status line is known for.

Checked against Claude Code 2.1.332 documentation, November 25, 2026. By the Omniscio team. Updated .

What it shows

One row: the model in brackets, the folder you are in, then the branch, with a green count of staged files and a yellow count of modified files once there are any.

[Opus] ๐Ÿ“ my-app | ๐ŸŒฟ feature/login +2 ~3

The +2 is two files staged with git add. The ~3 is three files modified but not staged. Both counts are files, not lines.

Outside a git repository the script prints the model and the folder only, so the row never goes blank in a directory you have not initialised.

The full script

Save this as ~/.claude/statusline.sh. It is Anthropic's own git status example, printed here in full so you do not have to assemble it from the documentation.

#!/bin/bash
input=$(cat)

MODEL=$(echo "$input" | jq -r '.model.display_name')
DIR=$(echo "$input" | jq -r '.workspace.current_dir')

GREEN='\033[32m'
YELLOW='\033[33m'
RESET='\033[0m'

if git rev-parse --git-dir > /dev/null 2>&1; then
    BRANCH=$(git branch --show-current 2>/dev/null)
    STAGED=$(git diff --cached --numstat 2>/dev/null | wc -l | tr -d ' ')
    MODIFIED=$(git diff --numstat 2>/dev/null | wc -l | tr -d ' ')

    GIT_STATUS=""
    [ "$STAGED" -gt 0 ] && GIT_STATUS="${GREEN}+${STAGED}${RESET}"
    [ "$MODIFIED" -gt 0 ] && GIT_STATUS="${GIT_STATUS}${YELLOW}~${MODIFIED}${RESET}"

    echo -e "[$MODEL] ๐Ÿ“ ${DIR##*/} | ๐ŸŒฟ $BRANCH $GIT_STATUS"
else
    echo "[$MODEL] ๐Ÿ“ ${DIR##*/}"
fi

Then make it executable, because Claude Code runs the command as a program:

chmod +x ~/.claude/statusline.sh

Before any of this works, jq has to be installed: the script calls it to read the JSON, and it is a command-line JSON parser Anthropic's Bash examples use throughout. It is a separate download from jqlang.org and is not on a stock Mac, so check with jq --version first. Without it the JSON reads as empty and the row shows the model and folder as blanks rather than failing loudly.

Inside a repository the script runs git four times per update: a check that this is a repository at all, then the branch and the two counts. That is deliberate, because the branch and the file counts are repository state rather than session state, and the JSON has no field that carries them.

The settings entry

Add this to ~/.claude/settings.json, or to a project's settings file if you want the row only there. type is always "command"; command is the script.

{
  "statusLine": {
    "type": "command",
    "command": "~/.claude/statusline.sh",
    "refreshInterval": 5
  }
}

Add the object beside whatever else the file holds, inside the same braces; it is not a whole file to paste over. Claude Code reloads settings and runs the script as soon as you save it, so there is nothing to restart.

The refreshInterval line is the one addition worth making for a git row: it re-runs the command every five seconds on top of the event-driven updates, which is what keeps the branch honest while you are not typing. The value is in seconds and the minimum is 1. Leave it out and the row updates on events only.

On Windows the path needs forward slashes. A backslash in command is eaten before the script runs, and the row fails without an error. The PowerShell page in this set is the Windows version of this script.

What each field means

Your script gets one JSON object on stdin. These are the parts this script reads, and the branch field that looks right and is not.

The fields around this script, and where the branch really comes from.
FieldWhat it holds
model.display_nameThe model's display name, which is what the row shows in brackets. model.id is the identifier if you would rather switch on that
workspace.current_dirThe directory you are in now. Claude Code prefers it over cwd, which carries the same value, so that a script names it the same way it names its neighbour workspace.project_dir
workspace.project_dirWhere Claude Code was launched. It differs from current_dir once the working directory changes mid-session
worktree.branchThe branch of a Claude Code worktree session, absent for hook-based worktrees. worktree.original_branch beside it is the branch checked out before you entered the worktree. The whole worktree object appears only while the session is in one, so neither field is the branch of the repository you are sitting in
workspace.git_worktreeThe worktree's name when the current directory is inside a linked worktree. Present for any linked worktree, unlike worktree.*
session_idA unique id for the session. Not needed for this script, but it is the right key if you cache git output to a temp file
COLUMNSNot a JSON field: an environment variable holding the terminal width, set fresh before each run. A long branch name is where a row starts wrapping

Everything else the payload carries โ€” cost, the context window, rate limits, the pull request โ€” is covered field by field in the examples library.

How to confirm it renders

Test the script before you trust the setting. Anthropic's tip is to feed it mock JSON, which separates a broken script from a broken setting in one command:

echo '{"model":{"display_name":"Opus"},"workspace":{"current_dir":"/home/you/my-app"},"context_window":{"used_percentage":25},"session_id":"test"}' | ~/.claude/statusline.sh

The mock carries a context_window key this script ignores; it is there only so the same test string works for every page in this set.

Run it from inside a git repository with a change staged, and the line comes back with the branch and the counts. Run it from /tmp and you get the fallback line instead. Both are correct, and seeing both is the proof that the guard works.

In Claude Code, claude --debug logs the script's stderr on every invocation and its exit code on the first invocation in a session. That is the difference between the script never having run and the script having run and failed.

Then check the thing this script is worst at: switch branches in another window and watch the row. With refreshInterval set to five seconds it corrects itself within five seconds of an idle moment; take that field out and it can sit on the old branch until the next event re-runs it.

The common failure

A git status line is the one example where the row is usually late rather than wrong. The triggers that re-run the script โ€” a new assistant message, a finished /compact, a permission mode change โ€” all stop while the main session is idle. Anthropic names the case exactly: a coordinator waiting on background subagents, while git moves on underneath.

The fix is one field, not a new script: refreshInterval in the statusLine object, which re-runs the command on a fixed timer as well. Five seconds is enough for a branch and cheap enough for a repository of ordinary size.

The other failure is a blank row, and it has one cause worth knowing first: Claude Code displays your output only after the script exits with code 0. A script that fails, or prints nothing, leaves the row empty. That is why the script guards the git call with rev-parse --git-dir and keeps an else branch.

What you see, and what to check first.
What you seeCheck
The row never appearsclaude --debug for the script's stderr and exit code; then the executable bit, and whether the folder is trusted
Model and folder show, the branch does notThe script is running from a directory git does not recognise as a repository, so the else branch is the output
Colour codes print as literal textYour terminal may not support them, or the escape is being written literally. In the branch line, change echo -e to printf '%b\n', which the documentation recommends for more reliable escape handling
The row lags after a branch changeAdd refreshInterval; without it the triggers go quiet while the session is idle
The row stalls for a second at a timeFour git calls per update in a large repository. Anthropic's cache example keeps them in a temp file keyed by session_id and refreshes every five seconds

The other scripts in this set

Each one is a complete script and settings entry, not a fragment.

Where Omniscio fits

The status line is Claude Code's own, and nothing on this page needs Omniscio. Omniscio is a desktop app for running several Claude Code agents side by side, in one list rather than a wall of terminals.

Its agent sessions run Claude Code in print mode, so they show Omniscio's session list rather than a terminal row. A status line you configure still applies to any claude you run yourself in a terminal.

The features page lists what the app does today.

How this page was checked

Every statement here about Claude Code comes from Anthropic's own documentation, read in its Markdown form on November 25, 2026: the status line page, the settings reference and the changelog. The version line comes from the changelog, whose newest release is 2.1.332, dated November 25, 2026.

The script is Anthropic's git status example reproduced in full. It was not written for this page and not run on our machine; where the page tells you what it prints, it is repeating what that example is documented to print.

What this page says about Omniscio comes from our own pages. If Anthropic's page and this one ever disagree about Claude Code, Anthropic's page is right, because this part of Claude Code changes on nearly every release.

Sources

  • Customize your status line: the setting, the walkthrough, the full JSON and every field, the update triggers, the git status example, the Windows notes and the troubleshooting section
  • Settings reference: the statusLine entry, its fields and its defaults
  • The changelog: release 2.1.332, the newest listed
  • jq: the JSON parser the script calls

Omniscio's own pages, for what this section says about this app:

Common questions

Does the Claude Code status line JSON include the git branch?

Not for an ordinary session. The branch fields in the payload, worktree.branch and worktree.original_branch, exist only while the session is in a Claude Code worktree session. To show the branch of the repository you are working in, your script reads it itself with git branch --show-current.

Why is the branch on my status line out of date?

The script runs on events, and those triggers go quiet while the main session is idle, for example while a coordinator waits on background subagents. Git can change underneath it without the row re-running. Set refreshInterval in the statusLine object to re-run it on a fixed timer as well.

Why is my status line blank after adding a git branch?

Claude Code shows your output only after the script exits with code 0, so a script that fails or prints nothing leaves the row blank, and anything written to stderr is not displayed. Guard the git call the way the script here does, and run claude --debug to see the script's stderr and its exit code.

Is the status line slow because of git?

It can be. Anthropic's guidance is that the script runs frequently in an active session and that commands like git status or git diff can be slow, especially in large repositories, so a slow script blocks the row from updating until it finishes. Its caching example keeps git output in a temp file keyed by session_id and refreshes it every five seconds.

Run the sessions behind those status lines, from one window

Install Omniscio, keep your Claude Code sessions in one list, and see what each one needs without hunting through terminals. The features page lists what is in it today.