claude-statusline

skill
Guvenlik Denetimi
Basarisiz
Health Uyari
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 9 GitHub stars
Code Basarisiz
  • eval() — Dynamic code execution via eval() in tests/run.sh
  • rm -rf — Recursive force deletion command in tests/run.sh
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

Powerlevel10k-style statusline for Claude Code: usage bars, PR state, cost and cache in pure Bash

README.md

claude-statusline

A Powerlevel10k-style statusline for Claude Code: rounded pills, usage bars, and session stats in three lines. Pure Bash. The installer asks you how you want it, question by question, like the Powerlevel10k wizard.

claude-statusline: project, branch and PR, model and effort; context, 5-hour and weekly usage bars; session time, lines changed, cost and cache

What it shows

Line Segment Meaning
1 Project Folder of the session. It follows the worktree when you switch.
1 Branch Branch and git counts, with p10k symbols: ⇡ahead ⇣behind +staged !modified ?untracked ~conflicts. Green when clean, yellow with changes. Shown inside git worktrees.
1 PR Open pull request of the branch: ✔ approved, ● pending, ✘ changes requested, ✎ draft.
1 /rename Reminder to name the session. It disappears once you run /rename.
1 Model · Effort Model of the session, colored by family, and the reasoning effort. 󱐋 marks fast mode.
2 Context Context used up to the auto-compact point. Next to the percentage, it shows tokens used out of that point (for example, 98% 361k/367k). With --context window, the share of the whole context window.
2 Today 5-hour usage limit and time until it resets.
2 Week 7-day usage limit and time until it resets.
3 Time Session duration.
3 Tasks Claude's task list (the one Ctrl+T toggles): tasks left, done out of total, and ▶ in progress. Green with ✔ when all are done. Hidden while there are no tasks.
3 Lines Lines added and removed in the session, as a proportional bar, plus files changed in the repo.
3 Cost · Cache Estimated session cost in USD and prompt-cache hit ratio. Grey with 󰜗 when the cache has gone cold.

Usage bars turn green, yellow, and red at 60% and 80%. Pills wrap to new lines and spread across the full terminal width, like p10k.

Styles

Two presets, both from versions I have used day to day:

Preset Look
p10k (default) The image above: three lines, round pills.
classic One line, flat pills.
classic preset: project, model, context, today and week in one line of flat pills

Every option can be changed on top of a preset. Two examples:

Options Look
--style angled --bar line --colors soft angled pills, line bars and soft colors
--icons none --bar block --gap none (no Nerd Font needed) flat pills without icons and block bars
Option Values Default (p10k)
--preset p10k, classic p10k
--icons nerd, none (without a Nerd Font; forces flat) nerd
--style round, angled, flat round
--layout full (three lines), compact (one line, wraps when it does not fit) full
--segments all or a comma-separated list of project, rename, branch, pr, model, effort, context, today, week, time, tasks, lines, cost, cache all
--bar shade (▒░), line (━─), block (■□), none shade
--colors vivid, soft vivid
--gap line (─── between pills), none line
--context compact (Context counts up to the auto-compact point), window (the whole context window) compact

The installer saves your choices to ~/.claude/statusline.conf, one key=value per line. The statusline reads that file and never runs it as code. Options you do not set come from the preset.

Auto-compact point

Claude Code compacts the conversation about 33K tokens before its auto-compact window. Since version 2.1.334 that window defaults to 400K on models with a 1M context, so compaction runs at about 367K tokens, while the payload's used_percentage still counts against the full 1M. The Context pill reads the window from, in order: CLAUDE_CODE_AUTO_COMPACT_WINDOW, the window /autocompact saves for the model (modelSettings.<model>.autoCompactWindow), autoCompactWindow in the managed, project, or user settings.json, and otherwise the default. The --autocompact launch flag does not reach the statusline, so with it the point shown can be wrong.

Requirements

  • A Nerd Font in your terminal (for example, MesloLGS NF, the font Powerlevel10k recommends). Without one, choose --icons none.
  • Bash, git, and awk (preinstalled on macOS and Linux).
  • A recent version of Claude Code. Segments whose data the payload does not include are hidden.
  • For the Tasks pill, Claude needs its task tools. Claude Code only provides them by default on older models (Opus 4.7, Sonnet 4.6, Haiku 4.5 and earlier), so the installer sets CLAUDE_CODE_ENABLE_TODO_TOOLS=1 in the env of settings.json (it keeps any value you already have there). Pass --no-task-tools to skip it. See Task list.

Install

curl -fsSL https://raw.githubusercontent.com/sergiomorapardo/claude-statusline/main/install.sh | bash

In a terminal, the installer first asks you how you want it: whether you see the icons, a preset, and then, if you want, each option with a live preview. r restarts and q quits without changing anything. To answer the questions again later:

curl -fsSL https://raw.githubusercontent.com/sergiomorapardo/claude-statusline/main/install.sh | bash -s -- --configure

To skip the questions, pass the options as flags. Options you leave out keep their saved value:

curl -fsSL https://raw.githubusercontent.com/sergiomorapardo/claude-statusline/main/install.sh | bash -s -- --preset classic --colors soft

The installer copies the script to ~/.claude/statusline.sh and adds the statusLine block (and CLAUDE_CODE_ENABLE_TODO_TOOLS=1, for the Tasks pill) to ~/.claude/settings.json. The rest of your settings stay as they are. It backs up any file it changes, and you can run it again to update. If you already have another statusline, it stops without changing anything. Add --force to replace it.

It respects CLAUDE_CONFIG_DIR and needs jq or python3 to edit the settings. --help lists every option.

Install with Claude Code

Paste this into Claude Code:

Install the statusline from https://github.com/sergiomorapardo/claude-statusline following its README.

Instructions for agents

If you are an AI agent installing this statusline for a user, do not edit statusline.sh or statusline.conf. Every option is a flag of the installer.

  1. Ask the user how they want it, in this order. Offer the default first.
    • Does their terminal use a Nerd Font? If they do not know, it is the font Powerlevel10k uses. If not, pass --icons none.
    • Preset: p10k (three lines, the main image) or classic (one line). Point them to the images in the Styles section.
    • Ask whether they want to change anything else. Only then ask about style, layout, bars, colors, gap, and segments, with the values from the options table.
  2. Run the installer with their answers as flags, for example:
    curl -fsSL https://raw.githubusercontent.com/sergiomorapardo/claude-statusline/main/install.sh | bash -s -- --preset classic --icons none.
    Without a terminal it never asks questions. If the user prefers the interactive wizard, tell them to run the command in the Install section in their own terminal.
  3. Check the exit code:
    • 0: installed. Tell the user to send a message or restart Claude Code to see it.
    • 2: the user already has another statusline. Nothing was changed. Show the user the command the installer printed and ask whether to replace it. Run again with bash -s -- --force only after the user says yes.
    • 1: show the error to the user. Do not edit settings.json by hand to work around it.
  4. To change the style later, run the installer again with only the flags that change, for example bash -s -- --bar line.
  5. Tell the user that the icons need a Nerd Font in their terminal. If they look like boxes or question marks, the terminal font is the cause.

Manual install

Download the script:

curl -fsSL https://raw.githubusercontent.com/sergiomorapardo/claude-statusline/main/statusline.sh -o ~/.claude/statusline.sh

Add this to ~/.claude/settings.json. To change the style, create ~/.claude/statusline.conf with the options from the table, for example preset=classic:

{
  "statusLine": {
    "type": "command",
    "command": "bash ~/.claude/statusline.sh",
    "padding": 0,
    "refreshInterval": 2
  }
}

refreshInterval keeps the session time and the reset countdowns up to date between messages.

How it works

Claude Code sends a JSON payload to the script on stdin. The script reads it with grep and sed (no jq needed) and calls git status on the session folder. It makes no network calls and reads the transcript only to detect whether the session has a custom name.

Comments in the script are in Spanish.

License

MIT © Sergio A. Mora Pardo · GitHub · LinkedIn

Yorumlar (0)

Sonuc bulunamadi