@pcircle/memesh 2.11.0 → 3.0.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 +153 -52
- package/dist/cli/assets/d3.v7.min.js +2 -0
- package/dist/cli/view.d.ts +1 -0
- package/dist/cli/view.d.ts.map +1 -1
- package/dist/cli/view.js +2198 -10
- package/dist/cli/view.js.map +1 -1
- package/dist/core/config.d.ts +33 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +70 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/extractor.d.ts +26 -0
- package/dist/core/extractor.d.ts.map +1 -0
- package/dist/core/extractor.js +106 -0
- package/dist/core/extractor.js.map +1 -0
- package/dist/core/lifecycle.d.ts +9 -0
- package/dist/core/lifecycle.d.ts.map +1 -0
- package/dist/core/lifecycle.js +51 -0
- package/dist/core/lifecycle.js.map +1 -0
- package/dist/core/operations.d.ts +9 -0
- package/dist/core/operations.d.ts.map +1 -0
- package/dist/core/operations.js +342 -0
- package/dist/core/operations.js.map +1 -0
- package/dist/core/query-expander.d.ts +4 -0
- package/dist/core/query-expander.d.ts.map +1 -0
- package/dist/core/query-expander.js +114 -0
- package/dist/core/query-expander.js.map +1 -0
- package/dist/core/schema-export.d.ts +2 -0
- package/dist/core/schema-export.d.ts.map +1 -0
- package/dist/core/schema-export.js +67 -0
- package/dist/core/schema-export.js.map +1 -0
- package/dist/core/scoring.d.ts +25 -0
- package/dist/core/scoring.d.ts.map +1 -0
- package/dist/core/scoring.js +40 -0
- package/dist/core/scoring.js.map +1 -0
- package/dist/core/types.d.ts +124 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/version-check.d.ts +10 -0
- package/dist/core/version-check.d.ts.map +1 -0
- package/dist/core/version-check.js +44 -0
- package/dist/core/version-check.js.map +1 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +33 -0
- package/dist/db.js.map +1 -1
- package/dist/knowledge-graph.d.ts +16 -30
- package/dist/knowledge-graph.d.ts.map +1 -1
- package/dist/knowledge-graph.js +205 -24
- package/dist/knowledge-graph.js.map +1 -1
- package/dist/mcp/server.js +8 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +1 -92
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +1 -182
- package/dist/mcp/tools.js.map +1 -1
- package/dist/transports/cli/cli.d.ts +3 -0
- package/dist/transports/cli/cli.d.ts.map +1 -0
- package/dist/transports/cli/cli.js +378 -0
- package/dist/transports/cli/cli.js.map +1 -0
- package/dist/transports/http/server.d.ts +5 -0
- package/dist/transports/http/server.d.ts.map +1 -0
- package/dist/transports/http/server.js +314 -0
- package/dist/transports/http/server.js.map +1 -0
- package/dist/transports/mcp/handlers.d.ts +184 -0
- package/dist/transports/mcp/handlers.d.ts.map +1 -0
- package/dist/transports/mcp/handlers.js +271 -0
- package/dist/transports/mcp/handlers.js.map +1 -0
- package/hooks/hooks.json +24 -0
- package/package.json +27 -9
- package/plugin.json +4 -4
- package/scripts/hooks/post-commit.js +35 -6
- package/scripts/hooks/pre-compact.js +198 -0
- package/scripts/hooks/session-start.js +73 -25
- package/scripts/hooks/session-summary.js +255 -0
package/README.md
CHANGED
|
@@ -1,86 +1,187 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">MeMesh LLM Memory</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>The lightest universal AI memory layer.</strong><br />
|
|
5
|
+
One SQLite file. Any LLM. Zero cloud.
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@pcircle/memesh"><img src="https://img.shields.io/npm/v/@pcircle/memesh?style=flat-square&color=3b82f6&label=npm" alt="npm" /></a>
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-22c55e?style=flat-square" alt="MIT" /></a>
|
|
10
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-22c55e?style=flat-square" alt="Node" /></a>
|
|
11
|
+
<a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-compatible-a855f7?style=flat-square" alt="MCP" /></a>
|
|
12
|
+
<a href="https://pypi.org/project/memesh/"><img src="https://img.shields.io/badge/pip-memesh-3b82f6?style=flat-square" alt="PyPI" /></a>
|
|
13
|
+
</p>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Your AI forgets everything between sessions. **MeMesh fixes that.**
|
|
19
|
+
|
|
20
|
+
Install once, configure in 30 seconds, and every AI tool you use — Claude, GPT, LLaMA, or any MCP client — gets persistent, searchable, evolving memory. No cloud. No Neo4j. No vector database. Just one SQLite file.
|
|
2
21
|
|
|
3
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @pcircle/memesh
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Dashboard
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="docs/images/dashboard-search.png" alt="MeMesh Search" width="100%" />
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="docs/images/dashboard-analytics.png" alt="MeMesh Analytics" width="100%" />
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<img src="docs/images/dashboard-browse.png" alt="MeMesh Browse" width="100%" />
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
Run `memesh` to open the interactive dashboard with Search, Browse, Analytics, Manage, and Settings.
|
|
4
43
|
|
|
5
|
-
|
|
6
|
-
[](LICENSE)
|
|
7
|
-
[](https://nodejs.org)
|
|
8
|
-
[](https://modelcontextprotocol.io)
|
|
44
|
+
---
|
|
9
45
|
|
|
10
|
-
##
|
|
46
|
+
## Quick Start
|
|
11
47
|
|
|
12
48
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
49
|
+
# Store a memory
|
|
50
|
+
memesh remember --name "auth-decision" --type "decision" --obs "Use OAuth 2.0 with PKCE"
|
|
15
51
|
|
|
16
|
-
|
|
52
|
+
# Search memories (finds "OAuth" even if you search "login security" with Smart Mode)
|
|
53
|
+
memesh recall "login security"
|
|
17
54
|
|
|
18
|
-
|
|
55
|
+
# Archive outdated memories (soft-delete, never lost)
|
|
56
|
+
memesh forget --name "old-auth-design"
|
|
19
57
|
|
|
20
|
-
|
|
58
|
+
# Open the dashboard
|
|
59
|
+
memesh
|
|
21
60
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| `recall` | Search stored knowledge via FTS5 full-text search with optional tag filtering |
|
|
26
|
-
| `forget` | Delete stored knowledge by name (cascades to observations, relations, tags) |
|
|
61
|
+
# Start HTTP API (for Python SDK, integrations)
|
|
62
|
+
memesh serve
|
|
63
|
+
```
|
|
27
64
|
|
|
28
|
-
###
|
|
65
|
+
### Python
|
|
29
66
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| Session Start | `SessionStart` | Auto-recalls project-specific + recent global memories |
|
|
33
|
-
| Post Commit | `PostToolUse` (Bash) | Records git commits as knowledge entities |
|
|
67
|
+
```python
|
|
68
|
+
from memesh import MeMesh
|
|
34
69
|
|
|
35
|
-
|
|
70
|
+
m = MeMesh() # connects to localhost:3737
|
|
71
|
+
m.remember("auth", "decision", observations=["Use OAuth 2.0 with PKCE"])
|
|
72
|
+
results = m.recall("auth")
|
|
73
|
+
```
|
|
36
74
|
|
|
37
|
-
|
|
38
|
-
|---------|-------------|
|
|
39
|
-
| `memesh-view` | Generate and open an interactive HTML dashboard |
|
|
75
|
+
### Any LLM (OpenAI function calling format)
|
|
40
76
|
|
|
41
77
|
```bash
|
|
42
|
-
memesh-
|
|
78
|
+
memesh export-schema --format openai
|
|
79
|
+
# → JSON array of tools, paste into your OpenAI/Claude/Gemini API call
|
|
43
80
|
```
|
|
44
81
|
|
|
45
|
-
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Why MeMesh?
|
|
85
|
+
|
|
86
|
+
Most AI memory solutions need Neo4j, vector databases, API keys, and 30+ minutes of setup. MeMesh needs **one command**.
|
|
87
|
+
|
|
88
|
+
| | **MeMesh** | Mem0 | Zep | Anthropic Memory |
|
|
89
|
+
|---|---|---|---|---|
|
|
90
|
+
| **Install** | `npm i -g` (5 sec) | pip + Neo4j + VectorDB | pip + Neo4j | Built-in (cloud) |
|
|
91
|
+
| **Storage** | Single SQLite file | Neo4j + Qdrant | Neo4j | Cloud |
|
|
92
|
+
| **Search** | FTS5 + scoring + LLM expansion | Semantic + BM25 | Temporal graph | Key lookup |
|
|
93
|
+
| **Privacy** | 100% local, always | Cloud option | Self-host | Cloud |
|
|
94
|
+
| **Dependencies** | 6 | 20+ | 10+ | 0 (but cloud-locked) |
|
|
95
|
+
| **Offline** | Yes | No | No | No |
|
|
96
|
+
| **Dashboard** | Built-in (5 tabs) | None | None | None |
|
|
97
|
+
| **Price** | Free | Free/Paid | Free/Paid | Included w/ API |
|
|
46
98
|
|
|
47
|
-
|
|
99
|
+
---
|
|
48
100
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
## Features
|
|
102
|
+
|
|
103
|
+
### 6 Memory Tools
|
|
104
|
+
|
|
105
|
+
| Tool | What it does |
|
|
106
|
+
|------|-------------|
|
|
107
|
+
| **remember** | Store knowledge with observations, relations, and tags |
|
|
108
|
+
| **recall** | Smart search with multi-factor scoring and LLM query expansion |
|
|
109
|
+
| **forget** | Soft-archive (never deletes) or remove specific observations |
|
|
110
|
+
| **consolidate** | LLM-powered compression of verbose memories |
|
|
111
|
+
| **export** | Share memories as JSON between projects or team members |
|
|
112
|
+
| **import** | Import memories with merge strategies (skip / overwrite / append) |
|
|
113
|
+
|
|
114
|
+
### 3 Access Methods
|
|
115
|
+
|
|
116
|
+
| Method | Command | Best for |
|
|
117
|
+
|--------|---------|----------|
|
|
118
|
+
| **CLI** | `memesh` | Terminal, scripting, CI/CD |
|
|
119
|
+
| **HTTP API** | `memesh serve` | Python SDK, dashboard, integrations |
|
|
120
|
+
| **MCP** | `memesh-mcp` | Claude Code, Claude Desktop, any MCP client |
|
|
121
|
+
|
|
122
|
+
### 4 Auto-Capture Hooks
|
|
123
|
+
|
|
124
|
+
| Hook | Trigger | What it captures |
|
|
125
|
+
|------|---------|-----------------|
|
|
126
|
+
| **Session Start** | Every session | Loads your top memories by relevance |
|
|
127
|
+
| **Post Commit** | After `git commit` | Records commit with diff stats |
|
|
128
|
+
| **Session Summary** | When Claude stops | Files edited, errors fixed, decisions made |
|
|
129
|
+
| **Pre-Compact** | Before compaction | Saves knowledge before context is lost |
|
|
130
|
+
|
|
131
|
+
### Smart Features
|
|
132
|
+
|
|
133
|
+
- **Knowledge Evolution** — `forget` archives, not deletes. `supersedes` relations replace old decisions with new ones. History is preserved.
|
|
134
|
+
- **Smart Recall** — LLM expands your search query into related terms. "login security" finds "OAuth PKCE".
|
|
135
|
+
- **Multi-Factor Scoring** — Results ranked by relevance (35%) + recency (25%) + frequency (20%) + confidence (15%) + temporal validity (5%).
|
|
136
|
+
- **Conflict Detection** — Warns when memories contradict each other.
|
|
137
|
+
- **Auto-Decay** — Stale memories (30+ days unused) gradually fade in ranking. Never deleted.
|
|
138
|
+
- **Namespaces** — `personal`, `team`, `global` scopes for organizing and sharing.
|
|
139
|
+
|
|
140
|
+
---
|
|
54
141
|
|
|
55
142
|
## Architecture
|
|
56
143
|
|
|
57
144
|
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
│
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
└── post-commit.js # Git commit tracking
|
|
145
|
+
┌─────────────────┐
|
|
146
|
+
│ Core Engine │
|
|
147
|
+
│ (6 operations) │
|
|
148
|
+
└────────┬────────┘
|
|
149
|
+
┌─────────────────┼─────────────────┐
|
|
150
|
+
│ │ │
|
|
151
|
+
CLI (memesh) HTTP API (serve) MCP (memesh-mcp)
|
|
152
|
+
│ │ │
|
|
153
|
+
└─────────────────┼─────────────────┘
|
|
154
|
+
│
|
|
155
|
+
SQLite + FTS5 + sqlite-vec
|
|
156
|
+
(~/.memesh/knowledge-graph.db)
|
|
71
157
|
```
|
|
72
158
|
|
|
73
|
-
**
|
|
159
|
+
**Core** is framework-agnostic — the same `remember`/`recall`/`forget` logic runs identically whether invoked from terminal, HTTP, or MCP.
|
|
160
|
+
|
|
161
|
+
**Dependencies**: `better-sqlite3`, `sqlite-vec`, `@modelcontextprotocol/sdk`, `zod`, `express`, `commander`
|
|
162
|
+
|
|
163
|
+
---
|
|
74
164
|
|
|
75
165
|
## Development
|
|
76
166
|
|
|
77
167
|
```bash
|
|
168
|
+
git clone https://github.com/PCIRCLE-AI/memesh-llm-memory
|
|
169
|
+
cd memesh-llm-memory
|
|
170
|
+
npm install
|
|
171
|
+
npm run build
|
|
172
|
+
npm test -- --run # 289 tests
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Dashboard development:
|
|
176
|
+
```bash
|
|
177
|
+
cd dashboard
|
|
78
178
|
npm install
|
|
79
|
-
npm run
|
|
80
|
-
npm
|
|
81
|
-
npm run typecheck # tsc --noEmit
|
|
179
|
+
npm run dev # Vite dev server with hot reload
|
|
180
|
+
npm run build # Build to single HTML file
|
|
82
181
|
```
|
|
83
182
|
|
|
183
|
+
---
|
|
184
|
+
|
|
84
185
|
## License
|
|
85
186
|
|
|
86
|
-
MIT
|
|
187
|
+
MIT — [PCIRCLE AI](https://pcircle.ai)
|