Cursor "Context Length Exceeded" and Slow Requests: Keep the AI Fast and Accurate
Cursor shows context length exceeded, requests crawl, or the model forgets earlier decisions in a long chat. Context management is the main friction point in AI coding tools — not a broken install. Keep each thread focused and only pull the files you need.
Why Cursor slows down or hits context limits
- One giant chat that accumulates every file, diff, and reply
- @-mentioning whole folders or the entire codebase when a few files would do
- Huge pasted logs or generated files in the prompt
- Asking for a multi-module refactor in a single message
Fix 1: Fresh chat per task
Start a new chat when you switch features or bugs. Long threads burn context on old decisions and make later answers slower and less accurate. Carry forward only a short summary of what still matters.
Fix 2: @-mention only what you need
Prefer specific files over broad folders:
- Good:
@src/lib/content/posts.tsand the one component you are editing - Costly:
@srcor the whole repo on every turn
Add folders only when the task truly spans many files.
Fix 3: Add a .cursorrules (or project rules) file
Put durable project constraints in rules so you do not re-paste them every chat. Example starter:
# Project rules
- Prefer editing existing patterns over new abstractions
- Do not add dependencies unless asked
- Match existing file structure and naming
- Keep diffs small and task-scopedAdjust to your stack. Rules shrink how much you must restate and keep answers on-rails.
Fix 4: Split large work; pick the right model
- Break “refactor the whole auth system” into smaller prompts (types → API → UI).
- For big refactors that need many files, use a model with a larger context window when available.
- Paste the exact error back into a short new chat instead of scrolling an old thread.
Quick checklist
- New chat per distinct task
- @-mention specific files, not the whole tree
- Project rules /
.cursorrulesfor standing constraints - Smaller prompts; larger-context model for wide refactors
Related: when AI tools hallucinate packages and break the build