Home / Blog / I Fed Cursor 5,000 Lines of Code and It Got Progre...

I Fed Cursor 5,000 Lines of Code and It Got Progressively Dumber — Here's What I Was Doing Wrong

By CaelLee | | 8 min read

I Fed Cursor 5,000 Lines of Code and It Got Progressively Dumber — Here's What I Was Doing Wrong

Last Wednesday at 2 AM, I stared at the 47th completely irrelevant line of code Cursor had generated for me, and it hit me: the AI wasn't getting stupider — my context management had turned into a dumpster fire.

Three months ago when I first switched to Cursor, I felt like I'd strapped on an Iron Man suit. Tab completions read my mind. Ctrl+K understood my code better than my partner does. Then my project crossed 3,000 lines, and suddenly it started recommending functions I'd deleted three days prior — with complete confidence.

I nearly posted a rant on Twitter about Cursor being a bait-and-switch. Then I stumbled across this comment buried in GitHub Issues:

"Cursor's context window isn't magic. It's a hungry beast, and you're feeding it garbage."

Translation: the context window is finite. Every line of rubbish you shove in pushes out a line of gold.

The .cursorrules File That Broke Me

Let me tell you about a tax on stupidity I paid.

Back in November 2024 when I was just getting started, I found a blog post titled "The Ultimate .cursorrules Configuration." Without thinking twice, I copy-pasted a 300-line rules file. It was obsessively detailed — project architecture, naming conventions, even instructions telling the AI to "think like a senior architect."

Guess what happened?

Cursor's completion latency jumped from 200ms to over 2 seconds. And the code it generated? It started writing React components with Vue syntax. I'm not joking. Because my rules file mentioned both frameworks.

I finally did what I should've done from the start — read the bloody documentation. And there it was:

Cursor's context window sits around 8,000-10,000 tokens, and your .cursorrules file permanently occupies a chunk of it.

My 300-line rules file? It was eating nearly 2,000 tokens all by itself. That left 6,000 tokens for the current file, related files, and chat history. No wonder the AI was having a schizophrenic episode.

My .cursorrules now? Eight lines:


You are a TypeScript + React expert.
Use functional components and Hooks.
State management with Zustand.
Styling with Tailwind CSS.
Never use the `any` type.
Prefer async/await.

Fewer rules, smarter AI. It's not mysticism — it's token mathematics.

Three Unorthodox Tricks for Keeping Cursor Sharp on Large Projects

These are a bit... unconventional.

After three months of trial and error, I've landed on three techniques. You won't find them in the official docs. A couple of them actually contradict what most "best practice" guides tell you.

1. Surgical Partitioning of Your Project

My project is a SaaS dashboard with user management, analytics, and payment modules. I used to love having one marathon Chat session — jumping from login logic to chart configuration without breaking stride.

That's when Cursor started "cross-contaminating" — generating payment module code inside user management files, referencing functions from three different files, none of them correct.

Here's what I do now: each feature module gets its own Composer.

The setup:

My payment.context.md looks like this:


# Payment Module Context
Core files:
- src/features/payment/PaymentForm.tsx
- src/features/payment/useStripe.ts
- src/lib/stripe.ts

External dependencies:
- src/lib/api.ts (only use createPaymentIntent)
- src/store/userStore.ts (read-only: currentUser.id)

Do NOT reference:
- src/features/analytics/ (analytics module)
- src/features/users/ (user management module)

It's under 100 lines, but it transformed Cursor's accuracy from "random number generator" to something that actually works.

Actually, let me correct that — not just "works." The code runs on the first try. Big difference.

The principle is dead simple: telling the AI what NOT to look at matters far more than telling it what to look at.

2. The Art of Conversation Decluttering

Cursor's Chat history continuously eats into your context window. After 50 exchanges, the AI has completely forgotten your original requirements.

Painful lesson: I once asked Cursor to refactor a form component. The first 20 exchanges went brilliantly. Then it started getting "creative" — adding business logic I'd never mentioned, like "auto-detect the user's location and switch currency units."

I never asked for that.

Because the early conversation had been pushed out of the window, it no longer remembered what the form was actually for. It was improvising.

What I do now: reset context every 15-20 exchanges.

Not by closing and reopening — that's too blunt. Instead:

  1. Copy the key decisions and interface definitions into a temporary file
  2. Reload that file with the @file command
  3. Start a fresh Chat with: "Continue working based on this file"

It's like a Git squash commit — compressing 20 scattered operations into one clean snapshot.

I've tracked this myself (small sample size, about 30 tests). In the first 10 exchanges after a reset, code generation accuracy bounces back above 90%. Without resets, after 30 exchanges it drops below 60%. Sometimes much lower.

3. File References: Less Is Genuinely More

Cursor's @file and @folder features are brilliant — and dangerous.

Once, being lazy, I threw @folder src at the AI, feeding it my entire project. It went on a "reading spree" — the generated code referenced a deprecated utility function from six months ago, because that file was still sitting in src undeleted.

I still remember the error:


Cannot find module '../../utils/deprecated/oldFormatter'

Took me 20 minutes to realise the AI had referenced the wrong bloody file.

Cursor doesn't judge whether a file is current or relevant. It faithfully reads everything you feed it.

My rules now:

For example, when modifying an API call, I only reference:

Three files, under 200 lines total. The AI's response speed roughly tripled, and the generated code was significantly more accurate.

A Counterintuitive Discovery

You might be thinking: "Why not just use the Claude 3.5 Sonnet API directly? 200K context window — problem solved, right?"

I thought the same thing.

I spent an entire weekend (mid-January 2025 — I remember it vividly because I pulled an all-nighter on Sunday) configuring Cursor's API settings, switching to a 200K window model.

The result?

It was worse.

Because the larger the window, the more the AI's "attention" scatters. It's like telling someone to find a book in a library. Say "it's on the third shelf" and they'll find it in 30 seconds. Say "it's somewhere in this library" and they'll be there all day.

With a 200K window, the model "considers" more irrelevant information when generating code, leading to over-engineering. A simple CRUD endpoint? It generated an "enterprise-grade solution" with caching, retry logic, circuit breakers, and graceful degradation. Mate, I'm building a side project — I just want to store user data.

From what I understand, this issue has been discussed in some late-2024 tech blogs. The RAG (Retrieval-Augmented Generation) folks call it "retrieval noise."

The essence of context management isn't "feed more" — it's "feed more precisely."

My Daily Workflow (Steal This)

Here's what my Cursor workflow looks like now:

Before starting a new feature:

  1. Create a .context.md file (keep it under 50 lines)
  2. Load it in Composer with @context
  3. Reference only 2-3 core files

During development:

  1. Every 15 exchanges, proactively summarise the current state
  2. Write key decisions into .context.md
  3. Reset the conversation and reload the context

When things get sluggish or buggy:

  1. Check if you've referenced too many files (more than 5 is too many)
  2. Check if .cursorrules exceeds 20 lines
  3. Check if chat history exceeds 30 exchanges

As your project grows:

  1. Split .context.md by module
  2. Use separate Composers for each module
  3. For cross-module logic, use explicit interface docs — don't let the AI guess

TL;DR (Key Takeaways)

Here's the Uncomfortable Truth

Every Cursor tutorial out there teaches you "how to write better prompts." But almost nobody tells you this: the ceiling of prompt engineering is your understanding of the context window.

It's like delegating to an intern.

Give them 3 pages of relevant documentation — they'll do great work. Give them 300 pages of the entire project wiki — they'll freeze up.

AI works the same way. It's not magic. It's a probability model that reads your context and guesses what you want. I think that's a useful mental model to hold onto.

Feed it precisely, and it guesses accurately. Feed it everything, and it guesses wildly.

My project's now at 5,000+ lines, and Cursor's response speed and accuracy feel the same as when it was at 500 lines. Not because the AI improved.

It's because I finally learned to shut up.

What's the most absurd completion Cursor has ever thrown at you? Got any context management tricks of your own? Drop them in the comments — I genuinely need all the help I can get.

Related reads:

cursor #contextmanagement #aicoding #developerproductivity #indiedev #softwareengineering

C

Cael Lee

Full-stack developer with 8+ years of experience. Currently building AI-powered developer tools. I've tested 20+ AI API providers and coding assistants.

Ready to get started?

Get your API key and start building with 180+ AI models.

Get API Key Free