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

做了一個 Claude Code 模組,顯示究竟是什麼在佔用你的上下文

一位 Reddit 作者發布了 cc-side-context,一個 Claude Code 外掛,它會顯示一個側邊窗格,拆解是什麼在消耗你的上下文視窗:最大的輸出、每項佔用多少,以及提示詞快取何時到期。它還增加了一個緊湊變體,會保留早期指示;以及一個防護機制,如果某個檔案先前曾大幅撐大上下文,就會擋下一次重複的檔案讀取。

已翻譯

關於這個 mod

cc-side-context 是一個 MIT 授權的 Claude Code 模組,可透過 /plugin marketplace add bcanozgur/cc-side-context 和 /plugin install cc-side-context@cc-side-context 安裝。它會在聊天旁呈現一個窗格(以及提示框上方一個可選的小列),列出最大的上下文消耗者、其大小與提示詞快取到期時間,並透過新的 function-hooks mods API 與 TSX 渲染的 UI,在終端機和桌面應用程式中運作。功能包括緊湊模式,其摘要會保留早期的使用者指示;以及一個需選擇啟用的防護機制,當某個檔案先前曾大幅增加上下文時,會略過該檔案的一次讀取,若 Claude 再次要求,則讓讀取通過。需要 Claude Code 2.1.287+(桌面應用程式 2.1.286)。作者指出它在本機執行,僅在透過 /context 使用的同一 API 取得精確 token 數時才會連上網路。

安裝

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

claude plugin marketplace add bcanozgur/cc-side-context
claude plugin install cc-side-context@cc-side-context
原文 / README

got annoyed that /context only ever says "conversation 320k" and nothing else. dug into a transcript once and like 60k of it was the same package-lock.json getting read 3 times. so yeah

made a mod that sits next to the chat and just shows that. biggest outputs, how much each one takes, when the cache is gonna expire. theres a small bar above the prompt too if you dont want the whole pane. works in the terminal and the desktop app (left/right in the pic)

the thing i actually use most is c, its compact but it makes the summary keep the stuff i told it early on. compact kept dropping that for me. theres also a guard thing (x) that bounces a file read once if that file already blew up your context before. if claude asks again it just goes through so it never really blocks you
needs claude code 2.1.287 or newer, desktop app 2.1.286

/plugin marketplace add bcanozgur/cc-side-context

/plugin install cc-side-context@cc-side-context

built the whole thing in claude code sessions, mostly me describing what i wanted to see and claude writing the hooks + pane. it uses the new mods api (function hooks) so the pane is just tsx that claude code renders, same file draws in the terminal and the desktop app. biggest pain was the desktop side, the layout there is real html boxes not terminal cells so stuff that looked fine in iterm broke at narrow widths, took a bunch of rounds with screenshots back and forth

stuff i learned along the way: 4 chars per token is way off for non english text, turkish/accented stuff is closer to 2 and cjk is ~1, so my first estimates were lying. the 5h/7d usage only shows up with an api response so you cant really show it on startup without caching stale numbers (i chose not to). and the prompt cache is 1h on a sub but drops to 5m once youre on usage credits, which i didnt know

free and MIT, runs locally, doesnt send anything anywhere except when you ask for an exact token count (same api /context uses)

https://github.com/bcanozgur/cc-side-context

lmk if something breaks

取得徽章

這是你的專案嗎?把這個徽章放進 README 或網站,連回本頁。

Featured on ClaudeMods
尺寸
配色
Markdown
HTML

更多類似作品