[GH-ISSUE #596] bug: Claude Code Extension in VS Code - Can't run generated hooks #191

Closed
opened 2026-03-02 04:12:44 +03:00 by kerem · 4 comments
Owner

Originally created by @martinsafsten-codescene on GitHub (Feb 26, 2026).
Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/596

System information

  • Git AI version: 1.1.5
  • VS Code version: 1.109.5
  • Claude Code for VS Code (Extension) version: 2.1.59
  • Claude Code CLI version: 2.1.6
  • OS: Windows 11

Problem description

When using Claude Code through the Chat UI inside VS Code, none of the generated code was tagged as AI generated. I traced it back to Claude not being able to run the git-ai hooks for PostToolUse and PreToolUse as generated by git-ai install-hooks

This is what was generated in %USERPROFILE%/.claude/settings.json

"hooks": {
    "PostToolUse": [
      {
        "hooks": [
          {
            "command": "C:\\Users\\marti\\.git-ai\\bin\\git-ai.exe checkpoint claude --hook-input stdin"
            "type": "command"
          }
        ],
        "matcher": "Write|Edit|MultiEdit"
      }
    ],
    "PreToolUse": [
      {
        "hooks": [
          {
            "command": "C:\\Users\\marti\\.git-ai\\bin\\git-ai.exe checkpoint claude --hook-input stdin"
            "type": "command"
          }
        ],
        "matcher": "Write|Edit|MultiEdit"
      }
    ]
  },

The CLI has no issue with this, but the extension is unable to run them.

Workaround

I did find that changing the command to this, it started working:

"command": "/c/Users/marti/.git-ai/bin/git-ai.exe checkpoint claude --hook-input stdin"

However, this syntax did not work for the CLI

I ended up with this workaround that works for both the Extension, and the CLI:

"command": "git-ai checkpoint claude --hook-input stdin"

Conclusion

Obviously, it requires that git-ai is in the PATH variable, which is fine on my dev machine, but it is a workaround. Running git-ai install-hooks overwrites these manual changes, making it abit fragile.

One could also argue that this isn't a bug in Git AI, but rather in the VS Code Extension, which should handle windows + bash paths better. But I thought I'd create this issue anyway.

Originally created by @martinsafsten-codescene on GitHub (Feb 26, 2026). Original GitHub issue: https://github.com/git-ai-project/git-ai/issues/596 ### System information - Git AI version: **1.1.5** - VS Code version: **1.109.5** - Claude Code for VS Code (Extension) version: **2.1.59** - Claude Code CLI version: **2.1.6** - OS: **Windows 11** ### Problem description When using Claude Code through the Chat UI inside VS Code, none of the generated code was tagged as AI generated. I traced it back to Claude not being able to run the git-ai hooks for **PostToolUse** and **PreToolUse** as generated by `git-ai install-hooks` This is what was generated in `%USERPROFILE%/.claude/settings.json` ``` "hooks": { "PostToolUse": [ { "hooks": [ { "command": "C:\\Users\\marti\\.git-ai\\bin\\git-ai.exe checkpoint claude --hook-input stdin" "type": "command" } ], "matcher": "Write|Edit|MultiEdit" } ], "PreToolUse": [ { "hooks": [ { "command": "C:\\Users\\marti\\.git-ai\\bin\\git-ai.exe checkpoint claude --hook-input stdin" "type": "command" } ], "matcher": "Write|Edit|MultiEdit" } ] }, ``` The CLI has no issue with this, but the extension is unable to run them. ### Workaround I did find that changing the command to this, it started working: ``` "command": "/c/Users/marti/.git-ai/bin/git-ai.exe checkpoint claude --hook-input stdin" ``` However, this syntax did not work for the CLI I ended up with this workaround that works for both the Extension, and the CLI: ``` "command": "git-ai checkpoint claude --hook-input stdin" ``` ### Conclusion Obviously, it requires that git-ai is in the PATH variable, which is fine on my dev machine, but it is a workaround. Running `git-ai install-hooks` overwrites these manual changes, making it abit fragile. One could also argue that this isn't a bug in Git AI, but rather in the VS Code Extension, which should handle windows + bash paths better. But I thought I'd create this issue anyway.
kerem closed this issue 2026-03-02 04:12:45 +03:00
Author
Owner

@martinsafsten-codescene commented on GitHub (Feb 26, 2026):

I have created a bug at Claude Codes repo aswell: https://github.com/anthropics/claude-code/issues/29007

<!-- gh-comment-id:3966763551 --> @martinsafsten-codescene commented on GitHub (Feb 26, 2026): I have created a bug at Claude Codes repo aswell: https://github.com/anthropics/claude-code/issues/29007
Author
Owner

@svarlamov commented on GitHub (Feb 27, 2026):

Claude Code did in fact change how they execute hooks, so this issue is real. It seems like that was actually intentional, so I updated things on our side. This should be workign as of 1.1.6 -- can you try if this is fixed after git-ai upgrade and make sure to re-run git-ai install-hooks?

<!-- gh-comment-id:3973453349 --> @svarlamov commented on GitHub (Feb 27, 2026): Claude Code did in fact change how they execute hooks, so this issue is real. It seems like that was actually intentional, so I updated things on our side. This should be workign as of `1.1.6` -- can you try if this is fixed after `git-ai upgrade` and make sure to re-run `git-ai install-hooks`?
Author
Owner

@martinsafsten-codescene commented on GitHub (Feb 27, 2026):

Thanks Sasha for the quick reply. After updating git-ai to 1.1.6, updating Claude Code to 2.1.62, and Claude Code for VS Code to 2.1.61, hooks seems to work as expected.

Kudos!

<!-- gh-comment-id:3973972150 --> @martinsafsten-codescene commented on GitHub (Feb 27, 2026): Thanks Sasha for the quick reply. After updating git-ai to 1.1.6, updating Claude Code to 2.1.62, and Claude Code for VS Code to 2.1.61, hooks seems to work as expected. Kudos!
Author
Owner

@svarlamov commented on GitHub (Feb 27, 2026):

Awesome! And just a quick note for other folks who might be following this -- make sure to get on the latest Claude (2.1.62+) as there were some releases in between that were sending bad paths to hooks I believe

<!-- gh-comment-id:3975072660 --> @svarlamov commented on GitHub (Feb 27, 2026): Awesome! And just a quick note for other folks who might be following this -- make sure to get on the latest Claude (`2.1.62`+) as there were some releases in between that were sending bad paths to hooks I believe
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#191
No description provided.