claude-mem-lite 4.0.4 → 5.1.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +18 -72
- package/README.zh-CN.md +24 -74
- package/adopt-content.mjs +0 -1
- package/cli/common.mjs +0 -17
- package/cli.mjs +19 -3
- package/commands/mem.md +3 -3
- package/commands/update.md +5 -12
- package/format-utils.mjs +0 -21
- package/haiku-client.mjs +36 -5
- package/hash-utils.mjs +21 -0
- package/hook-episode.mjs +7 -1
- package/hook-optimize.mjs +103 -50
- package/hook-shared.mjs +8 -2
- package/hook-update.mjs +56 -14
- package/hook.mjs +21 -29
- package/hooks/hooks.json +0 -10
- package/install.mjs +100 -678
- package/lib/atomic-write.mjs +16 -0
- package/lib/deferred-work.mjs +7 -3
- package/lib/doctor-drift.mjs +0 -1
- package/lib/frontmatter.mjs +1 -2
- package/lib/get-core.mjs +27 -1
- package/lib/hook-prune.mjs +133 -0
- package/lib/hook-stdin.mjs +1 -1
- package/lib/hook-telemetry.mjs +1 -1
- package/lib/install-shape.mjs +45 -4
- package/lib/maintain-core.mjs +9 -0
- package/lib/metrics.mjs +2 -2
- package/lib/proc-lock.mjs +111 -13
- package/lib/proxy-fetch.mjs +26 -2
- package/lib/scrub-record.mjs +8 -0
- package/lib/shard-gc.mjs +11 -7
- package/lib/tmp-fixture-sweep.mjs +9 -0
- package/mem-cli.mjs +46 -434
- package/nlp.mjs +1 -1
- package/npm-shrinkwrap.json +6 -2
- package/package.json +9 -16
- package/project-utils.mjs +43 -15
- package/schema.mjs +112 -50
- package/scripts/hook-launcher.mjs +9 -3
- package/scripts/prompt-search-utils.mjs +0 -30
- package/scripts/setup.sh +5 -0
- package/scripts/user-prompt-search.js +3 -125
- package/secret-scrub.mjs +32 -3
- package/server.mjs +19 -451
- package/source-files.mjs +12 -29
- package/synonyms.mjs +2 -1
- package/tool-schemas.mjs +23 -91
- package/utils.mjs +5 -13
- package/commands/tools.md +0 -67
- package/install-metadata.mjs +0 -2193
- package/lib/registry-core.mjs +0 -264
- package/registry/preinstalled.json +0 -2419
- package/registry-enricher.mjs +0 -124
- package/registry-github.mjs +0 -86
- package/registry-importer.mjs +0 -569
- package/registry-recommend.mjs +0 -503
- package/registry-retriever.mjs +0 -611
- package/registry-scanner.mjs +0 -261
- package/registry.mjs +0 -665
- package/resource-discovery.mjs +0 -199
- package/scripts/pre-skill-bridge.js +0 -146
package/source-files.mjs
CHANGED
|
@@ -33,24 +33,10 @@ export const SOURCE_FILES = [
|
|
|
33
33
|
'package.json',
|
|
34
34
|
'package-lock.json',
|
|
35
35
|
'skill.md',
|
|
36
|
-
'registry.mjs',
|
|
37
|
-
'registry-scanner.mjs',
|
|
38
|
-
'registry-retriever.mjs',
|
|
39
|
-
'resource-discovery.mjs',
|
|
40
|
-
// registry-recommend.mjs: statically imported by hook.mjs (PostToolUse adoption probe)
|
|
41
|
-
// and scripts/user-prompt-search.js (UserPromptSubmit shadow recommendation).
|
|
42
|
-
'registry-recommend.mjs',
|
|
43
|
-
// registry-enricher/-github/-importer are dynamically imported by server.mjs
|
|
44
|
-
// (mem_registry tool) and mem-cli.mjs (registry CLI subcommands). Missing
|
|
45
|
-
// them from SOURCE_FILES silently broke those code paths prior to this fix.
|
|
46
|
-
'registry-enricher.mjs',
|
|
47
|
-
'registry-github.mjs',
|
|
48
|
-
'registry-importer.mjs',
|
|
49
36
|
// Shared SOURCE_FILES manifest — self-reference so `~/.claude-mem-lite/` can
|
|
50
37
|
// re-run install.mjs (which imports this module) after an auto-update.
|
|
51
38
|
'source-files.mjs',
|
|
52
39
|
'install.mjs',
|
|
53
|
-
'install-metadata.mjs',
|
|
54
40
|
'mem-cli.mjs',
|
|
55
41
|
'tier.mjs',
|
|
56
42
|
'tfidf.mjs',
|
|
@@ -65,8 +51,8 @@ export const SOURCE_FILES = [
|
|
|
65
51
|
'bash-utils.mjs',
|
|
66
52
|
// Single source of truth for the CLAUDE_MEM_DIR → data-dir resolver (rejects a
|
|
67
53
|
// stringified "undefined"/"null"/relative env instead of creating a stray dir).
|
|
68
|
-
// Statically imported by schema.mjs / cli.mjs / install.mjs
|
|
69
|
-
// AND hook scripts (pre-tool-recall / post-tool-recall
|
|
54
|
+
// Statically imported by schema.mjs / cli.mjs / install.mjs
|
|
55
|
+
// AND hook scripts (pre-tool-recall / post-tool-recall) — ship it
|
|
70
56
|
// or auto-update leaves schema + every hook with ERR_MODULE_NOT_FOUND on each fire.
|
|
71
57
|
'lib/resolve-data-dir.mjs',
|
|
72
58
|
// lib/ — statically imported by hook-llm.mjs (activity) + hook-handoff.mjs (git-state, task-reader);
|
|
@@ -107,7 +93,7 @@ export const SOURCE_FILES = [
|
|
|
107
93
|
'lib/id-routing.mjs',
|
|
108
94
|
'lib/err-sampler.mjs',
|
|
109
95
|
// v2.76.x: unsampled hook-script failure log. Imported by
|
|
110
|
-
// scripts/pre-tool-recall.js
|
|
96
|
+
// scripts/pre-tool-recall.js (recorder)
|
|
111
97
|
// and mem-cli.mjs (countRecentHookErrors for `stats`). Missing from
|
|
112
98
|
// manifest → tarball ships hooks that ERR_MODULE_NOT_FOUND on every fire.
|
|
113
99
|
'lib/hook-telemetry.mjs',
|
|
@@ -156,6 +142,11 @@ export const SOURCE_FILES = [
|
|
|
156
142
|
// + auto-update lock). Must ship or a partial install/update skips them.
|
|
157
143
|
'lib/proc-lock.mjs',
|
|
158
144
|
'lib/atomic-write.mjs',
|
|
145
|
+
// Shared settings.json hook classification + dangling-entry reconciliation.
|
|
146
|
+
// Statically imported by install.mjs AND dynamically by hook-update.mjs's
|
|
147
|
+
// post-swap step — missing it from the manifest would break auto-update's
|
|
148
|
+
// hook reconcile on the very release that needs it.
|
|
149
|
+
'lib/hook-prune.mjs',
|
|
159
150
|
'lib/proxy-fetch.mjs',
|
|
160
151
|
'lib/llm-provider-probe.mjs',
|
|
161
152
|
// P1 supply-chain: shared release-signing core (sha256 manifest + Ed25519
|
|
@@ -211,8 +202,7 @@ export const SOURCE_FILES = [
|
|
|
211
202
|
// (scripts/user-prompt-search.js and hook.mjs user-prompt via hook-memory.mjs).
|
|
212
203
|
'lib/ups-query.mjs',
|
|
213
204
|
// P2-12 twin cores: get/browse shared data collection for the CLI/MCP pairs
|
|
214
|
-
// (update lives in observation-write, delete-preview in delete-core
|
|
215
|
-
// stats/list in registry.mjs — all already listed).
|
|
205
|
+
// (update lives in observation-write, delete-preview in delete-core).
|
|
216
206
|
'lib/get-core.mjs',
|
|
217
207
|
'lib/browse-core.mjs',
|
|
218
208
|
// v2.61 dedup refactor: shared "save one observation" pipeline used by both
|
|
@@ -225,10 +215,6 @@ export const SOURCE_FILES = [
|
|
|
225
215
|
// auto-update. Same single-source-of-truth pattern (see #8217).
|
|
226
216
|
'lib/observation-write.mjs',
|
|
227
217
|
'lib/recall-core.mjs',
|
|
228
|
-
// Shared registry write core (import/remove/reindex + the 'installed' tier grant).
|
|
229
|
-
// Statically imported by mem-cli.mjs AND server.mjs — missing it from the manifest
|
|
230
|
-
// would break `registry import|remove|reindex` and mem_registry on auto-update.
|
|
231
|
-
'lib/registry-core.mjs',
|
|
232
218
|
// Shared timeline core (anchor resolution + before/after window) and shared
|
|
233
219
|
// cross-source search core (sessions/prompts FTS, CJK fallback, normalization,
|
|
234
220
|
// pagination math). Statically imported by mem-cli.mjs AND server.mjs — same
|
|
@@ -328,7 +314,7 @@ export const SOURCE_FILES = [
|
|
|
328
314
|
* Single source of truth for both install.mjs (initial install) and
|
|
329
315
|
* hook-update.mjs (auto-update): pre-v2.55 hook-update copied the entire
|
|
330
316
|
* scripts/ tree from the GitHub Releases tarball, which silently shipped
|
|
331
|
-
* dev-only files (mock-claude.mjs, extract-repos.mjs
|
|
317
|
+
* dev-only files (mock-claude.mjs, extract-repos.mjs…)
|
|
332
318
|
* to every user's data dir on the first auto-update.
|
|
333
319
|
*/
|
|
334
320
|
export const HOOK_SCRIPT_FILES = [
|
|
@@ -337,7 +323,6 @@ export const HOOK_SCRIPT_FILES = [
|
|
|
337
323
|
'prompt-search-utils.mjs',
|
|
338
324
|
'pre-tool-recall.js',
|
|
339
325
|
'post-tool-recall.js',
|
|
340
|
-
'pre-skill-bridge.js',
|
|
341
326
|
// The Agent|Task hook command in BOTH registration sites is now the .sh prefilter,
|
|
342
327
|
// which execs the .js only when CLAUDE_MEM_SUBAGENT_INJECT is on (audit P2-5). Both
|
|
343
328
|
// must be materialized: shipping the prefilter without its target turns every
|
|
@@ -376,8 +361,8 @@ const LAUNCHER_SCRIPT_FILES = ['launch.mjs', 'launch-preflight.mjs', 'setup.sh',
|
|
|
376
361
|
// themselves, but they NAME what gets executed: hooks/hooks.json declares the
|
|
377
362
|
// command lines Claude Code runs on every hook fire, .mcp.json declares the MCP
|
|
378
363
|
// server launch command, plugin.json/marketplace.json steer the install source,
|
|
379
|
-
// commands/*.md are model-visible skill bodies
|
|
380
|
-
//
|
|
364
|
+
// commands/*.md are model-visible skill bodies. All ship in the tarball; none
|
|
365
|
+
// were signed — the same
|
|
381
366
|
// shape as the two closed RCE gaps (hook scripts v3.40, launch.mjs v3.42): a
|
|
382
367
|
// release published without the signing key could swap hooks.json to point a
|
|
383
368
|
// hook event at an arbitrary command while every signed hash still matched.
|
|
@@ -388,11 +373,9 @@ const PLUGIN_DECLARATION_FILES = [
|
|
|
388
373
|
'.mcp.json',
|
|
389
374
|
'.claude-plugin/plugin.json',
|
|
390
375
|
'.claude-plugin/marketplace.json',
|
|
391
|
-
'registry/preinstalled.json',
|
|
392
376
|
'commands/mem.md',
|
|
393
377
|
'commands/memory.md',
|
|
394
378
|
'commands/update.md',
|
|
395
|
-
'commands/tools.md',
|
|
396
379
|
'commands/adopt.md',
|
|
397
380
|
'commands/unadopt.md',
|
|
398
381
|
'commands/lesson.md',
|
package/synonyms.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// synonyms.mjs -- Unified synonym data for FTS5 search and dispatch.
|
|
2
|
-
// Consolidates SYNONYM_PAIRS/SYNONYM_MAP (from nlp.mjs) and DISPATCH_SYNONYMS (
|
|
2
|
+
// Consolidates SYNONYM_PAIRS/SYNONYM_MAP (from nlp.mjs) and DISPATCH_SYNONYMS (formerly
|
|
3
|
+
// registry-retriever.mjs, removed with the skill registry in 2026-09).
|
|
3
4
|
|
|
4
5
|
// ─── Synonym Pairs (Bidirectional FTS5 expansion) ─────────────────────────────
|
|
5
6
|
|
package/tool-schemas.mjs
CHANGED
|
@@ -19,15 +19,25 @@ const coerceBool = z.preprocess(
|
|
|
19
19
|
z.boolean(),
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
// Coerce ids: accept single number, string "123", comma-separated "1,2,3", or array
|
|
22
|
+
// Coerce ids: accept single number, string "123", comma-separated "1,2,3", or array.
|
|
23
|
+
//
|
|
24
|
+
// R10 P2-6: a token that is not a whole integer is LEFT AS A STRING so zod rejects it —
|
|
25
|
+
// it is never parseInt'd. parseInt truncates and stops at the first non-digit, so the old
|
|
26
|
+
// preprocessor turned "1.5" into 1 (mem_delete then deleted #1) and dropped "abc" out of
|
|
27
|
+
// "1,abc,3" entirely, deleting a two-element set the caller never asked for. The array
|
|
28
|
+
// form `[1.5]` and the CLI both already rejected these; only the MCP string form did not,
|
|
29
|
+
// and mem_delete is a destructive tool. mem-cli.mjs records the same shape as a real
|
|
30
|
+
// incident — "3.9 -> 3 updated the wrong row" — which the CLI fixed and this did not.
|
|
31
|
+
// Same discipline as coerceDeferredTokens below: hand a non-conforming token to zod
|
|
32
|
+
// rather than silently repairing it.
|
|
33
|
+
// Positive whole digits only. coerceIntArray has exactly one consumer, memDeleteSchema
|
|
34
|
+
// below, and an observation id is a positive AUTOINCREMENT rowid — so "-3" is as much a
|
|
35
|
+
// caller mistake as "1.5" and gets the same answer: left as a string, rejected by zod.
|
|
36
|
+
const wholeIntOrRaw = (s) => (/^\d+$/.test(s) ? parseInt(s, 10) : s);
|
|
23
37
|
const coerceIntArray = z.preprocess((v) => {
|
|
24
|
-
if (Array.isArray(v)) return v.map((x) => (typeof x === 'string' ?
|
|
38
|
+
if (Array.isArray(v)) return v.map((x) => (typeof x === 'string' ? wholeIntOrRaw(x.trim()) : x));
|
|
25
39
|
if (typeof v === 'number') return [v];
|
|
26
|
-
if (typeof v === 'string')
|
|
27
|
-
return v
|
|
28
|
-
.split(',')
|
|
29
|
-
.map((s) => parseInt(s.trim(), 10))
|
|
30
|
-
.filter((n) => !isNaN(n));
|
|
40
|
+
if (typeof v === 'string') return v.split(',').map((s) => wholeIntOrRaw(s.trim()));
|
|
31
41
|
return v;
|
|
32
42
|
}, z.array(z.number().int()));
|
|
33
43
|
|
|
@@ -511,45 +521,6 @@ export const memFtsCheckSchema = {
|
|
|
511
521
|
action: z.enum(['check', 'rebuild']).describe('check=verify FTS integrity, rebuild=rebuild FTS indexes'),
|
|
512
522
|
};
|
|
513
523
|
|
|
514
|
-
export const memRegistrySchema = {
|
|
515
|
-
action: z
|
|
516
|
-
.enum(['list', 'stats', 'search', 'import', 'remove', 'reindex', 'import_url', 'enrich'])
|
|
517
|
-
.describe('Registry operation'),
|
|
518
|
-
query: z.string().optional().describe('Search query — keywords describing what you need (for search)'),
|
|
519
|
-
type: z.enum(['skill', 'agent']).optional().describe('Filter by resource type (for list/search)'),
|
|
520
|
-
name: z.string().optional().describe('Resource name (for import/remove)'),
|
|
521
|
-
resource_type: z.enum(['skill', 'agent']).optional().describe('Resource type (for import/remove)'),
|
|
522
|
-
source: z
|
|
523
|
-
.enum(['preinstalled', 'user', 'github'])
|
|
524
|
-
.optional()
|
|
525
|
-
.describe('Source (for import, default: user)'),
|
|
526
|
-
repo_url: z.string().optional().describe('GitHub repository URL (for import)'),
|
|
527
|
-
local_path: z.string().optional().describe('Local file path (for import)'),
|
|
528
|
-
invocation_name: z.string().optional().describe('Invocation name like "plugin:skill" (for import)'),
|
|
529
|
-
intent_tags: z.string().optional().describe('Comma-separated intent tags (for import)'),
|
|
530
|
-
domain_tags: z.string().optional().describe('Comma-separated domain/tech tags (for import)'),
|
|
531
|
-
trigger_patterns: z.string().optional().describe('When to recommend this tool (for import)'),
|
|
532
|
-
capability_summary: z.string().optional().describe('What this tool does (for import)'),
|
|
533
|
-
keywords: z.string().optional().describe('Search keywords (for import)'),
|
|
534
|
-
tech_stack: z.string().optional().describe('Technology stack tags (for import)'),
|
|
535
|
-
use_cases: z.string().optional().describe('Usage scenarios (for import)'),
|
|
536
|
-
url: z.string().optional().describe('GitHub repository URL (for import_url action)'),
|
|
537
|
-
enrich: coerceBool.optional().describe('Auto-enrich imported resources (for import_url action)'),
|
|
538
|
-
category: z
|
|
539
|
-
.string()
|
|
540
|
-
.optional()
|
|
541
|
-
.describe("Filter by category (e.g., 'testing', 'code-quality', 'debugging')"),
|
|
542
|
-
quality: z
|
|
543
|
-
.enum(['installed', 'verified', 'community'])
|
|
544
|
-
.optional()
|
|
545
|
-
.describe('Filter by quality tier (default: all)'),
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
export const memUseSchema = {
|
|
549
|
-
name: z.string().min(1).describe('Skill or agent name to load (exact name or search query)'),
|
|
550
|
-
type: z.enum(['skill', 'agent']).optional().describe('Resource type (default: skill)'),
|
|
551
|
-
};
|
|
552
|
-
|
|
553
524
|
export const memBrowseSchema = {
|
|
554
525
|
project: z.string().optional().describe('Filter by project (default: inferred from CWD)'),
|
|
555
526
|
tier: z.enum(['working', 'active', 'archive']).optional().describe('Show only this tier'),
|
|
@@ -601,16 +572,18 @@ export const memDeferDropSchema = {
|
|
|
601
572
|
//
|
|
602
573
|
// Core vs hidden (v2.34.0, expanded v2.70.0): only 9 tools are exposed via MCP
|
|
603
574
|
// `tools/list` (the original 6 + mem_defer/mem_defer_list/mem_defer_drop). The
|
|
604
|
-
// remaining
|
|
575
|
+
// remaining 9 stay registered — and are still callable by name at the MCP
|
|
605
576
|
// protocol level (`tools/call` by exact name) — but are omitted from the list
|
|
606
577
|
// response so they don't bloat every agent's startup context. The core set
|
|
607
578
|
// covers the hot paths the invited-memory contract promises (recall before
|
|
608
579
|
// Edit, save after bugfix, search/recent/timeline/get for retrieval, defer
|
|
609
580
|
// for cross-session carry-forward). Hidden tools are either maintenance
|
|
610
581
|
// (compress/maintain/optimize/fts_check), admin/infra
|
|
611
|
-
// (stats/export/update/delete), or specialized
|
|
612
|
-
//
|
|
613
|
-
// `
|
|
582
|
+
// (stats/export/update/delete), or a specialized browser (browse) — all of which have
|
|
583
|
+
// CLI equivalents documented in `adopt-content.mjs`. R10 P3-28: this said "remaining 11"
|
|
584
|
+
// and listed `registry/use`, four lines above the array that disproves it — mem_registry
|
|
585
|
+
// and mem_use went with the skill registry in v5.0.0. tests/tool-schemas.test.mjs pins
|
|
586
|
+
// 18 = 9 + 9; this comment is now the only prose nearby and must agree with it.
|
|
614
587
|
// ────────────────────────────────────────────────────────────────────────────
|
|
615
588
|
|
|
616
589
|
export const tools = [
|
|
@@ -824,47 +797,6 @@ export const tools = [
|
|
|
824
797
|
inputSchema: memOptimizeSchema,
|
|
825
798
|
hidden: true,
|
|
826
799
|
},
|
|
827
|
-
{
|
|
828
|
-
name: 'mem_registry',
|
|
829
|
-
description:
|
|
830
|
-
'Manage the skill/agent resource registry (list, stats, search, import, remove, reindex, enrich).\n' +
|
|
831
|
-
'\n' +
|
|
832
|
-
'DO NOT use when:\n' +
|
|
833
|
-
' - Searching project memory (use mem_search — registry is tool resources, not observations)\n' +
|
|
834
|
-
' - You already know the skill name and just want to load it (use mem_use)\n' +
|
|
835
|
-
' - Importing from a random URL user has not explicitly trusted\n' +
|
|
836
|
-
'\n' +
|
|
837
|
-
'USE when:\n' +
|
|
838
|
-
' - User asks "what skills/agents are installed" → action="list"\n' +
|
|
839
|
-
' - Looking for a tool by capability → action="search" with keywords\n' +
|
|
840
|
-
' - User explicitly asks to import a GitHub repo → action="import_url"\n' +
|
|
841
|
-
'\n' +
|
|
842
|
-
'Equivalent CLI: ' +
|
|
843
|
-
CLI_INVOKE +
|
|
844
|
-
' registry <list|search|import|...> [args]',
|
|
845
|
-
inputSchema: memRegistrySchema,
|
|
846
|
-
hidden: true,
|
|
847
|
-
},
|
|
848
|
-
{
|
|
849
|
-
name: 'mem_use',
|
|
850
|
-
description:
|
|
851
|
-
'Load and activate a skill or agent from the registry by EXACT name or invocation_name.\n' +
|
|
852
|
-
"A name that matches nothing returns closest-match names to pick from — never another resource's content.\n" +
|
|
853
|
-
'\n' +
|
|
854
|
-
'DO NOT use when:\n' +
|
|
855
|
-
' - You have not confirmed the skill exists (run mem_registry action="list" first)\n' +
|
|
856
|
-
' - The user only asked about a skill, not to invoke it\n' +
|
|
857
|
-
' - A built-in Claude Code Skill is a better fit than a managed one\n' +
|
|
858
|
-
'\n' +
|
|
859
|
-
'USE when:\n' +
|
|
860
|
-
' - mem_registry search surfaced a promising skill and you want its full content\n' +
|
|
861
|
-
' - You know the invocation_name (e.g. "plugin:foo") and need its instructions\n' +
|
|
862
|
-
' - User says "run the <X> skill" where X is a registered resource\n' +
|
|
863
|
-
'\n' +
|
|
864
|
-
'Equivalent CLI: MCP only (no CLI handler — use mem_registry to inspect)',
|
|
865
|
-
inputSchema: memUseSchema,
|
|
866
|
-
hidden: true,
|
|
867
|
-
},
|
|
868
800
|
{
|
|
869
801
|
name: 'mem_update',
|
|
870
802
|
description:
|
package/utils.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// claude-mem-lite shared utilities
|
|
2
2
|
// Used by server.mjs, hook.mjs, and tests
|
|
3
3
|
|
|
4
|
-
import { basename, dirname
|
|
4
|
+
import { basename, dirname } from 'path';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
6
|
import { buildLowSignalRegex } from './lib/low-signal-patterns.mjs';
|
|
7
7
|
// Local binding for internal use: the `export … from './secret-scrub.mjs'` re-export below
|
|
@@ -72,18 +72,10 @@ export const COMPRESSED_PENDING_PURGE = -2;
|
|
|
72
72
|
|
|
73
73
|
// ─── Path Safety ──────────────────────────────────────────────────────────
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* @param {string} allowedBase Base directory the path must stay within
|
|
80
|
-
* @returns {boolean} true if safe
|
|
81
|
-
*/
|
|
82
|
-
export function isPathConfined(candidate, allowedBase) {
|
|
83
|
-
const resolved = resolve(candidate);
|
|
84
|
-
const base = resolve(allowedBase);
|
|
85
|
-
return resolved === base || resolved.startsWith(base + sep);
|
|
86
|
-
}
|
|
75
|
+
// `isPathConfined` lived here until 2026-09. Its consumers were the skill-registry
|
|
76
|
+
// enrichment confinement gate and mem_use's managed-path check, both removed with that
|
|
77
|
+
// subsystem (docs/audits/20260906-145304.md); keeping the export would have added a dead
|
|
78
|
+
// name to the knip baseline — the same call made for `basenameAnySep` below.
|
|
87
79
|
|
|
88
80
|
// `basenameAnySep` lived here until 2026-08-22. Its sole production consumer was
|
|
89
81
|
// `recallForFile` (hook-memory.mjs), which had no callers of its own and was
|
package/commands/tools.md
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tools
|
|
3
|
-
description: "Use when: importing skills/agents from GitHub, managing registry resources, or searching for tools to solve a problem"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Tool Import
|
|
7
|
-
|
|
8
|
-
Import skills and agents from GitHub repositories into the resource registry for intelligent dispatch.
|
|
9
|
-
|
|
10
|
-
## Commands
|
|
11
|
-
|
|
12
|
-
- `/mem:tools <github-url>` — Import all skills/agents from a GitHub repo
|
|
13
|
-
- `/mem:tools <github-url> <instructions>` — Import with specific instructions (add/remove specific items)
|
|
14
|
-
- `/mem:tools <instructions>` — Directly add/remove/modify tools by prompt (no URL needed)
|
|
15
|
-
- `/mem:tools` (no args) — Show current registry stats and import help
|
|
16
|
-
|
|
17
|
-
## Instructions
|
|
18
|
-
|
|
19
|
-
When the user invokes `/mem:tools`:
|
|
20
|
-
|
|
21
|
-
### With GitHub URL
|
|
22
|
-
|
|
23
|
-
1. Call `mem_registry(action="import_url", url="<github-url>", enrich=true)` to import all skills/agents
|
|
24
|
-
2. The import pipeline automatically:
|
|
25
|
-
- Fetches repo file tree via GitHub API
|
|
26
|
-
- Discovers SKILL.md/AGENT.md files
|
|
27
|
-
- Parses frontmatter and extracts metadata
|
|
28
|
-
- Downloads files to managed/ directory
|
|
29
|
-
- Runs LLM enrichment for semantic tags (when enrich=true)
|
|
30
|
-
3. Report imported tools in a table format
|
|
31
|
-
|
|
32
|
-
### With GitHub URL + instructions
|
|
33
|
-
|
|
34
|
-
If the user provides instructions after the URL:
|
|
35
|
-
- "only add the TDD skill" → import only matching tools from that repo
|
|
36
|
-
- "remove the old testing tool" → call `mem_registry(action="remove", ...)`
|
|
37
|
-
- Follow user instructions for selective add/remove/modify operations
|
|
38
|
-
|
|
39
|
-
### With instructions only (no URL)
|
|
40
|
-
|
|
41
|
-
If the user provides a prompt without a GitHub URL, parse the intent:
|
|
42
|
-
|
|
43
|
-
**Adding a tool:**
|
|
44
|
-
- "添加一个叫 my-linter 的 skill" or "add a skill called my-linter"
|
|
45
|
-
- → Ask for metadata (or infer from context): capability_summary, intent_tags, domain_tags, trigger_patterns
|
|
46
|
-
- → Call `mem_registry(action="import", name="my-linter", resource_type="skill", ...)`
|
|
47
|
-
|
|
48
|
-
**Removing a tool:**
|
|
49
|
-
- "删除 old-testing skill" or "remove the old-testing agent"
|
|
50
|
-
- → Call `mem_registry(action="remove", name="old-testing", resource_type="skill")`
|
|
51
|
-
|
|
52
|
-
**Listing/searching:**
|
|
53
|
-
- "有哪些 testing 相关的工具" or "list all agents"
|
|
54
|
-
- → Call `mem_registry(action="list", type="agent")` or search by keywords
|
|
55
|
-
|
|
56
|
-
**Modifying a tool:**
|
|
57
|
-
- "更新 my-linter 的描述" or "update tags for my-tool"
|
|
58
|
-
- → Call `mem_registry(action="import", ...)` with updated metadata (upsert)
|
|
59
|
-
|
|
60
|
-
Always call `mem_registry(action="reindex")` after any add/remove/modify operations.
|
|
61
|
-
|
|
62
|
-
### Without URL or instructions
|
|
63
|
-
|
|
64
|
-
If no arguments provided:
|
|
65
|
-
1. Call `mem_registry(action="stats")` to show current registry state
|
|
66
|
-
2. Call `mem_registry(action="list")` to show all registered tools
|
|
67
|
-
3. Explain usage examples
|