| Segment | Meaning | Color |
|---|---|---|
Sonnet 4.6 |
Active model | Magenta |
122K |
Total input tokens this session | Cyan |
61% |
Context window used | Green → yellow → orange → red |
AC!! |
Auto-compact imminent (≤ 20% remaining) | Yellow → orange → red |
🌙 OFF-PK / PEAK |
Anthropic API peak hours (5–11 AM Pacific, Mon–Fri) | Green (off-peak) / yellow (peak) |
my-project |
Working directory (last path segment) | Orange |
The peak/off-peak indicator includes a live countdown to the next state change — useful if you're deciding whether to start a heavy session now or wait.
Prerequisites: Node.js (18+) and Claude Code.
- Copy
statusline.jsto~/.claude/:
curl -o ~/.claude/statusline.js \
https://raw.githubusercontent.com/DFKHelper/claude-code-statusline/main/statusline.js- Add the
statusLinekey to~/.claude/settings.json:
macOS / Linux
{
"statusLine": {
"type": "command",
"command": "node /home/your-username/.claude/statusline.js"
}
}Windows
{
"statusLine": {
"type": "command",
"command": "node C:/Users/your-username/.claude/statusline.js"
}
}- Restart Claude Code. The status bar updates on every turn.
The script is a single self-contained Node.js file (~100 lines). No build step, no dependencies.
Change peak hours or timezone
Find the isPeak assignment and edit the hour bounds or the timezone string:
// Change 5 and 11 to your preferred window, or swap the timezone
const isPeak = isWeekday && ptHour >= 5 && ptHour < 11;
// timeZone: 'America/Los_Angeles' � change thisAdjust context color thresholds
if (used >= 95) color = '\x1b[1;31m'; // red
else if (used >= 80) color = '\x1b[38;5;208m'; // orange
else if (used >= 60) color = '\x1b[1;33m'; // yellow
else color = '\x1b[0;32m'; // greenChange 95, 80, 60 to whatever breakpoints suit your workflow.
Remove a segment
Comment out the matching parts.push(...) call near the bottom of the file.
statusline-debug.js captures the raw JSON payload Claude Code pipes to the command and writes it to disk — handy when building your own status line.
- Temporarily point
settings.jsonat the debug script:
{
"statusLine": {
"type": "command",
"command": "node /home/your-username/.claude/statusline-debug.js"
}
}-
Run Claude Code for one turn. The status bar shows
DEBUG: wrote .... -
Open the output file (default:
~/statusline-capture.json). Override the path withSTATUSLINE_DEBUG_PATH.
example-input.json in this repo shows a sanitized example of the full payload schema, so you can build against it without running a live session.
Claude Code pipes a JSON payload to the status line command via stdin on every turn. The script parses the context window metrics and model info, builds an ANSI-colored string, and writes it to stdout. Claude Code renders that string in the status bar.
Claude Code ──stdin──▶ node statusline.js ──stdout──▶ status bar
JSON ANSI string
The 3-second setTimeout exits the process if stdin never closes — without it, Node processes stack up across long sessions.
MIT
