Skip to content

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

Closed

Description

@1079265662

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.

Activity

  1. added a commit that references this issue on Nov 19, 2026
    23ce841
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions