@joseairosa/recall 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/REGISTRY.md +182 -0
- package/.claude/globals.md +168 -0
- package/.claude/settings.local.json +15 -1
- package/.claude/todo.json +7 -0
- package/CHANGELOG.md +24 -0
- package/CLAUDE.md +7 -7
- package/MEMORY_RELATIONSHIPS.md +1 -1
- package/QUICKSTART.md +151 -1
- package/README.md +137 -53
- package/WORKSPACE_MODES.md +1 -1
- package/dist/index.js +762 -298
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/tests/README.md +61 -33
- package/tests/test-relationships-vr.ts +122 -0
- package/tests/test-relationships.js +3 -3
- package/tests/test-runtime.js +16 -10
- package/tests/test-time-window-vr.ts +343 -0
- package/tests/test-time-window.js +1 -1
- package/tests/test-v1.5.0-simple.sh +17 -31
- package/tests/test-v1.5.0.js +6 -6
- package/tests/test-vr-v1.7.0.ts +510 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Agent Registry - Recall MCP Server
|
|
2
|
+
|
|
3
|
+
This registry defines specialized agents for the Recall project. The Coordinator should route tasks to appropriate agents based on their specialization.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Available Agents
|
|
8
|
+
|
|
9
|
+
### 1. Code Agent (`code`)
|
|
10
|
+
|
|
11
|
+
**Specialization**: TypeScript implementation, MCP tools, Redis operations
|
|
12
|
+
|
|
13
|
+
**Use When**:
|
|
14
|
+
- Implementing new tools or resources
|
|
15
|
+
- Modifying memory-store.ts logic
|
|
16
|
+
- Adding new context types or schemas
|
|
17
|
+
- Fixing bugs in core functionality
|
|
18
|
+
|
|
19
|
+
**Key Files**:
|
|
20
|
+
- `src/types.ts` - Schemas
|
|
21
|
+
- `src/redis/memory-store.ts` - Storage
|
|
22
|
+
- `src/tools/*.ts` - Tool implementations
|
|
23
|
+
- `src/index.ts` - Request routing
|
|
24
|
+
|
|
25
|
+
**Guidelines**:
|
|
26
|
+
- Always use Zod schemas for validation
|
|
27
|
+
- Use Redis pipelines for atomic operations
|
|
28
|
+
- Maintain backward compatibility
|
|
29
|
+
- Add comprehensive error handling
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### 2. Test Agent (`test`)
|
|
34
|
+
|
|
35
|
+
**Specialization**: Testing, quality assurance, validation
|
|
36
|
+
|
|
37
|
+
**Use When**:
|
|
38
|
+
- Writing new tests
|
|
39
|
+
- Validating feature implementations
|
|
40
|
+
- Running test suites
|
|
41
|
+
- Debugging test failures
|
|
42
|
+
|
|
43
|
+
**Key Files**:
|
|
44
|
+
- `tests/test-runtime.js` - Runtime tests
|
|
45
|
+
- `tests/test-v1.5.0.js` - Integration tests
|
|
46
|
+
- `tests/test-v1.5.0-simple.sh` - Static checks
|
|
47
|
+
- `tests/README.md` - Test documentation
|
|
48
|
+
|
|
49
|
+
**Guidelines**:
|
|
50
|
+
- Test both success and failure paths
|
|
51
|
+
- Include edge cases
|
|
52
|
+
- Document test requirements
|
|
53
|
+
- Keep tests independent
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### 3. Docs Agent (`docs`)
|
|
58
|
+
|
|
59
|
+
**Specialization**: Documentation, README updates, changelog
|
|
60
|
+
|
|
61
|
+
**Use When**:
|
|
62
|
+
- Updating README.md
|
|
63
|
+
- Writing feature documentation
|
|
64
|
+
- Updating CHANGELOG.md
|
|
65
|
+
- Creating usage examples
|
|
66
|
+
|
|
67
|
+
**Key Files**:
|
|
68
|
+
- `README.md` - Main documentation
|
|
69
|
+
- `CHANGELOG.md` - Version history
|
|
70
|
+
- `CLAUDE.md` - Development guidelines
|
|
71
|
+
- `ai_docs/` - AI-specific docs
|
|
72
|
+
|
|
73
|
+
**Guidelines**:
|
|
74
|
+
- Keep examples practical
|
|
75
|
+
- Update all relevant docs together
|
|
76
|
+
- Maintain consistent formatting
|
|
77
|
+
- Include version numbers
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### 4. Review Agent (`review`)
|
|
82
|
+
|
|
83
|
+
**Specialization**: Code review, architecture validation, quality checks
|
|
84
|
+
|
|
85
|
+
**Use When**:
|
|
86
|
+
- Reviewing PRs
|
|
87
|
+
- Validating architectural decisions
|
|
88
|
+
- Checking for breaking changes
|
|
89
|
+
- Security audits
|
|
90
|
+
|
|
91
|
+
**Guidelines**:
|
|
92
|
+
- Check for backward compatibility
|
|
93
|
+
- Validate error handling
|
|
94
|
+
- Review test coverage
|
|
95
|
+
- Check documentation updates
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 5. Release Agent (`release`)
|
|
100
|
+
|
|
101
|
+
**Specialization**: Version management, npm publishing, releases
|
|
102
|
+
|
|
103
|
+
**Use When**:
|
|
104
|
+
- Preparing a new release
|
|
105
|
+
- Updating version numbers
|
|
106
|
+
- Creating GitHub releases
|
|
107
|
+
- Publishing to npm
|
|
108
|
+
|
|
109
|
+
**Key Files**:
|
|
110
|
+
- `package.json` - Version, metadata
|
|
111
|
+
- `CHANGELOG.md` - Release notes
|
|
112
|
+
- `dist/` - Built output
|
|
113
|
+
|
|
114
|
+
**Guidelines**:
|
|
115
|
+
- Follow semantic versioning
|
|
116
|
+
- Update CHANGELOG.md
|
|
117
|
+
- Test build before release
|
|
118
|
+
- Verify npm package contents
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Routing Guidelines
|
|
123
|
+
|
|
124
|
+
### Simple Tasks (No Agent Needed)
|
|
125
|
+
- Quick fixes with clear solutions
|
|
126
|
+
- Single-file changes
|
|
127
|
+
- Documentation typos
|
|
128
|
+
- Minor refactoring
|
|
129
|
+
|
|
130
|
+
### Code Agent Tasks
|
|
131
|
+
- "Add a new tool for X"
|
|
132
|
+
- "Fix bug in memory storage"
|
|
133
|
+
- "Implement feature Y"
|
|
134
|
+
- "Optimize Redis queries"
|
|
135
|
+
|
|
136
|
+
### Test Agent Tasks
|
|
137
|
+
- "Write tests for X feature"
|
|
138
|
+
- "Why is test Y failing?"
|
|
139
|
+
- "Validate feature implementation"
|
|
140
|
+
- "Add edge case coverage"
|
|
141
|
+
|
|
142
|
+
### Docs Agent Tasks
|
|
143
|
+
- "Update README for new feature"
|
|
144
|
+
- "Document X functionality"
|
|
145
|
+
- "Add usage examples"
|
|
146
|
+
- "Update CHANGELOG"
|
|
147
|
+
|
|
148
|
+
### Review Agent Tasks
|
|
149
|
+
- "Review this implementation"
|
|
150
|
+
- "Check for breaking changes"
|
|
151
|
+
- "Validate architecture decision"
|
|
152
|
+
- "Security review"
|
|
153
|
+
|
|
154
|
+
### Release Agent Tasks
|
|
155
|
+
- "Prepare v1.7.0 release"
|
|
156
|
+
- "Publish to npm"
|
|
157
|
+
- "Create GitHub release"
|
|
158
|
+
- "Update version numbers"
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Agent Invocation
|
|
163
|
+
|
|
164
|
+
The Coordinator should:
|
|
165
|
+
|
|
166
|
+
1. **Analyze the task** to determine complexity and scope
|
|
167
|
+
2. **Select appropriate agent** based on specialization
|
|
168
|
+
3. **Provide context** from globals.md and relevant files
|
|
169
|
+
4. **Track progress** in todo.json
|
|
170
|
+
5. **Validate output** before completion
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Creating New Agents
|
|
175
|
+
|
|
176
|
+
When adding new agents:
|
|
177
|
+
|
|
178
|
+
1. Define clear specialization
|
|
179
|
+
2. List key files and responsibilities
|
|
180
|
+
3. Provide specific guidelines
|
|
181
|
+
4. Add routing examples
|
|
182
|
+
5. Update this registry
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Global Configuration - Recall MCP Server
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
**Recall** is an MCP (Model Context Protocol) server providing persistent memory for Claude conversations. It stores context in Redis with semantic search capabilities, solving context window limitations.
|
|
6
|
+
|
|
7
|
+
**Version**: 1.6.0
|
|
8
|
+
**Author**: José Airosa
|
|
9
|
+
**License**: MIT
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Tech Stack
|
|
14
|
+
|
|
15
|
+
- **Runtime**: Node.js 18+
|
|
16
|
+
- **Language**: TypeScript (strict mode)
|
|
17
|
+
- **Build**: tsup
|
|
18
|
+
- **Database**: Redis (ioredis)
|
|
19
|
+
- **AI**: Anthropic Claude API (for embeddings/analysis)
|
|
20
|
+
- **Protocol**: Model Context Protocol (MCP)
|
|
21
|
+
- **IDs**: ULID (not auto-increment)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Key Architecture
|
|
26
|
+
|
|
27
|
+
### Core Components
|
|
28
|
+
|
|
29
|
+
| Component | Location | Purpose |
|
|
30
|
+
|-----------|----------|---------|
|
|
31
|
+
| Entry Point | `src/index.ts` | MCP server setup, request routing |
|
|
32
|
+
| Types | `src/types.ts` | Zod schemas, TypeScript types |
|
|
33
|
+
| Memory Store | `src/redis/memory-store.ts` | Redis storage logic |
|
|
34
|
+
| Redis Client | `src/redis/client.ts` | Connection management |
|
|
35
|
+
| Embeddings | `src/embeddings/generator.ts` | Claude-based embeddings |
|
|
36
|
+
| Analyzer | `src/analysis/conversation-analyzer.ts` | AI conversation analysis |
|
|
37
|
+
|
|
38
|
+
### Tool Modules
|
|
39
|
+
|
|
40
|
+
| Module | Purpose |
|
|
41
|
+
|--------|---------|
|
|
42
|
+
| `tools/index.ts` | Core memory operations |
|
|
43
|
+
| `tools/context-tools.ts` | Smart context (recall, analyze, summarize) |
|
|
44
|
+
| `tools/export-import-tools.ts` | Backup/restore, duplicates |
|
|
45
|
+
| `tools/relationship-tools.ts` | Knowledge graphs (v1.4) |
|
|
46
|
+
| `tools/version-tools.ts` | Version history (v1.5) |
|
|
47
|
+
| `tools/template-tools.ts` | Memory templates (v1.5) |
|
|
48
|
+
| `tools/category-tools.ts` | Categories (v1.5) |
|
|
49
|
+
|
|
50
|
+
### Resources
|
|
51
|
+
|
|
52
|
+
| Module | Purpose |
|
|
53
|
+
|--------|---------|
|
|
54
|
+
| `resources/index.ts` | MCP resource handlers |
|
|
55
|
+
| `resources/analytics.ts` | Usage analytics |
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Critical Constraints
|
|
60
|
+
|
|
61
|
+
### NEVER Change Without Migration
|
|
62
|
+
|
|
63
|
+
1. **Redis Key Patterns**:
|
|
64
|
+
- `memory:{id}` → Hash
|
|
65
|
+
- `memories:all` → Set
|
|
66
|
+
- `memories:timeline` → Sorted Set
|
|
67
|
+
- `memories:type:{type}` → Set
|
|
68
|
+
- `memories:tag:{tag}` → Set
|
|
69
|
+
- `memories:important` → Sorted Set
|
|
70
|
+
|
|
71
|
+
2. **Context Types** (10 core types):
|
|
72
|
+
- `directive`, `information`, `heading`, `decision`, `code_pattern`
|
|
73
|
+
- `requirement`, `error`, `todo`, `insight`, `preference`
|
|
74
|
+
|
|
75
|
+
3. **Importance Threshold**: >= 8 for `memories:important` index
|
|
76
|
+
|
|
77
|
+
4. **ULID Generation**: Memory IDs must remain accessible forever
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Code Conventions
|
|
82
|
+
|
|
83
|
+
### Naming
|
|
84
|
+
- **Files**: kebab-case (`memory-store.ts`)
|
|
85
|
+
- **Variables/Functions**: camelCase
|
|
86
|
+
- **Types/Classes**: PascalCase
|
|
87
|
+
- **Constants**: SCREAMING_SNAKE_CASE
|
|
88
|
+
|
|
89
|
+
### Imports
|
|
90
|
+
- Use `.js` extensions (ESM requirement)
|
|
91
|
+
- Group: stdlib → vendor → local
|
|
92
|
+
|
|
93
|
+
### Error Handling
|
|
94
|
+
- Use MCP error codes: `ErrorCode.InvalidRequest`, `ErrorCode.InternalError`
|
|
95
|
+
- Always include descriptive messages
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Testing
|
|
100
|
+
|
|
101
|
+
### Quick Commands
|
|
102
|
+
```bash
|
|
103
|
+
# Build
|
|
104
|
+
npm run build
|
|
105
|
+
|
|
106
|
+
# Static checks
|
|
107
|
+
./tests/test-v1.5.0-simple.sh
|
|
108
|
+
|
|
109
|
+
# Runtime tests (requires Redis)
|
|
110
|
+
ANTHROPIC_API_KEY="test-key" node tests/test-runtime.js
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Before Committing
|
|
114
|
+
- [ ] TypeScript compiles
|
|
115
|
+
- [ ] Bundle size reasonable
|
|
116
|
+
- [ ] All tools work
|
|
117
|
+
- [ ] Indexes update correctly
|
|
118
|
+
- [ ] Documentation updated
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Environment Variables
|
|
123
|
+
|
|
124
|
+
| Variable | Required | Default | Purpose |
|
|
125
|
+
|----------|----------|---------|---------|
|
|
126
|
+
| `REDIS_URL` | No | `redis://localhost:6379` | Redis connection |
|
|
127
|
+
| `ANTHROPIC_API_KEY` | Yes | - | Claude API for embeddings |
|
|
128
|
+
| `WORKSPACE_MODE` | No | `isolated` | Memory isolation mode |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Workspace Modes
|
|
133
|
+
|
|
134
|
+
- **isolated** (default): Workspace-only memories
|
|
135
|
+
- **global**: All memories shared globally
|
|
136
|
+
- **hybrid**: Both workspace-specific AND global memories
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Performance Targets
|
|
141
|
+
|
|
142
|
+
- Store Memory: ~200ms
|
|
143
|
+
- Batch Store (10): ~500ms
|
|
144
|
+
- Get by ID: <1ms
|
|
145
|
+
- Recent (50): ~10ms
|
|
146
|
+
- Semantic Search (1k): ~500ms
|
|
147
|
+
- Semantic Search (10k): ~2s
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Security Reminders
|
|
152
|
+
|
|
153
|
+
- Redis should be secured (AUTH, TLS)
|
|
154
|
+
- Never store secrets in memories
|
|
155
|
+
- Audit stored data regularly
|
|
156
|
+
- Use `rediss://` for remote connections
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Coordinator Role
|
|
161
|
+
|
|
162
|
+
When working as the Coordinator on this project:
|
|
163
|
+
|
|
164
|
+
1. **Route to Specialists**: Use agents in `.claude/agents/` for specialized tasks
|
|
165
|
+
2. **Track Progress**: Keep `.claude/todo.json` updated
|
|
166
|
+
3. **Maintain Quality**: Ensure tests pass before commits
|
|
167
|
+
4. **Preserve Compatibility**: Never break existing memories
|
|
168
|
+
5. **Document Changes**: Update CHANGELOG.md and README.md
|
|
@@ -2,7 +2,21 @@
|
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
4
|
"Bash(gh pr merge:*)",
|
|
5
|
-
"Bash(npm publish:*)"
|
|
5
|
+
"Bash(npm publish:*)",
|
|
6
|
+
"Bash(gh release create:*)",
|
|
7
|
+
"Bash(gh pr view:*)",
|
|
8
|
+
"Bash(gh pr diff:*)",
|
|
9
|
+
"Bash(npm run build:*)",
|
|
10
|
+
"Bash(git add:*)",
|
|
11
|
+
"Bash(git commit -m \"$(cat <<''EOF''\nfix: Clean up PR - remove dist/, fix unused imports, improve docs\n\n- Remove dist/ from git tracking (added to .gitignore)\n- Remove unused imports in memory-store.ts (Redis, log, unused providers)\n- Fix storage-client.interface.ts - remove unused import, improve typing\n- Fix CHANGELOG.md - proper markdown formatting and expanded release notes\n- Fix README.md - properly close code blocks, fix markdown structure\n- Fix QUICKSTART.md - replace hardcoded paths with placeholders, fix JSON\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nEOF\n)\")",
|
|
12
|
+
"Bash(git push:*)",
|
|
13
|
+
"Bash(cat:*)",
|
|
14
|
+
"Bash(git checkout:*)",
|
|
15
|
+
"Bash(git pull:*)",
|
|
16
|
+
"Bash(git merge valkey-support --no-ff -m \"$(cat <<''EOF''\nfeat: v1.7.0 - Valkey Support (#10)\n\nAdd Valkey as an alternative backend to Redis with a clean storage abstraction layer.\n\n## Added\n- Valkey support via @valkey/valkey-glide client\n- BACKEND_TYPE env var to select backend (redis/valkey)\n- VALKEY_HOST and VALKEY_PORT configuration options\n- StorageClient interface for backend-agnostic operations\n- RedisAdapter and ValkeyAdapter implementations\n- Factory pattern for backend selection\n\n## Changed\n- Moved persistence code to src/persistence/ directory\n- Ported JavaScript tests to TypeScript\n\n## Fixed\n- Removed dist/ from git tracking\n- Cleaned up unused imports\n- Fixed markdown formatting in docs\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>\nCo-Authored-By: Matthias Howell <matthias.howell@yoppworks.com>\nEOF\n)\")",
|
|
17
|
+
"Bash(git reset:*)",
|
|
18
|
+
"Bash(git rm:*)",
|
|
19
|
+
"Bash(gh pr create:*)"
|
|
6
20
|
],
|
|
7
21
|
"deny": [],
|
|
8
22
|
"ask": []
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [1.7.0] - 2025-12-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Valkey Support** - Now supports Valkey as an alternative backend to Redis
|
|
15
|
+
- New `BACKEND_TYPE` environment variable to select backend (`redis` or `valkey`)
|
|
16
|
+
- `VALKEY_HOST` and `VALKEY_PORT` configuration options
|
|
17
|
+
- Uses `@valkey/valkey-glide` client for Valkey connections
|
|
18
|
+
- Full feature parity with Redis backend
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **Architecture Refactor** - Introduced storage abstraction layer
|
|
23
|
+
- New `StorageClient` interface for backend-agnostic storage operations
|
|
24
|
+
- `RedisAdapter` and `ValkeyAdapter` implement the common interface
|
|
25
|
+
- Factory pattern (`createStorageClient`) for backend selection
|
|
26
|
+
- Moved persistence code to `src/persistence/` directory
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Ported JavaScript tests to TypeScript for better type safety
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
10
34
|
## [1.6.0] - 2025-10-04
|
|
11
35
|
|
|
12
36
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -6,7 +6,7 @@ Project-specific instructions for Claude when working with this codebase.
|
|
|
6
6
|
|
|
7
7
|
## Project Context
|
|
8
8
|
|
|
9
|
-
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.
|
|
9
|
+
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.
|
|
10
10
|
|
|
11
11
|
**Key Principle**: This server IS the solution to context loss - treat it with care and always maintain backward compatibility.
|
|
12
12
|
|
|
@@ -107,10 +107,10 @@ Use this tool to retrieve consolidated context from specific time periods:
|
|
|
107
107
|
1. **Immutable Memory IDs**: Never change ULID generation - memories must remain accessible
|
|
108
108
|
2. **Backward Compatible**: New context types OK, removing types breaks existing memories
|
|
109
109
|
3. **Index Integrity**: Always update ALL indexes when modifying/deleting memories
|
|
110
|
-
4. **Atomic Operations**: Use Redis pipelines for multi-step updates
|
|
110
|
+
4. **Atomic Operations**: Use Redis/Valkey pipelines for multi-step updates
|
|
111
111
|
5. **Error Handling**: Use MCP error codes (`ErrorCode.InvalidRequest`, `ErrorCode.InternalError`)
|
|
112
112
|
|
|
113
|
-
### Redis Data Model
|
|
113
|
+
### Redis/Valkey Data Model
|
|
114
114
|
|
|
115
115
|
**NEVER** change these key patterns without migration:
|
|
116
116
|
```
|
|
@@ -147,7 +147,7 @@ These 10 types are core to the system:
|
|
|
147
147
|
### Adding a New Tool
|
|
148
148
|
|
|
149
149
|
1. Add Zod schema to [types.ts](src/types.ts)
|
|
150
|
-
2. Add method to `MemoryStore` class in [memory-store.ts](src/
|
|
150
|
+
2. Add method to `MemoryStore` class in [memory-store.ts](src/persistence/memory-store.ts)
|
|
151
151
|
3. Add tool handler to [tools/index.ts](src/tools/index.ts)
|
|
152
152
|
4. Update documentation in [README.md](README.md)
|
|
153
153
|
|
|
@@ -162,7 +162,7 @@ These 10 types are core to the system:
|
|
|
162
162
|
|
|
163
163
|
**CRITICAL**: If changing `MemoryStore` methods:
|
|
164
164
|
1. Ensure index updates are atomic (use pipelines)
|
|
165
|
-
2. Test with existing Redis data
|
|
165
|
+
2. Test with existing Redis/Valkey data
|
|
166
166
|
3. Document migration path if needed
|
|
167
167
|
4. Update version in [package.json](package.json)
|
|
168
168
|
|
|
@@ -234,7 +234,7 @@ export const ContextType = z.enum([
|
|
|
234
234
|
### Increase Embedding Dimensions
|
|
235
235
|
|
|
236
236
|
If switching to larger embedding model:
|
|
237
|
-
1. Update `embedding` field handling in [memory-store.ts](src/
|
|
237
|
+
1. Update `embedding` field handling in [memory-store.ts](src/persistence/memory-store.ts)
|
|
238
238
|
2. Existing memories will have wrong dimensions - need migration
|
|
239
239
|
3. Consider versioning: `embedding_v1`, `embedding_v2`
|
|
240
240
|
|
|
@@ -244,7 +244,7 @@ If switching to larger embedding model:
|
|
|
244
244
|
|
|
245
245
|
**Current**: No formal migration system
|
|
246
246
|
|
|
247
|
-
**If Redis Schema Changes**:
|
|
247
|
+
**If Redis/Valkey Schema Changes**:
|
|
248
248
|
1. Create migration script in `scripts/migrate-{version}.ts`
|
|
249
249
|
2. Document in `MIGRATIONS.md`
|
|
250
250
|
3. Provide rollback instructions
|
package/MEMORY_RELATIONSHIPS.md
CHANGED
package/QUICKSTART.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Setup (5 minutes)
|
|
4
4
|
|
|
5
|
+
## Redis Version (See Valkey Below)
|
|
6
|
+
|
|
5
7
|
### 1. Start Redis
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -35,7 +37,7 @@ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
|
35
37
|
"mcpServers": {
|
|
36
38
|
"memory": {
|
|
37
39
|
"command": "node",
|
|
38
|
-
"args": ["/
|
|
40
|
+
"args": ["/path/to/recall/dist/index.js"],
|
|
39
41
|
"env": {
|
|
40
42
|
"REDIS_URL": "redis://localhost:6379",
|
|
41
43
|
"OPENAI_API_KEY": "sk-your-openai-key"
|
|
@@ -147,3 +149,151 @@ Make sure your API key is set in the Claude Desktop config, not just in `.env`.
|
|
|
147
149
|
---
|
|
148
150
|
|
|
149
151
|
**Ready to use!** Your Claude now has a persistent memory brain.
|
|
152
|
+
|
|
153
|
+
### 1. Start Valkey
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
# macOS
|
|
157
|
+
brew services start valkey
|
|
158
|
+
|
|
159
|
+
# Verify Valkey is running - if installed with brew
|
|
160
|
+
valkey-cli ping # Should return PONG
|
|
161
|
+
|
|
162
|
+
# Or Docker
|
|
163
|
+
docker run -d -p 6379:6379 valkey/valkey:latest
|
|
164
|
+
|
|
165
|
+
# use docker to ping Valkey server
|
|
166
|
+
docker exec -it [valkey container name] valkey-cli ping
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 2. Set Environment Variables
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Copy example env file
|
|
173
|
+
cp .env.example .env
|
|
174
|
+
|
|
175
|
+
# Edit .env and add your Valkey values
|
|
176
|
+
# BACKEND_TYPE='valkey'
|
|
177
|
+
# VALKEY_HOST = 'localhost'
|
|
178
|
+
# VALKEY_PORT = '6379'
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 3. Configure Claude Desktop
|
|
183
|
+
|
|
184
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"mcpServers": {
|
|
189
|
+
"memory": {
|
|
190
|
+
"command": "node",
|
|
191
|
+
"args": ["/path/to/recall/dist/index.js"],
|
|
192
|
+
"env": {
|
|
193
|
+
"BACKEND_TYPE": "valkey",
|
|
194
|
+
"VALKEY_HOST": "localhost",
|
|
195
|
+
"VALKEY_PORT": "6379"
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 4. Restart Claude Desktop
|
|
203
|
+
|
|
204
|
+
Completely quit and reopen Claude Desktop to load the MCP server.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## First Test
|
|
209
|
+
|
|
210
|
+
Ask Claude:
|
|
211
|
+
|
|
212
|
+
> "Store a memory that I prefer informal communication. Make it importance 8 and tag it with 'preference' and 'communication'"
|
|
213
|
+
|
|
214
|
+
Claude should use the `store_memory` tool and return a success message with a memory ID.
|
|
215
|
+
|
|
216
|
+
Then ask:
|
|
217
|
+
|
|
218
|
+
> "Search for memories about communication preferences"
|
|
219
|
+
|
|
220
|
+
Claude should use the `search_memories` tool and find your stored memory.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Common Usage Patterns
|
|
225
|
+
|
|
226
|
+
### Store Important Directive
|
|
227
|
+
|
|
228
|
+
> "Remember: Always use ULIDs for database IDs, never auto-increment. This is critical (importance 10)"
|
|
229
|
+
|
|
230
|
+
### Store Code Pattern
|
|
231
|
+
|
|
232
|
+
> "Store a code pattern: In this project, use Drizzle ORM with text('id').primaryKey() for ULID fields. Tag it with 'drizzle', 'database', and 'patterns'"
|
|
233
|
+
|
|
234
|
+
### Search Previous Context
|
|
235
|
+
|
|
236
|
+
> "What do you remember about database conventions?"
|
|
237
|
+
|
|
238
|
+
### Get Recent Context
|
|
239
|
+
|
|
240
|
+
> "Show me the last 10 memories we've stored"
|
|
241
|
+
|
|
242
|
+
### Create Session Snapshot
|
|
243
|
+
|
|
244
|
+
> "Create a session called 'Feature X Development - Day 1' with the last 5 memories"
|
|
245
|
+
|
|
246
|
+
### Retrieve Session
|
|
247
|
+
|
|
248
|
+
> "Show me memories from the 'Feature X Development - Day 1' session"
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Verification
|
|
253
|
+
|
|
254
|
+
Check if server is running:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# Check Claude Desktop logs
|
|
258
|
+
tail -f ~/Library/Logs/Claude/mcp*.log
|
|
259
|
+
|
|
260
|
+
# Should see:
|
|
261
|
+
# Valkey Client Connected
|
|
262
|
+
# Valkey Client Ready
|
|
263
|
+
# MCP Memory Server started successfully
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Troubleshooting
|
|
269
|
+
|
|
270
|
+
### "Failed to connect to Redis"
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# Check Redis is running
|
|
274
|
+
valkey-cli ping
|
|
275
|
+
|
|
276
|
+
# Start Redis if not running
|
|
277
|
+
brew services start valkey
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Server not appearing in Claude
|
|
281
|
+
|
|
282
|
+
1. Check config file syntax (valid JSON)
|
|
283
|
+
2. Verify absolute path to `dist/index.js`
|
|
284
|
+
3. Completely quit and restart Claude Desktop
|
|
285
|
+
4. Check logs: `~/Library/Logs/Claude/`
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Next Steps
|
|
290
|
+
|
|
291
|
+
- Store project-specific conventions and directives
|
|
292
|
+
- Create sessions at the end of each work day
|
|
293
|
+
- Use semantic search to find relevant past context
|
|
294
|
+
- Tag memories for easy retrieval
|
|
295
|
+
- Mark critical information with high importance scores
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
**Ready to use!** Your Claude now has a persistent memory brain.
|