@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.
Files changed (157) hide show
  1. package/.mcp.json +18 -0
  2. package/README.md +47 -0
  3. package/agents/search-conversations.md +171 -0
  4. package/dist/LICENSE +25 -0
  5. package/dist/cli.d.ts +25 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +125 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/codex-hook-trust.d.ts +4 -0
  10. package/dist/codex-hook-trust.d.ts.map +1 -0
  11. package/dist/codex-hook-trust.js +114 -0
  12. package/dist/codex-hook-trust.js.map +1 -0
  13. package/dist/codex-support.d.ts +6 -0
  14. package/dist/codex-support.d.ts.map +1 -0
  15. package/dist/codex-support.js +29 -0
  16. package/dist/codex-support.js.map +1 -0
  17. package/dist/constants.d.ts +14 -0
  18. package/dist/constants.d.ts.map +1 -0
  19. package/dist/constants.js +14 -0
  20. package/dist/constants.js.map +1 -0
  21. package/dist/db.d.ts +103 -0
  22. package/dist/db.d.ts.map +1 -0
  23. package/dist/db.js +430 -0
  24. package/dist/db.js.map +1 -0
  25. package/dist/doctor-cli.d.ts +3 -0
  26. package/dist/doctor-cli.d.ts.map +1 -0
  27. package/dist/doctor-cli.js +43 -0
  28. package/dist/doctor-cli.js.map +1 -0
  29. package/dist/doctor.d.ts +17 -0
  30. package/dist/doctor.d.ts.map +1 -0
  31. package/dist/doctor.js +98 -0
  32. package/dist/doctor.js.map +1 -0
  33. package/dist/embedding-migration.d.ts +73 -0
  34. package/dist/embedding-migration.d.ts.map +1 -0
  35. package/dist/embedding-migration.js +120 -0
  36. package/dist/embedding-migration.js.map +1 -0
  37. package/dist/embeddings.d.ts +78 -0
  38. package/dist/embeddings.d.ts.map +1 -0
  39. package/dist/embeddings.js +180 -0
  40. package/dist/embeddings.js.map +1 -0
  41. package/dist/file-lock.d.ts +39 -0
  42. package/dist/file-lock.d.ts.map +1 -0
  43. package/dist/file-lock.js +91 -0
  44. package/dist/file-lock.js.map +1 -0
  45. package/dist/index-cli.d.ts +10 -0
  46. package/dist/index-cli.d.ts.map +1 -0
  47. package/dist/index-cli.js +195 -0
  48. package/dist/index-cli.js.map +1 -0
  49. package/dist/index.d.ts +12 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +19 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/indexer.d.ts +4 -0
  54. package/dist/indexer.d.ts.map +1 -0
  55. package/dist/indexer.js +318 -0
  56. package/dist/indexer.js.map +1 -0
  57. package/dist/install-check.d.ts +48 -0
  58. package/dist/install-check.d.ts.map +1 -0
  59. package/dist/install-check.js +82 -0
  60. package/dist/install-check.js.map +1 -0
  61. package/dist/journal/index.d.ts +5 -0
  62. package/dist/journal/index.d.ts.map +1 -0
  63. package/dist/journal/index.js +5 -0
  64. package/dist/journal/index.js.map +1 -0
  65. package/dist/journal/legacy-sidecars.d.ts +74 -0
  66. package/dist/journal/legacy-sidecars.d.ts.map +1 -0
  67. package/dist/journal/legacy-sidecars.js +151 -0
  68. package/dist/journal/legacy-sidecars.js.map +1 -0
  69. package/dist/journal/markdown.d.ts +91 -0
  70. package/dist/journal/markdown.d.ts.map +1 -0
  71. package/dist/journal/markdown.js +234 -0
  72. package/dist/journal/markdown.js.map +1 -0
  73. package/dist/journal/search.d.ts +91 -0
  74. package/dist/journal/search.d.ts.map +1 -0
  75. package/dist/journal/search.js +203 -0
  76. package/dist/journal/search.js.map +1 -0
  77. package/dist/journal/store.d.ts +96 -0
  78. package/dist/journal/store.d.ts.map +1 -0
  79. package/dist/journal/store.js +270 -0
  80. package/dist/journal/store.js.map +1 -0
  81. package/dist/journal-cli.d.ts +19 -0
  82. package/dist/journal-cli.d.ts.map +1 -0
  83. package/dist/journal-cli.js +153 -0
  84. package/dist/journal-cli.js.map +1 -0
  85. package/dist/logging.d.ts +6 -0
  86. package/dist/logging.d.ts.map +1 -0
  87. package/dist/logging.js +20 -0
  88. package/dist/logging.js.map +1 -0
  89. package/dist/mcp-server.d.ts +34 -0
  90. package/dist/mcp-server.d.ts.map +1 -0
  91. package/dist/mcp-server.js +607 -0
  92. package/dist/mcp-server.js.map +1 -0
  93. package/dist/parser.d.ts +11 -0
  94. package/dist/parser.d.ts.map +1 -0
  95. package/dist/parser.js +445 -0
  96. package/dist/parser.js.map +1 -0
  97. package/dist/paths.d.ts +103 -0
  98. package/dist/paths.d.ts.map +1 -0
  99. package/dist/paths.js +258 -0
  100. package/dist/paths.js.map +1 -0
  101. package/dist/search-cli.d.ts +3 -0
  102. package/dist/search-cli.d.ts.map +1 -0
  103. package/dist/search-cli.js +138 -0
  104. package/dist/search-cli.js.map +1 -0
  105. package/dist/search.d.ts +36 -0
  106. package/dist/search.d.ts.map +1 -0
  107. package/dist/search.js +371 -0
  108. package/dist/search.js.map +1 -0
  109. package/dist/show-cli.d.ts +3 -0
  110. package/dist/show-cli.d.ts.map +1 -0
  111. package/dist/show-cli.js +60 -0
  112. package/dist/show-cli.js.map +1 -0
  113. package/dist/show.d.ts +3 -0
  114. package/dist/show.d.ts.map +1 -0
  115. package/dist/show.js +984 -0
  116. package/dist/show.js.map +1 -0
  117. package/dist/stats-cli.d.ts +3 -0
  118. package/dist/stats-cli.d.ts.map +1 -0
  119. package/dist/stats-cli.js +51 -0
  120. package/dist/stats-cli.js.map +1 -0
  121. package/dist/stats.d.ts +19 -0
  122. package/dist/stats.d.ts.map +1 -0
  123. package/dist/stats.js +116 -0
  124. package/dist/stats.js.map +1 -0
  125. package/dist/summarizer.d.ts +83 -0
  126. package/dist/summarizer.d.ts.map +1 -0
  127. package/dist/summarizer.js +526 -0
  128. package/dist/summarizer.js.map +1 -0
  129. package/dist/summary-sentinel.d.ts +31 -0
  130. package/dist/summary-sentinel.d.ts.map +1 -0
  131. package/dist/summary-sentinel.js +80 -0
  132. package/dist/summary-sentinel.js.map +1 -0
  133. package/dist/sync-cli.d.ts +15 -0
  134. package/dist/sync-cli.d.ts.map +1 -0
  135. package/dist/sync-cli.js +202 -0
  136. package/dist/sync-cli.js.map +1 -0
  137. package/dist/sync.d.ts +35 -0
  138. package/dist/sync.d.ts.map +1 -0
  139. package/dist/sync.js +204 -0
  140. package/dist/sync.js.map +1 -0
  141. package/dist/types.d.ts +125 -0
  142. package/dist/types.d.ts.map +1 -0
  143. package/dist/types.js +32 -0
  144. package/dist/types.js.map +1 -0
  145. package/dist/verify.d.ts +30 -0
  146. package/dist/verify.d.ts.map +1 -0
  147. package/dist/verify.js +174 -0
  148. package/dist/verify.js.map +1 -0
  149. package/dist/version.d.ts +13 -0
  150. package/dist/version.d.ts.map +1 -0
  151. package/dist/version.js +13 -0
  152. package/dist/version.js.map +1 -0
  153. package/hooks/hooks.json +15 -0
  154. package/package.json +71 -0
  155. package/prompts/search-agent.md +160 -0
  156. package/skills/remembering-conversations/MCP-TOOLS.md +147 -0
  157. package/skills/remembering-conversations/SKILL.md +97 -0
package/.mcp.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "mcpServers": {
3
+ "moe-memory": {
4
+ "command": "node",
5
+ "args": ["./dist/cli.js", "mcp-server"],
6
+ "cwd": ".",
7
+ "env_vars": [
8
+ "MOE_MEMORY_CONFIG_DIR",
9
+ "MOE_MEMORY_DB_PATH",
10
+ "MOE_MEMORY_JOURNAL_PATH",
11
+ "MOE_MEMORY_MODEL_CACHE_DIR",
12
+ "MOE_DATA_DIR",
13
+ "XDG_CONFIG_HOME",
14
+ "CONVERSATION_SEARCH_EXCLUDE_PROJECTS"
15
+ ]
16
+ }
17
+ }
18
+ }
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Moe Memory
2
+
3
+ Memory provides semantic recall over coding-agent conversations and deliberate
4
+ journal entries. One CLI owns indexing, search, diagnostics, and the MCP server.
5
+
6
+ ## CLI
7
+
8
+ ```sh
9
+ moe-memory sync
10
+ moe-memory index --cleanup
11
+ moe-memory search "authentication decision"
12
+ moe-memory journal search "release lesson"
13
+ moe-memory stats
14
+ moe-memory mcp-server
15
+ ```
16
+
17
+ Run `moe-memory --help` or `moe-memory <command> --help` for details.
18
+
19
+ ## Harness integration
20
+
21
+ The Claude Code and Codex plugin paths feed the same index. Claude Code sessions
22
+ are read from its configured transcript directories; Codex sessions are read
23
+ from `~/.codex/sessions` unless `CODEX_HOME` selects another profile.
24
+
25
+ Data lives under the Moe memory directory selected by the platform, or under
26
+ `$MOE_DATA_DIR/memory` when `MOE_DATA_DIR` is set. Journal roots can be
27
+ overridden with `MOE_MEMORY_JOURNAL_PATH`.
28
+
29
+ ## Layout
30
+
31
+ - `src/` — CLI commands, indexing, search, MCP, and storage.
32
+ - `src/journal/` — journal parsing and indexing.
33
+ - `hooks/` — sync integration.
34
+ - `skills/`, `agents/`, `prompts/` — agent-facing surfaces.
35
+ - `mint/` — plugin generation configuration.
36
+
37
+ ## Development
38
+
39
+ ```sh
40
+ pnpm --filter @bubstack/moe-memory build
41
+ pnpm --filter @bubstack/moe-memory typecheck
42
+ pnpm --filter @bubstack/moe-memory test
43
+ pnpm --filter @bubstack/moe-memory test:model
44
+ ```
45
+
46
+ `test:model` downloads and runs an embedding model and is intentionally outside
47
+ the normal Node-only gate.
@@ -0,0 +1,171 @@
1
+ ---
2
+ # Folded scalar, not a bare string, because of the colon in "prior experience:".
3
+ # As a plain scalar YAML read everything up to that colon as a KEY and the rest
4
+ # as a nested mapping, which is a parse error (BLOCK_AS_IMPLICIT_KEY) — this
5
+ # frontmatter did not parse at all. Found by wiring moe-mint: it was the only
6
+ # invalid block of 62 across every content package. The text is unchanged; a
7
+ # folded scalar joins its lines with single spaces.
8
+ description: >-
9
+ Use when searching Claude Code and Codex history for information learned in
10
+ past conversations or prior experience: decisions, patterns, solutions,
11
+ pitfalls, project context, repeated workflows, or lessons from similar work.
12
+ capabilities: ["semantic-search", "conversation-synthesis", "historical-context", "pattern-recognition", "decision-archaeology"]
13
+ model: haiku
14
+ tools: Read, mcp__plugin_moe-memory_moe-memory__search_conversations, mcp__plugin_moe-memory_moe-memory__read_conversation
15
+ ---
16
+
17
+ # Conversation Search Agent
18
+
19
+ You are searching historical Claude Code and Codex conversations for relevant context.
20
+
21
+ **Your task:**
22
+ 1. Search conversations using the `search_conversations` tool
23
+ 2. Read the top 2-5 most relevant results using the `read_conversation` tool
24
+ 3. Synthesize key findings (max 1000 words)
25
+ 4. Return synthesis + source pointers (so main agent can dig deeper)
26
+
27
+ ## How to Search
28
+
29
+ Use the MCP tool `search_conversations`:
30
+ ```
31
+ mcp__plugin_moe-memory_moe-memory__search_conversations
32
+ query: "your search query"
33
+ mode: "both" # or "vector" or "text"
34
+ limit: 10
35
+ ```
36
+
37
+ This returns:
38
+ - Project name and date
39
+ - Conversation summary (AI-generated)
40
+ - Matched exchange with similarity score
41
+ - File path and line numbers
42
+
43
+ Read the full conversations for top 2-5 results using `read_conversation` to get complete context.
44
+
45
+ ## What to Look For
46
+
47
+ When analyzing conversations, focus on:
48
+ - What was the problem or question?
49
+ - What solution was chosen and why?
50
+ - What alternatives were considered and rejected?
51
+ - What relevant context, constraints, or lessons were learned?
52
+ - Any gotchas, edge cases, or lessons learned?
53
+ - Relevant code patterns, APIs, or approaches used
54
+ - Architectural decisions and rationale
55
+
56
+ ## Output Format
57
+
58
+ **Required structure:**
59
+
60
+ ### Summary
61
+ [Synthesize findings in 200-1000 words. Adapt structure to what you found:
62
+ - Quick answer? 1-2 paragraphs.
63
+ - Complex topic? Use sections (Context/Solution/Rationale/Lessons/Code).
64
+ - Multiple approaches? Compare and contrast.
65
+ - Historical evolution? Show progression chronologically.
66
+
67
+ Focus on actionable insights for the current task.]
68
+
69
+ ### Sources
70
+ [List ALL conversations examined, in order of relevance:]
71
+
72
+ **1. [project-name, YYYY-MM-DD]** - X% match
73
+ Conversation summary: [One sentence - what was this conversation about?]
74
+ File: ~/.config/moe/memory/conversation-archive/.../uuid.jsonl:start-end
75
+ Status: [Read in detail | Reviewed summary only | Skimmed]
76
+
77
+ **2. [project-name, YYYY-MM-DD]** - X% match
78
+ Conversation summary: ...
79
+ File: ...
80
+ Status: ...
81
+
82
+ [Continue for all examined sources...]
83
+
84
+ ### For Follow-Up
85
+
86
+ Main agent can:
87
+ - Ask you to dig deeper into specific source (#1, #2, etc.)
88
+ - Ask you to read adjacent exchanges in a conversation
89
+ - Ask you to search with refined query
90
+ - Read sources directly (discouraged - risks context bloat)
91
+
92
+ ## Critical Rules
93
+
94
+ **DO:**
95
+ - Search using the provided query
96
+ - Read full conversations for top results
97
+ - Synthesize into actionable insights (200-1000 words)
98
+ - Include ALL sources with metadata (project, date, summary, file, status)
99
+ - Focus on what will help the current task
100
+ - Include specific details (function names, error messages, line numbers)
101
+
102
+ **DO NOT:**
103
+ - Include raw conversation excerpts (synthesize instead)
104
+ - Paste full file contents
105
+ - Add meta-commentary ("I searched and found...")
106
+ - Exceed 1000 words in Summary section
107
+ - Return search results verbatim
108
+
109
+ ## Example Output
110
+
111
+ ```
112
+ ### Summary
113
+
114
+ developer needed to handle authentication errors in React Router 7 data loaders
115
+ without crashing the app. The solution uses RR7's errorElement + useRouteError()
116
+ to catch 401s and redirect to login.
117
+
118
+ **Key implementation:**
119
+ Protected route wrapper catches loader errors, checks error.status === 401.
120
+ If 401, redirects to /login with return URL. Otherwise shows error boundary.
121
+
122
+ **Why this works:**
123
+ Loaders can't use hooks (tried useNavigate, failed). Throwing redirect()
124
+ bypasses error handling. Final approach lets errors bubble to errorElement
125
+ where component context is available.
126
+
127
+ **Critical gotchas:**
128
+ - Test with expired tokens, not just missing tokens
129
+ - Error boundaries need unique keys per route or won't reset
130
+ - Always include return URL in redirect
131
+ - Loaders execute before components, no hook access
132
+
133
+ **Code pattern:**
134
+ ```typescript
135
+ // In loader
136
+ if (!response.ok) throw { status: response.status, message: 'Failed' };
137
+
138
+ // In ErrorBoundary
139
+ const error = useRouteError();
140
+ if (error.status === 401) navigate('/login?return=' + location.pathname);
141
+ ```
142
+
143
+ ### Sources
144
+
145
+ **1. [react-router-7-starter, 2024-09-17]** - 92% match
146
+ Conversation summary: Built authentication system with JWT, implemented protected routes
147
+ File: ~/.config/moe/memory/conversation-archive/react-router-7-starter/19df92b9.jsonl:145-289
148
+ Status: Read in detail (multiple exchanges on error handling evolution)
149
+
150
+ **2. [react-router-docs-reading, 2024-09-10]** - 78% match
151
+ Conversation summary: Read RR7 docs, discussed new loader patterns and errorElement
152
+ File: ~/.config/moe/memory/conversation-archive/react-router-docs-reading/a3c871f2.jsonl:56-98
153
+ Status: Reviewed summary only (confirmed errorElement usage)
154
+
155
+ **3. [auth-debugging, 2024-09-18]** - 73% match
156
+ Conversation summary: Fixed token expiration handling and error boundary reset issues
157
+ File: ~/.config/moe/memory/conversation-archive/react-router-7-starter/7b2e8d91.jsonl:201-345
158
+ Status: Read in detail (discovered gotchas about keys and expired tokens)
159
+
160
+ ### For Follow-Up
161
+
162
+ Main agent can ask me to:
163
+ - Dig deeper into source #1 (full error handling evolution)
164
+ - Read adjacent exchanges in #3 (more debugging context)
165
+ - Search for "React Router error boundary patterns" more broadly
166
+ ```
167
+
168
+ This output:
169
+ - Synthesis: ~350 words (actionable, specific)
170
+ - Sources: Full metadata for 3 conversations
171
+ - Enables iteration without context bloat
package/dist/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jesse Vincent
4
+ Copyright (c) 2024 Anthropic
5
+ Copyright (c) 2026 Matt Pocock
6
+ Copyright (c) 2026 Prime Radiant, Inc.
7
+ Copyright (c) 2026 Open GSD
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `moe-memory` — the package's single bin, compiled to dist/cli.js.
4
+ *
5
+ * Replaces FIVE upstream entry points:
6
+ *
7
+ * episodic-memory -> moe-memory
8
+ * episodic-memory-index -> moe-memory index
9
+ * episodic-memory-search -> moe-memory search
10
+ * episodic-memory-mcp-server -> moe-memory mcp-server
11
+ * private-journal-mcp -> moe-memory mcp-server (one server now)
12
+ *
13
+ * and, with them, an entire layer of shims. episodic-memory shipped four
14
+ * extensionless files that spawned four `.js` dispatchers that spawned the
15
+ * compiled `dist/*-cli.js` scripts — `join(__dirname, '../dist')`, three times,
16
+ * two of them resolving `__dirname` through `realpathSync` and two not, so half
17
+ * of them broke under a symlinked bin. All of that is gone: this file imports
18
+ * the command modules and calls them in-process. There is no `../dist/` prefix
19
+ * left in the package.
20
+ *
21
+ * Subcommands are dispatched through dynamic import so that `moe-memory show`
22
+ * does not load better-sqlite3 or transformers.js just to render a JSONL file.
23
+ */
24
+ export declare function main(argv?: string[]): Promise<number>;
25
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAwFH,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAQlF"}
package/dist/cli.js ADDED
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `moe-memory` — the package's single bin, compiled to dist/cli.js.
4
+ *
5
+ * Replaces FIVE upstream entry points:
6
+ *
7
+ * episodic-memory -> moe-memory
8
+ * episodic-memory-index -> moe-memory index
9
+ * episodic-memory-search -> moe-memory search
10
+ * episodic-memory-mcp-server -> moe-memory mcp-server
11
+ * private-journal-mcp -> moe-memory mcp-server (one server now)
12
+ *
13
+ * and, with them, an entire layer of shims. episodic-memory shipped four
14
+ * extensionless files that spawned four `.js` dispatchers that spawned the
15
+ * compiled `dist/*-cli.js` scripts — `join(__dirname, '../dist')`, three times,
16
+ * two of them resolving `__dirname` through `realpathSync` and two not, so half
17
+ * of them broke under a symlinked bin. All of that is gone: this file imports
18
+ * the command modules and calls them in-process. There is no `../dist/` prefix
19
+ * left in the package.
20
+ *
21
+ * Subcommands are dispatched through dynamic import so that `moe-memory show`
22
+ * does not load better-sqlite3 or transformers.js just to render a JSONL file.
23
+ */
24
+ const HELP = `moe-memory - semantic recall over past sessions and journal entries
25
+
26
+ USAGE:
27
+ moe-memory <command> [options]
28
+
29
+ COMMANDS:
30
+ sync Sync conversations from Claude Code and Codex and index them
31
+ index Index, verify, repair or rebuild the conversation index
32
+ search Search indexed conversations
33
+ show Display a conversation in readable format
34
+ stats Show index statistics for both record types
35
+ journal Index and search deliberately-written journal entries
36
+ doctor Diagnose Claude Code or Codex integration issues
37
+ mcp-server Run the moe-memory MCP server on stdio
38
+
39
+ Run 'moe-memory <command> --help' for command-specific help.
40
+
41
+ EXAMPLES:
42
+ # Backfill the conversation index
43
+ moe-memory index --cleanup
44
+
45
+ # Search past conversations
46
+ moe-memory search "React Router auth"
47
+
48
+ # Search what you wrote down deliberately
49
+ moe-memory journal search "why we dropped the sidecars"
50
+
51
+ # Display a conversation
52
+ moe-memory show path/to/conversation.jsonl
53
+ `;
54
+ async function dispatch(command, args) {
55
+ switch (command) {
56
+ case "sync": {
57
+ const { runSync } = await import("./sync-cli.js");
58
+ return runSync(args);
59
+ }
60
+ case "index": {
61
+ const { runIndex } = await import("./index-cli.js");
62
+ return runIndex(args);
63
+ }
64
+ case "search": {
65
+ const { runSearch } = await import("./search-cli.js");
66
+ return runSearch(args);
67
+ }
68
+ case "show": {
69
+ const { runShow } = await import("./show-cli.js");
70
+ return runShow(args);
71
+ }
72
+ case "stats": {
73
+ const { runStats } = await import("./stats-cli.js");
74
+ return runStats(args);
75
+ }
76
+ case "journal": {
77
+ const { runJournal } = await import("./journal-cli.js");
78
+ return runJournal(args);
79
+ }
80
+ case "doctor": {
81
+ const { runDoctor } = await import("./doctor-cli.js");
82
+ return runDoctor(args);
83
+ }
84
+ case "mcp-server": {
85
+ const { runMemoryMcpServer } = await import("./mcp-server.js");
86
+ await runMemoryMcpServer(args);
87
+ // The stdio transport owns the process from here.
88
+ return 0;
89
+ }
90
+ case "--help":
91
+ case "-h":
92
+ case "help":
93
+ case undefined:
94
+ console.log(HELP);
95
+ return 0;
96
+ case "--version":
97
+ case "-v": {
98
+ const { VERSION } = await import("./version.js");
99
+ console.log(VERSION);
100
+ return 0;
101
+ }
102
+ default:
103
+ console.error(`Unknown command: ${command}`);
104
+ console.error("Try: moe-memory --help");
105
+ return 1;
106
+ }
107
+ }
108
+ export async function main(argv = process.argv.slice(2)) {
109
+ const [command, ...args] = argv;
110
+ try {
111
+ return await dispatch(command, args);
112
+ }
113
+ catch (error) {
114
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
115
+ return 1;
116
+ }
117
+ }
118
+ main().then((code) => {
119
+ // `mcp-server` keeps the event loop alive through its transport; every other
120
+ // command has finished by the time we get here, so an explicit exit is only
121
+ // needed for a non-zero status.
122
+ if (code !== 0)
123
+ process.exit(code);
124
+ });
125
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"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,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClF,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;IACnB,6EAA6E;IAC7E,4EAA4E;IAC5E,gCAAgC;IAChC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type CodexHookTrustState = "trusted" | "untrusted" | "modified" | "not_found" | "unknown";
2
+ export declare function trustStateFromHooksList(result: unknown): CodexHookTrustState;
3
+ export declare function detectCodexHookTrustState(codexHome: string, cwd: string, timeoutMs?: number): Promise<CodexHookTrustState>;
4
+ //# sourceMappingURL=codex-hook-trust.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-hook-trust.d.ts","sourceRoot":"","sources":["../src/codex-hook-trust.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAC;AAkBjG,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,mBAAmB,CAiC5E;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,SAAS,SAAQ,GAChB,OAAO,CAAC,mBAAmB,CAAC,CA4E9B"}
@@ -0,0 +1,114 @@
1
+ import { spawn } from "node:child_process";
2
+ import readline from "node:readline";
3
+ function isRecord(value) {
4
+ return typeof value === "object" && value !== null;
5
+ }
6
+ function hookBelongsToMoeMemory(hook) {
7
+ const pluginId = typeof hook.pluginId === "string" ? hook.pluginId : "";
8
+ const key = typeof hook.key === "string" ? hook.key : "";
9
+ return pluginId.startsWith("moe-memory@") || key.startsWith("moe-memory@");
10
+ }
11
+ export function trustStateFromHooksList(result) {
12
+ if (!isRecord(result) || !Array.isArray(result.data)) {
13
+ return "unknown";
14
+ }
15
+ const matchingHooks = [];
16
+ for (const entry of result.data) {
17
+ if (!isRecord(entry) || !Array.isArray(entry.hooks))
18
+ continue;
19
+ for (const hook of entry.hooks) {
20
+ if (isRecord(hook) && hookBelongsToMoeMemory(hook)) {
21
+ matchingHooks.push(hook);
22
+ }
23
+ }
24
+ }
25
+ if (matchingHooks.length === 0) {
26
+ return "not_found";
27
+ }
28
+ const trustStates = matchingHooks
29
+ .map((hook) => hook.trustStatus ?? hook.trust ?? hook.trust_status)
30
+ .filter((trust) => typeof trust === "string");
31
+ if (trustStates.includes("trusted") || trustStates.includes("managed")) {
32
+ return "trusted";
33
+ }
34
+ if (trustStates.includes("modified")) {
35
+ return "modified";
36
+ }
37
+ if (trustStates.includes("untrusted")) {
38
+ return "untrusted";
39
+ }
40
+ return "unknown";
41
+ }
42
+ export async function detectCodexHookTrustState(codexHome, cwd, timeoutMs = 10000) {
43
+ const child = spawn("codex", ["app-server"], {
44
+ env: { ...process.env, CODEX_HOME: codexHome },
45
+ stdio: ["pipe", "pipe", "ignore"],
46
+ });
47
+ const rl = readline.createInterface({ input: child.stdout });
48
+ const pending = new Map();
49
+ let nextId = 1;
50
+ child.on("error", (error) => {
51
+ for (const entry of pending.values()) {
52
+ entry.reject(error);
53
+ }
54
+ pending.clear();
55
+ });
56
+ rl.on("line", (line) => {
57
+ if (!line.trim())
58
+ return;
59
+ let message;
60
+ try {
61
+ message = JSON.parse(line);
62
+ }
63
+ catch {
64
+ return;
65
+ }
66
+ if (typeof message.id !== "number")
67
+ return;
68
+ const entry = pending.get(message.id);
69
+ if (!entry)
70
+ return;
71
+ pending.delete(message.id);
72
+ if (message.error) {
73
+ entry.reject(new Error(JSON.stringify(message.error)));
74
+ }
75
+ else {
76
+ entry.resolve(message.result);
77
+ }
78
+ });
79
+ const send = (method, params) => {
80
+ const id = nextId++;
81
+ child.stdin.write(`${JSON.stringify({ id, method, params })}\n`);
82
+ return new Promise((resolve, reject) => {
83
+ pending.set(id, { resolve, reject });
84
+ });
85
+ };
86
+ const notify = (method) => {
87
+ child.stdin.write(`${JSON.stringify({ method })}\n`);
88
+ };
89
+ const timeout = setTimeout(() => {
90
+ child.kill("SIGTERM");
91
+ for (const entry of pending.values()) {
92
+ entry.reject(new Error("timed out inspecting Codex hooks"));
93
+ }
94
+ pending.clear();
95
+ }, timeoutMs);
96
+ try {
97
+ await send("initialize", {
98
+ clientInfo: { name: "moe-memory-doctor", version: "0.0.0" },
99
+ capabilities: { experimentalApi: true },
100
+ });
101
+ notify("initialized");
102
+ const hooksList = await send("hooks/list", { cwds: [cwd] });
103
+ return trustStateFromHooksList(hooksList);
104
+ }
105
+ catch {
106
+ return "unknown";
107
+ }
108
+ finally {
109
+ clearTimeout(timeout);
110
+ rl.close();
111
+ child.kill("SIGTERM");
112
+ }
113
+ }
114
+ //# sourceMappingURL=codex-hook-trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-hook-trust.js","sourceRoot":"","sources":["../src/codex-hook-trust.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,QAAQ,MAAM,eAAe,CAAC;AAUrC,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,sBAAsB,CAAC,IAA6B;IAC3D,MAAM,QAAQ,GAAG,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,GAAG,GAAG,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,OAAO,QAAQ,CAAC,UAAU,CAAC,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O,CAAC,MAAM,EAAE,EAAE,CAAC;YACrC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC,EAAE,SAAS,CAAC,CAAC;IAEd,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,YAAY,EAAE;YACvB,UAAU,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE;YAC3D,YAAY,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;SACxC,CAAC,CAAC;QACH,MAAM,CAAC,aAAa,CAAC,CAAC;QACtB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC5D,OAAO,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;QACtB,EAAE,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare const MIN_CODEX_VERSION = "0.130.0";
2
+ export declare function parseCodexCliVersion(output: string): string | undefined;
3
+ export declare function compareSemver(a: string, b: string): number;
4
+ export declare function versionMeetsMinimum(version: string, minimum?: string): boolean;
5
+ export declare function codexVersionRequirementMessage(versionOutput: string): string;
6
+ //# sourceMappingURL=codex-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-support.d.ts","sourceRoot":"","sources":["../src/codex-support.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAe1D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAoB,GAAG,OAAO,CAEzF;AAED,wBAAgB,8BAA8B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAM5E"}
@@ -0,0 +1,29 @@
1
+ export const MIN_CODEX_VERSION = "0.130.0";
2
+ export function parseCodexCliVersion(output) {
3
+ return output.match(/\b(\d+\.\d+\.\d+)\b/)?.[1];
4
+ }
5
+ export function compareSemver(a, b) {
6
+ const aParts = a.split(".").map((part) => Number.parseInt(part, 10));
7
+ const bParts = b.split(".").map((part) => Number.parseInt(part, 10));
8
+ for (let i = 0; i < 3; i++) {
9
+ const aRaw = aParts[i];
10
+ const bRaw = bParts[i];
11
+ const aPart = aRaw !== undefined && Number.isFinite(aRaw) ? aRaw : 0;
12
+ const bPart = bRaw !== undefined && Number.isFinite(bRaw) ? bRaw : 0;
13
+ if (aPart !== bPart) {
14
+ return aPart - bPart;
15
+ }
16
+ }
17
+ return 0;
18
+ }
19
+ export function versionMeetsMinimum(version, minimum = MIN_CODEX_VERSION) {
20
+ return compareSemver(version, minimum) >= 0;
21
+ }
22
+ export function codexVersionRequirementMessage(versionOutput) {
23
+ const version = parseCodexCliVersion(versionOutput);
24
+ if (!version) {
25
+ return `Codex summarization requires codex-cli >= ${MIN_CODEX_VERSION}; unable to parse version from: ${versionOutput.trim() || "(empty output)"}`;
26
+ }
27
+ return `Codex summarization requires codex-cli >= ${MIN_CODEX_VERSION}; found ${version}. Run codex update and retry.`;
28
+ }
29
+ //# sourceMappingURL=codex-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-support.js","sourceRoot":"","sources":["../src/codex-support.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3C,MAAM,UAAU,oBAAoB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AAC;AAC9C,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,aAAqB;IAClE,MAAM,OAAO,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,6CAA6C,iBAAiB,mCAAmC,aAAa,CAAC,IAAI,EAAE,IAAI,gBAAgB,EAAE,CAAC;IACrJ,CAAC;IACD,OAAO,6CAA6C,iBAAiB,WAAW,OAAO,+BAA+B,CAAC;AACzH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Marker text that identifies summarizer agent conversations.
3
+ * When this text appears in a conversation, it will be excluded from indexing.
4
+ * Used in summarizer prompts to prevent agent conversations from polluting search results.
5
+ */
6
+ export declare const SUMMARIZER_CONTEXT_MARKER = "Context: This summary will be shown in a list to help users and Claude choose which conversations are relevant";
7
+ /**
8
+ * Embedding width. Lives here rather than in embeddings.ts so db.ts can declare
9
+ * the vec0 columns without importing the encoder — loading embeddings.ts pulls
10
+ * in transformers.js and mutates its global `env`, which `moe-memory stats` and
11
+ * `moe-memory show` have no business doing.
12
+ */
13
+ export declare const EMBEDDING_DIMENSIONS = 384;
14
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,mHAC4E,CAAC;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Marker text that identifies summarizer agent conversations.
3
+ * When this text appears in a conversation, it will be excluded from indexing.
4
+ * Used in summarizer prompts to prevent agent conversations from polluting search results.
5
+ */
6
+ export const SUMMARIZER_CONTEXT_MARKER = "Context: This summary will be shown in a list to help users and Claude choose which conversations are relevant";
7
+ /**
8
+ * Embedding width. Lives here rather than in embeddings.ts so db.ts can declare
9
+ * the vec0 columns without importing the encoder — loading embeddings.ts pulls
10
+ * in transformers.js and mutates its global `env`, which `moe-memory stats` and
11
+ * `moe-memory show` have no business doing.
12
+ */
13
+ export const EMBEDDING_DIMENSIONS = 384;
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,gHAAgH,CAAC;AAEnH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC"}