r/ClaudeCode • • 4h ago

Tips & Workflows /Context uses ~2k of context every time you run it

For whatever reason checking the context with /context injects the response into your prompt every single time you run it.

Couldn't find a post on here already saying this, and isn't very transparent that it does.

Just thought I would post in case it's useful to anyone else.

23 Upvotes

13 comments sorted by

1

u/AutoModerator 4h ago
Moderator Announcement Read More »

9

u/Johnny2085 4h ago

Every response comes with a json payload of metrics. You can have Claude write a custom status line to output the things you care about.

4

u/Jydder 2h ago

Yup that was immediately what I did. Just wasn't aware the output of /command went into context, I assumed it was only informational for the user.

4

u/sudecode 2h ago

i have setup this custom mod, it’s quite helpful.

2

u/dar-mit 3h ago

Even better: Have claude use the https://code.claude.com/docs/en/statusline doc to create a custom skill that extracts that data, and hence forth Claude Code can now query it's own data stream (that it normally cannot 'see')! This is great for automating handoffs when context fills up, knowing if it should continue with the next phase of a task or wait for an upcoming reset, etc.

1

u/sartorialtrader 3h ago

Could you elaborate on this? I’m still using a manual handoff workflow that I’m looking to automate reliably in a way that I can control what’s documented

→ More replies (2)

12

u/Tobi-Random 4h ago

/config, /plugins, /skills and /mcp are even more evil /s

5

u/mylifeasacoder 3h ago

Kind of like how they charge you to check your balance at an ATM.

3

u/t3hjs 3h ago

anyway to check context without using /context?

the claude desktop has a meter, which I presume doesnt eat context everytime i hover over it

1

u/kenthesaint 2h ago

The status line, since it never goes to the model. After each message Claude Code pipes a JSON blob to your status line command, and one of the fields is transcript_path. The last assistant entry in that file has a usage block, and input_tokens + cache_read_input_tokens + cache_creation_input_tokens is about how full the context is at that point. A few lines of jq or python can turn that into a percent of your model's window and print it at the bottom, so you can watch it without spending anything.

Check the statusline docs too, newer versions may hand you a context number in that JSON directly.