ProductsAgent tooling

Agent Cache Meter

Know before your prompt cache goes cold.

A prompt-cache meter for omp and Claude Code. It shows how many tokens each request read from the cache, wrote to it and sent uncached, and counts down to the cache's expiry. When the cache goes cold it says what rebuilding it costs and whether /compact pays for itself.

Star on GitHub

Also for Claude Code, and a Tern plugin that shows every agent's cache in one place.

Agent Cache Meter: a warm cache at 99.6% hit rate with 4:33 left, then a cold one and what /compact saves.
Why it matters

Coming back costs one rebuild.

Every request sends the whole conversation again. The prompt cache makes that cheap: tokens read from it cost a tenth of normal input. But the cache lives only an hour after the last request (five minutes on an API key).

After it expires, the first request writes the whole conversation to the cache again, at the cache-write price. In a real 487k-token Opus 5.5 session that was $3.63, the price of 30 normal requests. The meter counts down to that moment, warns before it, and shows what the rebuild will cost.

Request costs in a 487k-token session at Opus 5.5 list prices: small green bars at $0.12 each while working, an hour where the cache stays warm, the expiry, and 15 hours later one tall red bar of $3.63 for the first request back, which rewrites 450k tokens, worth 30 warm requests.
Continue or /compact

A big context costs on every request.

Even with a warm cache, each request reads all 487k tokens, $0.12 apiece, and one message with tool calls is often 10–30 requests. After /compact the same requests cost $0.04.

On a cold cache the meter compares both paths and recommends /compact when it pays: in Claude Code straight away, because its summary request is billed as plain input; in omp after about two requests, because omp writes the summarised history to the cache once more.

Total spend over the 40 requests after coming back: continuing climbs from $3.63 to $8.55; compacting first in omp starts at $3.72 and ends at $5.31; compacting first in Claude Code starts at $2.16 and ends at $3.83.
List prices. On a subscription you don't pay them per token, but your usage limits fill in the same proportions.

The meter

One line above the composer.

It redraws every second and takes one line, two when the cache is cold. What happened is on the left; the hit bar, hit rate and time (or the sizes) sit at the right end.

The meter with a green warm badge: read 96.2k · write 380 · uncached 14, then hit rate, the split bar, 99.6% | 4:33.
Warm

More than the warning time left, or omp will refresh the cache in time. Shows read · write · uncached of the last request.

The meter with an amber expires soon badge: rebuild cost 96.6k ≈ $0.39 after, and 99.6% | 0:37.
Expires soon

Inside the warning time (default 60 s) with no refresh planned. The rebuild cost on the left, the countdown in amber.

The meter on a cold cache, two lines: rebuild cost 96.6k ≈ $0.61, 1h · expired | 4:00 ago; then /compact recommended · ≈ $0.74 · +$0.12 now, pays back in ~7 turns.
Cold

The cache entry has expired. The rebuild cost, and on a second line what to do: continue or /compact.

The meter after /compact: ~$0.02 less per turn · +$0.12 now · next ≈ $0.25, and 96.6k → 60.0k.
Reset by /compact

A compaction is newer than the last request. Per turn is what every later request saves; now is the compaction's one-off result.

The screenshots render the extension's own code in omp and Tern with a fixed Opus 4.5 session: a 96.6k-token prompt whose first 37k tokens, the tools and system prompt, stay cached.

/cache

The breakdown, one command away.

/cache toggles a panel with session totals and the last eight requests, including warming refreshes and misses. Its title bar shows the next auto-refresh and its cost.

While the cache is expiring or cold it starts with what the meter leaves out: why omp didn't warm it, and on a cold cache what continue, /compact and /new each cost. The meter recommends /compact when it pays back within 10 turns, and continue otherwise.

The /cache panel on a cold cache: why it went cold; continue ≈ $0.61, /compact ≈ $0.74 with its payback, and /new; then session totals and the last requests with split bars.

Claude Code

The same meter, as the status line.

The same code omp's extension runs, under Claude Code's prompt. On a Claude subscription it adds list price: its dollar amounts compare options at API prices, they aren't a bill.

Claude Code's status line under the prompt: cache warm, read 37.8k · write 0 · uncached 2, then hit rate, the split bar, 100.0% | 60:00.

claude-cache-meter panel, run in a project directory, shows that directory's newest session: totals, the last eight requests with their split, and on a cold or compacted cache the breakdown behind the meter. Claude Code has no command that shows output without spending a turn, so the panel lives in the terminal.

Tern plugin

Every agent's cache in one place.

  • Status-line segment for the focused agent; clicking it opens the canvas.
  • Tab titles with a countdown suffix.
  • A toast per agent when its cache is about to expire with no refresh planned.
  • A canvas listing every agent with its split, hit %, prefix, expiry, warming and advice. Focus switches to an agent; Compact sends it /compact.

All colours come from the active omp or Tern theme, so light and dark themes both work.

status line · focused agent
⛁ 4:12 · 97.6% hit

tab title · horizontal tabs
my-app ⛁ 4:12

toast · default 60 s ahead
one per agent, before its cache expires

command palette
Cache: open       every agent, its split,
                  hit %, prefix, expiry,
                  warming and advice
Cache: settings   shared by every window
Settings

Four settings, all optional.

omp keeps them in ~/.omp/agent/cache-meter.json, and /cache settings edits them in place; Claude Code reads ~/.claude/cache-meter.json. A missing or invalid field falls back to its default.

setting                default
meter.show             always
  always, near-expiry or off
meter.warnLeadSeconds  60
  when a cache counts as expiring
advice.paybackTurns    10
  omp: recommend /compact when it pays
  back within this many turns
tern.publish           auto
  write Tern's state file; off never

Install

One meter, three hosts.

The omp extension and the Claude Code status line each work on their own in any terminal. The Tern plugin needs one of them.

omp extension

omp install @horizonloop/omp-cache-meter

Draws the meter above the composer and adds /cache and /cache settings. Sessions that are already running pick it up after a restart.

Claude Code status line

npx @horizonloop/claude-cache-meter install

Needs Node.js 18 or later and Claude Code 2.1.251 or later. Sets statusLine in ~/.claude/settings.json and keeps the old file as settings.json.bak; if you already have a status line it stops and changes nothing.

Or as a Claude Code plugin:

/plugin install cache-meter --marketplace horizon-loop/agent-cache-meter /cache-meter:setup

Tern plugin, optional

tern plugin install github.com/horizon-loop/agent-cache-meter/tern-plugin

Reads the state files the omp extension and the Claude Code status line write in a Tern pane. The segment needs Tern's status bar (Settings → Appearance); the tab countdown needs horizontal tabs.

Tested on omp 18.12.6, Claude Code 2.1.311 and Tern 0.9.13.

Open source · MIT

Building something for agents?

Agent Cache Meter is a HorizonLoop project.