oMaN-Rod/claude-code-widgets/tree/main/plugins/diff-widget
關於這個 mod
Claude Code Widgets
顯示在 Claude Code 提示列下方的小卡片,也可以在全螢幕模式中停駐在 transcript 旁邊。每個 widget 都是獨立的 mod,透過斜線指令切換。
它起初只有幾個實用 widget(脈絡、用量、檔案樹),後來越做越多:現在共有 61 個 widget,從 git status 和工作階段計時器,到像素螃蟹、地牢探險和 Tetris。
安裝
加入市集,接著安裝版面外掛和你想要的 widget:
/plugin marketplace add oMaN-Rod/claude-code-widgets
/plugin install widgets@claude-code-widgets
/plugin install context-widget@claude-code-widgets
每個 widget 都需要 widgets,也就是負責放置卡片的版面外掛。
需要支援 mod(function hook)的 Claude Code 版本。mod API 目前是 early access,版本更新之間可能會變更。
Widget
版面
每個 widget 都需要。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| widgets | /widgets [side\\|above\\|below\\|close\\|<columns>\\|width <widget> <columns\\|reset>] | 將卡片放在提示列下方、上方,或全螢幕模式的 transcript 旁邊 |
工作階段
Claude 正在做什麼,以及這要花多少成本。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| context-widget | /context-widget [auto\\|detailed\\|grid\\|top\\|bar\\|line] | 用堆疊列顯示脈絡視窗,每種 /context 類別使用一種顏色 |
| usage-widget | /usage-widget | 每個速率限制視窗一條列、重設所需時間和工作階段成本 |
| timer-widget | /timer-widget [on\\|off\\|clear] | 目前工作階段經過的時間,以及上一次、平均值、最長工作階段和迷你折線圖 |
| activity-widget | /activity-widget [on\\|off\\|clear] | 最近的工具呼叫、耗時和是否失敗 |
| tasks-widget | /tasks-widget [on\\|off\\|clear] | Claude 正在處理的工作清單和進度列 |
| checks-widget | /checks-widget [on\\|off\\|clear] | 最近的測試、lint 和建置執行:通過或失敗、耗時以及距今多久 |
| timeline-widget | /timeline-widget [on\\|off] | 把工作階段畫成圖表:時間軸上每次工具呼叫一條橫列,並將並行呼叫疊放 |
| board-widget | /board-widget [on\\|off\\|clear] | Claude 透過 pin 工具自行寫入的狀態板:目標、發現和待解問題 |
| forecast-widget | /forecast-widget [on\\|off\\|clear] | 每個工作階段的脈絡成長圖表,以及壓縮前剩餘的工作階段數 |
| guard-widget | /guard-widget [on\\|off\\|clear] | 本次工作階段的權限檢查:允許、已詢問和拒絕,並顯示一直被問到的內容 |
| stream-widget | /stream-widget [on\\|off] | Claude 撰寫時即時顯示每秒 token 數儀表和迷你折線圖(根據文字長度估算) |
| sessions-widget | /sessions-widget [on\\|off] | 本機其他已開啟的 Claude Code 工作階段:資料夾、分支、忙碌或閒置 |
專案與 git
工作樹狀態。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| file-tree-widget | /file-tree-widget | 專案目錄,點擊即可展開資料夾 |
| git-widget | /git-widget | 分支、領先/落後、已暫存、已變更和未追蹤數量,以及最近一次提交 |
| changes-widget | /changes-widget [on\\|off\\|clear] | 本次工作階段編輯過的檔案,最新的排在前面,並顯示每個檔案的編輯次數 |
| commits-widget | /commits-widget | 本次工作階段開始後建立的提交 |
| todos-widget | /todos-widget | 已追蹤檔案中的 TODO、FIXME、HACK 和 XXX 註解,計數並列出 |
| diff-widget | /diff-widget [on\\|off\\|clear] | 上次編輯的語法高亮差異 |
| watch-widget | /watch-widget [on\\|off\\|run\\|stop]、/watch <command> | /watch bun test 會在每次編輯後重新執行指令:顯示通過或失敗,以及上次失敗的行 |
| map-widget | /map-widget [on\\|off\\|clear] | 已追蹤檔案的像素地圖:Claude 讀過的地方亮藍色,編輯過的地方亮綠色 |
時間與專注
不依賴工作階段的時鐘、計時器和提醒。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| pomodoro-widget | /pomodoro-widget [on\\|off\\|start\\|break\\|stop\\|<minutes>] | 專注計時器、倒數、進度列和已完成工作階段計數 |
| countdown-widget | /countdown-widget [on\\|off\\|clear]、/countdown <HH:MM\\|<n>m\\|<n>h> [label] | 你設定的截止時間剩餘時間、進度列,以及到點時的 toast |
| clocks-widget | /clocks-widget [on\\|off\\|add <zone>\\|remove <zone>\\|clear] | 你當地的時間和加入的時區,例如 Asia/Tokyo |
| notes-widget | /notes-widget [on\\|off\\|clear]、/note <text\\|done <n>> | 跨工作階段保留的釘選筆記;/note <text> 新增一則,/note done <n> 刪除一則 |
| coffee-widget | /coffee-widget [on\\|off\\|refill\\|<minutes>] | 一杯在 90 分鐘內逐漸喝完的咖啡,並提醒你休息 |
場景
會對工作階段、工具呼叫、檢查和脈絡用量做出反應的像素畫。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| pet-widget | /pet-widget [on\\|off\\|<mood>] | 像素螃蟹 Clawd:工作階段進行時工作,工具呼叫失敗時頭暈,測試通過時開心。跨工作階段獲得 XP 並升級;badges-widget 發放徽章後會戴上帽子;開啟兩個工作階段時,會留在你最近提示過的那個工作階段裡 |
| aquarium-widget | /aquarium-widget [on\\|off\\|demo] | 每個正在執行的工具呼叫和代理對應一條魚 |
| skyline-widget | /skyline-widget [on\\|off\\|demo\\|clear] | 每個工作階段一棟樓,每次工具呼叫一層樓 |
| train-widget | /train-widget [on\\|off] | 火車頭在本次工作階段中每次工具呼叫拉一節車廂,顏色代表工具 |
| garden-widget | /garden-widget [on\\|off\\|reset] | 一株植物:每次工具呼叫長一片葉子,檢查通過時開花,呼叫失敗時枯萎 |
| campfire-widget | /campfire-widget [on\\|off\\|stoke] | 工具呼叫越多篝火燒得越旺,閒置時逐漸只剩餘燼 |
| constellation-widget | /constellation-widget [on\\|off\\|clear] | 每個工作階段一顆星,連成星座,達到 9 顆後取得名稱 |
| fireworks-widget | /fireworks-widget [on\\|off\\|demo] | 檢查通過時夜空放煙火,失敗時放出啞炮 |
| invaders-widget | /invaders-widget [on\\|off\\|demo\\|clear] | 每次檢查失敗出現一個入侵者;檢查通過時將它們擊落 |
| weather-widget | /weather-widget [on\\|off\\|live\\|<percent>] | 脈絡有空間時是晴天,接近壓縮時變成暴風雨 |
| boss-widget | /boss-widget [on\\|off] | 把脈絡用量顯示成 Boss 血條;壓縮會擊敗它並開始下一關 |
| sky-widget | /sky-widget [on\\|off] | 依你當地時間顯示天空:白天是太陽,夜晚是月亮,工作階段持續越久星星越多 |
| world-widget | /world-widget [on\\|off\\|clear] | 一個場景包含全部內容:天空隨時鐘變化、天氣隨脈絡變化、每個工作階段一座塔、工具呼叫組成的火車,以及一隻四處遊蕩的螃蟹 |
| quest-widget | /quest-widget [on\\|off\\|reset] | 把工作階段變成地牢探險:每個工作階段一間房、每次工具呼叫一個怪物、檢查通過時掉落戰利品;英雄會跨工作階段保留 |
| race-widget | /race-widget [on\\|off\\|clear] | 把並行子代理顯示成賽道上的賽車,每次工具呼叫前進一步,完成時登上頒獎台 |
視覺化工具
由工具活動驅動的抽象圖像。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| mosaic-widget | /mosaic-widget [on\\|off\\|clear] | 每次工具呼叫一個色塊,依工具著色;失敗顯示為紅色 |
| sorting-widget | /sorting-widget [on\\|off\\|step] | 正在排序的長條圖,每次工具呼叫交換一次 |
| equalizer-widget | /equalizer-widget [on\\|off] | 每次工具呼叫跳動、隨後回落的音量電平表 |
| rain-widget | /rain-widget [on\\|off] | 下落的程式碼雨,工作階段越忙速度越快 |
| orbit-widget | /orbit-widget [on\\|off] | 一個小型太陽系;工具呼叫執行時行星加速 |
| life-widget | /life-widget [on\\|off\\|reset] | Conway 的生命遊戲;每次工具呼叫放下一架滑翔機 |
| donut-widget | /donut-widget [on\\|off] | 旋轉的 3D 甜甜圈;工具呼叫執行時轉得更快 |
| pipes-widget | /pipes-widget [on\\|off] | 管道螢幕保護程式;工作階段閒置時生長,Claude 工作時暫停 |
| maze-widget | /maze-widget [on\\|off\\|new] | 使用專案資料夾作為種子生成的第一人稱迷宮漫遊 |
| marquee-widget | /marquee-widget [on\\|off\\|clear\\|<text>] | 捲動工作階段事件的 LED 跑馬燈;其他文字會發布成你自己的標題 |
遊戲
Snake、2048 和 Tetris 會自行遊玩,直到你點擊棋盤並接手按鍵。
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| snake-widget | /snake-widget [on\\|off] | Snake;在你接手按鍵前自行遊玩 |
| 2048-widget | /2048-widget [on\\|off] | 2048;在你接手按鍵前自行遊玩 |
| tetris-widget | /tetris-widget [on\\|off] | Tetris;在你接手按鍵前自行遊玩 |
| minesweeper-widget | /minesweeper-widget [on\\|off] | Minesweeper:點擊揭開,右鍵或 f 插旗,r 重新開始 |
| breakout-widget | /breakout-widget [on\\|off\\|reset] | 自動遊玩的打磚塊;每次工具呼叫增加一排磚塊 |
| typer-widget | /typer-widget [on\\|off] | 打字遊戲:你自己的檔名中的單字落下,你要在它們落地前打出來 |
只是好玩
| 外掛 | 指令 | 顯示內容 |
| --- | --- | --- |
| fortune-widget | /fortune-widget [on\\|off\\|next] | 每個工作階段都會改變的一行籤語 |
| 8ball-widget | /8ball-widget [on\\|off]、/8ball <question> | /8ball <question> 給出可靠性存疑的答案 |
| badges-widget | /badges-widget [on\\|off\\|reset] | 跨工作階段取得的成就,解鎖成就時顯示通知 |
| sigil-widget | /sigil-widget [on\\|off\\|clear] | 根據本次工作階段的活動產生像素徽記,並在旁邊展示較早工作階段的徽記畫廊 |
| sound-widget | /sound-widget [on\\|off\\|mute\\|test] | 每次工具呼叫一個音符,檢查通過時一組和弦,失敗時一聲蜂鳴,並顯示鋼琴捲簾(音訊只在 macOS 上播放) |
每個工作階段都會儲存並還原放置位置、啟用的 widget 和檢視模式。
說明
/widgets width pet 60設定一個 widget 卡片可以增長到的寬度(預設為 40 欄);/widgets width pet reset將它恢復。/widgets side只在全螢幕版面(/tui fullscreen)中把卡片停駐到 transcript 旁邊。在預設版面中,它會退回到提示列下方。- 像素畫只用終端機區塊字元繪製,只會顯示在終端機中。
- sound-widget 只在 macOS 上播放音訊;其他平台保持靜音,只繪製鋼琴捲簾。
- board-widget 註冊一個 Claude 可以呼叫的 pin 工具,因此面板開啟時,它的說明會成為脈絡的一部分。
- watch-widget 透過 sh -c 執行你的指令,失敗時回退到 cmd /c。
- 接手遊戲以及進行 Minesweeper 都需要點擊棋盤;全螢幕版面會回報這次點擊。
開發
plugins/ 下的每個外掛都是一個 mod:包含資訊清單、hooks 模組和測試。
claude --plugin-dir plugins # load every plugin from this checkout
claude plugin validate plugins/<name> # check a manifest and hooks module
claude plugin test plugins/<name> # run its tests
外掛不能互相匯入,因此 widgets 會將卡片堆疊和像素算繪器作為 $.widgets(plugins/widgets/hooks/kit.tsx)共用;每個 widget 都會呼叫它。
授權
MIT
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add oMaN-Rod/claude-code-widgets claude plugin install diff-widget
原文 / README
Claude Code Widgets
Small cards that sit under the Claude Code prompt, or docked beside the transcript in fullscreen. Each widget is its own mod, toggled with a slash command.
It started with a few useful ones (context, usage, file tree) and then got carried away: there are now 61 widgets, from git status and a turn timer to a pixel crab, a dungeon crawl and Tetris.
Install
Add the marketplace, then install the layout plugin and whichever widgets you want:
/plugin marketplace add oMaN-Rod/claude-code-widgets
/plugin install widgets@claude-code-widgets
/plugin install context-widget@claude-code-widgets
Every widget needs widgets, the layout plugin that places the cards.
Requires a Claude Code version with mod (function hook) support. The mod API is early access and may change between releases.
Widgets
Layout
Required by every widget.
| Plugin | Command | What it shows |
| --- | --- | --- |
| widgets | /widgets [side\|above\|below\|close\|<columns>\|width <widget> <columns\|reset>] | Places the cards: below the prompt, above it, or docked beside the transcript in fullscreen |
Session
What Claude is doing and what it is costing.
| Plugin | Command | What it shows |
| --- | --- | --- |
| context-widget | /context-widget [auto\|detailed\|grid\|top\|bar\|line] | The context window as a stacked bar, one colour per /context category |
| usage-widget | /usage-widget | A bar per rate-limit window, time to reset, session cost |
| timer-widget | /timer-widget [on\|off\|clear] | The running turn's elapsed time, plus last, average and longest turn and a sparkline |
| activity-widget | /activity-widget [on\|off\|clear] | The latest tool calls with their duration and whether they failed |
| tasks-widget | /tasks-widget [on\|off\|clear] | The task list Claude is working through, with a progress bar |
| checks-widget | /checks-widget [on\|off\|clear] | The latest test, lint and build runs: pass or fail, duration and how long ago |
| timeline-widget | /timeline-widget [on\|off] | The turn as a chart: one bar per tool call on a time axis, parallel calls stacked |
| board-widget | /board-widget [on\|off\|clear] | A status board Claude writes itself through a pin tool: goal, findings and open questions |
| forecast-widget | /forecast-widget [on\|off\|clear] | Context growth per turn as a chart, with the turns left before compaction |
| guard-widget | /guard-widget [on\|off\|clear] | Permission checks this session: allowed, asked and denied, with what you keep being asked about |
| stream-widget | /stream-widget [on\|off] | A live tokens-per-second gauge and sparkline while Claude is writing (estimated from text length) |
| sessions-widget | /sessions-widget [on\|off] | The other Claude Code sessions open on this machine: folder, branch, busy or idle |
Project and git
The state of the working tree.
| Plugin | Command | What it shows |
| --- | --- | --- |
| file-tree-widget | /file-tree-widget | The project directory; folders expand on click |
| git-widget | /git-widget | Branch, ahead/behind, staged, changed and untracked counts, and the last commit |
| changes-widget | /changes-widget [on\|off\|clear] | Files edited this session, most recent first, with an edit count each |
| commits-widget | /commits-widget | The commits made since the session started |
| todos-widget | /todos-widget | TODO, FIXME, HACK and XXX comments in tracked files, counted and listed |
| diff-widget | /diff-widget [on\|off\|clear] | The last edit as a syntax-highlighted diff |
| watch-widget | /watch-widget [on\|off\|run\|stop], /watch <command> | /watch bun test reruns the command after every edit: a pass or fail light and the last failing lines |
| map-widget | /map-widget [on\|off\|clear] | A pixel map of the tracked files, lit blue where Claude has read and green where it has edited |
Time and focus
Clocks, timers and reminders that do not depend on the session.
| Plugin | Command | What it shows |
| --- | --- | --- |
| pomodoro-widget | /pomodoro-widget [on\|off\|start\|break\|stop\|<minutes>] | A focus timer with a countdown, a progress bar and a count of finished sessions |
| countdown-widget | /countdown-widget [on\|off\|clear], /countdown <HH:MM\|<n>m\|<n>h> [label] | Time left to a deadline you set, with a progress bar and a toast when it arrives |
| clocks-widget | /clocks-widget [on\|off\|add <zone>\|remove <zone>\|clear] | Your local time beside the time zones you add, such as Asia/Tokyo |
| notes-widget | /notes-widget [on\|off\|clear], /note <text\|done <n>> | Pinned notes kept across sessions; /note <text> adds one, /note done <n> removes it |
| coffee-widget | /coffee-widget [on\|off\|refill\|<minutes>] | A cup that empties over 90 minutes and nudges you to take a break |
Scenes
Pixel art that reacts to turns, tool calls, checks and context usage.
| Plugin | Command | What it shows |
| --- | --- | --- |
| pet-widget | /pet-widget [on\|off\|<mood>] | Clawd, a pixel crab: works during a turn, dizzy when a tool call fails, happy when tests pass. Earns XP and levels up across sessions, wears a hat once badges-widget has awarded a badge, and with two sessions open stays in the one you last prompted |
| aquarium-widget | /aquarium-widget [on\|off\|demo] | A fish for every running tool call and agent |
| skyline-widget | /skyline-widget [on\|off\|demo\|clear] | One building per turn, one floor per tool call |
| train-widget | /train-widget [on\|off] | A locomotive pulling one wagon per tool call this turn, coloured by tool |
| garden-widget | /garden-widget [on\|off\|reset] | A plant: a leaf per tool call, a flower when checks pass, wilting when a call fails |
| campfire-widget | /campfire-widget [on\|off\|stoke] | A campfire that burns higher with tool calls and dies down to embers when idle |
| constellation-widget | /constellation-widget [on\|off\|clear] | A star per turn, joined into a constellation that gets a name after nine |
| fireworks-widget | /fireworks-widget [on\|off\|demo] | A night sky that sets off fireworks when checks pass, and a dud when they fail |
| invaders-widget | /invaders-widget [on\|off\|demo\|clear] | An invader arrives for every failing check; passing checks shoot them down |
| weather-widget | /weather-widget [on\|off\|live\|<percent>] | Clear sky when context has room, a storm near compaction |
| boss-widget | /boss-widget [on\|off] | Context usage as a boss health bar; compaction defeats it and starts the next level |
| sky-widget | /sky-widget [on\|off] | The sky at your local time: sun by day, moon by night, more stars the longer the session runs |
| world-widget | /world-widget [on\|off\|clear] | One scene for everything: sky by the clock, weather by context, a tower per turn, a train of tool calls and a wandering crab |
| quest-widget | /quest-widget [on\|off\|reset] | The session as a dungeon crawl: a room per turn, a monster per tool call, loot when checks pass; the hero is kept across sessions |
| race-widget | /race-widget [on\|off\|clear] | Parallel subagents as cars on a track, one stride per tool call, with a podium as they finish |
Visualizers
Abstract pictures driven by tool activity.
| Plugin | Command | What it shows |
| --- | --- | --- |
| mosaic-widget | /mosaic-widget [on\|off\|clear] | One tile per tool call, coloured by tool; failures are red |
| sorting-widget | /sorting-widget [on\|off\|step] | A bar chart being sorted, one swap per tool call |
| equalizer-widget | /equalizer-widget [on\|off] | Level meters that jump with each tool call and fall back to rest |
| rain-widget | /rain-widget [on\|off] | Falling code rain that speeds up the busier the turn gets |
| orbit-widget | /orbit-widget [on\|off] | A small solar system; the planets speed up while tool calls run |
| life-widget | /life-widget [on\|off\|reset] | Conway's Game of Life; every tool call drops a glider |
| donut-widget | /donut-widget [on\|off] | The spinning 3D donut; it spins faster while tool calls run |
| pipes-widget | /pipes-widget [on\|off] | The pipes screensaver; it grows while the session is idle and pauses while Claude works |
| maze-widget | /maze-widget [on\|off\|new] | A first-person walk through a maze seeded by the project folder |
| marquee-widget | /marquee-widget [on\|off\|clear\|<text>] | An LED ticker scrolling session events; any other text posts your own headline |
Games
Snake, 2048 and Tetris play themselves until you click the board and take the keys.
| Plugin | Command | What it shows |
| --- | --- | --- |
| snake-widget | /snake-widget [on\|off] | Snake; it plays itself until you take the keys |
| 2048-widget | /2048-widget [on\|off] | 2048; it plays itself until you take the keys |
| tetris-widget | /tetris-widget [on\|off] | Tetris; it plays itself until you take the keys |
| minesweeper-widget | /minesweeper-widget [on\|off] | Minesweeper: click to reveal, right-click or f to flag, r to restart |
| breakout-widget | /breakout-widget [on\|off\|reset] | A self-playing brick breaker; every tool call adds a row of bricks |
| typer-widget | /typer-widget [on\|off] | A typing game: words from your own file names fall, and you type them before they land |
Just for fun
| Plugin | Command | What it shows |
| --- | --- | --- |
| fortune-widget | /fortune-widget [on\|off\|next] | A one-line fortune that changes with every turn |
| 8ball-widget | /8ball-widget [on\|off], /8ball <question> | /8ball <question> gives an answer of doubtful reliability |
| badges-widget | /badges-widget [on\|off\|reset] | Achievements earned across sessions, with a toast when one unlocks |
| sigil-widget | /sigil-widget [on\|off\|clear] | A pixel emblem generated from this session's activity, beside a gallery of the ones from earlier sessions |
| sound-widget | /sound-widget [on\|off\|mute\|test] | A note per tool call, a chord when checks pass, a buzz on failure, with a piano roll (audio plays on macOS only) |
Placement, which widgets are on, and view modes are saved and restored in every session.
Notes
/widgets width pet 60sets how wide one widget's card may grow (the default is 40 columns);/widgets width pet resetputs it back./widgets sidedocks the cards beside the transcript only in the fullscreen layout (/tui fullscreen). In the default layout it falls back to below the prompt.- The pixel art is drawn with terminal block characters and shows in the terminal only.
sound-widgetplays audio on macOS only; elsewhere it stays silent and just draws the piano roll.board-widgetregisters apintool that Claude can call, so its description is part of the context while the board is on.watch-widgetruns your command throughsh -c, falling back tocmd /c.- Taking over a game, and playing Minesweeper at all, needs a mouse click on the board, which the fullscreen layout reports.
Develop
Each plugin under plugins/ is a mod: a manifest, a hooks module and its tests.
claude --plugin-dir plugins # load every plugin from this checkout
claude plugin validate plugins/<name> # check a manifest and hooks module
claude plugin test plugins/<name> # run its tests
Plugins cannot import from one another, so widgets shares card stacking and the pixel renderer as $.widgets (plugins/widgets/hooks/kit.tsx), which every widget calls.
License
MIT

