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

session-stats

프롬프트 위에 모델, 컨텍스트 사용량, 속도 제한 사용량을 표시하고 컨텍스트 창의 내역을 나눠 보여 주는 패널을 제공하는 Claude Code mod입니다.

cjmellor@cjmellor

cjmellor/mella-marketplace/tree/main/plugins/session-stats

번역 완료

이 mod 소개

모델, 컨텍스트 사용량, 속도 제한 사용량을 계속 볼 수 있게 해 주는 Claude Code mod입니다. 이 값을 표시하는 statusline 스크립트를 둘 수 있습니다.

Mods는 사용자의 컴퓨터에서 Claude Code 내부 코드를 실행합니다. 설치하기 전에 소스를 읽으세요. 이 mod는 hooks/register.tsx라는 단일 파일로 이루어져 있고 세션 자체의 수치만 읽습니다. 셸 명령을 실행하지 않으며 네트워크 호출도 하지 않습니다.

밴드

프롬프트 위에 표시됩니다.

Sonnet 5.5  ◼◼◼◼◼ 12%  5h 8% (34m)  W 13% (4d 2h)  +
  • /model에 표시되는 모델 뒤에 추론 effort 아이콘을 표시합니다. ○는 low, ◐는 medium, ●는 high, ◉는 xhigh, ◈는 max이며 effort가 token 예산이면 숫자로 표시합니다. /model 전환은 즉시 표시되고 새 모델의 첫 턴 전까지 effort 아이콘을 지웁니다. 다른 곳(Alt+P 선택기, 폴백, IDE)에서 전환하면 다음 턴부터 표시됩니다. Effort는 각 요청에서 읽으므로 첫 턴 뒤에 나타나며, /effort <level>은 즉시 표시되고 메뉴에서 고른 수준은 다음 턴부터 표시됩니다. Effort 설정이 없는 모델에는 아이콘이 없습니다.
  • 컨텍스트 창을 위한 5칸 막대와 백분율.
  • 각 속도 제한 창(5h, W)의 백분율과 재설정까지 남은 시간. 창은 첫 응답이 값을 보고한 뒤 나타나며 구독에서만 표시됩니다.
  • 막대와 백분율은 녹색이고 60%에서 노란색, 85%에서 빨간색으로 바뀝니다.
  • 오른쪽 버튼은 패널이 닫혀 있으면 +, 열려 있으면 −를 표시합니다. 누르면 패널을 열거나 닫습니다.

설문이 표시되는 동안 밴드는 숨겨집니다.

패널

+ 버튼이나 /session-stats로 엽니다.

  • 모델, 컨텍스트 사용량, 각 속도 제한 창을 재설정 카운트다운이 있는 20칸 막대로 표시합니다. 세션(5h)과 주간 창은 Session limit, Weekly · all models로 표시되고, 엔진이 보고하는 모델별 주간 창(예: Fable)은 Weekly · <model>, 밴드에서는 W <model>로 표시됩니다.
  • 이 세션: 비용, 턴 시간, 캐시 적중, 각 모델의 token 비율.
  • 내역: 입력, 출력, 캐시 읽기, 캐시 쓰기 token.
  • 컨텍스트 창: 시스템 프롬프트, 도구, 메시지, 여유 공간 등 범주별로 로컬에서 추정해 큰 순서로 표시합니다.

세션 수치는 mod가 로드된 뒤 완료된 턴을 합산합니다. 다시 로드해도 유지되고 /clear로 초기화되지 않습니다. "Turns"는 완료된 턴의 벽시계 시간이지 API 자체의 시간이 아닙니다.

r로 새로 고칩니다. Esc를 누르면 키보드를 프롬프트로 돌려주고 패널을 닫습니다.

최신 상태

엔진은 각 턴 뒤와 속도 제한 창이 정수 단위로 움직일 때 데이터를 보내며, /model과 /effort 직후에도 새로 고칩니다. 재설정 카운트다운은 1분마다 진행됩니다.

설치

/plugin marketplace add cjmellor/mella-marketplace
/plugin install session-stats@mella-marketplace
/reload-plugins

설치하지 않고 체크아웃에서 시험할 수도 있습니다.

claude --plugin-dir plugins/session-stats

개발

claude plugin validate plugins/session-stats
claude plugin test plugins/session-stats

validate는 밴드가 무엇을 그리는지 검사하지 않습니다. 잘못된 렌더링 트리는 엔진이 버리고 밴드도 표시되지 않습니다. 편집 후 사라지면 --debug로 Claude Code를 실행하고 ui.render (AbovePrompt): a hook returned a tree that does not validate 줄을 찾으세요.

제한

  • status line에 그리거나 숨길 수 없습니다. 디렉터리, 브랜치, PR은 statusline에 두거나 다른 mod로 옮기세요.
  • 밴드를 그릴 수 있는 훅은 하나뿐입니다. 이 mod는 아래 훅에 트리를 요청하고 자신의 행을 위에 쌓으므로 먼저 로드될 때만 git-diff와 함께 사용할 수 있습니다. 요청하지 않고 그리는 mod가 이 mod를 대체합니다.
  • Mods는 모델 또는 effort 변경 이벤트를 받지 않고 /model과 /effort 명령만 받습니다. 현재 모델이 거부하거나 낮추는 /effort 수준도 다음 턴에서 바로잡기 전까지는 입력된 그대로 표시됩니다.
  • 패널은 열 때 찍은 스냅샷입니다(r로 새로 고침).
  • mod를 핫 리로드하면 열린 패널이 닫힙니다.
  • 터미널은 포인터 아래 버튼을 반전 블록으로 그립니다. 엔진이 하는 일이므로 스타일을 지정할 수 없습니다.

설치

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

claude plugin marketplace add cjmellor/mella-marketplace
claude plugin install session-stats
원문 / README

session-stats

A Claude Code mod that keeps the model, context fill and rate-limit usage in view, so you can drop a statusline script for them.

Mods run code inside Claude Code on your machine. Read the source before you install one — this one is a single file, hooks/register.tsx, and only reads the session's own figures. It runs no shell commands and makes no network calls.

The band

Shown above the prompt:

Sonnet 5.5  ◼◼◼◼◼ 12%  5h 8% (34m)  W 13% (4d 2h)  +
  • The model, as /model shows it, then an icon for the reasoning effort: ○ low, ◐ medium, ● high, ◉ xhigh, ◈ max (a number if the effort is a token budget). A /model switch shows at once and clears the effort icon until the new model's first turn; one made elsewhere (the Alt+P picker, a fallback, the IDE) shows from the next turn. The effort is read from each request, so it appears after the first turn; /effort <level> shows at once, while a level picked from a menu shows from the next turn. Models without an effort setting show no icon.
  • A five-square bar and percentage for the context window.
  • Each rate-limit window (5h, W) with its percentage and the time until it resets. Windows appear once the first response has reported them, and only on a subscription.
  • Bars and percentages are green, turn yellow at 60% and red at 85%.
  • The button on the right shows + while the pane is closed and − while it is open. Press it to open or close the pane.

The band is hidden while a survey is up.

The pane

Open it with the + button or /session-stats.

  • The model, context fill and each rate-limit window as a 20-square bar, with reset countdowns. Session (5h) and weekly windows show as Session limit and Weekly · all models; a per-model weekly window the engine reports, such as Fable, shows as Weekly · <model>, and as W <model> in the band.
  • This session: cost, turn time, cache hit and each model's share of tokens.
  • Breakdown: input, output, cache read and cache write tokens.
  • Context window: by category (system prompt, tools, messages, free space), largest first, estimated locally.

The session figures add up the turns finished since the mod loaded. A reload keeps them, /clear does not reset them, and "Turns" is the wall-clock time of finished turns, not the API's own time.

r refreshes. Esc hands the keyboard back and closes the pane.

Freshness

The figures are pushed by the engine after each turn and whenever a rate-limit window moves a whole point, and refreshed straight after /model and /effort. Reset countdowns tick once a minute.

Install

/plugin marketplace add cjmellor/mella-marketplace
/plugin install session-stats@mella-marketplace
/reload-plugins

To try it from a checkout without installing:

claude --plugin-dir plugins/session-stats

Develop

claude plugin validate plugins/session-stats
claude plugin test plugins/session-stats

validate does not check what the band draws: an invalid render tree is dropped by the engine and the band simply does not appear. If it goes missing after an edit, run Claude Code with --debug and look for a ui.render (AbovePrompt): a hook returned a tree that does not validate line.

Limits

  • It cannot draw in the status line or hide it. Keep your statusline for the directory, branch and PR, or move those into another mod.
  • Only one hook can draw the band. This mod asks the hooks beneath it for their tree and stacks its own row on top, so it composes with git-diff only when it loads first. A mod that draws without asking replaces this one.
  • Mods get no event for a model or effort change, only for the /model and /effort commands. A level /effort refuses or lowers for the model still shows as typed until the next turn corrects it.
  • The pane is a snapshot taken when it opens (press r to refresh).
  • A hot reload of the mod closes an open pane.
  • The terminal draws a button under the pointer as an inverted block. That comes from the engine and cannot be styled.

비슷한 프로젝트