Commit
Create a git commit now. Do not ask for confirmation unless there is nothing to commit or secrets are involved.
How the user invokes this
- Slash:
/commitin Agent chat - Invoke with slash
/commitin the current Agent chat (do not start a new chat).- Cursor’s Agent input is a webview: keybindings cannot reliably type/submit into it (
typegoes to the editor instead). No Mac shortcut for auto-send/commituntil Cursor exposes a prompt API that works from keybindings.
- Cursor’s Agent input is a webview: keybindings cannot reliably type/submit into it (
Steps
- In parallel:
git status,git diff(staged + unstaged). Do not rungit logor infer message style from history (see.cursor/rules/git.mdc). - Decide what belongs in this commit from the conversation / current task. Exclude unrelated dirty files (e.g. leftover docs). Never stage secrets (
.env,credentials.json,config/master.key). - Stage the chosen paths with
git add. - Draft the subject from
.cursor/rules/git.mdc(this file only — including the scope glossary):type(scope): imperative description- Types:
feat|fix|docs|style|refactor|test|chore|perf|build|ci - Imperative, lowercase start, ≤ 72 chars, no trailing punctuation
- Commit with HEREDOC (no
--no-verify, no amend, no push, no git config):
git commit -m "$(cat <<'EOF'
type(scope): description
Optional body when the why is not obvious.
EOF
)"
- If a hook fails, fix and create a new commit (do not amend).
- Run
git statusand reply with the short hash + subject only.
Out of scope
- Do not push unless the user explicitly asks in the same turn.
- Do not commit when the worktree has no relevant changes — say so briefly.