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

cache-watch

프롬프트 캐시가 따뜻하게 유지되는 시간을 보여 주고 큰 컨텍스트를 압축하는 것이 이득인 순간에 압축을 제안합니다.

MichaelP17@MichaelP17

MichaelP17/claude-mods/tree/main/cache-watch

번역 완료

이 mod 소개

상태 줄에서 프롬프트 캐시의 온기를 추적하는 Claude Code 모드입니다. 설정 가능한 컨텍스트 크기를 넘으면 비용이 큰 캐시 재구축 전에 컨텍스트를 줄일 수 있도록 Compact, Write handoff, Dismiss를 제공합니다. 서버 응답에서 실제 캐시 수명을 학습해 만료 전에 경고하고 저장소 루트의 HANDOFF.md에서 새 세션을 시작할 수도 있습니다.

설치

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

claude plugin marketplace add MichaelP17/claude-mods
claude plugin install cache-watch
원문 / README

cache-watch

Shows how long the prompt cache stays warm and suggests compacting a large context at the moments where it pays off.

Every model request re-sends the whole conversation. The prompt cache makes that cheap, but it expires a fixed time after the last request — one hour in Claude Code, five minutes under usage overage. A request on an expired cache re-reads the entire context at the cache write price, which on a large context is the most expensive single request of a session. This mod keeps that moment visible and offers to shrink the context before it happens.

Status line

| Line | Meaning | | --- | --- | | cache 42m · ctx 250k | Warm for another 42 minutes; the last request carried 250k tokens | | cache cold · ctx 250k | Expired; the next request rebuilds the cache over the whole context | | cache rebuilds · ctx 90k | A compaction just ran; the next request writes the cache for the smaller context |

The line only appears when there is something to decide: from statusFromTokens of context on, or while the cache is about to expire. A small context on a cold cache shows nothing.

The timer starts over with every model request of the main conversation, including the steps Claude takes on its own between tool calls. Subagents have a cache of their own and do not count.

Suggestions

From largeContextTokens of context on, a band above the prompt offers Compact, Write handoff and Dismiss:

| When | Why then | | --- | --- | | The cache expires in warnMinutes and you are idle | Compacting on a warm cache reads the context at the cache read price | | A turn committed or ran tests green | A unit of work ended; nothing in flight gets lost |

A running turn is never interrupted.

Write handoff sends a prompt that asks Claude to write HANDOFF.md at the repository root: goal, state, decisions with their reasons, rejected approaches, open points and the exact next step.

When a conversation starts in a repository that has a HANDOFF.md, a toast names it and Claude is told where it lies, so asking it to continue is enough for the next session. Only the path is added to the context, not the file's content.

When you send a prompt on a cold cache with a large context, a dialog asks whether to compact first. The rebuild is paid either way; compacting first pays it on the smaller remainder.

Lifetime learned from the server

The server reports with every response how much of the prompt came from the cache. When a request finds nothing cached although the timer still ran, the mod switches to a five-minute lifetime; when a request is served from the cache after more than five minutes, it switches back. Prompts under 20k tokens teach nothing, since they may be too short to be cached at all.

Configuration

| Option | Default | Meaning | | --- | --- | --- | | ttlMinutes | 60 | Cache lifetime Claude Code uses | | warnMinutes | 10 | How early before expiry to suggest compacting | | statusFromTokens | 300000 | Context size from which the status line shows | | largeContextTokens | 300000 | Context size from which the mod suggests compacting |

Change them in /config, or in ~/.claude/settings.json under pluginConfigs["cache-watch"].options.

Works with compact-shaper

Compact runs a normal compaction. With compact-shaper loaded, its summary follows the structure of a handoff.

Uninstall

Remove the mod from CLAUDE_CODE_PLUGIN_DIRS. Its options in pluginConfigs can be deleted.

동명의 다른 작품

비슷한 프로젝트