Remove claude-mem hooks from Claude Code settings while preserving memory data and compressed transcripts.

Synopsis

claude-mem uninstall [options]

Description

The uninstall command removes claude-mem integration:
  1. Hook Removal - Removes all three hook types from settings
  2. Settings Backup - Creates backup before modification
  3. Data Preservation - Keeps all memories and archives intact
  4. Multiple Locations - Handles both global and project settings
Uninstalling removes integration but preserves compressed transcripts and memory data. Reinstall anytime without losing data.

Options

OptionDescriptionDefault
--allRemove from both global and project settingsfalse
--projectRemove only from project settingsfalse

Examples

Basic Uninstall

Remove from global settings:
claude-mem uninstall
Sample Output:
🔄 Uninstalling claude-mem hooks...

✅ Removed PreCompact hook from User settings
✅ Removed SessionStart hook from User settings
✅ Removed SessionEnd hook from User settings
📋 Created backup: ~/.claude/claude_code_settings.json.backup.1726405815234
✅ Updated User settings: ~/.claude/claude_code_settings.json

✨ Uninstallation complete!
claude-mem hooks removed from settings.

Note: Your compressed transcripts and archives are preserved.
To reinstall: claude-mem install

Project-Only Uninstall

Remove only from current project:
claude-mem uninstall --project
Removes hooks from ./.claude/settings.json while leaving global settings intact.

Complete Uninstall

Remove from all locations:
claude-mem uninstall --all
Sample Output:
🔄 Uninstalling claude-mem hooks...

✅ Removed PreCompact hook from User settings
✅ Removed SessionStart hook from User settings
✅ Removed SessionEnd hook from User settings
📋 Created backup: ~/.claude/claude_code_settings.json.backup.1726405815234
✅ Updated User settings: ~/.claude/claude_code_settings.json

⏭️  No hooks configured in Project settings

✨ Uninstallation complete!
claude-mem hooks removed from settings.

Note: Your compressed transcripts and archives are preserved.
To reinstall: claude-mem install

What Gets Removed

Hook Types

Removes all three hook types:

PreCompact Hooks

Triggered before /compact command:
"PreCompact": [
  {
    "patterns": ["**"],
    "hooks": [
      {
        "command": "~/.claude-mem/hooks/pre-compact.js"
      }
    ]
  }
]

SessionStart Hooks

Triggered at session startup:
"SessionStart": [
  {
    "patterns": ["**"],
    "hooks": [
      {
        "command": "~/.claude-mem/hooks/session-start.js"
      }
    ]
  }
]

SessionEnd Hooks

Triggered at session end:
"SessionEnd": [
  {
    "patterns": ["**"],
    "hooks": [
      {
        "command": "~/.claude-mem/hooks/session-end.js"
      }
    ]
  }
]

Settings Locations

Target different settings files:
TargetFile LocationCommand
Global~/.claude/claude_code_settings.jsonuninstall
Project./.claude/settings.jsonuninstall --project
BothBoth filesuninstall --all

Safety Features

Automatic Backups

Creates timestamped backup before modifying settings:
~/.claude/claude_code_settings.json.backup.1726405815234
./.claude/settings.json.backup.1726405815234
Backup Format:
  • Original filename + .backup. + Unix timestamp
  • Contains exact copy of original settings
  • Can be manually restored if needed

Data Preservation

Uninstalling preserves all your data:
~/.claude-mem/
├── index/              # Chroma database - PRESERVED
├── archives/           # Compressed transcripts - PRESERVED
├── hooks/              # Hook scripts - PRESERVED
├── trash/              # Deleted items - PRESERVED
├── logs/               # Activity logs - PRESERVED
└── settings.json       # Configuration - PRESERVED
Only the hook registrations in Claude Code settings are removed.

Hook Detection

Detects claude-mem hooks by:
  • Exact path matches - Direct hook script paths
  • Filename patterns - Scripts containing pre-compact.js, session-start.js, session-end.js
  • Command patterns - Commands containing claude-mem
Only removes claude-mem hooks, preserving other hooks.

Selective Removal

Filtering Other Hooks

If your settings contain multiple hooks:
{
  "hooks": {
    "PreCompact": [
      {
        "patterns": ["**"],
        "hooks": [
          {
            "command": "~/.claude-mem/hooks/pre-compact.js"
          },
          {
            "command": "/path/to/other-hook.js"
          }
        ]
      }
    ]
  }
}
After uninstall:
{
  "hooks": {
    "PreCompact": [
      {
        "patterns": ["**"],
        "hooks": [
          {
            "command": "/path/to/other-hook.js"
          }
        ]
      }
    ]
  }
}
Only claude-mem hooks are removed; other hooks remain.

Clean-up Behavior

Performs thorough cleanup:
  1. Remove claude-mem hooks from hook arrays
  2. Remove empty arrays if no hooks remain
  3. Remove empty hook types if all arrays are empty
  4. Remove hooks section if no hook types remain

Status Messages

Success Cases

Hooks Found and Removed

✅ Removed PreCompact hook from User settings
✅ Removed SessionStart hook from User settings
✅ Removed SessionEnd hook from User settings

No Hooks Found

ℹ️  No Claude Memory System hooks found in User settings

Settings File Missing

⏭️  No settings found at User location

Error Cases

Permission Issues

⚠️  Could not process User settings: Permission denied

Corrupted Settings

⚠️  Could not process User settings: Invalid JSON

Post-Uninstall

Immediate Effects

After uninstalling:
  1. New sessions won’t load claude-mem context automatically
  2. /compact command won’t trigger memory compression
  3. Session end won’t save context automatically
  4. Claude Code functions normally without claude-mem features

Data Access

Data remains accessible:
# View preserved memories
claude-mem load-context

# Check system status
claude-mem status

# View logs
claude-mem logs

# Restore files
claude-mem restore

Reinstallation

Reinstall at any time:
# Quick reinstall
claude-mem install

# Force reinstall over existing
claude-mem install --force
All preserved data immediately available.

Troubleshooting

Permission Denied

If uninstall fails due to permissions:
# Check file permissions
ls -la ~/.claude/claude_code_settings.json

# Fix permissions if needed
chmod 644 ~/.claude/claude_code_settings.json

# Retry uninstall
claude-mem uninstall

Backup Restoration

To restore a backup manually:
# Find backup files
ls ~/.claude/*.backup.*

# Restore specific backup
cp ~/.claude/claude_code_settings.json.backup.1726405815234 \
   ~/.claude/claude_code_settings.json

Incomplete Uninstall

If some hooks remain:
# Check current status
claude-mem status

# Force complete removal
claude-mem uninstall --all

# Manual cleanup if needed
# Edit settings files directly

Settings Corruption

If settings become corrupted:
# Restore from backup
cp ~/.claude/claude_code_settings.json.backup.1726405815234 \
   ~/.claude/claude_code_settings.json

# Or reinstall clean
mv ~/.claude/claude_code_settings.json \
   ~/.claude/claude_code_settings.json.old
claude-mem install

Verification

Confirm Uninstall

Verify removal after uninstalling:
# Check system status
claude-mem status

# Should show: "❌ Claude Memory System is not installed"

Test Claude Code

  1. Restart Claude Code completely
  2. Start new session - No automatic context loading
  3. Try /compact - Should work but no memory compression
  4. Check session end - No automatic context saving

See Also