Context Window (Must Know if You Don't Know)

Best-practice cheat-sheet for a Cursor AI chat session

  1. User prompt (intent)
    • State exactly what you want in one or two sentences; every extra word costs tokens and dilutes signal Cursor.
    • Reference code surgically with @code, @file, @folder so the model grabs only what matters Cursor.
    • Open a new chat for each distinct task to avoid dragging old context forward Cursor.

  2. Files in the context window (state)
    • Attach just the slice you’re working on; Cursor’s default chat cap is ≈ 20 k tokens, Cmd-K ≈ 10 k Cursor - Community Forum.
    • If a file is huge, send the key functions or lines, not the whole thing, or the model will prune unpredictably Cursor.
    • Use @file path/to/foo.py:100-180 style snippets to keep noise down.

  3. .cursor/rules/*.mdc (persistent guidance)
    • Convert any instruction you find yourself repeating into an MDC rule; Cursor prepends it in every prompt for you Cursor.
    • Keep each rule atomic (one concern), YAML-front-matter, and use the type that fits: Always, Auto Attached, Agent Requested, Manual CursorCursor - Community Forum.
    Name and number files predictably (001-Security.mdc, 100-API.mdc) so humans—and the IDE, resolve clashes cleanly Cursor - Community Forum.

  4. Thinking & token burn
    • “Thinking” models double request cost and latency; toggle it only for hard reasoning tasks Cursor.
    • Large-context mode (200 k on Claude 3 MAX, 128 k on GPT-4o MAX) also doubles price; disable when you don’t need the whole codebase Cursor.
    • Watch the running token meter and start a fresh chat or summarize history before you breach the cap.

  5. Answers, tool calls, diffs
    • Ask the Agent to produce patch-style diffs (git-style) so you can review and apply selectively rather than rewriting whole files.
    • Limit tool-call chains to ≤ 25 per request; Cursor will prompt for confirmation after that threshold Cursor.
    • Merge small, testable changes; rerun tests; then iterate, this keeps context small and feedback tight.

Follow this flow and you get maximum signal per token, predictable rule behavior, and clean, reviewable diffs every time.

1 Like