sessionmem 1.2.0 → 1.4.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/.github/sessionmem-logo.svg +57 -0
- package/CHANGELOG.md +84 -0
- package/CONTRIBUTING.md +130 -0
- package/README.md +153 -82
- package/SECURITY.md +33 -0
- package/dist/cli/commands/dedupe.js +89 -22
- package/dist/cli/commands/import.js +15 -44
- package/dist/cli/commands/ingestHook.js +107 -18
- package/dist/cli/commands/install.js +3 -3
- package/dist/cli/commands/list.js +3 -0
- package/dist/cli/commands/run.js +10 -12
- package/dist/cli/commands/savings.js +3 -1
- package/dist/cli/commands/search.js +8 -4
- package/dist/cli/commands/stats.js +7 -0
- package/dist/cli/commands/uninstall.js +2 -1
- package/dist/cli/context.js +8 -6
- package/dist/cli/index.js +8 -17
- package/dist/cli/projectId.js +48 -2
- package/dist/core/api/contracts.js +6 -1
- package/dist/core/api/memoryCoreService.js +17 -3
- package/dist/core/config/policyConfig.js +5 -1
- package/dist/core/injection/tokenBudget.js +10 -2
- package/dist/core/retrieve/retrieveMemories.js +1 -1
- package/dist/core/schema/runMigrations.js +9 -5
- package/dist/core/storage/db.js +31 -9
- package/dist/core/storage/memoryRepo.js +1 -1
- package/dist/core/storage/memorySearchRepo.js +36 -14
- package/dist/core/storage/sessionEventsRepo.js +21 -0
- package/dist/core/summarize/cloudSummarizer.js +3 -8
- package/dist/core/summarize/redaction.js +70 -10
- package/dist/core/summarize/summaryShape.js +50 -20
- package/docs/architecture.md +53 -0
- package/docs/benchmark.md +50 -0
- package/docs/cloud-summarization.md +57 -0
- package/docs/migration.md +42 -0
- package/docs/privacy-and-retention.md +139 -0
- package/docs/team-mode.md +117 -0
- package/docs/troubleshooting.md +78 -0
- package/docs/typescript-upgrade.md +48 -0
- package/package.json +26 -13
- package/dist/core/session.js +0 -4
package/README.md
CHANGED
|
@@ -1,18 +1,41 @@
|
|
|
1
1
|
# sessionmem
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src=".github/sessionmem-logo.svg" alt="sessionmem" width="480">
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/sessionmem"><img src="https://img.shields.io/npm/v/sessionmem.svg" alt="npm version"></a>
|
|
9
|
+
<a href="https://github.com/catfish-1234/sessionmem/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
10
|
+
</p>
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
**Project memory between sessions, stored on your machine. Startup context used 85.6% fewer tokens than full session history in the included benchmark.**
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
```
|
|
15
|
+
New session. Claude starts fresh.
|
|
16
|
+
|
|
17
|
+
WITHOUT sessionmem:
|
|
18
|
+
You explain the stack. The JWT bug from last week.
|
|
19
|
+
The Stripe migration that's halfway done. The billing code to stay away from.
|
|
20
|
+
Same questions. Different day.
|
|
21
|
+
|
|
22
|
+
WITH sessionmem:
|
|
23
|
+
[warning] JWT blacklist must be checked before issuing new tokens. Fixed PR #47.
|
|
24
|
+
[decision] Stripe migration ~50% done. Do NOT use /lib/billing-v1.
|
|
25
|
+
[fact] Stack: TypeScript, Next.js, Postgres.
|
|
26
|
+
|
|
27
|
+
Claude: "Looks like you're mid-Stripe migration. Where do you want to pick up?"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`sessionmem` is an MCP server that stores decisions, warnings, and project context across sessions. Claude Code hooks capture supported tool events and load relevant memories automatically. Other hosts use its MCP tools and installed instructions; session automation depends on the host. It works with Claude Code, Cursor, Cline, Codex, Windsurf, and other [MCP](https://modelcontextprotocol.io) hosts.
|
|
31
|
+
|
|
32
|
+
By default, everything stays on your machine. You don't need an account or a cloud service. Data only leaves your computer if you enable sharing or cloud summarization.
|
|
10
33
|
|
|
11
34
|
---
|
|
12
35
|
|
|
13
36
|
## Quickstart
|
|
14
37
|
|
|
15
|
-
|
|
38
|
+
You need a terminal (Command Prompt, Terminal, or PowerShell) and [Node.js](https://nodejs.org), version 20.19+ on the Node 20 line, or 22.13+. Node 22 LTS is recommended. No programming experience is required.
|
|
16
39
|
|
|
17
40
|
### 1. Install sessionmem
|
|
18
41
|
|
|
@@ -22,31 +45,35 @@ npm install -g sessionmem
|
|
|
22
45
|
|
|
23
46
|
### 2. Register it with your AI tool
|
|
24
47
|
|
|
25
|
-
Run this
|
|
48
|
+
Run this in your project folder after configuring your AI tool (Claude Code, Cursor, etc.):
|
|
26
49
|
|
|
27
50
|
```bash
|
|
28
51
|
sessionmem install
|
|
52
|
+
# From a plain terminal, choose the host explicitly when needed:
|
|
53
|
+
sessionmem install --adapter claude-code
|
|
54
|
+
# Other names: cursor, cline, codex, windsurf, antigravity, qcoder, generic
|
|
29
55
|
```
|
|
30
56
|
|
|
31
|
-
This
|
|
32
|
-
- Tells your AI tool's MCP host about `sessionmem` so it can be launched automatically.
|
|
33
|
-
- Creates a config file at `~/.sessionmem/config.json` with safe, privacy-respecting defaults, but only if one doesn't already exist.
|
|
34
|
-
- Injects instructions into `~/.claude/CLAUDE.md` so Claude Code knows about sessionmem's tools and uses them proactively (idempotent, so safe to re-run).
|
|
57
|
+
This initializes the database and, for supported adapters:
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
- Registers `sessionmem` with your AI tool's MCP host so the host can start it automatically.
|
|
60
|
+
- Creates `~/.sessionmem/config.json` with secret redaction enabled and a 90-day retention window, if the file doesn't already exist.
|
|
61
|
+
- Adds instructions to the selected host's guidance file, such as `~/.claude/CLAUDE.md` for Claude Code or `~/.codex/AGENTS.md` for Codex. You can re-run the command without duplicating those instructions.
|
|
37
62
|
|
|
38
|
-
|
|
39
|
-
sessionmem run
|
|
40
|
-
```
|
|
63
|
+
### 3. Restart your AI tool
|
|
41
64
|
|
|
42
|
-
|
|
65
|
+
Restart your editor or agent so it loads the MCP registration. Your host starts
|
|
66
|
+
`sessionmem run` automatically; running it directly starts a stdio server that
|
|
67
|
+
waits for MCP messages, so it can appear to hang in a terminal. For an unknown
|
|
68
|
+
host (`generic`), install writes a project-local `.mcp.json`; if your host uses
|
|
69
|
+
another format or location, copy its server entry into that host’s MCP config.
|
|
43
70
|
|
|
44
|
-
|
|
45
|
-
- `sessionmem` watches your sessions in the background.
|
|
46
|
-
- At the end of each session, it writes down a short summary of what mattered.
|
|
47
|
-
- At the start of your next session, it quietly reminds your assistant of the relevant bits.
|
|
71
|
+
After restarting:
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
- In Claude Code, the installed PostToolUse, SessionEnd, and SessionStart hooks capture supported tool events, summarize them, and load prior memories automatically.
|
|
74
|
+
- Other MCP hosts use sessionmem's tools and installed instructions. Automatic capture and session lifecycle calls depend on the host or agent. MCP registration alone does not install Claude Code hooks there.
|
|
75
|
+
|
|
76
|
+
Check that the local database is accessible:
|
|
50
77
|
|
|
51
78
|
```bash
|
|
52
79
|
sessionmem ping
|
|
@@ -69,6 +96,7 @@ sessionmem ping
|
|
|
69
96
|
- [Further documentation](#further-documentation)
|
|
70
97
|
- [Troubleshooting](#troubleshooting)
|
|
71
98
|
- [FAQ](#faq)
|
|
99
|
+
- [Security](#security)
|
|
72
100
|
- [Contributing](#contributing)
|
|
73
101
|
- [License](#license)
|
|
74
102
|
|
|
@@ -76,44 +104,42 @@ sessionmem ping
|
|
|
76
104
|
|
|
77
105
|
## What problem does this solve?
|
|
78
106
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
> You spend twenty minutes explaining your project's setup, the libraries you use, a tricky bug you already fixed, and a decision you made about how authentication should work. The assistant nods along, helps you out... and then in your **next session**, it has forgotten all of it. You explain everything again.
|
|
107
|
+
Most AI coding assistants rely on the current conversation for context. Start a new session and you may need to explain the project's setup, libraries, fixed bugs, and design decisions again.
|
|
82
108
|
|
|
83
|
-
|
|
109
|
+
`sessionmem` keeps short notes between sessions:
|
|
84
110
|
|
|
85
|
-
|
|
111
|
+
1. While you work, it captures session events.
|
|
112
|
+
2. At session end, it summarizes decisions, warnings, and useful facts into stored memories.
|
|
113
|
+
3. At the next session start, it loads the most relevant memories within a small token budget.
|
|
86
114
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
You don't run any of these steps yourself. Once installed, it just works in the background.
|
|
115
|
+
Claude Code runs these steps through the installed hooks. Other hosts need their
|
|
116
|
+
agent to call the MCP memory and lifecycle tools; the installed guidance explains
|
|
117
|
+
how to do that.
|
|
92
118
|
|
|
93
119
|
---
|
|
94
120
|
|
|
95
121
|
## How is sessionmem different?
|
|
96
122
|
|
|
97
|
-
|
|
123
|
+
Compared with projects such as *claude-mem* and other cloud or Claude-only memory tools, `sessionmem` focuses on local storage and support for multiple MCP hosts:
|
|
98
124
|
|
|
99
125
|
| | **sessionmem** | Typical cloud/Claude-only memory tools |
|
|
100
126
|
|---|---|---|
|
|
101
127
|
| **Where is data stored?** | A single SQLite file on your computer (`~/.sessionmem/memories.db`) | Often a hosted service, a cloud vector database, or a separate server process you have to run |
|
|
102
|
-
| **Account / sign-up required?** | No
|
|
128
|
+
| **Account / sign-up required?** | No | Sometimes |
|
|
103
129
|
| **Which AI tools does it work with?** | Claude Code, Cursor, Codex, Cline, Windsurf, Antigravity, QCoder, and any other MCP-compatible host | Usually just one specific tool (commonly Claude Code only) |
|
|
104
130
|
| **Secret redaction** | Built in, on by default. API keys, tokens, passwords, and private keys are scrubbed before anything is saved. | Often not handled, or left to the user |
|
|
105
|
-
| **Token budget control** | Injected memories are trimmed to a small, fixed token budget
|
|
106
|
-
| **Old/stale memory cleanup** | Built-in retention policy automatically prunes old memories (configurable, on by default) | Often
|
|
131
|
+
| **Token budget control** | Injected memories are trimmed to a small, fixed token budget (see benchmarks below) | Varies, often unbounded |
|
|
132
|
+
| **Old/stale memory cleanup** | Built-in retention policy automatically prunes old memories (configurable, on by default) | Often no automatic cleanup ("memory rot") |
|
|
107
133
|
| **Team sharing** | Optional, via a shared folder you already control (network drive, synced directory). No server needed. | Usually requires a shared hosted backend |
|
|
108
|
-
| **Offline-capable** | Yes
|
|
134
|
+
| **Offline-capable** | Yes. Works with no network connection by default. | Usually requires network access to the memory service |
|
|
109
135
|
|
|
110
|
-
|
|
136
|
+
The SQLite file is easy to inspect, back up, or delete, and you can use it across AI tools from different vendors.
|
|
111
137
|
|
|
112
138
|
---
|
|
113
139
|
|
|
114
140
|
## Benchmark results
|
|
115
141
|
|
|
116
|
-
These numbers come from `npm run benchmark` (`scripts/benchmark.mjs`)
|
|
142
|
+
These numbers come from `npm run benchmark` (`scripts/benchmark.mjs`). It runs the production retrieval and injection code against fixed, synthetic test data without network calls. See [`docs/benchmark.md`](docs/benchmark.md) for the full report and reproduction steps.
|
|
117
143
|
|
|
118
144
|
### Token savings
|
|
119
145
|
|
|
@@ -124,11 +150,11 @@ These numbers come from `npm run benchmark` (`scripts/benchmark.mjs`), which run
|
|
|
124
150
|
| Full session history (baseline) | 1,587 |
|
|
125
151
|
| What sessionmem injects at the start of your next session | 228 |
|
|
126
152
|
|
|
127
|
-
In
|
|
153
|
+
In this benchmark, about 1,600 tokens of session history become roughly 230 tokens of decisions, warnings, and facts for the next session.
|
|
128
154
|
|
|
129
155
|
### Retrieval accuracy
|
|
130
156
|
|
|
131
|
-
> **100% hit-rate**:
|
|
157
|
+
> **100% hit-rate**: all 10 test queries retrieved the expected memory.
|
|
132
158
|
|
|
133
159
|
| Metric | Result |
|
|
134
160
|
|---|---|
|
|
@@ -136,9 +162,9 @@ In practice: instead of re-reading (or re-explaining) about 1,600 tokens of past
|
|
|
136
162
|
| Recall | 100.0% |
|
|
137
163
|
| Precision | 33.3% |
|
|
138
164
|
|
|
139
|
-
|
|
165
|
+
Each query returns 3 candidate memories, with one scored as the expected match. That gives 33.3% precision even when the expected memory is found every time. The other two candidates may provide context, but are not scored as matches. These results apply to the 10 curated queries; see the report for the embedding model's limits.
|
|
140
166
|
|
|
141
|
-
|
|
167
|
+
The benchmark is deterministic and reproducible:
|
|
142
168
|
|
|
143
169
|
```bash
|
|
144
170
|
npm run build # benchmark imports the compiled code from dist/
|
|
@@ -175,11 +201,11 @@ npm run benchmark # regenerates docs/benchmark.md
|
|
|
175
201
|
└──────────────────────────────────────────────┘
|
|
176
202
|
```
|
|
177
203
|
|
|
178
|
-
- **Adapters**
|
|
179
|
-
- **The core engine**
|
|
180
|
-
- **The database** is
|
|
204
|
+
- **Adapters** connect each AI tool to sessionmem. Supporting another tool doesn't require changing the memory engine.
|
|
205
|
+
- **The core engine** stores memories, ranks their relevance, and selects what fits in the next session's context budget. Every adapter uses the same engine.
|
|
206
|
+
- **The database** is a local file. You can back it up, move it, inspect it, or delete it.
|
|
181
207
|
|
|
182
|
-
|
|
208
|
+
See [`docs/architecture.md`](docs/architecture.md) for the technical overview.
|
|
183
209
|
|
|
184
210
|
---
|
|
185
211
|
|
|
@@ -187,33 +213,58 @@ For a deeper technical dive, see [`docs/architecture.md`](docs/architecture.md).
|
|
|
187
213
|
|
|
188
214
|
| Command | What it does |
|
|
189
215
|
|---------|--------------|
|
|
190
|
-
| `sessionmem install` | Register sessionmem with the current MCP host and write default config. |
|
|
191
|
-
| `sessionmem uninstall [--purge]` | Remove sessionmem from the host. `--purge` also deletes the local database. |
|
|
216
|
+
| `sessionmem install [--adapter <name>]` | Register sessionmem with the current MCP host and write default config. |
|
|
217
|
+
| `sessionmem uninstall [--adapter <name>] [--purge]` | Remove sessionmem from the host. `--purge` also deletes the local database. |
|
|
192
218
|
| `sessionmem run` | Start the MCP server. |
|
|
193
|
-
| `sessionmem ping` | Check
|
|
194
|
-
| `sessionmem search <query> [--limit <n>]` | Search memories by semantic query. |
|
|
195
|
-
| `sessionmem list` | List
|
|
196
|
-
| `sessionmem show <id>` | Show
|
|
219
|
+
| `sessionmem ping` | Check the local version and database reachability. |
|
|
220
|
+
| `sessionmem search <query> [--limit <n>]` | Search memories by semantic query (limit 1–100, default 10). |
|
|
221
|
+
| `sessionmem list` | List up to 200 recent memories for the current project; warns when truncated. |
|
|
222
|
+
| `sessionmem show <id>` | Show memory details (content capped at 2000 characters; use export for full content). |
|
|
197
223
|
| `sessionmem forget <id> [--force]` | Delete a memory by ID. |
|
|
198
|
-
| `sessionmem export [path]` | Export memories to
|
|
199
|
-
| `sessionmem import <path> [--merge]` | Import
|
|
224
|
+
| `sessionmem export [path]` | Export all current-project memories to JSON (default `~/.sessionmem/export-YYYY-MM-DD.json`). |
|
|
225
|
+
| `sessionmem import <path> [--merge]` | Import up to 1000 valid records from UTF-8 JSON into the current project. Existing IDs are preserved, including with `--merge`; invalid records are skipped with warnings. |
|
|
200
226
|
| `sessionmem stats` | Show memory statistics for the current project. |
|
|
201
227
|
| `sessionmem savings [--json]` | Show token savings from compression and injection, with percentage. |
|
|
202
228
|
| `sessionmem redact-scan [--apply]` | Scan stored memories for secrets; `--apply` redacts in place. |
|
|
203
229
|
| `sessionmem retention prune [--force] [--days <n>]` | Prune old memories (dry-run by default). |
|
|
204
230
|
| `sessionmem config get <key>` / `config set <key> <value>` | Read and write policy config. |
|
|
205
|
-
| `sessionmem team enable <path>` / `team disable` / `team status` | Manage shared-path team memory mode. |
|
|
231
|
+
| `sessionmem team enable <path>` / `team disable [--remove-team-memories]` / `team status` | Manage shared-path team memory mode. |
|
|
206
232
|
| `sessionmem sync` | Push local memories and pull teammate memories via the shared path. |
|
|
233
|
+
| `sessionmem browse [--project <id>]` | List projects or preview up to 50 recent memories from one project. |
|
|
234
|
+
| `sessionmem dedupe [--apply] [--threshold <n>]` | Preview duplicate memories; `--apply` deletes them (threshold >0–1, default 0.85). |
|
|
235
|
+
| `sessionmem re-embed` | Refresh memories with stale embedding versions. |
|
|
236
|
+
| `sessionmem session-start` | Print prior context as Claude Code SessionStart hook JSON. |
|
|
237
|
+
| `sessionmem ingest-hook` | Read a Claude Code PostToolUse JSON payload from stdin and capture supported tool events. |
|
|
238
|
+
| `sessionmem session-end` | Summarize ingested events and apply retention pruning; reads the hook session ID from stdin. |
|
|
239
|
+
|
|
240
|
+
Use `sessionmem --help` or `sessionmem <command> --help` for options, and
|
|
241
|
+
`sessionmem --version` for the installed version. Destructive commands require
|
|
242
|
+
`--force`, `--apply`, or `--purge` as shown above. `team disable` preserves
|
|
243
|
+
teammate memories unless `--remove-team-memories` is passed.
|
|
244
|
+
|
|
245
|
+
The default database is `~/.sessionmem/memories.db`. Set `SESSIONMEM_DB_PATH`
|
|
246
|
+
to use another file; its parent directories are created automatically and the
|
|
247
|
+
default directory is not created by database commands. Server logs are written
|
|
248
|
+
to `logs/mcp.log` beside the selected database (disabled for `:memory:`). Config remains at
|
|
249
|
+
`~/.sessionmem/config.json`. `uninstall --purge` deletes the selected database.
|
|
250
|
+
Quote paths containing spaces (for example `"C:\Users\Ada Lovelace\memory.db"`
|
|
251
|
+
on Windows). In JSON config files, use forward slashes or escaped backslashes
|
|
252
|
+
for Windows paths. Imports accept CRLF and a UTF-8 BOM; convert other encodings to UTF-8.
|
|
253
|
+
|
|
254
|
+
`SESSIONMEM_PROJECT_ID` pins the project bucket (useful when moving a repository);
|
|
255
|
+
otherwise it is derived from the repository root or working directory.
|
|
256
|
+
`SESSIONMEM_ADAPTER` selects the install/uninstall host unless `--adapter` is set.
|
|
257
|
+
`SESSIONMEM_DEBUG=1` enables ingest-hook diagnostics on stderr.
|
|
207
258
|
|
|
208
259
|
---
|
|
209
260
|
|
|
210
261
|
## Privacy, secrets, and your data
|
|
211
262
|
|
|
212
|
-
|
|
263
|
+
Storage, retrieval, and summarization run locally by default. There is no account, telemetry, or hosted memory service. Settings live in `~/.sessionmem/config.json`.
|
|
213
264
|
|
|
214
265
|
### Secrets are scrubbed automatically
|
|
215
266
|
|
|
216
|
-
Before
|
|
267
|
+
Before saving memory content, `sessionmem` replaces common secret patterns with `REDACTED`:
|
|
217
268
|
|
|
218
269
|
- Email addresses
|
|
219
270
|
- API keys (`sk-...`, AWS `AKIA...`, GitHub `ghp_...`/`gho_...`, etc.)
|
|
@@ -221,7 +272,7 @@ Before anything is saved, `sessionmem` automatically removes common secret patte
|
|
|
221
272
|
- Private key blocks (`-----BEGIN ... PRIVATE KEY-----`)
|
|
222
273
|
- Connection-string style secrets (`password=...`, `secret=...`)
|
|
223
274
|
|
|
224
|
-
|
|
275
|
+
Redaction is on by default. To scan and clean up older memories:
|
|
225
276
|
|
|
226
277
|
```bash
|
|
227
278
|
sessionmem redact-scan # see what would be redacted
|
|
@@ -234,26 +285,26 @@ Full details: [`docs/privacy-and-retention.md`](docs/privacy-and-retention.md).
|
|
|
234
285
|
|
|
235
286
|
## Memory rot: keeping memory accurate over time
|
|
236
287
|
|
|
237
|
-
|
|
288
|
+
Old decisions and duplicate facts can accumulate in a memory store, causing the assistant to use outdated information. This is sometimes called "memory rot."
|
|
238
289
|
|
|
239
|
-
`sessionmem`
|
|
290
|
+
`sessionmem` handles it through retention, ranking, and sync rules:
|
|
240
291
|
|
|
241
|
-
1. **Retention pruning**: memories older than a configurable window (
|
|
292
|
+
1. **Retention pruning**: memories older than a configurable window (90 days by default) are eligible for deletion. A lightweight check runs at session end. You can also run it manually:
|
|
242
293
|
|
|
243
294
|
```bash
|
|
244
295
|
sessionmem retention prune # dry run - shows what *would* be deleted
|
|
245
296
|
sessionmem retention prune --force # actually deletes
|
|
246
297
|
```
|
|
247
298
|
|
|
248
|
-
2. **Importance-weighted ranking**:
|
|
299
|
+
2. **Importance-weighted ranking**: retrieval ranks memories by semantic relevance, recency, and importance. Older, less important notes rank lower even before they are pruned.
|
|
249
300
|
|
|
250
|
-
3. **Token-budgeted injection**: only the
|
|
301
|
+
3. **Token-budgeted injection**: only the highest-ranked memories are loaded, trimmed to a small token budget (see [benchmarks](#benchmark-results)). The context stays within that budget as the store grows.
|
|
251
302
|
|
|
252
|
-
4. **Conflict resolution in team mode**:
|
|
303
|
+
4. **Conflict resolution in team mode**: merging teammate memories uses last-write-wins by id to avoid stale duplicates and keeps the higher importance score so a warning isn't downgraded.
|
|
253
304
|
|
|
254
|
-
The
|
|
305
|
+
The benchmark above found every expected memory across its 10 queries (100% hit-rate and recall) with ranking and trimming enabled.
|
|
255
306
|
|
|
256
|
-
|
|
307
|
+
Export your memories before pruning if you want to keep a copy:
|
|
257
308
|
|
|
258
309
|
```bash
|
|
259
310
|
sessionmem export
|
|
@@ -263,17 +314,17 @@ sessionmem export
|
|
|
263
314
|
|
|
264
315
|
## Team mode (optional)
|
|
265
316
|
|
|
266
|
-
|
|
317
|
+
To share decisions and warnings across your team's AI assistants, point `sessionmem` at a folder everyone can read and write, such as a network drive or synced directory:
|
|
267
318
|
|
|
268
319
|
```bash
|
|
269
320
|
sessionmem team enable <shared-path>
|
|
270
321
|
sessionmem sync
|
|
271
322
|
```
|
|
272
323
|
|
|
273
|
-
-
|
|
274
|
-
-
|
|
275
|
-
-
|
|
276
|
-
-
|
|
324
|
+
- Team mode is off by default. Nothing is shared until you enable it.
|
|
325
|
+
- Memories are shared as files in that folder; no server is needed.
|
|
326
|
+
- Teammate memories appear with an `author:` prefix identifying their source.
|
|
327
|
+
- Redaction runs on every pulled memory using your redaction policy.
|
|
277
328
|
|
|
278
329
|
Full details, including the trust model: [`docs/team-mode.md`](docs/team-mode.md).
|
|
279
330
|
|
|
@@ -281,9 +332,9 @@ Full details, including the trust model: [`docs/team-mode.md`](docs/team-mode.md
|
|
|
281
332
|
|
|
282
333
|
## Cloud summarization (optional, off by default)
|
|
283
334
|
|
|
284
|
-
By default,
|
|
335
|
+
By default, session summaries are created locally, with no API calls.
|
|
285
336
|
|
|
286
|
-
|
|
337
|
+
To use Claude's API for higher-quality summaries, set `allowCloudSummarization=true` and provide an `ANTHROPIC_API_KEY`. If cloud summarization fails after retries, sessionmem uses local summarization. Failures are recorded for diagnosis; see the configuration guide below.
|
|
287
338
|
|
|
288
339
|
Details: [`docs/cloud-summarization.md`](docs/cloud-summarization.md).
|
|
289
340
|
|
|
@@ -301,7 +352,7 @@ Details: [`docs/cloud-summarization.md`](docs/cloud-summarization.md).
|
|
|
301
352
|
- Antigravity
|
|
302
353
|
- QCoder
|
|
303
354
|
|
|
304
|
-
|
|
355
|
+
Other tools that implement the [Model Context Protocol](https://modelcontextprotocol.io) can connect too.
|
|
305
356
|
|
|
306
357
|
---
|
|
307
358
|
|
|
@@ -319,12 +370,21 @@ Details: [`docs/cloud-summarization.md`](docs/cloud-summarization.md).
|
|
|
319
370
|
|
|
320
371
|
## Troubleshooting
|
|
321
372
|
|
|
322
|
-
|
|
373
|
+
For install failures, adapter issues, missing session data, or `better-sqlite3` native-build problems, see [`docs/troubleshooting.md`](docs/troubleshooting.md).
|
|
374
|
+
|
|
375
|
+
To refresh the installation and check for stored session data:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
sessionmem install # idempotent; Claude Code also installs all three hooks
|
|
379
|
+
sessionmem stats # memories, sessions, and session_events for the current project
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
If `stats` shows `sessions: 0` after real work, see [“0 sessions” / no session data recorded](docs/troubleshooting.md#0-sessions--no-session-data-recorded). Memories are keyed to the **repository root**, so every directory inside one repo shares a bucket; outside a repo the working directory itself is the key.
|
|
323
383
|
|
|
324
|
-
|
|
384
|
+
To check database access and memory counts:
|
|
325
385
|
|
|
326
386
|
```bash
|
|
327
|
-
sessionmem ping #
|
|
387
|
+
sessionmem ping # can the local database be opened?
|
|
328
388
|
sessionmem stats # is data being stored?
|
|
329
389
|
```
|
|
330
390
|
|
|
@@ -333,16 +393,16 @@ sessionmem stats # is data being stored?
|
|
|
333
393
|
## FAQ
|
|
334
394
|
|
|
335
395
|
**How do I give Cursor, Cline, or Windsurf memory between sessions?**
|
|
336
|
-
Install sessionmem (`npm i -g sessionmem`), then run `sessionmem install` in your project.
|
|
396
|
+
Install sessionmem (`npm i -g sessionmem`), then run `sessionmem install` in your project. Use `--adapter cursor`, `--adapter cline`, or `--adapter windsurf` when auto-detection cannot identify your host.
|
|
337
397
|
|
|
338
398
|
**How do I give Claude Code persistent memory?**
|
|
339
|
-
|
|
399
|
+
Use the same install steps above. sessionmem also ships as a Claude Code plugin (the `.claude-plugin` directory in the repo) for Claude Code's native plugin system.
|
|
340
400
|
|
|
341
401
|
**Is there a local MCP memory server that works offline with no API key?**
|
|
342
|
-
Yes. sessionmem stores
|
|
402
|
+
Yes. sessionmem stores memories in a single SQLite file at `~/.sessionmem/memories.db` and works offline by default. Sharing and cloud summarization are optional and off by default.
|
|
343
403
|
|
|
344
404
|
**How is sessionmem different from claude-mem?**
|
|
345
|
-
sessionmem
|
|
405
|
+
sessionmem works with Claude Code, Cursor, Cline, Codex, Windsurf, Antigravity, QCoder, and other MCP hosts. It redacts secrets (API keys, tokens, JWTs) by default, prunes old memories automatically, and includes reproducible benchmarks.
|
|
346
406
|
|
|
347
407
|
**Does sessionmem send my code to the cloud?**
|
|
348
408
|
No. Nothing leaves your machine by default. The optional cloud summarization path is opt-in and off by default.
|
|
@@ -352,18 +412,29 @@ Run `sessionmem savings` to see a breakdown of storage compression (raw session
|
|
|
352
412
|
|
|
353
413
|
---
|
|
354
414
|
|
|
415
|
+
## Security
|
|
416
|
+
|
|
417
|
+
See the [security policy](SECURITY.md) for supported versions, private vulnerability
|
|
418
|
+
reporting through GitHub security advisories, and response expectations.
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
355
422
|
## Contributing
|
|
356
423
|
|
|
357
424
|
Issues and pull requests are welcome. The codebase is TypeScript, tested with [Vitest](https://vitest.dev), and linted with ESLint:
|
|
358
425
|
|
|
359
426
|
```bash
|
|
360
|
-
npm
|
|
427
|
+
npm ci
|
|
361
428
|
npm run build
|
|
429
|
+
npm run typecheck
|
|
362
430
|
npm test
|
|
363
431
|
npm run lint
|
|
364
432
|
```
|
|
365
433
|
|
|
366
|
-
**MCP config for local development:**
|
|
434
|
+
**MCP config for local development:** Clone the repository, build it, copy
|
|
435
|
+
`.mcp.json.example` to `.mcp.json`, and replace the example path with the absolute
|
|
436
|
+
path to your checkout’s `dist/cli/index.js`. This runs your local build.
|
|
437
|
+
`sessionmem install` registers the `sessionmem` executable on PATH instead. The `.mcp.json` file is gitignored because it contains machine-specific paths.
|
|
367
438
|
|
|
368
439
|
---
|
|
369
440
|
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Supported versions
|
|
4
|
+
|
|
5
|
+
Security fixes are provided for the latest published stable release of
|
|
6
|
+
sessionmem. Older releases and prereleases are not supported;
|
|
7
|
+
upgrade to the latest stable release before checking whether an issue persists.
|
|
8
|
+
The main branch receives fixes for the next release but is not a supported
|
|
9
|
+
published version.
|
|
10
|
+
|
|
11
|
+
## Report a vulnerability privately
|
|
12
|
+
|
|
13
|
+
Use [GitHub private vulnerability reporting](https://github.com/catfish-1234/sessionmem/security/advisories/new)
|
|
14
|
+
to open a private security advisory. You need a GitHub account. Reports stay
|
|
15
|
+
private while maintainers investigate and coordinate a fix with the reporter.
|
|
16
|
+
Do not disclose vulnerabilities in public issues, pull requests, or discussions.
|
|
17
|
+
|
|
18
|
+
Include the affected version, operating system and Node.js version, reproduction
|
|
19
|
+
steps or a minimal proof of concept, expected impact, and any suggested mitigation.
|
|
20
|
+
Use synthetic data: do not include real API keys, private session transcripts,
|
|
21
|
+
production memory databases, or other sensitive information.
|
|
22
|
+
|
|
23
|
+
## Response expectations
|
|
24
|
+
|
|
25
|
+
Maintainers aim to acknowledge reports within 7 calendar days and provide an
|
|
26
|
+
initial assessment within 14 calendar days. These are best-effort targets for a
|
|
27
|
+
community-maintained project, not guaranteed service levels. If you have not
|
|
28
|
+
heard back after 7 days, follow up in the same private advisory.
|
|
29
|
+
|
|
30
|
+
For confirmed vulnerabilities, maintainers coordinate remediation, disclosure
|
|
31
|
+
timing, and reporter credit in the private advisory. Fix timing depends on
|
|
32
|
+
severity and complexity; maintainers will share progress and available
|
|
33
|
+
workarounds there. Keep details private until coordinated disclosure.
|