usage 0.29.15
新功能 4 項
壞掉的快取先隔離,留下查問題的線索
某次用量數字看起來不對時,壞掉的快取(把查過結果暫存起來直接用的資料)現在不會立刻被刪光。Antigravity、Codex 與 history 三種快取遇到讀不懂的檔案,仍會重新計算以便繼續使用,但會先把原檔移到 ~/.usage/quarantine/,讓你日後還能檢查出了什麼問題。每個檔名帶毫秒時間戳,第二次故障不會蓋掉第一次;隔離區最多留十個檔案,每個最多 5 MB。這像醫院把破損的檢體先放進證物袋,再重新採樣,而不是直接丟進垃圾桶。只有過期的 schema_version 不會被隔離,因為那是正常升級;每個快取有 32 個分片,一次升版若全送進隔離區,反而會擠掉真正的故障證據。
官方原文
**A corrupt disk cache is preserved instead of being deleted outright.** All three caches — Antigravity, Codex and history — dealt with an unreadable file by removing it and recomputing. That is the right recovery, but it also destroys the only evidence of what went wrong, so a later report of "my numbers look off" has nothing left to inspect. A damaged file is now moved to ~/.usage/quarantine/ first, named with a millisecond timestamp so a second failure cannot overwrite the first, capped at ten files and 5 MB each. A stale schema_version is *not* quarantined: that is an ordinary upgrade, and with 32 shards per cache one version bump would flush the whole budget and push the real evidence out. The quarantine helper swallows every error it can hit — it is a side service and must never take the caller down with it.
Windows 的系統匣測試會寫入真實偏好設定
Windows 開發者跑系統匣(Windows 工作列角落放背景程式圖示的區域)測試後,自己的面板偏好曾被悄悄改掉。兩個測試都會呼叫 switch_panel() 切換面板;這個動作接著透過 _save_active_panel_id() 寫入偏好檔,但測試沒有把 prefs.PREFERENCES_FILE 改指向暫存位置,於是實際碰到的是 ~/.claude/usage-preferences.json。換句話說,測試本來該在模型屋裡搬家具,卻走進你的家改了客廳。
官方原文
**Two Windows tray tests wrote into the real ~/.claude/usage-preferences.json.** Both call switch_panel(), which persists through _save_active_panel_id(), and neither patched prefs.PREFERENCES_FILE — so running the suite silently changed the developer's own active panel.
四種 README 翻譯都有人守,不再只盯繁中
英文 README 多加一節時,簡體中文、日文和韓文版現在也會被檢查有沒有跟上。原本 check_doc_parity.py 只比對英文與繁中 README,其他三份翻譯沒有自動守門員,只能靠 CLAUDE.md 裡的手動提醒。現在每一種翻譯各自和英文比較,若落後,錯誤訊息會直接點出是哪個檔案。它比的是 ## 標題的數量,不是標題文字本身:譯者仍可用自然的語言改寫標題,不必逐字照翻。這像展覽入口只數每個語言版有沒有同樣多扇展廳門,而不強迫門牌翻成同一串字;少了一扇門才提醒你回頭補。
官方原文
**The documentation parity check covers Simplified Chinese, Japanese and Korean.** check_doc_parity.py only compared English against Traditional Chinese, leaving the other three README translations unwatched; CLAUDE.md had to carry a note to sync them by hand. Each translation is now compared on its own and the failure message names the file that drifted. The comparison is still a count of ## headings rather than their text — matching text would force translators to mirror English headings word for word, which is what makes translated docs read badly.
本機安裝有了腳本,選單列不再默默跑舊版
你剛做完本機 build(編譯完成、可執行的程式版本),標上 release tag 並不會自動換掉 /Applications 裡正在跑的 App。過去這一步只寫在檢查清單,曾讓選單列連續六個版本仍開著舊 build。現在要在本機安裝時,直接執行 scripts/install_local.sh:它先確認 build 存在,印出新舊兩個版本,等待正在執行的 App 結束,再替換檔案,最後核對已安裝版本是否相同。這像買了新燈泡卻只把盒子放在門口;打上標籤不等於已裝進燈座。腳本把拆舊燈、裝新燈和開燈確認串起來,讓本機副本跟著更新。
官方原文
**scripts/install_local.sh replaces the hand-typed steps for installing a build locally.** Releasing does not touch /Applications: the tag drives CI, and the local copy keeps running whatever was already there. That last step lived only in a checklist, and the menu bar once ran a stale build for six versions before anyone noticed. The script checks the build exists, prints both versions, waits for the running app to exit, swaps it, and verifies the installed version matches.
修正 2 項
中文、日文、韓文的用量估算不再少算四倍
你拿中文、日文或韓文檔案檢查浪費的用量時,以前看到的數字其實少算了四倍。診斷工具把所有文字都當成四個字元才算一個 token(AI 處理文字量的單位),這套演算法適合 ASCII 文字,卻不適合 CJK 文字:一個中日韓字大約就是一個 token。現在它會把中日韓字逐一計算,其餘文字仍以四個字元估算,所以浪費的 token 與由此算出的費用不會再縮成四分之一。這像秤蔬菜時把每四顆番茄才當一顆,秤重結果當然偏低;秤法改正後,數字才接近實際重量。工具仍在離線運作,沒有為了追求細微的取整誤差加入特定模型的 tokenizer。
官方原文
**Token estimates no longer undercount CJK text by a factor of four.** Six places in the waste diagnosis converted characters to tokens with chars // 4, which is the ASCII ratio. A CJK character is roughly one token, not a quarter of one, so every figure the diagnosis reported for a Chinese, Japanese or Korean file — wasted tokens and the cost derived from them — came out at a quarter of the truth. This project reads its own i18n.json, CLAUDE.md and README.zh-TW.md often enough to hit this on itself. The estimate now counts CJK codepoints as one token each and everything else at four characters per token. No tokenizer dependency was added: this is an offline tool, and pulling in a model-specific tokenizer to chase rounding-level accuracy is not a trade worth making.
--doctor 會分清楚「缺檔」與「根本用不到」
跑 --doctor 檢查安裝狀態時,看到 forwarder script: [missing] 不必再先以為出錯。以前報告把十四項檢查攤成一張清單,即使你目前的模式根本不用 forwarder script(負責轉送資料的腳本),它也照樣標成 missing。現在結果分成 [core]、[hook] 與 [optional] 三組;不需要轉送腳本的模式會直接寫 [not needed in <state> mode]。這像健康檢查把必做檢驗、加選檢驗和不適用項目分欄,而不是把所有未做項目都標紅。檢查的判斷規則沒有改,改的是報告把情境講清楚的方式;真正缺少目前模式會用到的檔案,仍會顯示為問題。
官方原文
**--doctor no longer reports a missing file that the current mode does not use.** The report listed fourteen checks as one flat list, so forwarder script: [missing] read as a fault even when the installed mode never needs that script. It is now grouped into [core], [hook] and [optional], and the forwarder line says [not needed in <state> mode] when that is the case. None of the check logic changed.