cccmemory 1.8.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 (216) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/dist/ConversationMemory.d.ts +231 -0
  4. package/dist/ConversationMemory.d.ts.map +1 -0
  5. package/dist/ConversationMemory.js +357 -0
  6. package/dist/ConversationMemory.js.map +1 -0
  7. package/dist/cache/QueryCache.d.ts +215 -0
  8. package/dist/cache/QueryCache.d.ts.map +1 -0
  9. package/dist/cache/QueryCache.js +294 -0
  10. package/dist/cache/QueryCache.js.map +1 -0
  11. package/dist/cli/commands.d.ts +9 -0
  12. package/dist/cli/commands.d.ts.map +1 -0
  13. package/dist/cli/commands.js +954 -0
  14. package/dist/cli/commands.js.map +1 -0
  15. package/dist/cli/help.d.ts +16 -0
  16. package/dist/cli/help.d.ts.map +1 -0
  17. package/dist/cli/help.js +361 -0
  18. package/dist/cli/help.js.map +1 -0
  19. package/dist/cli/index.d.ts +30 -0
  20. package/dist/cli/index.d.ts.map +1 -0
  21. package/dist/cli/index.js +111 -0
  22. package/dist/cli/index.js.map +1 -0
  23. package/dist/context/ContextInjector.d.ts +38 -0
  24. package/dist/context/ContextInjector.d.ts.map +1 -0
  25. package/dist/context/ContextInjector.js +235 -0
  26. package/dist/context/ContextInjector.js.map +1 -0
  27. package/dist/documentation/CodeAnalyzer.d.ts +29 -0
  28. package/dist/documentation/CodeAnalyzer.d.ts.map +1 -0
  29. package/dist/documentation/CodeAnalyzer.js +122 -0
  30. package/dist/documentation/CodeAnalyzer.js.map +1 -0
  31. package/dist/documentation/ConversationAnalyzer.d.ts +19 -0
  32. package/dist/documentation/ConversationAnalyzer.d.ts.map +1 -0
  33. package/dist/documentation/ConversationAnalyzer.js +157 -0
  34. package/dist/documentation/ConversationAnalyzer.js.map +1 -0
  35. package/dist/documentation/CrossReferencer.d.ts +67 -0
  36. package/dist/documentation/CrossReferencer.d.ts.map +1 -0
  37. package/dist/documentation/CrossReferencer.js +247 -0
  38. package/dist/documentation/CrossReferencer.js.map +1 -0
  39. package/dist/documentation/DocumentationGenerator.d.ts +22 -0
  40. package/dist/documentation/DocumentationGenerator.d.ts.map +1 -0
  41. package/dist/documentation/DocumentationGenerator.js +57 -0
  42. package/dist/documentation/DocumentationGenerator.js.map +1 -0
  43. package/dist/documentation/MarkdownFormatter.d.ts +26 -0
  44. package/dist/documentation/MarkdownFormatter.d.ts.map +1 -0
  45. package/dist/documentation/MarkdownFormatter.js +301 -0
  46. package/dist/documentation/MarkdownFormatter.js.map +1 -0
  47. package/dist/documentation/types.d.ts +176 -0
  48. package/dist/documentation/types.d.ts.map +1 -0
  49. package/dist/documentation/types.js +5 -0
  50. package/dist/documentation/types.js.map +1 -0
  51. package/dist/embeddings/ConfigManager.d.ts +46 -0
  52. package/dist/embeddings/ConfigManager.d.ts.map +1 -0
  53. package/dist/embeddings/ConfigManager.js +177 -0
  54. package/dist/embeddings/ConfigManager.js.map +1 -0
  55. package/dist/embeddings/EmbeddingConfig.d.ts +39 -0
  56. package/dist/embeddings/EmbeddingConfig.d.ts.map +1 -0
  57. package/dist/embeddings/EmbeddingConfig.js +132 -0
  58. package/dist/embeddings/EmbeddingConfig.js.map +1 -0
  59. package/dist/embeddings/EmbeddingGenerator.d.ts +51 -0
  60. package/dist/embeddings/EmbeddingGenerator.d.ts.map +1 -0
  61. package/dist/embeddings/EmbeddingGenerator.js +157 -0
  62. package/dist/embeddings/EmbeddingGenerator.js.map +1 -0
  63. package/dist/embeddings/EmbeddingProvider.d.ts +34 -0
  64. package/dist/embeddings/EmbeddingProvider.d.ts.map +1 -0
  65. package/dist/embeddings/EmbeddingProvider.js +6 -0
  66. package/dist/embeddings/EmbeddingProvider.js.map +1 -0
  67. package/dist/embeddings/ModelRegistry.d.ts +48 -0
  68. package/dist/embeddings/ModelRegistry.d.ts.map +1 -0
  69. package/dist/embeddings/ModelRegistry.js +170 -0
  70. package/dist/embeddings/ModelRegistry.js.map +1 -0
  71. package/dist/embeddings/VectorStore.d.ts +114 -0
  72. package/dist/embeddings/VectorStore.d.ts.map +1 -0
  73. package/dist/embeddings/VectorStore.js +393 -0
  74. package/dist/embeddings/VectorStore.js.map +1 -0
  75. package/dist/embeddings/providers/OllamaEmbeddings.d.ts +38 -0
  76. package/dist/embeddings/providers/OllamaEmbeddings.d.ts.map +1 -0
  77. package/dist/embeddings/providers/OllamaEmbeddings.js +125 -0
  78. package/dist/embeddings/providers/OllamaEmbeddings.js.map +1 -0
  79. package/dist/embeddings/providers/OpenAIEmbeddings.d.ts +40 -0
  80. package/dist/embeddings/providers/OpenAIEmbeddings.d.ts.map +1 -0
  81. package/dist/embeddings/providers/OpenAIEmbeddings.js +129 -0
  82. package/dist/embeddings/providers/OpenAIEmbeddings.js.map +1 -0
  83. package/dist/embeddings/providers/TransformersEmbeddings.d.ts +38 -0
  84. package/dist/embeddings/providers/TransformersEmbeddings.d.ts.map +1 -0
  85. package/dist/embeddings/providers/TransformersEmbeddings.js +115 -0
  86. package/dist/embeddings/providers/TransformersEmbeddings.js.map +1 -0
  87. package/dist/handoff/SessionHandoffStore.d.ts +80 -0
  88. package/dist/handoff/SessionHandoffStore.d.ts.map +1 -0
  89. package/dist/handoff/SessionHandoffStore.js +314 -0
  90. package/dist/handoff/SessionHandoffStore.js.map +1 -0
  91. package/dist/index.d.ts +7 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.js +115 -0
  94. package/dist/index.js.map +1 -0
  95. package/dist/mcp-server.d.ts +27 -0
  96. package/dist/mcp-server.d.ts.map +1 -0
  97. package/dist/mcp-server.js +157 -0
  98. package/dist/mcp-server.js.map +1 -0
  99. package/dist/memory/WorkingMemoryStore.d.ts +83 -0
  100. package/dist/memory/WorkingMemoryStore.d.ts.map +1 -0
  101. package/dist/memory/WorkingMemoryStore.js +318 -0
  102. package/dist/memory/WorkingMemoryStore.js.map +1 -0
  103. package/dist/memory/types.d.ts +192 -0
  104. package/dist/memory/types.d.ts.map +1 -0
  105. package/dist/memory/types.js +8 -0
  106. package/dist/memory/types.js.map +1 -0
  107. package/dist/parsers/CodexConversationParser.d.ts +51 -0
  108. package/dist/parsers/CodexConversationParser.d.ts.map +1 -0
  109. package/dist/parsers/CodexConversationParser.js +301 -0
  110. package/dist/parsers/CodexConversationParser.js.map +1 -0
  111. package/dist/parsers/ConversationParser.d.ts +286 -0
  112. package/dist/parsers/ConversationParser.d.ts.map +1 -0
  113. package/dist/parsers/ConversationParser.js +795 -0
  114. package/dist/parsers/ConversationParser.js.map +1 -0
  115. package/dist/parsers/DecisionExtractor.d.ts +144 -0
  116. package/dist/parsers/DecisionExtractor.d.ts.map +1 -0
  117. package/dist/parsers/DecisionExtractor.js +434 -0
  118. package/dist/parsers/DecisionExtractor.js.map +1 -0
  119. package/dist/parsers/GitIntegrator.d.ts +156 -0
  120. package/dist/parsers/GitIntegrator.d.ts.map +1 -0
  121. package/dist/parsers/GitIntegrator.js +348 -0
  122. package/dist/parsers/GitIntegrator.js.map +1 -0
  123. package/dist/parsers/MistakeExtractor.d.ts +151 -0
  124. package/dist/parsers/MistakeExtractor.d.ts.map +1 -0
  125. package/dist/parsers/MistakeExtractor.js +460 -0
  126. package/dist/parsers/MistakeExtractor.js.map +1 -0
  127. package/dist/parsers/RequirementsExtractor.d.ts +166 -0
  128. package/dist/parsers/RequirementsExtractor.d.ts.map +1 -0
  129. package/dist/parsers/RequirementsExtractor.js +338 -0
  130. package/dist/parsers/RequirementsExtractor.js.map +1 -0
  131. package/dist/realtime/ConversationWatcher.d.ts +87 -0
  132. package/dist/realtime/ConversationWatcher.d.ts.map +1 -0
  133. package/dist/realtime/ConversationWatcher.js +204 -0
  134. package/dist/realtime/ConversationWatcher.js.map +1 -0
  135. package/dist/realtime/IncrementalParser.d.ts +83 -0
  136. package/dist/realtime/IncrementalParser.d.ts.map +1 -0
  137. package/dist/realtime/IncrementalParser.js +232 -0
  138. package/dist/realtime/IncrementalParser.js.map +1 -0
  139. package/dist/realtime/LiveExtractor.d.ts +72 -0
  140. package/dist/realtime/LiveExtractor.d.ts.map +1 -0
  141. package/dist/realtime/LiveExtractor.js +288 -0
  142. package/dist/realtime/LiveExtractor.js.map +1 -0
  143. package/dist/search/SemanticSearch.d.ts +121 -0
  144. package/dist/search/SemanticSearch.d.ts.map +1 -0
  145. package/dist/search/SemanticSearch.js +823 -0
  146. package/dist/search/SemanticSearch.js.map +1 -0
  147. package/dist/storage/BackupManager.d.ts +58 -0
  148. package/dist/storage/BackupManager.d.ts.map +1 -0
  149. package/dist/storage/BackupManager.js +223 -0
  150. package/dist/storage/BackupManager.js.map +1 -0
  151. package/dist/storage/ConversationStorage.d.ts +341 -0
  152. package/dist/storage/ConversationStorage.d.ts.map +1 -0
  153. package/dist/storage/ConversationStorage.js +792 -0
  154. package/dist/storage/ConversationStorage.js.map +1 -0
  155. package/dist/storage/DeletionService.d.ts +70 -0
  156. package/dist/storage/DeletionService.d.ts.map +1 -0
  157. package/dist/storage/DeletionService.js +253 -0
  158. package/dist/storage/DeletionService.js.map +1 -0
  159. package/dist/storage/GlobalIndex.d.ts +133 -0
  160. package/dist/storage/GlobalIndex.d.ts.map +1 -0
  161. package/dist/storage/GlobalIndex.js +310 -0
  162. package/dist/storage/GlobalIndex.js.map +1 -0
  163. package/dist/storage/SQLiteManager.d.ts +114 -0
  164. package/dist/storage/SQLiteManager.d.ts.map +1 -0
  165. package/dist/storage/SQLiteManager.js +636 -0
  166. package/dist/storage/SQLiteManager.js.map +1 -0
  167. package/dist/storage/migrations.d.ts +54 -0
  168. package/dist/storage/migrations.d.ts.map +1 -0
  169. package/dist/storage/migrations.js +285 -0
  170. package/dist/storage/migrations.js.map +1 -0
  171. package/dist/storage/schema.sql +436 -0
  172. package/dist/tools/ToolDefinitions.d.ts +946 -0
  173. package/dist/tools/ToolDefinitions.d.ts.map +1 -0
  174. package/dist/tools/ToolDefinitions.js +937 -0
  175. package/dist/tools/ToolDefinitions.js.map +1 -0
  176. package/dist/tools/ToolHandlers.d.ts +791 -0
  177. package/dist/tools/ToolHandlers.d.ts.map +1 -0
  178. package/dist/tools/ToolHandlers.js +3262 -0
  179. package/dist/tools/ToolHandlers.js.map +1 -0
  180. package/dist/types/ToolTypes.d.ts +824 -0
  181. package/dist/types/ToolTypes.d.ts.map +1 -0
  182. package/dist/types/ToolTypes.js +6 -0
  183. package/dist/types/ToolTypes.js.map +1 -0
  184. package/dist/utils/Logger.d.ts +70 -0
  185. package/dist/utils/Logger.d.ts.map +1 -0
  186. package/dist/utils/Logger.js +131 -0
  187. package/dist/utils/Logger.js.map +1 -0
  188. package/dist/utils/McpConfig.d.ts +54 -0
  189. package/dist/utils/McpConfig.d.ts.map +1 -0
  190. package/dist/utils/McpConfig.js +136 -0
  191. package/dist/utils/McpConfig.js.map +1 -0
  192. package/dist/utils/ProjectMigration.d.ts +82 -0
  193. package/dist/utils/ProjectMigration.d.ts.map +1 -0
  194. package/dist/utils/ProjectMigration.js +416 -0
  195. package/dist/utils/ProjectMigration.js.map +1 -0
  196. package/dist/utils/constants.d.ts +75 -0
  197. package/dist/utils/constants.d.ts.map +1 -0
  198. package/dist/utils/constants.js +105 -0
  199. package/dist/utils/constants.js.map +1 -0
  200. package/dist/utils/safeJson.d.ts +37 -0
  201. package/dist/utils/safeJson.d.ts.map +1 -0
  202. package/dist/utils/safeJson.js +48 -0
  203. package/dist/utils/safeJson.js.map +1 -0
  204. package/dist/utils/sanitization.d.ts +45 -0
  205. package/dist/utils/sanitization.d.ts.map +1 -0
  206. package/dist/utils/sanitization.js +153 -0
  207. package/dist/utils/sanitization.js.map +1 -0
  208. package/dist/utils/worktree.d.ts +15 -0
  209. package/dist/utils/worktree.d.ts.map +1 -0
  210. package/dist/utils/worktree.js +86 -0
  211. package/dist/utils/worktree.js.map +1 -0
  212. package/package.json +98 -0
  213. package/scripts/changelog-check.sh +62 -0
  214. package/scripts/check-node.js +17 -0
  215. package/scripts/dev-config.js +56 -0
  216. package/scripts/postinstall.js +117 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 xiaolai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,349 @@
1
+ # CCCMemory MCP
2
+
3
+ An MCP server that gives Claude long-term memory by indexing conversation history with semantic search, decision tracking, and cross-project search.
4
+
5
+ ---
6
+
7
+ ## ⚠️ Breaking Changes in v1.8.0
8
+
9
+ **This package has been renamed from `claude-conversation-memory-mcp` to `cccmemory`.**
10
+
11
+ If you were using the old package, follow these migration steps:
12
+
13
+ ### 1. Uninstall the old package
14
+
15
+ ```bash
16
+ npm uninstall -g claude-conversation-memory-mcp
17
+ ```
18
+
19
+ ### 2. Install the new package
20
+
21
+ ```bash
22
+ npm install -g cccmemory
23
+ ```
24
+
25
+ ### 3. Update your MCP configuration
26
+
27
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "cccmemory": {
32
+ "command": "npx",
33
+ "args": ["-y", "cccmemory"]
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ **Claude Code** (`~/.claude.json`):
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "cccmemory": {
44
+ "command": "npx",
45
+ "args": ["-y", "cccmemory"]
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ **Codex** (`~/.codex/config.toml`):
52
+ ```toml
53
+ [mcp_servers.cccmemory]
54
+ command = "npx"
55
+ args = ["-y", "cccmemory"]
56
+ ```
57
+
58
+ ### 4. Database migration (automatic)
59
+
60
+ Your conversation history is preserved. The database files are automatically migrated:
61
+ - `.claude-conversations-memory.db` → `.cccmemory.db`
62
+ - `.codex-conversations-memory.db` → `.cccmemory.db`
63
+
64
+ No manual action required - the migration happens on first run.
65
+
66
+ ---
67
+
68
+ ## Features
69
+
70
+ - **Search conversations** - Natural language search across your chat history
71
+ - **Track decisions** - Remember why you made technical choices
72
+ - **Prevent mistakes** - Learn from past errors
73
+ - **Git integration** - Link conversations to commits
74
+ - **Cross-project search** - Search across all your projects globally
75
+ - **Project migration** - Keep history when renaming/moving projects
76
+ - **Semantic search** - Uses Transformers.js embeddings (bundled, works offline)
77
+
78
+ ## Installation
79
+
80
+ ### Node.js version
81
+
82
+ CCCMemory supports **Node.js 20 or 22 LTS**. Using other versions can break native
83
+ modules (like `better-sqlite3`). If you switch Node versions, reinstall the
84
+ package (or run `npm rebuild better-sqlite3` in a local clone).
85
+
86
+ ```bash
87
+ npm install -g cccmemory
88
+ ```
89
+
90
+ Verify installation:
91
+
92
+ ```bash
93
+ cccmemory --version
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ ### For Claude Desktop
99
+
100
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
101
+
102
+ ```json
103
+ {
104
+ "mcpServers": {
105
+ "cccmemory": {
106
+ "command": "npx",
107
+ "args": ["-y", "cccmemory"]
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ Then restart Claude Desktop.
114
+
115
+ ### For Claude Code
116
+
117
+ Edit `~/.claude.json` (note: this file is in your home directory, not inside `~/.claude/`):
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "cccmemory": {
123
+ "command": "npx",
124
+ "args": ["-y", "cccmemory"]
125
+ }
126
+ }
127
+ }
128
+ ```
129
+
130
+ Or if installed globally:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "cccmemory": {
136
+ "command": "cccmemory"
137
+ }
138
+ }
139
+ }
140
+ ```
141
+
142
+ ### For Codex CLI
143
+
144
+ Codex stores MCP settings in `~/.codex/config.toml` (shared by the CLI and the IDE extension).
145
+
146
+ **Recommended (CLI):**
147
+ ```bash
148
+ codex mcp add cccmemory -- npx -y cccmemory
149
+ ```
150
+
151
+ **Manual config (`~/.codex/config.toml`):**
152
+ ```toml
153
+ [mcp_servers.cccmemory]
154
+ command = "npx"
155
+ args = ["-y", "cccmemory"]
156
+ ```
157
+
158
+ If you installed globally, you can use:
159
+ ```toml
160
+ [mcp_servers.cccmemory]
161
+ command = "cccmemory"
162
+ ```
163
+
164
+ Open Codex and run `/mcp` in the TUI to verify the server is active.
165
+
166
+ ### Storage Paths
167
+
168
+ By default, CCCMemory stores per-project databases in:
169
+
170
+ - `~/.claude/projects/<project>/.cccmemory.db`
171
+ - Global index: `~/.claude/.cccmemory-global.db`
172
+
173
+ If your home directory is not writable (common in sandboxed Codex/Claude setups where
174
+ `~/.claude` and `~/.codex` are locked), the server will exit with a clear error.
175
+ Set explicit paths to a writable location:
176
+
177
+ ```bash
178
+ export CCCMEMORY_DB_PATH="/path/to/cccmemory.db"
179
+ export CCCMEMORY_GLOBAL_INDEX_PATH="/path/to/cccmemory-global.db"
180
+ ```
181
+
182
+ For MCP configs, add these env vars in your server definition. CCCMemory will not
183
+ silently create new databases outside `~/.claude`; it only uses an existing
184
+ project-local DB if one already exists and logs a warning.
185
+
186
+ ### Embedding Configuration (Optional)
187
+
188
+ The MCP uses **Transformers.js** by default for semantic search (bundled, works offline, no setup required).
189
+
190
+ **Model download & cache behavior (Transformers.js):**
191
+ On first use, `@xenova/transformers` downloads the model weights and caches them in its own default cache directory. CCCMemory does not manage or relocate that cache. Subsequent runs reuse the cached model and work fully offline.
192
+
193
+ To customize, create `~/.claude-memory-config.json`:
194
+
195
+ ```json
196
+ {
197
+ "embedding": {
198
+ "provider": "transformers",
199
+ "model": "Xenova/all-MiniLM-L6-v2",
200
+ "dimensions": 384
201
+ }
202
+ }
203
+ ```
204
+
205
+ **Alternative providers:**
206
+
207
+ <details>
208
+ <summary>Ollama (faster, requires Ollama running)</summary>
209
+
210
+ ```bash
211
+ # Install Ollama
212
+ curl -fsSL https://ollama.com/install.sh | sh
213
+ ollama pull mxbai-embed-large
214
+ ollama serve
215
+ ```
216
+
217
+ Config:
218
+ ```json
219
+ {
220
+ "embedding": {
221
+ "provider": "ollama",
222
+ "model": "mxbai-embed-large",
223
+ "dimensions": 1024
224
+ }
225
+ }
226
+ ```
227
+ </details>
228
+
229
+ <details>
230
+ <summary>OpenAI (requires API key)</summary>
231
+
232
+ ```json
233
+ {
234
+ "embedding": {
235
+ "provider": "openai",
236
+ "model": "text-embedding-3-small",
237
+ "dimensions": 1536
238
+ }
239
+ }
240
+ ```
241
+
242
+ Set `OPENAI_API_KEY` environment variable.
243
+ </details>
244
+
245
+ ## MCP Tools
246
+
247
+ ### Indexing
248
+ | Tool | Description |
249
+ |------|-------------|
250
+ | `index_conversations` | Index current project's conversations |
251
+ | `index_all_projects` | Index all Claude Code + Codex projects |
252
+
253
+ ### Search
254
+ | Tool | Description |
255
+ |------|-------------|
256
+ | `search_conversations` | Search messages in current project |
257
+ | `search_all_conversations` | Search across all indexed projects |
258
+ | `get_decisions` | Find architectural decisions |
259
+ | `get_all_decisions` | Decisions across all projects |
260
+ | `search_mistakes` | Find past errors and fixes |
261
+ | `search_all_mistakes` | Mistakes across all projects |
262
+ | `find_similar_sessions` | Find related conversations |
263
+
264
+ ### Context
265
+ | Tool | Description |
266
+ |------|-------------|
267
+ | `check_before_modify` | Get context before editing a file |
268
+ | `get_file_evolution` | See file history with commits |
269
+ | `search_by_file` | Find all context related to a file |
270
+ | `list_recent_sessions` | List recent sessions with summaries |
271
+ | `recall_and_apply` | Recall past work for current task |
272
+ | `get_requirements` | Look up component requirements |
273
+ | `get_tool_history` | Query tool usage history |
274
+ | `link_commits_to_conversations` | Connect git commits to sessions |
275
+
276
+ ### Project Management
277
+ | Tool | Description |
278
+ |------|-------------|
279
+ | `discover_old_conversations` | Find folders from renamed projects |
280
+ | `migrate_project` | Migrate/merge conversation history |
281
+ | `forget_by_topic` | Delete conversations by keyword |
282
+ | `generate_documentation` | Generate docs from conversations |
283
+
284
+ ## CLI Usage
285
+
286
+ The package includes a standalone CLI:
287
+
288
+ ```bash
289
+ # Interactive mode
290
+ cccmemory
291
+
292
+ # Single commands
293
+ cccmemory status
294
+ cccmemory index
295
+ cccmemory "search authentication"
296
+ cccmemory help
297
+ ```
298
+
299
+ ## Supported Platforms
300
+
301
+ | Platform | Status | Conversation Location |
302
+ |----------|--------|----------------------|
303
+ | Claude Code | ✅ Supported | `~/.claude/projects/` |
304
+ | Claude Desktop | ✅ Supported | (indexes Claude Code history) |
305
+ | Codex | ✅ Supported | `~/.codex/sessions/` |
306
+
307
+ **Why only Claude Code and Codex CLI today?**
308
+ CCCMemory indexes local session history from stable, parseable on-disk formats. Claude Code and Codex CLI both store full conversation logs locally with consistent schemas. Other tools either do not expose full local history, only support partial/manual saves, or do not provide a stable file format to parse reliably. Without deterministic local storage, there is nothing safe to index or resume.
309
+
310
+ ## Architecture
311
+
312
+ ```
313
+ Per-Project Databases (isolation)
314
+ ├── ~/.claude/projects/{project}/.cccmemory.db (Claude Code default)
315
+ ├── ~/.codex/.cccmemory.db (Codex default)
316
+ └── {project}/.cccmemory/.cccmemory.db (fallback in restricted sandboxes)
317
+
318
+ Global Registry (cross-project search)
319
+ ├── ~/.claude/.cccmemory-global.db (default)
320
+ └── {project}/.cccmemory/global-index.db (fallback in restricted sandboxes)
321
+ ```
322
+
323
+ ## Troubleshooting
324
+
325
+ ### Claude Desktop shows JSON parse errors
326
+
327
+ Upgrade to v1.7.3+:
328
+ ```bash
329
+ npm update -g cccmemory
330
+ ```
331
+
332
+ ### MCP not loading in Claude Code
333
+
334
+ 1. Check config location is `~/.claude.json` (not `~/.claude/config.json`)
335
+ 2. Verify JSON syntax is valid
336
+ 3. Restart Claude Code
337
+
338
+ ### Embeddings not working
339
+
340
+ Check provider status:
341
+ ```bash
342
+ cccmemory status
343
+ ```
344
+
345
+ Default Transformers.js should work out of the box. If you opt into Ollama, ensure it's running (`ollama serve`).
346
+
347
+ ## License
348
+
349
+ MIT
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Main Orchestrator - Coordinates all components for conversation memory indexing and retrieval.
3
+ *
4
+ * ConversationMemory is the primary interface for the cccmemory-mcp system.
5
+ * It orchestrates parsing, storage, extraction, and search of Claude Code conversation history.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * const memory = new ConversationMemory();
10
+ * await memory.indexConversations({
11
+ * projectPath: '/path/to/project',
12
+ * enableGitIntegration: true
13
+ * });
14
+ * ```
15
+ */
16
+ import { ConversationStorage } from "./storage/ConversationStorage.js";
17
+ import { SemanticSearch } from "./search/SemanticSearch.js";
18
+ /**
19
+ * Configuration options for indexing conversations.
20
+ */
21
+ export interface IndexOptions {
22
+ /** Absolute path to the project directory to index */
23
+ projectPath: string;
24
+ /** Optional: Index only a specific session ID instead of all sessions */
25
+ sessionId?: string;
26
+ /**
27
+ * Whether to include thinking blocks in the index.
28
+ * Thinking blocks can be large and are excluded by default.
29
+ * @default false
30
+ */
31
+ includeThinking?: boolean;
32
+ /**
33
+ * Enable git integration to link commits to conversations.
34
+ * Requires the project to be a git repository.
35
+ * @default true
36
+ */
37
+ enableGitIntegration?: boolean;
38
+ /**
39
+ * Exclude MCP tool conversations from indexing.
40
+ * - `false`: Index all conversations (default)
41
+ * - `'self-only'`: Exclude only cccmemory MCP conversations (prevents self-referential loops)
42
+ * - `'all-mcp'` or `true`: Exclude all MCP tool conversations
43
+ * @default false
44
+ */
45
+ excludeMcpConversations?: boolean | 'self-only' | 'all-mcp';
46
+ /**
47
+ * List of specific MCP server names to exclude.
48
+ * More granular than `excludeMcpConversations`.
49
+ * @example ['cccmemory', 'code-graph-rag']
50
+ */
51
+ excludeMcpServers?: string[];
52
+ /**
53
+ * Optional timestamp to skip unchanged conversation files.
54
+ * Files with mtime older than this will be skipped.
55
+ */
56
+ lastIndexedMs?: number;
57
+ }
58
+ /**
59
+ * Main orchestrator for conversation memory operations.
60
+ *
61
+ * Coordinates parsing, storage, extraction, and search across:
62
+ * - Conversation parsing from JSONL files
63
+ * - Decision, mistake, and requirement extraction
64
+ * - Git commit integration
65
+ * - Semantic search with embeddings
66
+ */
67
+ export declare class ConversationMemory {
68
+ private sqliteManager;
69
+ private storage;
70
+ private parser;
71
+ private decisionExtractor;
72
+ private mistakeExtractor;
73
+ private requirementsExtractor;
74
+ private semanticSearch;
75
+ constructor();
76
+ /**
77
+ * Index conversations for a project.
78
+ *
79
+ * This is the main entry point for processing conversation history.
80
+ * It performs the following operations:
81
+ * 1. Parse conversation JSONL files from the project
82
+ * 2. Store conversations, messages, and tool interactions
83
+ * 3. Extract decisions, mistakes, and requirements
84
+ * 4. Link git commits (if enabled)
85
+ * 5. Generate semantic embeddings for search
86
+ *
87
+ * @param options - Configuration options for indexing
88
+ * @returns Result object containing:
89
+ * - `embeddings_generated`: Whether embeddings were successfully generated
90
+ * - `embedding_error`: Error message if embedding generation failed
91
+ * - `indexed_folders`: List of folders that were indexed
92
+ * - `database_path`: Path to the SQLite database
93
+ *
94
+ * @throws {Error} If project path doesn't exist or conversation files can't be parsed
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * const result = await memory.indexConversations({
99
+ * projectPath: '/Users/me/my-project',
100
+ * enableGitIntegration: true,
101
+ * excludeMcpConversations: 'self-only'
102
+ * });
103
+ *
104
+ * if (result.embeddings_generated) {
105
+ * console.error('Indexed folders:', result.indexed_folders);
106
+ * } else {
107
+ * console.warn('Embeddings failed:', result.embedding_error);
108
+ * }
109
+ * ```
110
+ */
111
+ indexConversations(options: IndexOptions): Promise<{
112
+ embeddings_generated: boolean;
113
+ embedding_error?: string;
114
+ indexed_folders?: string[];
115
+ database_path?: string;
116
+ }>;
117
+ /**
118
+ * Search conversations using natural language query.
119
+ *
120
+ * Uses semantic search with embeddings if available, otherwise falls back to full-text search.
121
+ *
122
+ * @param query - Natural language search query
123
+ * @param limit - Maximum number of results to return (default: 10)
124
+ * @returns Array of search results with messages, conversations, and similarity scores
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * const results = await memory.search('authentication bug fix', 5);
129
+ * results.forEach(r => {
130
+ * console.error(`${r.similarity}: ${r.snippet}`);
131
+ * });
132
+ * ```
133
+ */
134
+ search(query: string, limit?: number): Promise<import("./search/SemanticSearch.js").SearchResult[]>;
135
+ /**
136
+ * Search for decisions using natural language query.
137
+ *
138
+ * Searches through extracted decisions to find relevant architectural choices and technical decisions.
139
+ *
140
+ * @param query - Natural language search query
141
+ * @param limit - Maximum number of results to return (default: 10)
142
+ * @returns Array of decision search results with similarity scores
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * const decisions = await memory.searchDecisions('database choice', 3);
147
+ * decisions.forEach(d => {
148
+ * console.error(`Decision: ${d.decision.decision_text}`);
149
+ * console.error(`Rationale: ${d.decision.rationale}`);
150
+ * });
151
+ * ```
152
+ */
153
+ searchDecisions(query: string, limit?: number): Promise<import("./search/SemanticSearch.js").DecisionSearchResult[]>;
154
+ /**
155
+ * Get the timeline of changes for a specific file.
156
+ *
157
+ * Returns all edits, commits, and related conversations for a file across its history.
158
+ *
159
+ * @param filePath - Path to the file (relative to project root)
160
+ * @returns Timeline of file changes with conversations and commits
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const timeline = memory.getFileTimeline('src/index.ts');
165
+ * console.error(`${timeline.length} changes to this file`);
166
+ * ```
167
+ */
168
+ getFileTimeline(filePath: string): {
169
+ file_path: string;
170
+ edits: import("./parsers/ConversationParser.js").FileEdit[];
171
+ commits: import("./parsers/GitIntegrator.js").GitCommit[];
172
+ decisions: import("./parsers/DecisionExtractor.js").Decision[];
173
+ };
174
+ /**
175
+ * Get statistics about the indexed conversation data.
176
+ *
177
+ * @returns Object containing counts for conversations, messages, decisions, mistakes, and commits
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const stats = memory.getStats();
182
+ * console.error(`Indexed ${stats.conversations.count} conversations`);
183
+ * console.error(`Extracted ${stats.decisions.count} decisions`);
184
+ * ```
185
+ */
186
+ getStats(): {
187
+ conversations: {
188
+ count: number;
189
+ };
190
+ messages: {
191
+ count: number;
192
+ };
193
+ decisions: {
194
+ count: number;
195
+ };
196
+ mistakes: {
197
+ count: number;
198
+ };
199
+ git_commits: {
200
+ count: number;
201
+ };
202
+ };
203
+ /**
204
+ * Get the underlying storage instance for direct database access.
205
+ *
206
+ * Use with caution - prefer using the high-level methods when possible.
207
+ *
208
+ * @returns ConversationStorage instance
209
+ * @internal
210
+ */
211
+ getStorage(): ConversationStorage;
212
+ /**
213
+ * Get the semantic search instance for advanced search operations.
214
+ *
215
+ * @returns SemanticSearch instance
216
+ * @internal
217
+ */
218
+ getSemanticSearch(): SemanticSearch;
219
+ /**
220
+ * Filter MCP conversations from parse results.
221
+ *
222
+ * Implements the exclusion logic for MCP tool conversations to prevent
223
+ * self-referential loops and reduce noise in the index.
224
+ *
225
+ * Strategy: Filter at MESSAGE level, not conversation level.
226
+ * - Keep all conversations
227
+ * - Exclude only messages that invoke specified MCP tools and their responses
228
+ */
229
+ private filterMcpConversations;
230
+ }
231
+ //# sourceMappingURL=ConversationMemory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConversationMemory.d.ts","sourceRoot":"","sources":["../src/ConversationMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IAEpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;IAE5D;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE7B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,qBAAqB,CAAwB;IACrD,OAAO,CAAC,cAAc,CAAiB;;IAiBvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACG,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC;QACvD,oBAAoB,EAAE,OAAO,CAAC;QAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IAiIF;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW;IAI9C;;;;;;;;;;;;;;;;;OAiBG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW;IAIvD;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM;;;;;;IAIhC;;;;;;;;;;;OAWG;IACH,QAAQ;;;;;;;;;;;;;;;;;IAIR;;;;;;;OAOG;IACH,UAAU;IAIV;;;;;OAKG;IACH,iBAAiB;IAIjB;;;;;;;;;OASG;IACH,OAAO,CAAC,sBAAsB;CA6E/B"}