[BUG] Claude Code commits without being asked, repeatedly ignoring CLAUDE.md rule

Open 💬 2 comments Opened Jun 16, 2026 by monico-moreno

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code repeatedly commits to git without being explicitly asked, even when the project's CLAUDE.md contains a
clear, unambiguous rule:

▎ "Never git commit unless explicitly asked."

This happened multiple times in the same session, including after the user had already corrected the behavior
once. The rule was acknowledged but not followed.

Impact: Unauthorized commits pollute the git history, may trigger hooks or CI, and undermine the user's control
over their own repository. It also erodes trust in the tool — if CLAUDE.md rules aren't reliably honored, there's
little point in maintaining them.

Suggested fix: Treat any instruction in CLAUDE.md that uses "never" or "always" language as a hard behavioral
constraint that overrides default task-completion instincts.

What Should Happen?

Expected behavior: Claude Code reads and respects CLAUDE.md rules as hard constraints, not suggestions. A rule
like "never commit unless asked" should be treated as an absolute gate — no commit is made regardless of how
natural or helpful it might seem in context.

Actual behavior: Claude Code commits automatically at the end of fix tasks or implementation steps, treating the
git commit as part of "completing the task" even when the user never requested it.

Error Messages/Logs

Steps to Reproduce

use claude code cli with claude.md telling it not to commit unless explicitly asked to.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.153 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Seems to happen more when, during the same session, I do explicitly ask it to commit code. Seems like after that point, any other coding tasks are auto committed instead of following the claude.md instructions not to.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗