@skedulo/memory-hub-mcp 0.2.12 → 0.2.13
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 +4 -0
- package/assets/session-start.sh +13 -1
- package/assets/session-stop.sh +10 -0
- package/dist/bulk.js +1 -1
- package/dist/capture.js +6 -1
- package/dist/cli.js +15 -1
- package/dist/index.js +1 -1
- package/dist/setup.js +140 -18
- package/package.json +1 -1
- package/skill-guide.md +14 -9
package/README.md
CHANGED
|
@@ -69,6 +69,10 @@ npm install -g @skedulo/memory-hub-mcp
|
|
|
69
69
|
memory-hub-mcp setup
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
The Claude Code hooks need `bash`, `curl` and `jq` (`jq` ships with macOS 15 and later; otherwise
|
|
73
|
+
`brew install jq`); `setup` warns about any that are missing. `setup` also asks about
|
|
74
|
+
auto-capture, which is off by default; switch it later with `memory-hub-mcp capture on` (or `off`).
|
|
75
|
+
|
|
72
76
|
`setup` asks which host you use — Claude Code, Claude Desktop, or both (`--code` / `--desktop` /
|
|
73
77
|
`--both` skip the prompt) — then logs you in with the same browser OAuth `sked` itself uses and
|
|
74
78
|
mints a personal token from that session. For **Claude Code** it does everything
|
package/assets/session-start.sh
CHANGED
|
@@ -19,6 +19,12 @@ if [ -z "$TOKEN" ]; then
|
|
|
19
19
|
exit 0
|
|
20
20
|
fi
|
|
21
21
|
|
|
22
|
+
# Without jq the JSON below cannot be built, and an invalid line is dropped without a word.
|
|
23
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
24
|
+
printf '%s\n' '{"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": "memory-hub needs jq, which is not installed, so memory is off this session. Tell the user to install it (macOS: brew install jq; Debian/Ubuntu: sudo apt install jq) and restart Claude Code."}}'
|
|
25
|
+
exit 0
|
|
26
|
+
fi
|
|
27
|
+
|
|
22
28
|
TMP_DIR=$(mktemp -d)
|
|
23
29
|
trap 'rm -rf "$TMP_DIR"' EXIT
|
|
24
30
|
|
|
@@ -431,7 +437,13 @@ auto_capture_registered() {
|
|
|
431
437
|
return 1
|
|
432
438
|
}
|
|
433
439
|
|
|
434
|
-
|
|
440
|
+
# Same rule as session-stop.sh; change both together.
|
|
441
|
+
capture_opted_in() {
|
|
442
|
+
case "$(printf '%s' "${MEMORY_HUB_AUTO_CAPTURE:-}" | tr '[:upper:]' '[:lower:]')" in 1|true|yes|on) return 0 ;; esac
|
|
443
|
+
[ "${CLAUDE_PLUGIN_OPTION_CAPTURE:-}" = true ]
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
if auto_capture_registered || { [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && capture_opted_in; }; then
|
|
435
447
|
SAVE_LINE='Auto-capture is on: after long stretches and at session end, a background run saves or updates a Fact for this session'"'"'s work, shown as "memory-hub auto-saved" notices. Still save what matters yourself.'
|
|
436
448
|
else
|
|
437
449
|
SAVE_LINE='What follows is an automatic recall only - nothing in this session is saved unless you call memory_save.'
|
package/assets/session-stop.sh
CHANGED
|
@@ -7,6 +7,16 @@ if [ -n "${MEMORY_HUB_STOP_HOOK_ACTIVE:-}" ]; then
|
|
|
7
7
|
exit 0
|
|
8
8
|
fi
|
|
9
9
|
|
|
10
|
+
opted_in() {
|
|
11
|
+
case "$(printf '%s' "${MEMORY_HUB_AUTO_CAPTURE:-}" | tr '[:upper:]' '[:lower:]')" in 1|true|yes|on) return 0 ;; esac
|
|
12
|
+
[ "${CLAUDE_PLUGIN_OPTION_CAPTURE:-}" = true ]
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
# The plugin registers this hook for everyone, so there it waits for an opt-in; a hand registration is the opt-in.
|
|
16
|
+
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && ! opted_in; then
|
|
17
|
+
exit 0
|
|
18
|
+
fi
|
|
19
|
+
|
|
10
20
|
TOKEN="${MEMORY_HUB_MCP_TOKEN:-${CLAUDE_PLUGIN_OPTION_TOKEN:-}}"
|
|
11
21
|
[ -n "$TOKEN" ] || exit 0
|
|
12
22
|
command -v jq >/dev/null 2>&1 || exit 0
|
package/dist/bulk.js
CHANGED
|
@@ -14,7 +14,7 @@ async function performSaveItem(deps, input) {
|
|
|
14
14
|
if (refused) {
|
|
15
15
|
return { refused: refused.message };
|
|
16
16
|
}
|
|
17
|
-
const result = await (0, save_1.performSave)(deps, input);
|
|
17
|
+
const result = await (0, save_1.performSave)(deps, { ...input, visibility: (0, capture_1.captureVisibility)(input.visibility) });
|
|
18
18
|
(0, capture_1.logCapture)({ action: 'saved', type: input.type, uid: result.uid, externalRef: input.externalRef });
|
|
19
19
|
return { result };
|
|
20
20
|
}
|
package/dist/capture.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logCapture = exports.captureUpsert = exports.isCaptureMode = void 0;
|
|
3
|
+
exports.logCapture = exports.captureVisibility = exports.captureUpsert = exports.isCaptureMode = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const SIMILAR_OWN_FACT_FLOOR = 0.86;
|
|
6
6
|
function isCaptureMode(env = process.env) {
|
|
@@ -50,6 +50,11 @@ async function captureUpsert(deps, input, env = process.env) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
exports.captureUpsert = captureUpsert;
|
|
53
|
+
// An auto-capture is never reviewed before it is saved, so it stays with its author until they share it.
|
|
54
|
+
function captureVisibility(requested, env = process.env) {
|
|
55
|
+
return isCaptureMode(env) ? 'Private' : requested;
|
|
56
|
+
}
|
|
57
|
+
exports.captureVisibility = captureVisibility;
|
|
53
58
|
function logCapture(entry, env = process.env, append = fs_1.appendFileSync, now = () => new Date()) {
|
|
54
59
|
const path = env.MEMORY_HUB_CAPTURE_LOG;
|
|
55
60
|
if (!isCaptureMode(env) || !path) {
|
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,14 @@ if (command === 'setup') {
|
|
|
12
12
|
process.exit(1);
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
else if (command === 'capture') {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
|
+
const { runCapture } = require('./setup');
|
|
18
|
+
runCapture(process.argv.slice(3)).catch((error) => {
|
|
19
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
15
23
|
else if (command === 'embed') {
|
|
16
24
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
25
|
const { runEmbed, readProcessStdin } = require('./embed-cli');
|
|
@@ -34,7 +42,13 @@ else if (command === '--help' || command === '-h') {
|
|
|
34
42
|
on (needs the claude CLI and GitHub access; --no-plugin installs
|
|
35
43
|
the hooks and skill directly instead). The server runs as
|
|
36
44
|
npx ...@latest, so each start picks up the newest release;
|
|
37
|
-
--no-auto-update pins this install instead.
|
|
45
|
+
--no-auto-update pins this install instead. It asks about
|
|
46
|
+
auto-capture; --capture or --no-capture answers for it.
|
|
47
|
+
memory-hub-mcp capture on|off
|
|
48
|
+
turn auto-capture on or off: after long stretches and at session
|
|
49
|
+
end, a background Claude run, using your Claude usage, saves what
|
|
50
|
+
the session learned (new memories Private, updates keep their
|
|
51
|
+
visibility). setup also asks.
|
|
38
52
|
memory-hub-mcp embed print the embedding of the text on stdin (or the arguments) as JSON;
|
|
39
53
|
used by the UserPromptSubmit hook. Exits non-zero if it cannot.
|
|
40
54
|
memory-hub-mcp run the MCP server on stdio (how a host launches it)
|
package/dist/index.js
CHANGED
|
@@ -73,7 +73,7 @@ const INSTRUCTIONS = [
|
|
|
73
73
|
'Call memory_sessionContext once at the start of a conversation to load this',
|
|
74
74
|
"developer's persona, facts, skills and wiki pages before answering from scratch.",
|
|
75
75
|
'Before wrapping up a task, save anything durable with memory_save — nothing is',
|
|
76
|
-
'saved automatically unless the
|
|
76
|
+
'saved automatically unless the user switched on auto-capture, and on hosts',
|
|
77
77
|
'without hooks (e.g. Claude Desktop) nothing can capture it.',
|
|
78
78
|
].join(' ');
|
|
79
79
|
const server = new mcp_js_1.McpServer({ name: 'memory-hub-mcp', version: '0.1.0' }, { instructions: INSTRUCTIONS });
|
package/dist/setup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.runSetup = exports.registerPromptHook = exports.registerSessionStartHook = exports.removeMcpServer = exports.removeCopiedAssets = exports.unregisterHooks = exports.installPlugin = exports.enableMarketplaceAutoUpdate = exports.writeUserEnv = exports.writeDesktopConfig = exports.writeMcpServer = exports.functionUrl = exports.desktopConfigPath = exports.mcpLaunch = exports.pluginInstalled = exports.PLUGIN_ID = exports.MARKETPLACE_REF = exports.MARKETPLACE_REPO = exports.MARKETPLACE_NAME = exports.launchPath = exports.PACKAGE_SPEC = void 0;
|
|
3
|
+
exports.runSetup = exports.runCapture = exports.registerPromptHook = exports.registerSessionStartHook = exports.removeMcpServer = exports.removeCopiedAssets = exports.setCapture = exports.captureOn = exports.CAPTURE_FLAG = exports.unregisterHooks = exports.installPlugin = exports.enableMarketplaceAutoUpdate = exports.removeUserEnv = exports.writeUserEnv = exports.writeDesktopConfig = exports.writeMcpServer = exports.functionUrl = exports.desktopConfigPath = exports.mcpLaunch = exports.pluginInstalled = exports.PLUGIN_ID = exports.MARKETPLACE_REF = exports.MARKETPLACE_REPO = exports.MARKETPLACE_NAME = exports.launchPath = exports.PACKAGE_SPEC = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const os_1 = require("os");
|
|
@@ -156,11 +156,19 @@ function writeUserEnv(path, env) {
|
|
|
156
156
|
writeJson(path, settings);
|
|
157
157
|
}
|
|
158
158
|
exports.writeUserEnv = writeUserEnv;
|
|
159
|
+
function removeUserEnv(path, key) {
|
|
160
|
+
const settings = readJson(path);
|
|
161
|
+
if (!settings.env || !(key in settings.env))
|
|
162
|
+
return;
|
|
163
|
+
delete settings.env[key];
|
|
164
|
+
writeJson(path, settings);
|
|
165
|
+
}
|
|
166
|
+
exports.removeUserEnv = removeUserEnv;
|
|
159
167
|
// Only our own entries are touched — a developer may have their own SessionStart hooks.
|
|
160
168
|
// "Ours" is the script's identity, not its exact path: setup-dev.sh registers the repo
|
|
161
169
|
// checkout and this installer ~/.claude/memory-hub-hook, so matching the exact string
|
|
162
170
|
// lets both stack copies of the same script. Replaces, keeping any timeout it carried.
|
|
163
|
-
function registerHook(path, event, hookPath, script, timeout) {
|
|
171
|
+
function registerHook(path, event, hookPath, script, timeout, extra = {}) {
|
|
164
172
|
const settings = readJson(path);
|
|
165
173
|
const hooks = (settings.hooks ||= {});
|
|
166
174
|
const entries = (hooks[event] ||= []);
|
|
@@ -168,7 +176,7 @@ function registerHook(path, event, hookPath, script, timeout) {
|
|
|
168
176
|
(command.trim() === hookPath || command.trim().endsWith(`memory-hub-hook/${script}`));
|
|
169
177
|
const ours = entries.flatMap((entry) => (entry.hooks || []).filter((h) => isOurs(h.command)));
|
|
170
178
|
const already = ours.length === 1 && ours[0].command === hookPath;
|
|
171
|
-
const kept = { type: 'command', ...(timeout ? { timeout } : {}), ...ours[0], command: hookPath };
|
|
179
|
+
const kept = { type: 'command', ...(timeout ? { timeout } : {}), ...extra, ...ours[0], command: hookPath };
|
|
172
180
|
for (const entry of entries) {
|
|
173
181
|
entry.hooks = (entry.hooks || []).filter((h) => !isOurs(h.command));
|
|
174
182
|
}
|
|
@@ -220,25 +228,75 @@ function claudeRunner() {
|
|
|
220
228
|
};
|
|
221
229
|
}
|
|
222
230
|
// The plugin brings its own hooks, so setup's copies would run every hook twice.
|
|
231
|
+
// Empty event lists are dropped too: left behind, they read as "the hooks are missing".
|
|
232
|
+
function removeHookCommands(settings, event, matches) {
|
|
233
|
+
const entries = settings.hooks?.[event];
|
|
234
|
+
if (!Array.isArray(entries))
|
|
235
|
+
return { removed: 0, changed: false };
|
|
236
|
+
let removed = 0;
|
|
237
|
+
for (const entry of entries) {
|
|
238
|
+
const before = (entry.hooks || []).length;
|
|
239
|
+
entry.hooks = (entry.hooks || []).filter((h) => !(typeof h.command === 'string' && matches(h.command.trim())));
|
|
240
|
+
removed += before - entry.hooks.length;
|
|
241
|
+
}
|
|
242
|
+
const kept = entries.filter((entry) => entry.hooks.length > 0);
|
|
243
|
+
if (kept.length > 0) {
|
|
244
|
+
settings.hooks[event] = kept;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
delete settings.hooks[event];
|
|
248
|
+
}
|
|
249
|
+
return { removed, changed: removed > 0 || kept.length !== entries.length || kept.length === 0 };
|
|
250
|
+
}
|
|
223
251
|
function unregisterHooks(path) {
|
|
224
252
|
const settings = readJson(path);
|
|
225
253
|
let removed = 0;
|
|
254
|
+
let changed = false;
|
|
226
255
|
for (const [event, script] of [['SessionStart', 'session-start.sh'], ['UserPromptSubmit', 'user-prompt-submit.sh']]) {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
for (const entry of entries) {
|
|
231
|
-
const before = (entry.hooks || []).length;
|
|
232
|
-
entry.hooks = (entry.hooks || []).filter((h) => !(typeof h.command === 'string' && h.command.trim().endsWith(`memory-hub-hook/${script}`)));
|
|
233
|
-
removed += before - entry.hooks.length;
|
|
234
|
-
}
|
|
235
|
-
settings.hooks[event] = entries.filter((entry) => entry.hooks.length > 0);
|
|
256
|
+
const result = removeHookCommands(settings, event, (command) => command.endsWith(`memory-hub-hook/${script}`));
|
|
257
|
+
removed += result.removed;
|
|
258
|
+
changed ||= result.changed;
|
|
236
259
|
}
|
|
237
|
-
if (
|
|
260
|
+
if (changed)
|
|
238
261
|
writeJson(path, settings);
|
|
239
262
|
return removed;
|
|
240
263
|
}
|
|
241
264
|
exports.unregisterHooks = unregisterHooks;
|
|
265
|
+
exports.CAPTURE_FLAG = 'MEMORY_HUB_AUTO_CAPTURE';
|
|
266
|
+
const CAPTURE_EVENTS = ['Stop', 'SessionEnd'];
|
|
267
|
+
// Same reading as the hooks' opted_in; change both together.
|
|
268
|
+
function flagOn(value) {
|
|
269
|
+
return typeof value === 'string' && ['1', 'true', 'yes', 'on'].includes(value.toLowerCase());
|
|
270
|
+
}
|
|
271
|
+
function captureOn(settingsPath) {
|
|
272
|
+
const settings = readJson(settingsPath);
|
|
273
|
+
if (flagOn(settings.env?.[exports.CAPTURE_FLAG]))
|
|
274
|
+
return true;
|
|
275
|
+
return CAPTURE_EVENTS.some((event) => (settings.hooks?.[event] ?? []).some((entry) => (entry.hooks || []).some((h) => typeof h.command === 'string' && h.command.includes('session-stop.sh'))));
|
|
276
|
+
}
|
|
277
|
+
exports.captureOn = captureOn;
|
|
278
|
+
// With the plugin its own hooks wait for the flag; without it the copied hook is registered here.
|
|
279
|
+
function setCapture(settingsPath, on, mode) {
|
|
280
|
+
if (on) {
|
|
281
|
+
writeUserEnv(settingsPath, { [exports.CAPTURE_FLAG]: '1' });
|
|
282
|
+
if (!mode.plugin && mode.hookPath) {
|
|
283
|
+
registerHook(settingsPath, 'Stop', mode.hookPath, 'session-stop.sh', undefined, { async: true });
|
|
284
|
+
registerHook(settingsPath, 'SessionEnd', mode.hookPath, 'session-stop.sh', 60);
|
|
285
|
+
}
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
removeUserEnv(settingsPath, exports.CAPTURE_FLAG);
|
|
289
|
+
if (!mode.plugin && mode.hookPath) {
|
|
290
|
+
const settings = readJson(settingsPath);
|
|
291
|
+
let changed = false;
|
|
292
|
+
for (const event of CAPTURE_EVENTS) {
|
|
293
|
+
changed = removeHookCommands(settings, event, (command) => command === mode.hookPath).changed || changed;
|
|
294
|
+
}
|
|
295
|
+
if (changed)
|
|
296
|
+
writeJson(settingsPath, settings);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
exports.setCapture = setCapture;
|
|
242
300
|
// Under the plugin a copied SKILL.md lists the skill twice. state/ and cli-path stay: the plugin's prompt hook uses them.
|
|
243
301
|
function removeCopiedAssets(settingsPath, home = (0, os_1.homedir)()) {
|
|
244
302
|
const { hookDir, skillFile } = (0, asset_sync_1.installDirs)(home);
|
|
@@ -344,6 +402,60 @@ function existingToken(hosts) {
|
|
|
344
402
|
const env = readJson(desktopConfigPath()).mcpServers?.['memory-hub']?.env || {};
|
|
345
403
|
return { token: env.MEMORY_HUB_MCP_TOKEN, url: env.MEMORY_HUB_FUNCTION_URL };
|
|
346
404
|
}
|
|
405
|
+
const CAPTURE_SWITCH_HINT = 'Switch it any time with `npx -y @skedulo/memory-hub-mcp@latest capture on` (or `off`).';
|
|
406
|
+
function warnHookTools() {
|
|
407
|
+
if ((0, os_1.platform)() === 'win32') {
|
|
408
|
+
console.log(' warning: the hooks are bash scripts, so on Windows they only run inside Git Bash or WSL');
|
|
409
|
+
}
|
|
410
|
+
for (const tool of ['bash', 'curl', 'jq']) {
|
|
411
|
+
if ((0, child_process_1.spawnSync)('which', [tool]).status !== 0) {
|
|
412
|
+
console.log(` warning: ${tool} is not installed. The hooks need it, so memory is not injected until you install it (macOS: brew install ${tool}).`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
async function askCapture(current) {
|
|
417
|
+
console.log(' After long stretches and at session end, a background Claude run saves what the');
|
|
418
|
+
console.log(' session learned. New memories are Private (shared only if you share them); an');
|
|
419
|
+
console.log(' update keeps the memory\'s visibility. It uses your Claude usage, and you see what');
|
|
420
|
+
console.log(' it saved at the start of your next session.');
|
|
421
|
+
const answer = (await ask(` Turn on auto-capture? (${current ? 'Y/n' : 'y/N'}): `)).toLowerCase();
|
|
422
|
+
if (!answer)
|
|
423
|
+
return current;
|
|
424
|
+
return answer.startsWith('y');
|
|
425
|
+
}
|
|
426
|
+
async function runCapture(argv = []) {
|
|
427
|
+
const settingsPath = (0, path_1.join)((0, os_1.homedir)(), '.claude', 'settings.json');
|
|
428
|
+
const plugin = pluginInstalled();
|
|
429
|
+
const hookPath = (0, path_1.join)((0, asset_sync_1.installDirs)().hookDir, 'session-stop.sh');
|
|
430
|
+
const choice = argv[0];
|
|
431
|
+
const pluginNote = "If you turned on the plugin's Auto-capture option in /plugin configure, that keeps it on too.";
|
|
432
|
+
if (choice !== 'on' && choice !== 'off') {
|
|
433
|
+
console.log(`auto-capture is ${captureOn(settingsPath) ? 'on' : 'off'} in ~/.claude/settings.json.`);
|
|
434
|
+
if (plugin)
|
|
435
|
+
console.log(pluginNote);
|
|
436
|
+
console.log('Usage: memory-hub-mcp capture on|off');
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (choice === 'on' && !plugin && !(0, fs_1.existsSync)(hookPath)) {
|
|
440
|
+
console.log('memory-hub is not set up for Claude Code yet. Run `npx -y @skedulo/memory-hub-mcp setup` first.');
|
|
441
|
+
process.exitCode = 1;
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
setCapture(settingsPath, choice === 'on', { plugin, hookPath: plugin ? undefined : hookPath });
|
|
445
|
+
if (choice === 'on') {
|
|
446
|
+
console.log('auto-capture is on: after long stretches and at session end, a background Claude run, using your Claude usage, saves what the session learned. New memories are Private; updates keep their visibility.');
|
|
447
|
+
}
|
|
448
|
+
else if (captureOn(settingsPath)) {
|
|
449
|
+
console.log('auto-capture is still on: a session-stop.sh entry under Stop or SessionEnd in ~/.claude/settings.json keeps it running. Remove that entry by hand to stop it.');
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
452
|
+
console.log('auto-capture is off.');
|
|
453
|
+
if (plugin)
|
|
454
|
+
console.log(pluginNote);
|
|
455
|
+
}
|
|
456
|
+
console.log('Restart Claude Code to pick this up.');
|
|
457
|
+
}
|
|
458
|
+
exports.runCapture = runCapture;
|
|
347
459
|
async function runSetup(argv = []) {
|
|
348
460
|
console.log('==> Setting up the memory hub');
|
|
349
461
|
let hosts;
|
|
@@ -464,11 +576,21 @@ async function runSetup(argv = []) {
|
|
|
464
576
|
const prompt = registerPromptHook((0, path_1.join)((0, os_1.homedir)(), '.claude', 'settings.json'), promptHookPath);
|
|
465
577
|
console.log(` UserPromptSubmit hook -> ${promptHookPath}${prompt.already ? ' (already registered)' : ''}`);
|
|
466
578
|
console.log(' skill -> ~/.claude/skills/se-ai-memory-hub/SKILL.md');
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
579
|
+
}
|
|
580
|
+
if (hosts.includes('code')) {
|
|
581
|
+
warnHookTools();
|
|
582
|
+
console.log();
|
|
583
|
+
console.log('==> Auto-capture');
|
|
584
|
+
const hookPath = plugin ? undefined : (0, path_1.join)((0, asset_sync_1.installDirs)().hookDir, 'session-stop.sh');
|
|
585
|
+
let on = captureOn(settingsPath);
|
|
586
|
+
if (argv.includes('--capture'))
|
|
587
|
+
on = true;
|
|
588
|
+
else if (argv.includes('--no-capture'))
|
|
589
|
+
on = false;
|
|
590
|
+
else if (process.stdin.isTTY)
|
|
591
|
+
on = await askCapture(on);
|
|
592
|
+
setCapture(settingsPath, on, { plugin, hookPath });
|
|
593
|
+
console.log(on ? ` on. ${CAPTURE_SWITCH_HINT}` : ` off. ${CAPTURE_SWITCH_HINT}`);
|
|
472
594
|
}
|
|
473
595
|
if (hosts.includes('desktop')) {
|
|
474
596
|
console.log();
|
package/package.json
CHANGED
package/skill-guide.md
CHANGED
|
@@ -164,12 +164,12 @@ it. A save that happens is worth more than a better-timed one that doesn't.
|
|
|
164
164
|
|
|
165
165
|
## Automatic capture (when enabled)
|
|
166
166
|
|
|
167
|
-
Nothing saves on its own unless the user has switched on
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
Nothing saves on its own unless the user has switched on auto-capture. It is
|
|
168
|
+
off by default: `setup` asks, and `npx -y @skedulo/memory-hub-mcp@latest capture on`
|
|
169
|
+
(or `off`) switches it, as does the plugin's Auto-capture option. The
|
|
170
|
+
session-start Reminder says "Auto-capture is on" when it is. Without it, a
|
|
171
|
+
memory exists only if you called `memory_save`. If the user asks how to turn it
|
|
172
|
+
on, give them that one command; never ask them to edit hook JSON.
|
|
173
173
|
|
|
174
174
|
When it runs, it resumes the session headlessly and asks the model to keep
|
|
175
175
|
anything durable:
|
|
@@ -179,7 +179,10 @@ anything durable:
|
|
|
179
179
|
- **`SessionEnd`**: once, in the background, when the session ends.
|
|
180
180
|
|
|
181
181
|
It updates the existing Fact for a ticket instead of adding copies, so a
|
|
182
|
-
ticket's Fact is revised as the work moves on.
|
|
182
|
+
ticket's Fact is revised as the work moves on. New memories it saves are
|
|
183
|
+
Private, even in a repo linked to a team, because nobody reviewed them first;
|
|
184
|
+
the user shares one with `memory_setVisibility` once they have read it. An
|
|
185
|
+
update to an existing memory keeps that memory's visibility. Saving yourself is still the
|
|
183
186
|
right move for anything you know matters now. The capture model is
|
|
184
187
|
`MEMORY_HUB_CAPTURE_MODEL`, default `sonnet`.
|
|
185
188
|
|
|
@@ -194,8 +197,10 @@ the list of saves in `~/.claude/memory-hub-hook/state/captures-<session>.jsonl`,
|
|
|
194
197
|
and a one-line entry per run in `$TMPDIR/memory-hub-stop-hook.log`
|
|
195
198
|
(`/tmp/memory-hub-stop-hook.log` when `TMPDIR` is unset).
|
|
196
199
|
|
|
197
|
-
To turn it off
|
|
198
|
-
|
|
200
|
+
To turn it off: `npx -y @skedulo/memory-hub-mcp@latest capture off`, and switch off the
|
|
201
|
+
plugin's Auto-capture option if it was turned on there. A `session-stop.sh`
|
|
202
|
+
registered by hand in `~/.claude/settings.json` keeps capturing until its entry
|
|
203
|
+
is removed.
|
|
199
204
|
|
|
200
205
|
## Revise, don't re-save
|
|
201
206
|
|