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

optimaizr

一個 Claude Code 外掛,在載入動畫和提示列中即時顯示每輪成本及 5 小時方案用量,套用來自 `optimaizr live` 的模型/工作量切換,在對話快取過期前倒數,提供 `/optimaizr handoff` 筆記,並防止重試迴圈——全部在本機執行。

blendbunjaku@blendbunjaku

blendbunjaku/optimaizr/tree/main/mods/optimaizr

已翻譯

關於這個 mod

optimAIzr 將你的工作階段成本直接顯示在 Claude Code 介面中:載入動畫顯示目前輪次的成本和視窗填充,提示符上方的橫幅顯示方案視窗狀態和重設時間,每個回答都會獲得一行成本摘要。/optimaizr 列印工作階段支出和節省以及方案視窗,/optimaizr hud 繪製儀表和迷你圖,/optimaizr handoff 讓 Claude 寫一個簡短筆記,以便新對話無需重新閱讀舊對話即可開始。它還會在快取過期前倒數並發出成本警告,並在兩次相同失敗後保持命令不變以打破重試迴圈。在 optimaizr live 中接受的切換(模型或工作量)從下一個請求開始套用於執行中的工作階段。安裝:/plugin marketplace add blendbunjaku/optimaizr 然後 /plugin install optimaizr@optimaizr。需要 Claude Code 2.1.287+。除了透過你自己的工作階段發出的交接請求外,完全在本機執行。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add blendbunjaku/optimaizr
claude plugin install optimaizr@optimaizr
原文 / README

optimAIzr for Claude Code

A Claude Code mod from optimAIzr. It puts what your session costs where you work, lets optimaizr live switch the model or effort of the session you are in, and shows what each switch saved.

/plugin marketplace add blendbunjaku/optimaizr
/plugin install optimaizr@optimaizr

Needs Claude Code 2.1.287 or later.

What it adds

  • The spinner shows what the turn has cost so far and how full your 5-hour window is: Thinking · $0.18 · 61% of 5h…
  • The band above the prompt shows the window, how long it lasts at this pace and when it resets: 61% of 5h · ~2h 25m left at this pace · resets 01:00
  • Each answer gets one line: optimaizr: this turn $0.18 · 4 requests · 5h 55% → 56%
  • What a switch saved: a switched turn's line leads with it, e.g. saved $0.10 vs Opus 5.5 · this turn $0.10 on Sonnet 5.5 · …, and the band keeps a running total. It is the same tokens priced on both models.
  • /optimaizr prints the session's spend, what it saved, both plan windows and any switch. /optimaizr hud shows it as gauges and a sparkline.
  • Switches that pay: subagents switch at once; a long conversation waits until reloading it into the new model pays back, and the band says so.
  • Before the cache expires: Claude Code caches the conversation for an hour. Once it carries 50K tokens or more, the band counts down the last 15 minutes, cache warm 10m more, then 300K is written again ($2.40), and one toast comes 5 minutes before. After it expires, the band says what the next message will cost. Past 200K, it says what each request re-reads.
  • /optimaizr handoff: Claude writes a three-line note (done, next, the file to start from) while the cache is still warm, so it costs cents. /clear, and the next conversation in that project starts from the note instead of re-reading the old one. A note is used once and expires after 12 hours.
  • A guard against retry loops: when the same command fails twice in a row with nothing changed, the next identical attempt is held once and Claude is asked to change something first.
  • Switches. Press Y on a model swap in optimaizr live and running sessions in that project use the new model from their next request. A reasoning-effort finding lowers effort the same way. The first switched request leaves a note, and the band names the model. Harder task? /optimaizr off goes back for this session, /optimaizr on resumes, and optimaizr undo <rule> takes it back everywhere.

Options

| Option | Default | What it does | | ------------ | ------- | --------------------------------------------- | | turnLine | true | The line under each answer with what it cost. | | retryGuard | true | Hold a command that failed twice unchanged. |

Privacy

It reads the usage figures Claude Code already shows you (cost, token counts, context fill, plan windows) and the commands Claude runs, kept in memory for the retry guard. It never reads your prompts or file contents and makes no network calls of its own. It reads ~/.optimaizr/overrides.json and writes one small file per session to ~/.optimaizr/mod/sessions, which is how optimaizr live knows it is running. That file also carries Claude Code's own 5-hour and weekly meters, so optimaizr profile and optimaizr live can show your real windows. /optimaizr handoff is the one exception to "no text": only when you run it, it asks Claude for a note through your own session and saves the reply to ~/.optimaizr/mod/handoffs, one file per project, which the next conversation there reads once. Nothing leaves your machine besides that one request to Claude. claude plugin validate on this folder lists every call it makes.

Develop

claude --plugin-dir mods/optimaizr     # reloads on save
claude plugin validate mods/optimaizr
claude plugin test mods/optimaizr

The tests were last run on Claude Code 2.1.286, where mods still needed CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1. From 2.1.287 they are on by default.

更多類似作品