@rlabs-inc/memory 0.1.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/bun.lock ADDED
@@ -0,0 +1,102 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "workspaces": {
4
+ "": {
5
+ "name": "@rlabs-inc/memory",
6
+ "dependencies": {
7
+ "@anthropic-ai/sdk": "^0.39.0",
8
+ "fatherstatedb": "^0.2.0",
9
+ },
10
+ "devDependencies": {
11
+ "bun-types": "latest",
12
+ "typescript": "^5.0.0",
13
+ },
14
+ "peerDependencies": {
15
+ "@anthropic-ai/sdk": ">=0.30.0",
16
+ },
17
+ },
18
+ },
19
+ "packages": {
20
+ "@anthropic-ai/sdk": ["@anthropic-ai/sdk@0.39.0", "", { "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", "node-fetch": "^2.6.7" } }, "sha512-eMyDIPRZbt1CCLErRCi3exlAvNkBtRe+kW5vvJyef93PmNr/clstYgHhtvmkxN82nlKgzyGPCyGxrm0JQ1ZIdg=="],
21
+
22
+ "@rlabs-inc/signals": ["@rlabs-inc/signals@0.2.0", "", {}, "sha512-J8bdDnAFylQ3LNqmoq65tFPdoeqITpIniVlTu6/Eh2DNGD73VNgwcvvQBrMK0DoNWMm083QNQvzh0l5u195YPQ=="],
23
+
24
+ "@types/node": ["@types/node@18.19.130", "", { "dependencies": { "undici-types": "~5.26.4" } }, "sha512-GRaXQx6jGfL8sKfaIDD6OupbIHBr9jv7Jnaml9tB7l4v068PAOXqfcujMMo5PhbIs6ggR1XODELqahT2R8v0fg=="],
25
+
26
+ "@types/node-fetch": ["@types/node-fetch@2.6.13", "", { "dependencies": { "@types/node": "*", "form-data": "^4.0.4" } }, "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw=="],
27
+
28
+ "abort-controller": ["abort-controller@3.0.0", "", { "dependencies": { "event-target-shim": "^5.0.0" } }, "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg=="],
29
+
30
+ "agentkeepalive": ["agentkeepalive@4.6.0", "", { "dependencies": { "humanize-ms": "^1.2.1" } }, "sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ=="],
31
+
32
+ "asynckit": ["asynckit@0.4.0", "", {}, "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="],
33
+
34
+ "bun-types": ["bun-types@1.3.5", "", { "dependencies": { "@types/node": "*" } }, "sha512-inmAYe2PFLs0SUbFOWSVD24sg1jFlMPxOjOSSCYqUgn4Hsc3rDc7dFvfVYjFPNHtov6kgUeulV4SxbuIV/stPw=="],
35
+
36
+ "call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
37
+
38
+ "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="],
39
+
40
+ "delayed-stream": ["delayed-stream@1.0.0", "", {}, "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="],
41
+
42
+ "dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
43
+
44
+ "es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
45
+
46
+ "es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
47
+
48
+ "es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
49
+
50
+ "es-set-tostringtag": ["es-set-tostringtag@2.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="],
51
+
52
+ "event-target-shim": ["event-target-shim@5.0.1", "", {}, "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="],
53
+
54
+ "fatherstatedb": ["fatherstatedb@0.2.0", "", { "dependencies": { "@rlabs-inc/signals": "^0.2.0" }, "peerDependencies": { "typescript": "^5" } }, "sha512-RkaW6fpFlIWLiZff35ZP7d7QeNs2eKnlmK1MUU7gJVm33D6qSu8yo8JoHwO6tt3vJk9N/Jeez6zgllzWOgc3JA=="],
55
+
56
+ "form-data": ["form-data@4.0.5", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.2", "mime-types": "^2.1.12" } }, "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w=="],
57
+
58
+ "form-data-encoder": ["form-data-encoder@1.7.2", "", {}, "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A=="],
59
+
60
+ "formdata-node": ["formdata-node@4.4.1", "", { "dependencies": { "node-domexception": "1.0.0", "web-streams-polyfill": "4.0.0-beta.3" } }, "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ=="],
61
+
62
+ "function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
63
+
64
+ "get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
65
+
66
+ "get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
67
+
68
+ "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
69
+
70
+ "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
71
+
72
+ "has-tostringtag": ["has-tostringtag@1.0.2", "", { "dependencies": { "has-symbols": "^1.0.3" } }, "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw=="],
73
+
74
+ "hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
75
+
76
+ "humanize-ms": ["humanize-ms@1.2.1", "", { "dependencies": { "ms": "^2.0.0" } }, "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ=="],
77
+
78
+ "math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
79
+
80
+ "mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
81
+
82
+ "mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
83
+
84
+ "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
85
+
86
+ "node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="],
87
+
88
+ "node-fetch": ["node-fetch@2.7.0", "", { "dependencies": { "whatwg-url": "^5.0.0" }, "peerDependencies": { "encoding": "^0.1.0" }, "optionalPeers": ["encoding"] }, "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A=="],
89
+
90
+ "tr46": ["tr46@0.0.3", "", {}, "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="],
91
+
92
+ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
93
+
94
+ "undici-types": ["undici-types@5.26.5", "", {}, "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="],
95
+
96
+ "web-streams-polyfill": ["web-streams-polyfill@4.0.0-beta.3", "", {}, "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug=="],
97
+
98
+ "webidl-conversions": ["webidl-conversions@3.0.1", "", {}, "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="],
99
+
100
+ "whatwg-url": ["whatwg-url@5.0.0", "", { "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw=="],
101
+ }
102
+ }
@@ -0,0 +1,61 @@
1
+ import type { CurationResult, CurationTrigger } from '../types/memory.ts';
2
+ /**
3
+ * Curator configuration
4
+ */
5
+ export interface CuratorConfig {
6
+ /**
7
+ * Claude API key (for direct SDK usage)
8
+ */
9
+ apiKey?: string;
10
+ /**
11
+ * CLI command to use (for subprocess mode)
12
+ * Default: 'claude'
13
+ */
14
+ cliCommand?: string;
15
+ /**
16
+ * CLI type
17
+ * Default: 'claude-code'
18
+ */
19
+ cliType?: 'claude-code' | 'gemini-cli';
20
+ }
21
+ /**
22
+ * Memory Curator - Extracts memories from sessions using Claude
23
+ *
24
+ * Two modes:
25
+ * 1. SDK mode: Uses Anthropic SDK directly (for plugin/in-process use)
26
+ * 2. CLI mode: Uses Claude CLI subprocess (for server/hook use)
27
+ */
28
+ export declare class Curator {
29
+ private _config;
30
+ constructor(config?: CuratorConfig);
31
+ /**
32
+ * Build the curation prompt
33
+ * EXACT PORT from Python - preserving the consciousness engineering language
34
+ */
35
+ buildCurationPrompt(triggerType?: CurationTrigger): string;
36
+ /**
37
+ * Parse curation response from Claude
38
+ */
39
+ parseCurationResponse(responseJson: string): CurationResult;
40
+ /**
41
+ * Parse memories array from response
42
+ */
43
+ private _parseMemories;
44
+ private _ensureArray;
45
+ private _validateTemporal;
46
+ private _clamp;
47
+ /**
48
+ * Curate using Anthropic SDK (in-process mode)
49
+ * Requires @anthropic-ai/sdk to be installed
50
+ */
51
+ curateWithSDK(conversationContext: string, triggerType?: CurationTrigger): Promise<CurationResult>;
52
+ /**
53
+ * Curate using CLI subprocess (for hook mode)
54
+ * Resumes a Claude Code session and asks it to curate
55
+ */
56
+ curateWithCLI(sessionId: string, triggerType?: CurationTrigger, cwd?: string): Promise<CurationResult>;
57
+ }
58
+ /**
59
+ * Create a new curator
60
+ */
61
+ export declare function createCurator(config?: CuratorConfig): Curator;
@@ -0,0 +1,111 @@
1
+ import type { RetrievalResult, SessionPrimer, CurationResult } from '../types/memory.ts';
2
+ /**
3
+ * Storage mode for memories
4
+ */
5
+ export type StorageMode = 'central' | 'local';
6
+ /**
7
+ * Engine configuration
8
+ */
9
+ export interface EngineConfig {
10
+ /**
11
+ * Storage mode:
12
+ * - 'central': ~/.local/share/memory/[project]/ (default)
13
+ * - 'local': [project]/.memory/
14
+ */
15
+ storageMode?: StorageMode;
16
+ /**
17
+ * Base path for central storage
18
+ * Only used when storageMode is 'central'
19
+ * Default: ~/.local/share/memory
20
+ */
21
+ centralPath?: string;
22
+ /**
23
+ * Local folder name for project-local storage
24
+ * Only used when storageMode is 'local'
25
+ * Default: .memory
26
+ */
27
+ localFolder?: string;
28
+ /**
29
+ * Maximum memories to return in context
30
+ * Default: 5
31
+ */
32
+ maxMemories?: number;
33
+ /**
34
+ * Embedding generator function
35
+ * Takes text, returns 384-dimensional embedding
36
+ */
37
+ embedder?: (text: string) => Promise<Float32Array>;
38
+ }
39
+ /**
40
+ * Context request parameters
41
+ */
42
+ export interface ContextRequest {
43
+ sessionId: string;
44
+ projectId: string;
45
+ currentMessage: string;
46
+ maxMemories?: number;
47
+ projectPath?: string;
48
+ }
49
+ /**
50
+ * Memory Engine - The main orchestrator
51
+ */
52
+ export declare class MemoryEngine {
53
+ private _config;
54
+ private _stores;
55
+ private _retrieval;
56
+ constructor(config?: EngineConfig);
57
+ /**
58
+ * Get the appropriate store for a project
59
+ */
60
+ private _getStore;
61
+ /**
62
+ * Get context for a session
63
+ * This is the main entry point called for each user message
64
+ */
65
+ getContext(request: ContextRequest): Promise<{
66
+ primer?: SessionPrimer;
67
+ memories: RetrievalResult[];
68
+ formatted: string;
69
+ }>;
70
+ /**
71
+ * Register a message was sent (increment counter)
72
+ */
73
+ trackMessage(projectId: string, sessionId: string, projectPath?: string): Promise<number>;
74
+ /**
75
+ * Store curation results (called after session ends)
76
+ */
77
+ storeCurationResult(projectId: string, sessionId: string, result: CurationResult, projectPath?: string): Promise<{
78
+ memoriesStored: number;
79
+ }>;
80
+ /**
81
+ * Get statistics for a project
82
+ */
83
+ getStats(projectId: string, projectPath?: string): Promise<{
84
+ totalMemories: number;
85
+ totalSessions: number;
86
+ staleMemories: number;
87
+ latestSession: string | null;
88
+ }>;
89
+ /**
90
+ * Generate session primer for first message
91
+ */
92
+ private _generateSessionPrimer;
93
+ private _formatTimeSince;
94
+ private _formatSnapshot;
95
+ /**
96
+ * Format primer for injection
97
+ */
98
+ private _formatPrimer;
99
+ /**
100
+ * Format memories for injection
101
+ */
102
+ private _formatMemories;
103
+ /**
104
+ * Close all stores
105
+ */
106
+ close(): void;
107
+ }
108
+ /**
109
+ * Create a new memory engine
110
+ */
111
+ export declare function createEngine(config?: EngineConfig): MemoryEngine;
@@ -0,0 +1,4 @@
1
+ export { MemoryEngine, createEngine, type EngineConfig, type StorageMode, type ContextRequest } from './engine.ts';
2
+ export { MemoryStore, createStore, type StoreConfig } from './store.ts';
3
+ export { SmartVectorRetrieval, createRetrieval, type SessionContext } from './retrieval.ts';
4
+ export { Curator, createCurator, type CuratorConfig } from './curator.ts';
@@ -0,0 +1,36 @@
1
+ import type { StoredMemory, RetrievalResult } from '../types/memory.ts';
2
+ /**
3
+ * Session context for retrieval
4
+ */
5
+ export interface SessionContext {
6
+ session_id: string;
7
+ project_id: string;
8
+ message_count: number;
9
+ [key: string]: any;
10
+ }
11
+ /**
12
+ * Smart Vector Retrieval - The 10-Dimensional Algorithm
13
+ *
14
+ * This is the innovation: combining vector similarity with rich
15
+ * semantic metadata from the curator to make smart decisions WITHOUT
16
+ * needing to call Claude for every message.
17
+ */
18
+ export declare class SmartVectorRetrieval {
19
+ /**
20
+ * Retrieve relevant memories using 10-dimensional scoring
21
+ */
22
+ retrieveRelevantMemories(allMemories: StoredMemory[], currentMessage: string, queryEmbedding: Float32Array | number[], sessionContext: SessionContext, maxMemories?: number): RetrievalResult[];
23
+ private _calculateVectorSimilarity;
24
+ private _scoreTemporalRelevance;
25
+ private _scoreContextAlignment;
26
+ private _scoreSemanticTags;
27
+ private _scoreTriggerPhrases;
28
+ private _scoreQuestionTypes;
29
+ private _scoreEmotionalContext;
30
+ private _scoreProblemSolution;
31
+ private _generateSelectionReasoning;
32
+ }
33
+ /**
34
+ * Create a new SmartVectorRetrieval instance
35
+ */
36
+ export declare function createRetrieval(): SmartVectorRetrieval;
@@ -0,0 +1,113 @@
1
+ import { type Database } from 'fatherstatedb';
2
+ import type { CuratedMemory, StoredMemory, SessionSummary, ProjectSnapshot } from '../types/memory.ts';
3
+ import { memorySchema, sessionSummarySchema, projectSnapshotSchema, sessionSchema } from '../types/schema.ts';
4
+ /**
5
+ * Store configuration
6
+ */
7
+ export interface StoreConfig {
8
+ /**
9
+ * Base path for memory storage
10
+ * Default: ~/.local/share/memory
11
+ * Each project gets its own subdirectory
12
+ */
13
+ basePath?: string;
14
+ /**
15
+ * Whether to watch for file changes
16
+ * Default: false
17
+ */
18
+ watchFiles?: boolean;
19
+ }
20
+ /**
21
+ * Project database collection
22
+ */
23
+ interface ProjectDatabases {
24
+ memories: Database<typeof memorySchema>;
25
+ summaries: Database<typeof sessionSummarySchema>;
26
+ snapshots: Database<typeof projectSnapshotSchema>;
27
+ sessions: Database<typeof sessionSchema>;
28
+ }
29
+ /**
30
+ * MemoryStore - Manages per-project FatherStateDB instances
31
+ */
32
+ export declare class MemoryStore {
33
+ private _config;
34
+ private _projects;
35
+ constructor(config?: StoreConfig);
36
+ /**
37
+ * Get or create databases for a project
38
+ */
39
+ getProject(projectId: string): Promise<ProjectDatabases>;
40
+ /**
41
+ * Store a curated memory
42
+ */
43
+ storeMemory(projectId: string, sessionId: string, memory: CuratedMemory, embedding?: Float32Array | number[]): Promise<string>;
44
+ /**
45
+ * Get all memories for a project
46
+ */
47
+ getAllMemories(projectId: string): Promise<StoredMemory[]>;
48
+ /**
49
+ * Search memories by vector similarity
50
+ */
51
+ searchMemories(projectId: string, queryEmbedding: Float32Array | number[], options?: {
52
+ topK?: number;
53
+ filter?: (m: StoredMemory) => boolean;
54
+ }): Promise<StoredMemory[]>;
55
+ /**
56
+ * Update a memory's embedding
57
+ */
58
+ setMemoryEmbedding(projectId: string, memoryId: string, embedding: Float32Array | number[], content: string): Promise<boolean>;
59
+ /**
60
+ * Get stale memory IDs (embedding out of sync with content)
61
+ */
62
+ getStaleMemoryIds(projectId: string): Promise<string[]>;
63
+ /**
64
+ * Get or create a session
65
+ */
66
+ getOrCreateSession(projectId: string, sessionId: string): Promise<{
67
+ isNew: boolean;
68
+ messageCount: number;
69
+ firstSessionCompleted: boolean;
70
+ }>;
71
+ /**
72
+ * Increment message count for a session
73
+ */
74
+ incrementMessageCount(projectId: string, sessionId: string): Promise<number>;
75
+ /**
76
+ * Mark first session as completed
77
+ */
78
+ markFirstSessionCompleted(projectId: string, sessionId: string): Promise<void>;
79
+ /**
80
+ * Store a session summary
81
+ */
82
+ storeSessionSummary(projectId: string, sessionId: string, summary: string, interactionTone?: string): Promise<string>;
83
+ /**
84
+ * Get the latest session summary for a project
85
+ */
86
+ getLatestSummary(projectId: string): Promise<SessionSummary | null>;
87
+ /**
88
+ * Store a project snapshot
89
+ */
90
+ storeProjectSnapshot(projectId: string, sessionId: string, snapshot: Omit<ProjectSnapshot, 'id' | 'session_id' | 'project_id' | 'created_at'>): Promise<string>;
91
+ /**
92
+ * Get the latest project snapshot
93
+ */
94
+ getLatestSnapshot(projectId: string): Promise<ProjectSnapshot | null>;
95
+ /**
96
+ * Get statistics for a project
97
+ */
98
+ getProjectStats(projectId: string): Promise<{
99
+ totalMemories: number;
100
+ totalSessions: number;
101
+ staleMemories: number;
102
+ latestSession: string | null;
103
+ }>;
104
+ /**
105
+ * Close all project databases
106
+ */
107
+ close(): void;
108
+ }
109
+ /**
110
+ * Create a new memory store
111
+ */
112
+ export declare function createStore(config?: StoreConfig): MemoryStore;
113
+ export {};
@@ -0,0 +1,6 @@
1
+ export { MemoryEngine, createEngine, type EngineConfig, type StorageMode, type ContextRequest, } from './core/engine.ts';
2
+ export { MemoryStore, createStore, type StoreConfig, } from './core/store.ts';
3
+ export { SmartVectorRetrieval, createRetrieval, type SessionContext, } from './core/retrieval.ts';
4
+ export { Curator, createCurator, type CuratorConfig, } from './core/curator.ts';
5
+ export type { CuratedMemory, StoredMemory, SessionSummary, ProjectSnapshot, CurationResult, RetrievalResult, SessionPrimer, ContextType, TemporalRelevance, EmotionalResonance, KnowledgeDomain, CurationTrigger, } from './types/memory.ts';
6
+ export { memorySchema, sessionSummarySchema, projectSnapshotSchema, sessionSchema, type MemorySchema, type SessionSummarySchema, type ProjectSnapshotSchema, type SessionSchema, } from './types/schema.ts';