Skip to content

Conversation

@NewsGuyTor
Copy link

Problem

When claude-auto-commit runs in environments where the Claude Code SDK has tool access (e.g., Claude Code itself), commit message generation can fail because Claude tries to use tools to analyze the repo instead of producing a message from the supplied diff.

This led to:

  • Generic meta-responses like “I’ll analyze the changes to generate an appropriate commit message”
  • Multiple tool invocation attempts instead of direct message generation
  • Failed or incorrect commit messages

Root Cause

ClaudeCodeSDK.query() interprets prompts as allowing tool usage in tool-enabled contexts. Claude then attempts to run git diff (and similar) rather than relying solely on the diff already provided in the prompt.

Solution

The prompt was modified to explicitly instruct Claude to:

  1. Not use any tools
  2. Not run any commands
  3. Generate the commit message based only on the provided git diff
  4. Output only the commit message text

Changes

  • Updated buildPrompt() in src/claude-auto-commit.js
  • Added explicit instructions preventing tool usage
  • Clarified output requirements to avoid explanatory or meta text

Signed-off-by: NewsguyTor <newsguytor@fake.email>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant