@synth-coder/memhub 0.2.1 → 0.2.3

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.
Files changed (71) hide show
  1. package/.eslintrc.cjs +45 -45
  2. package/.factory/commands/opsx-apply.md +150 -0
  3. package/.factory/commands/opsx-archive.md +155 -0
  4. package/.factory/commands/opsx-explore.md +171 -0
  5. package/.factory/commands/opsx-propose.md +104 -0
  6. package/.factory/skills/openspec-apply-change/SKILL.md +156 -0
  7. package/.factory/skills/openspec-archive-change/SKILL.md +114 -0
  8. package/.factory/skills/openspec-explore/SKILL.md +288 -0
  9. package/.factory/skills/openspec-propose/SKILL.md +110 -0
  10. package/.github/workflows/ci.yml +74 -74
  11. package/.iflow/commands/opsx-apply.md +152 -152
  12. package/.iflow/commands/opsx-archive.md +157 -157
  13. package/.iflow/commands/opsx-explore.md +173 -173
  14. package/.iflow/commands/opsx-propose.md +106 -106
  15. package/.iflow/skills/openspec-apply-change/SKILL.md +156 -156
  16. package/.iflow/skills/openspec-archive-change/SKILL.md +114 -114
  17. package/.iflow/skills/openspec-explore/SKILL.md +288 -288
  18. package/.iflow/skills/openspec-propose/SKILL.md +110 -110
  19. package/.prettierrc +11 -11
  20. package/AGENTS.md +169 -26
  21. package/README.md +195 -195
  22. package/README.zh-CN.md +193 -193
  23. package/dist/src/contracts/mcp.js +34 -34
  24. package/dist/src/server/mcp-server.d.ts +8 -0
  25. package/dist/src/server/mcp-server.d.ts.map +1 -1
  26. package/dist/src/server/mcp-server.js +23 -2
  27. package/dist/src/server/mcp-server.js.map +1 -1
  28. package/dist/src/services/memory-service.d.ts +1 -0
  29. package/dist/src/services/memory-service.d.ts.map +1 -1
  30. package/dist/src/services/memory-service.js +125 -82
  31. package/dist/src/services/memory-service.js.map +1 -1
  32. package/docs/architecture-diagrams.md +368 -0
  33. package/docs/architecture.md +381 -349
  34. package/docs/contracts.md +190 -119
  35. package/docs/prompt-template.md +33 -79
  36. package/docs/proposals/mcp-typescript-sdk-refactor.md +568 -568
  37. package/docs/proposals/proposal-close-gates.md +58 -58
  38. package/docs/tool-calling-policy.md +101 -107
  39. package/docs/vector-search.md +306 -0
  40. package/package.json +59 -58
  41. package/src/contracts/index.ts +12 -12
  42. package/src/contracts/mcp.ts +222 -222
  43. package/src/contracts/schemas.ts +307 -307
  44. package/src/contracts/types.ts +410 -410
  45. package/src/index.ts +8 -8
  46. package/src/server/index.ts +5 -5
  47. package/src/server/mcp-server.ts +185 -161
  48. package/src/services/embedding-service.ts +114 -114
  49. package/src/services/index.ts +5 -5
  50. package/src/services/memory-service.ts +663 -621
  51. package/src/storage/frontmatter-parser.ts +243 -243
  52. package/src/storage/index.ts +6 -6
  53. package/src/storage/markdown-storage.ts +236 -236
  54. package/src/storage/vector-index.ts +160 -160
  55. package/src/utils/index.ts +5 -5
  56. package/src/utils/slugify.ts +63 -63
  57. package/test/contracts/schemas.test.ts +313 -313
  58. package/test/contracts/types.test.ts +21 -21
  59. package/test/frontmatter-parser-more.test.ts +94 -94
  60. package/test/server/mcp-server.test.ts +210 -169
  61. package/test/services/memory-service-edge.test.ts +248 -248
  62. package/test/services/memory-service.test.ts +278 -278
  63. package/test/storage/frontmatter-parser.test.ts +222 -222
  64. package/test/storage/markdown-storage.test.ts +216 -216
  65. package/test/storage/storage-edge.test.ts +238 -238
  66. package/test/storage/vector-index.test.ts +153 -153
  67. package/test/utils/slugify-edge.test.ts +94 -94
  68. package/test/utils/slugify.test.ts +68 -68
  69. package/tsconfig.json +25 -25
  70. package/tsconfig.test.json +8 -8
  71. package/vitest.config.ts +29 -29
package/package.json CHANGED
@@ -1,58 +1,59 @@
1
- {
2
- "name": "@synth-coder/memhub",
3
- "version": "0.2.1",
4
- "description": "A Git-friendly memory hub using Markdown-based storage with YAML Front Matter",
5
- "type": "module",
6
- "main": "dist/src/index.js",
7
- "types": "dist/src/index.d.ts",
8
- "bin": {
9
- "memhub": "dist/src/server/mcp-server.js"
10
- },
11
- "scripts": {
12
- "prepublishOnly": "npm run build && chmod +x dist/src/server/mcp-server.js",
13
- "build": "tsc",
14
- "dev": "tsc --watch",
15
- "test": "vitest run",
16
- "test:watch": "vitest",
17
- "test:coverage": "vitest run --coverage",
18
- "lint": "eslint src test --ext .ts",
19
- "lint:fix": "eslint src test --ext .ts --fix",
20
- "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\"",
21
- "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\"",
22
- "typecheck": "tsc --noEmit --project tsconfig.json",
23
- "quality": "npm run lint && npm run typecheck && npm run test:coverage",
24
- "ci": "npm run quality"
25
- },
26
- "keywords": [
27
- "mcp",
28
- "memory",
29
- "markdown",
30
- "yaml",
31
- "git-friendly"
32
- ],
33
- "author": "",
34
- "license": "MIT",
35
- "dependencies": {
36
- "@lancedb/lancedb": "^0.26.2",
37
- "@modelcontextprotocol/sdk": "^1.27.1",
38
- "@xenova/transformers": "^2.17.2",
39
- "sharp": "^0.34.5",
40
- "yaml": "^2.8.2",
41
- "zod": "^3.25.76"
42
- },
43
- "devDependencies": {
44
- "@types/node": "^20.19.35",
45
- "@typescript-eslint/eslint-plugin": "^6.21.0",
46
- "@typescript-eslint/parser": "^6.21.0",
47
- "@vitest/coverage-v8": "^1.6.1",
48
- "eslint": "^8.57.1",
49
- "eslint-config-prettier": "^9.1.2",
50
- "eslint-plugin-import": "^2.32.0",
51
- "prettier": "^3.8.1",
52
- "typescript": "^5.9.3",
53
- "vitest": "^1.6.1"
54
- },
55
- "engines": {
56
- "node": ">=18.0.0"
57
- }
58
- }
1
+ {
2
+ "name": "@synth-coder/memhub",
3
+ "version": "0.2.3",
4
+ "description": "A Git-friendly memory hub using Markdown-based storage with YAML Front Matter",
5
+ "type": "module",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
+ "bin": {
9
+ "memhub": "dist/src/server/mcp-server.js"
10
+ },
11
+ "scripts": {
12
+ "build": "tsc",
13
+ "dev": "tsc --watch",
14
+ "test": "vitest run",
15
+ "test:watch": "vitest",
16
+ "test:coverage": "vitest run --coverage",
17
+ "lint": "eslint src test --ext .ts",
18
+ "lint:fix": "eslint src test --ext .ts --fix",
19
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\"",
20
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" \"docs/**/*.md\"",
21
+ "typecheck": "tsc --noEmit --project tsconfig.json",
22
+ "quality": "npm run lint && npm run typecheck && npm run test:coverage",
23
+ "ci": "npm run quality"
24
+ },
25
+ "keywords": [
26
+ "mcp",
27
+ "memory",
28
+ "markdown",
29
+ "yaml",
30
+ "git-friendly"
31
+ ],
32
+ "author": "",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "@lancedb/lancedb": "^0.26.2",
36
+ "@modelcontextprotocol/sdk": "^1.27.1",
37
+ "@xenova/transformers": "^2.17.2",
38
+ "proper-lockfile": "^4.1.2",
39
+ "sharp": "^0.34.5",
40
+ "yaml": "^2.8.2",
41
+ "zod": "^3.25.76"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^20.19.35",
45
+ "@types/proper-lockfile": "^4.1.4",
46
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
47
+ "@typescript-eslint/parser": "^6.21.0",
48
+ "@vitest/coverage-v8": "^1.6.1",
49
+ "eslint": "^8.57.1",
50
+ "eslint-config-prettier": "^9.1.2",
51
+ "eslint-plugin-import": "^2.32.0",
52
+ "prettier": "^3.8.1",
53
+ "typescript": "^5.9.3",
54
+ "vitest": "^1.6.1"
55
+ },
56
+ "engines": {
57
+ "node": ">=18.0.0"
58
+ }
59
+ }
@@ -1,12 +1,12 @@
1
- /**
2
- * Contract exports - Central export point for all types and schemas
3
- */
4
-
5
- // Types
6
- export * from './types.js';
7
-
8
- // Schemas
9
- export * from './schemas.js';
10
-
11
- // MCP protocol types
12
- export * from './mcp.js';
1
+ /**
2
+ * Contract exports - Central export point for all types and schemas
3
+ */
4
+
5
+ // Types
6
+ export * from './types.js';
7
+
8
+ // Schemas
9
+ export * from './schemas.js';
10
+
11
+ // MCP protocol types
12
+ export * from './mcp.js';
@@ -1,223 +1,223 @@
1
- /**
2
- * MCP (Model Context Protocol) specific types and constants
3
- * Tool definitions and business-level types (protocol types provided by SDK)
4
- */
5
-
6
- import type { Memory } from './types.js';
7
-
8
- // ============================================================================
9
- // MCP Protocol Version
10
- // ============================================================================
11
-
12
- /** Current MCP protocol version */
13
- export const MCP_PROTOCOL_VERSION = '2024-11-05';
14
-
15
- /** Server information */
16
- export const SERVER_INFO = {
17
- name: 'memhub',
18
- version: '0.2.0',
19
- } as const;
20
-
21
- // ============================================================================
22
- // MCP Tool Definitions (kept for SDK use)
23
- // ============================================================================
24
-
25
- /** Tool definition for tool/list */
26
- export interface Tool {
27
- name: string;
28
- description: string;
29
- inputSchema: ToolInputSchema;
30
- }
31
-
32
- /** Tool input schema (JSON Schema) */
33
- export interface ToolInputSchema {
34
- type: 'object';
35
- properties?: Record<string, unknown>;
36
- required?: string[];
37
- additionalProperties?: boolean;
38
- }
39
-
40
- // ============================================================================
41
- // MCP Tool List
42
- // ============================================================================
43
-
44
- /** All available tool names */
45
- export const TOOL_NAMES = ['memory_load', 'memory_update'] as const;
46
-
47
- /** Tool name type */
48
- export type ToolName = (typeof TOOL_NAMES)[number];
49
-
50
- /** Tool definitions for MCP server */
51
- export const TOOL_DEFINITIONS: readonly Tool[] = [
52
- {
53
- name: 'memory_load',
54
- description: `Retrieve stored memories to recall user preferences, past decisions, project context, and learned knowledge.
55
-
56
- WHEN TO USE (call proactively):
57
- • Starting a new conversation or task
58
- • User references past discussions ("remember when...", "as I mentioned before")
59
- • Need context about user's coding style, preferences, or project decisions
60
- • Uncertain about user's existing preferences or constraints
61
- • Before making assumptions about user requirements
62
-
63
- WHAT IT PROVIDES:
64
- • User preferences (coding style, frameworks, naming conventions)
65
- • Past decisions and their rationale
66
- • Project-specific context and constraints
67
- • Previously learned knowledge about the user
68
-
69
- Call this early to provide personalized, context-aware responses.`,
70
- inputSchema: {
71
- type: 'object',
72
- properties: {
73
- query: {
74
- type: 'string',
75
- description:
76
- 'Search query to find relevant memories. Examples: "react preferences", "error handling approach", "database choice"',
77
- },
78
- id: {
79
- type: 'string',
80
- description: 'Direct lookup by memory ID (if known)',
81
- },
82
- category: {
83
- type: 'string',
84
- description:
85
- 'Filter by category: "general" (default), "preference", "decision", "knowledge", "project"',
86
- },
87
- tags: {
88
- type: 'array',
89
- items: { type: 'string' },
90
- description: 'Filter by tags. Example: ["typescript", "backend"]',
91
- },
92
- limit: {
93
- type: 'number',
94
- description: 'Max results (default: 20, max: 100)',
95
- },
96
- },
97
- additionalProperties: false,
98
- },
99
- },
100
- {
101
- name: 'memory_update',
102
- description: `Store important information to remember for future conversations.
103
-
104
- WHEN TO USE (call when learning something worth remembering):
105
- • User explicitly states a preference ("I prefer functional components")
106
- • User makes a decision with rationale ("We'll use PostgreSQL because...")
107
- • You discover important project context (tech stack, constraints, patterns)
108
- • User corrects your assumption ("Actually, I don't use Redux")
109
- • Task state changes that should persist
110
-
111
- WHAT TO STORE:
112
- • Preferences: coding style, frameworks, naming conventions
113
- • Decisions: architecture choices, library selections, with reasoning
114
- • Knowledge: project-specific patterns, gotchas, conventions
115
- • Context: team structure, deployment process, testing approach
116
-
117
- TIPS:
118
- • content is required and most important
119
- • title helps with search (auto-generated if omitted)
120
- • Use entryType to categorize: "preference", "decision", "context", "fact"
121
- • importance: 1-5 (default: 3), higher = more critical to remember`,
122
- inputSchema: {
123
- type: 'object',
124
- properties: {
125
- content: {
126
- type: 'string',
127
- description:
128
- 'The information to remember. Be specific and include context. Example: "User prefers TypeScript with strict mode. Uses functional React components with hooks. Avoids class components."',
129
- },
130
- title: {
131
- type: 'string',
132
- description:
133
- 'Brief title for the memory (auto-generated from content if omitted). Example: "TypeScript and React preferences"',
134
- },
135
- entryType: {
136
- type: 'string',
137
- enum: ['preference', 'decision', 'context', 'fact'],
138
- description:
139
- 'Type of memory. "preference" for user likes/dislikes, "decision" for choices made, "context" for project info, "fact" for learned facts',
140
- },
141
- category: {
142
- type: 'string',
143
- description:
144
- 'Category for grouping. Default: "general". Example: "frontend", "backend", "project-alpha"',
145
- },
146
- tags: {
147
- type: 'array',
148
- items: { type: 'string' },
149
- description: 'Tags for filtering. Example: ["typescript", "react", "coding-style"]',
150
- },
151
- importance: {
152
- type: 'number',
153
- description: 'Importance level 1-5. 5 = critical, always recall. Default: 3',
154
- },
155
- },
156
- required: ['content'],
157
- additionalProperties: false,
158
- },
159
- },
160
- ] as const;
161
-
162
- // ============================================================================
163
- // Error Codes (MemHub Custom)
164
- // ============================================================================
165
-
166
- /** MemHub custom error codes */
167
- export const MEMHUB_ERROR_CODES = {
168
- NOT_FOUND: -32001,
169
- STORAGE_ERROR: -32002,
170
- VALIDATION_ERROR: -32003,
171
- DUPLICATE_ERROR: -32004,
172
- } as const;
173
-
174
- /** Combined error codes (includes JSON-RPC standard codes) */
175
- export const ERROR_CODES = {
176
- PARSE_ERROR: -32700,
177
- INVALID_REQUEST: -32600,
178
- METHOD_NOT_FOUND: -32601,
179
- INVALID_PARAMS: -32602,
180
- INTERNAL_ERROR: -32603,
181
- ...MEMHUB_ERROR_CODES,
182
- } as const;
183
-
184
- // ============================================================================
185
- // Utility Types
186
- // ============================================================================
187
-
188
- /** Helper type to extract result type from a tool name */
189
- export type ToolResult<T extends ToolName> = T extends 'memory_load'
190
- ? { items: Memory[]; total: number }
191
- : T extends 'memory_update'
192
- ? {
193
- id: string;
194
- sessionId: string;
195
- filePath: string;
196
- created: boolean;
197
- updated: boolean;
198
- memory: Memory;
199
- }
200
- : never;
201
-
202
- /** Helper type to extract input type from a tool name */
203
- export type ToolInput<T extends ToolName> = T extends 'memory_load'
204
- ? {
205
- id?: string;
206
- query?: string;
207
- category?: string;
208
- tags?: string[];
209
- limit?: number;
210
- }
211
- : T extends 'memory_update'
212
- ? {
213
- id?: string;
214
- sessionId?: string;
215
- mode?: 'append' | 'upsert';
216
- entryType?: 'preference' | 'decision' | 'context' | 'fact';
217
- title?: string;
218
- content: string;
219
- tags?: string[];
220
- category?: string;
221
- importance?: number;
222
- }
1
+ /**
2
+ * MCP (Model Context Protocol) specific types and constants
3
+ * Tool definitions and business-level types (protocol types provided by SDK)
4
+ */
5
+
6
+ import type { Memory } from './types.js';
7
+
8
+ // ============================================================================
9
+ // MCP Protocol Version
10
+ // ============================================================================
11
+
12
+ /** Current MCP protocol version */
13
+ export const MCP_PROTOCOL_VERSION = '2024-11-05';
14
+
15
+ /** Server information */
16
+ export const SERVER_INFO = {
17
+ name: 'memhub',
18
+ version: '0.2.0',
19
+ } as const;
20
+
21
+ // ============================================================================
22
+ // MCP Tool Definitions (kept for SDK use)
23
+ // ============================================================================
24
+
25
+ /** Tool definition for tool/list */
26
+ export interface Tool {
27
+ name: string;
28
+ description: string;
29
+ inputSchema: ToolInputSchema;
30
+ }
31
+
32
+ /** Tool input schema (JSON Schema) */
33
+ export interface ToolInputSchema {
34
+ type: 'object';
35
+ properties?: Record<string, unknown>;
36
+ required?: string[];
37
+ additionalProperties?: boolean;
38
+ }
39
+
40
+ // ============================================================================
41
+ // MCP Tool List
42
+ // ============================================================================
43
+
44
+ /** All available tool names */
45
+ export const TOOL_NAMES = ['memory_load', 'memory_update'] as const;
46
+
47
+ /** Tool name type */
48
+ export type ToolName = (typeof TOOL_NAMES)[number];
49
+
50
+ /** Tool definitions for MCP server */
51
+ export const TOOL_DEFINITIONS: readonly Tool[] = [
52
+ {
53
+ name: 'memory_load',
54
+ description: `Retrieve stored memories to recall user preferences, past decisions, project context, and learned knowledge.
55
+
56
+ WHEN TO USE (call proactively):
57
+ • Starting a new conversation or task
58
+ • User references past discussions ("remember when...", "as I mentioned before")
59
+ • Need context about user's coding style, preferences, or project decisions
60
+ • Uncertain about user's existing preferences or constraints
61
+ • Before making assumptions about user requirements
62
+
63
+ WHAT IT PROVIDES:
64
+ • User preferences (coding style, frameworks, naming conventions)
65
+ • Past decisions and their rationale
66
+ • Project-specific context and constraints
67
+ • Previously learned knowledge about the user
68
+
69
+ Call this early to provide personalized, context-aware responses.`,
70
+ inputSchema: {
71
+ type: 'object',
72
+ properties: {
73
+ query: {
74
+ type: 'string',
75
+ description:
76
+ 'Search query to find relevant memories. Examples: "react preferences", "error handling approach", "database choice"',
77
+ },
78
+ id: {
79
+ type: 'string',
80
+ description: 'Direct lookup by memory ID (if known)',
81
+ },
82
+ category: {
83
+ type: 'string',
84
+ description:
85
+ 'Filter by category: "general" (default), "preference", "decision", "knowledge", "project"',
86
+ },
87
+ tags: {
88
+ type: 'array',
89
+ items: { type: 'string' },
90
+ description: 'Filter by tags. Example: ["typescript", "backend"]',
91
+ },
92
+ limit: {
93
+ type: 'number',
94
+ description: 'Max results (default: 20, max: 100)',
95
+ },
96
+ },
97
+ additionalProperties: false,
98
+ },
99
+ },
100
+ {
101
+ name: 'memory_update',
102
+ description: `Store important information to remember for future conversations.
103
+
104
+ WHEN TO USE (call when learning something worth remembering):
105
+ • User explicitly states a preference ("I prefer functional components")
106
+ • User makes a decision with rationale ("We'll use PostgreSQL because...")
107
+ • You discover important project context (tech stack, constraints, patterns)
108
+ • User corrects your assumption ("Actually, I don't use Redux")
109
+ • Task state changes that should persist
110
+
111
+ WHAT TO STORE:
112
+ • Preferences: coding style, frameworks, naming conventions
113
+ • Decisions: architecture choices, library selections, with reasoning
114
+ • Knowledge: project-specific patterns, gotchas, conventions
115
+ • Context: team structure, deployment process, testing approach
116
+
117
+ TIPS:
118
+ • content is required and most important
119
+ • title helps with search (auto-generated if omitted)
120
+ • Use entryType to categorize: "preference", "decision", "context", "fact"
121
+ • importance: 1-5 (default: 3), higher = more critical to remember`,
122
+ inputSchema: {
123
+ type: 'object',
124
+ properties: {
125
+ content: {
126
+ type: 'string',
127
+ description:
128
+ 'The information to remember. Be specific and include context. Example: "User prefers TypeScript with strict mode. Uses functional React components with hooks. Avoids class components."',
129
+ },
130
+ title: {
131
+ type: 'string',
132
+ description:
133
+ 'Brief title for the memory (auto-generated from content if omitted). Example: "TypeScript and React preferences"',
134
+ },
135
+ entryType: {
136
+ type: 'string',
137
+ enum: ['preference', 'decision', 'context', 'fact'],
138
+ description:
139
+ 'Type of memory. "preference" for user likes/dislikes, "decision" for choices made, "context" for project info, "fact" for learned facts',
140
+ },
141
+ category: {
142
+ type: 'string',
143
+ description:
144
+ 'Category for grouping. Default: "general". Example: "frontend", "backend", "project-alpha"',
145
+ },
146
+ tags: {
147
+ type: 'array',
148
+ items: { type: 'string' },
149
+ description: 'Tags for filtering. Example: ["typescript", "react", "coding-style"]',
150
+ },
151
+ importance: {
152
+ type: 'number',
153
+ description: 'Importance level 1-5. 5 = critical, always recall. Default: 3',
154
+ },
155
+ },
156
+ required: ['content'],
157
+ additionalProperties: false,
158
+ },
159
+ },
160
+ ] as const;
161
+
162
+ // ============================================================================
163
+ // Error Codes (MemHub Custom)
164
+ // ============================================================================
165
+
166
+ /** MemHub custom error codes */
167
+ export const MEMHUB_ERROR_CODES = {
168
+ NOT_FOUND: -32001,
169
+ STORAGE_ERROR: -32002,
170
+ VALIDATION_ERROR: -32003,
171
+ DUPLICATE_ERROR: -32004,
172
+ } as const;
173
+
174
+ /** Combined error codes (includes JSON-RPC standard codes) */
175
+ export const ERROR_CODES = {
176
+ PARSE_ERROR: -32700,
177
+ INVALID_REQUEST: -32600,
178
+ METHOD_NOT_FOUND: -32601,
179
+ INVALID_PARAMS: -32602,
180
+ INTERNAL_ERROR: -32603,
181
+ ...MEMHUB_ERROR_CODES,
182
+ } as const;
183
+
184
+ // ============================================================================
185
+ // Utility Types
186
+ // ============================================================================
187
+
188
+ /** Helper type to extract result type from a tool name */
189
+ export type ToolResult<T extends ToolName> = T extends 'memory_load'
190
+ ? { items: Memory[]; total: number }
191
+ : T extends 'memory_update'
192
+ ? {
193
+ id: string;
194
+ sessionId: string;
195
+ filePath: string;
196
+ created: boolean;
197
+ updated: boolean;
198
+ memory: Memory;
199
+ }
200
+ : never;
201
+
202
+ /** Helper type to extract input type from a tool name */
203
+ export type ToolInput<T extends ToolName> = T extends 'memory_load'
204
+ ? {
205
+ id?: string;
206
+ query?: string;
207
+ category?: string;
208
+ tags?: string[];
209
+ limit?: number;
210
+ }
211
+ : T extends 'memory_update'
212
+ ? {
213
+ id?: string;
214
+ sessionId?: string;
215
+ mode?: 'append' | 'upsert';
216
+ entryType?: 'preference' | 'decision' | 'context' | 'fact';
217
+ title?: string;
218
+ content: string;
219
+ tags?: string[];
220
+ category?: string;
221
+ importance?: number;
222
+ }
223
223
  : never;