claude-simple-status 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/statusline.mjs +5 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-simple-status",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "A simple statusline for Claude Code — project name, git branch, model, context usage, quota, and API costs at a glance",
5
5
  "type": "module",
6
6
  "bin": {
package/statusline.mjs CHANGED
@@ -46,7 +46,7 @@ const CACHE_STALE_AGE = 300; // seconds - when to show "--" instead of old value
46
46
  const GIT_BRANCH_CACHE = join(tmpdir(), 'claude-statusline-branches.json');
47
47
  const GIT_BRANCH_MAX_AGE = 30; // seconds
48
48
  const CONTEXT_HISTORY_FILE = join(tmpdir(), 'claude-statusline-context.json');
49
- const CONTEXT_COMPACT_THRESHOLD = 95; // % at which compaction typically fires
49
+ const CONTEXT_COMPACT_THRESHOLD = 83; // % at which autocompact typically fires
50
50
  const CONTEXT_MAX_SAMPLES = 20; // rolling window of turn deltas
51
51
  const QUOTA_HISTORY_FILE = join(tmpdir(), 'claude-statusline-quota-history.json');
52
52
  const QUOTA_MAX_READINGS = 30; // ~1h of data at 120s refresh intervals
@@ -233,8 +233,9 @@ function getContextVelocity(projectDir, contextUsed) {
233
233
  history[projectDir] = entry;
234
234
  try { writeFileSync(CONTEXT_HISTORY_FILE, JSON.stringify(history)); } catch {}
235
235
 
236
- // Need at least 2 turn deltas to estimate
237
- if (entry.deltas.length < 2) return null;
236
+ // Need at least 5 turn deltas to estimate — fewer gives noisy results
237
+ // (especially right after compaction when early turns inflate context quickly)
238
+ if (entry.deltas.length < 5) return null;
238
239
 
239
240
  // Weighted average: recent deltas matter more
240
241
  let weightSum = 0;
@@ -298,7 +299,7 @@ function getQuotaPressure(windowKey, utilization, resetsAtIso) {
298
299
 
299
300
  const oldest = history.readings[0];
300
301
  const elapsedMs = now - oldest.ts;
301
- if (elapsedMs < 60_000) return null; // need at least 1 min of data
302
+ if (elapsedMs < 600_000) return null; // need at least 10 min of data to avoid noisy early-window spikes
302
303
 
303
304
  const pctGained = utilization - oldest.pct;
304
305
  if (pctGained <= 0) return 'safe'; // not growing