I have a custom command called /wrap. When I finish a work session, I type it. It commits the code, writes down what changed, and makes a backup zip on my NAS. I use it many times a day, across a dozen projects.

This week I looked at my token usage data. One line stood out: /wrap was 30% of everything I spent.

The Need: The Cheap-Looking Thing Was the Expensive Thing

If you use Claude Code with a subscription, your allowance runs out before the week does. Mine did. So I stopped asking “what can I build next?” and started asking “where are my tokens going?”

I did not expect the answer to be a command I thought of as housekeeping.

The Proof: Two Numbers

The /wrap command file itself is about 2KB. That is a few hundred tokens. It is not the problem.

The problem was the file it told Claude to edit. In my kids media player project, CLAUDE.md had grown to 81,184 bytes. After the fix it is 46,265 bytes. The 35KB I moved out now lives in docs/CHANGELOG.md.

I can’t give you a before-and-after token count yet. Claude estimated that 81KB of mostly Korean text is somewhere around 40,000 tokens, but that is a guess, not a measurement. I will check my usage data next week and add the real number here.

The Story: A Loop That Feeds Itself

Here is what was happening, as Claude explained it when I asked.

  1. My /wrap instructions said: update CLAUDE.md with what changed this session, and follow the style of the existing entries.
  2. To follow the style, Claude read the whole file, then edited it.
  3. But CLAUDE.md is also loaded automatically at the start of every session. So /wrap was reading, a second time, text that was already in the conversation.
  4. Each wrap added one more version section. The file grew. Every session, and every wrap, got more expensive.

The file was also messy. The history had a v2.10 entry twice, in the wrong order. That is what happens when a rules file is also used as a diary.

Two problems, then. The file was too big to be loaded every session. And a command was re-reading it on top of that.

The How: Split the History Out, Then Make /wrap Append Only

I asked Claude for improvement ideas. It gave six. I did the first two, because they were the biggest.

💬 Prompt that worked “Looking at my recent token usage data, the wrap skill takes 30%. Please check it and give me ideas to improve it.”

Claude’s answer, then my reply: “Please do 1 and 2.”

Step 1: Move the version history into its own file. CLAUDE.md keeps only what a new session needs: structure, rules, known traps. The history of every version goes to docs/CHANGELOG.md. The old file keeps one line that says where the history went. Nothing was deleted. I moved the old sections as they were.

Step 2: Rewrite step 2 of /wrap. The old step said “update CLAUDE.md”. The new step says this (my own wording, translated):

  • Write the version history by appending to the end of docs/CHANGELOG.md. Do not read the file first. Use a shell cat >> with a heredoc.
  • Each entry has a header (## v2.13 — short summary (date)) and at most five lines: what changed, plus one line about any trap.
  • Do not read CLAUDE.md in full. It is already loaded in the session. Only if the structure, an API, a rule or a data schema actually changed: search for that part, read only that part, edit it, and bump the version number at the top.
  • Small changes, like adding a song or fixing a database row, get one line in the changelog and no CLAUDE.md edit.

I have two copies of wrap.md, one global and one inside the project, so I changed both.

🗂 Claude.md Rule CLAUDE.md is for rules and traps that a new session needs. History goes in docs/CHANGELOG.md, and is appended to, never read back in full.

I ran /wrap twice after the change. It committed and backed up both times, and Claude did not open CLAUDE.md in full either time. That is all I have verified.

What I Did Not Do

Claude’s other four ideas are still on the list: shorter history entries as a hard limit, archiving old diagnostic notes, a --quick mode for tiny changes, and ending the session and starting a fresh one after each big task. A long session gets re-sent on every message, so that last one may matter more than I think.

I should also say this: the CLAUDE.md for this blog is 62KB. The same loop is waiting for me here.

Cost of the fix: $0. It took about three minutes of one session.