@vheins/local-memory-mcp 0.1.0 → 0.1.2

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 (79) hide show
  1. package/.kiro/specs/memory-mcp-optimization/.config.kiro +1 -0
  2. package/.vscode/tasks.json +27 -0
  3. package/README.md +136 -0
  4. package/package.json +1 -5
  5. package/DASHBOARD.md +0 -129
  6. package/HYBRID_SEARCH.md +0 -204
  7. package/IMPLEMENTATION.md +0 -159
  8. package/dist/dashboard/dashboard.test.js +0 -362
  9. package/dist/mcp/client.test.js +0 -130
  10. package/dist/resources/index.test.js +0 -96
  11. package/dist/router.test.js +0 -113
  12. package/dist/storage/sqlite.d.ts +0 -95
  13. package/dist/storage/sqlite.d.ts.map +0 -1
  14. package/dist/storage/sqlite.js +0 -537
  15. package/dist/storage/sqlite.js.map +0 -1
  16. package/dist/storage/sqlite.test.d.ts +0 -2
  17. package/dist/storage/sqlite.test.d.ts.map +0 -1
  18. package/dist/storage/sqlite.test.js +0 -358
  19. package/dist/storage/sqlite.test.js.map +0 -1
  20. package/dist/storage/vectors.stub.d.ts +0 -12
  21. package/dist/storage/vectors.stub.d.ts.map +0 -1
  22. package/dist/storage/vectors.stub.js +0 -88
  23. package/dist/storage/vectors.stub.js.map +0 -1
  24. package/dist/tools/memory.search.test.js +0 -181
  25. package/dist/utils/logger.test.js +0 -84
  26. package/dist/utils/normalize.test.js +0 -159
  27. package/dist/utils/query-expander.test.js +0 -35
  28. package/docs/PRD.md +0 -199
  29. package/docs/PROMPT-agent.md +0 -139
  30. package/docs/SPEC-git-scope.md +0 -172
  31. package/docs/SPEC-heuristics.md +0 -199
  32. package/docs/SPEC-server.md +0 -243
  33. package/docs/SPEC-skeleton.md +0 -255
  34. package/docs/SPEC-sqlite-schema.md +0 -183
  35. package/docs/SPEC-tool-schema.md +0 -201
  36. package/docs/SPEC-vector-search.md +0 -198
  37. package/docs/TEST-scenarios.md +0 -179
  38. package/scripts/update-null-titles-ai.mjs +0 -272
  39. package/scripts/update-titles-batch.mjs +0 -71
  40. package/scripts/update-titles.mjs +0 -66
  41. package/seed-data.mjs +0 -151
  42. package/src/capabilities.ts +0 -22
  43. package/src/dashboard/dashboard.test.ts +0 -546
  44. package/src/dashboard/public/app.js +0 -1187
  45. package/src/dashboard/public/chart.js +0 -0
  46. package/src/dashboard/public/index.html +0 -967
  47. package/src/dashboard/server.ts +0 -347
  48. package/src/mcp/client.test.ts +0 -164
  49. package/src/mcp/client.ts +0 -212
  50. package/src/prompts/registry.ts +0 -89
  51. package/src/resources/index.test.ts +0 -132
  52. package/src/resources/index.ts +0 -113
  53. package/src/router.test.ts +0 -145
  54. package/src/router.ts +0 -80
  55. package/src/server.ts +0 -99
  56. package/src/storage/sqlite.test.ts +0 -504
  57. package/src/storage/sqlite.ts +0 -688
  58. package/src/storage/vectors.stub.ts +0 -101
  59. package/src/tools/memory.delete.ts +0 -37
  60. package/src/tools/memory.recap.ts +0 -61
  61. package/src/tools/memory.search.test.ts +0 -276
  62. package/src/tools/memory.search.ts +0 -244
  63. package/src/tools/memory.store.ts +0 -56
  64. package/src/tools/memory.summarize.ts +0 -23
  65. package/src/tools/memory.update.ts +0 -46
  66. package/src/tools/schemas.ts +0 -261
  67. package/src/types.ts +0 -36
  68. package/src/utils/git-scope.ts +0 -42
  69. package/src/utils/logger.test.ts +0 -125
  70. package/src/utils/logger.ts +0 -53
  71. package/src/utils/mcp-response.ts +0 -116
  72. package/src/utils/normalize.test.ts +0 -203
  73. package/src/utils/normalize.ts +0 -53
  74. package/src/utils/query-expander.test.ts +0 -40
  75. package/src/utils/query-expander.ts +0 -60
  76. package/storage/.gitkeep +0 -5
  77. package/test.sh +0 -48
  78. package/tsconfig.json +0 -21
  79. package/vitest.config.ts +0 -10
@@ -0,0 +1 @@
1
+ {"specId": "a9aa2a01-bac5-484c-8b95-7f5536bca00e", "workflowType": "requirements-first", "specType": "feature"}
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "label": "Start Dashboard",
6
+ "type": "shell",
7
+ "command": "npm",
8
+ "args": ["run", "dashboard"],
9
+ "options": {
10
+ "cwd": "/home/vheins/Projects/local-memory-mcp"
11
+ },
12
+ "group": "build",
13
+ "presentation": {
14
+ "echo": true,
15
+ "reveal": "silent",
16
+ "focus": false,
17
+ "panel": "shared",
18
+ "showReuseMessage": true,
19
+ "clear": false
20
+ },
21
+ "isBackground": true,
22
+ "runOptions": {
23
+ "runOn": "folderOpen"
24
+ }
25
+ }
26
+ ]
27
+ }
package/README.md CHANGED
@@ -15,13 +15,149 @@ This project implements a local memory service using Node.js and SQLite with vec
15
15
  - **MCP Protocol**: Full implementation of MCP resources, tools, and prompts
16
16
  - **Web Dashboard**: Browser-based UI for visualizing and managing memories
17
17
 
18
+ ## Quick Start (npx)
19
+
20
+ The easiest way to use this MCP server is via npx - no installation required:
21
+
22
+ ```bash
23
+ npx @vheins/local-memory-mcp
24
+ ```
25
+
18
26
  ## Installation
19
27
 
28
+ ### Local Development
29
+
20
30
  ```bash
21
31
  npm install
22
32
  npm run build
23
33
  ```
24
34
 
35
+ ### Global Install
36
+
37
+ ```bash
38
+ npm install -g @vheins/local-memory-mcp
39
+ mcp-memory-local
40
+ ```
41
+
42
+ ## MCP Client Configuration
43
+
44
+ This server works with any MCP-compatible client. Add it to your configuration:
45
+
46
+ ### OpenCode
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "local-memory": {
52
+ "command": "npx",
53
+ "args": ["@vheins/local-memory-mcp"]
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ### Claude Desktop (claude.ai)
60
+
61
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
62
+
63
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "local-memory": {
69
+ "command": "npx",
70
+ "args": ["@vheins/local-memory-mcp"]
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ ### Cursor
77
+
78
+ Settings → Features → Models → "Edit JSON"
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "local-memory": {
84
+ "command": "npx",
85
+ "args": ["@vheins/local-memory-mcp"]
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### Kiro Antigravity
92
+
93
+ Add to your MCP configuration file:
94
+
95
+ ```json
96
+ {
97
+ "servers": {
98
+ "local-memory": {
99
+ "command": "npx",
100
+ "args": ["@vheins/local-memory-mcp"]
101
+ }
102
+ }
103
+ }
104
+ ```
105
+
106
+ ### Trae
107
+
108
+ Settings → Integrations → MCP → Add Server
109
+
110
+ ```json
111
+ {
112
+ "command": "npx",
113
+ "args": ["@vheins/local-memory-mcp"]
114
+ }
115
+ ```
116
+
117
+ ### Gemini CLI
118
+
119
+ ```bash
120
+ gemini mcp add local-memory -- npx @vheins/local-memory-mcp
121
+ ```
122
+
123
+ ### Codex
124
+
125
+ ```json
126
+ {
127
+ "mcp_servers": {
128
+ "local-memory": {
129
+ "command": "npx",
130
+ "args": ["@vheins/local-memory-mcp"]
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ ### VS Code (with MCP extension)
137
+
138
+ ```json
139
+ {
140
+ "mcpServers": {
141
+ "local-memory": {
142
+ "command": "npx",
143
+ "args": ["@vheins/local-memory-mcp"]
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ ### Other MCP Clients
150
+
151
+ For any other MCP-compatible client, use:
152
+
153
+ - **Command**: `npx`
154
+ - **Args**: `["@vheins/local-memory-mcp"]`
155
+
156
+ Or build from source:
157
+
158
+ - **Command**: `node`
159
+ - **Args**: `["/path/to/dist/server.js"]`
160
+
25
161
  ## Usage
26
162
 
27
163
  ### MCP Server
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@vheins/local-memory-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "MCP Local Memory Service for coding copilot agents",
5
5
  "type": "module",
6
6
  "main": "dist/server.js",
7
- "bin": {
8
- "mcp-memory-local": "./dist/server.js",
9
- "mcp-memory-dashboard": "./dist/dashboard/server.js"
10
- },
11
7
  "scripts": {
12
8
  "build": "tsc && mkdir -p dist/dashboard/public && rsync -a --delete src/dashboard/public/ dist/dashboard/public/",
13
9
  "dev": "tsc --watch",
package/DASHBOARD.md DELETED
@@ -1,129 +0,0 @@
1
- # MCP Memory Dashboard
2
-
3
- A web-based dashboard for managing and visualizing MCP Local Memory data.
4
-
5
- ## Features
6
-
7
- - **Live Connection Status**: Real-time monitoring of MCP server connection
8
- - **Repository Scoping**: View memories filtered by repository
9
- - **Summary Statistics**: Quick overview of total memories, by type, and unused entries
10
- - **Visual Charts**:
11
- - Memory distribution by type (pie chart)
12
- - Top 10 memories by importance (bar chart)
13
- - **Memory Management**:
14
- - Browse all memories with sortable columns
15
- - Filter by type (decision, mistake, code_fact, pattern)
16
- - View detailed memory information
17
- - Edit memory content and importance
18
- - Delete memories with confirmation
19
- - **Operations-First Design**: Clear, data-dense interface optimized for daily use
20
-
21
- ## Quick Start
22
-
23
- 1. **Build the project**:
24
- ```bash
25
- npm run build
26
- ```
27
-
28
- 2. **Start the dashboard**:
29
- ```bash
30
- npm run dashboard
31
- ```
32
-
33
- 3. **Access the dashboard**:
34
- Open your browser to `http://localhost:3456`
35
-
36
- ## Architecture
37
-
38
- The dashboard is a thin presentation layer that:
39
-
40
- - Spawns the MCP server as a subprocess
41
- - Communicates via JSON-RPC (stdin/stdout)
42
- - Uses MCP tools exclusively (no direct database access):
43
- - `memory.search` - List and filter memories
44
- - `memory.update` - Edit memories
45
- - `memory.delete` - Remove memories
46
- - Resources API - Read individual memory details
47
-
48
- ## Safety Features
49
-
50
- - **Confirmation Required**: All destructive actions require explicit confirmation
51
- - **Type "DELETE" Verification**: Memory deletion requires typing "DELETE" to proceed
52
- - **Read-Only Fields**: Repository scope and type cannot be changed
53
- - **Connection Monitoring**: Dashboard disables actions when MCP is offline
54
-
55
- ## API Endpoints
56
-
57
- The dashboard server exposes these REST endpoints:
58
-
59
- - `GET /api/health` - Check MCP connection status
60
- - `GET /api/repos` - List all repositories
61
- - `GET /api/stats` - Get statistics (total, by type, top memories)
62
- - `GET /api/memories` - List memories with filtering and sorting
63
- - `GET /api/memories/:id` - Get memory detail
64
- - `PUT /api/memories/:id` - Update memory (content, importance)
65
- - `DELETE /api/memories/:id` - Delete memory
66
-
67
- ## Configuration
68
-
69
- - **Port**: Set `PORT` environment variable (default: 3456)
70
- - **MCP Server**: Automatically spawned from `dist/server.js`
71
-
72
- ## Known Limitations
73
-
74
- 1. ~~**Memory Search Constraints**~~: RESOLVED - Dashboard now uses direct database access for listing all memories, bypassing the MCP search limitation.
75
-
76
- 2. ~~**Unused Memory Tracking**~~: RESOLVED - The SQLite schema now includes `hit_count`, `recall_count`, and `last_used_at` columns for full usage tracking.
77
-
78
- 3. **Chart.js CDN**: Charts use Chart.js from CDN, which may be blocked in some environments. The dashboard shows a graceful fallback message when unavailable: "Chart.js not available. Install locally for visualizations."
79
-
80
- ## Similarity Search
81
-
82
- The system now uses **ultra-lightweight text-based similarity** instead of heavy ML models:
83
- - Normalized token vectors with term frequency
84
- - Cosine similarity for matching
85
- - No GPU dependencies or model servers required
86
- - Zero startup cost and minimal memory overhead
87
- - Query latency < 20ms for typical memory counts
88
-
89
- This approach provides:
90
- - Typo tolerance through normalized text
91
- - Basic semantic grouping
92
- - Deterministic and predictable behavior
93
- - Perfect for 100-2,000 memories
94
-
95
- ## Acceptance Criteria Compliance
96
-
97
- This dashboard satisfies all acceptance criteria:
98
-
99
- ✅ **AC-A1-A2**: MCP connection status and handling
100
- ✅ **AC-B1-B3**: Memory listing with repo scoping and sorting
101
- ✅ **AC-C1-C2**: Detail view with read-only fields
102
- ✅ **AC-D1-D3**: Memory editing with constraints and feedback
103
- ✅ **AC-E1-E3**: Soft delete with confirmation
104
- ✅ **AC-F1-F2**: Accurate statistics and unused detection
105
- ✅ **AC-G1-G2**: Chart rendering and consistency
106
- ✅ **AC-H1-H2**: No direct DB access, explicit mutations
107
- ✅ **AC-I1-I2**: No accidental actions, clear errors
108
- ✅ **AC-J1**: Fast load time for reasonable memory counts
109
-
110
- ## Development
111
-
112
- The dashboard consists of:
113
-
114
- - **Backend**: Express server (`src/dashboard/server.ts`)
115
- - MCP client implementation
116
- - REST API endpoints
117
- - Static file serving
118
-
119
- - **Frontend**: Single-page app (`src/dashboard/public/index.html`)
120
- - Vanilla JavaScript (no framework overhead)
121
- - Chart.js for visualizations
122
- - Operations-focused UX
123
-
124
- ## Notes
125
-
126
- - This dashboard does NOT modify MCP schemas or storage
127
- - All data operations go through official MCP tools
128
- - The MCP server is a subprocess, not a library import
129
- - If MCP server stops, dashboard enters degraded state
package/HYBRID_SEARCH.md DELETED
@@ -1,204 +0,0 @@
1
- # Hybrid Similarity + Vector Search
2
-
3
- ## Overview
4
-
5
- The MCP Local Memory system implements a **hybrid search strategy** that combines:
6
-
7
- 1. **Lightweight text similarity** (primary, mandatory)
8
- 2. **Vector/semantic search** (secondary, optional boost)
9
-
10
- This approach provides precision through deterministic similarity while improving recall with semantic understanding.
11
-
12
- ## Architecture
13
-
14
- ### Search Pipeline
15
-
16
- ```
17
- memory.search(query, repo)
18
-
19
- 1. Repo filter (HARD)
20
-
21
- 2. Lightweight similarity scoring (MANDATORY)
22
-
23
- 3. Candidate pruning (top K × 3)
24
-
25
- 4. OPTIONAL vector similarity re-rank
26
-
27
- 5. Final ranking & threshold
28
-
29
- 6. Return memory IDs
30
- ```
31
-
32
- **Key Principle:** Vector search is NEVER step 1. It only re-ranks candidates identified by similarity.
33
-
34
- ## Scoring Formula
35
-
36
- ### Hybrid Mode (with vector search)
37
- ```
38
- FinalScore = (SimilarityScore × 0.6) + (VectorScore × 0.3) + (ImportanceBoost × 0.1)
39
- ```
40
-
41
- Where:
42
- - `SimilarityScore` ∈ [0.0 – 1.0] from text-based cosine similarity
43
- - `VectorScore` ∈ [0.0 – 1.0] from semantic embedding similarity
44
- - `ImportanceBoost` = importance / 5
45
-
46
- ### Fallback Mode (similarity-only)
47
- ```
48
- FinalScore = (SimilarityScore × 0.85) + (ImportanceBoost × 0.15)
49
- ```
50
-
51
- When vector search is unavailable or fails, weights are redistributed to maintain ranking quality.
52
-
53
- ## Implementation Details
54
-
55
- ### Text-Based Similarity (Tier 1)
56
-
57
- **Always computed**, provides:
58
- - Fast filtering
59
- - Typo tolerance
60
- - Deterministic results
61
-
62
- Algorithm:
63
- 1. Normalize text (lowercase, strip punctuation)
64
- 2. Remove stopwords
65
- 3. Build term frequency (TF) vector
66
- 4. Compute cosine similarity
67
-
68
- ### Vector Search (Tier 2)
69
-
70
- **Optional boost**, provides:
71
- - Paraphrase matching
72
- - Semantic recall
73
- - Abstract concept linking
74
-
75
- Rules:
76
- - Runs ONLY on top-K candidates from similarity
77
- - NEVER expands search universe
78
- - NEVER overrides similarity completely
79
- - Gracefully degrades if unavailable
80
-
81
- ## Failsafe Behavior
82
-
83
- ```typescript
84
- try {
85
- const vectorResults = await vectors.search(query, candidates.length);
86
- // Use hybrid ranking
87
- } catch (error) {
88
- console.error("Vector search failed, using similarity-only");
89
- // Automatically fall back to similarity-only ranking
90
- }
91
- ```
92
-
93
- The system behaves identically from the caller's perspective - no errors propagate.
94
-
95
- ## Storage
96
-
97
- ### Similarity Vectors
98
- - Computed on-the-fly
99
- - No storage required
100
- - Cached in memory (optional)
101
-
102
- ### Vector Embeddings (Optional)
103
- ```sql
104
- CREATE TABLE IF NOT EXISTS memory_vectors (
105
- memory_id TEXT PRIMARY KEY,
106
- vector TEXT NOT NULL, -- JSON array of floats
107
- updated_at TEXT NOT NULL,
108
- FOREIGN KEY (memory_id) REFERENCES memories(id) ON DELETE CASCADE
109
- );
110
- ```
111
-
112
- Methods:
113
- - `upsertVectorEmbedding(memoryId, vector)` - Store embedding
114
- - `getVectorEmbedding(memoryId)` - Retrieve embedding
115
-
116
- ## Dashboard Observability
117
-
118
- ### Debug View (Future Enhancement)
119
- When search results are displayed, the dashboard can show:
120
- - **SimilarityScore**: Text-based match quality
121
- - **VectorScore**: Semantic match quality (if used)
122
- - **FinalScore**: Combined ranking score
123
-
124
- ### Aggregate Metrics
125
- - Recall rate per search mode
126
- - Percentage of searches using vector boost
127
- - Performance comparison: similarity vs hybrid
128
-
129
- ## Configuration
130
-
131
- ### Weight Tuning
132
- ```typescript
133
- const HYBRID_WEIGHTS = {
134
- similarity: 0.6, // Primary signal
135
- vector: 0.3, // Secondary boost
136
- importance: 0.1 // Tiebreaker
137
- };
138
- ```
139
-
140
- Weights must sum to 1.0. Adjust based on:
141
- - Recall rate metrics
142
- - Query patterns
143
- - Memory content characteristics
144
-
145
- ### Quality Rules
146
- If recall_rate decreases after enabling vector boost:
147
- 1. Reduce vector weight
148
- 2. Or disable vector for that repo
149
- 3. Monitor and iterate
150
-
151
- **Vector is an assistant, not an authority.**
152
-
153
- ## Performance Expectations
154
-
155
- - **Similarity Search**: <20ms for <1k memories
156
- - **Vector Search**: Depends on implementation (embeddings, model)
157
- - **Hybrid Overhead**: Negligible if vector is fast
158
- - **Startup Cost**: ~0 (no model loading required for similarity)
159
-
160
- ## Example Usage
161
-
162
- ### With Vector Search Available
163
- ```typescript
164
- // Returns memories ranked by hybrid score
165
- const results = await handleMemorySearch({
166
- query: "authentication middleware",
167
- repo: "backend-api",
168
- limit: 10
169
- }, db, vectors);
170
-
171
- // Results use: 60% similarity + 30% vector + 10% importance
172
- ```
173
-
174
- ### With Vector Search Unavailable
175
- ```typescript
176
- // Automatically falls back to similarity-only
177
- const results = await handleMemorySearch({
178
- query: "authentication middleware",
179
- repo: "backend-api",
180
- limit: 10
181
- }, db, stubVectors); // Stub returns empty []
182
-
183
- // Results use: 85% similarity + 15% importance
184
- ```
185
-
186
- ## Philosophy
187
-
188
- This hybrid strategy:
189
- - ✅ Preserves precision (similarity as filter)
190
- - ✅ Improves recall (vector as booster)
191
- - ✅ Avoids overfitting to ML (deterministic-first)
192
- - ✅ Gracefully degrades (no hard dependencies)
193
-
194
- It is the correct balance for MCP Local Memory: **boring, predictable, fast** with optional semantic enhancement.
195
-
196
- ## Activation Message
197
-
198
- When the system is running with hybrid search enabled:
199
-
200
- **"Hybrid similarity + vector search active. Deterministic-first strategy enabled."**
201
-
202
- When vector search is not available:
203
-
204
- **"Similarity-only search active. Vector search unavailable (graceful degradation)."**
package/IMPLEMENTATION.md DELETED
@@ -1,159 +0,0 @@
1
- # Implementation Summary
2
-
3
- ## MCP Local Memory Server - COMPLETE ✅
4
-
5
- **Status:** Fully implemented and tested according to all documentation specifications.
6
-
7
- ### What Was Built
8
-
9
- A complete MCP (Model Context Protocol) server that provides long-term memory capabilities for coding copilot agents. The implementation strictly follows the documented architecture in the `docs/` folder.
10
-
11
- ### Architecture Components
12
-
13
- #### 1. MCP Server Core
14
- - **server.ts**: JSON-RPC protocol handler with stdin/stdout communication
15
- - **capabilities.ts**: MCP contract definition (resources, tools, prompts)
16
- - **router.ts**: Method dispatcher routing requests to appropriate handlers
17
-
18
- #### 2. Storage Layer
19
- - **storage/sqlite.ts**: SQLite database with proper schema and migrations
20
- - `memories` table: All memory entries with repo scoping
21
- - `memory_summary` table: Antigravity summaries per repo
22
- - Indexes on repo, type, and importance
23
- - **storage/vectors.stub.ts**: Vector search stub ready for embedding integration
24
-
25
- #### 3. Tools (MCP Tools)
26
- - **memory.store**: Store new memory entries with strict validation
27
- - **memory.search**: Semantic search with keyword fallback
28
- - **memory.update**: Update existing memory entries
29
- - **memory.summarize**: Create/update antigravity summaries
30
-
31
- #### 4. Resources (MCP Resources)
32
- - **memory://index**: Recent memory entries metadata
33
- - **memory://{id}**: Individual memory entry
34
- - **memory://summary/{repo}**: Project-level summary
35
-
36
- #### 5. Prompts (MCP Prompts)
37
- - **memory-agent-core**: Core behavioral contract for agents
38
- - **memory-index-policy**: Memory discipline enforcement
39
- - **tool-usage-guidelines**: Tool usage best practices
40
-
41
- #### 6. Utilities
42
- - **utils/git-scope.ts**: Git repository scope resolver
43
- - **utils/normalize.ts**: Text normalization for search
44
-
45
- ### Key Features Implemented
46
-
47
- ✅ **Git Scope Isolation**: Memories are strictly scoped per repository
48
- ✅ **Strict Validation**: Zod schemas enforce data quality
49
- ✅ **Memory Types**: code_fact, decision, mistake, pattern
50
- ✅ **Importance Scoring**: 1-5 importance levels
51
- ✅ **Semantic Search Stub**: Ready for vector embedding integration
52
- ✅ **Keyword Fallback**: Works without vector embeddings
53
- ✅ **Antigravity Summaries**: Project-level context anchoring
54
- ✅ **MCP Protocol Compliant**: Full MCP 2024-11-05 protocol support
55
-
56
- ### Testing
57
-
58
- All behavioral contracts from `TEST-scenarios.md` validated:
59
-
60
- ✅ Store architectural decisions
61
- ✅ Store mistakes to avoid repetition
62
- ✅ Store code patterns
63
- ✅ Cross-repo isolation (no memory leakage)
64
- ✅ Semantic search with typo tolerance
65
- ✅ Fallback to keyword search when vector unavailable
66
- ✅ Project summaries for antigravity behavior
67
-
68
- ### Code Quality
69
-
70
- ✅ **Code Review**: Completed with minor redundancies removed
71
- ✅ **Security Scan**: No vulnerabilities found (CodeQL)
72
- ✅ **Build**: TypeScript compiles without errors
73
- ✅ **Tests**: All test scenarios pass
74
-
75
- ### Design Compliance
76
-
77
- The implementation follows all specifications:
78
- - ✅ PRD (Product Requirements Document)
79
- - ✅ SPEC-heuristics (Auto-Memory rules)
80
- - ✅ SPEC-server (MCP contract)
81
- - ✅ SPEC-skeleton (Server structure)
82
- - ✅ SPEC-git-scope (Scope resolution)
83
- - ✅ SPEC-tool-schema (Tool validation)
84
- - ✅ SPEC-sqlite-schema (Database schema)
85
- - ✅ SPEC-vector-search (Vector layer)
86
- - ✅ TEST-scenarios (Behavioral tests)
87
- - ✅ PROMPT-agent (Agent behavior)
88
-
89
- ### Usage Example
90
-
91
- ```bash
92
- # Build
93
- npm install
94
- npm run build
95
-
96
- # Run server
97
- node dist/server.js
98
-
99
- # Store a memory (via JSON-RPC)
100
- {
101
- "jsonrpc":"2.0",
102
- "id":1,
103
- "method":"tools/call",
104
- "params":{
105
- "name":"memory.store",
106
- "arguments":{
107
- "type":"decision",
108
- "content":"Use React Query for all data fetching",
109
- "importance":5,
110
- "scope":{"repo":"frontend-app"}
111
- }
112
- }
113
- }
114
-
115
- # Search memories
116
- {
117
- "jsonrpc":"2.0",
118
- "id":2,
119
- "method":"tools/call",
120
- "params":{
121
- "name":"memory.search",
122
- "arguments":{
123
- "query":"data fetching",
124
- "repo":"frontend-app",
125
- "limit":5
126
- }
127
- }
128
- }
129
- ```
130
-
131
- ### Next Steps (Future Enhancements)
132
-
133
- The implementation is production-ready but can be extended:
134
-
135
- 1. **Vector Embeddings**: Replace stub with real embedding model
136
- - Ollama integration
137
- - llama.cpp integration
138
- - OpenAI embeddings (with privacy controls)
139
-
140
- 2. **Enhanced Search**: Improve ranking algorithm
141
- - Temporal decay
142
- - Usage frequency
143
- - Cross-reference scoring
144
-
145
- 3. **Memory Management**: Add lifecycle management
146
- - Archival policies
147
- - Memory consolidation
148
- - Duplicate detection
149
-
150
- 4. **Monitoring**: Add observability
151
- - Memory growth tracking
152
- - Search performance metrics
153
- - Agent usage patterns
154
-
155
- ### Conclusion
156
-
157
- **MCP Local Memory loaded. Documentation verified. Ready to execute.**
158
-
159
- The implementation is complete, tested, secure, and ready for production use. All documented behavioral contracts are satisfied. The server provides a solid foundation for long-term agent memory with clear extension points for future enhancements.