cursor-hooks/STANDALONE-SETUP.md
Persistent AI Memory for Cursor - Zero Cost to Start
Use claude-mem's persistent memory in Cursor without a Claude Code subscription. Choose between free-tier providers (Gemini, OpenRouter) or paid options.
What You Get:
.cursor/rules/ - relevant history included in every chatWhy This Matters: Every Cursor session starts fresh. Claude-mem bridges that gap - your AI agent builds cumulative knowledge about your codebase, decisions, and patterns over time.
curl -fsSL https://bun.sh/install | bash)jq and curl:
brew install jq curlapt install jq curlpowershell -c "irm bun.sh/install.ps1 | iex")# Clone the repository
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem
# Install dependencies
bun install
# Build the project
bun run build
Since you don't have Claude Code, you need to configure an AI provider for claude-mem's summarization engine.
Gemini offers 1500 free requests per day, plenty for typical usage.
# Create settings directory
mkdir -p ~/.claude-mem
# Create settings file
cat > ~/.claude-mem/settings.json << 'EOF'
{
"CLAUDE_MEM_PROVIDER": "gemini",
"CLAUDE_MEM_GEMINI_API_KEY": "YOUR_GEMINI_API_KEY",
"CLAUDE_MEM_GEMINI_MODEL": "gemini-2.5-flash-lite",
"CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED": true
}
EOF
Get your free API key: https://aistudio.google.com/apikey
OpenRouter provides access to many models, including free options.
mkdir -p ~/.claude-mem
cat > ~/.claude-mem/settings.json << 'EOF'
{
"CLAUDE_MEM_PROVIDER": "openrouter",
"CLAUDE_MEM_OPENROUTER_API_KEY": "YOUR_OPENROUTER_API_KEY"
}
EOF
Get your API key: https://openrouter.ai/keys
Free models available:
google/gemini-2.0-flash-exp:freexiaomi/mimo-v2-flash:freeIf you have Anthropic API credits but not a Claude Code subscription:
mkdir -p ~/.claude-mem
cat > ~/.claude-mem/settings.json << 'EOF'
{
"CLAUDE_MEM_PROVIDER": "claude",
"ANTHROPIC_API_KEY": "YOUR_ANTHROPIC_API_KEY"
}
EOF
# From the claude-mem repo directory (recommended - all projects)
bun run cursor:install -- user
# Or for project-level only:
bun run cursor:install
This installs:
.cursor/hooks/.cursor/hooks.json.cursor/rules/bun run worker:start
The worker runs in the background and handles:
Restart Cursor IDE to load the new hooks
Check installation status:
bun run cursor:status
Verify the worker is running:
curl http://127.0.0.1:37777/api/readiness
Should return: {"status":"ready"}
Open the web viewer: http://localhost:37777
.cursor/rules/Verify your settings file exists and has valid credentials:
cat ~/.claude-mem/settings.json
Check logs:
tail -f ~/.claude-mem/logs/worker-$(date +%Y-%m-%d).log
chmod +x ~/.cursor/hooks/*.sh
If you hit the 1500 requests/day limit:
| Command | Purpose |
|---|---|
bun run cursor:install -- user | Install hooks for all projects (recommended) |
bun run cursor:install | Install hooks for current project only |
bun run cursor:status | Check installation status |
bun run worker:start | Start the background worker |
bun run worker:stop | Stop the background worker |
bun run worker:restart | Restart the worker |
Windows users get full support via PowerShell scripts. The installer automatically detects Windows and installs the appropriate scripts.
PowerShell may require you to enable script execution:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Clone and build
git clone https://github.com/thedotmack/claude-mem.git
cd claude-mem
bun install
bun 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)
bun run cursor:setup
# Or manual installation
bun run cursor:install
bun run worker:start
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.
"Execution of scripts is disabled on this system"
Run as Administrator:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
PowerShell scripts not running
Verify the hooks.json contains PowerShell invocations:
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:
Get-NetTCPConnection -LocalPort 37777
Antivirus blocking scripts
Some antivirus software may block PowerShell scripts. Add an exception for the .cursor\hooks\ directory if needed.