@joseairosa/recall 1.5.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 +12 -15
- package/.claude/todo.json +7 -0
- package/CHANGELOG.md +58 -0
- package/CLAUDE.md +88 -7
- package/MEMORY_RELATIONSHIPS.md +1 -1
- package/QUICKSTART.md +151 -1
- package/README.md +224 -54
- package/WORKSPACE_MODES.md +1 -1
- package/dist/index.js +971 -294
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/tests/README.md +516 -0
- package/tests/TEST-RESULTS-v1.5.0.md +179 -0
- package/tests/test-relationships-vr.ts +122 -0
- package/{test-relationships.js → tests/test-relationships.js} +3 -3
- package/tests/test-runtime.js +238 -0
- package/tests/test-time-window-vr.ts +343 -0
- package/tests/test-time-window.js +333 -0
- package/tests/test-v1.5.0-manual.md +311 -0
- package/tests/test-v1.5.0-simple.sh +194 -0
- package/tests/test-v1.5.0.js +547 -0
- 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
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"Bash(
|
|
5
|
-
"Bash(
|
|
4
|
+
"Bash(gh pr merge:*)",
|
|
5
|
+
"Bash(npm publish:*)",
|
|
6
|
+
"Bash(gh release create:*)",
|
|
7
|
+
"Bash(gh pr view:*)",
|
|
8
|
+
"Bash(gh pr diff:*)",
|
|
9
|
+
"Bash(npm run build:*)",
|
|
6
10
|
"Bash(git add:*)",
|
|
7
|
-
"Bash(git commit
|
|
8
|
-
"Bash(git remote 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)\")",
|
|
9
12
|
"Bash(git push:*)",
|
|
10
|
-
"Bash(npm view:*)",
|
|
11
|
-
"Bash(npm whoami:*)",
|
|
12
|
-
"Bash(curl:*)",
|
|
13
|
-
"Bash(npm run build:*)",
|
|
14
|
-
"Bash(npm publish:*)",
|
|
15
|
-
"Bash(gh pr create:*)",
|
|
16
|
-
"Bash(gh repo edit:*)",
|
|
17
13
|
"Bash(cat:*)",
|
|
18
14
|
"Bash(git checkout:*)",
|
|
19
15
|
"Bash(git pull:*)",
|
|
20
|
-
"Bash(
|
|
21
|
-
"
|
|
22
|
-
"Bash(
|
|
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:*)"
|
|
23
20
|
],
|
|
24
21
|
"deny": [],
|
|
25
22
|
"ask": []
|
|
@@ -27,4 +24,4 @@
|
|
|
27
24
|
"enabledMcpjsonServers": [
|
|
28
25
|
"memory"
|
|
29
26
|
]
|
|
30
|
-
}
|
|
27
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,64 @@ 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
|
+
|
|
34
|
+
## [1.6.0] - 2025-10-04
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **Time Window Context Retrieval** - Get all memories from specific time periods
|
|
38
|
+
- `get_time_window_context` tool for time-based memory retrieval
|
|
39
|
+
- Multiple time specifications: hours, minutes, or explicit timestamp ranges
|
|
40
|
+
- Three output formats: Markdown (default), JSON, and plain text
|
|
41
|
+
- Four grouping options: chronological, by type, by importance, or by tags
|
|
42
|
+
- Filtering by minimum importance and context types
|
|
43
|
+
- Perfect for building context files from work sessions
|
|
44
|
+
- Respects workspace modes (isolated/global/hybrid)
|
|
45
|
+
|
|
46
|
+
- **Best Practices Documentation** - Context bloat prevention
|
|
47
|
+
- Added guidelines for selective memory storage
|
|
48
|
+
- Clear examples of what to store vs. avoid
|
|
49
|
+
- Added to both README.md and CLAUDE.md
|
|
50
|
+
- Helps users avoid indiscriminate memory storage
|
|
51
|
+
|
|
52
|
+
### Technical
|
|
53
|
+
- New `GetTimeWindowContextSchema` in types.ts
|
|
54
|
+
- New `getMemoriesByTimeWindow()` method in MemoryStore
|
|
55
|
+
- Helper functions for formatting output (JSON, Markdown, Text)
|
|
56
|
+
- Uses Redis `ZRANGEBYSCORE` for efficient time-range queries
|
|
57
|
+
|
|
58
|
+
### Testing
|
|
59
|
+
- New `test-time-window.js` test suite with 8 tests
|
|
60
|
+
- All tests passing
|
|
61
|
+
- Test coverage for time-based retrieval, filtering, grouping
|
|
62
|
+
|
|
63
|
+
### Tool Count
|
|
64
|
+
- **28 tools** (was 27 in v1.5.0)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
10
68
|
## [1.5.0] - 2025-10-03
|
|
11
69
|
|
|
12
70
|
### Added
|
package/CLAUDE.md
CHANGED
|
@@ -6,12 +6,93 @@ 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
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
+
## Using Recall Efficiently (Context Bloat Prevention)
|
|
16
|
+
|
|
17
|
+
**IMPORTANT: Be selective with memory storage to avoid context bloat.**
|
|
18
|
+
|
|
19
|
+
### When to Store Memories
|
|
20
|
+
|
|
21
|
+
Store **HIGH-SIGNAL** context only:
|
|
22
|
+
- ✅ High-level decisions and reasoning ("We chose PostgreSQL over MongoDB because...")
|
|
23
|
+
- ✅ Project preferences (coding style, tech stack, architecture patterns)
|
|
24
|
+
- ✅ Critical constraints (API limits, business rules, security requirements)
|
|
25
|
+
- ✅ Learned patterns from bugs/solutions ("Avoid X because it causes Y")
|
|
26
|
+
|
|
27
|
+
### When NOT to Store
|
|
28
|
+
|
|
29
|
+
Don't store **LOW-SIGNAL** content:
|
|
30
|
+
- ❌ Code snippets or implementations (put those in files)
|
|
31
|
+
- ❌ Obvious facts or general knowledge
|
|
32
|
+
- ❌ Temporary context (only needed in current session)
|
|
33
|
+
- ❌ Duplicates of what's already in documentation
|
|
34
|
+
|
|
35
|
+
### Keep Memories Concise
|
|
36
|
+
|
|
37
|
+
**Examples:**
|
|
38
|
+
- ✅ GOOD: "API rate limit is 1000 req/min, prefer caching for frequently accessed data"
|
|
39
|
+
- ❌ BAD: "Here's the entire implementation of our caching layer: [50 lines of code]"
|
|
40
|
+
|
|
41
|
+
- ✅ GOOD: "Team prefers Tailwind CSS over styled-components for consistency"
|
|
42
|
+
- ❌ BAD: "Tailwind is a utility-first CSS framework that..."
|
|
43
|
+
|
|
44
|
+
**Remember:** Recall is for high-level context, not a code repository. Quality over quantity.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Time Window Context Retrieval (v1.6.0+)
|
|
49
|
+
|
|
50
|
+
### When to Use `get_time_window_context`
|
|
51
|
+
|
|
52
|
+
Use this tool to retrieve consolidated context from specific time periods:
|
|
53
|
+
|
|
54
|
+
**Perfect for:**
|
|
55
|
+
- 📋 Building context files from work sessions ("Give me everything from the last 2 hours as markdown")
|
|
56
|
+
- 🔄 Session handoffs ("Show me what we worked on in the last hour")
|
|
57
|
+
- 📊 Progress summaries ("Get all decisions from today")
|
|
58
|
+
- 📝 Documentation ("Export the last 4 hours as a context file")
|
|
59
|
+
|
|
60
|
+
**How to use:**
|
|
61
|
+
```
|
|
62
|
+
"Give me the context for the last 2 hours"
|
|
63
|
+
"Show me all high-importance memories from the last hour, grouped by type"
|
|
64
|
+
"Export the last 30 minutes as JSON"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Output Format Options
|
|
68
|
+
|
|
69
|
+
- **Markdown** (default): Clean formatted context ready to paste
|
|
70
|
+
- **JSON**: Structured data for processing
|
|
71
|
+
- **Text**: Simple plain text summary
|
|
72
|
+
|
|
73
|
+
### Grouping Options
|
|
74
|
+
|
|
75
|
+
- **Chronological**: Time-ordered (default, oldest to newest)
|
|
76
|
+
- **By type**: Grouped by context_type (decisions, patterns, etc.)
|
|
77
|
+
- **By importance**: High to low priority
|
|
78
|
+
- **By tags**: Organized by tag categories
|
|
79
|
+
|
|
80
|
+
### Best Practices
|
|
81
|
+
|
|
82
|
+
**DO:**
|
|
83
|
+
- ✅ Use for building context files after work sessions
|
|
84
|
+
- ✅ Filter by importance (>= 8) for critical context only
|
|
85
|
+
- ✅ Group by type when exporting for specific purposes
|
|
86
|
+
- ✅ Use markdown format for human-readable output
|
|
87
|
+
- ✅ Use JSON format when passing to external tools
|
|
88
|
+
|
|
89
|
+
**DON'T:**
|
|
90
|
+
- ❌ Retrieve huge time windows (>24 hours) without filtering
|
|
91
|
+
- ❌ Use when semantic search would be better (use `search_memories` instead)
|
|
92
|
+
- ❌ Store the output as another memory (creates redundancy)
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
15
96
|
## Development Guidelines
|
|
16
97
|
|
|
17
98
|
### Code Style
|
|
@@ -26,10 +107,10 @@ This is an MCP (Model Context Protocol) server that provides **long-term memory*
|
|
|
26
107
|
1. **Immutable Memory IDs**: Never change ULID generation - memories must remain accessible
|
|
27
108
|
2. **Backward Compatible**: New context types OK, removing types breaks existing memories
|
|
28
109
|
3. **Index Integrity**: Always update ALL indexes when modifying/deleting memories
|
|
29
|
-
4. **Atomic Operations**: Use Redis pipelines for multi-step updates
|
|
110
|
+
4. **Atomic Operations**: Use Redis/Valkey pipelines for multi-step updates
|
|
30
111
|
5. **Error Handling**: Use MCP error codes (`ErrorCode.InvalidRequest`, `ErrorCode.InternalError`)
|
|
31
112
|
|
|
32
|
-
### Redis Data Model
|
|
113
|
+
### Redis/Valkey Data Model
|
|
33
114
|
|
|
34
115
|
**NEVER** change these key patterns without migration:
|
|
35
116
|
```
|
|
@@ -66,7 +147,7 @@ These 10 types are core to the system:
|
|
|
66
147
|
### Adding a New Tool
|
|
67
148
|
|
|
68
149
|
1. Add Zod schema to [types.ts](src/types.ts)
|
|
69
|
-
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)
|
|
70
151
|
3. Add tool handler to [tools/index.ts](src/tools/index.ts)
|
|
71
152
|
4. Update documentation in [README.md](README.md)
|
|
72
153
|
|
|
@@ -81,7 +162,7 @@ These 10 types are core to the system:
|
|
|
81
162
|
|
|
82
163
|
**CRITICAL**: If changing `MemoryStore` methods:
|
|
83
164
|
1. Ensure index updates are atomic (use pipelines)
|
|
84
|
-
2. Test with existing Redis data
|
|
165
|
+
2. Test with existing Redis/Valkey data
|
|
85
166
|
3. Document migration path if needed
|
|
86
167
|
4. Update version in [package.json](package.json)
|
|
87
168
|
|
|
@@ -153,7 +234,7 @@ export const ContextType = z.enum([
|
|
|
153
234
|
### Increase Embedding Dimensions
|
|
154
235
|
|
|
155
236
|
If switching to larger embedding model:
|
|
156
|
-
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)
|
|
157
238
|
2. Existing memories will have wrong dimensions - need migration
|
|
158
239
|
3. Consider versioning: `embedding_v1`, `embedding_v2`
|
|
159
240
|
|
|
@@ -163,7 +244,7 @@ If switching to larger embedding model:
|
|
|
163
244
|
|
|
164
245
|
**Current**: No formal migration system
|
|
165
246
|
|
|
166
|
-
**If Redis Schema Changes**:
|
|
247
|
+
**If Redis/Valkey Schema Changes**:
|
|
167
248
|
1. Create migration script in `scripts/migrate-{version}.ts`
|
|
168
249
|
2. Document in `MIGRATIONS.md`
|
|
169
250
|
3. Provide rollback instructions
|