hmem-mcp 4.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 -205
- package/dist/cli-checkpoint.d.ts +16 -0
- package/dist/cli-checkpoint.js +233 -0
- package/dist/cli-checkpoint.js.map +1 -0
- package/dist/cli-context-inject.d.ts +19 -0
- package/dist/cli-context-inject.js +77 -0
- package/dist/cli-context-inject.js.map +1 -0
- 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 +148 -10
- package/dist/cli-init.js.map +1 -1
- package/dist/cli-log-exchange.js +87 -23
- 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 +30 -2
- package/dist/cli.js.map +1 -1
- package/dist/hmem-config.d.ts +31 -0
- package/dist/hmem-config.js +76 -12
- package/dist/hmem-config.js.map +1 -1
- package/dist/hmem-store.d.ts +62 -1
- package/dist/hmem-store.js +364 -46
- package/dist/hmem-store.js.map +1 -1
- package/dist/mcp-server.js +405 -99
- package/dist/mcp-server.js.map +1 -1
- package/dist/session-cache.d.ts +11 -0
- package/dist/session-cache.js +25 -0
- package/dist/session-cache.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 +75 -0
- package/skills/hmem-write/SKILL.md +113 -61
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hmem-update
|
|
3
|
+
description: >
|
|
4
|
+
Post-update checklist for hmem-mcp and hmem-sync. Run after npm update or when
|
|
5
|
+
hmem detects a version change. Covers skill sync, entry migration, schema enforcement,
|
|
6
|
+
O-entry curation, and smoke tests. Use when the user says "update hmem", "hmem updaten",
|
|
7
|
+
or when the startup version-check detects a new version.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /hmem-update — Post-Update Checklist
|
|
11
|
+
|
|
12
|
+
Run this after updating hmem-mcp or hmem-sync. Every step is important — do not skip steps.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Step 1: Version Check
|
|
17
|
+
|
|
18
|
+
Determine what changed:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
hmem --version # current installed version
|
|
22
|
+
npm view hmem-mcp version # latest on npm
|
|
23
|
+
npm view hmem-mcp versions --json # all versions
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Read the changelog for the version range:
|
|
27
|
+
```bash
|
|
28
|
+
cd ~/projects/hmem && git log --oneline <old-tag>..HEAD # if local repo exists
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Or check GitHub releases: `gh release list -R Bumblebiber/hmem --limit 5`
|
|
32
|
+
|
|
33
|
+
**If already on latest:** Tell the user and skip to Step 7 (smoke test).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 2: Update Skills
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
hmem update-skills
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This syncs all skill files from the npm package to the local skills directory. Verify:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ls ~/.claude/skills/hmem-*/SKILL.md # Claude Code
|
|
47
|
+
ls ~/.config/gemini/skills/hmem-*/ # Gemini CLI (if applicable)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Check for new skills that weren't there before — inform the user about new capabilities.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Step 2b: Verify Hooks
|
|
55
|
+
|
|
56
|
+
Hooks are critical — without them, O-entries are never logged and auto-checkpoints never fire.
|
|
57
|
+
|
|
58
|
+
Check the current hook configuration:
|
|
59
|
+
```bash
|
|
60
|
+
cat ~/.claude/settings.json | grep -A5 hooks
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Required hooks (for `checkpointMode: "auto"`):**
|
|
64
|
+
- **UserPromptSubmit** — memory load + checkpoint reminder
|
|
65
|
+
- **Stop** — exchange logging (`hmem log-exchange`) + O-entry title generation
|
|
66
|
+
- **SessionStart[clear]** — context re-injection after `/clear`
|
|
67
|
+
|
|
68
|
+
**If hooks are missing or empty (`hooks: {}`):**
|
|
69
|
+
1. Inform the user: "Hooks are not configured — O-entries won't be logged and auto-checkpoints won't fire."
|
|
70
|
+
2. Suggest: "Run `/hmem-config` to set up hooks, or run `hmem init` to re-initialize."
|
|
71
|
+
|
|
72
|
+
**If hooks exist but reference old paths or scripts:**
|
|
73
|
+
- Check that hook scripts exist and are executable
|
|
74
|
+
- Verify they reference the current hmem installation path
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Step 2c: Check load_project Display Config
|
|
79
|
+
|
|
80
|
+
Since v5.1.8, `load_project` supports configurable section expansion:
|
|
81
|
+
- `loadProjectExpand.withBody`: sections showing L3 title + body (default: `[1]` = Overview)
|
|
82
|
+
- `loadProjectExpand.withChildren`: sections listing all L3 children as titles (default: `[6, 8]` = Bugs, Open Tasks)
|
|
83
|
+
|
|
84
|
+
Check if the user has customized this in `hmem.config.json`. If not, inform them about the option:
|
|
85
|
+
```json
|
|
86
|
+
{ "memory": { "loadProjectExpand": { "withBody": [1], "withChildren": [6, 8] } } }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Step 3: Entry Migration
|
|
92
|
+
|
|
93
|
+
Some versions introduce new data formats. Check if migration is needed:
|
|
94
|
+
|
|
95
|
+
**v5.1.0+ Title/Body Separation:**
|
|
96
|
+
- Entries now support `>` body lines (title shown in listings, body on drill-down)
|
|
97
|
+
- Check if old entries need title/body split:
|
|
98
|
+
```
|
|
99
|
+
read_memory(titles_only=true)
|
|
100
|
+
```
|
|
101
|
+
- Look for entries where the title is truncated mid-word or contains too much detail
|
|
102
|
+
- Fix with: `update_memory(id="L0042", content="Clear title\n> Detailed body text")`
|
|
103
|
+
|
|
104
|
+
**v5.1.2+ Checkpoint Summaries:**
|
|
105
|
+
- O-entries with >10 exchanges should have `[CP]` checkpoint summaries
|
|
106
|
+
- Check recent O-entries: `read_memory(prefix="O")`
|
|
107
|
+
- If summaries are missing, write them:
|
|
108
|
+
```
|
|
109
|
+
append_memory(id="O00XX", content="\t[CP] Factual 3-8 sentence summary of the session")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**v5.1.2+ Skill-Dialog Tags:**
|
|
113
|
+
- Exchanges containing skill activations should be tagged `#skill-dialog`
|
|
114
|
+
- These are auto-tagged by the checkpoint process going forward
|
|
115
|
+
- For old exchanges: the checkpoint auto-tagger picks them up on the next run
|
|
116
|
+
|
|
117
|
+
**General migration pattern:**
|
|
118
|
+
1. Read a sample of entries to assess the current state
|
|
119
|
+
2. Identify entries that don't match the new format
|
|
120
|
+
3. Fix in batches — don't try to fix everything at once
|
|
121
|
+
4. Prioritize: favorites and pinned entries first, then high-access, then the rest
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Step 4: P-Entry Schema Enforcement (R0009)
|
|
126
|
+
|
|
127
|
+
All P-entries (projects) must follow the standard L2 structure:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
.1 Overview
|
|
131
|
+
.2 Codebase
|
|
132
|
+
.3 Usage
|
|
133
|
+
.4 Context
|
|
134
|
+
.5 Deployment
|
|
135
|
+
.6 Bugs
|
|
136
|
+
.7 Protocol
|
|
137
|
+
.8 Open tasks
|
|
138
|
+
.9 Ideas
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
For each active P-entry:
|
|
142
|
+
1. `read_memory(id="P00XX", depth=2)` — check L2 structure
|
|
143
|
+
2. Compare against the schema above
|
|
144
|
+
3. Add missing sections: `append_memory(id="P00XX", content="\tOverview\n\t\tCurrent state: ...")`
|
|
145
|
+
4. L1 body should be: `Name | Status | Stack | Description`
|
|
146
|
+
|
|
147
|
+
**Do not restructure entries that already follow the schema.** Only fix what's missing or wrong.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 5: O-Entry Curation
|
|
152
|
+
|
|
153
|
+
Check recent O-entries for quality:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
read_memory(prefix="O")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Titles:**
|
|
160
|
+
- Replace "unassigned" or generic titles (e.g., "hmem-mcp") with descriptive ones
|
|
161
|
+
- Good: "Title/Body Separation design + v5.1.0 release"
|
|
162
|
+
- Fix: `update_memory(id="O00XX", content="Descriptive session title")`
|
|
163
|
+
|
|
164
|
+
**Tags:**
|
|
165
|
+
- Every O-entry should have at least `#session`
|
|
166
|
+
- Add topic tags where obvious: `#release`, `#bugfix`, `#refactor`, `#brainstorming`
|
|
167
|
+
- Fix: `update_memory(id="O00XX", tags=["#session", "#release"])`
|
|
168
|
+
|
|
169
|
+
**Checkpoint Summaries:**
|
|
170
|
+
- O-entries with >10 exchanges and no `[CP]` summary need one
|
|
171
|
+
- Write summary: `append_memory(id="O00XX", content="\t[CP] Summary...")`
|
|
172
|
+
- The auto-tagger will tag it `#checkpoint-summary` on the next checkpoint run
|
|
173
|
+
|
|
174
|
+
**Cleanup:**
|
|
175
|
+
- Look for duplicate O-entries (same title, same date, 1-2 exchanges) — these are likely subagent artifacts
|
|
176
|
+
- Mark as irrelevant or delete if clearly junk
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Step 6: hmem-sync Update (if installed)
|
|
181
|
+
|
|
182
|
+
Check if hmem-sync is installed and needs updating:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
which hmem-sync && hmem-sync --version # check if installed
|
|
186
|
+
npm view hmem-sync version # latest on npm
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
If outdated:
|
|
190
|
+
```bash
|
|
191
|
+
npm update -g hmem-sync
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Verify sync still works:
|
|
195
|
+
```bash
|
|
196
|
+
hmem-sync status # check connection to sync server
|
|
197
|
+
hmem-sync push # test push
|
|
198
|
+
hmem-sync pull # test pull
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
**If hmem-sync is not installed:** Skip this step. Mention to the user that hmem-sync is available for cross-device sync.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Step 7: Smoke Test
|
|
206
|
+
|
|
207
|
+
Verify everything works after the update:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
read_memory() # bulk read works
|
|
211
|
+
read_memory(id="P00XX") # drill-down works
|
|
212
|
+
load_project(id="P00XX") # project loading works
|
|
213
|
+
write_memory(prefix="T", content="Update smoke test — delete me", tags=["#test"])
|
|
214
|
+
# write works → note the ID
|
|
215
|
+
update_memory(id="T00XX", content="Update smoke test — verified", irrelevant=true)
|
|
216
|
+
# update works + mark for cleanup
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
If any step fails: report the error to the user. Do not proceed with normal work until the issue is resolved.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Step 8: Report
|
|
224
|
+
|
|
225
|
+
Tell the user what was done:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
hmem-mcp updated: v5.1.2 → v5.1.4
|
|
229
|
+
|
|
230
|
+
Changes applied:
|
|
231
|
+
- Skills synced (2 new, 3 updated)
|
|
232
|
+
- 5 P-entries checked against R0009 schema (2 fixed)
|
|
233
|
+
- 12 O-entries curated (4 titles fixed, 3 summaries added)
|
|
234
|
+
- Smoke test passed
|
|
235
|
+
|
|
236
|
+
New features in this version:
|
|
237
|
+
- Rolling checkpoint summaries
|
|
238
|
+
- Skill-dialog exchange filtering
|
|
239
|
+
- hmem --version reads from package.json
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Auto-Detection (for hook integration)
|
|
245
|
+
|
|
246
|
+
This skill can be triggered automatically. At session startup, if the hmem MCP server detects that the installed version differs from the last-seen version stored in the config, it appends a notice to the first `read_memory()` response:
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
⚠ hmem-mcp updated: v5.1.2 → v5.1.4. Run /hmem-update to apply post-update steps.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The agent should then invoke this skill automatically or ask the user if they want to run it.
|
|
253
|
+
|
|
254
|
+
**Last-seen version** is stored in `hmem.config.json` under `lastSeenVersion`. Updated automatically after a successful `/hmem-update` run.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hmem-wipe
|
|
3
|
+
description: >
|
|
4
|
+
Prepare for /clear by optionally saving high-value knowledge. Use when:
|
|
5
|
+
- User types /wipe
|
|
6
|
+
- Context threshold warning appears (100k tokens)
|
|
7
|
+
- User says "context aufräumen", "clear machen", "wipe"
|
|
8
|
+
Handles pre-clear cleanup, then instructs user to /clear for automatic context restoration.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Wipe — Prepare & Clear Context
|
|
12
|
+
|
|
13
|
+
Follow these steps in order.
|
|
14
|
+
|
|
15
|
+
## Step 1: Optionally save high-value knowledge
|
|
16
|
+
|
|
17
|
+
Check `checkpointMode` in hmem.config.json to decide what to do:
|
|
18
|
+
|
|
19
|
+
### checkpointMode: "auto"
|
|
20
|
+
|
|
21
|
+
The Haiku subagent already extracts L/D/E entries every 20 exchanges automatically.
|
|
22
|
+
Skip manual writes unless you have **specific high-value knowledge** that:
|
|
23
|
+
- Was discovered in the last few exchanges (too recent for the last auto-checkpoint)
|
|
24
|
+
- Is critical enough that losing it would cost significant rework
|
|
25
|
+
- Is NOT already covered by a recent auto-checkpoint
|
|
26
|
+
|
|
27
|
+
If nothing qualifies, proceed directly to Step 2.
|
|
28
|
+
|
|
29
|
+
### checkpointMode: "remind"
|
|
30
|
+
|
|
31
|
+
Manually save unsaved insights from this project context:
|
|
32
|
+
- New lessons learned: `write_memory(prefix="L", ...)`
|
|
33
|
+
- Project progress: `append_memory(id="P00XX.7", ...)` (Protocol node)
|
|
34
|
+
- Decisions made: `write_memory(prefix="D", ...)`
|
|
35
|
+
- Errors encountered: `write_memory(prefix="E", ...)`
|
|
36
|
+
|
|
37
|
+
Skip if the last checkpoint was fewer than 5 messages ago.
|
|
38
|
+
|
|
39
|
+
### Why gate on checkpointMode?
|
|
40
|
+
|
|
41
|
+
Redundant writes waste tokens and create duplicates that clutter memory.
|
|
42
|
+
Auto-checkpoints already call `read_memory` to deduplicate before writing —
|
|
43
|
+
manual writes during wipe bypass that check and risk creating noise.
|
|
44
|
+
|
|
45
|
+
## Step 2: Tell the user to /clear
|
|
46
|
+
|
|
47
|
+
O-entries are auto-logged by the Stop hook — every exchange is already saved
|
|
48
|
+
to the active project's O-entry. No need to manually create O-entries or call
|
|
49
|
+
`flush_context` for conversation history.
|
|
50
|
+
|
|
51
|
+
Reply with exactly:
|
|
52
|
+
|
|
53
|
+
> Context ready for clear. Type `/clear` — the SessionStart hook will automatically restore your project context.
|
|
54
|
+
|
|
55
|
+
Do NOT attempt to run /clear yourself — it is a built-in CLI command only the user can execute.
|
|
56
|
+
|
|
57
|
+
## What happens after /clear
|
|
58
|
+
|
|
59
|
+
The `SessionStart[clear]` hook automatically:
|
|
60
|
+
1. Resets the MCP session cache
|
|
61
|
+
2. Injects recent conversation exchanges from the project's O-entry transcript
|
|
62
|
+
3. Injects the active project briefing (overview expanded)
|
|
63
|
+
4. Injects recent O-entry titles + rules
|
|
64
|
+
|
|
65
|
+
The agent then calls `load_project` and has full context to continue working.
|
|
66
|
+
No manual restoration needed.
|
|
67
|
+
|
|
68
|
+
## Why this flow works
|
|
69
|
+
|
|
70
|
+
- **O-entries are covered.** The Stop hook logs every exchange to the active
|
|
71
|
+
project's O-entry. Wipe does not need to handle conversation history.
|
|
72
|
+
- **Checkpoints are covered (auto mode).** The Haiku subagent extracts knowledge
|
|
73
|
+
every 20 exchanges. Wipe only needs to catch the tail end, if anything.
|
|
74
|
+
- **Context restoration is covered.** The SessionStart[clear] hook handles
|
|
75
|
+
re-injection automatically. The agent just needs the user to type /clear.
|
|
@@ -19,13 +19,30 @@ If the tool `write_memory` is not available:
|
|
|
19
19
|
```
|
|
20
20
|
write_memory(
|
|
21
21
|
prefix: "E",
|
|
22
|
-
content: "Short Title (~50 chars)\
|
|
22
|
+
content: "Short Title (~50 chars)\n> L1 body — detailed explanation, can span multiple lines\n> second body line with more context\n\tL2 node title\n\t> L2 body text (supports newlines)\n\t> more L2 body\n\t\tL3 detail (2 tabs)\n\t\t\tL4 raw data (3 tabs — rarely needed)"
|
|
23
23
|
)
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
**Title convention:**
|
|
26
|
+
**Title + Body convention:** Every node has a **title** (short navigation label) and an optional **body** (detailed content loaded on drill-down).
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
- **Title:** The first non-indented line (L1) or first line at a given indent level (L2+). ~50 chars, like a chapter title.
|
|
29
|
+
- **Body:** Lines starting with `> ` at the same indent level. Joined with newlines. Shown only when the node is drilled into, not in listings.
|
|
30
|
+
- **Backward-compatible:** Without `> ` lines, the full text is stored as `content` and the title is auto-extracted from the first `maxTitleChars` characters (existing behavior).
|
|
31
|
+
|
|
32
|
+
**L1 example with body:**
|
|
33
|
+
```
|
|
34
|
+
Short Error Title
|
|
35
|
+
> SQLite connection failed because .mcp.json used a relative path.
|
|
36
|
+
> The fix was to use an absolute path in the HMEM_PROJECT_DIR env var.
|
|
37
|
+
Details about reproduction
|
|
38
|
+
> Steps: 1. Set HMEM_PROJECT_DIR=./hmem 2. Run hmem serve 3. Observe SQLITE_CANTOPEN
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**L1 example without body (old format, still works):**
|
|
42
|
+
```
|
|
43
|
+
SQLite connection failed due to wrong path in .mcp.json
|
|
44
|
+
Fix: use absolute path in env var
|
|
45
|
+
```
|
|
29
46
|
|
|
30
47
|
**Indentation:** 1 tab = 1 level. Alternatively: 2 or 4 spaces per level (auto-detected).
|
|
31
48
|
**Warning:** A tab at the start of any line always means "go one level deeper" — it is structural, not content. If you need to store code or text that contains leading tabs, use spaces instead.
|
|
@@ -70,15 +87,40 @@ tag_rename(old_tag="#hmem-store", new_tag="#hmem") # rename a tag ever
|
|
|
70
87
|
| Prefix | Category | When to use |
|
|
71
88
|
|--------|----------|-------------|
|
|
72
89
|
| **P** | (P)roject | Project entries — standardized L1 format (see below) |
|
|
73
|
-
| **L** | (L)esson | Lessons learned, best practices |
|
|
74
|
-
| **E** | (E)rror | Bugs, errors + their fix |
|
|
75
|
-
| **D** | (D)ecision | Architecture decisions with reasoning |
|
|
76
|
-
| **T** | (T)ask |
|
|
77
|
-
| **M** | (M)ilestone |
|
|
90
|
+
| **L** | (L)esson | Lessons learned, best practices — cross-project knowledge |
|
|
91
|
+
| **E** | (E)rror | Bugs, errors + their fix — cross-project knowledge |
|
|
92
|
+
| **D** | (D)ecision | Architecture decisions with reasoning — cross-project knowledge |
|
|
93
|
+
| **T** | (T)ask | Cross-project or infrastructure tasks ONLY (see note below) |
|
|
94
|
+
| **M** | (M)ilestone | Cross-project milestones ONLY — project milestones go in P-entry L2 "Protocol" |
|
|
78
95
|
| **S** | (S)kill | Skills, processes, how-to guides |
|
|
79
96
|
| **N** | (N)avigator | Code pointers — where something lives in the codebase |
|
|
80
97
|
| **H** | (H)uman | Knowledge about the user — preferences, context, working style |
|
|
81
98
|
| **R** | (R)ule | User-defined rules and constraints — "always do X", "never do Y" |
|
|
99
|
+
| **I** | (I)nfrastructure | Devices, servers, deployments, network — one entry per device/server |
|
|
100
|
+
|
|
101
|
+
### Where do tasks, errors, lessons, and decisions go?
|
|
102
|
+
|
|
103
|
+
**Tasks** belong inside the project's P-entry L2 "Open tasks" node:
|
|
104
|
+
```
|
|
105
|
+
append_memory(id="P0048.8", content="Implement multi-server sync\n\tPush/pull to all configured servers", tags=["#hmem-sync"])
|
|
106
|
+
```
|
|
107
|
+
Use the T-prefix ONLY for tasks that span multiple projects or are infrastructure/meta tasks (e.g. "Set up Strato server", "Run curation pass"). These get `links=["P00XX"]` to the most relevant project.
|
|
108
|
+
|
|
109
|
+
**Milestones** belong in the P-entry L2 "Protocol" node as a chronological entry:
|
|
110
|
+
```
|
|
111
|
+
append_memory(id="P0048.7", content="v4.0.0 published — project gate + load_project tool (2026-03-27)", tags=["#release"])
|
|
112
|
+
```
|
|
113
|
+
Use the M-prefix ONLY for milestones that span multiple projects (e.g. "First cross-device sync working").
|
|
114
|
+
|
|
115
|
+
**Errors (E), Lessons (L), Decisions (D)** stay as independent root entries — they are **cross-project knowledge**. An SQLite lesson learned in hmem applies to every SQLite project. Always add `tags` and `links` to connect them back:
|
|
116
|
+
```
|
|
117
|
+
write_memory(prefix="E", content="...", tags=["#hmem", "#sqlite"], links=["P0048"])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**P-entry "Known issues" (L2)** contains short summaries pointing to E-entries — not the errors themselves:
|
|
121
|
+
```
|
|
122
|
+
append_memory(id="P0048.6", content="Auto-sync fails with multiple .hmem in CWD → E0097, T0043", tags=["#hmem-sync"])
|
|
123
|
+
```
|
|
82
124
|
|
|
83
125
|
**Custom prefixes:** If none of the above fit, you can use any single uppercase letter. To register it officially (so the system validates it), add it to `hmem.config.json` under `"prefixes"`:
|
|
84
126
|
```json
|
|
@@ -89,10 +131,11 @@ Custom prefixes are merged with the defaults — they don't replace them. Withou
|
|
|
89
131
|
### P-Entry Standard Schema (enforced by MCP server)
|
|
90
132
|
|
|
91
133
|
Every project entry MUST follow this structure. The MCP server validates L2 nodes
|
|
92
|
-
against the
|
|
134
|
+
against the standard categories when `prefix="P"`.
|
|
93
135
|
|
|
94
|
-
**L1 Title:** `Name | Status | Tech |
|
|
95
|
-
|
|
136
|
+
**L1 Title:** `Name | Status | Tech Stack | GH: owner/repo | Short description`
|
|
137
|
+
The GH field is optional — include it when a GitHub repo exists, omit otherwise.
|
|
138
|
+
**L1 Body:** (same line or next non-indented line) One-sentence project summary.
|
|
96
139
|
|
|
97
140
|
**Status values:**
|
|
98
141
|
|
|
@@ -104,49 +147,51 @@ against the required categories when `prefix="P"`.
|
|
|
104
147
|
| Paused | On hold, will resume later |
|
|
105
148
|
| Archived | Done or abandoned |
|
|
106
149
|
|
|
107
|
-
**
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
150
|
+
**L2 categories (fixed order, skip sections that are empty):**
|
|
151
|
+
|
|
152
|
+
The MCP server validates that L2 nodes start with one of these names. Minimum for a new project: Overview + Codebase (or Usage).
|
|
153
|
+
|
|
154
|
+
| L2 Category | What goes here | L3 children |
|
|
155
|
+
|-------------|---------------|-------------|
|
|
156
|
+
| **Overview** | First thing an agent reads (like CLAUDE.md /init) | Current state, Goals, Architecture, Environment |
|
|
157
|
+
| **Codebase** | Code structure — NO code, only names + signatures | Entry point, Core modules (each module = L4 node with signature + purpose + return), Helpers, Config, Tests |
|
|
158
|
+
| **Usage** | How the project is used | Installation/Setup, CLI/API commands, Common workflows |
|
|
159
|
+
| **Context** | Background and motivation | Initiator, Target audience, Business context, Dependencies (links) |
|
|
160
|
+
| **Deployment** | Build/CI/CD/publish process | (flat or with L3 sub-steps) |
|
|
161
|
+
| **Bugs** | Active bugs + known limitations | L3: inline report (symptom + cause) OR pointer to E-entry (`→ E0097`). L4: reproduction steps |
|
|
162
|
+
| **Protocol** | Session log, chronological | One-liner per session + links to O-entries |
|
|
163
|
+
| **Open tasks** | Project-specific TODOs | One per L3 node. Cross-project tasks → T-prefix with links |
|
|
164
|
+
| **Ideas** | Feature ideas, brainstorming | L3: short description, L4: implementation details |
|
|
165
|
+
|
|
166
|
+
**load_project tool:** Use `load_project(id="P0048")` to activate a project and get the full briefing (L2 content + L3 titles) in one call. This is the recommended way to start working on a project — it combines read + activate.
|
|
167
|
+
|
|
168
|
+
**Markers you may see on entries:**
|
|
169
|
+
|
|
170
|
+
| Marker | Meaning |
|
|
171
|
+
|--------|---------|
|
|
172
|
+
| `[♥]` | Favorite — always expanded in bulk reads |
|
|
173
|
+
| `[★]` | Top-accessed — high weighted access score |
|
|
174
|
+
| `[≡]` | Top-subnode — many children |
|
|
175
|
+
| `[⚡]` | Task-promoted — relevant to an active T/P/D entry (tag overlap) |
|
|
176
|
+
| `[*]` | Active — currently in focus |
|
|
177
|
+
| `[P]` | Pinned — super-favorite, shows full L2 |
|
|
178
|
+
| `[!]` | Obsolete — superseded, kept for history |
|
|
179
|
+
| `[-]` | Irrelevant — hidden from bulk reads |
|
|
180
|
+
| `✓` | Synced — backed up to all sync servers |
|
|
181
|
+
|
|
182
|
+
**Complete P-entry example (WeatherBot):**
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
write_memory(
|
|
186
|
+
prefix="P",
|
|
187
|
+
content="WeatherBot | New | Python/Discord.py | GH: user/weatherbot\n> Discord bot for weather forecasts — slash commands for current weather and multi-day forecasts\n\tOverview\n\t\tCurrent state\n\t\t> Scaffolding done, no commands yet. Bot connects to Discord but has no slash commands registered.\n\t\tGoals\n\t\t> Daily/hourly forecasts via slash commands, multi-city support, embed formatting\n\t\tArchitecture\n\t\t> Discord slash command → OpenWeatherMap API → formatted embed. Single-file cog pattern.\n\t\tEnvironment\n\t\t> /home/user/weatherbot, python bot.py, needs DISCORD_TOKEN + WEATHER_API_KEY in .env\n\tCodebase\n\t\tEntry point — bot.py, start: python bot.py\n\t\tCore modules\n\t\t\tweather_cog.py — WeatherCog(Cog); fetch_forecast(city: str) → discord.Embed\n\t\t\tformatter.py — format_embed(data: dict) → discord.Embed\n\t\tHelpers / Utilities\n\t\t\tapi_client.py — get_weather(city: str) → dict; wraps HTTP to OpenWeatherMap\n\t\tConfig / Constants — .env: DISCORD_TOKEN, WEATHER_API_KEY, DEFAULT_CITY\n\t\tTests — pytest, test_weather_cog.py (3 tests)\n\tUsage\n\t\tInstallation / Setup — pip install -r requirements.txt, cp .env.example .env\n\t\tCLI / API — /weather <city>, /forecast <city> (planned)\n\tContext\n\t\tInitiator — personal project, Mar 2026\n\t\tTarget audience — personal Discord server\n\t\tDependencies — discord.py, OpenWeatherMap API, aiohttp\n\tOpen tasks\n\t\tImplement /forecast command\n\t\t> Multi-day view with daily highs/lows and weather icons per day\n\t\tAdd city autocomplete",
|
|
188
|
+
tags=["#discord", "#python", "#weather", "#bot"],
|
|
189
|
+
links=[]
|
|
190
|
+
)
|
|
148
191
|
```
|
|
149
192
|
|
|
193
|
+
Note: L2 nodes use 1 tab, L3 uses 2 tabs, L4 uses 3 tabs. Use `> ` for body text that should be hidden in listings but shown on drill-down. Skip empty sections — no need for placeholder text.
|
|
194
|
+
|
|
150
195
|
### Marking entries as favorites
|
|
151
196
|
|
|
152
197
|
Mark any entry as a favorite to ensure it always appears with its L2 detail in bulk reads (alongside a `[♥]` marker). Use this for reference info you need to see every session — API endpoints, key decisions, frequently looked-up patterns.
|
|
@@ -206,22 +251,22 @@ write_memory(
|
|
|
206
251
|
|
|
207
252
|
---
|
|
208
253
|
|
|
209
|
-
## Title +
|
|
254
|
+
## Title + Body Quality Rules
|
|
210
255
|
|
|
211
256
|
**Title:** Short navigation label, ~50 chars (configurable via `maxTitleChars`). Think "chapter title in a book".
|
|
212
257
|
- Good: `"hmem.py Performance: Bulk-Queries statt N+1"`, `"Ghost Wakeup Bug in msg-router.ts"`
|
|
213
258
|
- Bad: `"Fixed a bug"`, `"Important lesson"` (too vague)
|
|
214
259
|
|
|
215
|
-
**
|
|
260
|
+
**Body (via `>` lines):** Detailed explanation — full sentences, multiline OK. Shown on drill-down, hidden in listings.
|
|
216
261
|
- Must be understandable without any context
|
|
217
|
-
- Not "Fixed a bug" — instead
|
|
262
|
+
- Not "Fixed a bug" — instead explain root cause, fix, and impact
|
|
218
263
|
|
|
219
|
-
**With
|
|
264
|
+
**With title + body (recommended):**
|
|
220
265
|
```
|
|
221
|
-
write_memory(prefix="L", content="hmem.py Performance\
|
|
266
|
+
write_memory(prefix="L", content="hmem.py Performance: Bulk-Queries statt N+1\n> Alle Nodes in 2 Bulk-Queries laden, nicht pro Entry einzeln.\n> Vorher: load_nodes() pro Entry = N+1 SQLite-Connections.\n\tImplementation detail\n\t> Changed read() to batch-fetch all nodes for visible entries in one query")
|
|
222
267
|
```
|
|
223
268
|
|
|
224
|
-
**Without
|
|
269
|
+
**Without body (simple entries, backward-compatible):**
|
|
225
270
|
```
|
|
226
271
|
write_memory(prefix="E", content="SQLite connection failed due to wrong path in .mcp.json\n\tFix: use absolute path in env var")
|
|
227
272
|
```
|
|
@@ -302,7 +347,13 @@ Only use `write_memory` when:
|
|
|
302
347
|
|
|
303
348
|
## When to save?
|
|
304
349
|
|
|
305
|
-
**
|
|
350
|
+
**Checkpoint mode matters.** Check `checkpointMode` in hmem.config.json:
|
|
351
|
+
|
|
352
|
+
- **`"auto"` (recommended):** A background Haiku subagent handles checkpoints automatically every N exchanges. It reads recent O-entry exchanges, calls `read_memory` to avoid duplicates, and writes L/D/E entries + handoff via MCP tools. It also writes a rolling checkpoint summary (`[CP]` node tagged `#checkpoint-summary`) that compresses older exchanges for `load_project`. Skill-dialog exchanges are auto-tagged `#skill-dialog` and filtered from context injection. **You do NOT need to write entries yourself** unless the user explicitly asks you to save something specific.
|
|
353
|
+
|
|
354
|
+
- **`"remind"`:** You will receive a CHECKPOINT reminder every N messages. When you see it, save key learnings yourself using `write_memory` / `append_memory`.
|
|
355
|
+
|
|
356
|
+
**In both modes:** Only save what is still valuable in 6 months.
|
|
306
357
|
|
|
307
358
|
| Save | Don't save |
|
|
308
359
|
|------|-----------|
|
|
@@ -336,13 +387,14 @@ Use when: the wording is wrong, outdated, or needs clarification.
|
|
|
336
387
|
Appends new child nodes under an existing root or node. Existing children are preserved.
|
|
337
388
|
|
|
338
389
|
Content indentation is **relative to the parent** — 0 tabs = direct child of `id`.
|
|
390
|
+
Body lines (`> `) work the same as in `write_memory`.
|
|
339
391
|
|
|
340
392
|
```
|
|
341
393
|
append_memory(
|
|
342
394
|
id="L0003",
|
|
343
|
-
content="New finding discovered later\n\tSub-detail about it"
|
|
395
|
+
content="New finding discovered later\n> Detailed explanation of what was found and why it matters.\n> This can span multiple lines.\n\tSub-detail about it"
|
|
344
396
|
)
|
|
345
|
-
# → adds L0003.N (L2) and L0003.N.1 (L3)
|
|
397
|
+
# → adds L0003.N (L2 with title + body) and L0003.N.1 (L3)
|
|
346
398
|
|
|
347
399
|
append_memory(
|
|
348
400
|
id="L0003.2",
|