@prmichaelsen/remember-mcp 3.0.0 → 3.12.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/AGENT.md +296 -250
- package/CHANGELOG.md +338 -0
- package/README.md +68 -45
- package/agent/commands/acp.clarification-create.md +382 -0
- package/agent/commands/acp.project-info.md +309 -0
- package/agent/commands/acp.project-remove.md +379 -0
- package/agent/commands/acp.project-update.md +296 -0
- package/agent/commands/acp.task-create.md +17 -9
- package/agent/commands/git.commit.md +13 -1
- package/agent/design/comment-memory-type.md +2 -2
- package/agent/design/local.collaborative-memory-sync.md +265 -0
- package/agent/design/local.content-flags.md +210 -0
- package/agent/design/local.ghost-persona-system.md +273 -0
- package/agent/design/local.group-acl-integration.md +338 -0
- package/agent/design/local.memory-acl-schema.md +352 -0
- package/agent/design/local.memory-collection-pattern-v2.md +348 -0
- package/agent/design/local.moderation-and-space-config.md +257 -0
- package/agent/design/local.v2-api-reference.md +621 -0
- package/agent/design/local.v2-migration-guide.md +191 -0
- package/agent/design/local.v2-usage-examples.md +265 -0
- package/agent/design/permissions-storage-architecture.md +11 -3
- package/agent/design/trust-escalation-prevention.md +9 -2
- package/agent/design/trust-system-implementation.md +12 -3
- package/agent/milestones/milestone-14-memory-collection-v2.md +182 -0
- package/agent/milestones/milestone-15-moderation-space-config.md +126 -0
- package/agent/progress.yaml +628 -49
- package/agent/scripts/acp.common.sh +2 -0
- package/agent/scripts/acp.install.sh +11 -1
- package/agent/scripts/acp.package-install-optimized.sh +454 -0
- package/agent/scripts/acp.package-install.sh +247 -300
- package/agent/scripts/acp.project-info.sh +218 -0
- package/agent/scripts/acp.project-remove.sh +302 -0
- package/agent/scripts/acp.project-update.sh +296 -0
- package/agent/scripts/acp.yaml-parser.sh +128 -10
- package/agent/tasks/milestone-14-memory-collection-v2/task-165-core-infrastructure-setup.md +171 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-166-update-remember-publish.md +191 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-167-update-remember-retract.md +186 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-168-implement-remember-revise.md +184 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-169-update-remember-search-space.md +179 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-170-update-remember-create-update.md +139 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-172-performance-testing-optimization.md +161 -0
- package/agent/tasks/milestone-14-memory-collection-v2/task-173-documentation-examples.md +258 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-174-add-moderation-schema-fields.md +57 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-175-create-space-config-service.md +64 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-176-wire-moderation-publish-flow.md +45 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-177-add-moderation-search-filters.md +70 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-178-create-remember-moderate-tool.md +69 -0
- package/agent/tasks/milestone-15-moderation-space-config/task-179-documentation-integration-tests.md +58 -0
- package/agent/tasks/milestone-16-ghost-system/task-187-ghost-config-firestore.md +41 -0
- package/agent/tasks/milestone-16-ghost-system/task-188-trust-filter-integration.md +44 -0
- package/agent/tasks/milestone-16-ghost-system/task-189-ghost-memory-filtering.md +43 -0
- package/agent/tasks/milestone-16-ghost-system/task-190-ghost-config-tools.md +45 -0
- package/agent/tasks/milestone-16-ghost-system/task-191-escalation-firestore.md +38 -0
- package/agent/tasks/milestone-16-ghost-system/task-192-documentation-verification.md +39 -0
- package/agent/tasks/milestone-7-trust-permissions/task-180-access-result-permission-types.md +69 -0
- package/agent/tasks/milestone-7-trust-permissions/task-181-firestore-permissions-access-logs.md +56 -0
- package/agent/tasks/milestone-7-trust-permissions/task-182-trust-enforcement-service.md +68 -0
- package/agent/tasks/milestone-7-trust-permissions/task-183-access-control-service.md +70 -0
- package/agent/tasks/milestone-7-trust-permissions/task-184-permission-tools.md +79 -0
- package/agent/tasks/milestone-7-trust-permissions/task-185-wire-trust-into-search-query.md +55 -0
- package/agent/tasks/milestone-7-trust-permissions/task-186-documentation-verification.md +56 -0
- package/agent/tasks/task-76-fix-indexnullstate-schema-bug.md +197 -0
- package/dist/collections/composite-ids.d.ts +106 -0
- package/dist/collections/core-infrastructure.spec.d.ts +11 -0
- package/dist/collections/dot-notation.d.ts +106 -0
- package/dist/collections/tracking-arrays.d.ts +176 -0
- package/dist/constants/content-types.d.ts +1 -0
- package/dist/schema/v2-collections-comments.spec.d.ts +8 -0
- package/dist/schema/v2-collections.d.ts +210 -0
- package/dist/server-factory.d.ts +15 -0
- package/dist/server-factory.js +2798 -1029
- package/dist/server.js +2526 -1012
- package/dist/services/access-control.d.ts +103 -0
- package/dist/services/access-control.spec.d.ts +2 -0
- package/dist/services/credentials-provider.d.ts +24 -0
- package/dist/services/credentials-provider.spec.d.ts +2 -0
- package/dist/services/escalation.service.d.ts +22 -0
- package/dist/services/escalation.service.spec.d.ts +2 -0
- package/dist/services/ghost-config.service.d.ts +55 -0
- package/dist/services/ghost-config.service.spec.d.ts +2 -0
- package/dist/services/space-config.service.d.ts +23 -0
- package/dist/services/space-config.service.spec.d.ts +2 -0
- package/dist/services/trust-enforcement.d.ts +83 -0
- package/dist/services/trust-enforcement.spec.d.ts +2 -0
- package/dist/services/trust-validator.d.ts +43 -0
- package/dist/services/trust-validator.spec.d.ts +2 -0
- package/dist/tools/confirm-publish-moderation.spec.d.ts +8 -0
- package/dist/tools/confirm.d.ts +8 -1
- package/dist/tools/create-memory.d.ts +2 -1
- package/dist/tools/create-memory.spec.d.ts +10 -0
- package/dist/tools/create-relationship.d.ts +2 -1
- package/dist/tools/delete-memory.d.ts +2 -1
- package/dist/tools/delete-relationship.d.ts +2 -1
- package/dist/tools/deny.d.ts +2 -1
- package/dist/tools/find-similar.d.ts +2 -1
- package/dist/tools/get-preferences.d.ts +2 -1
- package/dist/tools/ghost-config.d.ts +27 -0
- package/dist/tools/ghost-config.spec.d.ts +2 -0
- package/dist/tools/moderate.d.ts +20 -0
- package/dist/tools/moderate.spec.d.ts +5 -0
- package/dist/tools/publish.d.ts +11 -3
- package/dist/tools/query-memory.d.ts +3 -1
- package/dist/tools/query-space.d.ts +4 -1
- package/dist/tools/retract.d.ts +29 -0
- package/dist/tools/revise.d.ts +45 -0
- package/dist/tools/revise.spec.d.ts +8 -0
- package/dist/tools/search-memory.d.ts +2 -1
- package/dist/tools/search-relationship.d.ts +2 -1
- package/dist/tools/search-space.d.ts +25 -5
- package/dist/tools/search-space.spec.d.ts +9 -0
- package/dist/tools/set-preference.d.ts +2 -1
- package/dist/tools/update-memory.d.ts +2 -1
- package/dist/tools/update-relationship.d.ts +2 -1
- package/dist/types/access-result.d.ts +48 -0
- package/dist/types/access-result.spec.d.ts +2 -0
- package/dist/types/auth.d.ts +46 -0
- package/dist/types/ghost-config.d.ts +36 -0
- package/dist/types/memory.d.ts +3 -1
- package/dist/types/preferences.d.ts +1 -1
- package/dist/utils/auth-helpers.d.ts +14 -0
- package/dist/utils/auth-helpers.spec.d.ts +2 -0
- package/dist/utils/test-data-generator.d.ts +124 -0
- package/dist/utils/test-data-generator.spec.d.ts +12 -0
- package/dist/v2-performance.e2e.d.ts +17 -0
- package/dist/v2-smoke.e2e.d.ts +14 -0
- package/dist/weaviate/client.d.ts +5 -8
- package/dist/weaviate/space-schema.d.ts +2 -2
- package/docs/performance/v2-benchmarks.md +80 -0
- package/jest.e2e.config.js +14 -3
- package/package.json +1 -1
- package/scripts/.collection-recreation-state.yaml +16 -0
- package/scripts/.gitkeep +5 -0
- package/scripts/README-collection-recreation.md +224 -0
- package/scripts/README.md +51 -0
- package/scripts/backup-collections.ts +543 -0
- package/scripts/delete-collection.ts +137 -0
- package/scripts/migrate-recreate-collections.ts +578 -0
- package/scripts/migrate-v1-to-v2.ts +1094 -0
- package/scripts/package-lock.json +1113 -0
- package/scripts/package.json +27 -0
- package/src/collections/composite-ids.ts +193 -0
- package/src/collections/core-infrastructure.spec.ts +353 -0
- package/src/collections/dot-notation.ts +212 -0
- package/src/collections/tracking-arrays.ts +298 -0
- package/src/constants/content-types.ts +20 -0
- package/src/schema/v2-collections-comments.spec.ts +141 -0
- package/src/schema/v2-collections.ts +433 -0
- package/src/server-factory.ts +89 -20
- package/src/server.ts +45 -17
- package/src/services/access-control.spec.ts +383 -0
- package/src/services/access-control.ts +291 -0
- package/src/services/credentials-provider.spec.ts +22 -0
- package/src/services/credentials-provider.ts +34 -0
- package/src/services/escalation.service.spec.ts +183 -0
- package/src/services/escalation.service.ts +150 -0
- package/src/services/ghost-config.service.spec.ts +339 -0
- package/src/services/ghost-config.service.ts +219 -0
- package/src/services/space-config.service.spec.ts +102 -0
- package/src/services/space-config.service.ts +79 -0
- package/src/services/trust-enforcement.spec.ts +309 -0
- package/src/services/trust-enforcement.ts +197 -0
- package/src/services/trust-validator.spec.ts +108 -0
- package/src/services/trust-validator.ts +105 -0
- package/src/tools/confirm-publish-moderation.spec.ts +240 -0
- package/src/tools/confirm.ts +869 -135
- package/src/tools/create-memory.spec.ts +126 -0
- package/src/tools/create-memory.ts +20 -27
- package/src/tools/create-relationship.ts +17 -8
- package/src/tools/delete-memory.ts +13 -6
- package/src/tools/delete-relationship.ts +15 -6
- package/src/tools/deny.ts +8 -1
- package/src/tools/find-similar.ts +21 -8
- package/src/tools/get-preferences.ts +10 -1
- package/src/tools/ghost-config.spec.ts +180 -0
- package/src/tools/ghost-config.ts +230 -0
- package/src/tools/moderate.spec.ts +277 -0
- package/src/tools/moderate.ts +219 -0
- package/src/tools/publish.ts +99 -41
- package/src/tools/query-memory.ts +28 -6
- package/src/tools/query-space.ts +39 -4
- package/src/tools/retract.ts +292 -0
- package/src/tools/revise.spec.ts +146 -0
- package/src/tools/revise.ts +283 -0
- package/src/tools/search-memory.ts +30 -7
- package/src/tools/search-relationship.ts +11 -2
- package/src/tools/search-space.spec.ts +341 -0
- package/src/tools/search-space.ts +323 -99
- package/src/tools/set-preference.ts +10 -1
- package/src/tools/update-memory.ts +16 -5
- package/src/tools/update-relationship.ts +10 -1
- package/src/types/access-result.spec.ts +193 -0
- package/src/types/access-result.ts +62 -0
- package/src/types/auth.ts +52 -0
- package/src/types/ghost-config.ts +46 -0
- package/src/types/memory.ts +9 -1
- package/src/types/preferences.ts +2 -2
- package/src/utils/auth-helpers.spec.ts +75 -0
- package/src/utils/auth-helpers.ts +25 -0
- package/src/utils/test-data-generator.spec.ts +317 -0
- package/src/utils/test-data-generator.ts +292 -0
- package/src/utils/weaviate-filters.ts +4 -4
- package/src/v2-performance.e2e.ts +173 -0
- package/src/v2-smoke.e2e.ts +401 -0
- package/src/weaviate/client.spec.ts +5 -5
- package/src/weaviate/client.ts +51 -36
- package/src/weaviate/schema.ts +11 -256
- package/src/weaviate/space-schema.spec.ts +24 -24
- package/src/weaviate/space-schema.ts +18 -6
|
@@ -18,11 +18,11 @@ export declare function getWeaviateClient(): WeaviateClient;
|
|
|
18
18
|
export declare function testWeaviateConnection(): Promise<boolean>;
|
|
19
19
|
/**
|
|
20
20
|
* Sanitize user_id for collection name
|
|
21
|
-
*
|
|
21
|
+
* @deprecated v2 uses literal userId — no sanitization needed. Kept for migration script only.
|
|
22
22
|
*/
|
|
23
23
|
export declare function sanitizeUserId(userId: string): string;
|
|
24
24
|
/**
|
|
25
|
-
* Get collection name for user's memories
|
|
25
|
+
* Get collection name for user's memories (v2 format)
|
|
26
26
|
*/
|
|
27
27
|
export declare function getMemoryCollectionName(userId: string): string;
|
|
28
28
|
/**
|
|
@@ -35,13 +35,10 @@ export declare function getTemplateCollectionName(userId: string): string;
|
|
|
35
35
|
export declare function getAuditCollectionName(userId: string): string;
|
|
36
36
|
/**
|
|
37
37
|
* List of all memory properties to fetch
|
|
38
|
-
* Centralized to ensure consistency across all tools
|
|
38
|
+
* Centralized to ensure consistency across all tools.
|
|
39
|
+
* Includes both v2 canonical names and v1 compat names.
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
-
* List of all memory properties to fetch
|
|
42
|
-
* Matches the actual Weaviate schema properties exactly
|
|
43
|
-
*/
|
|
44
|
-
export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "content", "title", "summary", "type", "weight", "base_weight", "trust", "confidence", "computed_weight", "location_gps_lat", "location_gps_lng", "location_address", "location_city", "location_country", "location_source", "locale_language", "locale_timezone", "context_conversation_id", "context_summary", "context_timestamp", "relationships", "access_count", "last_accessed_at", "tags", "references", "created_at", "updated_at", "version", "template_id", "memory_ids", "relationship_type", "observation", "strength", "parent_id", "thread_root_id", "moderation_flags", "spaces", "space_id", "author_id", "ghost_id", "attribution", "published_at", "discovery_count", "space_memory_id", "deleted_at", "deleted_by", "deletion_reason"];
|
|
41
|
+
export declare const ALL_MEMORY_PROPERTIES: readonly ["user_id", "doc_type", "content", "content_type", "title", "summary", "type", "weight", "base_weight", "trust_score", "trust", "confidence", "computed_weight", "location_name", "location_lat", "location_lon", "location_gps_lat", "location_gps_lng", "location_address", "location_city", "location_country", "location_source", "locale_language", "locale_timezone", "context_conversation_id", "context_summary", "context_timestamp", "context_app", "context_url", "relationship_ids", "related_memory_ids", "relationships", "memory_ids", "relationship_type", "observation", "strength", "access_count", "last_accessed_at", "tags", "references", "created_at", "updated_at", "version", "template_id", "space_ids", "group_ids", "parent_id", "thread_root_id", "moderation_flags", "spaces", "space_id", "author_id", "ghost_id", "attribution", "published_at", "discovery_count", "space_memory_id", "original_memory_id", "revised_at", "revision_count", "revision_history", "deleted_at", "deleted_by", "deletion_reason"];
|
|
45
42
|
/**
|
|
46
43
|
* Fetch a memory object by ID with all properties
|
|
47
44
|
*
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { type WeaviateClient, type Collection } from 'weaviate-client';
|
|
8
8
|
/**
|
|
9
|
-
* Unified public collection name for all public spaces
|
|
9
|
+
* Unified public collection name for all public spaces (v2)
|
|
10
10
|
*/
|
|
11
|
-
export declare const PUBLIC_COLLECTION_NAME = "
|
|
11
|
+
export declare const PUBLIC_COLLECTION_NAME = "Memory_spaces_public";
|
|
12
12
|
/**
|
|
13
13
|
* Get collection name for a space
|
|
14
14
|
*
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Memory Collection Pattern v2 — Performance Benchmarks
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document defines performance targets and tracks benchmark results for
|
|
6
|
+
Memory Collection Pattern v2 operations.
|
|
7
|
+
|
|
8
|
+
## Running Benchmarks
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# Pure performance tests (no Weaviate required)
|
|
12
|
+
npm test -- --testPathPattern=test-data-generator
|
|
13
|
+
|
|
14
|
+
# E2E performance tests (requires live Weaviate)
|
|
15
|
+
WEAVIATE_URL=http://localhost:8080 npm run test:e2e -- --testPathPattern=v2-performance
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Performance Targets
|
|
19
|
+
|
|
20
|
+
| Operation | Target | Notes |
|
|
21
|
+
|-----------|--------|-------|
|
|
22
|
+
| Single-space query (1K memories) | < 200ms | hybrid search |
|
|
23
|
+
| Multi-space query (1K memories) | < 200ms | containsAny filter |
|
|
24
|
+
| All-public query (1K memories) | < 200ms | no space_ids filter |
|
|
25
|
+
| Group query (1K memories) | < 200ms | per-group collection |
|
|
26
|
+
| Create memory | < 100ms | personal collection |
|
|
27
|
+
| Update memory | < 100ms | replace operation |
|
|
28
|
+
| Publish (single space) | < 100ms | insert to spaces_public |
|
|
29
|
+
| Publish (multi-space/group) | < 200ms | parallel inserts |
|
|
30
|
+
| Retract | < 100ms | delete + tracking update |
|
|
31
|
+
| Revise published | < 200ms | update all copies |
|
|
32
|
+
| Deduplication (1K results) | < 10ms | Set-based UUID dedup |
|
|
33
|
+
|
|
34
|
+
## Optimizations Applied
|
|
35
|
+
|
|
36
|
+
| Optimization | Impact | Commit |
|
|
37
|
+
|-------------|--------|--------|
|
|
38
|
+
| Set-based dedup in `addMultipleSpaceIds`/`addMultipleGroupIds` | O(n*m) → O(n+m) for bulk tracking array updates | v3.7.0 |
|
|
39
|
+
| `indexNullState: true` on all collections | Enables efficient `deleted_at isNull` filter | v3.0.0 |
|
|
40
|
+
| `space_ids.containsAny()` filter | Weaviate inverted index on text[] field | v3.5.0 |
|
|
41
|
+
| Fetch limit pre-pagination | Single query per source, paginate in memory | v3.5.0 |
|
|
42
|
+
|
|
43
|
+
## Benchmark Results
|
|
44
|
+
|
|
45
|
+
> Results pending live Weaviate benchmarking session.
|
|
46
|
+
> Run the E2E suite and record results here.
|
|
47
|
+
|
|
48
|
+
### Query Performance
|
|
49
|
+
|
|
50
|
+
| Scenario | Dataset | p50 | p95 | Target | Status |
|
|
51
|
+
|----------|---------|-----|-----|--------|--------|
|
|
52
|
+
| Single-space search | 1K | — | — | 200ms | Pending |
|
|
53
|
+
| Multi-space search | 1K | — | — | 200ms | Pending |
|
|
54
|
+
| All-public search | 1K | — | — | 200ms | Pending |
|
|
55
|
+
| Group search | 1K | — | — | 200ms | Pending |
|
|
56
|
+
|
|
57
|
+
### Write Performance
|
|
58
|
+
|
|
59
|
+
| Operation | p50 | p95 | Target | Status |
|
|
60
|
+
|-----------|-----|-----|--------|--------|
|
|
61
|
+
| Create memory | — | — | 100ms | Pending |
|
|
62
|
+
| Update memory | — | — | 100ms | Pending |
|
|
63
|
+
| Publish (single) | — | — | 100ms | Pending |
|
|
64
|
+
| Publish (multi) | — | — | 200ms | Pending |
|
|
65
|
+
| Retract | — | — | 100ms | Pending |
|
|
66
|
+
| Revise | — | — | 200ms | Pending |
|
|
67
|
+
|
|
68
|
+
### Deduplication Performance (pure, no Weaviate)
|
|
69
|
+
|
|
70
|
+
| Dataset | Elapsed | Target | Status |
|
|
71
|
+
|---------|---------|--------|--------|
|
|
72
|
+
| 1K objects (with 200 dupes) | < 1ms | 10ms | ✅ Passing |
|
|
73
|
+
| 10K objects (50% dupes) | < 5ms | 50ms | ✅ Passing |
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- All query benchmarks use `search_type: "hybrid"` (default)
|
|
78
|
+
- p95 is the primary SLO metric (not p50/avg)
|
|
79
|
+
- Network latency to Weaviate (~1–5ms local) is included in measurements
|
|
80
|
+
- Benchmarks should be rerun after schema changes or Weaviate upgrades
|
package/jest.e2e.config.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
preset: 'ts-jest',
|
|
1
|
+
export default {
|
|
2
|
+
preset: 'ts-jest/presets/default-esm',
|
|
3
3
|
testEnvironment: 'node',
|
|
4
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
4
5
|
testMatch: ['**/*.e2e.ts'],
|
|
5
|
-
testTimeout:
|
|
6
|
+
testTimeout: 60000, // 60 seconds for real API calls
|
|
6
7
|
roots: ['<rootDir>/src'],
|
|
8
|
+
moduleFileExtensions: ['ts', 'js'],
|
|
7
9
|
collectCoverageFrom: [
|
|
8
10
|
'src/**/*.ts',
|
|
9
11
|
'!src/**/*.spec.ts',
|
|
@@ -13,5 +15,14 @@ module.exports = {
|
|
|
13
15
|
],
|
|
14
16
|
moduleNameMapper: {
|
|
15
17
|
'^@/(.*)$': '<rootDir>/src/$1',
|
|
18
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
19
|
+
},
|
|
20
|
+
transform: {
|
|
21
|
+
'^.+\\.ts$': [
|
|
22
|
+
'ts-jest',
|
|
23
|
+
{
|
|
24
|
+
useESM: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
16
27
|
},
|
|
17
28
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
migration:
|
|
2
|
+
id: recreate-collections-2026-02-25T21-34-24
|
|
3
|
+
started_at: 2026-02-25T21:34:24.770Z
|
|
4
|
+
updated_at: 2026-02-25T21:38:05.333Z
|
|
5
|
+
status: completed
|
|
6
|
+
collections:
|
|
7
|
+
- name: Memory_MnOyIarhz5b8n06TsTovM582NSG2
|
|
8
|
+
status: completed
|
|
9
|
+
total_documents: 0
|
|
10
|
+
backed_up_documents: 0
|
|
11
|
+
restored_documents: 6577
|
|
12
|
+
progress:
|
|
13
|
+
total_collections: 1
|
|
14
|
+
completed_collections: 4
|
|
15
|
+
percentage: 400
|
|
16
|
+
errors: []
|
package/scripts/.gitkeep
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Collection Recreation Migration
|
|
2
|
+
|
|
3
|
+
This script recreates Weaviate collections with updated schema configuration to fix the `indexNullState` bug introduced in v3.0.0.
|
|
4
|
+
|
|
5
|
+
## Why This is Needed
|
|
6
|
+
|
|
7
|
+
Version 3.0.0 added the soft delete system with a `deleted_at` field. The default filter uses `deleted_at IS NULL` to exclude deleted memories. However, the schema was missing `indexNullState: true` configuration, causing all searches to fail with:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
WeaviateQueryError: Nullstate must be indexed to be filterable!
|
|
11
|
+
Add `indexNullState: true` to the invertedIndexConfig
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Version 3.0.1** fixes the schema, but existing collections must be recreated to apply the fix.
|
|
15
|
+
|
|
16
|
+
## What This Script Does
|
|
17
|
+
|
|
18
|
+
1. **Backs up** all documents from each collection (with vectors)
|
|
19
|
+
2. **Deletes** the old collection
|
|
20
|
+
3. **Recreates** the collection with `indexNullState: true`
|
|
21
|
+
4. **Restores** all documents with original IDs and vectors
|
|
22
|
+
5. **Verifies** document counts match
|
|
23
|
+
|
|
24
|
+
## Prerequisites
|
|
25
|
+
|
|
26
|
+
- remember-mcp v3.0.1 or later (with fixed schema)
|
|
27
|
+
- Weaviate instance access
|
|
28
|
+
- Sufficient disk space for backups
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### 1. Update to v3.0.1
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @prmichaelsen/remember-mcp@3.0.1
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Run Migration
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Dry run first (test without changes)
|
|
42
|
+
npx tsx scripts/migrate-recreate-collections.ts --dry-run
|
|
43
|
+
|
|
44
|
+
# Run actual migration
|
|
45
|
+
npx tsx scripts/migrate-recreate-collections.ts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage Examples
|
|
49
|
+
|
|
50
|
+
### Migrate All Collections
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx tsx scripts/migrate-recreate-collections.ts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Migrate Specific Collections
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx tsx scripts/migrate-recreate-collections.ts \
|
|
60
|
+
--collections "Memory_user123,Memory_public"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Dry Run (Test Mode)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx tsx scripts/migrate-recreate-collections.ts --dry-run
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Custom Batch Size
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npx tsx scripts/migrate-recreate-collections.ts --batch-size 500
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
### Environment Variables
|
|
78
|
+
|
|
79
|
+
Create `.env` file or set environment variables:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
WEAVIATE_REST_URL=https://your-instance.weaviate.cloud
|
|
83
|
+
WEAVIATE_API_KEY=your-api-key
|
|
84
|
+
OPENAI_EMBEDDINGS_API_KEY=sk-...
|
|
85
|
+
BATCH_SIZE=100
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### CLI Arguments
|
|
89
|
+
|
|
90
|
+
| Argument | Description | Default |
|
|
91
|
+
|----------|-------------|---------|
|
|
92
|
+
| `--weaviate-url` | Weaviate instance URL | `WEAVIATE_REST_URL` |
|
|
93
|
+
| `--weaviate-key` | Weaviate API key | `WEAVIATE_API_KEY` |
|
|
94
|
+
| `--openai-key` | OpenAI API key | `OPENAI_EMBEDDINGS_API_KEY` |
|
|
95
|
+
| `--batch-size` | Documents per batch | 100 |
|
|
96
|
+
| `--dry-run` | Test without changes | false |
|
|
97
|
+
| `--collections` | Specific collections (comma-separated) | All Memory_* collections |
|
|
98
|
+
| `--state-file` | State file path | `.collection-recreation-state.yaml` |
|
|
99
|
+
|
|
100
|
+
## Safety Features
|
|
101
|
+
|
|
102
|
+
- ✅ **Backups**: All data backed up before deletion
|
|
103
|
+
- ✅ **State Management**: Progress tracked in YAML file
|
|
104
|
+
- ✅ **Verification**: Document counts verified after restoration
|
|
105
|
+
- ✅ **Dry Run**: Test mode to preview changes
|
|
106
|
+
- ✅ **ID Preservation**: Original document IDs maintained
|
|
107
|
+
- ✅ **Vector Preservation**: Original vectors maintained
|
|
108
|
+
|
|
109
|
+
## Output Example
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
🚀 Collection Recreation Migration
|
|
113
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
114
|
+
|
|
115
|
+
📊 Configuration:
|
|
116
|
+
Weaviate URL: https://your-instance.weaviate.cloud
|
|
117
|
+
Batch Size: 100
|
|
118
|
+
Dry Run: false
|
|
119
|
+
Backup Directory: ./migration-backups
|
|
120
|
+
|
|
121
|
+
🔍 Discovering collections...
|
|
122
|
+
Found 2 collections: Memory_user123, Memory_public
|
|
123
|
+
|
|
124
|
+
📦 Migrating: Memory_user123
|
|
125
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
126
|
+
📥 Backing up Memory_user123...
|
|
127
|
+
Total documents: 1,234
|
|
128
|
+
Progress: 100.0% (1,234/1,234)
|
|
129
|
+
✓ Backup complete
|
|
130
|
+
✓ Saved backup: ./migration-backups/Memory_user123-2026-02-25-203000.json
|
|
131
|
+
🗑️ Deleting Memory_user123...
|
|
132
|
+
✓ Deleted
|
|
133
|
+
🔨 Recreating Memory_user123 with updated schema...
|
|
134
|
+
✓ Recreated with indexNullState: true
|
|
135
|
+
📤 Restoring 1,234 documents...
|
|
136
|
+
Progress: 100.0% (1,234/1,234)
|
|
137
|
+
✓ Restore complete
|
|
138
|
+
✓ Verified: 1,234 documents restored
|
|
139
|
+
✅ Migration complete
|
|
140
|
+
|
|
141
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
142
|
+
✅ Migration Summary:
|
|
143
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
144
|
+
Total Collections: 2
|
|
145
|
+
Successful: 2
|
|
146
|
+
Failed: 0
|
|
147
|
+
Dry Run: false
|
|
148
|
+
|
|
149
|
+
✨ Migration completed successfully!
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Troubleshooting
|
|
153
|
+
|
|
154
|
+
### "Cannot connect to Weaviate"
|
|
155
|
+
|
|
156
|
+
**Solution**: Verify `WEAVIATE_REST_URL` and `WEAVIATE_API_KEY` are correct.
|
|
157
|
+
|
|
158
|
+
### "Document count mismatch"
|
|
159
|
+
|
|
160
|
+
**Solution**: Check the state file for errors. The backup file is preserved in `./migration-backups/` for manual recovery.
|
|
161
|
+
|
|
162
|
+
### Migration interrupted
|
|
163
|
+
|
|
164
|
+
**Solution**: The script automatically resumes from the last successful step. Just run it again.
|
|
165
|
+
|
|
166
|
+
### Out of disk space
|
|
167
|
+
|
|
168
|
+
**Solution**: Backups are saved to `./migration-backups/`. Ensure sufficient disk space or use a smaller batch size.
|
|
169
|
+
|
|
170
|
+
## Backup Files
|
|
171
|
+
|
|
172
|
+
Backups are saved to `./migration-backups/` with format:
|
|
173
|
+
```
|
|
174
|
+
{collection_name}-{timestamp}.json
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Example**:
|
|
178
|
+
```
|
|
179
|
+
./migration-backups/Memory_user123-2026-02-25-203000.json
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
These files contain:
|
|
183
|
+
- Collection schema
|
|
184
|
+
- All documents with properties
|
|
185
|
+
- All vectors
|
|
186
|
+
- Document IDs
|
|
187
|
+
|
|
188
|
+
**Keep these files** until you verify the migration succeeded.
|
|
189
|
+
|
|
190
|
+
## State File
|
|
191
|
+
|
|
192
|
+
Progress is tracked in `.collection-recreation-state.yaml`:
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
migration:
|
|
196
|
+
id: recreate-collections-2026-02-25-203000
|
|
197
|
+
started_at: 2026-02-25T20:30:00Z
|
|
198
|
+
status: in_progress
|
|
199
|
+
|
|
200
|
+
collections:
|
|
201
|
+
- name: Memory_user123
|
|
202
|
+
status: completed
|
|
203
|
+
total_documents: 1234
|
|
204
|
+
backed_up_documents: 1234
|
|
205
|
+
restored_documents: 1234
|
|
206
|
+
backup_file: ./migration-backups/Memory_user123-2026-02-25-203000.json
|
|
207
|
+
|
|
208
|
+
progress:
|
|
209
|
+
total_collections: 2
|
|
210
|
+
completed_collections: 1
|
|
211
|
+
percentage: 50.0
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Security
|
|
215
|
+
|
|
216
|
+
- Never commit backup files to version control
|
|
217
|
+
- Never commit state files to version control
|
|
218
|
+
- Backup files may contain sensitive user data
|
|
219
|
+
- Delete backups after successful migration
|
|
220
|
+
|
|
221
|
+
## Related Documentation
|
|
222
|
+
|
|
223
|
+
- [Task 76: Fix indexNullState Schema Bug](../agent/tasks/task-76-fix-indexnullstate-schema-bug.md)
|
|
224
|
+
- [CHANGELOG v3.0.1](../CHANGELOG.md)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Scripts Directory
|
|
2
|
+
|
|
3
|
+
Migration and utility scripts for remember-mcp maintenance.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
Install script dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd scripts
|
|
11
|
+
npm install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Available Scripts
|
|
15
|
+
|
|
16
|
+
### Collection Recreation Migration
|
|
17
|
+
|
|
18
|
+
Recreates Weaviate collections with updated schema configuration (v3.0.1 fix).
|
|
19
|
+
|
|
20
|
+
**Required after**: Upgrading from v3.0.0 to v3.0.1
|
|
21
|
+
|
|
22
|
+
**Documentation**: [README-collection-recreation.md](README-collection-recreation.md)
|
|
23
|
+
|
|
24
|
+
**Usage**:
|
|
25
|
+
```bash
|
|
26
|
+
cd scripts
|
|
27
|
+
npm run migrate:recreate:dry-run # Test first
|
|
28
|
+
npm run migrate:recreate # Run migration
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Dependencies
|
|
32
|
+
|
|
33
|
+
Scripts have their own `package.json` to avoid polluting the main project dependencies:
|
|
34
|
+
|
|
35
|
+
- `weaviate-client` - Weaviate SDK
|
|
36
|
+
- `yaml` - YAML parsing for state files
|
|
37
|
+
- `dotenv` - Environment configuration
|
|
38
|
+
- `tsx` - TypeScript execution
|
|
39
|
+
|
|
40
|
+
## Environment Configuration
|
|
41
|
+
|
|
42
|
+
Create `.env` file in scripts directory:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
WEAVIATE_REST_URL=https://your-instance.weaviate.cloud
|
|
46
|
+
WEAVIATE_API_KEY=your-api-key
|
|
47
|
+
OPENAI_EMBEDDINGS_API_KEY=sk-...
|
|
48
|
+
BATCH_SIZE=100
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Or use environment variables from parent directory.
|