Windows: MemoryHealthCheck reports installed memory hooks as unregistered (installer backslash-escapes the config root)

未关闭 适合新手
#3,020 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
bash, bun, typescript

调研方向

从 skills/LifeOS/Tools/InstallEngine.ts 开始,检查 rewriteHomeRoot、shellQuoteRoot 和 rewriteHookRoots,然后将它们的输出与 LIFEOS/TOOLS/LifeosUpgrade.ts 中的 hookCommandScript 进行比较。验证 Windows 根路径是否规范化为正斜杠,并验证更新时现有 hook 是否会重新指向新的位置。使用该 issue 的探针和 MemoryHealthCheck.ts 确认命令能够被解析,并被报告为已注册;分别处理 Report.ts attest 的提取问题和 PATH 检测问题。

由索引模型根据 Issue 内容生成。

描述

Version

LifeOS 8.761.0 · attestation: unattested (could not extract v8.761.0: tar (child): Cannot connect to C: resolve failed

gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now)

What is broken

On Windows, MemoryHealthCheck reports MemoryTurnStart, MemoryReviewFire and MemoryHealthGate as "not registered in any settings layer" even though the installer registered them and they run. The installer's rewriteHookRoots → shellQuoteRoot (unquoted position) backslash-escapes every backslash in a Windows config root, so each hook command is written with doubled backslashes: <DRIVE>:\\<HOMEDIR>\\.claude/hooks/<name>.hook.ts. Bash runs that correctly, but hookCommandScript in LIFEOS/TOOLS/LifeosUpgrade.ts treats any backslash as making a command opaque and returns null, so every installer-written hook is invisible to the registration check (and to anything else that attests hooks through that parser). The four memory-write bugs on the same install are already covered by #2568 (closed, fix pending release) and are not refiled here. Separately, Report.ts attest cannot extract the release on Windows: tar reads the drive letter in the archive path as a remote host ("Cannot connect to C: resolve failed"), and collect reports bun and git as "not found" although both are on PATH.

Where (file:line)

skills/LifeOS/Tools/InstallEngine.ts:1322

Repro on a clean tree
1. Install LifeOS 8.761.0 on Windows 11 x64 under Claude Code (Git Bash, bun 1.4.5), default config root (`.claude` in the user profile).
2. Open `settings.json` in the config root: every LifeOS hook command is the config root with doubled backslashes, then `/hooks/<name>.hook.ts`.
3. Run `MemoryHealthCheck.ts`: it warns `settings-hook-absent` for all three memory hooks.
4. Probe (captured below): render `$HOME/.claude/hooks/MemoryTurnStart.hook.ts` through the installer's own `rewriteHookRoots` with the Windows config root, run the result with `bash -c` (exit 0: the hook works), then pass the same string to `hookCommandScript`, which returns `null`. The probe exits 1.
5. Workaround that turns the check green: rewrite each command's root to forward slashes (`<DRIVE>:/<HOMEDIR>/.claude/hooks/...`). Git Bash runs it identically and `hookCommandScript` returns the script path.
Negative control

Probe: bun C:~/AppData/Local/Temp/claude/978c4f609d2e0d95/745f923b-81b5-41a9-a4f1-42748d93b935/scratchpad/probe/hookroot-probe.ts · exit 1 · captured 2026-11-28T20:10:35.661Z

Red looks like: hookCommandScript -> null

installer-rendered command: C:\\Users\\<user>\\.claude/hooks/MemoryTurnStart.hook.ts
runs under bash: exit 0
hookCommandScript -> null
Suggested fix

Smallest fix, at the producer: on win32, convert the config root to forward slashes before shellQuoteRoot quotes it (in rewriteHomeRoot), e.g. const r = process.platform === "win32" ? root.split(sep).join("/") : root. A drive path with forward slashes is valid for Git Bash, cmd and PowerShell, contains no backslash, and hookCommandScript parses it. POSIX output is unchanged. repointHookRoots could apply the same normalisation so existing Windows installs heal on the next update. Relaxing hookCommandScript's backslash rule instead is not recommended; it exists for quote-boundary safety.

Environment
  • OS: Windows (x64)
  • Harness: claude-code
  • bun: not found · git: not found
  • Doctor broken: codex, interceptor, cloudflare, imagemagick, ffmpeg, ytdlp, fabric
主要语言
TypeScript
星标
20k
派生
2.5k
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

danielmiessler/LifeOS 的其他 Issue

查看 danielmiessler/LifeOS 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。