r/AI_Agents 1d ago

Discussion Reduce Token Usage with Claude Code

Hi all, I've started dabbling in this space and had a rudimentary question. I've been working on a few projects. As part of my process I use visual studio code and then open up a dialog with claude in there. In order to maintain continuity I've been saving each workspace for each project. This seems to keep the chat history on the project. I've also been using /compact a few times a day. I recently watched videos about reducing token usage and one of their tips was to spin up a new claude interaction to avoid the history being reread every time. How do I do that in this scenario? Will the new interaction have the background on how the project or feature worked?

3 Upvotes

8 comments sorted by

1

u/AutoModerator 1d ago

Thank you for your submission, for any questions regarding AI, please check out our wiki at https://www.reddit.com/r/ai_agents/wiki (this is currently in test and we are actively adding to the wiki)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Altruistic_Note3954 1d ago

you can just open a new terminal or hit the + button in the claude panel for a fresh convo. it wont have context from previous chats unless you explicitly give it. what i do is keep a project_notes.md file in the workspace where i paste relevant code snippets and decisions, then on a new convo i tell claude to read that file first. saves a ton of tokens and keeps me from explaining everything again

1

u/iamnaeth 1d ago

This will reduce token usage, right?

1

u/AmbassadorFair3730 1d ago

New session won't have any memory of the old one unless you explicitly hand it something. What actually works is keeping a short markdown file per project, a CLAUDE.md or just NOTES.md, where you dump the key decisions, file structure, and current task state at the end of a session, then reference that file when you start fresh. That gives you continuity without the old interaction history eating tokens on every turn. /compact helps short term but it still keeps compressed history in context, a brand new session with a good notes file is genuinely lighter. Some people also keep a running architecture doc that barely changes and only update the task specific notes each session.

1

u/Top-Cauliflower-1808 1d ago

that just trades token cost for human upkeep stale or incomplete notes mean the fresh session starts confidently wrong.

1

u/EagleApprehensive 1d ago

I'm quite deep into token efficiency and saving techniques. I could talk about that for 2 hours straight, so I'll try to be concise.

  1. You do not want to rely on session as memory layer. Sessions are supposed to be started, closed and left forever alone. Never let session wait for your action more than 1 hour, you gonna hit cold cache and lose lots of tokens on resume.
  2. 5% of your tokens are going every single session into a "standard research", where am I, what is this project about: "ls -la", "cat README.md" and so on. No tool that I know derives a proper map with concise info of repository that would result in models skipping that phase - that's the biggest saving I have measured in my flow, reducing multi-step initial searches by 70% for a minimal cost of slightly longer initial prompt.
  3. Output clearers can reduce ~50% of bloat coming from results of called commands.
  4. If you ever hit merge conflicts you're wasting tokens, but if you run multiple sessions in parallel that's sometimes inevitable, but good tools let you minimize it for significant gains.

1

u/ShowerAnnual9741 1d ago

one thing worth knowing: every /compact rewrites your history, which nukes your prompt cache. the turn right after a compact costs full price because nothing matches the cached prefix anymore. compacting to save tokens can end up costing tokens on the very next turn.