Ofer Shapira

Managing Cursor through rules and context windows

August 11, 2025 · 2 min read

Originally posted on LinkedIn, August 11, 2025.

The context window is the new game we play with Cursor. To make it work properly, I created a set of cursor rules that load automatically at the start of every conversation. I wrote them in a martial arts tone so they would be short and token-efficient, since they are added to every conversation in always apply mode, and so Cursor would treat them as basic assumptions rather than requests.

The rules tell it, among other things:

I noticed that as a work session gets longer and the context window fills up, Cursor forgets the rules. It simply stops following them, even though they appear at the beginning of the conversation. The only way to bring them back is to say: “read the rules”.

The effect is striking. Cursor stops making assumptions and hallucinating, makes fewer mistakes, and starts following existing patterns. This is especially useful when I tell it to study the code or context before responding.

I also added explicit instructions about what not to do:

I added instructions for how to do certain things as well. These came from failed attempts where, after several iterations, we found the right approach and I captured it in a sentence inside the rules file:

LLM-based programming now has 3 layers:

The third layer is what turns Cursor from an apprentice developer making educated guesses because it lacks enough context into a more attentive developer.

Illustration for “Managing Cursor through rules and context windows”