File: ods/installers/windows/phases/06-directories.ps1, Repair-HermesSoulMd (line 547).
Defective code:
if (-not $_rendered) {
if (Test-Path -LiteralPath $_output -PathType Container) {
Remove-Item -LiteralPath $_output -Recurse -Force
}
if (-not (Test-Path -LiteralPath $_output -PathType Leaf)) {
$_content = Get-Content -LiteralPath $template -Raw
$_content = $_content -replace "(?m)^\s*<!-- INSTALLATION_CONTEXT -->\s*\r?\n?", ""
Write-Utf8NoBom -Path $_output -Content $_content
Write-AIWarn "Generated fallback Hermes SOUL.md without dynamic installation context"
}
}
($_output is data\persona\SOUL.md — a file path.)
Behavior:
The fallback branch guards its cleanup with Test-Path ... -PathType Container, which only returns $true if the path is a directory. Since $_output is a file (SOUL.md), this test is always $false, so the Remove-Item that should discard a stale/leftover SOUL.md never runs. Control then falls through to the next if, which only writes the fallback when a SOUL.md file does not already exist (-not (Test-Path ... -PathType Leaf)). If a stale SOUL.md is already present (the common case after a previous install/upgrade), it is left untouched.
Impact:
The intended "refresh without dynamic installation context" fallback is effectively dead: a stale SOUL.md is never regenerated, so Hermes keeps serving the old persona/instruction content across upgrades and reinstalls on Windows.
Fix:
The cleanup guard should test for the file (or any item) at $_output, e.g.:
if (Test-Path -LiteralPath $_output) {
Remove-Item -LiteralPath $_output -Recurse -Force
}
(Optionally keep -PathType Leaf if a directory at that path is also expected.)
File:
ods/installers/windows/phases/06-directories.ps1,Repair-HermesSoulMd(line 547).Defective code:
(
$_outputisdata\persona\SOUL.md— a file path.)Behavior:
The fallback branch guards its cleanup with
Test-Path ... -PathType Container, which only returns$trueif the path is a directory. Since$_outputis a file (SOUL.md), this test is always$false, so theRemove-Itemthat should discard a stale/leftover SOUL.md never runs. Control then falls through to the nextif, which only writes the fallback when a SOUL.md file does not already exist (-not (Test-Path ... -PathType Leaf)). If a stale SOUL.md is already present (the common case after a previous install/upgrade), it is left untouched.Impact:
The intended "refresh without dynamic installation context" fallback is effectively dead: a stale
SOUL.mdis never regenerated, so Hermes keeps serving the old persona/instruction content across upgrades and reinstalls on Windows.Fix:
The cleanup guard should test for the file (or any item) at
$_output, e.g.:(Optionally keep
-PathType Leafif a directory at that path is also expected.)