Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

docs(windows): keep %VAR% entries in the manual user PATH steps

Vinícius DS Andraded8cdac75e858
diff --git a/docs/windows.md b/docs/windows.md
index 65b4c7a7..d9a6b30a 100644
--- a/docs/windows.md
+++ b/docs/windows.md
@@ -109,13 +109,20 @@ foreach ($Entry in $WrapperAssets.GetEnumerator()) {
}
Get-ChildItem "$UserBin\ai-memory.*" | Unblock-File
-# Put the wrapper directory on your user PATH for future terminals.
-$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
-if (($UserPath -split ';') -notcontains $UserBin) {
+# Put the wrapper directory on your user PATH for future terminals. Read and
+# write the registry value as is: [Environment]::GetEnvironmentVariable expands
+# its %VAR% entries, and SetEnvironmentVariable would save them expanded, as
+# REG_SZ.
+$EnvKey = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey("Environment")
+$UserPath = $EnvKey.GetValue("Path", "", "DoNotExpandEnvironmentNames")
+if (($UserPath -split ';' | ForEach-Object { [Environment]::ExpandEnvironmentVariables($_) }) -notcontains $UserBin) {
$NewUserPath = (($UserPath, $UserBin) | Where-Object { $_ }) -join ";"
- [Environment]::SetEnvironmentVariable("Path", $NewUserPath, "User")
+ $EnvKey.SetValue("Path", $NewUserPath, "ExpandString")
+ # Removing a variable that does not exist broadcasts the change to Explorer.
+ [Environment]::SetEnvironmentVariable("ai-memory-path-notify", [NullString]::Value, "User")
$env:Path = "$env:Path;$UserBin"
}
+$EnvKey.Dispose()
# Start the server with Docker Desktop. The image default allowlist includes
# host.docker.internal so wrapper thin-client commands (status, search, …) are
@@ -212,12 +219,17 @@ Invoke-WebRequest `
Expand-Archive "$env:TEMP\ai-memory.zip" -DestinationPath $Dest -Force
Get-ChildItem "$Dest\ai-memory.exe" | Unblock-File
-# Put it on PATH for future terminals (optional but convenient).
-$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
-if (($UserPath -split ';') -notcontains $Dest) {
- [Environment]::SetEnvironmentVariable("Path", "$UserPath;$Dest", "User")
+# Put it on PATH for future terminals (optional but convenient). The registry
+# value is read and written as is, so its %VAR% entries stay unexpanded.
+$EnvKey = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey("Environment")
+$UserPath = $EnvKey.GetValue("Path", "", "DoNotExpandEnvironmentNames")
+if (($UserPath -split ';' | ForEach-Object { [Environment]::ExpandEnvironmentVariables($_) }) -notcontains $Dest) {
+ $EnvKey.SetValue("Path", "$UserPath;$Dest", "ExpandString")
+ # Removing a variable that does not exist broadcasts the change to Explorer.
+ [Environment]::SetEnvironmentVariable("ai-memory-path-notify", [NullString]::Value, "User")
$env:Path = "$env:Path;$Dest"
}
+$EnvKey.Dispose()
# Wire MCP + lifecycle hooks against your server.
& "$Dest\ai-memory.exe" install-mcp --client claude-code --apply