mnemon icon indicating copy to clipboard operation
mnemon copied to clipboard

Windows: Kimi Code hooks registered as bare .sh pop a Git Bash window after Kimi Code v0.39

Open 1079265662 opened this issue 3 weeks ago • 0 comments

Windows: Kimi Code hooks registered as bare .sh pop a Git Bash window after Kimi Code v0.39

Environment

  • mnemon 0.2.13 (installed via npm), mnemon setup --target kimi --yes
  • Windows 11 + Git for Windows (registers .sh → sh_auto_file → "C:\Program Files\Git\git-bash.exe" --no-cd "%L" %*)
  • Kimi Code desktop ≥ v0.39 (release notes: "file tools and Shell now resolve Git Bash paths correctly on Windows")

What happens

Setup registers three hooks in $KIMI_CODE_HOME/config.toml as bare script paths:

[[hooks]]
event = "SessionStart"
command = "C:\\Users\\<user>\\.kimi-code\\hooks\\mnemon\\prime.sh"
timeout = 10

[[hooks]]
event = "UserPromptSubmit"
command = "C:\\Users\\<user>\\.kimi-code\\hooks\\mnemon\\user_prompt.sh"
timeout = 10

[[hooks]]
event = "Stop"
command = "C:\\Users\\<user>\\.kimi-code\\hooks\\mnemon\\stop.sh"
timeout = 10

Before Kimi Code v0.39 these ran silently through a shell. Since v0.39 the hook command is executed Windows-natively, and a bare .sh:

  • under cmd /c fails with "not recognized as an internal or external command" (Kimi Code hooks are fail-open, so the hooks silently stop working), or
  • gets handed to the Windows file association (git-bash.exe), so an interactive Git Bash window pops up on every SessionStart, every user prompt submit, and every turn stop.

Expected

Hooks run invisibly via bash, as before.

Verified workaround

Register the hooks with an explicit bash interpreter — all three phases then run silently and produce the expected stdout (tested via cmd /c with a JSON payload on stdin, exit 0):

command = "\"C:\\Program Files\\Git\\bin\\bash.exe\" \"C:\\Users\\<user>\\.kimi-code\\hooks\\mnemon\\prime.sh\""

Suggested fix

For --target kimi on Windows, resolve bash.exe (e.g. C:\Program Files\Git\bin\bash.exe, fallback to where bash) and register command = "<bash.exe>" "<script.sh>", or generate small .cmd wrappers — similar to how the ZCode target already invokes PowerShell explicitly on Windows.

Happy to test a patched build.

1079265662 avatar Nov 11 '26 07:11 1079265662