hmem-mcp 1.1.1 → 1.2.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/dist/cli-init.js +6 -18
- package/dist/cli-init.js.map +1 -1
- package/package.json +1 -1
- package/skills/hmem-config/SKILL.md +79 -0
- package/skills/save/SKILL.md +40 -2
package/dist/cli-init.js
CHANGED
|
@@ -8,7 +8,10 @@ import fs from "node:fs";
|
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import os from "node:os";
|
|
10
10
|
import readline from "node:readline";
|
|
11
|
-
|
|
11
|
+
// In WSL, os.homedir() may return the Windows path — prefer the Linux home directory
|
|
12
|
+
const HOME = (process.env.WSL_DISTRO_NAME || process.env.WSLENV)
|
|
13
|
+
? (process.env.HOME ?? os.homedir())
|
|
14
|
+
: os.homedir();
|
|
12
15
|
const TOOLS = {
|
|
13
16
|
"claude-code": {
|
|
14
17
|
name: "Claude Code",
|
|
@@ -217,7 +220,7 @@ export async function runInit() {
|
|
|
217
220
|
const selectedTools = selectedIndices.map(i => allToolIds[i]);
|
|
218
221
|
// Step 4: Memory directory
|
|
219
222
|
const defaultDir = isGlobal ? path.join(HOME, ".hmem") : process.cwd();
|
|
220
|
-
const memDirAnswer = await ask(`\nMemory directory [${defaultDir}]: `);
|
|
223
|
+
const memDirAnswer = await ask(`\nMemory directory (press Enter to use default):\n [${defaultDir}]: `);
|
|
221
224
|
const memDir = memDirAnswer || defaultDir;
|
|
222
225
|
const absMemDir = path.resolve(memDir);
|
|
223
226
|
// Create memory directory if it doesn't exist
|
|
@@ -225,9 +228,7 @@ export async function runInit() {
|
|
|
225
228
|
fs.mkdirSync(absMemDir, { recursive: true });
|
|
226
229
|
console.log(` Created: ${absMemDir}`);
|
|
227
230
|
}
|
|
228
|
-
// Step 5:
|
|
229
|
-
const agentId = await ask(`Agent ID (optional, press Enter to skip): `);
|
|
230
|
-
// Step 6: Write configs
|
|
231
|
+
// Step 5: Write configs
|
|
231
232
|
console.log("\n Writing configuration...\n");
|
|
232
233
|
for (const toolId of selectedTools) {
|
|
233
234
|
const tool = TOOLS[toolId];
|
|
@@ -246,17 +247,6 @@ export async function runInit() {
|
|
|
246
247
|
const entry = tool.format === "opencode"
|
|
247
248
|
? opencodeMcpEntry(envProjectDir)
|
|
248
249
|
: standardMcpEntry(envProjectDir);
|
|
249
|
-
// Add agent ID if provided
|
|
250
|
-
if (agentId) {
|
|
251
|
-
if (tool.format === "opencode") {
|
|
252
|
-
const mcp = entry.mcp;
|
|
253
|
-
mcp.hmem.environment.HMEM_AGENT_ID = agentId;
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
const servers = entry.mcpServers;
|
|
257
|
-
servers.hmem.env.HMEM_AGENT_ID = agentId;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
250
|
// Read existing config (if any) and merge
|
|
261
251
|
let existing = {};
|
|
262
252
|
if (fs.existsSync(configPath)) {
|
|
@@ -289,8 +279,6 @@ export async function runInit() {
|
|
|
289
279
|
}
|
|
290
280
|
console.log(`\n Done! Restart your AI tool(s) to activate hmem.\n`);
|
|
291
281
|
console.log(` Memory directory: ${absMemDir}`);
|
|
292
|
-
if (agentId)
|
|
293
|
-
console.log(` Agent ID: ${agentId}`);
|
|
294
282
|
console.log(`\n Test: Open your AI tool and call read_memory() — it should respond.\n`);
|
|
295
283
|
}
|
|
296
284
|
finally {
|
package/dist/cli-init.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-init.js","sourceRoot":"","sources":["../src/cli-init.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,QAAQ,MAAM,eAAe,CAAC;AAcrC,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;
|
|
1
|
+
{"version":3,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,CAAC,GAAG,CAAC,uBAAuB,SAAS,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;IAE3F,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hmem-config
|
|
3
|
+
description: >
|
|
4
|
+
View and change hmem settings. Use when the user types /hmem-config or asks
|
|
5
|
+
to change memory settings, adjust parameters, or configure hmem.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# hmem-config — View and Change Settings
|
|
9
|
+
|
|
10
|
+
## Step 1 — Find the config file
|
|
11
|
+
|
|
12
|
+
The config file is `hmem.config.json` in the `HMEM_PROJECT_DIR` directory.
|
|
13
|
+
|
|
14
|
+
Find it:
|
|
15
|
+
```bash
|
|
16
|
+
# Check the MCP environment variable first
|
|
17
|
+
echo $HMEM_PROJECT_DIR
|
|
18
|
+
|
|
19
|
+
# Common locations:
|
|
20
|
+
# Global: ~/.hmem/hmem.config.json
|
|
21
|
+
# Project: ./hmem.config.json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
If the file does not exist, offer to create it with defaults (see Step 3).
|
|
25
|
+
|
|
26
|
+
## Step 2 — Read and display current settings
|
|
27
|
+
|
|
28
|
+
Read the file and show the user a clear table of current values vs. defaults:
|
|
29
|
+
|
|
30
|
+
| Parameter | Current value | Default | What it does |
|
|
31
|
+
|-----------|--------------|---------|--------------|
|
|
32
|
+
| `maxL1Chars` | … | 120 | Max characters for Level 1 summaries (the one-liner shown at session start). Keep short — this is what the agent always sees. |
|
|
33
|
+
| `maxLnChars` | … | 50000 | Max characters for deeper levels (L2–L5). Controls how much detail you can store per node. |
|
|
34
|
+
| `maxDepth` | … | 5 | How many nesting levels are available (1–5). 5 is the maximum. |
|
|
35
|
+
| `defaultReadLimit` | … | 100 | Max entries returned by a single `read_memory()` call. |
|
|
36
|
+
| `recentDepthTiers` | … | [{count:10,depth:2},{count:3,depth:3}] | How much detail is auto-inlined for the most recent entries. See explanation below. |
|
|
37
|
+
| `prefixes` | … | P,L,T,E,D,M,S,F | Category labels for memory entries. Custom prefixes are merged with defaults. |
|
|
38
|
+
|
|
39
|
+
### recentDepthTiers explained
|
|
40
|
+
|
|
41
|
+
This controls how much detail is automatically shown for recent entries in a default `read_memory()` call — without you having to drill in manually.
|
|
42
|
+
|
|
43
|
+
Example: `[{count: 10, depth: 2}, {count: 3, depth: 3}]`
|
|
44
|
+
- The **3 most recent** entries: shown with L1 + L2 + L3 detail
|
|
45
|
+
- The **next 7** (positions 3–9): shown with L1 + L2 detail
|
|
46
|
+
- Everything older: L1 summary only
|
|
47
|
+
|
|
48
|
+
Think of it like human memory — yesterday in full detail, last week in outline, older in headlines.
|
|
49
|
+
|
|
50
|
+
Set to `[]` to disable (L1 only for everything).
|
|
51
|
+
|
|
52
|
+
## Step 3 — Ask the user what to change
|
|
53
|
+
|
|
54
|
+
Ask the user which parameter(s) they want to adjust. For each one:
|
|
55
|
+
|
|
56
|
+
1. Explain the tradeoff (e.g. higher `maxL1Chars` = more context at startup but wastes tokens)
|
|
57
|
+
2. Show the current value and the recommended range
|
|
58
|
+
3. Ask for the new value
|
|
59
|
+
4. Validate the input (numbers must be positive integers, tiers must be valid JSON)
|
|
60
|
+
|
|
61
|
+
**Recommended ranges:**
|
|
62
|
+
|
|
63
|
+
| Parameter | Min | Max | Notes |
|
|
64
|
+
|-----------|-----|-----|-------|
|
|
65
|
+
| `maxL1Chars` | 60 | 200 | Below 60: too terse. Above 200: wastes token budget at every spawn. |
|
|
66
|
+
| `maxLnChars` | 1000 | 100000 | Higher = more detail possible, but rarely read. |
|
|
67
|
+
| `maxDepth` | 2 | 5 | 3 is enough for most users. 5 for complex multi-agent setups. |
|
|
68
|
+
| `defaultReadLimit` | 20 | 500 | Lower if startup feels slow. Higher if you have many entries. |
|
|
69
|
+
|
|
70
|
+
**For custom prefixes:** Ask for a single letter + label (e.g. `R = Research`). Remind the user that custom prefixes are added on top of the defaults — they don't replace them.
|
|
71
|
+
|
|
72
|
+
## Step 4 — Write the updated config
|
|
73
|
+
|
|
74
|
+
Write the updated `hmem.config.json`. Only include keys that differ from defaults — keep the file clean.
|
|
75
|
+
|
|
76
|
+
Then tell the user:
|
|
77
|
+
- Which values were changed
|
|
78
|
+
- That the change takes effect **immediately** — no restart needed
|
|
79
|
+
- That `maxL1Chars` and `maxLnChars` only affect new entries written after the change (existing entries are not reformatted)
|
package/skills/save/SKILL.md
CHANGED
|
@@ -11,12 +11,50 @@ description: >
|
|
|
11
11
|
|
|
12
12
|
Execute these steps in order. Report results after all complete.
|
|
13
13
|
|
|
14
|
+
## Step 0 — First-time setup check
|
|
15
|
+
|
|
16
|
+
Before saving, verify that hmem is ready.
|
|
17
|
+
|
|
18
|
+
**Check 1: Is write_memory available?**
|
|
19
|
+
|
|
20
|
+
Try calling `write_memory` (or check if the tool exists in your tool list).
|
|
21
|
+
|
|
22
|
+
If `write_memory` is NOT available:
|
|
23
|
+
- Tell the user: "The hmem MCP server is not connected. Run `npx hmem-mcp init` in your terminal to set it up, then restart your AI tool."
|
|
24
|
+
- **STOP. Do not continue.**
|
|
25
|
+
|
|
26
|
+
**Check 2: Does a memory file exist?**
|
|
27
|
+
|
|
28
|
+
Call `read_memory()`. If it returns entries → memory exists, skip to Step 1.
|
|
29
|
+
|
|
30
|
+
If `read_memory()` returns an **empty memory** (no entries at all) for the first time, this is likely a fresh setup. Ask the user:
|
|
31
|
+
|
|
32
|
+
> "No memory found yet. Where should hmem store your memories?
|
|
33
|
+
> 1) Global — works in any directory (`~/.hmem/`)
|
|
34
|
+
> 2) Project-local — only in this directory (current folder)
|
|
35
|
+
>
|
|
36
|
+
> Recommendation: Global for personal assistants. Project-local for team projects."
|
|
37
|
+
|
|
38
|
+
After the user chooses, walk them through the config setup:
|
|
39
|
+
|
|
40
|
+
> "Let me set up your `hmem.config.json`. I'll explain each setting — press Enter to accept the recommendation or type a new value."
|
|
41
|
+
|
|
42
|
+
Go through these parameters one by one:
|
|
43
|
+
|
|
44
|
+
| Parameter | Recommendation | Question to ask |
|
|
45
|
+
|-----------|---------------|-----------------|
|
|
46
|
+
| `maxL1Chars` | 120 | "How long should memory summaries be? (60–200 characters — shorter loads faster at startup)" |
|
|
47
|
+
| `maxDepth` | 5 | "How many detail levels do you want? (2–5 — 5 gives the most flexibility)" |
|
|
48
|
+
| `recentDepthTiers` | [{count:10,depth:2},{count:3,depth:3}] | "Auto-expand recent entries? This shows extra detail for your newest memories without extra tool calls. Recommended: yes" |
|
|
49
|
+
| `prefixes` | default | "Do you want custom memory categories beyond the defaults (P/L/E/D/M/S/F/T)? If yes, name them (e.g. R=Research, B=Bookmark). Otherwise press Enter." |
|
|
50
|
+
|
|
51
|
+
Write the resulting `hmem.config.json` to the chosen directory.
|
|
52
|
+
Tell the user: "Config saved to `<path>/hmem.config.json`. You can adjust settings anytime with `/hmem-config`."
|
|
53
|
+
|
|
14
54
|
## Step 1 — Write Memory
|
|
15
55
|
|
|
16
56
|
**IMPORTANT:** You MUST use the `write_memory` MCP tool. NEVER write directly to `.hmem` files via sqlite3 or shell commands — this bypasses WAL journaling, integrity checks, and tree logic, causing corruption or data loss.
|
|
17
57
|
|
|
18
|
-
If `write_memory` is not available, **STOP and tell the user** to reconnect the MCP server first (Claude Code: `/mcp` → reconnect; other tools: restart the tool). Do NOT proceed without a working MCP connection.
|
|
19
|
-
|
|
20
58
|
Your L1 memory summaries are already in your context (injected at session start).
|
|
21
59
|
**Check them first** — do not re-write anything that already exists.
|
|
22
60
|
|