hmem-mcp 3.1.0 → 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,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hmem-config
|
|
3
3
|
description: >
|
|
4
|
-
View and change hmem settings. Use when the user
|
|
5
|
-
to change memory settings, adjust parameters,
|
|
4
|
+
View and change hmem settings, including sync configuration. Use when the user
|
|
5
|
+
types /hmem-config or asks to change memory settings, adjust parameters, configure
|
|
6
|
+
hmem, or set up / manage hmem-sync for cross-device synchronization.
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
# hmem-config — View and Change Settings
|
|
@@ -128,3 +129,63 @@ Then tell the user:
|
|
|
128
129
|
- Which values were changed
|
|
129
130
|
- That the change takes effect **immediately** — no restart needed
|
|
130
131
|
- That `maxL1Chars` and `maxLnChars` only affect new entries written after the change (existing entries are not reformatted)
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Step 5 — hmem-sync Status (check automatically)
|
|
136
|
+
|
|
137
|
+
Check if hmem-sync is installed and configured. Run this check as part of every /hmem-config invocation.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Check if hmem-sync is installed
|
|
141
|
+
which hmem-sync 2>/dev/null || npx hmem-sync --help 2>/dev/null
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### If hmem-sync is installed:
|
|
145
|
+
|
|
146
|
+
Check config and status:
|
|
147
|
+
```bash
|
|
148
|
+
npx hmem-sync status
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Show the user:
|
|
152
|
+
| Setting | Value |
|
|
153
|
+
|---------|-------|
|
|
154
|
+
| Server URL | (from status output) |
|
|
155
|
+
| User ID | (from status output) |
|
|
156
|
+
| Last push | (timestamp or "never") |
|
|
157
|
+
| Last pull | (timestamp or "never") |
|
|
158
|
+
| Sync secrets | yes/no |
|
|
159
|
+
|
|
160
|
+
Also check if `HMEM_SYNC_PASSPHRASE` is set in the MCP config (`.mcp.json` env block).
|
|
161
|
+
If missing, warn: "Auto-sync is disabled. Add `HMEM_SYNC_PASSPHRASE` to your .mcp.json env to enable automatic push/pull on every read/write."
|
|
162
|
+
|
|
163
|
+
### If hmem-sync is NOT installed:
|
|
164
|
+
|
|
165
|
+
Tell the user:
|
|
166
|
+
|
|
167
|
+
> **hmem-sync** enables zero-knowledge encrypted sync between devices. Your memories are encrypted client-side with AES-256-GCM before leaving your machine — the server only sees opaque blobs.
|
|
168
|
+
>
|
|
169
|
+
> This lets you:
|
|
170
|
+
> - Work on your PC, then continue on your laptop with full memory
|
|
171
|
+
> - Back up your memories to a server you control
|
|
172
|
+
> - Share memories between Claude Code, Gemini CLI, and OpenCode
|
|
173
|
+
>
|
|
174
|
+
> Install: `npm install -g hmem-sync`
|
|
175
|
+
> Setup: `npx hmem-sync setup` (first device) or `npx hmem-sync restore` (additional devices)
|
|
176
|
+
>
|
|
177
|
+
> Want me to install it now?
|
|
178
|
+
|
|
179
|
+
If the user says yes:
|
|
180
|
+
```bash
|
|
181
|
+
npm install -g hmem-sync
|
|
182
|
+
npx hmem-sync setup
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Sync troubleshooting
|
|
186
|
+
|
|
187
|
+
Common issues:
|
|
188
|
+
- **"Config not found"** → run `npx hmem-sync setup` or `npx hmem-sync restore`
|
|
189
|
+
- **401 Token verification failed** → passphrase has special characters that need shell escaping. Use `--passphrase` flag or set `HMEM_SYNC_PASSPHRASE` in .mcp.json env.
|
|
190
|
+
- **0 entries after pull** → check `HMEM_AGENT_ID` matches between devices. Different agent IDs = different .hmem files.
|
|
191
|
+
- **Updates always global**: `npm update -g hmem-sync` (NOT inside a project directory)
|
|
@@ -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
|
+
```
|