Case · AI agents
Capability: 10–25 MB control tower for every AI coding session, at about 0% idle CPU.
Reliability: ≤ 1.5 s hook budget inside every session, always exiting cleanly.
Claude Agents Widget
I run several AI-assisted coding sessions at once, so I built their control tower: one glance shows which one needs a decision.
The outcome
I use Claude Code for AI-assisted development, often with several sessions open across VS Code windows. This widget tells me which one needs me: needs you, your turn, working, background, stuck, failed or idle. I keep the windows minimised and jump in only when a row turns amber. It’s installed and in daily use on my own machine.
What I built
- Nine colour-coded states worked out from Claude Code’s hook events and its own session files.
- Rows that say what happened: “Asks: want me to deploy?”, “Done: all tests pass”, “Running a command for 12m”. A hover card adds the last message, the prompt, context-window fill and model.
- One hotkey jumps to the session that has waited longest. Clicking a row focuses its window.
- Usage limits always visible, read invisibly from Claude Code’s own usage command (no tokens spent), with a forecast of time left.
- Quick prompts typed safely into a session’s chat box. It checks focus is in the chat, never in a code file, and never overwrites a draft.
- Idle shell detection, and a “back after a break” summary of what finished and what failed.
- A safe installer that edits the settings file with a backup, preserving other hooks and key order.
The hard part
- A hook that can’t break anything. It runs inside every session, so it must always exit cleanly, never print and finish within 1.5 s. Printing at the wrong moment could approve a tool. A watchdog and a swallow-all design make sure it doesn’t.
- A footprint budget. Event-driven, no polling: 10–25 MB of memory and about 0% CPU at idle, with handle counts re-measured after every change to catch leaks.
- No false alarms. Background sub-agent checks and task wake-ups are ignored, so “needs you” means it.
- Nothing to install. C# compiled with the compiler built into Windows, raw Win32 and GDI calls, no frameworks and no packages.
How it was built
Built from a written spec and conventions file, with a changelog entry for every shipped item.
Stack
- 9session states, colour-coded
- 53numbered shipped items
- 0third-party dependencies