Installation and Setup - robwhite4/claude-memory GitHub Wiki

Installation and Setup

Claude Memory is designed to be incredibly simple to install and set up. Within minutes, you'll have persistent AI memory for your project.

Prerequisites

  • Node.js: Version 14.0.0 or higher
  • npm: Comes with Node.js
  • Git (optional): For version control integration

Quick Start

# Install once globally
npm install -g claude-memory

# Navigate to your project
cd your-project/

# Initialize and forget
cmem init

# That's it! Claude now has persistent memory

What Happens During Installation

1. Global Installation

When you run npm install -g claude-memory, the package is installed globally on your system. This means:

  • The cmem command becomes available everywhere
  • You only need to install once per machine
  • Updates are handled with npm update -g claude-memory

2. Project Initialization

When you run cmem init in your project directory:

your-project/
├── CLAUDE.md          # AI-readable project context (commit this!)
└── .claude/           # Auto-generated memory system
    ├── memory.json    # Full memory database
    ├── config.json    # Your preferences  
    ├── backups/       # Automatic backups
    └── context/       # Full context files
        ├── knowledge.md   # Complete knowledge base
        ├── patterns.md    # All patterns with details
        ├── decisions.md   # Full decision history
        └── tasks.md       # Detailed task information

3. Automatic Configuration

Claude Memory comes with sensible defaults that work for most projects:

{
  "autoSession": true,
  "autoSessionHours": 4,
  "autoBackup": true,
  "backupInterval": 10,
  "tokenOptimization": true,
  "silentMode": false
}

Version Control Setup

Basic Setup

Add to your .gitignore:

# Claude Memory - generated files
.claude/

Advanced Setup (Team Development)

If you want to share context with your team:

# Keep context files, ignore personal data
.claude/sessions/
.claude/backups/
.claude/memory.json
.claude/config.json
!.claude/context/

Environment Variables

You can configure Claude Memory using environment variables:

# Use custom config file
export CLAUDE_MEMORY_CONFIG=~/my-config.json

# Set default flags
export CLAUDE_MEMORY_DEBUG=true
export CLAUDE_MEMORY_FORCE=true

Verification

After installation, verify everything is working:

# Check installation
cmem --version

# View initial stats
cmem stats

# Test a simple command
cmem task add "Setup complete!"

Troubleshooting Installation

Command Not Found

If cmem is not recognized:

# Check npm global bin path
npm bin -g

# Add to PATH if needed (add to .bashrc/.zshrc)
export PATH="$(npm bin -g):$PATH"

Permission Errors

If you encounter permission errors:

# macOS/Linux - use sudo carefully
sudo npm install -g claude-memory

# Better: configure npm to use a different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH

Version Conflicts

If you have an older version:

# Uninstall old version
npm uninstall -g claude-memory

# Clear npm cache
npm cache clean --force

# Install fresh
npm install -g claude-memory

Next Steps


Need help? Check the Troubleshooting guide or report an issue.