ClaudeMods
☰
KO
● 0 명 접속 중 · 조회 0 회
후원프로젝트 제출
GitHub 저장소 · 작성자 tommy5dollar

context-gauge

한 가지, 컨텍스트 창이 얼마나 찼는지만 보여 주는 Claude Code mod입니다.

tommy5dollar@tommy5dollar

tommy5dollar/claude-mods/tree/main/context-gauge

번역 완료

이 mod 소개

프롬프트 푸터에 컨텍스트 창 사용량을 작은 색상 백분율로 표시하는 Claude Code mod입니다. 30% 미만은 녹색, 30-40%는 노란색, 40% 초과는 빨간색입니다. 기본적으로 SessionMode 푸터에 그리며 hint, band, status 같은 대체 표시 위치, 테마에 맞는 색상, 설정 가능한 yellowAt/redAbove 임계값을 지원합니다. /ctx는 컨텍스트를 범주별로 큰 항목부터 출력합니다. hook 오류가 나도 안전하게 진행하며, 백분율을 알 수 없을 때 잘못된 숫자를 표시하지 않습니다.

설치

먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.

claude plugin marketplace add tommy5dollar/claude-mods
claude plugin install context-gauge
원문 / README

context-gauge

A Claude Code mod that shows one thing: how full the context window is.

                                                 focus 34%

34% sits at the right of the prompt footer, beside Claude Code's own mode labels. It is coloured by how close you are to compacting:

| Colour | When | Meaning | | --- | --- | --- | | green | below 30% | plenty of room | | yellow | 30% to 40% | getting full | | red | above 40% | compact soon (it suits an auto-compact set at 50%) |

<!-- screenshot: terminal footer showing a yellow "34%" -->

It does not show 5-hour or 7-day rate limits or cost. That is deliberate.

/ctx prints the breakdown by category, largest first:

Session context: 68k / 200k (34%)
  Messages       60k
  System prompt  3.1k
  ...

Why

The Desktop app's usage ring mixes context with rate limits and is hard to read at a glance. Mods can't replace native chrome, so this puts a small, honest number in a place a mod can draw, in the terminal and in Desktop, without adding a separate usage panel.

Install

claude plugin marketplace add tommy5dollar/claude-mods
claude plugin install context-gauge@tommy-mods

Needs Claude Code 2.1.287 or later (Claude Mods).

Settings

Set these in /config, /plugin configure context-gauge@tommy-mods, or under pluginConfigs in settings.

| Option | Default | What it does | | --- | --- | --- | | yellowAt | 30 | Yellow from this percent | | redAbove | 40 | Red above this percent | | site | footer | Where to draw: footer, hint, band or status (see below) |

A threshold outside 0 to 100, or a yellowAt above redAbove, falls back to the defaults.

Where it draws

| site | Render site | Notes | | --- | --- | --- | | footer (default) | SessionMode, the dim mode labels at the right of the prompt footer | Least intrusive. Takes no row of its own. | | hint | PromptHint, the hint line under the prompt | Shares the line with ? for shortcuts and the pills. | | band | AbovePrompt, the band above the prompt | Takes a row, and the engine adds a [-] beside it. Yields to surveys. | | status | $.ui.status, the plugin status line | Plain text, no colour. The fallback if the others don't show. |

The colours are Claude Code theme keys (success, warning, error), so they follow light and dark themes.

How it works

  • session.measure fires after each main-thread turn with the context figures. The gauge updates when the context unit moved.
  • classic.SessionStart (startup, /clear, /resume, /branch, after compaction) re-reads $.session.usage().
  • It uses the engine's percent. If that is missing it works out tokens over window. If neither is known, as in a fresh or just-compacted session before the next response, it shows nothing rather than a wrong number.
  • Every hook fails open. If anything throws, Claude Code draws what it would have drawn anyway.

The percentage is the status line's used_percentage: the last response's input tokens over the model's context window. /context measures against the compaction window, so the two can differ by a few points.

Known limits

  • Desktop: issue #99265, the band draws in only one active chat. That bug is reported against the band, and it may also affect the footer.
  • Not tested in the Desktop app yet. The test kit checks the tree against Desktop's element table, but not how Desktop paints it.
  • VS Code (#99045), Remote Control (#99217) and -p run hooks but draw no UI. /ctx still answers where commands run.
  • Subagent context is not shown. session.measure follows the main thread.

Development

bun test                                   # pure logic (spec/)
claude plugin test .                       # hooks and drawing on terminal and desktop (tests/)
claude plugin validate . --strict
claude --plugin-dir .                      # live, reloads on save; writes .claude-plugin/types/

tsconfig.json extends the types Claude Code writes to .claude-plugin/types/ on load.

Licence

MIT

동명의 다른 작품

비슷한 프로젝트