Maximizing the value of your Claude Code sessions
claude.comI have 1h cache TTL set, and do nothing to cause rewrite (response in time, no model/effort/tool changes).
At 400K tokens in, I'll write a message, and /usage shows only a small increase in cache write. On the next message, cache writes shows 800K, and by the end, I often hit 2M cache writes with no explanation.
This seems to happen when: using /btw, asking it to review code, other random times. Anyone know what's going on?
_entirely_ vibecoded don't @ me.
Depending on how you're triggering reviews, you may be using a sub-agent?
It seems to be regular file edits rather than parallel tool calls.
I'm sitting on 1.6m cache write even now with 468k in /context. It drives my session costs above $100 regularly.
Can someone from Anthropic look into this?
I guess if I had to ask something (as someone who doesn't use CC as their daily driver), how much control do you have on subagents and roughly how do define or know when a session is getting too long? I know the answer is "when the model is getting worse" but worse is doing a lot of lifting in that sentence.
If you have to explain that someone is "holding it wrong"(1), that is product error, not a user error.
(1) https://www.wired.com/2010/06/iphone-4-holding-it-wrong/
Especially the /compact part. Like, if a session has been idle for 55 min, why not just automatically run compact at that point?
Oh yes, Claude will do all sorts of different things -- it depends on how you use it! You should totally learn all of these little finicky things ... because now completing your tasks cost money. It's not "free" anymore haha like when you used your old text editor, what are you a grandpa?
Oh, and those things will definitely change, as we (the priests of Claude) are vibe coding the system you use to do your little "tasks" ... right, you can't see how it works ... the code is not available. It's all good, just trust us -- we're totally looking out for you.
I mean it is utterly ridiculous to talk around this model of development. There are so many walls between you and doing the thing you want to do.
Agents are great, but the notion of "best tricks" for how to best use an opaque costful tool which will, by all odds, be completely different in a few months time is quite funny.
You know what won't change? A fucking text editor. Or your pi config, or a local model you run and trust.
I mean, agentic coding software is hardly the first tool to exist where learning some idiosyncrasies of how to use it well can result in more efficiency and cost savings.
- I'm happy to learn how to use tools efficiently
- I like to be able to inspect my tools
- I'm against tools changing underneath me
Are you against any of these points?
My contention is that we should be building towards less churn, not more. I'm aware that some churn is the cost of engaging in any sort of enterprise, but I'm deeply suspicious of an AI company inserting themselves between me, and the tasks I wish to do with my device -- with a completely opaque system that I can't really "learn".
I've never become used to it. My impression is that the constant churn has accelerated. Plausible drivers are (1) normalize novelty as desirable (like fast fashion), (2) product developer/designer incentive structures that reward revolutionary change over progressive refinement. The global switch to subscription models and continuous deployment didn't help.
> more like services and less like physical tools that never change.
I'm not sure that constant change is a characteristic feature of services, especially not professional services.
It used to be that you bought a piece of software and used that version until you decided it was worth upgrading, like a particular physical tool. The software still evolved, just like the design of physical tools can, in principle, evolve.
All that said, agentic AI tooling is evolving so rapidly I'm not sure an expectation of stability is realistic.
But Claude is running on someone else's computer, not yours, so it's not Photoshop so much as AWS. Or a rented server farm, if AWS is too new school for you. Of course there's an ongoing cost! And if you configure the server to use more electricity, you get billed more.
If you want to do agentic tooling locally, you can do that—the models aren't quite as good, but they're not bad either. But be warned, for the large models you're going to have to acquire some serious hardware, to the point where you may wish you'd chosen to just rent it instead!
and as is normal for hosted models, almost everything... based on load flucation they may even send your prompt to a quantised model
Am I to believe the creators, knowing full well that the source will, as Boris Cherny put it in a recent interview, be deleted and rewritten from scratch at the release of the next big model?
Further: I'm responding to content in the blog post itself:
> Until pretty recently, the tools you wrote code with were a flat fee (or free). Your editor cost the same whether you fixed one test or fifty that afternoon, so an individual task didn't really have a price of its own.
I find this type of prose ridiculous. It conveys "this is the way things are now, get used to it".
Does that make sense?
This is absolutely what AI companies and AI lovers want you to believe
i guess you do? claude code is the commercial closed sourced version provides by ant. reading a mini version of vllm or sglang and then read codex source code or grok build source code will teach you all things taught by this article, fully in the open
it is like saying that you have no insights into some $commercial_db_system which is kinda true but imagine if the article is to teach you indices, query normalization, etc..
Everything is version pinned and a deliberate choice to change, and a git revert away from changing back.
TBF the models may change underneath me to some extent still, but the cost benefit of running them myself doesn't pan out yet (for agentic coding at least, don't have enough local vram to get a usable context window and generation speed, self hosting on runpod or similar isn't economically sensible for my current consumption though I have tinkered with it)
A postgres index post is unlikely to reach front page. It's already part if the docs, and should include more context to be read worthy.
They are not equal comparison.
This before the fact that there is no guarantee that a model follows your agent instructions (plenty of easy to reach for research on it), and you also get suggestions by devs at these companies to wipe parts of your model's instructions because the model is better now tm.
If cloud providers change their billing quasi monthly, and if you'd need to fiddle with your indexes every couple of days. I'm not sure we'd be using them as much.
There is interesting information about the inference pipeline, but almost too late to the party (by at least a year), and for which audience? Techies understand in broad strokes the tech if they are interested, normies will definitely not read it.
All that to say, that yes, it's worth having a laugh. If for nothing else, as a release valve for all the problems they create in the real non-VC world.
Anthropic is IPOing in October according to news, you might be interested in investing.
But you might be right, engineering around the difficult LLM primitive might be a task which is just too hard for your typical software engineer, as you said, they want predictability, hand holding, determinism, most are unable to deal with the real world which is not a spherical cow in a vacuum. So I guess they can stick to simple very well understood primitives like EC2 or Postgres and leave dealing with LLMs for others.
When AI firms ate more than half of global VC private investment in 2025 https://www.oecd.org/en/about/news/announcements/2026/02/ai-... I would expect better results than what we have today.
The most well paid people in the industry brought us here. And "here" is very much as fuzzy as last year with better harnessing towards the local optima. And I say local optima because even the perceived capabilities have slowed down, nevermind the benchmark numbers which are in aggrement.
The best paid engineers in the world, with almost no practical budget limit, still deliver shoddy quality software with AI. Is that not fact? And if it is what does that say for the rest of us.
You are allowed to believe. I'm still waiting for the beneficial results, not only those that benefit griefters, hackers and scammers. AI has been a huge boon there.
Reality will materialize and markets will redress hopefully once they go public. Which they very much seem to be hesitant to do right now.
Not sure what your baseline was, if you said 10 years ago "in 2026 you'll be able to describe an app into the microphone, and the computer will write by itself in one day 50k lines of code to implement it, in a language and tech stack of your choosing, costing $200, and it will sort-of-work, and it will be at least as good as a junior-level programmer writing it from the same requirements in 3 months", most people would have said "implausible, that's at least 50 years away"
For more than a year now I was renting a limited GPU server for ~300$/month to learn, experiment, research and build internal tooling around open weight models. Thinking they are tools with potential and buying the exaggerated marketing are different things.
My history of comments on HN lands often on both providing what I believe to be my insights working with LLMs and calling out exaggerations, stupid terms of service, and the other mishaps in the field. You are free to browse them if you'd like to see my broader opinion.
Why do you think that Anthropic wants fewer tokens inputted and outputted?
They have also been supply constrained on compute and if users cost them less in compute they can more subscriptions and less customer frustration.
I agree they want you to have a subscription. That doesn't mean they aren't aligned with their subscribers.
And the unit economics need to be there because there are competitors in the space. They can't just skin you on tokens or you'll jump ship.
I can imagine there are coding tasks where small edits to an existing huge codebase mostly consists of some small tool calls + processing a lot of input tokens, in e.g. a 20 to 1 ratio of input to output tokens.
https://github.com/anthropics/claude-code/issues/63930
This issue suggests that 74% of the charged input tokens could actually have been cache reads if claude code hadn't busted the cache. On the input side of things, this increased the cost (or count towards allowance) by ~3x (given that cost of cache write is 1.25 the unit price, and read is 0.1x the unit price).
OpenAI has a different cache pricing strategy, where cached reads are only 0.5x the cost, but cache writes do not cost extra.
Not sure how the unit economics play out claude vs openai, but it's safe to say that caching costs play a huuuge factor in this. It seems to be one of anthropic's USPs as a frontier-AI lab. They charge a premium for cache-writes (on top of the inflated token usage compared to OpenAI that was recently reported), but significantly discount the cache reads. The lack of care in tackling issues related to cache-busting is therefore really bad and suspicious.
seriously... priorities yeah?
It's wildly lazy.
The bet with this blog post is that things WON'T be completely different in a few months time. I'm going to absorb things from this blog post, and the downside of my bet is the chance that none of this will apply.
Heh I will grant that three months is a looong time in llms hours :-)
Also bro: Run /clearbetween tasks. This prevents prior irrelevant context from being sent back to the model, which can reduce token usage. Set your model and effort level before you start. Changing either one mid-conversation can bust your prompt cache, which can increase token cost. @-mention files instead of naming them. The file gets attached to your message directly, which saves a Read call, or a search if Claude has to go find it. Add quiet flags to noisy commands, or run them in a subagent. Command output is added to the conversation just like a file, and stays there for the rest of the session. Run /context once in a fresh session. It shows what's loaded (CLAUDE.md, MCP tool definitions), so you can cut out anything unnecessary. /compact before you take a break from your keyboard. The prompt cache expires after an hour, and summarizing a conversation is much cheaper while it's still cached.
don’t do that, it is weird, use “bruh” or “dude”
I remember when the internet was an exchange of ideas instead of using gender to justify value of bad ideas
I frequently run Fable at xhigh effort to run statistical modeling way above my undergraduate understanding. Claude Fable produces Masters-degree level output, and then I spend lots of round trips asking it to explain different parts to me.
The first part absolutely uses the extra effort, but the interrogation exercise is something a much simpler model, or the same model with much less effort, could answer.
I would be really curious to know as well, why effort is linked to cache as its quite inconveniant. Is it possible the token used to indicate effort is only passed once at the start, not per thinking trace, or quite simply that different efforts have different model weights?
Previously you were at A+Y. Switching to medium reasoning makes it B+Y. There’s no prefix which can be cached, so the entire B+Y needs to be reprocessed.
• https://news.ycombinator.com/item?id=49080605 (JetBrains, Does Speaking to Agents Like Cavemen Save 65% of Tokens? We Test)
• https://news.ycombinator.com/item?id=48588755 (The Token Compression Illusion: Why I'm Skeptical of RTK )
Love Claude, but the @ mention is broken in the desktop app. For the same project if I type the same query "@ephem" I get:
CLI: https://imgur.com/a/VZMUCOa (good, relevant results)
Desktop: https://imgur.com/a/QLSo4Ms (bad, irrelevant)
Opened issue for this and it was automatically closed:
https://github.com/anthropics/claude-code/issues/71421
I could have written the issue better (using CLI as comparison instead of VS Code). But, no doubt in my mind Claude could fix this itself in a minute.
Clarification: It wasn’t closed on submission though. It sat open ~17 days, a bot marked it stale, and it closed when nobody responded to the stale label.
The two-phase thing is the part I didn’t know until recently: the stale label is basically asking “is this still relevant?”, and answering it makes the bot back off next time around. nixpkgs does the same. Bumping feels wrong on most trackers, agreed, but at this issue volume I don’t know what else works.
Anyway a comment should reopen it. Your CLI vs desktop screenshots are a better repro than most things in that tracker.
I'm not saying it's a perfect solution but for projects that deal with large amounts of issues it's workable.
It'd save the run around and have the same ultimate effect. Or, we could properly work on tickets instead of making the gate "has enough time to follow up on this 14 days later"
Just because someone moved on from your broke ass product doesn't mean the bug was fixed. I can't count how many times I'll find an old bug still there years later closed with 5+ duplicate issues all linked back to the same closed github issue that was closed as stale.
It's just bullshit. Having a lower count on your issue tracker doesn't make the actual bugs disappear folks
I've shifted most of my usage to Codex/ChatGPT Work. The UX of appshots, browser annotations (now available in claude), and the computer use being so much less intrusive in OpenAI.
It's all so tiring. I care less and less about Claude every single day because of the usage caps and the constant optimizing that has to be done. The whole point of AI was to get past this type of bullshit. They've failed miserably at their jobs.
I sometimes just leave some goals or something running before I go to bed or out and I don’t want to pay the cache text when I come back.
I've heard it argued that this is an antipattern. If the file is large, it will read the whole file. With Read or something similar, it can do a targeted search and read only the relevant portion.
Is this still not the case?
Also, since they mention /context: Can anyone explain why /context takes so long to run? It usually takes several seconds, and I've had cases of it taking over a minute.
And why don't they just show the basics in a status line somewhere? Just a plain: "120K/200K tokens" I hate having to type /context just to get this. And I shouldn't need to install an extension.
I suspect you're right and that's why they haven't fixed @-search in the desktop app.
I actually don't find myself using it anymore since moving to the desktop app. I went from using various AI extensions in the IDE to Claude Code desktop.
But if that's accurate, why mention it in this post? Maybe because that's the first thing developers will try when moving away from a code editor?
I'll never understand why anyone would want to restrict themselves to a terminal interface instead, and I say this as a Vim user.
It is shown in Claude Desktop if you care to check in Settings > Usage, sure - but not in Claude Code, updated as you work with it.
> I'll never understand why anyone would want to restrict themselves to a terminal interface instead, and I say this as a Vim user.
I usually work with Claude in tandem, that is: The agent is actively working while I am either reviewing code or making changes myself in other places. So this means I want to work within my IDE. If you use Claude Code to vibe-code without interacting with the codebase at all, the Desktop app is probably fine, but for all other purposes, you'll need to run it either in the CLI or integrated into your editor.
And since I use different editors and don't like using either a sub-par U integration or locking myself into the harness of my IDE's vendor, I prefer the CLI as a universal way of running Claude Code.
What? Claude Code shows you context window and session limits right next to the text input box.
The app has a context wheel on the right of the chat box, showing both current conversation context breakdown and 5h as well as weekly limits.
- it gets attached early so fully cached, even if later cache is busted
- it gets included in every request automatically, so if your following requests are going to keep triggering File Read requests it will be much cheaper and faster to keep sending it
My main question is how this works if Claude itself keeps editing the file. Surely then you are sabotaging your own cache rather than helping it.
The things to add this way would be static files that you don't expect to change and to be highly relevant to the following requests. Especially if you want them to be mandatory reading and not just hope the agent will read it.
If you type /resume right after clear, the first thing in the list is the session you just cleared.
Some versions of Claude Code had memory leaks. Therefore or was better to exit Claude Code and start a new session rather than /clear.
* In theory the system prompt is always the same and should therefore be cached, but in practice there's some dynamic strings in there so it doesn't work that way. (Unless they changed this recently.)
- https://github.com/anthropics/claude-code/issues/47756 > [BUG] /clear bleeds into the next session (what also breaks cache)
- https://github.com/anthropics/claude-code/issues/47098 > [BUG] new sessions will *never* hit a (full)cache
I mean, they told us "just talk naturally to the AI because it's so much smarter than all you meatbags" and now it's “for best results, please learn to manage context windows, prompt caching, cache invalidation, model switching, output verbosity and when to manually clear or compact your session.”
I get it, but it seems like the "PRODUCT" should be doing this shit. I.e., the PRODUCT is getting less efficient because I didn't manually manage its context correctly and now it's MY fault.
Edit: i.e., for e.g. Doh. Even the robots get that right. Sigh.
Anthropic has no incentive to make their products more efficient as long as they're selling them by the token.
Unless I am fully not understanding your comment and you don't actually mean “humans require communication skills too” which in honesty feels orthogonal to my complaint.
It's true both that it can be smarter than all us meat bags and that talking to it a certain way gets better results. On some of the things it's a limitation of the technology and on some of the others it's just how information and effort work in any context. I don't see it as orthogonal to your complaint, I see your complaint as misplaced frustration, like Anthropic invented GIGO and compute so they'd have an excuse to write a blog post.
Oh well.
I know we supposed to do this but is there any particular reason why such things cannot be supported? I thought its running on same model just different settings like reasoning. This would be super useful.
Basically:
- /handoff file creates a short document with the important context from your current session and maybe next steps as checklist.
- You can then start a fresh session with /continue file
- You can also hand the work from Claude to ChatGPT, or the other way around. Very useful at time of session limits.
- Plus your handoff files becomes a useful piece of project memory that you can reference later.
I find this much more useful than /compact or /clear because the context is saved in something portable instead of being tied to one session and i've seen better results doing this every 20 messages or so than running long sessions.
And I think plan files should focus on general ideas and invariants, not do “implementation as prose”. That way they perform as mini-ADRs that are useful historically, especially to mine why the system is the way it is.
I managed even the orchestrator to NOT read the plan whole, at once, but in sections.
The most useful thing is the task ledger the task agent leaves behind, which alongside its structured status message makes a very resilient handoff between all stages.
I've been doing this since I started agentic development, and have a whole framework based on this; Simply put I define workflow s that output templated files for everytype of tasks that happens in development.
It's a powerful pattern I'd recommend everyone.
- Prefix-numbered sets of documents, keeping them clustered visually and easily referenced by humans and agents. (124.5 = docset 125, phase 5) - Each doc gets a suffix. Most of the time STRATEGY is the first doc. Sometimes NOTES, DISCUSSION, or HANDOFF though. - Once the strategy doc is comprehensive, the multi-phase checklist PLAN doc can emerge. - During execution, the agent drives the PLAN while purposefully expanding lightly scaffolded phases before entry. - As the user, I drive a PROGRESS doc during the PLAN execution. This tracks the progression of my own questions and the important work summaries that I need for tracking the current work trajectory and for historic analysis over past decision-making. - Any concern that exceed the scope of the active docset numbers calls for a new one. - A "docs/archive" folder is kept where I sweep docsets into numbered eras.
I have aliases and templates too, but DDD is so simple that it's overkill.
Any modern reasoning agent can take the plain explanation above and understand you effortlessly when you say "open a new docset strategy" or "read docset 125 and proceed".
I now feel a bit silly but I reinvented the wheel during my last lil project and indeed found it very powerful. A variant of it is the "implementation (handover) prompt" when I conclude the planning session with plans and design documents, updated handoff, clean tree and a file for a new Opus implementing orchestrator (unusually do a single, highly specific implementer and a single, highly specific tester).
After implementation and task-level tests I end up with a long and very detailed implementation progress ledger and a summary findings from the orchestrator.
Then in the new session I do the whole branch tests.
Works really well, uses much less tokens than any other approach with more of Opus and very little repetitions/corrections.
I've been asking Claude to remember important points from our session, or future tasks. Then /clear and continue.
It might be even better if the harness were to automatically write a handoff note under some circumstances? If the user is away and the cache is going to expire, that would be a good time to do it.
If only they had some kind of technology that could make a judgement and automate those actions...
if youre working on the same codebase, that cache stays quite relevant, and i dont think they make the case that clearing and reading the same couple files over and over again is cheaper that relying on it already being cached. same with doing some of the same teaching claude the right way to approach changes in that codebase again and again.
what would be nice is pulling back and reusing an earlier part of the cache for the later two tasks, but claude code doesnt make that particularly easy, and using an LLM to pick where to go back to isnt really gonna save much when it reads all the same text again.
With Qwen 3.8 27B, we're one step closer to on-device LLMs that can replace subscriptions.
I guess compacting somewhat does that but I want something more explicitly that trims out these extremely bloated artefacts while maintaining in full the actual conversation history.
> 5-minute cache write tokens are 1.25 times the base input tokens price > 1-hour cache write tokens are 2 times the base input tokens price
https://code.claude.com/docs/en/prompt-caching#on-a-claude-s...
https://platform.claude.com/docs/en/build-with-claude/prompt...
Until pretty recently, the tools you wrote code with were a flat fee (or free) … [so] an individual task didn't really have a price of its own … [but] with agentic coding tools like Claude Code, it does.
I’ve heard this anti-AI thesis before, but it’s certainly novel to read it on “claude.com”.Yes. https://magazine.sebastianraschka.com/p/controlling-reasonin...
1. My agent writes code.
2. Then it creates tests and verifies that all of them actually work, not just pass. To do this, my agent writes the test, then it deletes the code it covers, reruns the test, confirms it goes red, and finally puts the code back.
3. I receive the ready-to-test code and environment setup.
4. I check that the business logic works as I expected it to be on a working product. Here we usually do several iterations of coding and bug fixing.
5. When the manual part is finished, the agent starts an external review using /code review skill. At that stage, it makes some additional fixes and corrections to the tests.
6. Finally, a branch is ready to be merged. We start CI/CD and wait until the run finishes successfully.
That's what I actually use because it generally works.
Note about only docs PRs: I just ask the agent to make the changes, then it runs the / code review skill, and then we merge the branch into main without CI running.
Why? Are you aware of red/green/refactor?
- review system prompt + cut it down or remove completely
- review agents.md file(s), check which ones are loaded, remove or improve them
- review context spam from tools, skills etc, de-activate all, see what needs re-adding
- review past sessions to see where tokens get wasted
more advanced: - keep sessions short (be conscious about compaction)
- form a habit of starting new sessions
- deliberately practice how to effectively get the right context into a new session (vs hanging on to a 'good' session)
- you can ask the agent to write the essential context into a .md file and have the new session read that
- learn about forking sessions
- experiment with starting sessions from a custom-built history/context
a good agents.md file can be small and still effective re helping the agent navigate the code basethat said: you will surprised by how well current models can navigate (way better than last year!)
Would be nice if it was easier to separate output that needs to live in context and stuff I just want to look at.
One thing I wasn’t aware of was the negative impact of switching models