Cache TTL Timer

A VS Code extension that tracks the prompt-cache TTL of every active agent
session in parallel (VS Code local agent + Copilot CLI), shows a color-coded
countdown in the status bar, and plays a sound before a cache expires.
Install
- Marketplace: search for Cache TTL Timer in the Extensions view
(
Ctrl/Cmd+Shift+X), or run
ext install SukumarP.cache-timer from the Quick Open bar.
- From a
.vsix: run npm run package to build one, then
Extensions: Install from VSIX… from the Command Palette.
The extension installs and runs in both VS Code and VS Code Insiders.
When it is installed in both and they run side by side, each instance tracks
only its own build's sessions, so the two status bars stay separate. The build
is named in the hover (e.g. Cache TTL (Insiders)), and Insiders adds a small
(Insiders) suffix to the status-bar toggle so you can tell the two apart.
Visual states
| Display |
State |
Meaning |
🔥 HOT |
working |
Agent generating (open turn); cache fresh — no countdown |
🟢 4:32 |
green |
Stopped, fresh: remaining > warnAt |
🟡 2:15 |
yellow |
Aging: alertAt < remaining ≤ warnAt |
🔴 0:45 |
red |
About to expire: 0 < remaining ≤ alertAt (+ sound) |
❄️ COLD |
cold |
Expired: remaining ≤ 0 |
The aggregate status-bar item shows the most-urgent session's state emoji and
its live countdown, e.g. 🔴 0:45. When more than one session is tracked, a
count is appended, e.g. 🔴 0:45 (2). Hover it to see every session with its
countdown and provider.
Usage
- Enable tracking: click
$(bell) Cache TTL in the status bar, run
Cache TTL: Toggle Tracking from the Command Palette, or set
cacheTimer.enabledOnStartup to true.
- Start an agent chat. As soon as it issues a model request, it appears in the
hover with its countdown.
Configuration
See the Cache TTL Timer section in VS Code Settings. Key options:
| Setting |
Default |
Purpose |
cacheTimer.ttl |
300/120/30 per provider |
TTL thresholds (timerValue/warnAt/alertAt) |
cacheTimer.soundPath |
bundled |
Sound file for the red alert |
cacheTimer.soundEnabled |
true |
Play a sound when a session turns red (off = visual only) |
cacheTimer.alertRepeat |
1 |
How many times to beep when a session turns red |
cacheTimer.notifyOnRed |
false |
Show a warning notification when a session first turns red |
cacheTimer.enabledOnStartup |
false |
Start tracking automatically |
cacheTimer.pollIntervalMs |
2000 |
Log re-scan interval |
cacheTimer.showCost |
true |
Show approximate per-session cost |
Development
npm install
npm run compile # tsc -> out/
npm test # node:test over the pure modules
npm run package # build a .vsix with @vscode/vsce
Press F5 to launch an Extension Development Host with the extension loaded.
Limitations
- Only agent-mode requests are logged to
main.jsonl; plain "ask" chats may not
appear.
- Cost is approximate — token-price units in
models.json are not documented.