Dynamic Time Variable Support in .cursorrules

Dynamic Time Variable Support in .cursorrules

Feature Request Summary

Add support for dynamic time/date variables in .cursorrules files that can be automatically populated at runtime when the AI generates content.

Current Limitation

Currently, when using .cursorrules to define AI behaviors, there’s no built-in way to inject the current time/date into the AI’s context. This becomes particularly problematic when generating documentation, changelogs, or any other content that requires accurate timestamps.

Use Case Example

When using Cursor AI to generate documentation like changelogs, the AI needs to include accurate timestamps. Currently, the AI either:

  1. Makes up arbitrary dates
  2. Uses placeholder dates
  3. Requires manual editing after generation

Proposed Solution

Implement special variables in .cursorrules that are dynamically resolved at runtime. For example:

{
  "rules": {
    "changelog": {
      "prompt": "Create a changelog entry for {%CURRENT_TIME%}. The changes include:",
      "context": {
        "timeFormat": "ISO"  // Optional formatting specification
      }
    }
  }
}

Suggested Variables

  • {%CURRENT_TIME%} - Current time in ISO format
  • {%CURRENT_DATE%} - Current date only
  • {%CURRENT_TIMESTAMP%} - Unix timestamp
  • {%FORMATTED_TIME:format%} - Time in specified format

Benefits

  1. More accurate documentation generation
  2. Reduced need for manual editing
  3. Consistent timestamp formatting across projects
  4. Improved automation capabilities

Technical Considerations

  • Implementation could leverage Node.js Date object
  • Should support different time formats and timezones
  • Variables should be resolved before the prompt reaches the AI
  • Should be documented in the Cursor AI documentation

Impact

This feature would significantly improve the workflow for teams using Cursor AI for documentation generation, logging, and other time-sensitive content creation tasks.