I built a self-hosted bot to generate Project Rules from PR comments (.mdc rules)

I’ve been using Cursor for more than a year now and have enjoyed watching it evolve from a single-player productivity boost to a tool that enhances the entire organization’s effectiveness. I decided to build a Github bot to generate Cursor project rules for our team at Squint.ai, and I’m open-sourcing it here.

The key idea is that many ideas for cursor rules emerge during the PR review process. This self-hosted bot reads PR comments and suggests updates and additions to the .cursor/rules directory (the new .mdc system) based on feedback from those PRs.

The experience of engaging with the bot is as follows:

  1. A PR comment is posted.
  2. The bot evaluates whether it’s a good rule candidate in light of existing rules and best practices.
  3. The bot replies to the PR comment with a suggestion and diff.
  4. A team member clicks an “accept” button on the suggestion comment.
  5. All rule suggestions are aggregated into a summary comment on the PR.
  6. A team member comments “/apply-cursor-rules,” which commits the rules to the branch.

I based the instructions on how to create rules on discussions in this forum, notably this thread: https://forum.cursor.com/t/my-best-practices-for-mdc-rules-and-troubleshooting/50526

Give it a try! It’s super easy to set up—just host it and provide an Anthropic API key. I recommend starting in “dry run” mode (configurable on the frontend), which will run the suggestion pipeline and let you see results without actually commenting on your PRs. From there, you can modify the prompts in prompts.py to better suit your organization’s needs.

Shoutout agent mode for helping me get this done in a couple of days.

Repo: https://github.com/alexyoung23j/cursor-ruler

1 Like