Latest / AI Fire Daily / #662 Neil: 10 Claude Code Tips That Save Tokens And Fix Bad Habits
Transcript
- 0:00It's a really frustrating paradox for modern
- 0:01software developers today. You pay for Claude
- 0:055 .5 to make your work effortless. Right. But
- 0:08somehow you are always burning through your usage
- 0:11limits. Exactly. You hit those invisible walls
- 0:13before the real work even begins. It is surprisingly
- 0:16common, actually. So welcome back to another
- 0:19deep dive into our source materials. Today we
- 0:21are unpacking a really fascinating set of developer
- 0:24field notes. I'm super excited to get into this
- 0:27one. We are looking closely at everyday coding
- 0:30habits that drain tokens. We are going to dissect
- 0:33the underlying architecture of Claude today.
- 0:35Yeah, we really need a look at how this model
- 0:37holds its memory. Right. We will examine how
- 0:40it processes its context window in real time.
- 0:42We will also look at how it prices its internal
- 0:45thoughts. Because the most expensive mistakes
- 0:47usually don't come from writing bad code. They
- 0:49come from fundamentally misunderstanding how
- 0:51the AI actually thinks. Well, people tend to
- 0:54treat it like a magic infinite brain. Exactly.
- 0:57But it's really a machine with very specific
- 0:59technical boundaries. You simply have to learn
- 1:01to manage its working memory. So let's start
- 1:04with our foundational interaction format with
- 1:07the AI. We rely heavily on the continuous chat
- 1:10session model. Uh -huh. A lot of devs use one
- 1:13massive session for literally everything. Right.
- 1:17You fix a CSS bug, then you build a landing page.
- 1:20You ask for database help in the exact same thread.
- 1:22Which is wild, if you think about it. It's like
- 1:25bringing your plumber along to a dental appointment.
- 1:27You're forcing Claude to carry completely irrelevant
- 1:30baggage around with you. That is a perfect analogy.
- 1:33Because Claude code automatically carries your
- 1:35conversation history forward every single time.
- 1:38And this makes prompt caching much cheaper for
- 1:41you initially, right? It does, yeah. But eventually,
- 1:45you're paying for a massive, completely irrelevant
- 1:48context history. you're carrying an old UI bug
- 1:51into a brand new database feature. Right, and
- 1:53your daily usage limit just starts disappearing
- 1:56in a thin air. So the easiest solution here is
- 1:58using the simple clear command. Yeah, typing
- 2:02slash clear is a truly fundamental workflow habit.
- 2:05It wipes the immediate conversation history clean
- 2:08for you, completely. But it keeps your core project
- 2:11instructions perfectly available still. Exactly.
- 2:14You're basically creating a fresh, clean slate
- 2:17for the AI, and you do this without losing the
- 2:19overarching project rules. So Claude can focus
- 2:22strictly on your next upcoming development task.
- 2:25Right. It stops dragging yesterday's resolved
- 2:28problems into today's new work. Does the clear
- 2:30command wipe out our core system prompt, too?
- 2:33No. It strictly targets just the chat history
- 2:36for deletion. Your foundational project rules
- 2:39remain perfectly active and completely intact.
- 2:41No, core instructions stay active. Just the chat
- 2:44history vanishes. You got it. So since we just
- 2:48established how session history piles up so quickly,
- 2:51let's look at the financial trap people fall
- 2:54into next. Oh, the model switching trick. Right.
- 2:57People try managing that heavy session by switching
- 2:59to a cheaper model midstream. Yeah, they really
- 3:02do. You start with Opus for a very complex architectural
- 3:06task. Then you get deep into a really long working
- 3:09session. And then... A simple formatting task
- 3:12suddenly comes up for you. You switch to Haiku
- 3:14to try and save some money. Right. And that's
- 3:17a logical but ultimately flawed assumption to
- 3:19make. You think you're saving compute costs with
- 3:22this clever trick. But it fundamentally misunderstands
- 3:25the underlying prompt cache architecture at play.
- 3:28Break that down for us. What exactly is a prompt
- 3:31cache? A prompt cache is a temporary memory storing
- 3:35recent data for faster, cheaper reuse. Got it.
- 3:38So it stores recent data. Right. And each Claude
- 3:41model actually has its own completely isolated
- 3:43cache. Oh, wow. Yeah. So switching from Opus
- 3:46to Haiku breaks that memory chain instantly.
- 3:50Haiku simply cannot read the Opus cache data
- 3:53at all. So it has to start over. It must reread
- 3:56all 100 ,000 tokens from scratch. You end up
- 4:00paying full price for that entire history. That
- 4:02is brutal. It really is. You should just start
- 4:04a totally separate session for that simple task.
- 4:07Does each model essentially have an entirely
- 4:09separate memory bank? Exactly. When you switch
- 4:13models, it dumps the cache entirely and resets
- 4:15the context. Yes, switching models dumps the
- 4:18cache entirely, resetting your context. Precisely.
- 4:21Well, if switching models mid -session breaks
- 4:23the working memory bank completely, how do we
- 4:26handle it when the current model just gets confused?
- 4:29That is the big question. Our natural human instinct
- 4:33is to simply argue with it. Oh, for sure. We
- 4:36treat it like a stubborn co -worker. I still
- 4:38wrestle with prompt drift myself. I go back and
- 4:41forth trying to fix things constantly. It's so
- 4:43easy to fall into that trap. I ask Claude to
- 4:46fix one specific minor code error, then I watch
- 4:48it accidentally break another piece entirely.
- 4:51Right. You end up fixing problems that weren't
- 4:53even there initially. And you pay computational
- 4:56costs for every single one of those failures.
- 4:59We've all been trapped in that exact endless
- 5:01argument loop before. So what is the technical
- 5:04fix? The best technical solution is using the
- 5:07rewind command immediately. Or you can also just
- 5:10press the escape key twice. Oh, I didn't know
- 5:13the shortcut. Yeah, it's super handy. It gives
- 5:15the AI a completely clean starting point. Instead,
- 5:17you go back to your original request and specify
- 5:20the details. So you point out the specific file
- 5:23and the exact bug location. Right. Tell it exactly
- 5:27what you expect to happen right there. This is
- 5:29vastly cheaper than reading through a failed
- 5:31history. It literally stops the AI from chasing
- 5:34its own tail. Exactly. How far back should we
- 5:37actually rewind the chat? You should rewind to
- 5:40the exact point before the errors began. Just
- 5:42remove any prompts where the AI started making
- 5:45wild assumptions. Back to the very last prompt
- 5:47where the logic was perfectly correct. That is
- 5:50exactly the right spot. So when arguing fails,
- 5:53the next desperate move is usually pretty predictable.
- 5:56We crank the AI settings to maximum effort for
- 5:59everything. Oh yeah. The brute force approach.
- 6:03We assume brute force will automatically fix
- 6:05our relatively simple bugs. It's kind of like
- 6:08hiring a rocket scientist to rename your folders.
- 6:10It is a great way to put it. Let's look at the
- 6:13artificial analysis benchmarks for Opus 5 .5
- 6:16closely. We can compare high effort versus max
- 6:19effort performance directly. The statistical
- 6:21benchmarks are incredibly revealing for this
- 6:23specific scenario. Walk us through the numbers.
- 6:26So high effort costs $1 .82. roughly, and it
- 6:31outputs 36 ,000 tokens per average benchmark
- 6:33task tested. OK, that seems reasonable. But Mac's
- 6:37effort costs $5 .98 total, and it outputs 119
- 6:42,000 tokens per single task. Whoa. Imagine scaling
- 6:46to a billion queries. Right. That cost difference
- 6:49would completely bankrupt a small startup overnight.
- 6:51You pay over three times as much money right
- 6:53there. And does the output quality actually match
- 6:55that price jump? Not at all. The intelligence
- 6:59index only improves by four tiny points. It just
- 7:01goes from 54 up to 58 overall. That is a terrible
- 7:05return on investment. It really is. Medium effort
- 7:09is perfectly fine for tweaking simple CSS files.
- 7:12Is max effort basically just generating more
- 7:14hidden reasoning tokens? Yes, it spends massive
- 7:17compute thinking before writing the final code.
- 7:20Exactly. It thinks longer before outputting the
- 7:22final requested code. You got it. So since cranking
- 7:25up the effort dial is a massive waste of money.
- 7:27The only real solution is feeding the AI a flawless
- 7:30initial brief. Yeah. You must prevent bad outputs
- 7:33before they even happen. Right. Because a vague
- 7:35prompt like, build me a website, simply fails.
- 7:38It's way too open -ended. Contrast that with
- 7:41the task flow SAS example from our sources. You
- 7:44must define UI colors and structural elements
- 7:47very clearly. Uh -huh. And you also need to establish
- 7:50strict SEO rules up front. It's like stacking
- 7:53Lego blocks of data perfectly in place. You have
- 7:55to do this before letting the AI touch the keyboard.
- 7:58The before coding guardrails are absolutely critical
- 8:01to establish here. What do those guardrails actually
- 8:03look like in practice? You must instruct Claude
- 8:06to review all dependencies thoroughly first.
- 8:09It needs to propose a structural plan before
- 8:11writing any actual code. So it maps things out
- 8:14first? Right. And it should ask you clarification
- 8:16questions to avoid making assumptions. Do all
- 8:19of this before it overwrites files or pushes
- 8:21to GitHub. It stops the AI from making wild,
- 8:25incredibly expensive guesses. Exactly. Doesn't
- 8:28a massive initial prompt cost more tokens upfront?
- 8:31It does, but it establishes a rock -solid foundation
- 8:34initially. It prevents endless, incredibly expensive
- 8:37correction loops from happening later on. Yes,
- 8:40avoiding endless correction loops saves vastly
- 8:42more total tokens. Precisely. Well, once that
- 8:46master brief is established, there's always a
- 8:47new temptation. You feel a strong urge to slowly
- 8:50drip -feed new features. Oh yeah, the follow
- 8:53-up fatigue trap. Right. This leads right into
- 8:56the trap of endless follow -up prompts. People
- 8:58will add charts or filters piece by piece, slowly.
- 9:02And this forces Claude to repeatedly rework the
- 9:04exact same code base. It really does. It burns
- 9:07through your token limits incredibly fast this
- 9:10way. So all major project requirements really
- 9:12must go in the initial prompt. Right. And this
- 9:14is where careful technical planning becomes crucial.
- 9:17But what if you don't have it all planned out?
- 9:19If you're really unsure of the specific feature
- 9:21details yet, you should use the AI to brainstorm
- 9:24and finalize those requirements. Do that completely
- 9:27before any actual coding ever begins. Exactly.
- 9:30You want to map out the entire house first. You
- 9:32do that before you start pouring the concrete
- 9:34foundation. What if I genuinely don't know the
- 9:37exact requirements yet? You should ask the AI
- 9:40to help map them out. Have a full brainstorming
- 9:42session before generating any actual production
- 9:45code. Ask the AI to help define them before writing
- 9:48code. That is the golden rule. We are going to
- 9:50take a quick break right here. Stick around.
- 9:53We have some great tips on system files next.
- 9:55And we are back. We just established that writing
- 9:58a massive initial brief is good. So putting thousands
- 10:01of lines into system files must be better, right?
- 10:04You would definitely think so. You think a huge
- 10:07permanent clod .md file helps the AI? Not exactly.
- 10:12This is actually a major hidden token trap. Why
- 10:15is it a trap? A bloated system file eats tokens
- 10:18on every single query you make. It also buries
- 10:21your actual coding rules and all that noise.
- 10:23So it's basically spamming your own prompt cache.
- 10:26Exactly. You should keep it strictly under 200
- 10:29lines total. But how do you compress an entire
- 10:31project into 200 lines? The workflow hack here
- 10:34is incredibly elegant and very simple. You don't
- 10:38even have to write the file yourself. Really?
- 10:40Who writes it then? Ask Cloud Code to review
- 10:43your current directory directly. Have it reference
- 10:46your existing documentation to learn your project
- 10:48rules. Well, that makes a lot of sense. It can
- 10:51generate a concise 96 -line file very easily.
- 10:54It includes your core text stack and crucial
- 10:57safety rules. It distills everything into a highly
- 11:00efficient, very small package. Exactly. Can the
- 11:03AI really summarize our entire repository accurately
- 11:06itself? Yes, it can scan your repository and
- 11:09compress the essential rules. It identifies the
- 11:11most critical architectural patterns without
- 11:13any human intervention. Yes, it can scan your
- 11:16repository and compress the rules. It is basically
- 11:18magic. Well, it isn't just system files quietly
- 11:21eating your tokens. It's the background applications
- 11:24you leave plugged into the AI's brain. Oh, this
- 11:27is a huge one. It's really easy to forget about
- 11:29these active background apps. We need to discuss
- 11:32these active peripheral connections right now.
- 11:34We are talking specifically about active MCP
- 11:37connections in your environment. Right, the MCP
- 11:40standard. For those who might not know, what
- 11:42exactly is an MCP? An MCP is a standard connecting
- 11:46AI to external tools like Google Drive. OK, so
- 11:49it connects your tools. Why is that a problem?
- 11:52Well, leaving these tools connected adds massive
- 11:54unseen context weight constantly. Even if you
- 11:57aren't using them? Exactly. You might leave Gmail,
- 12:00Notion, or Slack fully connected always, but...
- 12:03Right now, you are just building a simple website
- 12:05front end. So you don't need Gmail to write HTML.
- 12:09Right. This actively adds unnecessary tool definitions
- 12:14into your context window. It just bloats the
- 12:16payload. It does. You should ask Claude to check
- 12:19your recent integration usage. Find out what
- 12:21you actually used in the past two weeks. And
- 12:24then you should firmly disable all the rest of
- 12:26them. Keep only the integrations you actually
- 12:29need for this specific session. Do idle connections
- 12:32actually consume our context window limit passively?
- 12:35Yes. Tool descriptions take up context space
- 12:38even when totally unused. They bloat the system
- 12:41payload every time you send any messages. Yes.
- 12:44Tool descriptions take up space even when completely
- 12:46unused. It is a massive hit in text. So once
- 12:49you have successfully trimmed your bloated system
- 12:51files down, and you have disconnected all your
- 12:54idle peripheral workspace tools, how do you actually
- 12:57verify you stopped the daily token bleed? You...
- 13:00Definitely need a highly reliable way to check
- 13:03your limits. The answer lies in the simple built
- 13:05-in usage command. Running this specific command
- 13:08is absolutely essential for all developers today.
- 13:11What does it actually do? It catches expensive
- 13:14looping sessions before they drain your account
- 13:16dry. This is incredibly vital when running multiple
- 13:19subagents simultaneously today. Because they
- 13:21can just spin out of control. Right. It's the
- 13:23only real way to track your platform spending.
- 13:25You must know when to adjust your daily workflow
- 13:28habits. You check it carefully before you hit
- 13:30the hard platform limit. Exactly. Does this command
- 13:33show real -time cost or just token counts? It
- 13:36tracks your token consumption directly against
- 13:38your overall allowance limit. It gives you a
- 13:41clear percentage of your operational budget.
- 13:43It tracks your token consumption against your
- 13:45overall allowance limit. That is right. Now that
- 13:48you have complete operational visibility over
- 13:50your token usage, the final workflow optimization
- 13:53is matching cognitive weight to tasks. This is
- 13:56where you can really save a lot of money. You
- 13:59must precisely align the AI model with the specific
- 14:02job. Let's break down this specific model hierarchy
- 14:04very carefully now. Okay. Let's start with Haiku.
- 14:07Right. Haiku is perfect for renaming files or
- 14:11sorting large data. Uh -huh. And Sonnet is great
- 14:14for writing everyday code and common fixes. And
- 14:17Opus is strictly for deep architectural design
- 14:19and complex logic. Right. Using Opus to simply
- 14:23format JSON text is burning pure money. It really
- 14:26is. If you switch coding tasks frequently, you
- 14:29should use automatic model routing. How does
- 14:32that feature work? The specific feature automatically
- 14:35picks the cheapest capable model available. It
- 14:38carefully saves Opus for when you genuinely need
- 14:41it. That sounds incredibly useful. It is. It
- 14:44optimizes your workflow seamlessly without any
- 14:46manual intervention required. Can we fully automate
- 14:49which model handles which specific task? Yes.
- 14:52Configuring model routing handles this selection
- 14:54process completely automatically. It acts like
- 14:57an intelligent background dispatcher for your
- 14:59queries. Yes. Configuring model routing handles
- 15:02this selection process completely automatically.
- 15:05It is a total game changer. We have covered a
- 15:08massive amount of technical ground today. Let's
- 15:12summarize the core philosophical takeaway from
- 15:14all these sources. Yeah, let's bring it all together.
- 15:16Using AI effectively is not just about writing
- 15:19better prompts. It is primarily about deliberate
- 15:23and careful context memory management. I completely
- 15:26agree with that. You must be highly intentional
- 15:28with the AI's working memory. You have to deeply
- 15:31understand model constraints and system boundaries.
- 15:34That separates a frustrating coding tool from
- 15:38a true force multiplier. I could not agree more
- 15:41with that specific architectural assessment.
- 15:44Treating the AI's context window with deep respect
- 15:46is vital. It really pays off in the end. It ultimately
- 15:50buys you many more iterations and much better
- 15:52code. It fundamentally transforms how you approach
- 15:55modern software development today. I want to
- 15:57leave you with a final provocative thought to
- 15:59mull over. AI is rapidly approaching human level
- 16:03reasoning capabilities right now. It is moving
- 16:06so fast. So why is short -term memory management
- 16:09still entirely our responsibility? That is a
- 16:12really fascinating question. Will future coding
- 16:15agents need a subconscious to manage this for
- 16:18us? Perhaps the AI will eventually optimize its
- 16:21own context window automatically. I would not
- 16:24be surprised at all. Thank you so much for taking
- 16:26this deep dive with us.