Chapter 15 – Managing Context Rot and Entropy
This post is part of a series walking through key ideas from my book, Master Claude Chat, Cowork and Code. In the previous chapter we connected Claude to external systems through MCP. Today we confront the silent threat that undermines even the best-connected setup: context rot.
The 200k Token Illusion
Claude's context window is massive — 200,000 tokens. That's roughly the length of a novel. It's tempting to think this means you can just keep talking, keep adding documents, keep layering context indefinitely. Chapter 15 explains why that instinct leads to subtle, hard-to-diagnose failures.
Context rot is the gradual degradation of Claude's reasoning quality as conversations grow longer and context becomes cluttered with outdated information, abandoned ideas, and contradictory decisions. It doesn't announce itself with an error message. Claude doesn't say "I'm confused now." Instead, it quietly starts giving responses that feel slightly off — referencing decisions you reversed three sessions ago, or applying patterns from a part of the codebase you've since refactored.
The book walks through a concrete example that makes this visceral: an engineering team designing an API across multiple sessions. Early on, they specify REST with JSON responses. Later, they explore GraphQL as an alternative but decide against it. Forty conversations later, Claude starts blending elements of both approaches — not because it's broken, but because the old GraphQL discussion is still sitting in context, competing for attention with the final decision.
Four Strategies for Context Compression
The chapter doesn't just diagnose the problem — it provides a practical toolkit for fighting back. I'll share the high-level strategies here while keeping the implementation details in the book.
Strategy 1: Periodic context summarization. The idea is simple but powerful. Every N conversations or M days, you generate a compressed summary of the current context and start fresh with that summary as the foundation. Claude's /compact command does this automatically — analyzing a conversation, identifying key information, and producing a distilled version. The book shows before-and-after examples that make the compression ratio startling. Fifty conversations of API design discussion collapse into a crisp summary of decisions, endpoints, and constraints.
Strategy 2: Structured context extraction. Rather than letting Claude decide what matters, you explicitly structure the important information into maintained artifacts. The book demonstrates a decisions.json pattern — a living file that records every architectural decision with its rationale, date, implications, and alternatives considered. Load it at session start, and Claude immediately has perfect recall of what was decided and why, without wading through hundreds of conversational turns.
Strategy 3: Context scope limiting. Not every session needs every piece of context. When you're working on a database migration, the full UI design conversation history is noise. The book explains how to deliberately scope what enters context for each task, treating context like a resource budget rather than an infinite buffer.
Strategy 4: The /clear command. Sometimes the most effective action is acknowledging that context has become stale and starting fresh. The book discusses when this is the right call versus when it's premature — a judgment that comes with experience.
Structured State Management: Treating Claude Like Infrastructure
The most sophisticated approach in Chapter 15 moves beyond conversation management entirely. Instead of trying to keep conversations clean, you externalize state into structured files that Claude reads and updates — treating AI interactions like database transactions rather than chat threads.
The book walks through a DevOps example using an infrastructure-state.yaml file. Rather than discussing infrastructure changes across long conversations, the team maintains a versioned state file with cluster configurations, database details, pending changes, and approval statuses. Each Claude session reads the current state, proposes changes as structured diffs, and writes updates back — with human review at every step.
This pattern solves context rot by making state explicit, versioned, and independent of any single conversation. You can see when changes occurred, who made them, and what the system looked like at any point in time. The conversation becomes a tool for transforming state, not the state itself.
What I'm Holding Back
I will not spoil the specific implementation patterns for decisions.json and infrastructure-state.yaml, the team workflow for structured state reviews, or the metrics the book cites — including the 80% reduction in context-related errors that teams report after adopting these patterns. The chapter also covers how these strategies interact with CLAUDE.md (Chapter 12) and Skills (Chapter 13) to create a complete context hygiene system.
Next up — Chapter 16: Execution Risks and Isolation. We move into Part VI of the book — Security, Governance, and Risk. When Claude can execute commands, manipulate files, and interface with external services, what could go wrong? Quite a lot, as it turns out.
Sho Shimoda
I share and organize what I’ve learned and experienced.カテゴリー
タグ
検索ログ
Development & Technical Consulting
Working on a new product or exploring a technical idea? We help teams with system design, architecture reviews, requirements definition, proof-of-concept development, and full implementation. Whether you need a quick technical assessment or end-to-end support, feel free to reach out.
Contact Us