bcanozgur/cc-side-context

一位 Reddit 作者发布了 cc-side-context,一个 Claude Code 插件,它会显示一个侧边窗格,拆解是什么在消耗你的上下文窗口:最大的输出、每项占用多少,以及提示词缓存何时过期。它还增加了一个紧凑变体,会保留早期指令;以及一个防护机制,如果某个文件此前曾大幅撑大上下文,就会挡下一次重复的文件读取。
bcanozgur/cc-side-context

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
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 或网站,链接回本页。