惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
N
Netflix TechBlog - Medium
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Vercel News
Vercel News
P
Palo Alto Networks Blog
C
CERT Recently Published Vulnerability Notes
Simon Willison's Weblog
Simon Willison's Weblog
I
Intezer
L
Lohrmann on Cybersecurity
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed
The Register - Security
The Register - Security
T
Threat Research - Cisco Blogs
P
Privacy & Cybersecurity Law Blog
A
Arctic Wolf
F
Fortinet All Blogs
V
Vulnerabilities – Threatpost
The Hacker News
The Hacker News
V
Visual Studio Blog
Know Your Adversary
Know Your Adversary
博客园 - Franky
C
Check Point Blog
P
Privacy International News Feed
NISL@THU
NISL@THU
T
Tenable Blog
云风的 BLOG
云风的 BLOG
T
Tailwind CSS Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
B
Blog RSS Feed
A
About on SuperTechFans
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
G
Google Developers Blog
WordPress大学
WordPress大学
T
Threatpost
Y
Y Combinator Blog
Last Week in AI
Last Week in AI
The GitHub Blog
The GitHub Blog
爱范儿
爱范儿
T
Tor Project blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Stop chatting with Claude Code: 3 rules for cleaner context and lower bills
Olexandr Uva · 2026-05-18 · via DEV Community

I corrected Claude in a debugging session. It said "you're right."

Then it spent the next 20 messages quietly building on the bug I had just disproved.

The bug wasn't in the model. It was in how I was using context.


Most developers I know use Claude Code like a chat window. One terminal, one session, all day long. Backend question in the morning, frontend bug after lunch, a quick "what should I order for lunch" mixed in somewhere, and an architecture decision around 4pm.

By the end of the day, Claude is unhelpful in subtle ways. It mixes the codebases up. It forgets corrections you made an hour ago. The answers get longer, the relevant parts shorter. And you're closer to your weekly rate limit than you should be — or, if you're on API access, your bill is bigger than yesterday — for the same amount of actual work.

None of that is a model problem. It's a context problem. The window is not memory — it's a working surface, and you have to manage it like one.

The three symptoms

1. Cross-topic confusion

A long session has no concept of "topic." Every new message ships the entire prior conversation to the model. If auth.users appeared in your prompt at 10am, it's still in the prompt at 4pm — even if you've been working in a completely unrelated repo for the last three hours.

So when you ask "should we cache this with Redis?" at 4pm, you're not asking a clean question. You're asking a question against a 4-hour-old soup of:

  • The 10am backend table schema
  • A 12pm offhand mention of a deadline
  • The 2pm frontend stack discussion
  • That weird tangent about your dev container at 3pm

The model answers based on the whole soup. It pulls patterns from one task into another. It references functions that exist in a different repo. It gets confidently wrong because it has too much context, not too little.

You can write better prompts forever — it won't fix this. The fix is realizing the surface itself is dirty.

2. Post-correction persistence — the "you're right" trap

This is the one that costs me the most time.

I was debugging a component that re-rendered three times on every keystroke last week.

First hypothesis: the parent was re-rendering on each state change. I asked Claude to look at the parent. It agreed — confirmed parent re-renders, here's a fix wrapping the parent in React.memo.

I opened React DevTools Profiler. The parent wasn't re-rendering at all. The child was re-rendering on its own — because a useEffect inside it had an inline object as a dependency:

useEffect(() => {
  fetchData(filter);
}, [{ filter, sort }]);

Enter fullscreen mode Exit fullscreen mode

That object is recreated on every render. The effect "depends on" a brand new reference every time, so it fires every render, which sets state, which re-renders the child. Classic React footgun.

Me: Parent's not rendering — check the profiler. The child has a useEffect with an inline object in its deps. New reference every render.

Claude: You're right. Sorry for the confusion. The cause is the inline object in the useEffect dependency array.

Moved on. Asked for the fix.

const Parent = React.memo(({ filter, sort, items }) => {
  // ...
});

Enter fullscreen mode Exit fullscreen mode

The fix Claude wrote was wrapping the parent in React.memo. The hypothesis we had ruled out two messages earlier.

I corrected it again. "It's the inline object inside the child's useEffect, not the parent."

Claude: Right, the inline object. Sorry.

Then it proposed the same fix. React.memo on the parent.

I /clear'd the session. Started over. Pasted only the child component and the profiler screenshot. New session caught the inline-object dependency in the first answer and proposed the correct fix: pull the object out with useMemo, or destructure into primitive deps.

Why this happens

Look at what's actually in the context window at the moment Claude proposes the wrong fix for the second time:

  1. System prompt with tool definitions (~10k tokens)
  2. My first message: "this component re-renders three times on every keystroke"
  3. Claude's confident first hypothesis: parent re-render — explained over a paragraph
  4. My correction with the profiler output
  5. Claude's "you're right, it's the inline object" — one sentence
  6. A few intermediate messages
  7. My request: "give me the fix"

Item 3 is still in the prompt. It's longer than item 5. It's more confidently argued than item 5. When the model generates the next answer, it weighs everything in the prior turns. The parent-re-render framing wins because there's more of it.

The apology doesn't delete the wrong answer. It adds a short retraction at the end of a long argument. The argument keeps winning.

You can think of it like this: in a long enough conversation, your correction is a sticky note attached to a 10-page memo. The model reads the whole memo every time. The sticky note doesn't always get noticed.

Three signs you're in a "you're right" loop

  • You corrected the model and it agreed.
  • Two or more turns later, the original wrong claim resurfaces.
  • You correct again. It agrees again. It does it again.

When you see this pattern, don't reason with it. Don't write a longer correction. Don't paste the same evidence twice. /clear. Start over with the corrected version as your starting prompt.

The reminder you're tempted to write will just be one more short message in a long polluted history. The history already lost that argument once.

3. The token tax

Most developers using Claude Code today are on a subscription — Claude Pro, Claude Max. Your bill doesn't grow at the end of the month. Instead, your weekly quota burns out faster than it should. You hit the rate limit on Wednesday afternoon and wait until Friday to keep working. If you're on API access, the same pressure shows up as a growing invoice. Either way, you pay the same tax — just in a different currency.

Here's where the tax comes from. Every Claude Code request includes, on every single turn:

  • The system prompt with MCP tool definitions (~10k tokens)
  • The full prior conversation
  • Your new message
  • The response it generates

Prompt caching helps for a few minutes if you're sending similar prefixes. After the cache TTL expires, the full content is recomputed.

After 50 messages of about 500 tokens each, you've accumulated ~25k tokens of history. Plus ~10k of system prompt. Every new request you send ships 35k input tokens before you've even typed your actual question. On a subscription, those tokens come out of your weekly allowance. On API, they come out of your wallet.

A back-of-the-envelope calculation on Anthropic's published pricing (Sonnet around $3 per million input tokens, Opus roughly 5× that):

Scenario Avg input per request 30 requests Tokens shipped Cost (API)
One long session, no /clear (Sonnet) ~35k ~1.05M 1.05M ~$3.15
/clear every 10 messages + notes on disk (Sonnet) ~15k ~450k 450k ~$1.35
Same work, all on Opus, one session ~35k ~1.05M 1.05M ~$15.75
Research on Opus → write to disk → execute on Sonnet mixed ~250k Opus + ~450k Sonnet ~700k ~$5.10

These are model calculations from Anthropic's published pricing, not a billing screenshot. Plug your own usage in — the ratio is what matters. You can do the same work for less than half the token cost just by clearing the surface. You can do it with a better model for a third of the cost by splitting the workload.

If you're on a subscription, divide your weekly token allowance by these numbers. The "Claude Max ran out by Wednesday" feeling has a real cause — and it's not your workload, it's your session length.

A long messy session quietly burns through your quota — or your wallet — in the background. The rate-limit message at 4pm Wednesday looks like a usage problem. It's a hygiene problem.

The three rules

Rule 1 — /clear is hygiene, not panic

Treat /clear the way you treat closing a browser tab. It's not failure. It's not "starting over." It's normal.

Things I clear on:

  • Switching from backend to frontend (different mental model).
  • Switching from designing something to implementing it (different decision style).
  • After any "you're right" loop, no matter how confidently the apology was phrased.
  • After a long debugging detour that didn't pay off — clear, restart with what I learned, not with the failed attempts.
  • At the end of any session that lasted more than an hour.

If you have two parallel tasks, open two terminals, not two threads in one session. The model doesn't have tabs. The window doesn't.

The cost of clearing is zero. The cost of not clearing accumulates linearly in tokens and nonlinearly in quality.

Rule 2 — Context lives on disk, not in the window

The window is volatile. It gets polluted, it gets long, you /clear it, it's gone.

The disk is durable. A markdown file you wrote yesterday is still there today, exactly as you left it.

So after every non-trivial research session, I write the conclusions out. A plan into plans/, an architecture decision into docs/adr/, a set of patterns into docs/component-patterns.md. The next session reads the file as ground truth. The previous chat history is not invited.

This is the most underrated habit in Claude Code, and it's also the cheapest. A 2k-token markdown file in your context replaces a 25k-token conversation history that the model would otherwise be re-shipping on every turn.

A practical example: I keep a file that lists the patterns used in my codebase — what to do, what we've already tried and abandoned, what's idiomatic here. Every Claude Code session that touches the frontend reads that file first. Without it, the model invents patterns from training data — usually fine, sometimes wrong, occasionally suggesting a component I built six months ago as if it's a new idea. With it, the model is grounded in the codebase as it exists today.

Disk-based context also survives /clear. Window-based context doesn't. That asymmetry is the whole game.

Rule 3 — Use the right model for the right phase

Opus is the deep, expensive model. Sonnet is the fast, cheap one. Opus is roughly 5× the price of Sonnet per token.

The instinct is to pick one and use it for everything. That instinct is wrong for two reasons:

  1. If you pick Opus for everything, you pay Opus rates for the long tail of formatting fixes, lint errors, file shuffling, and "rename this variable." None of that benefits from Opus reasoning.
  2. If you pick Sonnet for everything, your research phase produces a plan that's almost right, you implement it, you hit a wall, you back up, you re-research, you implement again. The cost is real but invisible — it's the rework, not the line items on your bill.

The pattern that wins: research and plan on Opus, then write the plan to disk, then /clear and start a fresh Sonnet session that reads the plan.

In numbers: a research-heavy task done entirely on Opus might run around $15. The same task split — Opus for research, written to a markdown file, Sonnet reading the file and executing — runs around $5. And the execution is better, because the plan is correct on the first try.

The split takes one extra step: writing your conclusions to a file. That step pays for itself in the first task.

What I clear and what I keep

To make this concrete, here is what I throw away and what I keep across the boundary of a /clear:

Thrown away (in the window):

  • The chronological back-and-forth.
  • All the wrong hypotheses I explored.
  • Claude's apologies for being wrong.
  • Long tool outputs I needed once.

Kept (on disk):

  • The final correct plan.
  • The architecture decision with the reasoning.
  • The patterns I want the next session to know about.
  • Any "do not do X again" notes from this session.

When I open a new session, the window starts at zero. The disk hands me a clean version of what I learned. The two together are stronger than any long conversation.

Closing

You don't get better answers from Claude by holding a longer conversation with it. You get better answers by managing the surface it works on — what's in it, what's gone from it, and which model is reading it now.

The long session feels productive because the model still talks back. But it's slowly losing the thread, weighing wrong hypotheses against your corrections, and burning through your quota — or your wallet — for the privilege.

/clear. Write things to disk. Switch models on purpose. Treat the context window like a workbench, not a journal.

Context isn't memory. It's a working surface. Keep it clean.