ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 MohabYasser2

Claude Code模組

Claude Code的三個模組。我讓 Claude 審核我上次的 30 Claude Code 會話,並告訴我的時間都花在哪裡了。每個模組都會回答它發現的一件事。 |模組 |它有什麼作用 |審計發現了什麼 | |---|---|---| |快取帶|顯示提示快取的溫暖程度,在你離開時保持溫暖,並以 400K 權杖壓縮長對話 |我的快取變冷了 91---|---|---| |快取帶|顯示提示快取的溫暖程度,在你離開時保持溫暖,並以 400K 權杖壓縮長對話 |我的快取變冷了 91Z AQ Git 同步帶 |XZ 7、3KQZAQ | 1,660 手動完成 git 檢查 | |偵察路由器|執行僅探索、閱讀或研究 Sonnet 的子代理 | 309 子代理的 243 在 Opus 上執行 |它們在 Claude Code 的函數鉤子上執行。這些都處於早期存取階段,因此 API 可能會在版本之間發生變化。我在 Claude Code 2.1.286 和 2.1.287 上建置並測試了它們。

MohabYasser2@MohabYasser2

MohabYasser2/claude-code-mods/tree/main/cache-band

已翻譯

關於這個 mod

Claude Code模組

Claude Code的三個模組。我讓 Claude 審查我上次的 30 Claude Code 會話,並告訴我的時間都花在哪裡了。每個模組都會回答它發現的一件事。

|模組 |它有什麼作用 |審計發現了什麼 | |---|---|---| | [快取帶](快取帶)|顯示提示快取的溫暖程度,在你離開時保持溫暖,並以 400K 權杖壓縮長對話 |我的快取變冷了 91 次 | | Git 同步帶 |分支、ahead/behind 和在提示上方更改的文件,帶有“拉取”、“文件”和“提交”按鈕 | 1,660 手動完成 git 檢查 | | 偵察路由器 |執行僅探索、閱讀或研究 Sonnet 的代理程式 | 309 代理程式的 243 在 Opus 上執行 |

它們在 Claude Code 的函數鉤子上執行。這些都處於早期存取階段,因此 API 可能會在版本之間發生變化。我在 Claude Code 2.1.286 和 2.1.287 上建置並測試了它們。

安裝

1。將 mod 的資料夾複製到 ~/.claude/skills/ 中,例如 ~/.claude/skills/cache-band。 2。新會話加載它。在已開啟的會話中,執行 /reload-plugins。

要在加載 mod 之前檢查它或執行其測試:

claude plugin validate ~/.claude/skills/cache-band
claude plugin test ~/.claude/skills/cache-band

當 Claude Code 載入 mod 時,它會將 claude-code 類型宣告寫入 tsconfig.json 指向的 mod 的 .claude-plugin/types 資料夾中。該資料夾在這裡被 git 忽略。

快取帶

每個訊息都會重讀整個對話。提示快取保持便宜:快取讀取成本約為正常輸入價格的十分之一。根據我的計劃,快取條目在上次讀取後會保留一個小時。一旦變冷,下一則訊息就會再次將整個對話寫入緩存,一小時的快取寫入成本是輸入價格的兩倍。在 400K 對話中,這一點加起來。

樂團位於提示上方:隨著小時和分鐘的流逝,火焰冷卻成雪花,兩個切換按鈕和一個緊湊按鈕。

**自動快取。 ** 在快取變冷之前十分鐘,它會對它執行 ping 操作。 ping 會通過 $.model.fork,它會從後台副本再次發送對話的最後一個請求,最後有一行保持活動狀態。該副本是同一對話的逐字逐句,因此 API 從同一快取中提供服務,並且該讀取將快取再保留一個小時。回覆將被刪除,並且你的聊天中不會添加任何內容。在聊天中輸入「hi」也會讓快取保持溫暖,但它會永遠保留在對話中,Claude可能會對其採取行動。

它在 20 連續 ping 後停止。 ping 會讀取快取 (0.1x),冷重啟會寫入快取 (2x),因此 20 ping 的成本約為它們阻止的重新啟動的成本,大約在 16 小時內。你的下一則訊息會再次啟動它。如果 ping 發現快取已消失,自動快取將暫停,而不是每小時支付全額。**自動壓縮。 ** 一旦對話傳遞 400K 權杖,即在 Claude 回復之後,並且快取仍處於熱狀態,它就會進行壓縮,因此讀取對話以獲取摘要的成本很低。

**緊湊。 ** 此按鈕執行 /compact 就像你鍵入它一樣。桌面應用程式拒絕 mod 的直接壓縮調用,因此這是在那裡工作的路線。

28 測試涵蓋儀表、ping 和自動緊湊型。

Git 同步帶

提示上方的條帶包含分支、領先或落後的距離、更改的檔案以及上次推送的時間。它每分鐘讀取一次 git status 並每五次獲取一次,沒有憑證提示,也沒有取得 git 的索引鎖定。

在提示之前,當不會丟失任何東西時,它會用 --ff-only 拉取,並告訴 Claude 進來了什麼,或者為什麼沒有任何反應。直接從 band 拉取、文件和提交並推送執行 git。它不會提交看起來像秘密的文件。

5 測試涵蓋樂團的佈局和提交流程。

偵察路由器

當 Claude 啟動代理程式時,Scout Router 會讀取其類型和描述。探索代理和通用代理,其描述是關於探索、閱讀、搜尋或研究,在 Sonnet 上執行。任何有關計劃、審核、審查或評分的內容都保留在主模型上。每次重新路由都會被記錄。

許可證

麻省理工學院

安裝

請先查看作者 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

  1. Copy a mod's folder into ~/.claude/skills/, for example ~/.claude/skills/cache-band.
  2. 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

更多類似作品