top | item 44879053

(no title)

gdudeman | 6 months ago

A tip for those who both use Claude Code and are worried about token use (which you should be if you're stuffing 400k tokens into context even if you're on 20x Max):

  1. Build context for the work you're doing. Put lots of your codebase into the context window.
  2. Do work, but at each logical stopping point hit double escape to rewind to the context-filled checkpoint. You do not spend those tokens to rewind to that point.
  3. Tell Claude your developer finished XYZ, have it read it into context and give high level and low level feedback (Claude will find more problems with your developer's work than with yours).
If you want to have multiple chats running, use /resume and pull up the same thread. Hit double escape to the point where Claude has rich context, but has not started down a specific rabbit hole.

discuss

order

cube00|6 months ago

> Tell Claude your developer finished XYZ [...] (Claude will find more problems with your developer's work than with yours).

It's crazy to think LLMs are so focused on pleasing us that we have to trick them like this to get frank and fearless feedback.

razemio|6 months ago

I think it is something else. If you think about it, humans often write about correcting errors done by others. Refactoring code, fixing bugs and write code more efficient. I guess it triggers other paths in the model, if we write that someone else did it. It is not about pleasing but our constant desire to improve things.

sixothree|6 months ago

I've been using Serena MCP to keep my context smaller. It seems to be working because claude uses it pretty much exclusively to search the codebase.

lucasfdacunha|6 months ago

Could you elaborate a bit on how that works? Does it need any changes in how you use Claude?

nojs|6 months ago

In my experience jumping back like this is risky unless you explicitly tell it you made changes, otherwise they will get clobbered because it will update files based on the old context.

Telling it to “re-read” xyz files before starting works though.

bamboozled|6 months ago

I always ask it to read the last 5 commits and anaylize and modified or staged files, works well...

oars|6 months ago

I tell Claude that it wrote XYZ in another session (I wrote it) then use that context to ask questions or make changes.

ewoodrich|6 months ago

Hah, I do the same when I need to manually intervene to nudge the solution in the direction I want after a few failed attempts to recontruct my prompt to avoid some undesired path the LLM really wants to go down.

insane_dreamer|6 months ago

I usually tell CC (or opencode, which I've been using recently) to look up the files and find the relevant code. So I'm not attaching a huge number of files to the context. But I don't actually know whether this saves tokens or not.

FajitaNachos|6 months ago

What's the benefit to using claude code CLI directly over something like Cursor?

qafy|6 months ago

the benefit is you can use your preferred editor. no need to learn a completely new piece of software that doesnt match your workflow just to get access to agentic workflows. for example, my entire workflow for the last 15+ years has been tmux+vim, and i have no desire to change that.

KptMarchewa|6 months ago

You don't have to deal with awfulness of vs code.

Wowfunhappy|6 months ago

I do this all the time and it sometimes works, but it's not a silver bullet. Sometimes Claude benefits from having the full conversation.

rvnx|6 months ago

Thank you for the tips, do you know how to rollback latest changes ? Trying very hard to do it, but seems like Git is the only way ?

rtuin|6 months ago

Quick tip when working with Claude Code and Git: When you're happy with an intermediate result, stage the changes by running `git add` (no commit). That makes it possible to always go back to the staged changes when Claude messes up. You can then just discard the unstaged changes and don't have to roll back to the latest commit.

gdudeman|6 months ago

Git or my favorite "Undo all of those changes."

gdudeman|6 months ago

I'll note this saves a lot of wait time as well! No sitting there while a new Claude builds context from scratch.

i_have_an_idea|6 months ago

This sounds like the programmer equivalent of astrology.

> Build context for the work you're doing. Put lots of your codebase into the context window.

If you don’t say that, what do you think happens as the agent works on your codebase.

gdudeman|6 months ago

You don't say that - you instruct the LLM to read files about X, Y, and Z. Putting the context in helps the agent plan better (next step) and write correct code (final step).

If you're asking the agent to do chunks of work, this will get better results than asking it to blindly go forth and do work. Anthropic's best practices guide says as much.

If you're asking the agent to create one method that accomplishes X, this isn't useful.

bubblyworld|6 months ago

You don't have to think about it, you can just go try it. It doesn't work as well (yet) for me. I'm still way better than Claude at finding an initial heading.

Astrology doesn't produce working code =P

seperman|6 months ago

Very interesting. Why does Claude find more problems if we mention the code is written by another developer?

mcintyre1994|6 months ago

Total guess, but maybe it breaks it out of the sycophancy that most models seem to exhibit?

I wonder if they’d also be better at things like telling you an idea is dumb if you tell it it’s from someone else and you’re just assessing it.

bgilly|6 months ago

In my experience, Claude will criticize others more than it will criticize itself. Seems similar to how LLMs in general tend to say yes to things or call anything a good idea by default.

I find it to be an entertaining reflection of the cultural nuances embedded into training data and reinforcement learning processes.

daveydave|6 months ago

I would guess the training data (conversational as opposed to coding specific solutions) is weighted towards people finding errors in others work, more than people discussing errors in their own. If you knew there was an error in your thinking, you probably wouldn't think that way.

gdudeman|6 months ago

Claude is very agreeable and is an eager helper.

It gives you the benefit of the doubt if you're coding.

It also gives you the benefit of the doubt if you're looking for feedback on your developers work. If you give it a hint of distrust "my developer says they completed this, can you check and make sure, give them feedback....?" Claude will look out for you.

yahoozoo|6 months ago

I thought double escape just clears the text box?

gdudeman|6 months ago

With an empty text box, double escape shows you a list of previous inputs from you. You can go back and fork at any one of those.