Skip to content

Commit a90e1b5

Browse files
committed
add absolute context value in addition to percent
1 parent c93f251 commit a90e1b5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ai/claude/statusline.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ const { execSync } = require('node:child_process');
55

66
const CLAUDE_DUMB_ZONE = 59;
77

8+
function formatTokens(tokens) {
9+
if (tokens >= 1000) {
10+
return `${(tokens / 1000).toFixed(1)}k`;
11+
}
12+
return `${tokens}`;
13+
}
14+
815
function getGitBranch() {
916
try {
1017
return execSync('git branch --show-current 2>/dev/null', { encoding: 'utf-8' }).trim();
@@ -81,7 +88,7 @@ try {
8188
const isDumbZone = percent > CLAUDE_DUMB_ZONE;
8289
const bgColor = isDumbZone ? "rgb(226, 0, 0)" : "rgb(217, 119, 87)";
8390
const color = isDumbZone ? "rgb(255, 255, 255)" : "rgb(0, 0, 0)";
84-
sections.push({ text: `${percent}%`, bgColor, color });
91+
sections.push({ text: `${formatTokens(currentTokens)}/${formatTokens(contextSize)} (${percent}%)`, bgColor, color });
8592
}
8693

8794
// Rate limit usage. Claude Code currently exposes `five_hour` and `seven_day`

0 commit comments

Comments
 (0)