@leaf-x317/cc-statusline
v1.0.6
Published
Custom status line for Claude Code: model, context usage, session duration, CPU, git branch & changes
Maintainers
Readme
cc-statusline
A custom status line for Claude Code — shows model name, context usage, session duration, CPU utilization, repo name, git branch, and code change stats at a glance.
classic theme:

matrix theme:

ocean theme:

Features
- Current model name
- Model effort level and thinking mode status
- Context usage percentage with progress bar
- Context usage measured against the window Claude Code actually uses (1M for
[1m]-suffixed model IDs, 200k otherwise) - Session duration
- CPU utilization (Linux, including WSL; hidden on macOS and native Windows, which lack
/proc/stat) - Current working directory and repository name
- Git branch
- Code change stats (added / removed lines)
- Switchable themes (classic / matrix / ocean)
Installation
Via npx (recommended)
npx @leaf-x317/cc-statusline@latestGlobal install
# 1. Install the package
npm install -g @leaf-x317/cc-statusline
# 2. Run the setup script
cc-statuslineThe installer copies the status line script to ~/.claude/statusline.sh (backing up any existing one) and writes the statusLine config into ~/.claude/settings.json.
Uninstall
npx @leaf-x317/cc-statusline@latest --uninstallRestores your previous status line from backup (or removes it) and cleans up settings.json.
Dependencies
jq— JSON processing (apt install jq/yum install jq/brew install jq/winget install jqlang.jq)git— branch and diff statsbash— required on Windows (ships with Git for Windows); preinstalled on macOS/Linux
Windows note: the installer locates
bash,jq, andgitvia yourPATH. Git for Windows' default setup only addsGit\cmdtoPATH, which containsgit.exebut notbash.exe— addGit\usr\binto yourPATHas well. After installing dependencies or editingPATH, open a new terminal window before running the installer (existing windows keep the oldPATH).
Themes
Edit ~/.claude/statusline.sh and change the THEME variable:
THEME="classic" # classic theme (blue)
THEME="matrix" # matrix theme (green)
THEME="ocean" # ocean theme (cyan)Or set the CC_STATUSLINE_THEME environment variable — it survives reinstalls. Add it to the env section of ~/.claude/settings.json:
"env": {
"CC_STATUSLINE_THEME": "matrix"
}Sample output
✦ kimi-k3 (high, thinking) | ◼ /workspace | ⎔ cc-statusline | ⌥ main
◔ Context: ████████░░ 82% (165k/200k) | ◷ Duration: 5m32s | ▣ CPU: 23% | Δ +128 -45Context window
Claude Code determines the context window itself and reports it in the status line JSON as context_window_size: models whose ID carries the [1m] suffix get 1M tokens, everything else defaults to 200k. The status line uses that value as-is, so its percentage always matches the window Claude Code actually compacts against. There is no model-name mapping table to maintain.
[1m] is a suffix Claude Code appends to the model ID for 1M-context models (e.g. deepseek-v4-flash[1m]) — it is not a separate model ID. If context_window_size is missing, the script applies the same rule as a fallback: [1m] suffix → 1M, otherwise → 200k.
Releasing
Publishing is automated via GitHub Actions (.github/workflows/publish.yml):
git tag v1.0.0
git push origin v1.0.0The workflow syncs the package.json version from the tag and publishes to the public npm registry (requires an NPM_TOKEN repository secret).
License
中文说明
Claude Code 自定义状态行工具,实时展示模型名称、上下文使用率、会话时长、CPU 使用率、代码仓库、Git 分支与代码变更统计等。
安装
npx @leaf-x317/cc-statusline@latest卸载
npx @leaf-x317/cc-statusline@latest --uninstall依赖
jq- JSON 处理工具(apt install jq/yum install jq/brew install jq/winget install jqlang.jq)git- 版本控制工具bash- 仅 Windows 需要(随 Git for Windows 提供);macOS/Linux 已预装
Windows 提示: 安装程序通过
PATH查找bash、jq、git。Git for Windows 默认安装只把Git\cmd加入PATH(其中有git.exe但没有bash.exe),需手动将Git\usr\bin也加入PATH。安装依赖或修改PATH后,请重新打开终端窗口再运行安装程序(已打开的窗口仍使用旧的PATH)。
主题配置
编辑 ~/.claude/statusline.sh 文件,修改 THEME 变量:
THEME="classic" # 经典主题(蓝色系)
THEME="matrix" # 矩阵主题(绿色系)
THEME="ocean" # 海洋主题(青色系)也可以设置 CC_STATUSLINE_THEME 环境变量——重装不会丢失。在 ~/.claude/settings.json 的 env 中添加:
"env": {
"CC_STATUSLINE_THEME": "matrix"
}示例输出
✦ kimi-k3 (high, thinking) | ◼ /workspace | ⎔ cc-statusline | ⌥ main
◔ Context: ████████░░ 82% (165k/200k) | ◷ Duration: 5m32s | ▣ CPU: 23% | Δ +128 -45上下文窗口
Claude Code 会自行判定上下文窗口,并通过状态行 JSON 的 context_window_size 上报:模型 ID 带 [1m] 后缀(如 deepseek-v4-flash[1m])时为 1M,其余默认 200k。状态行直接使用该值,因此显示的百分比与 Claude Code 实际压缩所依据的窗口一致,无需维护模型名映射表。
若 JSON 未提供 context_window_size,脚本按同样的规则兜底:带 [1m] 后缀 → 1M,否则 → 200k。
