Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ view-memories.js
# Local config
.claude/
.mcp.json

#test build files
tests/test_dist/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

---

##[1.7.0] - 2025-11-20

### Added
- **Added Valkey support** - now supports Valkey as alternative memory store


## [1.6.0] - 2025-10-04

### Added
Expand Down
14 changes: 7 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Project-specific instructions for Claude when working with this codebase.

## Project Context

This is an MCP (Model Context Protocol) server that provides **long-term memory** for Claude conversations. It stores context in Redis with semantic search capabilities to survive context window limitations.
This is an MCP (Model Context Protocol) server that provides **long-term memory** for Claude conversations. It stores context in Redis or Valkey with semantic search capabilities to survive context window limitations.

**Key Principle**: This server IS the solution to context loss - treat it with care and always maintain backward compatibility.

Expand Down Expand Up @@ -107,10 +107,10 @@ Use this tool to retrieve consolidated context from specific time periods:
1. **Immutable Memory IDs**: Never change ULID generation - memories must remain accessible
2. **Backward Compatible**: New context types OK, removing types breaks existing memories
3. **Index Integrity**: Always update ALL indexes when modifying/deleting memories
4. **Atomic Operations**: Use Redis pipelines for multi-step updates
4. **Atomic Operations**: Use Redis/Valkey pipelines for multi-step updates
5. **Error Handling**: Use MCP error codes (`ErrorCode.InvalidRequest`, `ErrorCode.InternalError`)

### Redis Data Model
### Redis/Valkey Data Model

**NEVER** change these key patterns without migration:
```
Expand Down Expand Up @@ -147,7 +147,7 @@ These 10 types are core to the system:
### Adding a New Tool

1. Add Zod schema to [types.ts](src/types.ts)
2. Add method to `MemoryStore` class in [memory-store.ts](src/redis/memory-store.ts)
2. Add method to `MemoryStore` class in [memory-store.ts](src/persistence/memory-store.ts)
3. Add tool handler to [tools/index.ts](src/tools/index.ts)
4. Update documentation in [README.md](README.md)

Expand All @@ -162,7 +162,7 @@ These 10 types are core to the system:

**CRITICAL**: If changing `MemoryStore` methods:
1. Ensure index updates are atomic (use pipelines)
2. Test with existing Redis data
2. Test with existing Redis/Valkey data
3. Document migration path if needed
4. Update version in [package.json](package.json)

Expand Down Expand Up @@ -234,7 +234,7 @@ export const ContextType = z.enum([
### Increase Embedding Dimensions

If switching to larger embedding model:
1. Update `embedding` field handling in [memory-store.ts](src/redis/memory-store.ts)
1. Update `embedding` field handling in [memory-store.ts](src/persistence/memory-store.ts)
2. Existing memories will have wrong dimensions - need migration
3. Consider versioning: `embedding_v1`, `embedding_v2`

Expand All @@ -244,7 +244,7 @@ If switching to larger embedding model:

**Current**: No formal migration system

**If Redis Schema Changes**:
**If Redis/Valkey Schema Changes**:
1. Create migration script in `scripts/migrate-{version}.ts`
2. Document in `MIGRATIONS.md`
3. Provide rollback instructions
Expand Down
2 changes: 1 addition & 1 deletion MEMORY_RELATIONSHIPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Claude: [Uses get_related_memories with filter 'supersedes']

### Storage

**Redis Keys:**
**Redis/Valkey Keys:**
```
# Workspace relationships
ws:{workspace_id}:relationship:{id}
Expand Down
150 changes: 150 additions & 0 deletions QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Setup (5 minutes)

## Redis Version (See Valkey Below)

### 1. Start Redis

```bash
Expand Down Expand Up @@ -147,3 +149,151 @@ Make sure your API key is set in the Claude Desktop config, not just in `.env`.
---

**Ready to use!** Your Claude now has a persistent memory brain.

### 1. Start Valkey

```bash
# macOS
brew services start valkey

# Verify Valkey is running - if installed with brew
valkey-cli ping # Should return PONG

# Or Docker
docker run -d -p 6379:6379 valkey/valkey:latest

# use docker to ping Valkey server
Comment thread
MatthiasHowellYopp marked this conversation as resolved.
docker exec -it [valkey container name] valkey-cli ping
```

### 2. Set Environment Variables

```bash
# Copy example env file
cp .env.example .env

# Edit .env and add your Valkey values
# BACKEND_TYPE='valkey'
# VALKEY_HOST = 'localhost'
# VALKEY_PORT = '6379'

```

### 3. Configure Claude Desktop

Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:

```json
{
"mcpServers": {
"memory": {
"command": "node",
"args": ["/Users/joseairosa/Development/mcp/mem/dist/index.js"],
"env": {
"BACKEND_TYPE": "valkey",
"VALKEY_HOST": "localhost",
"VALKEY_PORT": "6379",
}
}
}
}
```

### 4. Restart Claude Desktop

Completely quit and reopen Claude Desktop to load the MCP server.

---

## First Test

Ask Claude:

> "Store a memory that I prefer informal communication. Make it importance 8 and tag it with 'preference' and 'communication'"

Claude should use the `store_memory` tool and return a success message with a memory ID.

Then ask:

> "Search for memories about communication preferences"

Claude should use the `search_memories` tool and find your stored memory.

---

## Common Usage Patterns

### Store Important Directive

> "Remember: Always use ULIDs for database IDs, never auto-increment. This is critical (importance 10)"

### Store Code Pattern

> "Store a code pattern: In this project, use Drizzle ORM with text('id').primaryKey() for ULID fields. Tag it with 'drizzle', 'database', and 'patterns'"

### Search Previous Context

> "What do you remember about database conventions?"

### Get Recent Context

> "Show me the last 10 memories we've stored"

### Create Session Snapshot

> "Create a session called 'Feature X Development - Day 1' with the last 5 memories"

### Retrieve Session

> "Show me memories from the 'Feature X Development - Day 1' session"

---

## Verification

Check if server is running:

```bash
# Check Claude Desktop logs
tail -f ~/Library/Logs/Claude/mcp*.log

# Should see:
# Valkey Client Connected
# Valkey Client Ready
# MCP Memory Server started successfully
```

---

## Troubleshooting

### "Failed to connect to Redis"

```bash
# Check Redis is running
valkey-cli ping

# Start Redis if not running
brew services start valkey
```

### Server not appearing in Claude

1. Check config file syntax (valid JSON)
2. Verify absolute path to `dist/index.js`
3. Completely quit and restart Claude Desktop
4. Check logs: `~/Library/Logs/Claude/`

---

## Next Steps

- Store project-specific conventions and directives
- Create sessions at the end of each work day
- Use semantic search to find relevant past context
- Tag memories for easy retrieval
- Mark critical information with high importance scores

---

**Ready to use!** Your Claude now has a persistent memory brain.
Loading