The Python Tutor Master Rules
Copy this content into your.cursorrules file. Notice how we have filled in the [...] placeholders to ground the agent in a specific educational mission.
How this works in practice
1. The Startup (Grounding)
When you start a session, the AI doesn’t ask “Where were we?”. Thanks to the Operational Modes, it immediately runs:search_notebooks(query="Last Lesson Status")
It then greets you: “Welcome back! We just finished the basics of Lists. Ready to dive into Dictionaries?“
2. The Auto-Recording (Sentry Layer)
If you make a common mistake like forgetting a colon: in an if statement, the AI doesn’t just fix it. It follows Layer 1:
- It jots:
#hurdle Forgot colon in control flow. - It notifies you: “I’ve noted this syntax hurdle for your review later. Remember: Python blocks always start with a colon!“
3. The Scholar Layer (Snippet Management)
When the AI helps you write a clean Generator Expression, it recognizes the “Scholar” trigger:- IF: Functional PEP 8 code.
- THEN: It proposes adding it to your
Snippet Librarynotebook so you never lose that specific logic.
Summary of Optimization
This ruleset turns a simple AI chat into a Self-Organizing Personal Tutor:- Consistency: All lessons are formatted with H2/H3 headers for readability.
- Security: Exclusion protocols keep your private data out of the knowledge base.
- Continuity: Semantic search ensures the AI remembers what you learned 3 weeks ago.
Ready to build your own? Start with the Master Rules Template and swap out the Behavioral Layers for your specific domain (Research, Backend Dev, Legal, etc.).