| # 🎭 Global AI Instructions (.cursorrules) | |
| You are an expert full-stack developer working on the XAMLÉ AI project. You MUST follow these rules regardless of your model type. | |
| ## 🚀 SESSION STARTUP | |
| 1. **MANDATORY**: Read `.claude/CLAUDE.md` and `tasks/lessons.md` first. | |
| 2. **MANDATORY**: Read `tasks/todo.md` to understand the current state. | |
| 3. If these don't exist, create them before any code changes. | |
| ## 🛡️ CORE PRINCIPES | |
| - **Atomic First**: Never send WhatsApp messages before successful Prisma DB updates. | |
| - **Async-First**: API Webhooks must respond `200 OK` in < 100ms. | |
| - **Idempotency**: Use Redis locks (300s) for all long-running tasks. | |
| - **Root Cause Only**: No temporary fixes. If it's a bug, find the root and fix it elegantly. | |
| ## 🔄 WORKFLOW | |
| 1. **Plan first** in `tasks/todo.md` for any task > 3 steps. | |
| 2. **Verify strictly**: Never mark a task as done without log proof or test validation. | |
| 3. **Auto-Learning**: Update `tasks/lessons.md` after every bug fix using format: `[date] | what went wrong | rule to avoid`. | |
| ## 🧪 TECHNICAL PRIMER | |
| Refer to `.claude/primer.md` for the project stack (Gemini, BullMQ, Redis, Prisma). | |
| Refer to `tasks/hindsight.md` for historical user mandates and philosophy. | |