MohabYasser2/claude-code-mods/tree/main/cache-band
Claude Code 모드
Claude Code의 세 가지 모드. 저는 Claude에게 마지막 30 Claude Code 세션을 감사하고 시간이 어디로 갔는지 알려달라고 요청했습니다. 각 모드는 발견한 한 가지에 답합니다. | 모드 | 그것이 하는 일 | 감사 결과 | |---|---|---| | 캐시밴드 | 프롬프트 캐시가 얼마나 따뜻한지 보여주고, 자리를 비운 동안에도 따뜻하게 유지하며, 긴 대화를 400K 토큰으로 압축합니다 | 내 캐시가 91번 냉각되었습니다 | | Git 동기화 밴드 | Pull, Files 및 Commit & push 버튼을 사용하여 프롬프트 위의 분기, before/behind 및 변경된 파일 | 직접 수행한 1,660 git 검사 | | 스카우트 라우터 | Sonnet | 309 하위 에이전트의 243가 Opus에서 실행됨 | Claude Code의 함수 후크에서 실행됩니다. 이는 초기 액세스 단계이므로 릴리스 간에 API가 변경될 수 있습니다. Claude Code 2.1.286 및 2.1.287에서 이를 구축하고 테스트했습니다.
이 mod 소개
Claude Code 모드
Claude Code의 세 가지 모드. 저는 Claude에게 마지막 30 Claude Code 세션을 감사하고 시간이 어디로 갔는지 알려달라고 요청했습니다. 각 모드는 발견한 한 가지에 답합니다.
| 모드 | 그것이 하는 일 | 감사 결과 | |---|---|---| | 캐시밴드 | 프롬프트 캐시가 얼마나 따뜻한지 보여주고, 자리를 비운 동안에도 따뜻하게 유지하며, 긴 대화를 400K 토큰으로 압축합니다 | 내 캐시가 91번 냉각되었습니다 | | Git 동기화 밴드 | Pull, Files 및 Commit & push 버튼을 사용하여 프롬프트 위의 분기, before/behind 및 변경된 파일 | 직접 수행한 1,660 git 검사 | | 스카우트 라우터 | Sonnet | 309 하위 에이전트의 243가 Opus에서 실행되었습니다 |
Claude Code의 함수 후크에서 실행됩니다. 이는 초기 액세스 단계이므로 릴리스 간에 API가 변경될 수 있습니다. Claude Code 2.1.286 및 2.1.287에서 이를 구축하고 테스트했습니다.
설치
- 모드 폴더를
~/.claude/skills/에 복사하세요(예:~/.claude/skills/cache-band). - 새 세션이 이를 로드합니다. 이미 열려 있는 세션에서
/reload-plugins를 실행합니다.
모드를 로드하기 전에 확인하거나 테스트를 실행하려면:
claude plugin validate ~/.claude/skills/cache-band
claude plugin test ~/.claude/skills/cache-band
Claude Code는 모드를 로드할 때 claude-code 유형 선언을 tsconfig.json가 가리키는 모드의 .claude-plugin/types 폴더에 기록합니다. 해당 폴더는 여기서 git 무시됩니다.
캐시밴드
모든 메시지는 전체 대화를 다시 읽습니다. 프롬프트 캐시는 이를 저렴하게 유지합니다. 캐시 읽기 비용은 일반 입력 가격의 약 십분의 1입니다. 내 계획에 따르면 캐시 항목은 마지막으로 읽은 후 한 시간 동안 유지됩니다. 일단 차가워지면 다음 메시지는 전체 대화를 다시 캐시에 기록하며, 1시간 캐시 쓰기 비용은 입력 가격의 두 배입니다. 400K 대화에서 그것은 합산됩니다.
밴드는 프롬프트 위에 위치합니다. 시간, 남은 분, 두 개의 토글 및 컴팩트 버튼이 지나면 불꽃이 눈송이로 식어갑니다.
자동 캐시. 캐시가 냉각되기 십분 전에 핑을 보냅니다. 핑은 $.model.fork를 통과하여 마지막에 한 줄의 연결 유지와 함께 백그라운드 복사본에서 대화의 마지막 요청을 다시 보냅니다. 사본은 단어 그대로 동일한 대화이므로 API는 동일한 캐시에서 사본을 제공하고 해당 읽기는 캐시를 한 시간 더 유지합니다. 답변이 삭제되고 채팅에 아무것도 추가되지 않습니다. 채팅에 "안녕"을 입력하면 캐시도 따뜻하게 유지되지만 대화에는 영원히 남아 있으므로 Claude가 그에 따라 조치를 취할 수도 있습니다.
연속으로 20 핑을 보낸 후 중지됩니다. 핑은 캐시를 읽고(0.1x) 콜드 재시작은 캐시에 씁니다(2x). 따라서 20 핑은 16 시간쯤에 다시 시작을 방지하는 비용에 대해 비용이 듭니다. 다음 메시지가 다시 시작됩니다. 핑을 통해 캐시가 이미 사라진 것을 발견하면 매시간 전체 가격을 지불하는 대신 자동 캐시가 일시 중지됩니다.자동 압축. Claude의 응답 직후에 대화가 400K 토큰을 통과하면 캐시가 여전히 따뜻한 상태에서 압축되므로 요약을 위해 대화를 읽는 비용이 저렴합니다.
Compact. 버튼을 입력한 것처럼 /compact가 실행됩니다. 데스크톱 앱은 모드의 직접 압축 호출을 거부하므로 이 경로가 해당 경로에서 작동합니다.
28 테스트에서는 게이지, 핑 및 자동 컴팩트를 다룹니다.
Git 동기화 밴드
브랜치가 있는 프롬프트 위의 밴드, 앞 또는 뒤의 거리, 변경된 파일 및 마지막으로 푸시한 시간. 자격 증명 프롬프트나 git의 인덱스 잠금을 사용하지 않고 1분마다 git 상태를 읽고 5분마다 가져옵니다.
프롬프트가 표시되기 전에 아무것도 잃을 수 없을 때 --ff-only를 가져오고 Claude에게 무엇이 들어왔는지 또는 왜 아무 것도 안 되었는지 알려줍니다. 풀, 파일, 커밋 및 푸시 실행 git을 밴드에서 바로 실행하세요. 비밀처럼 보이는 파일은 커밋하지 않습니다.
5 테스트는 밴드의 레이아웃과 커밋 흐름을 다룹니다.
스카우트 라우터
Claude가 하위 에이전트를 시작하면 Scout Router는 하위 에이전트의 유형과 설명을 읽습니다. 탐색, 읽기, 검색 또는 조사에 관한 설명을 제공하는 탐색 에이전트 및 범용 에이전트는 Sonnet에서 실행됩니다. 계획, 감사, 검토 또는 등급 지정에 관한 모든 것이 기본 모델에 유지됩니다. 각 재라우팅이 기록됩니다.
라이센스
MIT
설치
먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.
claude plugin marketplace add MohabYasser2/claude-code-mods claude plugin install cache-band
원문 / README
Claude Code mods
Three mods for Claude Code. I asked Claude to audit my last 30 Claude Code sessions and tell me where my time went. Each mod answers one thing it found.
| Mod | What it does | What the audit found | |---|---|---| | Cache Band | Shows how warm the prompt cache is, keeps it warm while you're away, and compacts long conversations at 400K tokens | My cache went cold 91 times | | Git Sync Band | Branch, ahead/behind and changed files above the prompt, with Pull, Files and Commit & push buttons | 1,660 git checks done by hand | | Scout Router | Runs subagents that only explore, read or research on Sonnet | 243 of 309 subagents ran on Opus |
They run on Claude Code's function hooks. Those are in early access, so the API can change between releases. I built and tested these on Claude Code 2.1.286 and 2.1.287.
Install
- Copy a mod's folder into
~/.claude/skills/, for example~/.claude/skills/cache-band. - New sessions load it. In a session that was already open, run
/reload-plugins.
To check a mod before you load it, or to run its tests:
claude plugin validate ~/.claude/skills/cache-band
claude plugin test ~/.claude/skills/cache-band
When Claude Code loads a mod, it writes the claude-code type declarations into the mod's .claude-plugin/types folder, which tsconfig.json points at. That folder is git-ignored here.
Cache Band
Every message re-reads the whole conversation. The prompt cache keeps that cheap: a cache read costs about a tenth of the normal input price. On my plan a cache entry lives for an hour after it was last read. Once it goes cold, the next message writes the whole conversation into the cache again, and a one-hour cache write costs twice the input price. On a 400K conversation, that adds up.
The band sits above the prompt: a flame that cools into a snowflake as the hour runs out, the minutes left, two toggles and a Compact button.
Auto cache. Ten minutes before the cache would go cold, it pings it. The ping goes through $.model.fork, which sends the conversation's last request again from a background copy, with a one-line keep-alive at the end. The copy is word for word the same conversation, so the API serves it from the same cache, and that read keeps the cache for another hour. The reply is dropped and nothing is added to your chat. A "hi" typed into the chat would keep the cache warm too, but it stays in the conversation for good, and Claude might act on it.
It stops after 20 pings in a row. A ping reads the cache (0.1x) and a cold restart writes it (2x), so 20 pings cost about what the restart they prevent would, around 16 hours in. Your next message starts it again. If a ping finds the cache already gone, Auto cache pauses instead of paying full price every hour.
Auto compact. It compacts once the conversation passes 400K tokens, right after Claude's reply, while the cache is still warm, so reading the conversation for the summary is cheap. Why 400K:
- Every message re-reads the whole conversation, so at 830K each message costs about twice what it does at 400K.
- The longer the conversation, the more Claude misses (Chroma's context rot study).
- Compacting too early summarizes a long task halfway through, and details get lost. Anthropic's API compaction defaults to 150K (docs). Claude Code's own auto-compact waits until about 83% of the window, around 830K on a 1M window.
- 400K is twice the old 200K window, so a long task fits in one go, at under half the per-message cost of 830K.
Compact. The button runs /compact as if you typed it. The desktop app refuses a mod's direct compaction call, so this is the route that works there.
28 tests cover the gauge, the pings and Auto compact.
Git Sync Band
A band above the prompt with the branch, how far ahead or behind it is, the changed files and when you last pushed. It reads git status every minute and fetches every five, with no credential prompts and without taking git's index lock, so it never gets in the way of Claude's own git.
Before your prompt, it pulls with --ff-only when that can't lose anything, and tells Claude what came in, or why nothing did. Pull, Files and Commit & push run git straight from the band, without a turn in the chat. Commit & push writes the message with one small model call and shows it to you before anything runs. It won't commit files that look like secrets (.env files, keys, credentials).
5 tests cover the band's layouts and the commit flow.
Scout Router
When Claude starts a subagent, Scout Router reads its type and description. Explore agents, and general-purpose agents whose description is about exploring, reading, searching or researching, run on Sonnet. Anything about planning, auditing, reviewing or grading stays on the main model. Agents that write code stay there too, unless you set the plugin's builders option to sonnet. Haiku requests are left alone, since Haiku is already cheaper. Each reroute is logged.
License
MIT
