hmem-mcp 7.0.5 → 7.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/README.md +1 -1
- package/dist/cli-stats.d.ts +9 -0
- package/dist/cli-stats.js +101 -0
- package/dist/cli-stats.js.map +1 -0
- package/dist/cli.js +5 -0
- package/dist/cli.js.map +1 -1
- package/dist/hmem-config.js +1 -1
- package/dist/hmem-config.js.map +1 -1
- package/dist/hmem-store.d.ts +11 -0
- package/dist/hmem-store.js +43 -2
- package/dist/hmem-store.js.map +1 -1
- package/dist/mcp-server.js +46 -36
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/hmem-activate/SKILL.md +9 -0
- package/skills/hmem-curate/SKILL.md +7 -0
- package/skills/hmem-dispatch/SKILL.md +8 -0
- package/skills/hmem-new-project/SKILL.md +22 -2
- package/skills/hmem-session-start/SKILL.md +22 -1
- package/skills/hmem-subagent/SKILL.md +20 -0
- package/skills/hmem-update/SKILL.md +59 -2
- package/skills/hmem-write/SKILL.md +18 -0
package/package.json
CHANGED
|
@@ -45,6 +45,15 @@ Move at the batch or session level (e.g. `O0043.3`), not exchange by exchange.
|
|
|
45
45
|
|
|
46
46
|
**If OLD_O has no today-exchanges, or all exchanges genuinely belong to OLD_PROJECT:** skip this step.
|
|
47
47
|
|
|
48
|
+
## STEP 3.5: Noise Check
|
|
49
|
+
|
|
50
|
+
Scan the load_project output:
|
|
51
|
+
- **>4k tokens** → invoke `hmem-curate` first
|
|
52
|
+
- **✓ DONE Roadmap items** → `update_memory(id, { irrelevant: true })`
|
|
53
|
+
- **Decommissioned / concept entries in Infrastructure** → `update_memory(id, { irrelevant: true })`
|
|
54
|
+
|
|
55
|
+
Fix immediately, do not defer.
|
|
56
|
+
|
|
48
57
|
## STEP 4: Confirm
|
|
49
58
|
|
|
50
59
|
Output:
|
|
@@ -39,6 +39,13 @@ Shows:
|
|
|
39
39
|
- **Stale favorites/pinned** — not accessed in >60 days (demote or verify)
|
|
40
40
|
- **Broken obsolete chains** — `[✓ID]` pointing to deleted entries
|
|
41
41
|
|
|
42
|
+
**Severity classification — prioritize fixes in this order:**
|
|
43
|
+
| Severity | Examples | Action |
|
|
44
|
+
|----------|----------|--------|
|
|
45
|
+
| **BLOCKER** | Broken links, broken obsolete chains | Fix before any other curation |
|
|
46
|
+
| **WARNING** | Orphaned stubs, stale favorites >90 days, P-entry token bloat | Fix in current session |
|
|
47
|
+
| **INFO** | Vague titles, duplicate candidates, minor tag cleanup | Fix if time allows |
|
|
48
|
+
|
|
42
49
|
Useful before starting:
|
|
43
50
|
```
|
|
44
51
|
memory_stats()
|
|
@@ -11,6 +11,7 @@ description: "Dispatch an isolated sub-agent for a specific task. Sub-agent rece
|
|
|
11
11
|
- **Searching** — "does a spec exist?", "find the plan for X", "search the codebase for Y", "check if skill Z covers this", "read the docs for W", "is there already a file that does X?" — any exploration or lookup task
|
|
12
12
|
- **Calculation or lookup** — deterministic, context-free
|
|
13
13
|
- **Writing an isolated section or document** — no conversation history needed
|
|
14
|
+
- **Writing or modifying code** — never write code directly in the main context. Pass the project ID and relevant node IDs (e.g. `.2 Codebase`) in the task so the sub-agent can sync them after completing the work.
|
|
14
15
|
|
|
15
16
|
**Never dispatch for tasks that require knowing the conversation context.**
|
|
16
17
|
|
|
@@ -22,6 +23,7 @@ Write out before dispatching:
|
|
|
22
23
|
- INPUT: exactly what the sub-agent needs — no more, no less
|
|
23
24
|
- TASK: what to do with the input
|
|
24
25
|
- OUTPUT FORMAT: what to return
|
|
26
|
+
- VERIFY (optional): a concrete shell command that proves completion (e.g. `npx tsc --noEmit`, `grep "pattern" file.ts`). Use for tasks that produce code or file changes.
|
|
25
27
|
|
|
26
28
|
## STEP 2: Dispatch
|
|
27
29
|
|
|
@@ -30,15 +32,21 @@ Send the sub-agent ONLY this prompt — no conversation history, no project cont
|
|
|
30
32
|
---
|
|
31
33
|
Task: <TASK>
|
|
32
34
|
Input: <INPUT>
|
|
35
|
+
[If VERIFY set:] After completing the task, run: <VERIFY_CMD>
|
|
33
36
|
Return your answer in exactly this format:
|
|
34
37
|
[RESULT]
|
|
35
38
|
<answer here>
|
|
36
39
|
[/RESULT]
|
|
40
|
+
[If VERIFY set:]
|
|
41
|
+
[VERIFY_RESULT]
|
|
42
|
+
pass | fail: <command output or error>
|
|
43
|
+
[/VERIFY_RESULT]
|
|
37
44
|
Max 200 words. Use the hmem-subagent skill.
|
|
38
45
|
---
|
|
39
46
|
|
|
40
47
|
## STEP 3: Inject result
|
|
41
48
|
|
|
42
49
|
Take ONLY the content between [RESULT] and [/RESULT].
|
|
50
|
+
If [VERIFY_RESULT] is present: check pass/fail. On fail, report the verification error instead of declaring the task complete.
|
|
43
51
|
Discard all sub-agent reasoning and preamble.
|
|
44
52
|
Use the result directly in the main conversation.
|
|
@@ -61,10 +61,30 @@ This creates:
|
|
|
61
61
|
|
|
62
62
|
## Step 4: Fill in details
|
|
63
63
|
|
|
64
|
-
If a codebase was scanned, append the findings:
|
|
64
|
+
If a codebase was scanned, append the findings. The Codebase node (`.2`) follows a strict schema:
|
|
65
|
+
|
|
66
|
+
### Codebase node structure
|
|
67
|
+
|
|
68
|
+
- **L3 — Pipeline** (first child): Data flow overview — `entry → moduleA → moduleB → storage`
|
|
69
|
+
- **L3 — Modules**: One node per source file. Title = filename, body = purpose + `src/file.ts`
|
|
70
|
+
- **L4 — Functions**: Under each module, one node per exported function/class. Title = full TypeScript signature, body = one-line description + `src/file.ts`
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
append_memory(id="P00XX.2", title="Pipeline", body="src/cli.ts → moduleA.ts → DB")
|
|
74
|
+
append_memory(id="P00XX.2", title="moduleA.ts", body="Core logic handler. src/moduleA.ts")
|
|
75
|
+
append_memory(id="P00XX.2.N", title="doThing(x: string): Promise<boolean>", body="Does the thing. src/moduleA.ts")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**L4 is critical.** Without function signatures, every agent must read source files for every task. Fill L4 for all exported functions when creating a new project — dispatch a subagent to extract them if the codebase is large.
|
|
79
|
+
|
|
80
|
+
- **L5 — Extended Notes** (optional, use selectively): Add under an L4 node only when it adds real value:
|
|
81
|
+
- Usage example: `write("P", { content: "Title\n\nBody", tags: ["#foo"] })`
|
|
82
|
+
- Important caveats: "triggers sync push", "returns null if not found — never throws"
|
|
83
|
+
- Parameter details: field list for complex option types like `ReadOptions`
|
|
84
|
+
|
|
85
|
+
Not every function needs L5 — only where the signature alone leaves agents guessing.
|
|
65
86
|
|
|
66
87
|
```
|
|
67
|
-
append_memory(id="P00XX.2", content="Entry point: src/index.ts\n\n...")
|
|
68
88
|
append_memory(id="P00XX.3", content="Installation: npm install\n\n...")
|
|
69
89
|
```
|
|
70
90
|
|
|
@@ -19,7 +19,28 @@ Replace P00XX with the actual project ID (e.g., P0048).
|
|
|
19
19
|
load_project returns the project brief, recent O-Entry summaries, rules, and lessons.
|
|
20
20
|
Do NOT call read_memory separately. load_project is the only activation action.
|
|
21
21
|
|
|
22
|
-
## STEP 2:
|
|
22
|
+
## STEP 2: Noise Check
|
|
23
|
+
|
|
24
|
+
**Do this immediately after load_project, before any other work.**
|
|
25
|
+
|
|
26
|
+
Scan the output for:
|
|
27
|
+
- **>4k tokens** → invoke `hmem-curate` on this project first, then continue
|
|
28
|
+
- **✓ DONE items in Roadmap** → `update_memory(id, { irrelevant: true })`
|
|
29
|
+
- **Decommissioned / concept entries in Infrastructure** → `update_memory(id, { irrelevant: true })`
|
|
30
|
+
- **Old status snapshots in Overview** (superseded by newer) → mark obsolete
|
|
31
|
+
|
|
32
|
+
Fix noise immediately. Do not note it and defer.
|
|
33
|
+
|
|
34
|
+
## STEP 3: Calibrate explanation depth
|
|
35
|
+
|
|
36
|
+
Read H0003 (IT Skills) — the scale is 1–9:
|
|
37
|
+
- **7–9 = Expert**: use technical language directly, no padding, no basics
|
|
38
|
+
- **4–6 = Proficient**: explain concepts but skip fundamentals
|
|
39
|
+
- **1–3 = Basics**: explain with examples
|
|
40
|
+
|
|
41
|
+
Apply this calibration for the entire session. When explaining something in a domain, check the matching H0003 skill first.
|
|
42
|
+
|
|
43
|
+
## STEP 4: O-Entry routing check
|
|
23
44
|
|
|
24
45
|
**This step is critical.** Every `load_project` call changes which O-entry receives session exchanges. If you called `load_project` on any project other than your working project — even briefly, even for administrative reasons (reconcile, curation, migration) — those exchanges were misrouted to the wrong O-entry.
|
|
25
46
|
|
|
@@ -22,3 +22,23 @@ You were dispatched for exactly one task. You have no conversation history. You
|
|
|
22
22
|
[/RESULT]
|
|
23
23
|
|
|
24
24
|
Nothing before [RESULT]. Nothing after [/RESULT].
|
|
25
|
+
|
|
26
|
+
## POST-TASK NODE SYNC
|
|
27
|
+
|
|
28
|
+
If your task changed the project state, update the relevant hmem node **before returning your result**.
|
|
29
|
+
|
|
30
|
+
The next agent reads the Codebase node before making changes — a stale node leads to wrong assumptions and costly mistakes. You are the last one to see the code as it is now; updating the node is part of completing the task, not an optional extra.
|
|
31
|
+
|
|
32
|
+
| What you did | Node to update | What to write |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Wrote or modified code | `.2 Codebase` | L4: function signature + one-line purpose + file path. L5 optional: usage example, caveats, complex param details |
|
|
35
|
+
| Fixed a bug | `.6 Bugs` → E-Entry | Mark `#solved`, one-line fix summary |
|
|
36
|
+
| Made a release | `.1 Overview` + `.5 Deployment` | New version, date |
|
|
37
|
+
| Added a dependency | `.15 Dependencies` | Package name + version |
|
|
38
|
+
| Made an architectural decision | `.4 Context` | Decision + rationale |
|
|
39
|
+
| Completed a roadmap milestone | `.8 Roadmap` | Mark DONE |
|
|
40
|
+
| Discovered a new requirement | `.16 Requirements` | Add to relevant sub-list |
|
|
41
|
+
|
|
42
|
+
**How to find the node ID:** The project ID (e.g. `P0048`) and relevant node IDs are in your task description. If only the project ID is given, the node ID is `<project-id>.<section-number>` — e.g. `P0048.2` for Codebase.
|
|
43
|
+
|
|
44
|
+
Use `append_memory` for additive changes (new entry in a list), `update_memory` to overwrite existing content.
|
|
@@ -320,6 +320,56 @@ settings.windows.example.json is now in the Bumblebiber/hmem repository. If you
|
|
|
320
320
|
|
|
321
321
|
---
|
|
322
322
|
|
|
323
|
+
## Step 2i: v7.1.0 — load_project Noise Reduction + Skill Improvements
|
|
324
|
+
|
|
325
|
+
**Only needed when upgrading from < v7.1.0**
|
|
326
|
+
|
|
327
|
+
### load_project: DONE-filter in schema mode
|
|
328
|
+
|
|
329
|
+
`load_project` now hides `✓ DONE` and `DONE`-prefixed items from **Roadmap** and **Next Steps** sections when using schema-driven rendering. Previously this filter only applied to legacy rendering mode (no schema). No config change needed — automatic.
|
|
330
|
+
|
|
331
|
+
### load_project: Project-specific R-entries only
|
|
332
|
+
|
|
333
|
+
Rules (`R`-prefix entries) are now only shown in `load_project` if the rule has an explicit link to the current project (`r.links.includes(projectId)`). Global rules without a project link are no longer injected. This eliminates ~1k token duplication for projects with many global rules. **Action:** If you have project-specific rules that should appear in `load_project`, ensure they have a `links` entry pointing to the project.
|
|
334
|
+
|
|
335
|
+
### Skill improvements
|
|
336
|
+
|
|
337
|
+
- **hmem-dispatch**: New optional `VERIFY` field — specify a shell command the sub-agent must run and return as `[VERIFY_RESULT]`. Use for code-change tasks to close the feedback loop.
|
|
338
|
+
- **hmem-curate**: Health check findings now classified as BLOCKER / WARNING / INFO for structured triage.
|
|
339
|
+
- **hmem-write**: New "After Writing" verification step — for complex L/D/E entries, read back the written entry and verify it captures "why?", not just "what?".
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Step 2j: v7.2.0 — Codebase Node Schema + checkpointPolicy Fix
|
|
344
|
+
|
|
345
|
+
**Only needed when upgrading from < v7.2.0**
|
|
346
|
+
|
|
347
|
+
### checkpointPolicy: readonly now correctly scoped
|
|
348
|
+
|
|
349
|
+
`readonly` on a schema section previously blocked ALL `append_memory` calls under that section (including adding L3 modules or L4 function signatures). This was a bug — the intent was only to prevent adding new L2 sections to a project root.
|
|
350
|
+
|
|
351
|
+
**New behavior:**
|
|
352
|
+
- `append_memory(id="P0048")` → blocked if schema has readonly sections (prevents new L2 sections) ✓
|
|
353
|
+
- `append_memory(id="P0048.2")` → allowed (add module to Codebase) ✓
|
|
354
|
+
- `append_memory(id="P0048.2.N")` → allowed (add function signature) ✓
|
|
355
|
+
- `pointer` policy still enforced at all depths ✓
|
|
356
|
+
|
|
357
|
+
**Action:** Change `"checkpointPolicy": "readonly"` on the **Codebase** section in your `hmem.config.json` to `"checkpointPolicy": "append"` — the section is now freely appendable by agents.
|
|
358
|
+
|
|
359
|
+
### Codebase node schema standardized
|
|
360
|
+
|
|
361
|
+
The `.2 Codebase` section now has a standard 4-level structure:
|
|
362
|
+
- **L3 — Pipeline** (auto-created via `defaultChildren`): data flow overview
|
|
363
|
+
- **L3.N — Module**: title = filename, body = purpose + `src/file.ts`
|
|
364
|
+
- **L4 — Function** (mandatory): title = full TS signature, body = description + `src/file.ts`
|
|
365
|
+
- **L5 — Extended Notes** (optional): usage example, caveats, complex param details
|
|
366
|
+
|
|
367
|
+
Agents update L4 after every code change (enforced via `hmem-subagent` POST-TASK NODE SYNC).
|
|
368
|
+
|
|
369
|
+
**Action:** Run `load_project` on each active project — the Pipeline sub-node is auto-created via `defaultChildren` reconcile if missing.
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
323
373
|
## Step 3: Entry Migration
|
|
324
374
|
|
|
325
375
|
Some versions introduce new data formats. Check if migration is needed:
|
|
@@ -360,7 +410,7 @@ All P-entries (projects) must follow the standard 16-section L2 structure define
|
|
|
360
410
|
|
|
361
411
|
```
|
|
362
412
|
.1 Overview (readonly)
|
|
363
|
-
.2 Codebase (
|
|
413
|
+
.2 Codebase (append — L3 modules + L4 signatures freely appendable by agents)
|
|
364
414
|
.3 Dependencies (readonly)
|
|
365
415
|
.4 Usage (readonly)
|
|
366
416
|
.5 Requirements (readonly)
|
|
@@ -382,6 +432,13 @@ All P-entries (projects) must follow the standard 16-section L2 structure define
|
|
|
382
432
|
- `pointer` — Haiku may only add nodes that reference an entry ID (e.g. `[E0124]`)
|
|
383
433
|
- `append` — Haiku may freely add sub-nodes
|
|
384
434
|
|
|
435
|
+
**Codebase node structure (`.2`):**
|
|
436
|
+
- L3 first child = **Pipeline** (data flow overview)
|
|
437
|
+
- L3.N = **Module** (title: filename, body: purpose + `src/file.ts`)
|
|
438
|
+
- L4 = **Function** (title: full TS signature, body: one-line description + `src/file.ts`)
|
|
439
|
+
|
|
440
|
+
Agents update `.2` after every code change (POST-TASK NODE SYNC in hmem-subagent skill).
|
|
441
|
+
|
|
385
442
|
For each active P-entry:
|
|
386
443
|
1. `read_memory(id="P00XX", depth=2)` — check L2 structure
|
|
387
444
|
2. Run `load_project(id="P00XX")` — auto-reconcile adds any missing sections
|
|
@@ -412,7 +469,7 @@ In `memory.schemas.P.sections`, make these changes:
|
|
|
412
469
|
Full recommended policies (add to each section):
|
|
413
470
|
```json
|
|
414
471
|
{ "name": "Overview", "checkpointPolicy": "readonly" },
|
|
415
|
-
{ "name": "Codebase", "checkpointPolicy": "
|
|
472
|
+
{ "name": "Codebase", "checkpointPolicy": "append" },
|
|
416
473
|
{ "name": "Dependencies", "checkpointPolicy": "readonly" },
|
|
417
474
|
{ "name": "Usage", "checkpointPolicy": "readonly" },
|
|
418
475
|
{ "name": "Requirements", "checkpointPolicy": "readonly" },
|
|
@@ -590,6 +590,24 @@ Create new H-entries as topics emerge naturally from conversation.
|
|
|
590
590
|
|
|
591
591
|
Match the language of existing entries. Before writing, check what language the memory store uses (run `read_memory()` if unsure). If existing entries are in German, write in German. If English, write in English. Do not mix languages within a single store — it makes search and curation harder.
|
|
592
592
|
|
|
593
|
+
## After Writing: Verify the Entry Captured the Insight
|
|
594
|
+
|
|
595
|
+
For L, D, and E entries with complex reasoning, do a quick read-back:
|
|
596
|
+
```
|
|
597
|
+
read_memory(id="X")
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
Ask: does this entry answer **"why?"** not just "what?"
|
|
601
|
+
|
|
602
|
+
Update if any of these are true:
|
|
603
|
+
- Entry is under 20 words with no body
|
|
604
|
+
- Content is "Lesson learned: X" with no explanation or evidence
|
|
605
|
+
- Entry would be incomprehensible to a future agent without this conversation context
|
|
606
|
+
|
|
607
|
+
Skip for: simple factual entries, routine appends, O-entry checkpoints.
|
|
608
|
+
|
|
609
|
+
---
|
|
610
|
+
|
|
593
611
|
## Anti-Patterns
|
|
594
612
|
|
|
595
613
|
| Wrong | Right |
|