Short version: I measured what a single paste costs an AI agent. A 2,348-line source file is 40,324 tokens, one fifth of a 200,000 token window, gone in one keystroke. The path to that same file is 19 tokens. Four pastes like that and the agent starts forgetting the instructions you gave it an hour earlier. At the end I show what I did about it.
The session that gets dumber
You know the shape of this even if you have never named it.
You start a session in the morning. You explain the project, the constraints, the two things the agent must never touch. It works. The answers are sharp, it remembers the schema, it follows your conventions.
Two hours later the same agent suggests exactly the thing you ruled out at the start. It re-reads a file it already read. It asks you which framework the project uses. Nothing crashed, nothing errored, the model is the same model. It just got dumber.
The usual reaction is to blame the provider. In my case the cause was much more boring. It was my own clipboard.
Between the sharp session and the dumb one, I had pasted a stack trace, a test log, a config file and a chunk of a lockfile. Every one of those felt free at the time. None of them were.
What a paste actually costs
I stopped guessing and measured it. Four real files off my disk, not made-up samples:
- a terminal log, 400 lines of
git log --stat - a Swift source file, 2,348 lines
- the first 800 lines of a
package-lock.json - CLI output, 193 lines of
git help -a
Tokenizer: tiktoken with o200k_base, the GPT-4o/5 family encoding. One caveat, because it limits what the numbers prove: Anthropic does not ship a local tokenizer, so this is an approximation rather than a Claude measurement. I counted everything a second time with cl100k_base, a completely different vocabulary, and the two disagreed by 6.5% on the log and 9.7% on the source file. Close enough that the order of magnitude holds.
Reference window: 200,000 tokens.
| Sample | Characters | Tokens when pasted | Share of a 200k window | Pastes until the window is full |
|---|---|---|---|---|
| Terminal log, 400 lines | 16,609 | 5,646 | 2.8% | 35 |
| Swift source, 2,348 lines | 169,223 | 40,324 | 20.2% | 4 |
package-lock.json, 800 lines |
30,890 | 11,178 | 5.6% | 17 |
| CLI output, 193 lines | 12,005 | 2,169 | 1.1% | 92 |
The number that reframes the table is the alternative. The file path to that same Swift file:
/Users/name/projects/app/Sources/AppState.swift
19 tokens. Same file, same information reachable by the model, and a factor of 2,122 between the two ways of handing it over. The agent can open the file itself. It can even read only the part it needs, which pasting makes impossible.
Logs are the worst offenders, and they are what you paste most
Characters per token came out at 2.94 for the terminal log and 4.20 for the source file.
Tokenizers compress predictable text well. Prose compresses best, code slightly less, logs barely at all, because they are full of hashes, timestamps, absolute paths and long numbers, and each of those shreds into many small tokens.
That is the opposite of how most of us work. Logs are the single most common thing anyone pastes into a terminal agent, because they are what you have in hand the moment something breaks. The material you paste most often costs the most per character.
Why the money is not the point
At current input rates, one paste:
| Sample | at $3 / M input | at $5 / M input |
|---|---|---|
| Terminal log, 400 lines | $0.0169 | $0.0282 |
| Swift source, 2,348 lines | $0.1210 | $0.2016 |
package-lock.json, 800 lines |
$0.0335 | $0.0559 |
Twelve cents. Nobody is going bankrupt over twelve cents, and if you stop reading here you take away the wrong lesson.
What it costs you is space, over and over. The same text is re-sent with every later request in that session and it sits in the window until the window fills up. Then compaction runs. Compaction has no way of knowing that the two sentences you wrote at minute five ("never touch the migrations, the client is on the old schema") matter more than the 400-line log you pasted at minute forty. It summarizes both with equal enthusiasm.
That is the session that got dumber. Not a model problem, a housekeeping problem, and one you caused with four keystrokes.
Doing it by hand
The fix is not complicated, and it needs no particular tool. Hand the agent a reference instead of the content.
Use file references. Claude Code, Codex and Cursor all take @path/to/file.
Redirect instead of copying:
npm test 2>&1 | pbcopy # 11,000 tokens into the window
npm test > /tmp/test.log 2>&1 # then: read /tmp/test.log
Filter before the model sees anything. You rarely need all 400 lines, you need the failing ones:
grep -n -A5 -B5 "FAIL\|Error" /tmp/test.log > /tmp/failures.log
That routinely turns 5,000 tokens into 300.
And never paste a lockfile. package-lock.json, Cargo.lock and pnpm-lock.yaml are enormous and contain nothing the model can reason about beyond what one grep would have given it.
All of it works. All of it also fails the same way every manual discipline fails: at 1 a.m., when the build is broken, the log is already in your clipboard, and typing a redirect feels like three seconds you do not have. You paste. You always paste. That is the whole problem in one sentence.
What I built instead
So I moved the discipline off myself and into the clipboard. It became a small macOS menu bar app called CtxVault.
It watches what you copy. Anything above a size threshold you set gets written to a file in ~/CtxVault/ at the moment you copy it. When you then press Cmd+V in a terminal, what lands there is the path to that file, not its content. The agent reads the file when it needs it, and reads only the part it needs.
Paste anywhere else, a browser, an editor, a chat window, and you get the original text exactly as before. Nothing about copying changes for the rest of your day.
The details that mattered while I was building it, in the order people ask about them:
Double-tap Cmd+V and it pastes the real content instead, for the times you genuinely wanted the text inline. Secrets are detected before anything is written, so API keys and export KEY= lines never reach the vault. It is local, with no account and no telemetry, and talks to exactly two hosts: the license server and the update feed. It runs on macOS 14 or later and costs 14.99 euros once, for one device, with no subscription.
Install it by download, or from the terminal:
brew tap dms2323/ctxvault
brew install --cask ctxvault
The measurement in this post is the reason it exists, and it is published in full, with the script and the method, here: what a paste costs.
If you have measured this differently, especially with a real Claude token count, which I could not run, I would like to see your numbers.
Top comments (0)