sessionmem 1.3.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 +122 -83
- package/SECURITY.md +33 -0
- package/dist/cli/commands/dedupe.js +1 -1
- package/dist/cli/commands/import.js +15 -44
- 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/search.js +8 -4
- package/dist/cli/commands/uninstall.js +2 -1
- package/dist/cli/context.js +8 -6
- package/dist/cli/index.js +6 -6
- package/dist/core/config/policyConfig.js +5 -1
- package/dist/core/injection/tokenBudget.js +10 -2
- package/dist/core/schema/runMigrations.js +9 -5
- package/dist/core/storage/db.js +31 -9
- package/dist/core/summarize/cloudSummarizer.js +3 -8
- 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 +25 -13
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Team Mode (Shared Memory)
|
|
2
|
+
|
|
3
|
+
Team mode shares `sessionmem` memories through a directory everyone on the team can read and write, such as a network drive or synced folder. With team mode enabled, `sessionmem sync` writes your local memories there and reads teammates' memories into your database. Your agent can then use decisions, warnings, and facts recorded by the team.
|
|
4
|
+
|
|
5
|
+
Team mode is off by default. Enable it to start sharing.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Enable team mode by pointing it at a shared directory:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
sessionmem team enable <shared-path>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`<shared-path>` must be a directory that all teammates can read and write, typically a network share or a folder synced across machines. The path is recorded in `~/.sessionmem/config.json` under the `team` section (`team.enabled` / `team.sharedPath`).
|
|
16
|
+
|
|
17
|
+
Inside the shared path, `sessionmem` uses a per-project, per-user file layout:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
{sharedPath}/{project_id}/{username}.json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Each teammate writes one snapshot file named after their OS username. Each project has its own subdirectory to keep snapshots separate.
|
|
24
|
+
|
|
25
|
+
To check the current state:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
sessionmem team status
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This reports whether team mode is enabled and whether the shared path is reachable.
|
|
32
|
+
|
|
33
|
+
## Usage: syncing
|
|
34
|
+
|
|
35
|
+
Once team mode is enabled, run:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
sessionmem sync
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Each `sync` runs two steps:
|
|
42
|
+
|
|
43
|
+
1. **Push**: writes a full snapshot of this project's local memories to
|
|
44
|
+
`{sharedPath}/{project_id}/{username}.json`. The write is atomic (a temp file
|
|
45
|
+
is written in the same directory and then renamed) so teammates don't read a
|
|
46
|
+
partly written snapshot.
|
|
47
|
+
2. **Pull**: reads every other `*.json` snapshot in the project directory and
|
|
48
|
+
merges those memories into your local database.
|
|
49
|
+
|
|
50
|
+
When it finishes, `sync` prints a summary:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Pushed N memories, pulled M new + updated K from teammates.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`N` is the number of local memories shared, `M` is the number of new teammate memories added, and `K` is the number of existing memories updated from teammate snapshots.
|
|
57
|
+
|
|
58
|
+
If team mode is disabled, `sync` makes no changes and tells you to run `team enable` first.
|
|
59
|
+
|
|
60
|
+
## Provenance and author annotation
|
|
61
|
+
|
|
62
|
+
Each memory records its source:
|
|
63
|
+
|
|
64
|
+
- **`author`**: the OS username of whoever created the memory.
|
|
65
|
+
- **`created_at`**: when it was first created.
|
|
66
|
+
|
|
67
|
+
In the agent's startup context, teammate memories have an `author:` prefix showing their recorded author, for example:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
- [decision] alice: decided to use X (...)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Your own memories have no prefix. Older memories with an empty author also have no prefix. The prefix appears when the recorded author differs from your local username.
|
|
74
|
+
|
|
75
|
+
## Conflict behavior
|
|
76
|
+
|
|
77
|
+
When the same memory id exists locally and in a teammate's snapshot, `sync` resolves it as follows:
|
|
78
|
+
|
|
79
|
+
- **Content**: sync uses last-write-wins by id, keeping the most recent content.
|
|
80
|
+
- **Importance**: a teammate's snapshot cannot lower your local copy's importance score.
|
|
81
|
+
- **Cross-project id collisions**: records whose ids already belong to a different project are skipped.
|
|
82
|
+
- **Redaction**: every pulled record is checked again using your secret redaction policy.
|
|
83
|
+
|
|
84
|
+
## Disable and recovery
|
|
85
|
+
|
|
86
|
+
To stop syncing and keep memories already pulled from teammates:
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
sessionmem team disable
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
To also delete teammate-authored memories:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
sessionmem team disable --remove-team-memories
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
This deletes the teammate-authored memories for this project, leaving only the memories you authored locally.
|
|
99
|
+
|
|
100
|
+
## Trust boundary and security
|
|
101
|
+
|
|
102
|
+
Anyone with write access to the shared path can add memories that your agent may use. Control access through the shared directory's filesystem permissions:
|
|
103
|
+
|
|
104
|
+
- Restrict write access with OS filesystem permissions (ACLs) to the people you intend to share memories with.
|
|
105
|
+
- The `author` field is advisory. A person with write access can change it, so the `author:` prefix does not verify identity.
|
|
106
|
+
- `sessionmem` does not authenticate teammates, sign snapshots, or verify authorship. Enforce any additional access controls through the filesystem or file share.
|
|
107
|
+
|
|
108
|
+
## Failure recovery
|
|
109
|
+
|
|
110
|
+
When `sync` encounters filesystem or snapshot errors:
|
|
111
|
+
|
|
112
|
+
- **Missing or unwritable shared path**: `sync` reports the error to stderr and
|
|
113
|
+
exits with a non-zero status. Your local memories are untouched.
|
|
114
|
+
- **A corrupt or truncated teammate file**: the file is skipped with a warning,
|
|
115
|
+
and the rest of the pull continues.
|
|
116
|
+
- **An invalid record inside an otherwise-valid file**: the record is skipped
|
|
117
|
+
with a warning; the remaining records still merge.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
This guide covers install failures, adapter (MCP host) issues, and `better-sqlite3` native-build failures. Configuration lives in `~/.sessionmem/config.json`.
|
|
4
|
+
|
|
5
|
+
## Install failures
|
|
6
|
+
|
|
7
|
+
### `config.json` not written
|
|
8
|
+
|
|
9
|
+
`sessionmem install` creates `~/.sessionmem/config.json` only if the file is missing. It leaves an existing config unchanged. To restore defaults, move or delete the old file and re-run `sessionmem install`. To change individual settings, use `sessionmem config set`.
|
|
10
|
+
|
|
11
|
+
### Adapter not detected
|
|
12
|
+
|
|
13
|
+
`install` registers sessionmem with the MCP host in the current directory. If install reports that it could not find a host, you are likely running it outside a project the host recognizes. `cd` into your project root (where the host's config lives) and re-run `sessionmem install`. Use `sessionmem install --adapter <name>` from a plain terminal (for example `--adapter cline` or `--adapter windsurf`, which cannot be reliably auto-detected). Run `sessionmem ping` afterward to check local database access; it does not probe the host's MCP connection.
|
|
14
|
+
|
|
15
|
+
### Command not found
|
|
16
|
+
|
|
17
|
+
If `sessionmem` is not on your `PATH` after `npm install -g sessionmem`, your npm global bin directory is not on `PATH`. Add npm's global prefix `bin` to your shell `PATH`, or invoke via `npx sessionmem`.
|
|
18
|
+
|
|
19
|
+
## Adapter issues
|
|
20
|
+
|
|
21
|
+
Each MCP host uses its own adapter. If the server starts but memories are missing, check the host's configuration:
|
|
22
|
+
|
|
23
|
+
- **Claude Code**: if memories are not injected at session start, confirm `sessionmem install` was run inside the project and that the MCP server entry exists in the host config. Use `sessionmem ping` to verify local database access, then check MCP connectivity in the host.
|
|
24
|
+
- **Cursor**: Cursor must be pointed at the registered MCP server. Re-run `install` from the project root and restart Cursor so it reloads MCP servers.
|
|
25
|
+
- **Generic MCP host**: for any other MCP-compatible host, ensure the host is configured to launch `sessionmem run` as the MCP server command. If the host starts but no memory appears, check that the working directory matches the project whose memories you expect.
|
|
26
|
+
|
|
27
|
+
If commands hang after the host loads, run `sessionmem ping` to check local database access, then check the host's MCP connection.
|
|
28
|
+
|
|
29
|
+
## "0 sessions" / no session data recorded
|
|
30
|
+
|
|
31
|
+
If `sessionmem savings` reports no session data or `sessionmem stats` shows `sessions: 0`, check the following.
|
|
32
|
+
|
|
33
|
+
### The hooks are not installed
|
|
34
|
+
|
|
35
|
+
Session events are captured by a `PostToolUse` hook that `sessionmem install` registers in `~/.claude/settings.json`. If you installed sessionmem before the auto-ingest hook existed, that hook is missing. Re-run `sessionmem install` (it is idempotent) and restart your editor, then confirm the entry exists:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
sessionmem install
|
|
39
|
+
sessionmem stats # check the session_events counter after a few tool calls
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
To watch the hook work in real time, run your host with `SESSIONMEM_DEBUG=1`; the hook then reports each ingest to stderr, including the project id it wrote to.
|
|
43
|
+
|
|
44
|
+
### Memory is keyed to the repository
|
|
45
|
+
|
|
46
|
+
A project's memories are keyed by its **repository root**, the nearest directory containing `.git`. All subdirectories in one repository share the same memory bucket.
|
|
47
|
+
|
|
48
|
+
Outside a repository, the id falls back to the exact working directory. Two different directories that are not in a repository are two different projects, so running `sessionmem stats` from a different folder than the one your host session used will show an empty store. Either run from inside the repository, or pin the id explicitly:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
export SESSIONMEM_PROJECT_ID=my-project
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Use `sessionmem browse` to list every project that has memories along with its id; the current project is marked.
|
|
55
|
+
|
|
56
|
+
### Not enough events to summarize
|
|
57
|
+
|
|
58
|
+
`handleSessionEnd` only writes a session summary once at least 3 events were captured. A very short session is skipped by design and reports `not enough session events to summarize`.
|
|
59
|
+
|
|
60
|
+
## `better-sqlite3` native-build failures
|
|
61
|
+
|
|
62
|
+
`sessionmem` stores memories in SQLite via `better-sqlite3`, which is a **native** module compiled for your platform and Node version. Most install-time crashes come from this native build.
|
|
63
|
+
|
|
64
|
+
### node-gyp build errors
|
|
65
|
+
|
|
66
|
+
If `npm install` fails compiling `better-sqlite3` with `node-gyp` errors, your toolchain is incomplete:
|
|
67
|
+
|
|
68
|
+
- **Windows**: install the Visual Studio Build Tools (MSVC C++ workload). `node-gyp` needs an MSVC compiler; without it the native build fails.
|
|
69
|
+
- **macOS**: install the Xcode Command Line Tools (`xcode-select --install`).
|
|
70
|
+
- **Linux**: install `build-essential` (or your distro's equivalent: a C/C++ compiler, `make`, and `python3`).
|
|
71
|
+
|
|
72
|
+
### ABI mismatch (Node 20 vs 22)
|
|
73
|
+
|
|
74
|
+
`better-sqlite3` is compiled against a specific Node ABI. If you switch Node versions (for example from Node 20 to Node 22), a prebuilt or previously compiled binary can fail to load with a module-version / ABI mismatch error. Rebuild the native module against your current Node by reinstalling, or run `npm rebuild better-sqlite3`. If you use a Node version manager, make sure you reinstall after switching versions.
|
|
75
|
+
|
|
76
|
+
### Confirming the build
|
|
77
|
+
|
|
78
|
+
After a successful build, `sessionmem stats` (or any command that touches the database) will run without a native-load error. A native-build failure typically surfaces immediately as a "cannot find module" or "was compiled against a different Node.js version" error the first time the database is opened.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# TypeScript 7 upgrade status
|
|
2
|
+
|
|
3
|
+
The supported development toolchain currently uses TypeScript 6.0.3. Do not
|
|
4
|
+
force TypeScript 7 into the dependency tree or disable peer dependency checks.
|
|
5
|
+
This is a tooling compatibility issue, not an application type error.
|
|
6
|
+
|
|
7
|
+
## Why Dependabot PR #21 fails
|
|
8
|
+
|
|
9
|
+
PR #21 upgrades `typescript` from 6.0.3 to 7.0.2. On every CI platform, `npm ci`
|
|
10
|
+
fails with `ERESOLVE` before lint, typecheck, build, or tests run:
|
|
11
|
+
|
|
12
|
+
- The PR's typescript-eslint 8.62.1 requires `typescript >=4.8.4 <6.1.0`.
|
|
13
|
+
- The latest published typescript-eslint checked for this review, 8.71.2,
|
|
14
|
+
still has that peer requirement. Updating the linter alone does not fix it.
|
|
15
|
+
- A separate scratch installation forced to TypeScript 7.0.2 plus
|
|
16
|
+
typescript-eslint 8.71.2 fails on import with
|
|
17
|
+
`Error: typescript-eslint does not support TS 7.0.`
|
|
18
|
+
- TypeScript 7's root export provides version information, not the previous
|
|
19
|
+
compiler API: `createSourceFile` and `SyntaxKind` are both undefined.
|
|
20
|
+
The new `typescript/unstable/*` APIs are not drop-in replacements for tools
|
|
21
|
+
that consume TypeScript 6's API.
|
|
22
|
+
|
|
23
|
+
The standalone TypeScript 7.0.2 compiler successfully typechecks this repository
|
|
24
|
+
with `tsc --noEmit -p tsconfig.json`. That does not make the whole toolchain
|
|
25
|
+
compatible: ESLint imports typescript-eslint from `eslint.config.mjs`, so bypassing
|
|
26
|
+
npm's peer checks still leaves lint broken. No application or tsconfig change
|
|
27
|
+
can supply the missing upstream API.
|
|
28
|
+
|
|
29
|
+
## Upgrade criteria
|
|
30
|
+
|
|
31
|
+
Keep TypeScript 6 until typescript-eslint explicitly supports the selected
|
|
32
|
+
TypeScript 7 release and its import/parser work with that compiler. Dependabot
|
|
33
|
+
continues TypeScript 6 updates; TypeScript 7+ version updates are temporarily
|
|
34
|
+
ignored to avoid recreating a known failing PR. Remove that ignore when support
|
|
35
|
+
lands, update TypeScript and typescript-eslint together, regenerate the lockfile
|
|
36
|
+
with normal peer resolution, and run:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm ci
|
|
40
|
+
npm run build
|
|
41
|
+
npm run typecheck
|
|
42
|
+
npm run lint
|
|
43
|
+
npm test
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
All CI operating systems and Node versions, including packaged-install smoke
|
|
47
|
+
tests and the security job, must pass before accepting the upgrade. Revisit
|
|
48
|
+
[PR #21](https://github.com/catfish-1234/sessionmem/pull/21) at that point.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sessionmem",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first MCP memory layer for coding agents across Claude Code, Codex, Cursor, Cline, Windsurf, and other MCP-compatible hosts.",
|
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
},
|
|
13
13
|
"mcpName": "io.github.catfish-1234/sessionmem",
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"docs",
|
|
17
|
+
"CHANGELOG.md",
|
|
18
|
+
"SECURITY.md",
|
|
19
|
+
"CONTRIBUTING.md",
|
|
20
|
+
".github/sessionmem-logo.svg"
|
|
16
21
|
],
|
|
17
22
|
"publishConfig": {
|
|
18
23
|
"access": "public"
|
|
@@ -28,24 +33,31 @@
|
|
|
28
33
|
"lint": "eslint .",
|
|
29
34
|
"typecheck": "tsc --noEmit",
|
|
30
35
|
"benchmark": "node scripts/benchmark.mjs",
|
|
31
|
-
"version": "node scripts/sync-version.mjs && git add package/package.json .claude-plugin/plugin.json server.json",
|
|
36
|
+
"version": "node scripts/sync-version.mjs && git add package/package.json .claude-plugin/plugin.json server.json Dockerfile",
|
|
32
37
|
"postversion": "npm run build"
|
|
33
38
|
},
|
|
34
39
|
"dependencies": {
|
|
35
|
-
"@anthropic-ai/sdk": "^0.
|
|
36
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
37
|
-
"better-sqlite3": "^12.
|
|
38
|
-
"commander": "^
|
|
40
|
+
"@anthropic-ai/sdk": "^0.135.0",
|
|
41
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
42
|
+
"better-sqlite3": "^12.11.1",
|
|
43
|
+
"commander": "^14.0.3",
|
|
39
44
|
"js-tiktoken": "^1.0.21",
|
|
40
|
-
"zod": "^4.
|
|
45
|
+
"zod": "^4.6.7"
|
|
41
46
|
},
|
|
42
47
|
"devDependencies": {
|
|
43
48
|
"@eslint/js": "^10.0.1",
|
|
44
|
-
"@types/better-sqlite3": "^
|
|
45
|
-
"eslint": "^10.
|
|
46
|
-
"globals": "^17.
|
|
49
|
+
"@types/better-sqlite3": "^9.6.0",
|
|
50
|
+
"eslint": "^10.12.0",
|
|
51
|
+
"globals": "^17.13.0",
|
|
47
52
|
"typescript": "^6.0.3",
|
|
48
|
-
"typescript-eslint": "^8.
|
|
53
|
+
"typescript-eslint": "^8.71.2",
|
|
49
54
|
"vitest": "^4.1.8"
|
|
50
|
-
}
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": "^20.19.0 || >=22.13.0"
|
|
58
|
+
},
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://github.com/catfish-1234/sessionmem/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://github.com/catfish-1234/sessionmem#readme"
|
|
51
63
|
}
|