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

context-bar

프롬프트 위의 띠에 실시간 컨텍스트 창 내역을 그리는 Claude Code 플러그인입니다. 분류별 사용량, 압축 임계값 표시기, 속도 제한 창을 보여 주며 /context-bar로 전환합니다.

myUdav4iik@myUdav4iik

myUdav4iik/claude-mods/tree/main/context-bar

원본 게시물 이미지1
번역 완료

이 mod 소개

context-bar는 프롬프트 위 띠에 컨텍스트 창의 실시간 내역을 그리는 Claude Code mod입니다. 헤더에는 사용 중인 창의 비율을 색으로 구분한 배지(50% 미만은 녹색, 80% 미만은 노란색, 그 이상은 빨간색), 사용 중인 token, 창 크기, 자동 압축이 실행되는 위치가 표시됩니다. 막대에는 각 분류가 차지하는 비율에 맞는 구간 하나가 이어지고, 그 뒤에 여유 공간 트랙이 옵니다. 범례에는 /context가 사용하는 색으로 각 분류와 token 수가 표시됩니다. 선택 가능한 사용량 행에는 플랜의 속도 제한 창(5h、7d 또는 게이트웨이 지출 한도), 사용 비율, 재설정 카운트다운이 표시되며 구독에서만 나타납니다. /context-bar, /context-bar on, /context-bar off로 전환할 수 있고 선택은 세션 사이에 유지됩니다. 사용하는 훅은 session.start(등록, 상태 복원, 최초 읽기, 카운트다운 타이머), turn.complete(각 주 대화 턴 후 읽기, 서브에이전트 건너뜀), session.compact(압축 후 읽기), session.measure(턴 사이 사용량 갱신), AbovePrompt의 ui.render(띠 그리기, 설문 중에는 비켜남)입니다. 읽기는 $.session.usage({ breakdown: 'summary' })에서 가져오며 로컬에서 추정하므로 요청을 보내지 않습니다. 막대는 flex box를 사용해 정확한 비율로 나뉘고 줄바꿈되지 않습니다. 여유 공간은 터미널에서 흐린 선으로, 데스크톱 앱에서 어두운 채움으로 그립니다. 알려진 제한은 분류 수치가 추정값이라는 점, 턴마다 한 번만 갱신된다는 점, 다음 API 응답 전까지 사용 비율이 오래될 수 있다는 점, 최초 읽기 전에는 자리 표시자가 보인다는 점, 다른 mod와 띠를 공유한다는 점입니다. 테스트는 tests/bar.test.tsx에 있으며 claude plugin test .로 실행할 수 있습니다.

설치

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

claude plugin marketplace add myUdav4iik/claude-mods
claude plugin install context-bar
원문 / README

context-bar

A live breakdown of the context window, drawn in the band above Claude Code's prompt.

In the terminal:

context-bar in the terminal: a context header at 18%, the category bar, its legend, and a usage row with 5h and 7d limits

In the desktop app:

context-bar in the Claude desktop app: a context header at 35%, the category bar on a dark free-space fill, and its legend

  • Header: the share of the window in use, as a badge that is green under 50%, yellow under 80% and red above. Then the tokens in use, the window size, and the point where auto-compaction runs.
  • Bar: one segment per category, in proportion to its share of the window, followed by a track for the free space.
  • Legend: each category with its token count, in the colours /context uses.
  • Usage: your plan's rate-limit windows (5h, 7d, or a gateway's spend limit), each with the share used, coloured like the context badge, and a countdown to when it resets. The row only appears on a subscription, where Claude Code receives these figures.

Usage

| Command | Does | | --- | --- | | /context-bar | Shows or hides the bar | | /context-bar on | Shows the bar | | /context-bar off | Hides the bar |

The command runs at once, even while Claude is working. The choice is remembered across sessions. Claude Code's own [-] control on the band collapses it as well.

How it works

| Hook | What it does | | --- | --- | | session.start | Registers /context-bar, restores the saved on/off choice, takes a first reading, and starts a once-a-minute timer for the reset countdowns. | | turn.complete | Takes a reading after each turn of the main conversation. Subagent turns are skipped. | | session.compact | Takes a reading after the conversation is compacted. | | session.measure | Updates the usage row when a rate-limit window moves, between turns too. | | ui.render on AbovePrompt | Draws the band. It steps aside while Claude Code shows a survey there. |

Readings come from $.session.usage({ breakdown: 'summary' }), the same per-category breakdown /context shows. The summary mode estimates locally, so a reading sends no requests and costs nothing. The same call returns the rate-limit windows from the last API response; the usage row shows those, so it sends no requests either.

The bar is built from flex boxes, each growing by its share of the window, so it splits in exact proportion at any width and never wraps. Small categories still get at least one cell. Free space is drawn differently per surface:

  • Terminal: a dim line, because Claude Code's colour for free space there is bright enough to read as used.
  • Desktop app: a dark fill. The desktop wraps long runs of text rather than clipping them, so a line of characters doesn't work there.

The compaction reserve is drawn as part of the free track; the header shows where compaction runs.

Limitations

  • Estimates: the category figures are estimates, as in /context, so the total can differ slightly from the status line.
  • Once per turn: the bar updates after each turn, not while Claude is working.
  • Usage after a reset: the percentages come from the last API response. Once a window's reset time passes, the row shows "resetting" until the next response brings a new figure.
  • Before the first reply: the bar shows "waiting for the first reading…".
  • Shared band: the band above the prompt holds one mod at a time. If another installed mod draws there, only one of them shows.

Tests

tests/bar.test.tsx feeds the mod a sample breakdown, draws the band on the terminal and desktop surfaces, and fails if either surface refuses the drawing. Claude Code drops a drawing it can't validate without an error you'd see, so run the tests after changing how the bar is drawn:

claude plugin test .

동명의 다른 작품

비슷한 프로젝트