Repository navigation
Description
What happens
The Windows installer creates an orchestrator virtual environment and installs Agentmetry into it, but the Claude and Cursor hook installers invoke the global python command instead of that virtual environment.
On a machine where Agentmetry is not installed globally, both hook installers fail with:
ModuleNotFoundError: No module named 'agentmetry'
The top-level install.ps1 then continues to doctor, prints Install complete, instructs the user to restart Claude Code and Cursor, and exits with code 0.
This leaves the user and any deployment automation with a successful result even though a requested installation stage failed.
Reproduce
PowerShell 7 is used here deliberately to avoid the separate Windows PowerShell parsing problem reported in #133.
From a fresh clone:
git clone https://github.com/blitzcrieg1/agentmetry.git
cd agentmetryConfirm that global Python does not have Agentmetry installed:
python -c "import sys; print(sys.executable); import agentmetry"Result:
C:\Python314\python.exe
ModuleNotFoundError: No module named 'agentmetry'
Create the project environment without installing hooks:
pwsh -NoProfile -ExecutionPolicy Bypass `
-File .\scripts\install.ps1 `
-SkipHooks `
-SkipDashboardConfirm that Agentmetry is available from the venv:
.\apps\orchestrator\.venv\Scripts\python.exe `
-c "import sys, agentmetry; print(sys.executable); print(agentmetry.__file__)"Result:
...\apps\orchestrator\.venv\Scripts\python.exe
...\apps\orchestrator\agentmetry\__init__.py
Run the Claude hook installer and capture its exit code:
pwsh -NoProfile -ExecutionPolicy Bypass `
-File .\scripts\install_claude_hooks.ps1
$hookExitCode = $LASTEXITCODE
Write-Host "Hook installer exit code: $hookExitCode"Result:
ModuleNotFoundError: No module named 'agentmetry'
claude hook install FAILED (exit 1). Nothing was installed.
Hook installer exit code: 1
The interpreter selected by the hook installer is the global interpreter, not the venv:
(Get-Command python).Source
Resolve-Path .\apps\orchestrator\.venv\Scripts\python.exeResult:
C:\Python314\python.exe
...\apps\orchestrator\.venv\Scripts\python.exe
Reproduce the false-success result
From the same clone, run the top-level installer with hook installation enabled:
pwsh -NoProfile -ExecutionPolicy Bypass `
-File .\scripts\install.ps1 `
-SkipDashboard
$installerExitCode = $LASTEXITCODE
Write-Host "Main installer exit code: $installerExitCode"Both child installers report failure:
claude hook install FAILED (exit 1). Nothing was installed.
cursor hook install FAILED (exit 1). Nothing was installed.
The parent installer nevertheless continues and reports:
==> Running agentmetry doctor
...
Install complete.
...
Fully quit and restart Claude Code / Cursor so hooks load.
Main installer exit code: 0
Cause
The hook wrappers select Python independently with:
$Python = (Get-Command python -ErrorAction Stop).SourceThis appears in:
scripts/install_claude_hooks.ps1scripts/install_cursor_hooks.ps1scripts/install_codex_hooks.ps1
That selection ignores the interpreter created by install.ps1 at:
apps\orchestrator\.venv\Scripts\python.exe
The top-level installer invokes the Claude and Cursor scripts as child PowerShell processes but does not check $LASTEXITCODE after either invocation. Their nonzero results therefore do not stop the parent script.
Expected behavior
The hook bootstrap should run with the Agentmetry environment created by the installer, without requiring a separate global Agentmetry installation.
If any requested hook installation fails, install.ps1 should:
- stop or otherwise clearly report an incomplete installation;
- exit nonzero;
- not print
Install complete; - not instruct the user to restart an IDE as though its hooks were installed.
Standalone hook installers should either locate the project venv or fail early with a clear message explaining which environment is required.
Why this matters
The README describes install.ps1 as the Windows one-flow installation path and says that it wires the supported IDE hooks. A successful exit code is also the contract used by deployment scripts and CI-style automation.
Returning 0 after both hook installers fail creates a partially configured recorder that appears successfully installed. Because hooks are the capture boundary, this can leave users believing activity is being recorded when the requested hook setup never completed.
Environment
OS: Microsoft Windows 11 Pro, 64-bit
OS version: 10.0.26200
PowerShell host: Windows PowerShell 5.1
pwsh: PowerShell 7.6.4
Python: 3.14.3
Global Python: C:\Python314\python.exe
Commit: a56ca49e49675f16ccbfaa3d81f623fe093edf49
This machine already had global hook configurations from another checkout, so doctor could report existing recording coverage. That does not affect the reproduction: the fresh clone's hook processes exited 1, while its parent installer exited 0.
Done when
- Hook installation launched by
install.ps1uses the venv interpreter created by that installer. - A global Agentmetry installation is not required.
- Claude and Cursor hook installation succeeds from a fresh clone when only the project venv contains Agentmetry.
- Any requested hook installer returning nonzero makes
install.ps1return nonzero. Install completeis printed only after every requested installation stage succeeds.- Existing user hook settings continue to be merged rather than replaced.
- A regression test covers both interpreter selection and child-process failure propagation.
- Ruff and pytest remain green.
Activity
fix(install): a fresh Windows install was broken three ways
chore(release): 0.8.0, the contributor release
ci: run install.sh on a clean runner, then execute the hook it installed