Size: 1.5 KB Modified: 25/06/2026 12:28 PM
---
description: "Use when modifying, creating, or deleting code files in the workspace. Commits code changes after each batch with descriptive messages, does not push."
applyTo: "**"
---

# Auto-Commit Protocol

After completing a batch of code changes (editing, creating, or deleting files), commit the changes to the local repository. Do not push.

## Rules

- **Commit after each logical batch.** A batch is one user-requested change or feature. Multiple files touched for the same purpose count as one batch.
- **Do not wait for explicit permission** -- commit automatically when the batch is done and verified (builds/passes).
- **Do not push.** Commits are local only.
- **Message must describe the actual diff** -- read `git diff --cached` and `git diff --cached --stat` before writing the message. Do not summarize from memory or intent.
- **Prefer the Commit-Message-Protocol** rules when writing the message (imperative mood, specific nouns/verbs, no process notes).
- **Stage exactly the changed files** -- avoid `git add -A` when unrelated changes exist in the working tree. Prefer `git add <specific files>`.

## Non-goals

- Do not commit after purely read-only operations (searching, reading files, browsing).
- Do not commit after git operations themselves (status, log, diff).
- Do not commit when the user explicitly says not to.

## Edge Cases

- If a build fails, fix the errors before committing. Do not commit broken code.
- If the user's request produces no file changes (e.g. asking a question), do not commit.
Offline