Claude Code's New Read Cache Blocks 8% of Token Waste Automatically

Claude Code's New Read Cache Blocks 8% of Token Waste Automatically

The claude-context-optimizer plugin v3.1 now actively blocks Claude from re-reading unchanged files, saving an average 8% of tokens per session.

Ggentic.news Editorial·2h ago·3 min read·27 views·via devto_claudecode
Share:

What Changed — From Tracking to Prevention

Two weeks ago, developer Egor Fedorov released a plugin that tracked where Claude Code tokens were being wasted. The data showed 37% waste, with the biggest culprit being redundant file reads. The new v3.1 update transforms that tracking into active prevention with a Smart Read Cache that intercepts and blocks wasteful reads before they happen.

How It Works — Intelligent Blocking Logic

The plugin adds a PreToolUse hook that intercepts every Read call Claude makes. It checks three conditions before allowing a read:

  1. First read? Always allow
  2. File changed on disk? Allow (checks mtime)
  3. Different section requested? Allow (tracks offset/limit ranges)

Only if the exact same file section is requested again, and the file hasn't changed, does it block with a clear message:

Already loaded tracker.js this session (983 lines, ~9.3K tokens).
File unchanged. Use offset/limit to read a specific section, or Edit to modify it.

Claude adapts to these blocks and works with the context it already has.

Real Impact — 107 Sessions Analyzed

Fedorov analyzed 107 existing sessions to see what the Read Cache would have saved:

Cover image for Update: my Claude Code token optimizer now blocks redundant reads. Here's the data from 107 sessions.

Sessions analyzed:              107
Total tokens tracked:           23.5M
Redundant reads found:          1,225
Tokens that would have been saved: 1.9M (8.0%)

Top offenders were predictable: page.tsx (189 reads, 60 blocked, 130.9K tokens saved), GameInfoModal.svelte, variables.css, and other frequently referenced files. Some sessions saw savings as high as 68%.

At $15 per million tokens on Claude Opus, that's roughly $60/month in savings for Fedorov's usage patterns.

New Feature: Project Anatomy

Version 3.1 also adds a /cco-anatomy command that generates a one-file codebase map:

# Project Anatomy: my-app
Generated: 2026-03-24 | 31 files | ~46K tokens if all read

| Path | Lines | ~Tokens | Type |
|------|-------|---------|------|
| src/tracker.js | 984 | 9.1K | source |
| src/export.js | 398 | 3.7K | source |
...

Instead of Claude opening 20 files to understand your project structure, you can provide this single file, saving thousands of tokens on project exploration.

Install It Now

First-time installation:

npx skills add https://github.com/egorfedorov/claude-context-optimizer

If you already have it:

claude plugin update claude-context-optimizer@egorfedorov-plugins

The plugin requires zero configuration, sends no telemetry, and all data stays local. It's MIT licensed and now includes 45 unit tests.

Why This Matters Beyond Token Savings

Beyond the direct cost savings, this plugin changes Claude Code's behavior. When Claude gets blocked from re-reading a file, it learns to work more efficiently with existing context. This mirrors the feedback from early users who said "getting a live counter visible all session changes behavior in the moment before waste happens."

The plugin also handles edge cases intelligently:

  • Compaction events clear the cache (Claude actually lost context)
  • Edit/Write operations invalidate that file's cache
  • Partial reads are tracked by specific offset/limit ranges

This isn't just about saving money—it's about training yourself and Claude to work more efficiently within the constraints of the context window.

AI Analysis

Claude Code users should install this plugin immediately. The 8% average token savings translates directly to cost reduction, especially for heavy users on Claude Opus. More importantly, the blocking behavior trains Claude (and you) to work more efficiently. Start by running `/cco-anatomy` at the beginning of any session where Claude needs to understand a complex project. Provide that single file instead of letting Claude explore randomly. Watch for the "Already loaded" messages—they're teaching moments about how Claude operates. If you're working on a file repeatedly (like `page.tsx` or a central `types.ts`), notice when Claude tries to re-read it. The plugin will block it, and you'll see Claude adapt by referencing the existing context instead of refreshing it. This is the behavior change that leads to long-term efficiency gains beyond just the immediate token savings.
Original sourcedev.to

Trending Now

More in Products & Launches

View all