memshare-mcp 0.2.6

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +243 -0
  3. package/dist/cli/index.d.ts +3 -0
  4. package/dist/cli/index.d.ts.map +1 -0
  5. package/dist/cli/index.js +702 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/cli/ui.d.ts +28 -0
  8. package/dist/cli/ui.d.ts.map +1 -0
  9. package/dist/cli/ui.js +104 -0
  10. package/dist/cli/ui.js.map +1 -0
  11. package/dist/index.d.ts +15 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +15 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/mcp/server.d.ts +6 -0
  16. package/dist/mcp/server.d.ts.map +1 -0
  17. package/dist/mcp/server.js +176 -0
  18. package/dist/mcp/server.js.map +1 -0
  19. package/dist/memory/project.d.ts +15 -0
  20. package/dist/memory/project.d.ts.map +1 -0
  21. package/dist/memory/project.js +77 -0
  22. package/dist/memory/project.js.map +1 -0
  23. package/dist/memory/redact.d.ts +35 -0
  24. package/dist/memory/redact.d.ts.map +1 -0
  25. package/dist/memory/redact.js +275 -0
  26. package/dist/memory/redact.js.map +1 -0
  27. package/dist/memory/store.d.ts +75 -0
  28. package/dist/memory/store.d.ts.map +1 -0
  29. package/dist/memory/store.js +325 -0
  30. package/dist/memory/store.js.map +1 -0
  31. package/dist/memory/types.d.ts +165 -0
  32. package/dist/memory/types.d.ts.map +1 -0
  33. package/dist/memory/types.js +88 -0
  34. package/dist/memory/types.js.map +1 -0
  35. package/dist/sharing/bundle.d.ts +36 -0
  36. package/dist/sharing/bundle.d.ts.map +1 -0
  37. package/dist/sharing/bundle.js +130 -0
  38. package/dist/sharing/bundle.js.map +1 -0
  39. package/dist/sharing/export.d.ts +54 -0
  40. package/dist/sharing/export.d.ts.map +1 -0
  41. package/dist/sharing/export.js +77 -0
  42. package/dist/sharing/export.js.map +1 -0
  43. package/dist/sharing/import.d.ts +59 -0
  44. package/dist/sharing/import.d.ts.map +1 -0
  45. package/dist/sharing/import.js +101 -0
  46. package/dist/sharing/import.js.map +1 -0
  47. package/package.json +69 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 memshare contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,243 @@
1
+ # memshare
2
+
3
+ **Peer-to-peer AI memory sharing between users — with consent.**
4
+
5
+ [![npm](https://img.shields.io/npm/v/memshare-mcp.svg)](https://www.npmjs.com/package/memshare-mcp)
6
+ [![CI](https://github.com/kampana/memshare/actions/workflows/ci.yml/badge.svg)](https://github.com/kampana/memshare/actions/workflows/ci.yml)
7
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
8
+
9
+ Every AI memory tool today treats memory as a feature of a chat product. memshare treats it as a data type: plain JSON files you own.
10
+
11
+ Once memory is a file, three things follow, in this order. You can **inspect** it — greppable, diffable, and actually gone when you delete it. You can **move** it — one store, every MCP client, every machine you own. And only then can you **share** it — selectively, item by item, with approval on both sides. That last one no other tool does at all; they are all per-account by design.
12
+
13
+ That third one is the part nothing else does. A designer working in Cursor and backend devs working in Claude Code can hand each other context directly — different people *and* different vendors, same bundle format.
14
+
15
+ No central server. No cloud. No signup.
16
+
17
+ 📊 **[See the pitch deck](https://kampana.github.io/memshare/pitch.html)** · 📄 **[Full spec](docs/SPEC.md)**
18
+
19
+ ---
20
+
21
+ ## 30-second quickstart
22
+
23
+ ```bash
24
+ npm install -g memshare-mcp
25
+ memshare init
26
+
27
+ # Connect it to Claude Code
28
+ claude mcp add memshare -- npx -y memshare-mcp serve
29
+
30
+ # Or add it to any MCP client's config:
31
+ # { "mcpServers": { "memshare": { "command": "npx", "args": ["-y", "memshare-mcp", "serve"] } } }
32
+ ```
33
+
34
+ ## You mostly talk, not type
35
+
36
+ After setup, capture and recall happen in conversation — there is no command to run:
37
+
38
+ > *"we went with Postgres — the JSONB support decided it"* → the AI calls `memory_set`, saved as `private`
39
+ >
40
+ > *"what do you know about this project?"* → the AI calls `memory_get`
41
+ >
42
+ > *"remember that I like dark mode"* → the AI calls `memory_set`
43
+
44
+ The commands exist for the decisions you should not delegate to a model: **what becomes shareable, what gets exported, and what you accept from someone else.** That is the point, not an unfinished UI.
45
+
46
+ ```bash
47
+ # The AI captures everything as private. Promote what the team should have:
48
+ memshare mark --tags project-x --shareable
49
+ ```
50
+
51
+ ### Tags name themselves
52
+
53
+ You never have to say "tag this project-x". The project tag is derived from the git checkout the assistant is working in, so every tool, every session and every teammate on that repo agrees on it — and the model is told to add only subject-matter tags (`auth`, `deploy`) on top. Turn it off with `memshare config --set autoProjectTag=false`.
54
+
55
+ If near-duplicates creep in anyway, merge them:
56
+
57
+ ```bash
58
+ memshare tags --rename projectx --to project-x
59
+ ```
60
+
61
+ You can also add memories by hand at any time:
62
+
63
+ ```bash
64
+ memshare add "Auth service uses JWT with 15min refresh" --tags project-x,auth --visibility shareable
65
+ memshare list
66
+ memshare list --tags project-x
67
+ ```
68
+
69
+ ## Sharing with someone else
70
+
71
+ ```bash
72
+ # Alice — see exactly what would go out, before anything is written
73
+ memshare export --tags "project-x,architecture" --for bob --expires 7d --preview
74
+
75
+ # Happy with it? Write the bundle.
76
+ memshare export --tags "project-x,architecture" --for bob --expires 7d
77
+ # → ~/.memshare/bundles/bundle-a3f8c2d1.memshare.json
78
+ ```
79
+
80
+ Send that file however you like — email, Slack, AirDrop, a USB stick. Then, on Bob's machine:
81
+
82
+ ```bash
83
+ memshare preview bundle-a3f8c2d1.memshare.json # look, import nothing
84
+ memshare import bundle-a3f8c2d1.memshare.json # choose item by item
85
+ ```
86
+
87
+ Bob picks each item individually. Accepted items land in his store marked `imported`, stored **private** by default — receiving something is not consent to pass it on. Nothing he already had is overwritten.
88
+
89
+ ## Architecture
90
+
91
+ ```
92
+ ~/.memshare/memories/*.json
93
+ the actual product — plain JSON files
94
+ ▲ ▲ ▲ ▲
95
+ │ │ │ │
96
+ MCP server CLI ChatGPT adapter system-prompt inject
97
+ │ (planned) (planned)
98
+
99
+ Claude · Cursor · VS Code · Windsurf · any MCP client
100
+ ```
101
+
102
+ The memory store is the product. The MCP server is one adapter over it, the CLI is another. If MCP disappears tomorrow, your data is still sitting in a folder — human-readable, diffable, and git-friendly. Sync it between your own machines with git or Dropbox; it is just files.
103
+
104
+ ```
105
+ ~/.memshare/
106
+ ├── config.json # your settings
107
+ ├── memories/
108
+ │ └── mem_<uuid>.json # one file per memory
109
+ ├── suggestions.json # pending, not yet approved
110
+ └── bundles/
111
+ └── bundle_<id>.memshare.json
112
+ ```
113
+
114
+ ## How memories get saved — three modes
115
+
116
+ These control what gets **written down** locally. What gets **shared** is a separate gate, covered below, and is never automatic.
117
+
118
+ | Mode | What happens | Who decides |
119
+ |---|---|---|
120
+ | `auto` **(default)** | The AI saves what it learns as you work. Everything lands `private`. | The AI, locally |
121
+ | `suggest` | The AI calls `memory_suggest`. Nothing is stored until you run `memshare review`. | You, in batch |
122
+ | `manual` | Nothing is saved unless you say "remember this". | You, every time |
123
+
124
+ `auto` is the default because an empty store is useless, and nothing captured locally can leave your machine until you mark it `shareable` anyway. If you would rather approve every item, use `suggest` — and note that a direct `memory_set` is then queued as a suggestion rather than saved, so an over-eager model cannot skip the consent step.
125
+
126
+ ```bash
127
+ memshare review # approve or reject, one by one
128
+ memshare review --yes # accept everything pending
129
+ memshare review --clear # reject everything pending
130
+ ```
131
+
132
+ ## Consent, on both sides
133
+
134
+ 1. **You tag at creation time.** Every item is `private` (the default) or `shareable`. Private items are never exported, not even when their tags match.
135
+ 2. **PII is blocked automatically.** Before anything leaves your machine, memshare scans for emails, phone numbers, government IDs, payment cards, bank details, credentials, and health or financial language. Flagged items are held back; you decide per item whether to skip them, send a redacted version, or send them as-is.
136
+ 3. **You see the exact bundle first.** `--preview` runs the identical computation the real export does — there is no separate preview code path to drift out of sync.
137
+ 4. **They choose too.** The recipient previews every item and accepts or rejects individually. Bundles are content-hashed, so a file edited in transit is refused.
138
+
139
+ ### What `--expires` does, and does not do
140
+
141
+ `memshare export --expires 30d` sets a deadline that does two things: the recipient's memshare **refuses to import** the bundle after it passes, and any item they did import **inherits that deadline** — so it stops being recalled and is deleted by `memshare prune`.
142
+
143
+ It does **not** delete the bundle file, and it is **cooperative, not enforced**: the deadline lives in the bundle metadata, which is not covered by the content hash, so a determined recipient can edit it. Expiry protects against stale context, not against a hostile recipient. There is no central server, so there is nothing that could revoke a file someone already has.
144
+
145
+ ## How it compares
146
+
147
+ | | Cross-model portability | Self-hosted | User-to-user sharing | Consent flow |
148
+ |---|:---:|:---:|:---:|:---:|
149
+ | Claude / ChatGPT memory | ✗ | ✗ | ✗ | ✗ |
150
+ | Mem0 | ✓ | ✓ | ✗ | ✗ |
151
+ | OMP (Open Memory Protocol) | ✓ | ✓ | ✗ | ✗ |
152
+ | Portable Memory (MacPaw) | ✓ | ✓ | ✗ | ✗ |
153
+ | **memshare** | **✓** | **✓** | **✓** | **✓** |
154
+
155
+ ## MCP tools
156
+
157
+ The server exposes four tools to any MCP client:
158
+
159
+ | Tool | What it does |
160
+ |---|---|
161
+ | `memory_set` | Save one durable fact. Routed to the approval queue in `suggest` mode. |
162
+ | `memory_get` | Recall memories by free text, tags, or most-recent. |
163
+ | `memory_suggest` | Propose memories for the user to approve later. |
164
+ | `memory_list_tags` | List every tag, so the model reuses tags instead of inventing near-duplicates. |
165
+
166
+ ## CLI reference
167
+
168
+ | Command | |
169
+ |---|---|
170
+ | `memshare init` | Create the store. `--name`, `--mode`, `--yes` |
171
+ | `memshare add <text>` | Add a memory. `--tags`, `--visibility`, `--expires`, `--tool` |
172
+ | `memshare list` | Show the store. `--tags`, `--visibility`, `--query`, `--from`, `--limit`, `--json`, `--all` |
173
+
174
+ `--from` matches the MCP client that wrote the memory — the name it gives in the handshake, such as `claude-code` or `cursor-vscode`. Memories added by hand are `cli`.
175
+
176
+ | `memshare recall` | Print memories as plain text, to paste into any AI tool |
177
+ | `memshare tags` | List all tags. `--rename <from> --to <to>` merges near-duplicates |
178
+ | `memshare mark [ids...]` | Promote memories to shareable, or pull them back. `--tags`, `--query`, `--shareable`, `--private` |
179
+ | `memshare review` | Approve or reject pending suggestions. `--yes`, `--clear` |
180
+ | `memshare export` | Write a bundle. `--tags`, `--for`, `--expires`, `--note`, `--out`, `--preview`, `--redact-blocked`, `--include-private`, `--no-scan` |
181
+ | `memshare preview <file>` | Inspect a bundle, import nothing |
182
+ | `memshare import <file>` | Import a bundle, item by item. `--yes`, `--visibility`, `--tag-sender`, `--allow-duplicates` |
183
+ | `memshare forget <ids...>` | Delete memories |
184
+ | `memshare prune` | Delete expired memories |
185
+ | `memshare config` | Show or change settings. `--set key=value` |
186
+ | `memshare serve` | Run the MCP server on stdio |
187
+
188
+ `--dir <path>` or `MEMSHARE_DIR` points any command at a different store — handy for keeping a separate memory profile per client, or for trying the sharing flow with yourself:
189
+
190
+ ```bash
191
+ MEMSHARE_DIR=/tmp/bob memshare init
192
+ MEMSHARE_DIR=/tmp/bob memshare import bundle-a3f8c2d1.memshare.json
193
+ ```
194
+
195
+ ## Where it can run
196
+
197
+ The same code, four ways to run it — pick one, switch whenever:
198
+
199
+ - **Local** *(we suggest starting here)* — files on your laptop, MCP as a local process. Sharing: export a file and send it.
200
+ - **Shared folder** — Dropbox, Drive, or a git repo. Sharing: auto-sync through the folder.
201
+ - **Team server** *(planned)* — Docker on your VPS. Sharing: by username.
202
+ - **Hosted** *(planned)* — managed infra, same protocol, zero ops.
203
+
204
+ ## Roadmap
205
+
206
+ - **v0.2 — shipped:** CLI, MCP server, export/import bundles, PII guard, consent flow
207
+ - **v0.3:** a ChatGPT route, and a system-prompt inject for API-only models (Gemini, Ollama). Claude Code, Cursor, Copilot and Windsurf already work — they speak MCP, so they need no adapter.
208
+ - **v0.4:** Docker deploy, remote MCP server
209
+ - **v0.5:** discovery and live sync
210
+ - **v1.0:** when the bundle format freezes and `SCHEMA_VERSION` goes to 1.0.0
211
+
212
+ ## Use as a library
213
+
214
+ ```ts
215
+ import { MemoryStore, selectForExport, planImport } from "memshare-mcp";
216
+
217
+ const store = new MemoryStore();
218
+ await store.add({ content: "Team chose Postgres over MySQL", tags: ["db"] });
219
+ const { included, blocked } = await selectForExport(store, { tags: ["db"] });
220
+ ```
221
+
222
+ Every adapter — the CLI, the MCP server, and any you write — goes through these exports. See [`src/index.ts`](src/index.ts).
223
+
224
+ ## Why is the package called `memshare-mcp`?
225
+
226
+ Two reasons. `memshare` itself is unusable on npm — an unrelated project published it in February 2021 and unpublished it that November, and npm permanently reserves unpublished names, returning 409 for everyone including the original owner. And `-mcp` says what this actually is: an MCP server first, with a CLI for the decisions that should not be delegated to a model.
227
+
228
+ The installed command is still `memshare`. An earlier release used `memshare-cli`, which is now deprecated and points here.
229
+
230
+ ## Development
231
+
232
+ ```bash
233
+ npm install
234
+ npm run build
235
+ npm test
236
+ npm run check:docs # docs and CLI must agree
237
+ ```
238
+
239
+ Contributions welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
240
+
241
+ ## License
242
+
243
+ MIT © memshare contributors
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}