cache-clock (ray-amjad)

Reviewed at commit 464b8bd New version, not yet reviewed

A one-line band above the prompt: context used, and a countdown until the prompt cache goes cold

Made by
Ray Amjad
What we checked

Shows a line above the prompt with context used and a countdown until the prompt cache goes cold, with toasts near expiry. By default, if you have not replied when the cache is about to go cold, it sends Claude a prompt to write a short HANDOFF-<id>.md note in your project (uses tokens; Claude's file write goes through the normal permission prompt). This can be switched off in /config. It makes no network calls of its own.

Review details

Static review of the source at the pinned commit; not run. Registers session.start (skipped in headless -p/SDK sessions; reads settings, registers /cache-clock, starts a 1 second clock), classic.SessionStart, classic.Stop, turn.start, turn.complete, prompt.submit, turn.step, session.measure, command.run for recap, btw and cache-clock, and ui.render for AbovePrompt. Environment variables read: CACHE_CLOCK_MAIN_TTL_MIN, CACHE_CLOCK_SUB_TTL_MIN, CACHE_CLOCK_WARN_MIN, CACHE_CLOCK_SOUND, CACHE_CLOCK_HANDOFF_DIR, CACHE_CLOCK_ON_WARNING, CACHE_CLOCK_AUTO_HANDOFF and OS. To learn the real cache TTL it reads the last 300 rows of the session's own transcript, using $.process.run with tail (Mac/Linux) or a fixed PowerShell snippet (Windows; the path is passed in an environment variable, not in the script), with $.fs.read as fallback; only the cache_creation token counters are looked at. With onWarning set to handoff (the default), when the warning point is reached while idle and the user has not replied, it shows a toast and calls $.prompt.submit with a fixed text containing a marker, asking Claude to write a handoff note to CACHE_CLOCK_HANDOFF_DIR or the project root; it fires at most once per user message. The plugin itself writes no files: Claude does it as a normal turn. Optional sound only with CACHE_CLOCK_SOUND=1 ($.audio.play of a bundled asset). The diff since the last review adds the handoff-or-off action choice (compact was removed), the headless guard and side-request (/recap, /btw) handling. No network calls, no eval, no npm dependencies.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: no
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): yes
  • Sends data over the network: no
  • Stores data: no
  • Shows something on screen: yes
Hooked events
Screenshot of cache-clock (ray-amjad)
Made this mod? Add a badge to your README

modsforClaude badge for cache-clock (ray-amjad)

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/cache-clock-ray-amjad.svg)](https://modsforclaude.com/mods/cache-clock-ray-amjad/)

← All mods