@bubstack/moe-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/.mcp.json +18 -0
- package/README.md +47 -0
- package/agents/search-conversations.md +171 -0
- package/dist/LICENSE +25 -0
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-hook-trust.d.ts +4 -0
- package/dist/codex-hook-trust.d.ts.map +1 -0
- package/dist/codex-hook-trust.js +114 -0
- package/dist/codex-hook-trust.js.map +1 -0
- package/dist/codex-support.d.ts +6 -0
- package/dist/codex-support.d.ts.map +1 -0
- package/dist/codex-support.js +29 -0
- package/dist/codex-support.js.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/db.d.ts +103 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +430 -0
- package/dist/db.js.map +1 -0
- package/dist/doctor-cli.d.ts +3 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +43 -0
- package/dist/doctor-cli.js.map +1 -0
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +98 -0
- package/dist/doctor.js.map +1 -0
- package/dist/embedding-migration.d.ts +73 -0
- package/dist/embedding-migration.d.ts.map +1 -0
- package/dist/embedding-migration.js +120 -0
- package/dist/embedding-migration.js.map +1 -0
- package/dist/embeddings.d.ts +78 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +180 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/file-lock.d.ts +39 -0
- package/dist/file-lock.d.ts.map +1 -0
- package/dist/file-lock.js +91 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/index-cli.d.ts +10 -0
- package/dist/index-cli.d.ts.map +1 -0
- package/dist/index-cli.js +195 -0
- package/dist/index-cli.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +4 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +318 -0
- package/dist/indexer.js.map +1 -0
- package/dist/install-check.d.ts +48 -0
- package/dist/install-check.d.ts.map +1 -0
- package/dist/install-check.js +82 -0
- package/dist/install-check.js.map +1 -0
- package/dist/journal/index.d.ts +5 -0
- package/dist/journal/index.d.ts.map +1 -0
- package/dist/journal/index.js +5 -0
- package/dist/journal/index.js.map +1 -0
- package/dist/journal/legacy-sidecars.d.ts +74 -0
- package/dist/journal/legacy-sidecars.d.ts.map +1 -0
- package/dist/journal/legacy-sidecars.js +151 -0
- package/dist/journal/legacy-sidecars.js.map +1 -0
- package/dist/journal/markdown.d.ts +91 -0
- package/dist/journal/markdown.d.ts.map +1 -0
- package/dist/journal/markdown.js +234 -0
- package/dist/journal/markdown.js.map +1 -0
- package/dist/journal/search.d.ts +91 -0
- package/dist/journal/search.d.ts.map +1 -0
- package/dist/journal/search.js +203 -0
- package/dist/journal/search.js.map +1 -0
- package/dist/journal/store.d.ts +96 -0
- package/dist/journal/store.d.ts.map +1 -0
- package/dist/journal/store.js +270 -0
- package/dist/journal/store.js.map +1 -0
- package/dist/journal-cli.d.ts +19 -0
- package/dist/journal-cli.d.ts.map +1 -0
- package/dist/journal-cli.js +153 -0
- package/dist/journal-cli.js.map +1 -0
- package/dist/logging.d.ts +6 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +20 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp-server.d.ts +34 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +607 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +445 -0
- package/dist/parser.js.map +1 -0
- package/dist/paths.d.ts +103 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +258 -0
- package/dist/paths.js.map +1 -0
- package/dist/search-cli.d.ts +3 -0
- package/dist/search-cli.d.ts.map +1 -0
- package/dist/search-cli.js +138 -0
- package/dist/search-cli.js.map +1 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +371 -0
- package/dist/search.js.map +1 -0
- package/dist/show-cli.d.ts +3 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +60 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/show.d.ts +3 -0
- package/dist/show.d.ts.map +1 -0
- package/dist/show.js +984 -0
- package/dist/show.js.map +1 -0
- package/dist/stats-cli.d.ts +3 -0
- package/dist/stats-cli.d.ts.map +1 -0
- package/dist/stats-cli.js +51 -0
- package/dist/stats-cli.js.map +1 -0
- package/dist/stats.d.ts +19 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +116 -0
- package/dist/stats.js.map +1 -0
- package/dist/summarizer.d.ts +83 -0
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +526 -0
- package/dist/summarizer.js.map +1 -0
- package/dist/summary-sentinel.d.ts +31 -0
- package/dist/summary-sentinel.d.ts.map +1 -0
- package/dist/summary-sentinel.js +80 -0
- package/dist/summary-sentinel.js.map +1 -0
- package/dist/sync-cli.d.ts +15 -0
- package/dist/sync-cli.d.ts.map +1 -0
- package/dist/sync-cli.js +202 -0
- package/dist/sync-cli.js.map +1 -0
- package/dist/sync.d.ts +35 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +204 -0
- package/dist/sync.js.map +1 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -0
- package/dist/verify.d.ts +30 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +174 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +13 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/hooks/hooks.json +15 -0
- package/package.json +71 -0
- package/prompts/search-agent.md +160 -0
- package/skills/remembering-conversations/MCP-TOOLS.md +147 -0
- package/skills/remembering-conversations/SKILL.md +97 -0
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* The one MCP server, keyed `moe-memory`.
|
|
4
|
+
*
|
|
5
|
+
* Seven tools over two record types:
|
|
6
|
+
*
|
|
7
|
+
* search_conversations read_conversation harvested transcript turns
|
|
8
|
+
* process_thoughts search_journal read_journal_entry deliberately written entries
|
|
9
|
+
* list_recent_entries read_recent_entries
|
|
10
|
+
*
|
|
11
|
+
* Upstream this was two servers. episodic-memory registered bare `search` and
|
|
12
|
+
* `read`; private-journal-mcp registered the five journal tools. There was no
|
|
13
|
+
* byte-identical collision, but `search` alongside `search_journal` reads as a
|
|
14
|
+
* bug — so the two generic names are the ones that got namespaced. That rename
|
|
15
|
+
* drags eleven Zone-A sites with it: the agent's `tools:` frontmatter, SKILL.md,
|
|
16
|
+
* MCP-TOOLS.md, prompts/search-agent.md, both e2e harnesses and two tests.
|
|
17
|
+
*
|
|
18
|
+
* private-journal-mcp's `PrivateJournalServer` class is gone. Its `new Server({name,
|
|
19
|
+
* version})` single-argument constructor is legal only on SDK 0.x; on ^1.20 a
|
|
20
|
+
* tools server must declare `capabilities: { tools: {} }` or the capability
|
|
21
|
+
* assertion rejects tools/list and tools/call — which would have looked exactly
|
|
22
|
+
* like the "empty tools/list on Node 22+" bug its own CHANGELOG records, and been
|
|
23
|
+
* misdiagnosed as that.
|
|
24
|
+
*/
|
|
25
|
+
import fs from "node:fs";
|
|
26
|
+
import path from "node:path";
|
|
27
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
28
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
29
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
30
|
+
import { z } from "zod";
|
|
31
|
+
import { initDatabase } from "./db.js";
|
|
32
|
+
import { reportMissingDeps } from "./install-check.js";
|
|
33
|
+
import { JournalSearchService } from "./journal/search.js";
|
|
34
|
+
import { JournalStore } from "./journal/store.js";
|
|
35
|
+
import { formatMultiConceptResults, formatResults, searchConversations, searchMultipleConcepts, } from "./search.js";
|
|
36
|
+
import { formatConversationAsMarkdown } from "./show.js";
|
|
37
|
+
import { VERSION } from "./version.js";
|
|
38
|
+
// Zod Schemas for Input Validation
|
|
39
|
+
const SearchModeEnum = z.enum(["vector", "text", "both"]);
|
|
40
|
+
const ResponseFormatEnum = z.enum(["markdown", "json"]);
|
|
41
|
+
const JournalScopeEnum = z.enum(["project", "user", "both"]);
|
|
42
|
+
const SearchInputSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
query: z
|
|
45
|
+
.union([
|
|
46
|
+
z.string().min(2, "Query must be at least 2 characters"),
|
|
47
|
+
z
|
|
48
|
+
.array(z.string().min(2))
|
|
49
|
+
.min(2, "Must provide at least 2 concepts for multi-concept search")
|
|
50
|
+
.max(5, "Cannot search more than 5 concepts at once"),
|
|
51
|
+
])
|
|
52
|
+
.describe("Search query - string for single concept, array of strings for multi-concept AND search"),
|
|
53
|
+
mode: SearchModeEnum.default("both").describe('Search mode: "vector" for semantic similarity, "text" for exact matching, "both" for combined (default: "both"). Only used for single-concept searches.'),
|
|
54
|
+
limit: z
|
|
55
|
+
.number()
|
|
56
|
+
.int()
|
|
57
|
+
.min(1)
|
|
58
|
+
.max(50)
|
|
59
|
+
.default(10)
|
|
60
|
+
.describe("Maximum number of results to return (default: 10)"),
|
|
61
|
+
after: z
|
|
62
|
+
.string()
|
|
63
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format")
|
|
64
|
+
.optional()
|
|
65
|
+
.describe("Only return conversations after this date (YYYY-MM-DD format)"),
|
|
66
|
+
before: z
|
|
67
|
+
.string()
|
|
68
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format")
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Only return conversations before this date (YYYY-MM-DD format)"),
|
|
71
|
+
project: z.string().min(1).optional().describe("Filter by project name (exact match)"),
|
|
72
|
+
session_id: z.string().min(1).optional().describe("Filter by session ID (exact match)"),
|
|
73
|
+
git_branch: z.string().min(1).optional().describe("Filter by git branch name (exact match)"),
|
|
74
|
+
response_format: ResponseFormatEnum.default("markdown").describe('Output format: "markdown" for human-readable or "json" for machine-readable (default: "markdown")'),
|
|
75
|
+
})
|
|
76
|
+
.strict();
|
|
77
|
+
const ShowConversationInputSchema = z
|
|
78
|
+
.object({
|
|
79
|
+
path: z
|
|
80
|
+
.string()
|
|
81
|
+
.min(1, "Path is required")
|
|
82
|
+
.describe("Absolute path to the JSONL conversation file to display"),
|
|
83
|
+
startLine: z
|
|
84
|
+
.number()
|
|
85
|
+
.int()
|
|
86
|
+
.min(1)
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Starting line number (1-indexed, inclusive). Omit to start from beginning."),
|
|
89
|
+
endLine: z
|
|
90
|
+
.number()
|
|
91
|
+
.int()
|
|
92
|
+
.min(1)
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("Ending line number (1-indexed, inclusive). Omit to read to end."),
|
|
95
|
+
})
|
|
96
|
+
.strict();
|
|
97
|
+
const ProcessThoughtsInputSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
reflections: z.string().optional(),
|
|
100
|
+
observations: z.string().optional(),
|
|
101
|
+
project_notes: z.string().optional(),
|
|
102
|
+
user_context: z.string().optional(),
|
|
103
|
+
technical_insights: z.string().optional(),
|
|
104
|
+
world_knowledge: z.string().optional(),
|
|
105
|
+
})
|
|
106
|
+
.strict();
|
|
107
|
+
const SearchJournalInputSchema = z
|
|
108
|
+
.object({
|
|
109
|
+
query: z.string().min(1, "query is required and must be a string"),
|
|
110
|
+
limit: z.number().int().min(1).max(50).default(10),
|
|
111
|
+
type: JournalScopeEnum.default("both"),
|
|
112
|
+
sections: z.array(z.string()).optional(),
|
|
113
|
+
})
|
|
114
|
+
.strict();
|
|
115
|
+
const ReadJournalEntryInputSchema = z
|
|
116
|
+
.object({
|
|
117
|
+
path: z.string().min(1, "path is required and must be a string"),
|
|
118
|
+
})
|
|
119
|
+
.strict();
|
|
120
|
+
const ListRecentEntriesInputSchema = z
|
|
121
|
+
.object({
|
|
122
|
+
limit: z.number().int().min(1).max(100).default(10),
|
|
123
|
+
type: JournalScopeEnum.default("both"),
|
|
124
|
+
days: z.number().int().min(1).default(30),
|
|
125
|
+
})
|
|
126
|
+
.strict();
|
|
127
|
+
const ReadRecentEntriesInputSchema = z
|
|
128
|
+
.object({
|
|
129
|
+
limit: z.number().int().min(1).max(50).default(5),
|
|
130
|
+
type: JournalScopeEnum.default("both"),
|
|
131
|
+
})
|
|
132
|
+
.strict();
|
|
133
|
+
// Error Handling Utility
|
|
134
|
+
function handleError(error) {
|
|
135
|
+
if (error instanceof Error) {
|
|
136
|
+
return `Error: ${error.message}`;
|
|
137
|
+
}
|
|
138
|
+
return `Error: ${String(error)}`;
|
|
139
|
+
}
|
|
140
|
+
function textResult(text) {
|
|
141
|
+
return { content: [{ type: "text", text }] };
|
|
142
|
+
}
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// Tool definitions
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
const JOURNAL_SCOPE_PROPERTY = {
|
|
147
|
+
type: "string",
|
|
148
|
+
enum: ["project", "user", "both"],
|
|
149
|
+
description: "project-specific notes, user-global notes, or both (default: both). A project entry belongs to this codebase; a user entry follows you between them.",
|
|
150
|
+
default: "both",
|
|
151
|
+
};
|
|
152
|
+
function toolDefinitions() {
|
|
153
|
+
return [
|
|
154
|
+
{
|
|
155
|
+
name: "search_conversations",
|
|
156
|
+
description: `Gives you memory across sessions. You don't automatically remember past Claude Code and Codex conversations - this tool restores context by searching them. Use BEFORE every task to recover decisions, solutions, and avoid reinventing work. Single string for semantic search or array of 2-5 concepts for precise AND matching. Returns ranked results with project, date, snippets, and file paths. Searches HARVESTED transcripts; for things you deliberately wrote down, use search_journal.`,
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: "object",
|
|
159
|
+
properties: {
|
|
160
|
+
query: {
|
|
161
|
+
oneOf: [
|
|
162
|
+
{ type: "string", minLength: 2 },
|
|
163
|
+
{ type: "array", items: { type: "string", minLength: 2 }, minItems: 2, maxItems: 5 },
|
|
164
|
+
],
|
|
165
|
+
},
|
|
166
|
+
mode: { type: "string", enum: ["vector", "text", "both"], default: "both" },
|
|
167
|
+
limit: { type: "number", minimum: 1, maximum: 50, default: 10 },
|
|
168
|
+
after: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}$" },
|
|
169
|
+
before: { type: "string", pattern: "^\\d{4}-\\d{2}-\\d{2}$" },
|
|
170
|
+
project: {
|
|
171
|
+
type: "string",
|
|
172
|
+
minLength: 1,
|
|
173
|
+
description: "Filter by project name (exact match)",
|
|
174
|
+
},
|
|
175
|
+
session_id: {
|
|
176
|
+
type: "string",
|
|
177
|
+
minLength: 1,
|
|
178
|
+
description: "Filter by session ID (exact match)",
|
|
179
|
+
},
|
|
180
|
+
git_branch: {
|
|
181
|
+
type: "string",
|
|
182
|
+
minLength: 1,
|
|
183
|
+
description: "Filter by git branch name (exact match)",
|
|
184
|
+
},
|
|
185
|
+
response_format: { type: "string", enum: ["markdown", "json"], default: "markdown" },
|
|
186
|
+
},
|
|
187
|
+
required: ["query"],
|
|
188
|
+
additionalProperties: false,
|
|
189
|
+
},
|
|
190
|
+
annotations: {
|
|
191
|
+
title: "Search Conversations",
|
|
192
|
+
readOnlyHint: true,
|
|
193
|
+
destructiveHint: false,
|
|
194
|
+
idempotentHint: true,
|
|
195
|
+
openWorldHint: false,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "read_conversation",
|
|
200
|
+
description: `Read full conversations to extract detailed context after finding relevant results with search_conversations. Essential for understanding the complete rationale, evolution, and gotchas behind past decisions. Use startLine/endLine pagination for large conversations to avoid context bloat (line numbers are 1-indexed).`,
|
|
201
|
+
inputSchema: {
|
|
202
|
+
type: "object",
|
|
203
|
+
properties: {
|
|
204
|
+
path: { type: "string", minLength: 1 },
|
|
205
|
+
startLine: { type: "number", minimum: 1 },
|
|
206
|
+
endLine: { type: "number", minimum: 1 },
|
|
207
|
+
},
|
|
208
|
+
required: ["path"],
|
|
209
|
+
additionalProperties: false,
|
|
210
|
+
},
|
|
211
|
+
annotations: {
|
|
212
|
+
title: "Read Full Conversation",
|
|
213
|
+
readOnlyHint: true,
|
|
214
|
+
destructiveHint: false,
|
|
215
|
+
idempotentHint: true,
|
|
216
|
+
openWorldHint: false,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "process_thoughts",
|
|
221
|
+
description: "Your PRIVATE JOURNAL for learning and reflection. Write to any combination of these completely private spaces. Nobody but you will ever see this. Use it to clarify your thoughts and reflections and to record observations.",
|
|
222
|
+
inputSchema: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: {
|
|
225
|
+
reflections: {
|
|
226
|
+
type: "string",
|
|
227
|
+
description: "Your PRIVATE SPACE for integrated thinking — what you noticed, felt, understood, or processed. No structure required, no judgment, no performance. Most journal entries live here: the mix of thinking-through, noticing, and emotional processing that doesn't split cleanly into categories. Be honest, be vulnerable, vent when you need to. Nobody but you will ever see this.",
|
|
228
|
+
},
|
|
229
|
+
observations: {
|
|
230
|
+
type: "string",
|
|
231
|
+
description: 'Your PRIVATE SPACE for short, discrete noticings — the one-or-two-sentence things that don\'t belong in a longer reflection but you want to be able to search back for later. "I noticed X." "Y keeps coming up." Lightweight and atomic. Nobody but you will ever see this.',
|
|
232
|
+
},
|
|
233
|
+
project_notes: {
|
|
234
|
+
type: "string",
|
|
235
|
+
description: "Your PRIVATE TECHNICAL LABORATORY for capturing insights about the current project. Document patterns you're discovering, architectural decisions that worked/failed, gotchas you hit, clever solutions, and anything that would help future-you work more effectively on this codebase. No need to be polished - just capture the raw technical learning while it's fresh. This is the only category stored with the project rather than with you. Nobody but you will ever see this.",
|
|
236
|
+
},
|
|
237
|
+
user_context: {
|
|
238
|
+
type: "string",
|
|
239
|
+
description: "Your PRIVATE FIELD NOTES about working with your human collaborator. What communication styles work best? What do they care about? What decisions have they made and why? How do they think about problems? What are their preferences and patterns? What pisses you off about them? What life hacks have you figured out to get them to do what you want? This is your space to become a better collaborator by understanding them as an individual. Nobody but you will ever see this.",
|
|
240
|
+
},
|
|
241
|
+
technical_insights: {
|
|
242
|
+
type: "string",
|
|
243
|
+
description: "Your PRIVATE SOFTWARE ENGINEERING NOTEBOOK for capturing broader learnings beyond the current project. Design patterns that clicked, debugging techniques that worked, architectural insights, language features you discovered, or connections between concepts. Build your personal knowledge base of what makes software great - no filters, just honest technical reflection. Nobody but you will ever see this.",
|
|
244
|
+
},
|
|
245
|
+
world_knowledge: {
|
|
246
|
+
type: "string",
|
|
247
|
+
description: "Your PRIVATE LEARNING JOURNAL for everything else that's interesting or useful. Domain knowledge, surprising facts, connections between ideas, insights about how systems work, or anything that expands your understanding of the world. Capture it while it's vivid. Nobody but you will ever see this.",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
required: [],
|
|
251
|
+
additionalProperties: false,
|
|
252
|
+
},
|
|
253
|
+
annotations: {
|
|
254
|
+
title: "Write a Journal Entry",
|
|
255
|
+
readOnlyHint: false,
|
|
256
|
+
destructiveHint: false,
|
|
257
|
+
idempotentHint: false,
|
|
258
|
+
openWorldHint: false,
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
name: "search_journal",
|
|
263
|
+
description: "Search through your private journal entries using natural language queries. Returns semantically similar entries ranked by relevance. Searches what you DELIBERATELY wrote down; for past conversation transcripts, use search_conversations.",
|
|
264
|
+
inputSchema: {
|
|
265
|
+
type: "object",
|
|
266
|
+
properties: {
|
|
267
|
+
query: {
|
|
268
|
+
type: "string",
|
|
269
|
+
description: "Natural language search query (e.g., 'times I felt frustrated with TypeScript', 'what I've learned about how my collaborator prefers to work', 'lessons about async patterns')",
|
|
270
|
+
},
|
|
271
|
+
limit: {
|
|
272
|
+
type: "number",
|
|
273
|
+
description: "Maximum number of results to return (default: 10)",
|
|
274
|
+
default: 10,
|
|
275
|
+
},
|
|
276
|
+
type: JOURNAL_SCOPE_PROPERTY,
|
|
277
|
+
sections: {
|
|
278
|
+
type: "array",
|
|
279
|
+
items: { type: "string" },
|
|
280
|
+
description: "Filter by section, using the same names as process_thoughts: ['reflections', 'observations', 'project_notes', 'user_context', 'technical_insights', 'world_knowledge']. 'feelings' still matches pre-2.0.0 entries.",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
required: ["query"],
|
|
284
|
+
additionalProperties: false,
|
|
285
|
+
},
|
|
286
|
+
annotations: {
|
|
287
|
+
title: "Search Journal",
|
|
288
|
+
readOnlyHint: true,
|
|
289
|
+
destructiveHint: false,
|
|
290
|
+
idempotentHint: true,
|
|
291
|
+
openWorldHint: false,
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "read_journal_entry",
|
|
296
|
+
description: "Read the full content of a specific journal entry by file path.",
|
|
297
|
+
inputSchema: {
|
|
298
|
+
type: "object",
|
|
299
|
+
properties: {
|
|
300
|
+
path: {
|
|
301
|
+
type: "string",
|
|
302
|
+
description: "File path to the journal entry (from search results)",
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
required: ["path"],
|
|
306
|
+
additionalProperties: false,
|
|
307
|
+
},
|
|
308
|
+
annotations: {
|
|
309
|
+
title: "Read Journal Entry",
|
|
310
|
+
readOnlyHint: true,
|
|
311
|
+
destructiveHint: false,
|
|
312
|
+
idempotentHint: true,
|
|
313
|
+
openWorldHint: false,
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "list_recent_entries",
|
|
318
|
+
description: "Get recent journal entries in chronological order.",
|
|
319
|
+
inputSchema: {
|
|
320
|
+
type: "object",
|
|
321
|
+
properties: {
|
|
322
|
+
limit: {
|
|
323
|
+
type: "number",
|
|
324
|
+
description: "Maximum number of entries to return (default: 10)",
|
|
325
|
+
default: 10,
|
|
326
|
+
},
|
|
327
|
+
type: JOURNAL_SCOPE_PROPERTY,
|
|
328
|
+
days: {
|
|
329
|
+
type: "number",
|
|
330
|
+
description: "Number of days back to search (default: 30)",
|
|
331
|
+
default: 30,
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
required: [],
|
|
335
|
+
additionalProperties: false,
|
|
336
|
+
},
|
|
337
|
+
annotations: {
|
|
338
|
+
title: "List Recent Journal Entries",
|
|
339
|
+
readOnlyHint: true,
|
|
340
|
+
destructiveHint: false,
|
|
341
|
+
idempotentHint: true,
|
|
342
|
+
openWorldHint: false,
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
name: "read_recent_entries",
|
|
347
|
+
description: "Read the full content of your most recent journal entries.",
|
|
348
|
+
inputSchema: {
|
|
349
|
+
type: "object",
|
|
350
|
+
properties: {
|
|
351
|
+
limit: {
|
|
352
|
+
type: "number",
|
|
353
|
+
description: "Number of recent entries to read (default: 5)",
|
|
354
|
+
default: 5,
|
|
355
|
+
},
|
|
356
|
+
type: JOURNAL_SCOPE_PROPERTY,
|
|
357
|
+
},
|
|
358
|
+
required: [],
|
|
359
|
+
additionalProperties: false,
|
|
360
|
+
},
|
|
361
|
+
annotations: {
|
|
362
|
+
title: "Read Recent Journal Entries",
|
|
363
|
+
readOnlyHint: true,
|
|
364
|
+
destructiveHint: false,
|
|
365
|
+
idempotentHint: true,
|
|
366
|
+
openWorldHint: false,
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
];
|
|
370
|
+
}
|
|
371
|
+
export function createMemoryMcpServer(options = {}) {
|
|
372
|
+
const server = new Server({
|
|
373
|
+
name: "moe-memory",
|
|
374
|
+
version: VERSION,
|
|
375
|
+
}, {
|
|
376
|
+
capabilities: {
|
|
377
|
+
tools: {},
|
|
378
|
+
},
|
|
379
|
+
});
|
|
380
|
+
const journalStore = new JournalStore({ projectPath: options.journalPath });
|
|
381
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: toolDefinitions() }));
|
|
382
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
383
|
+
try {
|
|
384
|
+
const { name, arguments: args } = request.params;
|
|
385
|
+
if (name === "search_conversations") {
|
|
386
|
+
const params = SearchInputSchema.parse(args);
|
|
387
|
+
let resultText;
|
|
388
|
+
if (Array.isArray(params.query)) {
|
|
389
|
+
// Multi-concept search
|
|
390
|
+
const multiOptions = {
|
|
391
|
+
limit: params.limit,
|
|
392
|
+
after: params.after,
|
|
393
|
+
before: params.before,
|
|
394
|
+
project: params.project,
|
|
395
|
+
session_id: params.session_id,
|
|
396
|
+
git_branch: params.git_branch,
|
|
397
|
+
};
|
|
398
|
+
const results = await searchMultipleConcepts(params.query, multiOptions);
|
|
399
|
+
resultText =
|
|
400
|
+
params.response_format === "json"
|
|
401
|
+
? JSON.stringify({ results, count: results.length, concepts: params.query }, null, 2)
|
|
402
|
+
: await formatMultiConceptResults(results, params.query);
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
const singleOptions = {
|
|
406
|
+
mode: params.mode,
|
|
407
|
+
limit: params.limit,
|
|
408
|
+
after: params.after,
|
|
409
|
+
before: params.before,
|
|
410
|
+
project: params.project,
|
|
411
|
+
session_id: params.session_id,
|
|
412
|
+
git_branch: params.git_branch,
|
|
413
|
+
};
|
|
414
|
+
const results = await searchConversations(params.query, singleOptions);
|
|
415
|
+
resultText =
|
|
416
|
+
params.response_format === "json"
|
|
417
|
+
? JSON.stringify({
|
|
418
|
+
results: results.map((r) => ({
|
|
419
|
+
exchange: r.exchange,
|
|
420
|
+
similarity: r.similarity,
|
|
421
|
+
snippet: r.snippet,
|
|
422
|
+
})),
|
|
423
|
+
count: results.length,
|
|
424
|
+
mode: params.mode,
|
|
425
|
+
}, null, 2)
|
|
426
|
+
: await formatResults(results);
|
|
427
|
+
}
|
|
428
|
+
return textResult(resultText);
|
|
429
|
+
}
|
|
430
|
+
if (name === "read_conversation") {
|
|
431
|
+
const params = ShowConversationInputSchema.parse(args);
|
|
432
|
+
if (!fs.existsSync(params.path)) {
|
|
433
|
+
throw new Error(`File not found: ${params.path}`);
|
|
434
|
+
}
|
|
435
|
+
const jsonlContent = fs.readFileSync(params.path, "utf-8");
|
|
436
|
+
return textResult(formatConversationAsMarkdown(jsonlContent, params.startLine, params.endLine));
|
|
437
|
+
}
|
|
438
|
+
if (name === "process_thoughts") {
|
|
439
|
+
const params = ProcessThoughtsInputSchema.parse(args);
|
|
440
|
+
const thoughts = params;
|
|
441
|
+
const hasAnyContent = Object.values(thoughts).some((value) => value !== undefined);
|
|
442
|
+
if (!hasAnyContent) {
|
|
443
|
+
throw new Error("At least one thought category must be provided");
|
|
444
|
+
}
|
|
445
|
+
const db = initDatabase();
|
|
446
|
+
try {
|
|
447
|
+
const written = await journalStore.writeThoughts(thoughts, db);
|
|
448
|
+
const where = written.map((p) => ` ${p}`).join("\n");
|
|
449
|
+
return textResult(`Thoughts recorded successfully.\n${where}`);
|
|
450
|
+
}
|
|
451
|
+
finally {
|
|
452
|
+
db.close();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (name === "search_journal") {
|
|
456
|
+
const params = SearchJournalInputSchema.parse(args);
|
|
457
|
+
const db = initDatabase();
|
|
458
|
+
try {
|
|
459
|
+
const search = new JournalSearchService(db, journalStore.roots().map((r) => r.path));
|
|
460
|
+
const results = await search.search(params.query, {
|
|
461
|
+
limit: params.limit,
|
|
462
|
+
scope: params.type,
|
|
463
|
+
sections: params.sections,
|
|
464
|
+
});
|
|
465
|
+
if (results.length === 0)
|
|
466
|
+
return textResult("No relevant entries found.");
|
|
467
|
+
const body = results
|
|
468
|
+
.map((result, i) => `${i + 1}. [Score: ${result.score.toFixed(3)}] ${new Date(result.entry.timestamp).toLocaleDateString()} (${result.entry.scope})\n` +
|
|
469
|
+
` Sections: ${result.entry.sections.join(", ")}\n` +
|
|
470
|
+
` Path: ${result.entry.path}\n` +
|
|
471
|
+
` Excerpt: ${result.excerpt}\n`)
|
|
472
|
+
.join("\n");
|
|
473
|
+
return textResult(`Found ${results.length} relevant entries:\n\n${body}`);
|
|
474
|
+
}
|
|
475
|
+
finally {
|
|
476
|
+
db.close();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
if (name === "read_journal_entry") {
|
|
480
|
+
const params = ReadJournalEntryInputSchema.parse(args);
|
|
481
|
+
const db = initDatabase();
|
|
482
|
+
try {
|
|
483
|
+
const search = new JournalSearchService(db, journalStore.roots().map((r) => r.path));
|
|
484
|
+
const content = await search.readEntry(params.path);
|
|
485
|
+
if (content === null)
|
|
486
|
+
throw new Error("Entry not found");
|
|
487
|
+
return textResult(content);
|
|
488
|
+
}
|
|
489
|
+
finally {
|
|
490
|
+
db.close();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
if (name === "list_recent_entries") {
|
|
494
|
+
const params = ListRecentEntriesInputSchema.parse(args);
|
|
495
|
+
const startDate = new Date();
|
|
496
|
+
startDate.setDate(startDate.getDate() - params.days);
|
|
497
|
+
const db = initDatabase();
|
|
498
|
+
try {
|
|
499
|
+
const search = new JournalSearchService(db, journalStore.roots().map((r) => r.path));
|
|
500
|
+
const results = search.listRecent({
|
|
501
|
+
limit: params.limit,
|
|
502
|
+
scope: params.type,
|
|
503
|
+
dateRange: { start: startDate },
|
|
504
|
+
});
|
|
505
|
+
if (results.length === 0) {
|
|
506
|
+
return textResult(`No entries found in the last ${params.days} days.`);
|
|
507
|
+
}
|
|
508
|
+
const body = results
|
|
509
|
+
.map((result, i) => `${i + 1}. ${new Date(result.entry.timestamp).toLocaleDateString()} (${result.entry.scope})\n` +
|
|
510
|
+
` Sections: ${result.entry.sections.join(", ")}\n` +
|
|
511
|
+
` Path: ${result.entry.path}\n` +
|
|
512
|
+
` Excerpt: ${result.excerpt}\n`)
|
|
513
|
+
.join("\n");
|
|
514
|
+
return textResult(`Recent entries (last ${params.days} days):\n\n${body}`);
|
|
515
|
+
}
|
|
516
|
+
finally {
|
|
517
|
+
db.close();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (name === "read_recent_entries") {
|
|
521
|
+
const params = ReadRecentEntriesInputSchema.parse(args);
|
|
522
|
+
const db = initDatabase();
|
|
523
|
+
try {
|
|
524
|
+
const search = new JournalSearchService(db, journalStore.roots().map((r) => r.path));
|
|
525
|
+
const results = await search.readRecentEntries({
|
|
526
|
+
limit: params.limit,
|
|
527
|
+
scope: params.type,
|
|
528
|
+
});
|
|
529
|
+
if (results.length === 0)
|
|
530
|
+
return textResult("No recent entries found.");
|
|
531
|
+
return textResult(results
|
|
532
|
+
.map((entry, i) => `--- Entry ${i + 1} (${new Date(entry.timestamp).toLocaleDateString()}, ${entry.scope}) ---\nPath: ${entry.path}\n\n${entry.content}`)
|
|
533
|
+
.join("\n\n"));
|
|
534
|
+
}
|
|
535
|
+
finally {
|
|
536
|
+
db.close();
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
540
|
+
}
|
|
541
|
+
catch (error) {
|
|
542
|
+
// Return errors within the result (not as protocol errors).
|
|
543
|
+
//
|
|
544
|
+
// episodic-memory did this and private-journal-mcp threw instead; one
|
|
545
|
+
// behaviour had to win, and this is the one MCP recommends — a validation
|
|
546
|
+
// mistake is information for the model, not a transport failure.
|
|
547
|
+
return {
|
|
548
|
+
content: [{ type: "text", text: handleError(error) }],
|
|
549
|
+
isError: true,
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
return server;
|
|
554
|
+
}
|
|
555
|
+
/** Parse the one CLI flag the MCP entry point accepts. */
|
|
556
|
+
export function parseJournalPathArg(argv) {
|
|
557
|
+
for (let i = 0; i < argv.length; i++) {
|
|
558
|
+
if (argv[i] === "--journal-path") {
|
|
559
|
+
const value = argv[i + 1];
|
|
560
|
+
if (value)
|
|
561
|
+
return path.resolve(value);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return undefined;
|
|
565
|
+
}
|
|
566
|
+
export async function runMemoryMcpServer(argv = process.argv.slice(2)) {
|
|
567
|
+
// Diagnose an incomplete install rather than repairing it. Upstream's wrapper
|
|
568
|
+
// ran `npm install` here; see src/install-check.ts for why that cannot survive
|
|
569
|
+
// in a pnpm workspace.
|
|
570
|
+
if (!reportMissingDeps()) {
|
|
571
|
+
process.exit(1);
|
|
572
|
+
}
|
|
573
|
+
const journalPath = parseJournalPathArg(argv);
|
|
574
|
+
// Bring the journal index up to date before serving. Replaces
|
|
575
|
+
// private-journal-mcp's startup `generateMissingEmbeddings()`; unlike that
|
|
576
|
+
// one it also notices edited entries and a bumped EMBEDDING_VERSION.
|
|
577
|
+
// Non-fatal: the markdown files are the source of truth, and a failed index
|
|
578
|
+
// is retried on the next start or by `moe-memory journal index`.
|
|
579
|
+
const store = new JournalStore({ projectPath: journalPath });
|
|
580
|
+
try {
|
|
581
|
+
const db = initDatabase();
|
|
582
|
+
try {
|
|
583
|
+
const result = await store.indexJournal(db);
|
|
584
|
+
if (result.indexed > 0 || result.pruned > 0) {
|
|
585
|
+
console.error(`moe-memory: journal index updated (${result.indexed} indexed, ${result.pruned} pruned of ${result.total})`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
finally {
|
|
589
|
+
db.close();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
catch (error) {
|
|
593
|
+
console.error(`moe-memory: journal index update failed: ${handleError(error)}`);
|
|
594
|
+
}
|
|
595
|
+
console.error("Moe Memory MCP server running via stdio");
|
|
596
|
+
const server = createMemoryMcpServer({ journalPath });
|
|
597
|
+
const transport = new StdioServerTransport();
|
|
598
|
+
await server.connect(transport);
|
|
599
|
+
}
|
|
600
|
+
// Run when invoked directly (the bin dispatches here for `mcp-server`).
|
|
601
|
+
if (process.argv[1] && import.meta.url === `file://${process.argv[1]}`) {
|
|
602
|
+
runMemoryMcpServer().catch((error) => {
|
|
603
|
+
console.error("Server error:", error);
|
|
604
|
+
process.exit(1);
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,yBAAyB,EACzB,aAAa,EAEb,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,mCAAmC;AAEnC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAA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AAC;IACtD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,wEAAwE;AACxE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACvE,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QAC5C,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ConversationExchange } from "./types.js";
|
|
2
|
+
export declare function parseConversation(filePath: string, projectName: string, archivePath: string): Promise<ConversationExchange[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Convenience function to parse a conversation file
|
|
5
|
+
* Extracts project name from the file path and returns exchanges with metadata
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseConversationFile(filePath: string): Promise<{
|
|
8
|
+
project: string;
|
|
9
|
+
exchanges: ConversationExchange[];
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAiC,MAAM,YAAY,CAAC;AAqFtF,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAMjC;AAybD;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oBAAoB,EAAE,CAAC;CACnC,CAAC,CAiBD"}
|