Skip to content

cache-tax 1.0.3: price Sonnet 5, date the lapse from expiry - #65

Merged
karanb192 merged 1 commit into
mainfrom
cache-tax-1.0.3
Sep 17, 2026
Merged

karanb192 merged 1 commit into
mainfrom
cache-tax-1.0.3

Conversation

@karanb192

Copy link
Copy Markdown
Owner

Summary

  • Sonnet 5 was priced at Sonnet 4.x rates. A sonnet-5 price row [0.2, 2.5, 4] (cache read, 5m write, 1h write, dollars per million tokens) now takes precedence through the longest-key match; claude-sonnet-4-6 still resolves to sonnet.
  • The guard, the card and the status line reported "lapsed X ago" with X as the time since the last request. They now report the time since the cache expired (age minus the tier TTL, clamped at zero).
  • Plugin version 1.0.2 to 1.0.3.

Details

plugins/cache-tax/cache-tax.js

  • DEFAULT_PRICES gains 'sonnet-5': [0.2, 2.5, 4] above the sonnet row; the matcher comment now cites sonnet-5 over sonnet as its example.
  • stateFrom adds lapsedSec: Math.max(0, -leftSec) to the live state (and lapsedSec: 0 on the compacted branch so the shape is stable). leftSec and the warm "cache Nm left" text are unchanged.
  • statusLine ("cache LAPSED X ago"), guardMessage ("the 1h prompt cache lapsed X ago") and renderCard ("COLD, lapsed X ago") format st.lapsedSec instead of st.ageSec. The compacted "reset by /compact X ago" line still uses ageSec, which is correct there.

plugins/cache-tax/README.md

  • Built-in list rates sentence lists Sonnet 5 [0.2, 2.5, 4] separately from Sonnet 4.x [0.3, 3.75, 6].
  • The verbatim guard example reads "lapsed 2h00m ago" (three hours since the last request on the 1h tier); every other number is unchanged.
  • "How it decides" states that the "lapsed N ago" figure is the time since expiry, not since the block.

plugins/cache-tax/.claude-plugin/plugin.json

  • version 1.0.2 to 1.0.3.

plugins/cache-tax/tests/cache-tax.test.js

  • Family test: claude-sonnet-5 maps to sonnet-5, claude-sonnet-4-6 to sonnet.
  • New test prices Sonnet 5 below Sonnet 4.x: priceFor returns [0.2, 2.5, 4] for sonnet-5 and [0.3, 3.75, 6] for sonnet-4-6.
  • State test asserts lapsedSec is about 3600 for a two-hour-old block on the 1h tier.
  • Status line fallback for a two-hour-old transcript expects cache LAPSED 1h00m ago.
  • Guard integration test for a three-hour-old transcript expects the 1h prompt cache lapsed 2h00m ago.
  • Card test transcript moved to four and three hours old so the card reads COLD, lapsed 2h00m ago; cost and session totals unchanged.

Test plan

  • npm test from the repo root: 1929 pass, 0 fail, 0 skipped (1928 before this change, one test added).
  • git diff --check origin/main: clean.
  • Grep for en and em dashes across the changed files: none.

Sonnet 5 matched the generic sonnet row and was priced at Sonnet 4.x
rates. A sonnet-5 row with the platform list prices (0.20 read, 2.50 5m
write, 4 1h write, dollars per million tokens) now wins the longest-key
match, and sonnet-4-6 still lands on the old row.

The guard, the card and the status line said "lapsed X ago" with X
being the time since the last request, not the time since the cache
expired. The state now carries lapsedSec, the age minus the tier TTL
clamped at zero, and all three use it. A session three hours old on
the 1h tier reads "lapsed 2h00m ago", not "3h00m ago".

README: Sonnet 5 listed separately in the built-in rates, the verbatim
guard example updated, and the decision section says what the lapsed
figure measures. Plugin version 1.0.2 to 1.0.3.
@karanb192
karanb192 merged commit 53ef677 into main Sep 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant