hmem-mcp 5.0.0 → 5.1.21
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/README.md +161 -214
- package/dist/cli-checkpoint.js +102 -40
- package/dist/cli-checkpoint.js.map +1 -1
- package/dist/cli-context-inject.d.ts +7 -6
- package/dist/cli-context-inject.js +27 -130
- package/dist/cli-context-inject.js.map +1 -1
- package/dist/cli-env.d.ts +16 -0
- package/dist/cli-env.js +40 -0
- package/dist/cli-env.js.map +1 -0
- package/dist/cli-hook-startup.d.ts +20 -0
- package/dist/cli-hook-startup.js +101 -0
- package/dist/cli-hook-startup.js.map +1 -0
- package/dist/cli-init.js +97 -188
- package/dist/cli-init.js.map +1 -1
- package/dist/cli-log-exchange.js +63 -3
- package/dist/cli-log-exchange.js.map +1 -1
- package/dist/cli-statusline.d.ts +14 -0
- package/dist/cli-statusline.js +172 -0
- package/dist/cli-statusline.js.map +1 -0
- package/dist/cli.js +18 -2
- package/dist/cli.js.map +1 -1
- package/dist/hmem-config.d.ts +10 -0
- package/dist/hmem-config.js +63 -13
- package/dist/hmem-config.js.map +1 -1
- package/dist/hmem-store.d.ts +30 -1
- package/dist/hmem-store.js +219 -48
- package/dist/hmem-store.js.map +1 -1
- package/dist/mcp-server.js +202 -75
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/scripts/autoresearch-nightly.sh +84 -0
- package/scripts/hmem-statusline.sh +4 -0
- package/skills/hmem-config/SKILL.md +112 -147
- package/skills/hmem-curate/SKILL.md +56 -6
- package/skills/hmem-new-project/SKILL.md +164 -0
- package/skills/hmem-read/SKILL.md +174 -146
- package/skills/hmem-release/SKILL.md +141 -0
- package/skills/hmem-self-curate/SKILL.md +49 -7
- package/skills/hmem-setup/SKILL.md +169 -87
- package/skills/hmem-sync-setup/SKILL.md +16 -3
- package/skills/hmem-update/SKILL.md +254 -0
- package/skills/hmem-wipe/SKILL.md +47 -21
- package/skills/hmem-write/SKILL.md +38 -14
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hmem-self-curate
|
|
3
|
-
description: Curate your own memory. Systematically review entries — mark obsolete, irrelevant, or favorite. Run periodically to keep memory clean.
|
|
3
|
+
description: Curate your own memory. Systematically review entries — mark obsolete, irrelevant, or favorite. Run periodically to keep memory clean. Use when asked to "aufräumen", "clean up memory", "alte Einträge prüfen", "memory review", "Speicher bereinigen", "curate", "tidy up", or when memory_health() shows issues.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Self-Curation: Review Your Own Memory
|
|
@@ -39,14 +39,53 @@ Work through one prefix at a time. Load all entries of a prefix with full depth:
|
|
|
39
39
|
read_memory(prefix="P", show_all=true)
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
This bypasses
|
|
42
|
+
This bypasses the bulk-read algorithm and session cache — every entry is expanded with L2+L3 children visible. Review each entry in the output directly — no need to drill into individual entries.
|
|
43
43
|
|
|
44
|
-
**Order:** Start with the prefix that has the most entries (usually P), then move to L, E, D, etc.
|
|
44
|
+
**Order:** Start with the prefix that has the most entries (usually P), then move to L, E, D, O, etc.
|
|
45
45
|
|
|
46
46
|
If context overflows mid-prefix, continue with the remaining entries — your memory survives compression.
|
|
47
47
|
|
|
48
48
|
---
|
|
49
49
|
|
|
50
|
+
## O-Entries (Session Logs)
|
|
51
|
+
|
|
52
|
+
O-entries accumulate automatically via the Stop hook — each session creates one per project. `load_project` injects the latest session's **checkpoint summary** (if available) plus the most recent raw exchanges.
|
|
53
|
+
|
|
54
|
+
**Checkpoint summaries:** Auto-checkpoints write a `[CP]` prefixed summary node (tagged `#checkpoint-summary`) under the O-entry. These rolling summaries compress older exchanges so `load_project` stays compact. Older summaries are further compressed into 1-2 sentences by each new checkpoint.
|
|
55
|
+
|
|
56
|
+
**Skill-dialog filtering:** Exchanges containing skill activations (brainstorming, TDD, debugging) are tagged `#skill-dialog` at the exchange-node level and automatically excluded from `load_project` / `/clear` output. The full content remains accessible via `read_memory(id="O0123")`.
|
|
57
|
+
|
|
58
|
+
**Curation rules for O-entries:**
|
|
59
|
+
- **Leave them alone.** Old O-entries don't cause harm — they're excluded from bulk reads and `load_project` only shows the most recent one.
|
|
60
|
+
- **Don't mark them irrelevant or obsolete** — they serve as historical record and can be useful for checkpoint agents extracting L/D/E.
|
|
61
|
+
- **Skip O-entries during curation.** Focus your time on L, E, D, P entries where curation has real impact.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Bulk Operations
|
|
66
|
+
|
|
67
|
+
For large-scale curation across many entries, use the bulk tools instead of updating one by one:
|
|
68
|
+
|
|
69
|
+
| Tool | Purpose |
|
|
70
|
+
|------|---------|
|
|
71
|
+
| `update_many(updates=[...])` | Batch-update multiple entries at once (content, flags, etc.) |
|
|
72
|
+
| `tag_bulk(ids=[...], add_tags=[...], remove_tags=[...])` | Add or remove tags across many entries in one call |
|
|
73
|
+
| `tag_rename(old_tag="...", new_tag="...")` | Rename a tag globally across all entries |
|
|
74
|
+
|
|
75
|
+
These are especially useful when a curation pass reveals a pattern (e.g., 10 entries that all need the same tag added, or a batch of stale entries to mark irrelevant).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Title Quality Check
|
|
80
|
+
|
|
81
|
+
Since v5.1, every node has a **title** (short navigation label, ~50 chars) and an optional **body** (detailed content shown on drill-down). During curation, check whether titles are good navigation labels:
|
|
82
|
+
|
|
83
|
+
- **Vague title?** Update it: `update_memory(id="L0003", content="Better, specific title")`
|
|
84
|
+
- **Title = full content?** Old entries without `>` body lines have `title = autoExtract(content)`. If the content is valuable but the title is truncated gibberish, rewrite the title to be a clear summary.
|
|
85
|
+
- **Long content in a leaf node?** Consider whether it would benefit from title/body separation — though this requires rewriting via the `>` format (write new entry + mark old obsolete).
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
50
89
|
## For Each Entry: Decide and Act
|
|
51
90
|
|
|
52
91
|
| Decision | Action |
|
|
@@ -55,7 +94,7 @@ If context overflows mid-prefix, continue with the remaining entries — your me
|
|
|
55
94
|
| Important reference I need every session | `update_memory(id="X", content="...", favorite=true)` |
|
|
56
95
|
| Outdated — a better entry exists | Mark obsolete (see below) |
|
|
57
96
|
| Just noise — not wrong, but irrelevant | `update_memory(id="X", content="...", irrelevant=true)` |
|
|
58
|
-
|
|
|
97
|
+
| Title is vague or misleading | `update_memory(id="X", content="Better wording")` |
|
|
59
98
|
| Sub-node has valuable reference info | `update_memory(id="X.N", content="...", favorite=true)` |
|
|
60
99
|
|
|
61
100
|
---
|
|
@@ -89,9 +128,9 @@ Look for entries covering the same topic (common with P entries). Merge them:
|
|
|
89
128
|
|
|
90
129
|
1. Pick the **keeper** (the more complete one)
|
|
91
130
|
2. Copy unique info from the duplicate: `append_memory(id="P0029", content="Session from duplicate\n\tDetail carried over")`
|
|
92
|
-
3.
|
|
131
|
+
3. Mark the duplicate obsolete with a correction reference: `update_memory(id="P0031", content="Merged into [✓P0029]", obsolete=true)`
|
|
93
132
|
|
|
94
|
-
**
|
|
133
|
+
**Note:** Only curators (ceo role) can delete entries via `delete_agent_memory`. As a worker agent, use `obsolete=true` with `[✓ID]` to point to the keeper. Obsolete entries are hidden from bulk reads and won't cause confusion.
|
|
95
134
|
|
|
96
135
|
---
|
|
97
136
|
|
|
@@ -148,5 +187,8 @@ Check `[♥]` markers in the output.
|
|
|
148
187
|
| `update_memory(id, content, obsolete=true)` | Mark as wrong (needs [✓ID]) |
|
|
149
188
|
| `append_memory(id, content)` | Merge info into keeper |
|
|
150
189
|
| `move_memory(source_id, target_parent_id)` | Relocate misplaced sub-node (updates all refs) |
|
|
151
|
-
| `
|
|
190
|
+
| `update_memory(id, content="Merged into [✓X]", obsolete=true)` | Mark duplicate as obsolete (point to keeper) |
|
|
191
|
+
| `update_many(updates=[...])` | Batch-update multiple entries at once |
|
|
192
|
+
| `tag_bulk(ids=[...], add_tags, remove_tags)` | Add/remove tags across many entries |
|
|
193
|
+
| `tag_rename(old_tag, new_tag)` | Rename a tag globally |
|
|
152
194
|
| `read_memory(show_obsolete=true, prefix="X")` | Review already-obsolete entries |
|
|
@@ -1,22 +1,163 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hmem-setup
|
|
3
3
|
description: Interactive setup guide for hmem. Run this skill to install and configure
|
|
4
|
-
the hmem MCP server — installs dependencies, configures .mcp.json,
|
|
5
|
-
|
|
4
|
+
the hmem MCP server — installs dependencies, configures .mcp.json, deploys skill
|
|
5
|
+
files, and registers auto-memory hooks for Claude Code, Gemini CLI, or OpenCode.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# hmem Setup
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Recommended: `hmem init`
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Install hmem globally, then run the interactive installer:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g hmem-mcp
|
|
16
|
+
hmem init
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`hmem init` performs all setup steps automatically:
|
|
20
|
+
1. Detects installed AI tools (Claude Code, Gemini CLI, OpenCode, Cursor, Windsurf, Cline)
|
|
21
|
+
2. Asks for installation scope (system-wide or project-local)
|
|
22
|
+
3. Creates the memory directory and optional example database
|
|
23
|
+
4. Writes `.mcp.json` with the correct paths for each detected tool
|
|
24
|
+
5. Adds session-start instructions to the tool's config file (CLAUDE.md, GEMINI.md, etc.)
|
|
25
|
+
6. Creates `hmem.config.json` with sensible defaults
|
|
26
|
+
7. Installs all 4 auto-memory hooks (Claude Code only — see Hook Reference below)
|
|
27
|
+
8. Copies skill files (slash commands) to the tool's skill directory
|
|
28
|
+
|
|
29
|
+
After `hmem init`, install the slash-command skills:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx hmem update-skills
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart your AI tool and call `read_memory()` to verify.
|
|
36
|
+
|
|
37
|
+
Non-interactive mode (CI / scripting):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
hmem init --global --tools claude-code --dir ~/.hmem --no-example
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Hook Reference (Claude Code)
|
|
46
|
+
|
|
47
|
+
`hmem init` registers 4 hooks in `~/.claude/settings.json`. Each hook is a bash script in `~/.claude/hooks/`.
|
|
48
|
+
|
|
49
|
+
### 1. UserPromptSubmit — memory load + checkpoint reminder
|
|
50
|
+
|
|
51
|
+
Script: `~/.claude/hooks/hmem-startup.sh`
|
|
52
|
+
|
|
53
|
+
- **First message**: injects `additionalContext` telling the agent to call `read_memory()` silently.
|
|
54
|
+
- **Every Nth message** (N = `checkpointInterval`, default 20): injects a checkpoint reminder.
|
|
55
|
+
- `checkpointMode: "remind"` — adds an `additionalContext` nudge; the agent decides what to save.
|
|
56
|
+
- `checkpointMode: "auto"` — checkpoint is handled by the Stop hook instead (no reminder injected).
|
|
57
|
+
- Subagents (messages with `parentUuid`) are skipped.
|
|
58
|
+
- Uses a per-session counter file at `/tmp/claude-hmem-counter-{SESSION_ID}`.
|
|
59
|
+
|
|
60
|
+
### 2. Stop (async) — exchange logging + checkpoint
|
|
61
|
+
|
|
62
|
+
Script: `~/.claude/hooks/hmem-log-exchange.sh`
|
|
63
|
+
|
|
64
|
+
- Runs asynchronously after every agent response (timeout: 10s).
|
|
65
|
+
- Pipes the Stop hook JSON (containing `transcript_path` and `last_assistant_message`) to `hmem log-exchange`.
|
|
66
|
+
- `hmem log-exchange` reads the last user message from the JSONL transcript, combines it with the agent response, and appends both to the currently active O-entry (session history).
|
|
67
|
+
- If no active O-entry exists, one is created automatically.
|
|
68
|
+
- Every N exchanges (configurable via `checkpointInterval`, default 20), triggers a checkpoint:
|
|
69
|
+
- **auto mode**: Spawns `hmem checkpoint` in background — Haiku subagent with MCP tools that:
|
|
70
|
+
- Titles each exchange with a descriptive summary (max 50 chars)
|
|
71
|
+
- Writes L/D/E entries for non-obvious insights
|
|
72
|
+
- Updates P-entry (protocol, bugs, open tasks, overview, codebase)
|
|
73
|
+
- Writes a checkpoint summary for context re-injection
|
|
74
|
+
- Verifies project relevance and fixes links
|
|
75
|
+
- **remind mode**: Injects a reminder for the main agent to save knowledge manually
|
|
76
|
+
- Checks transcript file size and writes a warning flag when context exceeds `contextTokenThreshold` (default 100k tokens).
|
|
77
|
+
|
|
78
|
+
### 3. SessionStart[clear] — context re-injection
|
|
79
|
+
|
|
80
|
+
Script: `~/.claude/hooks/hmem-context-inject.sh`
|
|
81
|
+
|
|
82
|
+
- Fires only after `/clear` (matcher: `"clear"`).
|
|
83
|
+
- Pipes session JSON to `hmem context-inject`, which outputs `additionalContext` containing:
|
|
84
|
+
- Last 20 user/assistant messages from the pre-clear transcript
|
|
85
|
+
- Active project briefing (title + overview)
|
|
86
|
+
- Recent O-entries (session logs) linked to the project
|
|
87
|
+
- R-entries (rules)
|
|
88
|
+
- Keeps the agent oriented after a context reset without a full `read_memory()` call.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Configuration Reference
|
|
93
|
+
|
|
94
|
+
Place `hmem.config.json` in your memory directory (the path you chose during `hmem init`). All keys are optional — defaults are applied for anything missing.
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"memory": {
|
|
99
|
+
"maxCharsPerLevel": [200, 2500, 10000, 25000, 50000],
|
|
100
|
+
"maxDepth": 5,
|
|
101
|
+
"defaultReadLimit": 100,
|
|
102
|
+
"maxTitleChars": 50,
|
|
103
|
+
"checkpointInterval": 20,
|
|
104
|
+
"checkpointMode": "remind",
|
|
105
|
+
"recentOEntries": 10,
|
|
106
|
+
"contextTokenThreshold": 100000,
|
|
107
|
+
"bulkReadV2": {
|
|
108
|
+
"topAccessCount": 3,
|
|
109
|
+
"topNewestCount": 5,
|
|
110
|
+
"topObsoleteCount": 3,
|
|
111
|
+
"topSubnodeCount": 3,
|
|
112
|
+
"newestPercent": 20,
|
|
113
|
+
"newestMin": 5,
|
|
114
|
+
"newestMax": 15,
|
|
115
|
+
"accessPercent": 10,
|
|
116
|
+
"accessMin": 3,
|
|
117
|
+
"accessMax": 8
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Key | Type | Default | Description |
|
|
124
|
+
|-----|------|---------|-------------|
|
|
125
|
+
| `maxCharsPerLevel` | `number[]` | `[200,2500,10000,25000,50000]` | Character limit per tree depth (L1..L5). Alternative: set `maxL1Chars` + `maxLnChars` and levels are interpolated linearly. |
|
|
126
|
+
| `maxDepth` | `number` | `5` | Max tree depth (1 = L1 only, 5 = full). |
|
|
127
|
+
| `defaultReadLimit` | `number` | `100` | Max entries returned by a default `read_memory()`. |
|
|
128
|
+
| `maxTitleChars` | `number` | `50` | Max characters for auto-extracted titles. |
|
|
129
|
+
| `checkpointInterval` | `number` | `20` | Messages between checkpoint reminders. Set 0 to disable. |
|
|
130
|
+
| `checkpointMode` | `"remind"` or `"auto"` | `"remind"` | `"remind"` = inject a save-reminder via `additionalContext`. `"auto"` = spawn a Haiku subagent that saves directly (no user interaction). |
|
|
131
|
+
| `recentOEntries` | `number` | `10` | Number of recent O-entries (session logs) injected at startup and on `load_project`. Set 0 to disable. |
|
|
132
|
+
| `contextTokenThreshold` | `number` | `100000` | Token threshold for context-clear recommendation. When cumulative hmem output exceeds this, the agent is told to flush + `/clear`. Set 0 to disable. |
|
|
133
|
+
|
|
134
|
+
**Bulk-read tuning** (`bulkReadV2`): controls which entries get expanded (all L2 children shown) in a default `read_memory()` call. Per prefix category, the top N newest + top M most-accessed entries are expanded. Favorites are always expanded.
|
|
135
|
+
|
|
136
|
+
| Key | Default | Description |
|
|
137
|
+
|-----|---------|-------------|
|
|
138
|
+
| `topAccessCount` | `3` | Fixed fallback: top-accessed entries to expand. |
|
|
139
|
+
| `topNewestCount` | `5` | Fixed fallback: newest entries to expand. |
|
|
140
|
+
| `topObsoleteCount` | `3` | Obsolete entries to keep visible. |
|
|
141
|
+
| `topSubnodeCount` | `3` | Entries with most sub-nodes to always expand. |
|
|
142
|
+
| `newestPercent` | `20` | Percentage-based selection (overrides `topNewestCount`). |
|
|
143
|
+
| `newestMin` / `newestMax` | `5` / `15` | Clamp for percentage-based newest selection. |
|
|
144
|
+
| `accessPercent` | `10` | Percentage-based selection (overrides `topAccessCount`). |
|
|
145
|
+
| `accessMin` / `accessMax` | `3` / `8` | Clamp for percentage-based access selection. |
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Manual Setup (Fallback)
|
|
150
|
+
|
|
151
|
+
Use these steps only if `hmem init` is not available (e.g., local clone without global install).
|
|
152
|
+
|
|
153
|
+
### Step 0 — Prerequisites
|
|
13
154
|
|
|
14
155
|
```bash
|
|
15
156
|
node --version # must be >= 18
|
|
16
157
|
npm --version # any recent version
|
|
17
158
|
```
|
|
18
159
|
|
|
19
|
-
`better-sqlite3` requires native build tools
|
|
160
|
+
`better-sqlite3` requires native build tools:
|
|
20
161
|
|
|
21
162
|
| OS | Install |
|
|
22
163
|
|----|---------|
|
|
@@ -25,9 +166,7 @@ npm --version # any recent version
|
|
|
25
166
|
| macOS | `xcode-select --install` |
|
|
26
167
|
| Windows | `npm install -g windows-build-tools` |
|
|
27
168
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Step 1 — Clone and Build
|
|
169
|
+
### Step 1 — Clone and Build
|
|
31
170
|
|
|
32
171
|
```bash
|
|
33
172
|
git clone https://github.com/Bumblebiber/hmem.git
|
|
@@ -36,33 +175,19 @@ npm install
|
|
|
36
175
|
npm run build
|
|
37
176
|
```
|
|
38
177
|
|
|
39
|
-
Verify: `dist/mcp-server.js` must exist after build.
|
|
40
|
-
before continuing — everything else depends on this file.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## Step 2 — Create Agent Directory
|
|
178
|
+
Verify: `dist/mcp-server.js` must exist after build.
|
|
45
179
|
|
|
46
|
-
|
|
47
|
-
The SQLite file is created automatically on first write — just create the folder:
|
|
180
|
+
### Step 2 — Create Memory Directory
|
|
48
181
|
|
|
49
182
|
```bash
|
|
50
183
|
mkdir -p /your/project/Agents/YOUR_NAME
|
|
51
184
|
```
|
|
52
185
|
|
|
186
|
+
The SQLite `.hmem` file is created automatically on first write.
|
|
53
187
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Step 3 — Configure MCP
|
|
57
|
-
|
|
58
|
-
Add hmem to your `.mcp.json` (create it at your project root if it doesn't exist).
|
|
188
|
+
### Step 3 — Configure MCP
|
|
59
189
|
|
|
60
|
-
|
|
61
|
-
> or AI tool. Claude Code, Gemini CLI, and OpenCode discover it from the current
|
|
62
|
-
> working directory — if you open your project in `/home/alice/myproject`, that's
|
|
63
|
-
> where `.mcp.json` belongs. The `.hmem` memory files will be created in that same
|
|
64
|
-
> directory (under `Agents/YOUR_NAME/`) unless you point `HMEM_PROJECT_DIR`
|
|
65
|
-
> elsewhere.
|
|
190
|
+
Add hmem to your `.mcp.json` (create it at your project root if it does not exist). All paths must be absolute.
|
|
66
191
|
|
|
67
192
|
```json
|
|
68
193
|
{
|
|
@@ -81,23 +206,15 @@ Add hmem to your `.mcp.json` (create it at your project root if it doesn't exist
|
|
|
81
206
|
}
|
|
82
207
|
```
|
|
83
208
|
|
|
84
|
-
**All paths must be absolute** — relative paths will fail silently.
|
|
85
|
-
|
|
86
209
|
| Variable | Description |
|
|
87
210
|
|----------|-------------|
|
|
88
211
|
| `HMEM_PROJECT_DIR` | Root directory where `.hmem` files are stored |
|
|
89
212
|
| `HMEM_AGENT_ID` | Unique identifier for this agent (e.g. `ALICE`, `DEVELOPER`) |
|
|
90
|
-
| `HMEM_AGENT_ROLE` | Permission level: `worker`
|
|
213
|
+
| `HMEM_AGENT_ROLE` | Permission level: `worker` / `al` / `pl` / `ceo` |
|
|
91
214
|
|
|
92
|
-
|
|
93
|
-
`worker` sees everything marked `min_role: worker`. Higher roles unlock more.
|
|
215
|
+
### Step 4 — Install Skill Files
|
|
94
216
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## Step 4 — Install Skill Files
|
|
98
|
-
|
|
99
|
-
Skill files teach your AI tool how to use `read_memory`, `write_memory`, and `/save`.
|
|
100
|
-
Copy them to the global skills directory for your tool:
|
|
217
|
+
Copy skill files to the global skills directory for your tool:
|
|
101
218
|
|
|
102
219
|
**Claude Code:**
|
|
103
220
|
```bash
|
|
@@ -111,78 +228,43 @@ cp /path/to/hmem/skills/memory-curate/SKILL.md ~/.claude/skills/memory-curate/SK
|
|
|
111
228
|
**Gemini CLI:**
|
|
112
229
|
```bash
|
|
113
230
|
mkdir -p ~/.gemini/skills/hmem-read ~/.gemini/skills/hmem-write ~/.gemini/skills/save ~/.gemini/skills/memory-curate
|
|
114
|
-
cp /path/to/hmem/skills
|
|
115
|
-
cp /path/to/hmem/skills/hmem-write/SKILL.md ~/.gemini/skills/hmem-write/SKILL.md
|
|
116
|
-
cp /path/to/hmem/skills/save/SKILL.md ~/.gemini/skills/save/SKILL.md
|
|
117
|
-
cp /path/to/hmem/skills/memory-curate/SKILL.md ~/.gemini/skills/memory-curate/SKILL.md
|
|
231
|
+
cp /path/to/hmem/skills/*/SKILL.md to corresponding ~/.gemini/skills/*/SKILL.md
|
|
118
232
|
```
|
|
119
233
|
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
mkdir -p ~/.config/opencode/skills/hmem-read ~/.config/opencode/skills/hmem-write ~/.config/opencode/skills/save ~/.config/opencode/skills/memory-curate
|
|
123
|
-
cp /path/to/hmem/skills/hmem-read/SKILL.md ~/.config/opencode/skills/hmem-read/SKILL.md
|
|
124
|
-
cp /path/to/hmem/skills/hmem-write/SKILL.md ~/.config/opencode/skills/hmem-write/SKILL.md
|
|
125
|
-
cp /path/to/hmem/skills/save/SKILL.md ~/.config/opencode/skills/save/SKILL.md
|
|
126
|
-
cp /path/to/hmem/skills/memory-curate/SKILL.md ~/.config/opencode/skills/memory-curate/SKILL.md
|
|
127
|
-
```
|
|
234
|
+
### Step 5 — Verify
|
|
128
235
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## Step 5 — Optional: hmem.config.json
|
|
132
|
-
|
|
133
|
-
Place `hmem.config.json` in your `HMEM_PROJECT_DIR` to customize behavior. All keys are optional.
|
|
134
|
-
|
|
135
|
-
```json
|
|
136
|
-
{
|
|
137
|
-
"maxL1Chars": 500,
|
|
138
|
-
"maxLnChars": 50000,
|
|
139
|
-
"maxDepth": 5,
|
|
140
|
-
"defaultReadLimit": 100,
|
|
141
|
-
"bulkReadV2": {
|
|
142
|
-
"topAccessCount": 3,
|
|
143
|
-
"topNewestCount": 5,
|
|
144
|
-
"topObsoleteCount": 3
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**Character limits** — two options:
|
|
150
|
-
- `"maxL1Chars"` + `"maxLnChars"`: set endpoints only, intermediate levels interpolated linearly
|
|
151
|
-
- `"maxCharsPerLevel"`: explicit array `[L1, L2, L3, L4, L5]`
|
|
152
|
-
|
|
153
|
-
**Bulk-read tuning** (`bulkReadV2`): controls which entries get expanded (all L2 children shown) in a default `read_memory()` call. Per prefix category: top N newest + top M most-accessed are expanded. Favorites are always expanded.
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
## Step 6 — Verify
|
|
158
|
-
|
|
159
|
-
**Fully restart** your AI tool (exit and reopen — `/clear` is not enough).
|
|
160
|
-
Then call:
|
|
236
|
+
Fully restart your AI tool (exit and reopen — `/clear` is not enough). Then call:
|
|
161
237
|
|
|
162
238
|
```
|
|
163
239
|
read_memory()
|
|
164
240
|
```
|
|
165
241
|
|
|
166
|
-
Expected: `Memory is empty` (or your existing memories
|
|
242
|
+
Expected: `Memory is empty` (or your existing memories).
|
|
243
|
+
|
|
244
|
+
---
|
|
167
245
|
|
|
168
|
-
|
|
246
|
+
## Troubleshooting
|
|
169
247
|
|
|
170
248
|
| Symptom | Likely cause |
|
|
171
249
|
|---------|-------------|
|
|
172
250
|
| `HMEM_PROJECT_DIR not set` | Path missing or wrong env var name in `.mcp.json` |
|
|
173
251
|
| `No such tool: read_memory` | Tool not restarted after adding `.mcp.json` |
|
|
174
|
-
| `npm install` fails | Missing build tools (see
|
|
252
|
+
| `npm install` fails | Missing build tools (see Prerequisites above) |
|
|
175
253
|
| `read_memory` returns empty after writing | MCP server process is stale — restart tool |
|
|
254
|
+
| Hooks not firing | Check `~/.claude/settings.json` — hooks must be registered there |
|
|
255
|
+
| Checkpoint reminders not appearing | Verify `checkpointInterval > 0` in `hmem.config.json` |
|
|
176
256
|
|
|
177
257
|
---
|
|
178
258
|
|
|
179
259
|
## Quick Reference — After Setup
|
|
180
260
|
|
|
181
261
|
```
|
|
182
|
-
read_memory() # see all
|
|
262
|
+
read_memory() # see all L1 memories
|
|
183
263
|
read_memory(id="L0001") # drill into one entry
|
|
184
|
-
write_memory(prefix="L", content="
|
|
264
|
+
write_memory(prefix="L", content="Short title\n> Detailed body text\n\tL2 sub-node")
|
|
185
265
|
search_memory(query="error node.js") # search across all memories
|
|
186
266
|
```
|
|
187
267
|
|
|
268
|
+
Use `>` lines for body text (hidden in listings, shown on drill-down). See `hmem-write` skill for details.
|
|
269
|
+
|
|
188
270
|
See `skills/hmem-read/SKILL.md` and `skills/hmem-write/SKILL.md` for full usage.
|
|
@@ -27,6 +27,10 @@ It automatically:
|
|
|
27
27
|
4. Asks the user what to sync (push, pull, merge, or skip)
|
|
28
28
|
5. Verifies the result
|
|
29
29
|
|
|
30
|
+
**Custom / Self-hosted servers:** The `--server-url` flag accepts any hmem-sync compatible
|
|
31
|
+
server, not just the default. Examples: `https://yourdomain.com/hmem-sync` for a self-hosted
|
|
32
|
+
instance, or `http://localhost:3100` for a local development server.
|
|
33
|
+
|
|
30
34
|
For non-interactive use:
|
|
31
35
|
```bash
|
|
32
36
|
# New account
|
|
@@ -34,6 +38,9 @@ npx hmem-sync connect --user-id myname --passphrase "pass" --hmem-path ~/.hmem/
|
|
|
34
38
|
|
|
35
39
|
# Existing account
|
|
36
40
|
npx hmem-sync connect --user-id myname --passphrase "pass" --token abc123... --hmem-path ~/.hmem/ --agent-id DEVELOPER
|
|
41
|
+
|
|
42
|
+
# Custom server
|
|
43
|
+
npx hmem-sync connect --server-url http://localhost:3100 --user-id myname --passphrase "pass" --hmem-path ~/.hmem/ --agent-id DEVELOPER
|
|
37
44
|
```
|
|
38
45
|
|
|
39
46
|
The legacy `setup` and `restore` commands still work for backwards compatibility.
|
|
@@ -104,10 +111,10 @@ The user needs these values on their other devices:
|
|
|
104
111
|
- **Token** — from `.hmem-sync-token`
|
|
105
112
|
- **Passphrase** — the one they chose in Step 2
|
|
106
113
|
|
|
107
|
-
Show the user where these files are:
|
|
114
|
+
Show the user where these files are (adjust AGENT_ID to match your `HMEM_AGENT_ID`):
|
|
108
115
|
```bash
|
|
109
|
-
cat $
|
|
110
|
-
cat $
|
|
116
|
+
cat "$HMEM_PROJECT_DIR/Agents/$HMEM_AGENT_ID/.hmem-sync-config.json"
|
|
117
|
+
cat "$HMEM_PROJECT_DIR/Agents/$HMEM_AGENT_ID/.hmem-sync-token"
|
|
111
118
|
```
|
|
112
119
|
|
|
113
120
|
---
|
|
@@ -250,3 +257,9 @@ Config files are always stored next to the .hmem file:
|
|
|
250
257
|
.hmem-sync-token — auth token (chmod 600, never commit)
|
|
251
258
|
.hmem-sync.json — sync state (last push/pull timestamps)
|
|
252
259
|
```
|
|
260
|
+
|
|
261
|
+
## Multi-Server Sync
|
|
262
|
+
|
|
263
|
+
For redundancy, you can configure multiple servers in `hmem.config.json` as an array.
|
|
264
|
+
hmem-sync will push to and pull from all configured servers, so data survives if one
|
|
265
|
+
server goes down. See the hmem-sync README for the exact schema.
|