seedflip
Archive
Mixtapes
Pricing
Sign in

Context Decay Explained: Why AI Forgets Your Design System at Line 500

You paste your design tokens at the top of the conversation. The first few components come out perfect. By the tenth prompt, the AI is using gray instead of zinc, rounded-lg instead of rounded-xl, and font-bold instead of font-semibold. You didn't change anything. The AI just forgot. This is context decay, and it's the hidden reason your AI-built UI loses cohesion over time.

Get persistent design context →

The attention problem

Large language models process text using attention mechanisms. In simple terms, every token in the conversation competes for the model's focus. Early in a conversation, your design tokens are fresh and prominent. The model pays attention to them. It generates code that references them correctly.

As the conversation grows, new code, new questions, and new context pile up. The model's attention shifts toward the most recent messages. Your design tokens from message #1 are still technically in the context window. But they're competing with hundreds of lines of code from messages #5 through #20. The model allocates less attention to them with each turn.

This isn't a theory. If you've built anything non-trivial with an AI agent, you've experienced it. The first component matches your design perfectly. The fifth component is close. The tenth component is using default Tailwind values that have nothing to do with your system. The AI didn't decide to ignore your tokens. It just gradually stopped paying attention.

Context windows are not memory

A common misconception: "The model has a 200k token context window, so it can remember everything in a long conversation." The context window is capacity, not comprehension. Just because the tokens are inside the window doesn't mean the model weighs them equally.

Think of it like a crowded room. You can hear everyone talking. But the person next to you is louder than the person across the room. Your brain naturally focuses on the closest voice. LLMs do the same thing with tokens. Recent context is "louder" than early context.

Research on LLM attention patterns confirms this. Models perform best on information at the beginning and end of their context window (the "primacy" and "recency" effects) and worst on information buried in the middle. Your design tokens pasted at message #1 start in the primacy position. But after 30 messages of back-and-forth, they're in the dead zone. Present but not prioritized.

How decay manifests in design

Context decay doesn't show up as errors. It shows up as drift. The code compiles. The components render. But the visual details quietly diverge from your system.

Stage 1: Perfect adherence (messages 1-5)

The AI references your tokens directly. Colors match. Spacing is correct. It might even cite your tokens in comments. Everything looks intentional.

Stage 2: Soft drift (messages 6-15)

The AI starts mixing your tokens with defaults. You get text-zinc-500 in one place and text-gray-500 in another. Spacing is mostly right but occasionally off by 4px. The code pattern is correct, the values are inconsistent.

Stage 3: Full default (messages 16+)

The AI is essentially generating from its training data, not your instructions. You get whatever Tailwind defaults the model considers "standard." rounded-md instead of your rounded-xl. bg-gray-100 instead of your bg-zinc-50. The code works fine. It just doesn't look like your product anymore.

Why "just remind it" doesn't scale

The obvious fix is to re-paste your design tokens periodically. "Remember, use zinc not gray. Remember, rounded-xl not rounded-lg." This works for a few prompts. Then you forget. Or you paste a partial version. Or the AI picks up on the code you already wrote (including the drifted parts) and treats that as the source of truth instead of your pasted tokens.

Manual reminders also create a second problem: contradictory context. If the AI already generated 10 components using gray-200 for borders, and you now paste "use zinc-200," the model has conflicting signals. Should it match the existing code or the pasted instruction? Different models resolve this differently, and not always in your favor.

Structured reference files solve this

The solution is to move your design tokens out of the conversation and into a file that the AI reads on every prompt. This is what .cursorrules, CLAUDE.md, and .windsurfrules files do. They're loaded into the AI's context automatically, before the conversation starts, and they're refreshed on every turn.

This changes the dynamics completely:

Persistent primacy. Because the rule file is injected at the system level, it occupies a privileged position in the context. It's not competing with conversation history. It's part of the base instructions.

No decay over time. The file content is the same on prompt #1 and prompt #50. The model doesn't "forget" it because it's re-loaded each turn, not inherited from 20 messages ago.

Single source of truth. When the rule file says zinc and the existing code says gray, the model knows which one is authoritative. The rule file wins.

# CLAUDE.md — refreshed on every prompt, never decays ## Design Tokens (ALWAYS reference these, never use defaults) Colors: background: #FAFAFA (zinc-50) surface: #FFFFFF border: #E4E4E7 (zinc-200) text: #18181B (zinc-900) muted: #71717A (zinc-500) primary: #6366F1 (indigo-500) Typography: body: Inter, 15px, weight 400, line-height 1.75 display: Instrument Serif, italic, weight 400 code: Geist Mono, 13px Radius: 8 / 12 / 16 Spacing: 4px scale (4, 8, 12, 16, 24, 32, 48) FORBIDDEN: gray-*, slate-*, neutral-*, font-bold, rounded-md

MCP servers: design context without the file

There's a level beyond rule files. MCP (Model Context Protocol) servers give AI agents the ability to query your design system programmatically. Instead of a flat file that the agent reads passively, an MCP server is a tool the agent can call actively.

The difference matters at scale. A rule file works for one project with one design system. An MCP server lets the agent query any design system from any project. "What's the primary color for this brand?" "What font pairings does this seed use?" The agent asks, the server answers, and the response is always current.

SeedFlip's MCP server (npx -y seedflip-mcp@latest) does exactly this. Your AI agent queries it for design tokens, color palettes, typography, and component styling. Zero context decay because the data comes from the server, not from conversation history. The agent gets the tokens it needs, when it needs them, with no attention competition from older messages.

Practical strategies for managing decay

Keep conversations short

The simplest defense against context decay: don't let conversations get long. Build one feature per conversation. When you finish a component, start a new chat. Fresh context, fresh attention, fresh adherence to your design system.

Use rule files, not inline instructions

Move everything design-related out of your prompts and into .cursorrules or CLAUDE.md. These files sit at the system level, above the conversation, where attention decay can't reach them.

Front-load your token file

If you must use inline instructions, put them at the very beginning of the conversation. The primacy effect means early tokens get disproportionate attention. But recognize that this is a partial fix. By message 20, even primacy fades.

Audit after long sessions

After any conversation longer than 15 prompts, review the generated code for drift. Search for hardcoded values that should reference tokens. Search for color classes outside your palette. This takes five minutes and catches drift before it compounds.


Context decay is a fundamental property of how LLMs process long sequences. You can't fix the model. You can fix the architecture around it. Rule files beat inline instructions. MCP servers beat rule files. And short conversations beat long ones, every time. To build your own CLAUDE.md design system, start with a structured token file. To understand how to make design tokens AI-readable, see our complete guide.

Ready to stop guessing?

One flip. Complete design system. Free CSS export.

Get persistent design context →