Check your caching rate in real time with Claude mode.
Building modes for Claude has become easy. That means you can build all kinds of features like a HUD, and you can even see your caching status in the status bar!
Contents
While using Claude Code, questions often come up like "Why is it slower than before?" and "Why is my usage running out faster than expected?" The main cause of this is the prompt cache, but there was a limitation: that information wasn't easy to see in the default interface. To improve on this, I implemented a feature that shows cache information directly in the status bar.
So what exactly is the cache?
Claude Code resends the entire conversation history to the model every time you send a message. Using the cache skips the parts that were already processed, which speeds up responses and eases the pressure on your usage limits.
However, the cache has an expiration time. After it expires, the next message you send requires reprocessing the entire conversation. The longer the conversation gets, the higher the cost, but there's a catch: you normally can't see how much time is left before the cache expires.
How do I apply it?
You don't need to write any code yourself. Just ask Claude Code something like this.
내 Claude Code 상태줄에 캐시 세그먼트를 추가해 줘.
이미 상태줄이 있으면 바꾸지 말고 아래 줄에 덧붙여 줘.
입력의 prompt_cache에서 warm, ttl, expires_at, hit_ratio, misses, last_miss_cause, recache_tokens_if_cold를 읽어 줘. 값이 없으면 표시하지 마.
캐시가 살아 있으면 녹색으로 cache ● 1h ████░░ 38m left · hit 91% · misses 0처럼 보여 주고, 남은 시간이 20% 미만이면 노란색으로 바꿔 줘.
만료됐으면 빨간색으로 cache ○ cold · next message re-caches 82k tokens처럼 보여 줘. 원인이 있으면 끝에 붙여 줘.
카운트다운이 움직이도록 statusLine 설정에 refreshInterval을 넣어 줘.
첫 줄에는 모델 이름, 추론 강도, 컨텍스트 토큰 수도 보여 줘.
끝나면 warm, 만료 직전, cold 샘플로 실행해서 결과를 보여 줘.To check prompt_cache information, you need Claude Code version 2.1.251 or later. You can check your version with the command claude --version.
Comments 0
- Loading comments.