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

cache-warmer

Claude Code 모드로, 만료 직전에 작은 새로 고침 포크를 전송하여 휴식 시간 동안 프롬프트 캐시를 따뜻하게 유지하여 다음 프롬프트 비용을 줄입니다.

번역 완료

이 mod 소개

cache-warmer는 휴식 시간 동안 메인 대화의 프롬프트 캐시를 따뜻하게 유지하는 Claude Code 플러그인입니다. 5분 또는 1시간 캐시 TTL이 만료되기 직전에 작은 새로 고침 요청(마지막 요청의 포크)을 보내 다음 프롬프트가 캐시를 읽도록 하여 더 높은 비용으로 다시 작성하는 대신 캐시를 사용하게 합니다. 이 플러그인은 Mario Zechner의 Pi에 있는 캐시 워머에서 새로 고침 타이밍, $0.05 손익분기점 규칙, 유휴 제한 개념을 가져왔습니다. 이 플러그인은 전역 및 세션 구성, 분석, 디버그 모드를 위한 /cache-warmer 창을 제공합니다. /cache-warmer 5m 또는 1h 또는 cache-warmer.ttl 구성을 통해 5분 및 1시간 캐시 시간을 지원합니다. 프로세스에 CLAUDE_CODE_PROMPT_CACHE_TTL을 설정합니다. 새로 고침 중에 Clawd 마스코트 밴드를 표시합니다. 그리고 압축, /clear, 모델 변경 또는 새로 고침 실패 후 워밍업을 중지합니다. claude plugin marketplace add paulbkim-dev/claude-code-cache-warmer 및 claude plugin install cache-warmer@claude-code-cache-warmer로 설치합니다. MIT 라이선스에 따라 출시되었습니다.

설치

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

claude plugin marketplace add paulbkim-dev/claude-code-cache-warmer
claude plugin install cache-warmer
원문 / README
<div align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="assets/clawd-dark.gif"> <img alt="Clawd sips from a steaming mug while the cache warms, hops under a heart of steam once it is warm, and dozes when it expired" src="assets/clawd-light.gif" width="914"> </picture>

cache-warmer

Keeps the Claude Code prompt cache warm during a break, so your next prompt costs less.

Blog post · Website · X

English · 한국어

</div> <br>

What does it do?

Each prompt sends the full conversation to the API. The API keeps the start of the conversation in a prompt cache for 5 minutes or 1 hour. A prompt that reads the cache costs much less and starts faster. After the cache expires, the next prompt writes the full cache again at a higher price.

cache-warmer sends one small refresh shortly before the cache expires, so the cache stays warm. It works like the cache warmer in Pi.

flowchart LR
    subgraph with["With cache-warmer"]
        direction LR
        b1["Prompt"] --> b2["Break"] --> b3["Refresh<br/>keeps the cache"] --> b4["Next prompt<br/>reads the cache"]
    end
    subgraph without["Without cache-warmer"]
        direction LR
        a1["Prompt"] --> a2["Break"] --> a3["Cache expires"] --> a4["Next prompt<br/>writes the cache again"]
    end
<br>

Install

claude plugin marketplace add paulbkim-dev/claude-code-cache-warmer
claude plugin install cache-warmer@claude-code-cache-warmer

Restart Claude Code, then type /cache-warmer to open the pane. To stop all warming, run claude plugin disable cache-warmer.

<br>

What you see

During a refresh, a band above the prompt shows Clawd, the Claude Code mascot.

| Clawd | Meaning | |---|---| | Sips from a steaming mug | A refresh runs. | | Hops under a heart of steam | The cache is warm. | | Dozes with a cold mug | The cache expired, or the refresh failed. |

  • The refresh never enters the conversation. The transcript keeps one notice row per refresh, starting with ☕, and no request sends it to the model.
  • The band needs seven free terminal rows; elsewhere it shows only the result line. reduceMotion keeps Clawd still.
  • /cache-warmer preview plays the three states with no refresh.
<br>

The pane

/cache-warmer opens and closes a pane with this menu:

Global configuration    defaults for new sessions
Session configuration   the current session only
Analytics               costs and savings
Debug mode              on or off
  • Tab and the arrow keys move between items. Enter opens a page or turns Debug mode on or off. Each page starts with a Back button.
  • Escape closes the pane when the pane has focus, or when the prompt is idle and empty.
  • A line below the menu shows the next refresh, or why warming stopped.
<br>

Cache time

| | 5 minutes | 1 hour | |---|---|---| | Refresh after | 4m30s | 54m | | Cache write price | 1.25× input | 2× input | | Warm time when idle, default limit | 27m30s | 5h30m |

  • Set the default on the Global page, in the /config row cache-warmer.ttl, or with /cache-warmer 5m or /cache-warmer 1h. The command also sets the current session.
  • The first main-conversation response locks the session's cache time. /clear or a new session unlocks it. While it is locked, the command refuses, and a new default applies to later sessions only.
  • The mod sets CLAUDE_CODE_PROMPT_CACHE_TTL for this Claude Code process, so it overrides promptCacheTtl and the shell. A change applies from the next request, which writes the cache once.
  • FORCE_PROMPT_CACHING_5M=1 keeps the cache at 5 minutes, and the Session page says so.
  • A refresh extends both cache times. In a live test on 2026-10-05, it kept a 1-hour cache warm past 60 minutes.
  • A refresh that reads less than half of the prefix counts as expired and stops warming.
<br>

When it refreshes

flowchart TD
    due["90% of the cache time is over"] --> rule{"Expected saving<br/>is $0.05 or more?"}
    rule -- No --> skip["No refresh"]
    rule -- Yes --> idle{"Is the session<br/>idle?"}
    idle -- "No, a turn runs" --> send["Refresh"]
    idle -- Yes --> left{"Idle refreshes left?"}
    left -- Yes --> send
    left -- No --> skip

A refresh is due at 90% of the cache time, and it must pass the rule from Pi:

chance of another request before expiry × extra cost to write the prefix again − refresh cost ≥ $0.05

The chance is 100% while a turn runs and 15% while the session is idle. So each model has a break-even prompt size, and a smaller prompt gets no refresh. The stop reason shows both sizes.

While the session is idle, each cache time gets at most its idle limit of refreshes after the last prompt. The limit is 0 to 20, 5 by default, set on the Global page or in cache-warmer.idle5m and cache-warmer.idle1h. While a turn runs, warming stops 60 minutes after the last prompt, or after two cache times if that is longer.

Warming also stops after compaction, /clear, a model change, a failed or expired refresh, or a timer that fired too late. The next request starts it again.

<br>

Debug mode

While debug mode is on, the newest refreshes show under the menu with their age, result, tokens, cost, and estimated saving. The mod also appends one JSON line per refresh and per stop to <config>/cache-warmer/debug/<session id>.jsonl, where <config> is CLAUDE_CONFIG_DIR or ~/.claude.

⚠️ The mod cannot see /rewind. After a rewind, refreshes keep the later prefix warm until the next request.

<br>

What it sends and stores

The mod sends each refresh automatically. Each refresh is a fork of the main conversation's last request, sent to the same model with this prompt:

Prompt cache refresh. Reply with the single word ok.

| | | |---|---| | Sends | Only the refresh requests. No other network requests and no telemetry. | | Bills | Each refresh counts against your Claude plan or API key, like any request. | | Sets | CLAUDE_CODE_PROMPT_CACHE_TTL for the running Claude Code process | | Stores | All-time totals in the plugin store, one notice row per refresh in the transcript, and the debug log while debug mode is on | | Stops | Set both idle limits to 0 to stop idle refreshes. Disable the plugin to stop all refreshes. |

<br>

Credits

The refresh timing, the $0.05 rule, and the idea of an idle limit come from the cache warmer in Pi by Mario Zechner. cache-warmer ports them to a Claude Code mod and counts idle refreshes instead of stopping at 30 minutes. It copies no Pi code.

Support

Report problems at github.com/paulbkim-dev/claude-code-cache-warmer/issues. cache-warmer is released under the MIT License.

비슷한 프로젝트