feat(cursor): Add Windows PowerShell support for Cursor hooks

Complete Windows parity with bash scripts:
- Create 7 PowerShell scripts mirroring bash functionality
- Update installer to detect platform and install appropriate scripts
- Generate platform-specific hooks.json with PowerShell invocation
- Add enterprise support for Windows (ProgramData/Cursor)
- Update findCursorHooksDir to check for both .sh and .ps1
- Add comprehensive Windows documentation to STANDALONE-SETUP.md

Scripts added: common.ps1, session-init.ps1, context-inject.ps1,
save-observation.ps1, save-file-edit.ps1, session-summary.ps1, user-message.ps1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alex Newman
2025-12-29 21:16:41 -05:00
parent ed8269250d
commit a82d1a24b9
10 changed files with 1086 additions and 117 deletions
+96
View File
@@ -16,6 +16,7 @@ Use claude-mem's persistent memory in Cursor without a Claude Code subscription.
## Prerequisites
### macOS / Linux
- Cursor IDE
- Node.js 18+
- Git
@@ -23,6 +24,12 @@ Use claude-mem's persistent memory in Cursor without a Claude Code subscription.
- **macOS**: `brew install jq curl`
- **Linux**: `apt install jq curl`
### Windows
- Cursor IDE
- Node.js 18+
- Git
- PowerShell 5.1+ (included with Windows 10/11)
## Step 1: Clone Claude-Mem
```bash
@@ -195,3 +202,92 @@ If you hit the 1500 requests/day limit:
| `npm run worker:start` | Start the background worker |
| `npm run worker:stop` | Stop the background worker |
| `npm run worker:restart` | Restart the worker |
---
## Windows Installation
Windows users get full support via PowerShell scripts. The installer automatically detects Windows and installs the appropriate scripts.
### Enable Script Execution (if needed)
PowerShell may require you to enable script execution:
```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
### Step-by-Step for Windows
```powershell
# Clone and build
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem
npm install
npm run build
# Configure provider (Gemini example)
$settingsDir = "$env:USERPROFILE\.claude-mem"
New-Item -ItemType Directory -Force -Path $settingsDir
@"
{
"CLAUDE_MEM_PROVIDER": "gemini",
"CLAUDE_MEM_GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
}
"@ | Out-File -FilePath "$settingsDir\settings.json" -Encoding UTF8
# Interactive setup (recommended - walks you through everything)
npm run cursor:setup
# Or manual installation
npm run cursor:install
npm run worker:start
```
### What Gets Installed on Windows
The installer copies these PowerShell scripts to `.cursor\hooks\`:
| Script | Purpose |
|--------|---------|
| `common.ps1` | Shared utilities |
| `session-init.ps1` | Initialize session on prompt |
| `context-inject.ps1` | Inject memory context |
| `save-observation.ps1` | Capture MCP/shell usage |
| `save-file-edit.ps1` | Capture file edits |
| `session-summary.ps1` | Generate summary on stop |
The `hooks.json` file is configured to invoke PowerShell with `-ExecutionPolicy Bypass` to ensure scripts run without additional configuration.
### Windows Troubleshooting
**"Execution of scripts is disabled on this system"**
Run as Administrator:
```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
```
**PowerShell scripts not running**
Verify the hooks.json contains PowerShell invocations:
```powershell
Get-Content .cursor\hooks.json
```
Should show commands like:
```
powershell.exe -ExecutionPolicy Bypass -File "./.cursor/hooks/session-init.ps1"
```
**Worker not responding**
Check if port 37777 is in use:
```powershell
Get-NetTCPConnection -LocalPort 37777
```
**Antivirus blocking scripts**
Some antivirus software may block PowerShell scripts. Add an exception for the `.cursor\hooks\` directory if needed.