Krypton
Prompt caching

Cut the cost of re-reading your code

Coding agents send your codebase to the model on every turn. Providers bill text they have already seen at a fraction of the normal price, so the longer the unchanged part stays at the front of each request, the smaller the bill.

Stable files firstFiles that rarely change go to the front, where the cache keeps them.
Checks before it changesYour history decides; otherwise your order stays.
Free to checkIt runs no model and sends no source.
The short version. Ordering files by how often they change can make the same prompts much cheaper, or change nothing, depending on your repository. krypton order checks your own history before it changes anything.

How caching rewards order

Providers cache the longest identical prefix of a request. If a file near the start changes, everything after it has to be read again at full price. If only files near the end change, almost the whole request is reused.

So the best order puts the files that rarely change first and the ones that change often last.

Krypton's ordering

$ krypton order . --subdir src --ext .py,.ts --model gpt-4o --post
# the order to send the files in, or your own order when Krypton would not win

Krypton's ordering algorithm uses each file's change history. Build your prompt from the files in that order. The ordering is a hint from history, not a guarantee, and it never changes a score.

What we learned

The numbers behind each point, repository by repository, are in the case study.

When Krypton would lose, it does nothing

Reordering blindly is not safe: on some repositories a stable-first order loses to plain alphabetical order. krypton order is the safe form of the feature. Before a request it replays your repository's history, tries several orders (stable files first, big files that rarely change first, least recently changed first, alphabetical, reverse alphabetical), builds each from the commits before every past change only, and compares how much of the prompt each would have kept. It takes the order that kept the most, and reorders only when there is enough history, its average gain over your order is clear, and it was ahead in more changes than it was behind. The answer lists every order it tried. Otherwise the answer is keep: your request goes out exactly as you built it.

How to run it, and what the answer looks like, is on file ordering.

Try it on your own repository

The hosted demo reads a repository you choose and shows its real size in tokens and an estimate of what ordering and a refactor could save.