hmem-mcp 3.1.1 → 3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hmem-mcp",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Humanlike memory for AI agents — MCP server with 5-level lazy-loaded SQLite memory",
5
5
  "author": "Bumblebiber",
6
6
  "license": "MIT",
@@ -0,0 +1,164 @@
1
+ ---
2
+ name: hmem-sync-setup
3
+ description: >
4
+ Set up hmem-sync for cross-device memory synchronization. Use when the user wants to
5
+ sync memories between devices, says "sync einrichten", "setup sync", "hmem-sync",
6
+ or when /hmem-config detects hmem-sync is not installed.
7
+ Covers first-device setup, additional-device restore, and MCP auto-sync configuration.
8
+ ---
9
+
10
+ # hmem-sync Setup
11
+
12
+ Zero-knowledge encrypted sync for hmem. Memories are encrypted client-side (AES-256-GCM)
13
+ before leaving the device — the server only sees opaque blobs.
14
+
15
+ ## Determine the scenario
16
+
17
+ Ask the user (or detect from context):
18
+
19
+ **A) First device** — no sync account exists yet → `hmem-sync setup`
20
+ **B) Additional device** — account exists on another machine → `hmem-sync restore`
21
+
22
+ ---
23
+
24
+ ## Scenario A: First Device Setup
25
+
26
+ ### Step 1: Install hmem-sync
27
+
28
+ ```bash
29
+ npm install -g hmem-sync
30
+ ```
31
+
32
+ ### Step 2: Run interactive setup
33
+
34
+ ```bash
35
+ npx hmem-sync setup
36
+ ```
37
+
38
+ This will:
39
+ 1. Ask for the sync server URL (default: `https://sync.hmem.dev`)
40
+ 2. Generate a salt + encryption key from a passphrase you choose
41
+ 3. Register with the server → receive an auth token
42
+ 4. Save config files next to your .hmem file
43
+
44
+ **Important:** Remember the passphrase — it's the encryption key. Losing it means losing access to synced data. There is no recovery.
45
+
46
+ ### Step 3: Enable auto-sync in MCP
47
+
48
+ Add `HMEM_SYNC_PASSPHRASE` to your `.mcp.json` env block:
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "hmem": {
54
+ "env": {
55
+ "HMEM_PROJECT_DIR": "/path/to/project",
56
+ "HMEM_AGENT_ID": "DEVELOPER",
57
+ "HMEM_SYNC_PASSPHRASE": "your-passphrase-here"
58
+ }
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ Without this, hmem works normally but won't auto-sync. With it, every `read_memory` pulls
65
+ and every `write_memory` pushes automatically (with 30s cooldown).
66
+
67
+ ### Step 4: Initial push
68
+
69
+ ```bash
70
+ npx hmem-sync push
71
+ ```
72
+
73
+ ### Step 5: Save credentials for additional devices
74
+
75
+ The user needs these values on their other devices:
76
+ - **Server URL** — from `.hmem-sync-config.json`
77
+ - **User ID** — from `.hmem-sync-config.json`
78
+ - **Token** — from `.hmem-sync-token`
79
+ - **Passphrase** — the one they chose in Step 2
80
+
81
+ Show the user where these files are:
82
+ ```bash
83
+ cat $(dirname $(echo $HMEM_PROJECT_DIR)/Agents/*//*.hmem)/.hmem-sync-config.json
84
+ cat $(dirname $(echo $HMEM_PROJECT_DIR)/Agents/*//*.hmem)/.hmem-sync-token
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Scenario B: Additional Device (Restore)
90
+
91
+ ### Step 1: Install hmem-sync
92
+
93
+ ```bash
94
+ npm install -g hmem-sync
95
+ ```
96
+
97
+ ### Step 2: Gather credentials from the original device
98
+
99
+ The user needs:
100
+ - **Server URL** (e.g. `https://bbbee.uber.space/hmem-sync`)
101
+ - **User ID** (e.g. `bbbee`)
102
+ - **Token** (64-char hex string from `.hmem-sync-token`)
103
+ - **Passphrase** (same as original device)
104
+
105
+ ### Step 3: Run restore
106
+
107
+ ```bash
108
+ npx hmem-sync restore
109
+ ```
110
+
111
+ This prompts for all values interactively. Or pass them as flags:
112
+
113
+ ```bash
114
+ npx hmem-sync restore \
115
+ --server-url https://sync.example.com/hmem-sync \
116
+ --user-id myname \
117
+ --token abc123... \
118
+ --passphrase "my passphrase" \
119
+ --hmem-path ~/.hmem/
120
+ ```
121
+
122
+ Note: `--hmem-path` accepts a directory — it will auto-detect or create `memory.hmem` inside it.
123
+
124
+ ### Step 4: Verify
125
+
126
+ After restore, the output shows entry count and path convention:
127
+
128
+ ```
129
+ ✓ Restore complete: 325 entries in /path/to/DEVELOPER.hmem
130
+
131
+ Path convention for MCP config:
132
+ Without HMEM_AGENT_ID: set HMEM_PROJECT_DIR to the directory containing memory.hmem
133
+ With HMEM_AGENT_ID=X: set HMEM_PROJECT_DIR to the parent of Agents/X/X.hmem
134
+ ```
135
+
136
+ ### Step 5: Configure MCP (same as Scenario A, Step 3)
137
+
138
+ Add `HMEM_SYNC_PASSPHRASE` to `.mcp.json` env block and restart the AI tool.
139
+
140
+ ---
141
+
142
+ ## Troubleshooting
143
+
144
+ | Problem | Cause | Fix |
145
+ |---------|-------|-----|
146
+ | 401 Token verification failed | Passphrase special chars broken by shell | Use `--passphrase` flag or `HMEM_SYNC_PASSPHRASE` env in .mcp.json |
147
+ | Config not found | hmem-sync looks in wrong directory | Run from the directory containing your .hmem file, or use `--config` flag |
148
+ | 0 entries after sync | Different `HMEM_AGENT_ID` on devices | Must match — different IDs mean different .hmem files |
149
+ | read_memory returns empty | `~/.claude.json` caches old HMEM_AGENT_ID | Check `~/.claude.json` for stale MCP env overrides |
150
+ | "npm ERR" on update | Running `npm update` inside a project dir | Always use `npm update -g hmem-sync` (global flag!) |
151
+
152
+ ## Path Convention
153
+
154
+ ```
155
+ Without HMEM_AGENT_ID: {HMEM_PROJECT_DIR}/memory.hmem
156
+ With HMEM_AGENT_ID=X: {HMEM_PROJECT_DIR}/Agents/X/X.hmem
157
+ ```
158
+
159
+ Config files are always stored next to the .hmem file:
160
+ ```
161
+ .hmem-sync-config.json — server URL, user ID, salt (not secret)
162
+ .hmem-sync-token — auth token (chmod 600, never commit)
163
+ .hmem-sync.json — sync state (last push/pull timestamps)
164
+ ```