Rules for the AI generate commit messages

The feature to generate a commit message, in the source control tab, is very nice. Anyway to provide rules or a custom prompt for this?

Hi Will,

Great question. The answer is not officially. The Source Control “Generate commit message” flow doesn’t currently support its own custom prompt, and the newer Rules system (Settings > Rules, Project Rules, and .cursor/rules) doesn’t affect that flow today.

However, there is a workaround: a repo-root legacy .cursorrules file can still influence the generated commit messages for that repo. If you want to keep it local to one clone, you can:

  1. Create a .cursorrules file in the repo root
  2. Add an instruction like: When Cursor auto-generates a Git commit message for this repository, I would like you to do X, Y, and Z.
  3. Add .cursorrules to .git/info/exclude so it doesn’t get committed
  4. Stage a small change and click the sparkle button in the Source Control commit box to test it

Of course, you can ask Cursor to help you generate this rule on your behalf. This is a legacy workaround rather than an officially supported path, and it may change in the future.

@kevinn Is this still the case now? Both that there is still no way to officially edit the commit message generation and that this workaround still exists and works?

If so, I really wish cursor would get around to updating this feature. The commit message generated by the button are pretty awful and overly wordy. Somehow they are noticeably worse than commit messages generated by any of the models available through the agents UI.

Hey @Spunkie, good timing. I just re-checked this against the current build, and yes, both parts of that earlier answer still hold:

  1. There’s still no official setting to customize or add a custom prompt to the Source Control “Generate commit message” button.
  2. The repo-root .cursorrules workaround still works. That file’s contents get passed into the commit-message generation as context, so an instruction there is the one supported lever you have today. Note that the newer .cursor/rules files do not affect this particular flow, only the legacy .cursorrules.

On the quality point: you’re not imagining it. The commit-message button intentionally runs on a small, fast model tuned for quick metadata generation, which is different from the frontier models you choose in the agent, so the style and verbosity won’t match. That’s also why .cursorrules is your best knob here for the “too wordy” problem. Something like:

When generating a Git commit message for this repo, keep it to a single
concise subject line under ~60 characters. Only add a short body if the
change is non-obvious, and never restate the diff line by line.

Steps to keep it local to your clone:

  1. Create a .cursorrules file in the repo root.
  2. Add your instruction (like the example above).
  3. Add .cursorrules to .git/info/exclude so it isn’t committed.
  4. Stage a change and click the sparkle button to test.