Skip to content

fix(aidd-telemetry): hooks pass ${CLAUDE_PLUGIN_ROOT} unquoted — every hook dies silently on Windows #862

Closed as not planned

Description

@VincentMenard76

Description

On Windows, Claude Code dispatches hook commands through a POSIX shell. ${CLAUDE_PLUGIN_ROOT} expands to a backslash-separated path (C:\Users\<user>\.claude\plugins\cache\...), and because the hook commands leave it unquoted, the shell eats the backslashes before node ever sees it.

Every hook of the plugin therefore fails with MODULE_NOT_FOUND. Nothing is recorded, and nothing says so: the hook is non-blocking, and journal.cjs exits 0 unconditionally by design. aidd telemetry check reports hook fired -- no run file in aidd_docs/runs yet, which reads as "not started yet" rather than "broken".

Affected file(s)

  • plugins/aidd-telemetry/hooks/hooks.json — SessionStart, Stop, PostToolUse
  • plugins/aidd-context/hooks/hooks.json — SessionStart, same line

Expected behaviour

A session on Windows writes its run file to aidd_docs/runs/.

Observed behaviour

Nothing is ever written. Proof captured from a real Claude Code session transcript (hook_non_blocking_error attachment). Two hooks pointing at the same file, differing only by quoting:

{
  "hookEvent": "SessionStart",
  "command":   "node C:\Users\<user>\.claude\probe.cjs UNQUOTED",
  "stderr":    "Error: Cannot find module 'C:\Users<user>.claudeprobe.cjs'",
  "exitCode":  1
}

C:\Users\<user>\.claude\ became C:\Users<user>.claude. The quoted variant of the same command resolved and executed normally.

Proposed solution

Quote the path argument, as ralph-loop already does (bash "${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh"):

- "command": "node ${CLAUDE_PLUGIN_ROOT}/hooks/journal.cjs session-start"
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/journal.cjs\" session-start"

Applies to all three aidd-telemetry commands and the one in aidd-context. Quoting is a no-op under cmd.exe and required under sh, so it is safe regardless of which shell the host picks.

Verified locally: after quoting, a fresh Windows session produced a complete run file — session_start, task_declared, file_written, turn_end — and aidd telemetry check returned session journalled ok / records join ok — 26 of 26 records, 0 unattributed.

Context / Technical constraints

Why this stayed invisible, and why it is worth a guard rather than only a patch:

  1. journal.cjs catches everything and exits 0 — "a measurement layer that breaks a session is worse than one that misses a session". Sound, but it also means a hook that never starts is indistinguishable from one that ran and had nothing to do.
  2. On macOS and Linux the expansion carries no backslash, so the defect cannot appear there.
  3. -- in aidd telemetry check is ambiguous between "measurement has not run yet" and "measurement can never run". A line stating whether the recorder's own command resolves would have turned a multi-hour investigation into one look.

Related: #707 (a real session per tool, on Windows and on Linux) — this is exactly the class of defect that would have caught.

Environment

AI tool Claude Code
aidd-cli version 5.3.0
OS Windows 11 Pro (10.0.26100)
node 24.12.0
aidd-telemetry 0.2.0

QA

  1. On Windows, install aidd-telemetry and enable telemetry.enabled in .aidd/config.json.
  2. Start a Claude Code session in that repository and complete one exchange.
  3. aidd_docs/runs/*.jsonl must exist and carry at least session_start and turn_end.
  4. Before the fix: the directory is never created, and no error surfaces anywhere.

I agree to follow this project's Code of Conduct.

Activity

  1. VincentMenard76 commented on Sep 11, 2026

    @VincentMenard76
    ContributorAuthor

    Refuted by the reporter — closing as not reproducible

    I filed this. It is wrong, and the fix it asks for corrects nothing. Here is what was measured afterwards, on the same machine.

    What refutes it

    I reverted SessionStart to the unquoted form in the live plugin cache and left it there. Three sessions since:

    Session start (UTC) Directory SessionStart form Run file
    16:01:16 main checkout unquoted session_start + turn_end
    17:04:31 linked worktree unquoted session_start + turn_end
    17:05:38 main checkout unquoted session_start + turn_end

    The command this issue claims cannot run, runs.

    What my original evidence actually established

    The transcript excerpt in the issue is genuine, but it comes from a probe hook carrying a hardcoded backslash path, not from the plugin's own command:

    Claim Status
    A hook command containing a literal C:\Users\… path is destroyed by the shell true, reproduced twice
    ${CLAUDE_PLUGIN_ROOT} expands to a backslash-separated path never observed — flagged as an inference in the issue, then reasoned from as fact
    Therefore the plugin's own command dies refuted

    Claude Code substitutes the token itself, and whatever it substitutes survives unquoted. A literal path and a token are not equivalent inputs; that is the step I got wrong.

    What the symptom actually was

    Two stacked causes, neither of them quoting:

    1. The plugin was enabled but never installed. aidd-telemetry@aidd-framework was true in a tracked project .claude/settings.json and absent from ~/.claude/plugins/installed_plugins.json — alone among the enabled plugins, across five consecutive auto-install batches. Its skills loaded; its hooks did not exist at runtime. /plugin install fixed it. Journalling began 21 minutes after I quoted the commands, and because of the install — a correlation I read as a cause.
    2. .aidd/config.json is a tracked file. A branch predating the commit that added it does not carry it, so telemetryEnabled() returns false and the hook runs and writes nothing, silently. Measured in that repository: 20 of 25 active branches do not carry that commit, including branches committed to the same day.

    The one thing worth keeping

    aidd telemetry check reported recorder declared yes alongside hook fired -- while the recorder was not installed at all. -- reads as "has not fired yet" and meant "cannot ever fire". A claim separating enabled but not installed from installed, not yet fired would have ended this in one look instead of a day. I am glad to open that separately if it is useful — it is the only actionable thing this investigation produced.

    No pull request will follow. Sorry for the noise, and thanks to anyone who spent time reading it.

  2. VincentMenard76 commented on Sep 11, 2026

    @VincentMenard76
    ContributorAuthor

    Closing as not reproducible — see the refutation above.

  3. moved this from Ideation to Done in AIDD Roadmapon Sep 11, 2026
  4. added theissue type on Sep 14, 2026
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

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions