Top
Best
New

Posted by twapi 16 hours ago

Maximizing the value of your Claude Code sessions(claude.com)
213 points | 122 comments
superasn 11 hours ago|
Recently I came across the /handoff skill, which I've been using a lot. I find it much better than /compact.

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.

3371 4 hours ago||
> Plus your handoff files becomes a useful piece of project memory that you can reference later.

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.

poseva 3 minutes ago|||
Can you please add more details? Thank you in advance!
ulimn 1 hour ago|||
I started doing this and then a colleague of mine recommended me OpenSpec. It might be overkill for small projects but it’s pretty clean and if you have goldfish memory like me, it helps to track changes.
devoidfury 3 hours ago|||
I like the handoff flow so much I built it into my agent as a native tool; and going to add it as a auto compaction strategy as well.
sjanes 9 hours ago|||
/handoff is the skill I use when I plainly are about to run out of token budget to give to a different harness system. Using this to avoid long sessions is something I will need to try, plus maybe "caveman" mode to cull the verbosity.
ls612 11 hours ago||
I have been doing this a lot even without a skill, having Fable write a planning document, then spawning an Opus subagent with instructions to strictly follow the plan and report any deviance at the end. It also helps that then the plan is always saved in an md file so any future agent can look at it and see what happened.
CBLT 9 hours ago||
Interestingly, this was tackled in this blog post[0] a month ago. They claim that plan files aren't token-efficient, because after reading the plan the workhorse model then reads all the relevant files anyways.

[0] https://news.ycombinator.com/item?id=48916512

hombre_fatal 7 hours ago|||
That link just says the planning stage should vet the idea concretely so that the plan focuses on a solution that won’t immediately have to pivot.

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.

inopinatus 7 hours ago|||
The trick is to delete all the relevant files after the plan is written.
rhaksw 14 hours ago||
> @-mention files instead of naming them

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.

guessmyname 13 hours ago|
> Opened issue for this and it was automatically closed: […]

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.

watwut 1 minute ago|||
The stale bots are such a crap.
DangitBobby 13 hours ago||||
By what definition of automatically does a bot closing an issue with low activity not count as "automatically closed"?
Banditoz 13 hours ago||||
Just because a Github issue doesn't have activity doesn't mean it's not an issue anymore.
kristjansson 13 hours ago|||
the norms of issue trackers are strongly opposed to “bump”. these autoclose bots may yet change that
Doohickey-d 12 hours ago|||
Yes, now the poster of the issue just needs to (tell claude to) write a bot which posts a "bump" comment every 17 days, and the bots will cancel each other out.
hackernudes 13 hours ago|||
In this case there is a two phase staleness check. The bot marks it as stale and it is correct to "bump" it if you think it is still important. The nixpkgs repo works the same way. I think it backs off from adding stale again as it gets bumped.

I'm not saying it's a perfect solution but for projects that deal with large amounts of issues it's workable.

jaggederest 6 hours ago||
They should just utilize the old joke about hiring: immediately throw away half the tickets, because you don't want to work on an unlucky ticket.

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"

Glyptodon 14 hours ago||
What I see is that I have to read a bunch of stuff and go through a bunch of hassle to save money when the root of it is that if I tell an AI to do work on a task while I'm busy with something else and come back later I've doubled my cost because the cache expires too quickly?
chamsom 14 hours ago|
As a driver I want to spend the majority of the day optimizing my truck's gasoline usage so that I can focus on optimizing my productivity for an outcome I am too far disconnected from to care about anymore.
jnwatson 15 hours ago||
Can anyone explain why the prefix cache is tied to effort?

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.

hellohello2 14 hours ago||
One trick is to simply as for a fast answer when talking to a high effort model, when working interactively. Sounds stupid but I do this all the time and it works. Just tell it you are working interactively now and need ultrafast answers with no thinking.

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?

janalsncm 14 hours ago||
I’m guessing that there’s a system prompt at the top telling the model about its reasoning budget. So when you switch reasoning effort it busts the cache.
cellularmitosis 1 minute ago|||
Maybe switching effort routes you to a different rack of gpu’s which don’t have the cache
SoMomentary 6 hours ago||||
That makes sense to me. The output styles work the same way.
foota 10 hours ago|||
Hmmm... Why wouldn't this be handled like other end of prompt things like the current mode?
BeetleB 14 hours ago||
> @-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.

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.

sadfgknerknksdf 13 hours ago||
You can make your own status line with something like "120K/200K Fable 5", it's nice.
9dev 13 hours ago|||
You can do tons more, really. There’s even a built-in /statusline command to modify it; mine shows both context window usage alongside session and weekly limit, all of them as progress bars. Just ask Claude to do it.
user43928 2 hours ago||
That's what is shown by default in the app.

I'll never understand why anyone would want to restrict themselves to a terminal interface instead, and I say this as a Vim user.

50or05 2 hours ago|||
except in vsc, there it cannot do it
rhaksw 14 hours ago|||
> 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.

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?

zmmmmm 10 hours ago|||
so i actually read beyond the TLDR and the reasons are:

- 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.

flonle 13 hours ago||
[dead]
nathanyz 14 hours ago||
This feels like the Anthropic version of "You're holding it wrong" (1)

1) https://www.wired.com/2010/06/iphone-4-holding-it-wrong/

agumonkey 14 hours ago||
It feels worse. It's all noob level suggestions that any decent system would have optimized away already.
onlyrealcuzzo 12 hours ago||
Step 1: use a different LLM that isn't 10x slower and 2-5x more expensive for the same level of quality.
zmmmmm 8 hours ago||
What I want is a version of `/clear` that keeps the conversation but drops out things like bloated logs, error traces, etc that were only relevant in the immediate local context.

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.

hetspookjee 5 hours ago||
Create a skill for this that you can invoke a new session in referencing your previous session id. Your instructions here read clear enough it seems to create it. Though a handover skill with this kind of behaviour in the same session might be more economical given the cache materials is already there.
dizhn 54 minutes ago||
Wouldn't that context with gaps where the output should be confuse the agent too much? At the very least they should be replaced with an explanation that sections were redacted. Otherwise I am imagining the agent will think the commando failed or it won't know how it fixed something.
apt-apt-apt-apt 15 hours ago||
I'm finding that unexpected cache rewrites cost me huge.

I 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?

AlexErrant 14 hours ago||
To not answer your question, I have a claude stop hook that my status line uses to tell me how close my cache is to expiring https://pastebin.com/JLXUG16Q

_entirely_ vibecoded don't @ me.

Esras 10 hours ago|||
You may be running into a "known" bug with Claude Code: https://github.com/anthropics/claude-code/issues/63930
apt-apt-apt-apt 7 hours ago||
This happens all the time and drives me bananas.

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?

radlad 13 hours ago||
I have long suspected but not confirmed that /btw uses a lower tier model like Haiku.

Depending on how you're triggering reviews, you may be using a sub-agent?

crthpl 6 hours ago|||
it does not use haiku. you can just ask Claude (possibly not fable BC of cyber) to reverse engineer the obfuscated JS.
apt-apt-apt-apt 12 hours ago|||
I don't use sub-agents, only the normal linear message-response flow.
fwlr 4 hours ago||

    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”.
lovasoa 2 hours ago|
I don't understand why changing effort levels busts the cache. Couldn't effort levels be a decoding-only thing where they just change the probability of the <end of thought> token? Are they literally adding a hidden system prompt that says "effort level: $level" ?
Philpax 1 hour ago||
> Are they literally adding a hidden system prompt that says "effort level: $level" ?

Yes. https://magazine.sebastianraschka.com/p/controlling-reasonin...

Traubenfuchs 2 hours ago||
Obviously it‘s something being put in the context that can not be taken out of it anymore.
More comments...