plans/recluster-2026-06-04/plan-02.md
The shell/command strings claude-mem templates for hooks and MCP subprocesses are not portable across hosts. On Windows the same root cause recurs in many surfaces: cmd.exe /c uvx … --with "pkg>=x" lets the shell eat >/< redirect operators, command:"sh" reappears where sh is not on PATH, chroma-mcp/mcp-search die instantly or time out, bash hooks pop visible cmd windows, where bun breaks under GBK/UTF-8 usernames, and the PATH prelude spawns a fresh login shell on every hook. All are one defect: there is no single, host-aware spawn contract that quotes arguments and resolves the interpreter/root canonically.
>/< in --with version pins (one-line fix)--with "onnxruntime>=1.20" mangled by shell redirect operatorscommand:"sh" reappeared; sh not on PATHwhere bun on Windows with Chinese (GBK/UTF-8) usernameDesign doc: plans/02-spawn-contract-templating.md. Centralize argv construction with host-aware quoting (no shell redirect exposure for uvx --with); resolve interpreter/root once; avoid login-shell-per-hook; suppress console windows on Windows GUI hosts; encode-safe path handling under non-UTF-8 locales.
| Host | Shell | Required behavior |
|---|---|---|
| Windows | cmd.exe | uvx --with "pkg>=x" reaches uvx intact; no >/< mangling |
| Windows | PowerShell / Desktop | no visible cmd windows; chroma-mcp + mcp-search connect |
| Windows | GBK username | where bun / spawn resolves |
| all | all | no login shell spawned per hook |
Hook IO channel/exit discipline (plan-01); worker process lifecycle (plan-03).