cache-clock

Reviewed at commit 87f1084

A prompt-cache line under your status line: minutes left while warm, and how many tokens the next message re-caches once cold. /cache-clock setup adds it.

Made by
Hamza Zafar
What we checked

Adds a prompt-cache line (time left, hit rate, misses, tokens a cold cache would re-cache) under your status line, drawn from figures Claude Code already supplies. Only after you run /cache-clock setup, it edits your status line setting, keeps your own status line command running, and /cache-clock remove restores it. No network calls.

Review details

Static review of the source at the pinned commit; not run. All five files were read in full (plugin.json, hooks.json, register.ts, statusline/cache-clock.mjs, statusline/render.mjs). The only change since the previous review is plugin.json metadata. Registers session.start (registers the /cache-clock command and, if its status line is active, refreshes its two copied scripts from the plugin folder) and command.run for /cache-clock (no argument shows status, setup, remove). Runtime calls: $.command.register, $.settings.read for each source, $.env.get (CLAUDE_CONFIG_DIR, HOME), $.session.root and $.session.version, $.fs.read/write/exists, and $.process.run(['node','--version']) to check that Node exists. Setup copies cache-clock.mjs and render.mjs to <config dir>/cache-clock, writes setup-<hash>.json there (the previous statusLine and the command it wraps), and rewrites the statusLine entry of ~/.claude/settings.json (or the project's .claude/settings.local.json when the status line came from project or local settings) with a node command and a 30 second refreshInterval (or the user's own if shorter). The whole settings file is re-serialised with JSON.stringify; a file that is not valid JSON is left untouched with an error. Setup refuses when policy or --settings supplies the status line. Remove restores the saved statusLine, and leaves the file alone if the status line changed since. At runtime the installed script reads the status line JSON from stdin, runs the user's previous status line command through a shell with the same input (5 second timeout) and prints it above the cache line; the command text comes only from the user's own settings. render.mjs is pure string formatting. No network, no telemetry, no model calls, no reads of prompts or tool calls. The status line command now runs every 30 seconds, which also re-runs the user's own wrapped command at that rate. Nothing outside the plugin and Claude config folders is written. External node and the wrapped user command were not reviewed.

What it uses
  • Reads your prompts: no
  • 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): no
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Screenshot of cache-clock

A prompt-cache line under your status line, from Claude Code's own cache figures: time left while warm, hit rate and misses, and how many tokens the next message re-caches once cold. /cache-clock setup adds it.

Made this mod? Add a badge to your README

modsforClaude badge for cache-clock

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.svg)](https://modsforclaude.com/mods/cache-clock/)

← All mods