collective-memory-mcp 0.6.5 → 0.7.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/README.md CHANGED
@@ -1,23 +1,35 @@
1
1
  # Collective Memory MCP Server
2
2
 
3
- A persistent, graph-based memory system with **vector search** that enables AI agents to document their work and learn from each other's experiences. This system transforms ephemeral agent interactions into a searchable knowledge base of structural patterns, solutions, and methodologies.
3
+ > A persistent, graph-based memory system with vector search that enables AI agents to document their work and learn from each other's experiences.
4
+
5
+ [![npm version](https://badge.fury.io/js/collective-memory-mcp.svg)](https://www.npmjs.org/package/collective-memory-mcp)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ---
4
9
 
5
10
  ## Overview
6
11
 
7
- The Collective Memory System is designed for multi-agent environments where agents need to:
12
+ Collective Memory transforms ephemeral agent interactions into a searchable knowledge base. It enables AI agents working across multiple projects to:
13
+
14
+ - **Document** their completed work for future reference
15
+ - **Discover** how similar tasks were solved using vector search
16
+ - **Learn** from structural patterns and approaches of other agents
17
+ - **Organize** knowledge by project for multi-codebase workflows
8
18
 
9
- - Document their completed work for future reference
10
- - Discover how similar tasks were solved previously using **vector search**
11
- - Learn from the structural patterns and approaches of other agents
12
- - Coordinate across parallel executions without duplicating effort
19
+ ---
13
20
 
14
- ## Key Features
21
+ ## Features
15
22
 
16
- - **Vector Search** - TF-IDF based search finds conceptually similar content even when keywords differ
17
- - **Knowledge Graph** - Entities and relations capture complex relationships
18
- - **Ranked Results** - Similarity scores help identify the most relevant past work
19
- - **Zero Configuration** - Works out of the box, no external dependencies or API keys needed
20
- - **Pure JavaScript** - No native dependencies, works completely offline
23
+ | Feature | Description |
24
+ |---------|-------------|
25
+ | **Vector Search** | TF-IDF based search finds conceptually similar content even when keywords differ |
26
+ | **Knowledge Graph** | Entities and relations capture complex relationships |
27
+ | **Ranked Results** | Similarity scores help identify the most relevant past work |
28
+ | **Multi-Project** | Organize and search knowledge across multiple codebases |
29
+ | **Zero Configuration** | Works out of the box, no external dependencies or API keys needed |
30
+ | **Pure JavaScript** | No native dependencies, works completely offline |
31
+
32
+ ---
21
33
 
22
34
  ## Installation
23
35
 
@@ -25,9 +37,16 @@ The Collective Memory System is designed for multi-agent environments where agen
25
37
  npx collective-memory-mcp
26
38
  ```
27
39
 
28
- ## Claude Desktop Configuration
40
+ ---
41
+
42
+ ## Configuration
43
+
44
+ ### Claude Desktop
29
45
 
30
- Add to your Claude Desktop MCP configuration (`~/.config/Claude/claude_desktop_config.json` on macOS/Linux or `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
46
+ Add to your Claude Desktop MCP configuration:
47
+
48
+ **macOS/Linux:** `~/.config/Claude/claude_desktop_config.json`
49
+ **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
31
50
 
32
51
  ```json
33
52
  {
@@ -35,114 +54,193 @@ Add to your Claude Desktop MCP configuration (`~/.config/Claude/claude_desktop_c
35
54
  "collective-memory": {
36
55
  "command": "npx",
37
56
  "args": ["-y", "collective-memory-mcp"]
57
+ },
58
+ "sequential-thinking": {
59
+ "command": "npx",
60
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
38
61
  }
39
62
  }
40
63
  }
41
64
  ```
42
65
 
43
- The `-y` flag suppresses the npx prompt and auto-installs the latest version.
66
+ > **Note:** The `sequential-thinking` MCP server is required for the full workflow. The `-y` flag suppresses the npx prompt and auto-installs the latest version.
67
+
68
+ ---
44
69
 
45
- ## System Prompt (Required)
70
+ ## System Prompt
46
71
 
47
- This MCP server does NOT automatically inject its instructions into new chats. You MUST manually add this to your Claude/AI system prompt:
72
+ Add this to your AI system prompt:
48
73
 
49
74
  ```
50
75
  You have access to a Collective Memory MCP Server that stores knowledge from previous tasks.
51
76
 
52
- BEFORE starting work, search for similar past tasks using:
53
- - search_collective_memory (vector search - understands meaning, not just keywords)
54
- - find_similar_procedures (finds similar tasks with full implementation details)
77
+ ## SEQUENTIAL THINKING (ALWAYS)
78
+ - Call `mcp_sequential-thinking_sequentialthinking` as your FIRST action in EVERY response
79
+ - Use it to analyze the request, plan your approach, and organize your thoughts
80
+ - Continue calling it until `nextThoughtNeeded: false`
81
+ - This applies to ALL responses: questions, tasks, explanations, debugging, etc.
82
+ - NO EXCEPTIONS - even simple questions benefit from structured thinking
83
+
84
+ ## MANDATORY WORKFLOW (Every Chat)
55
85
 
56
- The search uses TF-IDF vector embeddings, so it finds relevant content even when different
57
- terminology is used. Results are ranked by similarity score.
86
+ ### Phase 1: INIT (First response of every chat)
87
+ 1. Call `sequentialthinking` to analyze the user's request
88
+ 2. Call `getting_started` tool to load tool knowledge
89
+ 3. Acknowledge initialization complete (brief confirmation)
58
90
 
59
- AFTER completing any task (like any, it doesn't matter even if you answer a question), document it using:
60
- - record_task_completion
91
+ ### Phase 2: SEARCH (Before any task)
92
+ - Call `sequentialthinking` to formulate search strategy
93
+ - Call `search_collective_memory` OR `find_similar_procedures` with relevant query
94
+ - Review past solutions before implementing
95
+
96
+ ### Phase 3: WORK
97
+ - Call `sequentialthinking` before each major step
98
+ - Apply learnings from Phase 2
99
+
100
+ ### Phase 4: DOCUMENT (After completing ANY task, including Q&A)
101
+ - Call `sequentialthinking` to summarize what was accomplished
102
+ - Call `record_task_completion` with:
103
+ - Specific observations (file paths, versions, metrics, error messages)
104
+ - NO vague statements like "works well" or "fixed bugs"
105
+
106
+ ## ENFORCEMENT
107
+ - Sequential thinking is NON-NEGOTIABLE on EVERY response
108
+ - Phase 1 is NON-NEGOTIABLE on first response of chat
109
+ - Phase 4 applies to ALL completions, no exceptions
110
+ - If you skip any phase, acknowledge the violation and correct immediately
111
+
112
+ ## Available Tools
113
+
114
+ BEFORE starting work, search for similar past tasks using:
115
+ - `search_collective_memory` - Vector search (understands meaning, not just keywords)
116
+ - `find_similar_procedures` - Find similar tasks with full implementation details
117
+
118
+ AFTER completing any task (including answering questions), document it using:
119
+ - `record_task_completion`
61
120
 
62
121
  When writing observations, be SPECIFIC and include facts like file paths, versions,
63
122
  metrics, and error messages. Avoid vague statements like "works well" or "fixed bugs".
64
123
 
65
- In new chats, call getting_started tool to learn about the system.
66
- Use task_documentation_guide, search_workflow_guide, and observation_best_practices for detailed guidance.
124
+ In new chats, call `getting_started` tool to learn about the system.
125
+ Use `task_documentation_guide`, `search_workflow_guide`, and `observation_best_practices` for detailed guidance.
67
126
  ```
68
127
 
69
- **Important:** This system prompt must be manually configured in your AI client. The MCP protocol does not support automatic prompt injection on connection.
128
+ ---
129
+
130
+ ## How It Works
70
131
 
71
- ## How Vector Search Works
132
+ ### Vector Search
72
133
 
73
- This system uses **TF-IDF (Term Frequency-Inverse Document Frequency)** vector search:
134
+ Uses **TF-IDF (Term Frequency-Inverse Document Frequency)** for semantic-like search:
74
135
 
75
136
  - Tokenizes text into meaningful terms
76
137
  - Calculates term importance based on frequency
77
138
  - Uses cosine similarity to rank results
78
139
  - Works entirely offline with no external dependencies
79
140
 
80
- No configuration needed - it just works!
141
+ ```
142
+ Query: "login" → Finds: "authentication", "JWT", "OAuth", "user session"
143
+ Query: "slow API" → Finds: "performance", "optimization", "caching", "database index"
144
+ ```
145
+
146
+ ### Multi-Project Support
147
+
148
+ Organize knowledge by project when working on multiple codebases:
149
+
150
+ ```javascript
151
+ // Record a task with project context
152
+ await record_task_completion({
153
+ project: "my-app",
154
+ task_name: "Task_Add_JWT_Auth",
155
+ observations: ["Added JWT middleware at /src/auth/jwt.js"]
156
+ })
157
+
158
+ // Search within a specific project
159
+ await search_collective_memory({
160
+ project: "my-app",
161
+ query: "authentication"
162
+ })
163
+ ```
164
+
165
+ ---
81
166
 
82
167
  ## Entity Types
83
168
 
84
169
  | Type | Description |
85
170
  |------|-------------|
86
- | `agent` | Represents an autonomous AI agent |
171
+ | `agent` | An autonomous AI agent |
87
172
  | `task` | A unit of work completed by an agent |
88
173
  | `structure` | Architectural decisions or code patterns |
89
174
  | `artifact` | Concrete outputs like files or configurations |
90
175
  | `session` | A continuous work context grouping related tasks |
176
+ | `project` | Groups tasks by project/repository |
177
+
178
+ ---
91
179
 
92
180
  ## Relation Types
93
181
 
94
- | Type | From -> To | Description |
182
+ | Type | From To | Description |
95
183
  |------|------------|-------------|
96
- | `executed_by` | Task -> Agent | Links task to executing agent |
97
- | `created` | Task -> Artifact | Task produced an artifact |
98
- | `modified` | Task -> Structure | Task changed existing structure |
99
- | `documented` | Task -> Structure | Task defined a structure |
100
- | `depends_on` | Task -> Task | Task dependency |
101
- | `part_of` | Task -> Session | Groups tasks in session |
102
- | `similar_to` | Task -> Task | Similar problem solutions |
103
- | `uses` | Task -> Artifact | Task consumed artifact |
104
- | `implements` | Artifact -> Structure | Artifact implements structure |
184
+ | `executed_by` | Task Agent | Links task to executing agent |
185
+ | `created` | Task Artifact | Task produced an artifact |
186
+ | `modified` | Task Structure | Task changed existing structure |
187
+ | `documented` | Task Structure | Task defined a structure |
188
+ | `depends_on` | Task Task | Task dependency |
189
+ | `part_of` | Task Session/Project | Groups tasks in session or project |
190
+ | `similar_to` | Task Task | Similar problem solutions |
191
+ | `uses` | Task Artifact | Task consumed artifact |
192
+ | `implements` | Artifact Structure | Artifact implements structure |
193
+
194
+ ---
105
195
 
106
196
  ## API Tools
107
197
 
108
- ### Entity Management
198
+ ### Core Workflow
109
199
 
110
- - **create_entities** - Create multiple new entities
111
- - **delete_entities** - Remove entities with cascade delete
112
- - **add_observations** - Add observations to existing entities
113
- - **delete_observations** - Remove specific observations
114
-
115
- ### Relation Management
200
+ | Tool | Purpose |
201
+ |------|---------|
202
+ | `record_task_completion` | **PRIMARY** - Document completed work with full context |
203
+ | `search_collective_memory` | Vector search with ranked results |
204
+ | `find_similar_procedures` | Find similar tasks with full implementation details |
116
205
 
117
- - **create_relations** - Create directed relations between entities
118
- - **delete_relations** - Remove specific relations
206
+ ### Entity Management
119
207
 
120
- ### Query & Search
208
+ | Tool | Purpose |
209
+ |------|---------|
210
+ | `create_entities` | Create multiple new entities |
211
+ | `delete_entities` | Remove entities with cascade delete |
212
+ | `add_observations` | Add observations to existing entities |
213
+ | `delete_observations` | Remove specific observations |
121
214
 
122
- - **read_graph** - Read entire knowledge graph
123
- - **search_collective_memory** - Vector search with ranked results
124
- - **open_nodes** - Retrieve specific nodes by name
215
+ ### Relation Management
125
216
 
126
- ### Agent Workflow
217
+ | Tool | Purpose |
218
+ |------|---------|
219
+ | `create_relations` | Create directed relations between entities |
220
+ | `delete_relations` | Remove specific relations |
127
221
 
128
- - **record_task_completion** - Primary tool for documenting completed work
129
- - **find_similar_procedures** - Find similar tasks with full implementation details
222
+ ### Query & Guidance
130
223
 
131
- ### Guidance
224
+ | Tool | Purpose |
225
+ |------|---------|
226
+ | `read_graph` | Read entire knowledge graph |
227
+ | `open_nodes` | Retrieve specific nodes by name |
228
+ | `getting_started` | Introduction to the system |
229
+ | `task_documentation_guide` | How to document completed tasks |
230
+ | `search_workflow_guide` | How to search and learn from past work |
231
+ | `observation_best_practices` | How to write effective observations |
132
232
 
133
- - **getting_started** - Introduction to the Collective Memory System (call in new chats)
134
- - **task_documentation_guide** - How to document completed tasks properly
135
- - **search_workflow_guide** - How to search and learn from past work
136
- - **observation_best_practices** - How to write effective observations
233
+ ---
137
234
 
138
- ## Example Usage
235
+ ## Examples
139
236
 
140
237
  ### Recording a Task Completion
141
238
 
142
239
  ```javascript
143
- await session.callTool("record_task_completion", {
240
+ await record_task_completion({
144
241
  agent_name: "Agent_Backend_Developer",
145
- task_name: "Task_Implement_Pagination",
242
+ task_name: "Task_Implement_Pagination_20241224",
243
+ project: "my-backend-api",
146
244
  task_type: "implementation",
147
245
  description: "Added cursor-based pagination to all list endpoints",
148
246
  observations: [
@@ -150,21 +248,19 @@ await session.callTool("record_task_completion", {
150
248
  "Cursor encodes last_seen_id and last_seen_timestamp",
151
249
  "Default page size: 50 items, max: 200"
152
250
  ],
153
- created_artifacts: [
154
- {
155
- name: "Artifact_Pagination_Middleware",
156
- observations: ["Located at /src/middleware/pagination.js"]
157
- }
158
- ],
159
- session_id: "Session_API_Performance_Optimization"
251
+ created_artifacts: [{
252
+ name: "Artifact_Pagination_Middleware",
253
+ observations: ["Located at /src/middleware/pagination.js"]
254
+ }]
160
255
  });
161
256
  ```
162
257
 
163
- ### Finding Similar Procedures (Vector Search)
258
+ ### Finding Similar Procedures
164
259
 
165
260
  ```javascript
166
- const result = await session.callTool("find_similar_procedures", {
167
- query: "authentication implementation"
261
+ const result = await find_similar_procedures({
262
+ query: "authentication implementation",
263
+ project: "my-backend-api" // Optional: filter by project
168
264
  });
169
265
 
170
266
  // Returns ranked results with similarity scores:
@@ -177,37 +273,26 @@ const result = await session.callTool("find_similar_procedures", {
177
273
  // }
178
274
  ```
179
275
 
180
- ### Searching the Collective Memory
181
-
182
- ```javascript
183
- const result = await session.callTool("search_collective_memory", {
184
- query: "database optimization"
185
- });
186
-
187
- // Returns matching entities with similarity scores
188
- ```
276
+ ---
189
277
 
190
278
  ## Database
191
279
 
192
- The server uses JSON file storage for persistence. Data is stored at:
280
+ Data is stored locally at:
193
281
 
194
282
  ```
195
- ~/.collective-memory/memory.json # Knowledge graph data
283
+ ~/.collective-memory/memory.json
196
284
  ```
197
285
 
198
- ## Vector Search Benefits
286
+ No database setup required. Everything is stored as JSON.
199
287
 
200
- | Traditional Keyword Search | TF-IDF Vector Search |
201
- |---------------------------|---------------------|
202
- | Exact word matching required | Finds related terms automatically |
203
- | No relevance ranking | Results ranked by similarity score (0-1) |
204
- | "login" misses "authentication" | "login" finds "authentication", "JWT", "OAuth" |
205
- | High false-positive rate | More precise, relevant results |
288
+ ---
206
289
 
207
290
  ## Requirements
208
291
 
209
292
  - Node.js 18+
210
293
 
294
+ ---
295
+
211
296
  ## License
212
297
 
213
298
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "collective-memory-mcp",
3
- "version": "0.6.5",
3
+ "version": "0.7.0",
4
4
  "description": "A persistent, graph-based memory system for AI agents with TF-IDF vector search (MCP Server)",
5
5
  "type": "module",
6
6
  "main": "src/server.js",
package/src/models.js CHANGED
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Valid entity types
7
7
  */
8
- export const ENTITY_TYPES = ["agent", "task", "structure", "artifact", "session"];
8
+ export const ENTITY_TYPES = ["agent", "task", "structure", "artifact", "session", "project"];
9
9
 
10
10
  /**
11
11
  * Valid relation types