routing-spike

command
v0.78.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command routing-spike measures how much of a Claude Code archive is bulk I/O that could be routed to a cheap worker model.

It is Stage 0 of the routing-savings spec: the measurement that decides whether the rest of the feature is built. It writes nothing, changes nothing, and reads only the transcripts Claude Code already keeps.

go run ./cmd/routing-spike                       # ~/.claude/projects
go run ./cmd/routing-spike -dir /path/to/projects
go run ./cmd/routing-spike -json                 # machine-readable

What it counts, and why that is not obvious

The unit is **tokens**, taken from the transcript's own `usage` accounting, never bytes on disk. A screenshot is 600 KB of base64 and about 1.5k tokens; measuring bytes makes images look like the dominant cost when they are not. An earlier pass of this spike made exactly that mistake and reached the opposite conclusion, which is why `-bytes` still exists: it reproduces the wrong answer beside the right one so the size of the error stays visible.

The cost of a tool result is not its size either. Content written into the context is billed once as a cache write and then re-read on every remaining turn, so a file read early in a long session is charged many times over. The spec's unit is therefore `T * (1 + turns_left)` — token-turns — and the denominator is every context token-turn in the same sessions, not just the tool results. Both errors have burned this product before: counting each re-read at full price overstates, counting only the first read understates.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL