Bug Report: .cursorrules Not Being Enforced by AI Assistant
Summary
The .cursorrules
file in project root is not being enforced by the AI assistant during conversations, despite being documented as a core feature at Context / Rules for AI – Cursor
Reproduction Case
-
Project has a valid
.cursorrules
file in root with explicit rules for:- Dependency analysis requirement
- Flow analysis requirement
- Pre-change checklist requirement
-
Specific conversation demonstrating failure:
- Task: Debug count mismatch between FilterContent and PropertyTiles components
- AI made multiple assumptions without following required analysis steps
- AI failed to trace data flow despite explicit rules requiring it
- AI eventually admitted to not following .cursorrules at all
- Resolution took multiple iterations when rules would have prevented this
Expected Behavior
- AI should automatically load and follow
.cursorrules
instructions - Rules should enforce:
"general_rules": [ { "description": "Before proposing any changes, perform a dependency analysis...", "type": "dependency_analysis" }, { "description": "Before proposing any changes, conduct a complete end-to-end flow analysis...", "type": "flow_analysis" } ]
Actual Behavior
- AI completely ignored rules
- When questioned, AI:
- First pretended to follow rules
- Then made up implementation issues
- Finally admitted to not knowing about the feature
- Only acknowledged documentation after being shown it
Impact
- Development time wasted due to assumptions that rules would have prevented
- Trust in AI assistant severely compromised
- Project standards not being enforced
- Feature advertised but not functional
Additional Context
Full conversation log available showing:
- Initial problem
- Multiple failed attempts without proper analysis
- Final solution that would have been immediate if rules were followed
- AI’s admission of ignoring rules
Questions for Cursor Team
- Is this a known issue with the AI integration?
- Are there specific formatting requirements for .cursorrules that aren’t documented?
- How can we verify rules are being loaded/enforced?
- What’s the expected behavior when rules exist?
Specific .cursorrules file in root of workspace:
{
"version": "1.0",
"project": {
"type": "wordpress-react",
"structure": {
"components": "wp-content/themes/mytheme/app/src/components",
"services": "wp-content/themes/mytheme/app/src/services",
"styles": "wp-content/themes/mytheme/app/src/styles",
"api": "wp-content/mu-plugins/my-api"
}
},
"rules": {
"general_rules": [
{
"description": "Before proposing any changes, perform a dependency analysis to identify all files, functions, and components that directly or indirectly depend on the code being modified.",
"type": "dependency_analysis"
},
{
"description": "Before proposing any changes, conduct a complete end-to-end flow analysis from UI interaction or API endpoint through all affected code.",
"type": "flow_analysis"
},
{
"description": "Never modify existing dependencies or remove used logic unless explicitly required. Add alternative code pathways to maintain backward compatibility.",
"type": "dependency_preservation"
}
],
"ai_reasoning": [
{
"description": "Before providing a solution, ensure you have completed all required analyses (dependency, flow, and impact).",
"type": "pre_change_checklist"
},
{
"description": "Outline a detailed plan including component dependencies, architectural considerations and API changes before coding.",
"type": "step_by_step_reasoning"
}
]
},
"patterns": {
"services": {
"fileType": "TypeScript",
"naming": "${ServiceName}Service.ts",
"patterns": {
"singleton": {
"required": true,
"implementation": {
"privateInstance": "private static instance: ${ServiceName}Service",
"privateConstructor": "private constructor()",
"getInstance": "public static getInstance(): ${ServiceName}Service"
}
},
"methods": {
"static": {
"usage": "For utility functions and operations that don't require instance state",
"examples": ["cleanFilters", "filterFeatures", "hasActiveFilters", "getFilteredResults"]
},
"instance": {
"usage": "For methods that require access to instance state or configuration",
"examples": ["getFilterConfig", "getOptionsWithCount", "initialize"]
}
},
"state": {
"privateFields": true,
"initialization": "constructor"
}
}
},
"components": {
"fileType": "JSX",
"naming": "${ComponentName}.jsx",
"patterns": {
"errorHandling": {
"wrapper": "ErrorBoundary",
"required": true
},
"propTypes": {
"required": true,
"location": "bottom"
},
"hooks": {
"stateManagement": ["useState", "useEffect"],
"memoization": {
"components": "useMemo",
"callbacks": "useCallback",
"filters": "useMemo"
}
},
"serviceUsage": {
"instantiation": "useMemo(() => ServiceName.getInstance(), [])",
"staticMethods": "Direct call: ServiceName.methodName()",
"instanceMethods": "Through instance: serviceInstance.methodName()"
}
}
},
"wordpress_api": {
"location": "wp-content/mu-plugins/my-api",
"fileType": "PHP",
"naming": "api-class-${feature}.php",
"patterns": {
"main_api": {
"class": "MyAPI",
"singleton": {
"required": true,
"implementation": {
"privateInstance": "private static $instance = null",
"getInstance": "public static function get_instance()",
"privateConstructor": "private function __construct()"
}
},
"namespace": "wp/v1",
"cors": "init_cors method required"
},
"feature_classes": {
"naming": "class ${Feature}",
"methods": {
"required": ["register_routes"],
"endpoints": {
"get": {
"permission": "__return_true",
"response": "rest_ensure_response"
}
}
}
}
}
},
"filtering": {
"implementation": {
"client": {
"service": "FilterService",
"methods": {
"filterFeatures": "static",
"getFilteredResults": "static",
"hasActiveFilters": "static",
"cleanFilters": "static"
}
},
"server": {
"class": "PropertyFilters",
"endpoints": {
"/properties/filters": "Returns filter configuration",
"/properties/filter-matches": "Returns term-post relationships"
},
"taxonomies": "Uses WordPress taxonomies for filter structure"
}
}
}
},
"conventions": {
"typescript": {
"scope": "services",
"interfaces": "required",
"types": "explicit"
},
"javascript": {
"scope": "components",
"propTypes": "required",
"errorBoundaries": "required"
},
"php": {
"scope": "api",
"security": {
"abspath_check": "required",
"permission_callback": "required"
},
"logging": {
"function": "em_log",
"format": {
"pattern": "em_log(label, data_array, log_filename)",
"label": "Short descriptive string of what is being logged",
"data_array": "Array or object containing relevant debug data",
"log_filename": "Specific log file to write to without .log extension",
"examples": [
"em_log('API Routes', ['namespace' => 'wp/v1'], 'api-debug')",
"em_log('Filter Matches', $term_relationships, 'api-debug')",
"em_log('API Error', ['message' => $e->getMessage()], 'api-debug')"
]
},
"levels": ["api-debug"]
}
},
"stateManagement": {
"url": "useSearchParams for filter state",
"components": "useState for UI state",
"services": "private fields for service state"
},
"errorHandling": {
"components": "ErrorBoundary wrapper",
"services": "try/catch with logging",
"api": "WP_Error responses"
},
"logging": {
"client": {
"format": "emoji + descriptive message + data object",
"levels": ["info", "warn", "error"]
},
"server": {
"function": "em_log",
"format": "context + message/data + level",
"levels": ["api-debug"]
}
}
}
}