hmem-mcp 1.6.6 → 2.0.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/hmem-config.d.ts +24 -0
- package/dist/hmem-config.js +49 -2
- package/dist/hmem-config.js.map +1 -1
- package/dist/hmem-store.d.ts +54 -1
- package/dist/hmem-store.js +313 -26
- package/dist/hmem-store.js.map +1 -1
- package/dist/mcp-server.js +232 -108
- package/dist/mcp-server.js.map +1 -1
- package/package.json +2 -2
- package/server.json +3 -3
- package/skills/hmem-config/SKILL.md +52 -4
- package/skills/hmem-curate/SKILL.md +37 -1
- package/skills/hmem-read/SKILL.md +56 -5
- package/skills/hmem-save/SKILL.md +1 -1
- package/skills/hmem-write/SKILL.md +25 -3
package/dist/hmem-config.d.ts
CHANGED
|
@@ -69,8 +69,32 @@ export interface HmemConfig {
|
|
|
69
69
|
* Set to 0 to disable. Default: 5.
|
|
70
70
|
*/
|
|
71
71
|
accessCountTopN: number;
|
|
72
|
+
/**
|
|
73
|
+
* Descriptions for prefix category headers (X0000 entries).
|
|
74
|
+
* Used as L1 text for abstract header entries in grouped bulk reads.
|
|
75
|
+
* Users can override or add descriptions in hmem.config.json.
|
|
76
|
+
*/
|
|
77
|
+
prefixDescriptions: Record<string, string>;
|
|
78
|
+
/**
|
|
79
|
+
* V2 bulk-read algorithm tuning parameters.
|
|
80
|
+
* Controls how many entries receive expanded treatment in default reads.
|
|
81
|
+
*/
|
|
82
|
+
bulkReadV2: {
|
|
83
|
+
/** Number of top-accessed entries to expand (default: 3) */
|
|
84
|
+
topAccessCount: number;
|
|
85
|
+
/** Number of newest entries to expand (default: 5) */
|
|
86
|
+
topNewestCount: number;
|
|
87
|
+
/** Number of obsolete entries to keep visible (default: 3) */
|
|
88
|
+
topObsoleteCount: number;
|
|
89
|
+
};
|
|
72
90
|
}
|
|
73
91
|
export declare const DEFAULT_PREFIXES: Record<string, string>;
|
|
92
|
+
/**
|
|
93
|
+
* Default descriptions for prefix category headers (X0000 entries).
|
|
94
|
+
* These are used as L1 text for abstract header entries that group
|
|
95
|
+
* entries by category in bulk reads.
|
|
96
|
+
*/
|
|
97
|
+
export declare const DEFAULT_PREFIX_DESCRIPTIONS: Record<string, string>;
|
|
74
98
|
export declare const DEFAULT_CONFIG: HmemConfig;
|
|
75
99
|
/**
|
|
76
100
|
* Format prefix map as "P=Project, L=Lesson, ..." for tool descriptions.
|
package/dist/hmem-config.js
CHANGED
|
@@ -10,6 +10,21 @@ export const DEFAULT_PREFIXES = {
|
|
|
10
10
|
S: "Skill",
|
|
11
11
|
N: "Navigator",
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Default descriptions for prefix category headers (X0000 entries).
|
|
15
|
+
* These are used as L1 text for abstract header entries that group
|
|
16
|
+
* entries by category in bulk reads.
|
|
17
|
+
*/
|
|
18
|
+
export const DEFAULT_PREFIX_DESCRIPTIONS = {
|
|
19
|
+
P: "Project experiences and summaries",
|
|
20
|
+
L: "Lessons learned and best practices",
|
|
21
|
+
T: "Tasks and work items",
|
|
22
|
+
E: "Errors encountered and their fixes",
|
|
23
|
+
D: "Key decisions and their rationale",
|
|
24
|
+
M: "Milestones and achievements",
|
|
25
|
+
S: "Skills and technical knowledge",
|
|
26
|
+
N: "Navigation and context notes",
|
|
27
|
+
};
|
|
13
28
|
export const DEFAULT_CONFIG = {
|
|
14
29
|
maxCharsPerLevel: [120, 2_500, 10_000, 25_000, 50_000],
|
|
15
30
|
maxDepth: 5,
|
|
@@ -20,6 +35,12 @@ export const DEFAULT_CONFIG = {
|
|
|
20
35
|
defaultReadLimit: 100,
|
|
21
36
|
prefixes: { ...DEFAULT_PREFIXES },
|
|
22
37
|
accessCountTopN: 5,
|
|
38
|
+
prefixDescriptions: { ...DEFAULT_PREFIX_DESCRIPTIONS },
|
|
39
|
+
bulkReadV2: {
|
|
40
|
+
topAccessCount: 3,
|
|
41
|
+
topNewestCount: 5,
|
|
42
|
+
topObsoleteCount: 3,
|
|
43
|
+
},
|
|
23
44
|
};
|
|
24
45
|
/**
|
|
25
46
|
* Format prefix map as "P=Project, L=Lesson, ..." for tool descriptions.
|
|
@@ -56,13 +77,15 @@ export function resolveDepthForPosition(i, tiers) {
|
|
|
56
77
|
export function loadHmemConfig(projectDir) {
|
|
57
78
|
const configPath = path.join(projectDir, "hmem.config.json");
|
|
58
79
|
if (!fs.existsSync(configPath)) {
|
|
59
|
-
return { ...DEFAULT_CONFIG, recentDepthTiers: [...DEFAULT_CONFIG.recentDepthTiers], prefixes: { ...DEFAULT_PREFIXES } };
|
|
80
|
+
return { ...DEFAULT_CONFIG, recentDepthTiers: [...DEFAULT_CONFIG.recentDepthTiers], prefixes: { ...DEFAULT_PREFIXES }, prefixDescriptions: { ...DEFAULT_PREFIX_DESCRIPTIONS }, bulkReadV2: { ...DEFAULT_CONFIG.bulkReadV2 } };
|
|
60
81
|
}
|
|
61
82
|
try {
|
|
62
83
|
const raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
|
|
63
84
|
const cfg = {
|
|
64
85
|
...DEFAULT_CONFIG,
|
|
65
86
|
recentDepthTiers: [...DEFAULT_CONFIG.recentDepthTiers],
|
|
87
|
+
prefixDescriptions: { ...DEFAULT_PREFIX_DESCRIPTIONS },
|
|
88
|
+
bulkReadV2: { ...DEFAULT_CONFIG.bulkReadV2 },
|
|
66
89
|
};
|
|
67
90
|
if (typeof raw.maxDepth === "number" && raw.maxDepth >= 1 && raw.maxDepth <= 10)
|
|
68
91
|
cfg.maxDepth = raw.maxDepth;
|
|
@@ -95,6 +118,30 @@ export function loadHmemConfig(projectDir) {
|
|
|
95
118
|
}
|
|
96
119
|
cfg.prefixes = merged;
|
|
97
120
|
}
|
|
121
|
+
// Prefix descriptions: merge user-defined with defaults
|
|
122
|
+
if (raw.prefixDescriptions && typeof raw.prefixDescriptions === "object" && !Array.isArray(raw.prefixDescriptions)) {
|
|
123
|
+
for (const [key, val] of Object.entries(raw.prefixDescriptions)) {
|
|
124
|
+
if (typeof key === "string" && /^[A-Z]$/.test(key) && typeof val === "string" && val.length > 0) {
|
|
125
|
+
cfg.prefixDescriptions[key] = val;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Also generate descriptions for any new user prefixes that lack descriptions
|
|
130
|
+
for (const key of Object.keys(cfg.prefixes)) {
|
|
131
|
+
if (!cfg.prefixDescriptions[key]) {
|
|
132
|
+
cfg.prefixDescriptions[key] = cfg.prefixes[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// V2 bulk-read tuning
|
|
136
|
+
if (raw.bulkReadV2 && typeof raw.bulkReadV2 === "object") {
|
|
137
|
+
const v2 = raw.bulkReadV2;
|
|
138
|
+
if (typeof v2.topAccessCount === "number" && v2.topAccessCount >= 0)
|
|
139
|
+
cfg.bulkReadV2.topAccessCount = v2.topAccessCount;
|
|
140
|
+
if (typeof v2.topNewestCount === "number" && v2.topNewestCount >= 0)
|
|
141
|
+
cfg.bulkReadV2.topNewestCount = v2.topNewestCount;
|
|
142
|
+
if (typeof v2.topObsoleteCount === "number" && v2.topObsoleteCount >= 0)
|
|
143
|
+
cfg.bulkReadV2.topObsoleteCount = v2.topObsoleteCount;
|
|
144
|
+
}
|
|
98
145
|
// Resolve char limits: explicit array > linear endpoints > default
|
|
99
146
|
if (Array.isArray(raw.maxCharsPerLevel) && raw.maxCharsPerLevel.length >= 1) {
|
|
100
147
|
const levels = raw.maxCharsPerLevel;
|
|
@@ -117,7 +164,7 @@ export function loadHmemConfig(projectDir) {
|
|
|
117
164
|
}
|
|
118
165
|
catch (e) {
|
|
119
166
|
console.error(`[hmem] Failed to parse hmem.config.json: ${e}. Using defaults.`);
|
|
120
|
-
return { ...DEFAULT_CONFIG, recentDepthTiers: [...DEFAULT_CONFIG.recentDepthTiers], prefixes: { ...DEFAULT_PREFIXES } };
|
|
167
|
+
return { ...DEFAULT_CONFIG, recentDepthTiers: [...DEFAULT_CONFIG.recentDepthTiers], prefixes: { ...DEFAULT_PREFIXES }, prefixDescriptions: { ...DEFAULT_PREFIX_DESCRIPTIONS }, bulkReadV2: { ...DEFAULT_CONFIG.bulkReadV2 } };
|
|
121
168
|
}
|
|
122
169
|
}
|
|
123
170
|
//# sourceMappingURL=hmem-config.js.map
|
package/dist/hmem-config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmem-config.js","sourceRoot":"","sources":["../src/hmem-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"hmem-config.js","sourceRoot":"","sources":["../src/hmem-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AA+F7B,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,UAAU;IACb,CAAC,EAAE,WAAW;IACd,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,WAAW;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA2B;IACjE,CAAC,EAAE,mCAAmC;IACtC,CAAC,EAAE,oCAAoC;IACvC,CAAC,EAAE,sBAAsB;IACzB,CAAC,EAAE,oCAAoC;IACvC,CAAC,EAAE,mCAAmC;IACtC,CAAC,EAAE,6BAA6B;IAChC,CAAC,EAAE,gCAAgC;IACnC,CAAC,EAAE,8BAA8B;CAClC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAe;IACxC,gBAAgB,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;IACtD,QAAQ,EAAE,CAAC;IACX,gBAAgB,EAAE;QAChB,EAAE,KAAK,EAA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ED
|
@@ -57,6 +57,10 @@ export interface MemoryEntry {
|
|
|
57
57
|
* N>0 = bulk read, N additional children exist beyond the one shown.
|
|
58
58
|
*/
|
|
59
59
|
hiddenChildrenCount?: number;
|
|
60
|
+
/** True if all L2 children are shown + links resolved (V2 expanded entry). */
|
|
61
|
+
expanded?: boolean;
|
|
62
|
+
/** True if this entry is a category header (seq===0, e.g. P0000). */
|
|
63
|
+
isHeader?: boolean;
|
|
60
64
|
children?: MemoryNode[];
|
|
61
65
|
linkedEntries?: MemoryEntry[];
|
|
62
66
|
}
|
|
@@ -89,6 +93,16 @@ export interface ReadOptions {
|
|
|
89
93
|
linkDepth?: number;
|
|
90
94
|
/** Internal: visited entry IDs for cycle detection during link resolution. */
|
|
91
95
|
_visitedLinks?: Set<string>;
|
|
96
|
+
/** Include all obsolete entries in bulk reads (default: only top N most-accessed). */
|
|
97
|
+
showObsolete?: boolean;
|
|
98
|
+
/** Time filter: "HH:MM" — filter entries by time of day. */
|
|
99
|
+
time?: string;
|
|
100
|
+
/** Time window: "+2h", "-1h", "both" — direction and size around the time/date. */
|
|
101
|
+
period?: string;
|
|
102
|
+
/** Reference entry ID — find entries created around the same time as this entry. */
|
|
103
|
+
timeAround?: string;
|
|
104
|
+
/** Internal: bypass obsolete enforcement for curator tools. */
|
|
105
|
+
_curatorBypass?: boolean;
|
|
92
106
|
}
|
|
93
107
|
export interface WriteResult {
|
|
94
108
|
id: string;
|
|
@@ -121,6 +135,16 @@ export declare class HmemStore {
|
|
|
121
135
|
* For bulk queries: returns L1 summaries (depth=1 default).
|
|
122
136
|
*/
|
|
123
137
|
read(opts?: ReadOptions): MemoryEntry[];
|
|
138
|
+
/**
|
|
139
|
+
* V1 bulk-read algorithm (legacy): recency gradient with depth tiers.
|
|
140
|
+
* Kept for backward compatibility when recentDepthTiers is explicitly passed.
|
|
141
|
+
*/
|
|
142
|
+
private readBulkV1;
|
|
143
|
+
/**
|
|
144
|
+
* V2 bulk-read algorithm: per-prefix expansion, smart obsolete filtering,
|
|
145
|
+
* expanded entries with all L2 children + links.
|
|
146
|
+
*/
|
|
147
|
+
private readBulkV2;
|
|
124
148
|
/**
|
|
125
149
|
* Get all Level 1 entries for injection at agent startup.
|
|
126
150
|
* Does NOT bump access_count (routine injection).
|
|
@@ -152,7 +176,7 @@ export declare class HmemStore {
|
|
|
152
176
|
* For sub-nodes: updates node content only.
|
|
153
177
|
* Does NOT modify children — use appendChildren to extend the tree.
|
|
154
178
|
*/
|
|
155
|
-
updateNode(id: string, newContent: string, links?: string[], obsolete?: boolean, favorite?: boolean): boolean;
|
|
179
|
+
updateNode(id: string, newContent: string, links?: string[], obsolete?: boolean, favorite?: boolean, curatorBypass?: boolean): boolean;
|
|
156
180
|
/**
|
|
157
181
|
* Append new child nodes under an existing entry (root or node).
|
|
158
182
|
* Content is tab-indented relative to the parent:
|
|
@@ -165,6 +189,15 @@ export declare class HmemStore {
|
|
|
165
189
|
count: number;
|
|
166
190
|
ids: string[];
|
|
167
191
|
};
|
|
192
|
+
/**
|
|
193
|
+
* Bump access_count on a root entry or node.
|
|
194
|
+
* Returns true if the entry was found and bumped.
|
|
195
|
+
*/
|
|
196
|
+
bump(id: string, increment?: number): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get all header entries (seq=0) for grouped output formatting.
|
|
199
|
+
*/
|
|
200
|
+
getHeaders(): MemoryEntry[];
|
|
168
201
|
close(): void;
|
|
169
202
|
private migrate;
|
|
170
203
|
/**
|
|
@@ -172,6 +205,26 @@ export declare class HmemStore {
|
|
|
172
205
|
* Idempotent — tracked via schema_version table.
|
|
173
206
|
*/
|
|
174
207
|
private migrateToTree;
|
|
208
|
+
/**
|
|
209
|
+
* One-time migration: create abstract header entries (X0000) for each prefix.
|
|
210
|
+
* Headers have seq=0 and serve as group separators in bulk reads.
|
|
211
|
+
* Idempotent — tracked via schema_version table.
|
|
212
|
+
*/
|
|
213
|
+
private migrateHeaders;
|
|
214
|
+
/**
|
|
215
|
+
* Add a link from sourceId to targetId (idempotent).
|
|
216
|
+
* Only works for root entries (not nodes).
|
|
217
|
+
*/
|
|
218
|
+
private addLink;
|
|
219
|
+
/**
|
|
220
|
+
* Parse time filter "HH:MM" + date + period into start/end window.
|
|
221
|
+
*/
|
|
222
|
+
private parseTimeFilter;
|
|
223
|
+
/**
|
|
224
|
+
* Parse a time window around a reference date.
|
|
225
|
+
* period: "+2h" (future), "-1h" (past), "both" (symmetric ±2h)
|
|
226
|
+
*/
|
|
227
|
+
private parseTimeWindow;
|
|
175
228
|
private buildRoleFilter;
|
|
176
229
|
private nextSeq;
|
|
177
230
|
private bumpAccess;
|