Local Caching Middleware

Pay 90% Less on Repeated Claude Code Tokens

CacheLane is a local prompt-caching and trajectory-aware orchestration layer. It segregates your context into volatility tiers and prunes stale tool outputs, keeping your sessions fast and affordable.

Terminal

# Install globally

npm install -g cachelane

# Integrate with Claude Code hooks

cachelane install

# Diagnose and verify local setup

cachelane doctor

Side-by-Side: The Caching Edge

See how standard conversation context cost compounds vs. CacheLane's region reordering and K-pruning.

Standard Claude Code

Linear Cost Accumulation

No breakpoint management or context pruning.

Turn 1 (Initial Prompt)1.0× Cost
Turn 5 (Accumulating files & schemas)5.0× Cost
Turn 10 (Large workspace context bloat)10.0× Cost
Cumulative Input cost:55,000 Billed Tokens
With CacheLane

Cache-Aware Flattened Curve

Orchestration reorders blocks; K-pruning stubs idle content.

Turn 1 (Write Prefix Cache)1.25× Cost (Write)
Turn 5 (Cache Reads + Keepalives)0.45× Cost (82% hit ratio)
Turn 10 (K-Pruned Stubs Restrain Context)0.55× Cost (K-pruning active)
Pruned & Stubbed (Flat Growth)
Cumulative Input cost:
18,500 Billed Tokens-66% cost reduction

Local Optimization, Zero Configuration

CacheLane operates completely locally behind the scenes, ensuring optimal pricing without manual intervention.

Cache-Aware Orchestration

Automatically classifies incoming context blocks and aligns them into three regions with dual `cache_control` breakpoints.

Trajectory K-Pruning

Identifies stale files and tool-outputs unreferenced for consecutive turns and swaps them out for light, refetchable stubs.

Adaptive Keepalive

Schedules low-cost, single-token background pings when idle to keep your prompt cache hot, avoiding cold-start write penalties.

100% Local-First

All references, database metrics, and logs are kept in a local SQLite file. Your prompts and files never leave your environment.

Fail-Open Invariants

Built to be completely invisible. Any internal runtime error gracefully returns the raw prompt, never breaking your editor session.

TUI & CLI Dashboard

Use simple command line options like `cachelane stats` or `cachelane explain` to get transparent reports of your cache savings.