@onenomad/engram-mcp 1.0.0-beta.13 → 1.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/README.md +685 -691
- package/dist/cli.js +41 -41
- package/dist/governance.js +6 -6
- package/dist/handoff.d.ts +53 -48
- package/dist/handoff.js +156 -134
- package/dist/handoff.js.map +1 -1
- package/dist/migrate.js +5 -5
- package/dist/server.js +946 -927
- package/dist/server.js.map +1 -1
- package/dist/storage-postgres.js +61 -61
- package/migrations/postgres/001_init.sql +70 -70
- package/migrations/postgres/002_indexes.sql +45 -45
- package/package.json +69 -69
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
-- 002_indexes.sql — Hot-path indexes for multi-tenant Engram.
|
|
2
|
-
--
|
|
3
|
-
-- Each tenant typically has hundreds-to-millions of rows, so every
|
|
4
|
-
-- query is (tenant_id, ...) keyed. Indexes lead with tenant_id.
|
|
5
|
-
|
|
6
|
-
-- Chunks: scoped recency scans + vector search.
|
|
7
|
-
CREATE INDEX IF NOT EXISTS chunks_tenant_created_idx
|
|
8
|
-
ON chunks (tenant_id, created_at DESC);
|
|
9
|
-
|
|
10
|
-
-- IVFFlat for cosine-distance ANN. lists=100 is a sane default for
|
|
11
|
-
-- < 1M rows per tenant; bump to lists=sqrt(rows) for larger tenants.
|
|
12
|
-
-- Index is built lazily — fine to create on an empty table.
|
|
13
|
-
DO $$
|
|
14
|
-
BEGIN
|
|
15
|
-
IF NOT EXISTS (
|
|
16
|
-
SELECT 1 FROM pg_indexes WHERE indexname = 'chunks_embedding_ivfflat_idx'
|
|
17
|
-
) THEN
|
|
18
|
-
EXECUTE 'CREATE INDEX chunks_embedding_ivfflat_idx
|
|
19
|
-
ON chunks USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100)';
|
|
20
|
-
END IF;
|
|
21
|
-
END$$;
|
|
22
|
-
|
|
23
|
-
-- Knowledge triples: subject-keyed lookups dominate (queryTriples,
|
|
24
|
-
-- getTripleTimeline). Tenant + subject covers it; tenant + object
|
|
25
|
-
-- handles the timeline's OR branch.
|
|
26
|
-
CREATE INDEX IF NOT EXISTS knowledge_triples_tenant_subject_idx
|
|
27
|
-
ON knowledge_triples (tenant_id, subject);
|
|
28
|
-
CREATE INDEX IF NOT EXISTS knowledge_triples_tenant_object_idx
|
|
29
|
-
ON knowledge_triples (tenant_id, object);
|
|
30
|
-
|
|
31
|
-
-- Diary: date-range reads.
|
|
32
|
-
CREATE INDEX IF NOT EXISTS diary_entries_tenant_date_idx
|
|
33
|
-
ON diary_entries (tenant_id, date DESC);
|
|
34
|
-
|
|
35
|
-
-- Handoffs: newest-first.
|
|
36
|
-
CREATE INDEX IF NOT EXISTS handoffs_tenant_created_idx
|
|
37
|
-
ON handoffs (tenant_id, created_at DESC);
|
|
38
|
-
|
|
39
|
-
-- Daily logs: date-range reads.
|
|
40
|
-
CREATE INDEX IF NOT EXISTS daily_logs_tenant_date_idx
|
|
41
|
-
ON daily_logs (tenant_id, date DESC);
|
|
42
|
-
|
|
43
|
-
-- Rules: tenant lookup.
|
|
44
|
-
CREATE INDEX IF NOT EXISTS rules_tenant_idx
|
|
45
|
-
ON rules (tenant_id);
|
|
1
|
+
-- 002_indexes.sql — Hot-path indexes for multi-tenant Engram.
|
|
2
|
+
--
|
|
3
|
+
-- Each tenant typically has hundreds-to-millions of rows, so every
|
|
4
|
+
-- query is (tenant_id, ...) keyed. Indexes lead with tenant_id.
|
|
5
|
+
|
|
6
|
+
-- Chunks: scoped recency scans + vector search.
|
|
7
|
+
CREATE INDEX IF NOT EXISTS chunks_tenant_created_idx
|
|
8
|
+
ON chunks (tenant_id, created_at DESC);
|
|
9
|
+
|
|
10
|
+
-- IVFFlat for cosine-distance ANN. lists=100 is a sane default for
|
|
11
|
+
-- < 1M rows per tenant; bump to lists=sqrt(rows) for larger tenants.
|
|
12
|
+
-- Index is built lazily — fine to create on an empty table.
|
|
13
|
+
DO $$
|
|
14
|
+
BEGIN
|
|
15
|
+
IF NOT EXISTS (
|
|
16
|
+
SELECT 1 FROM pg_indexes WHERE indexname = 'chunks_embedding_ivfflat_idx'
|
|
17
|
+
) THEN
|
|
18
|
+
EXECUTE 'CREATE INDEX chunks_embedding_ivfflat_idx
|
|
19
|
+
ON chunks USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100)';
|
|
20
|
+
END IF;
|
|
21
|
+
END$$;
|
|
22
|
+
|
|
23
|
+
-- Knowledge triples: subject-keyed lookups dominate (queryTriples,
|
|
24
|
+
-- getTripleTimeline). Tenant + subject covers it; tenant + object
|
|
25
|
+
-- handles the timeline's OR branch.
|
|
26
|
+
CREATE INDEX IF NOT EXISTS knowledge_triples_tenant_subject_idx
|
|
27
|
+
ON knowledge_triples (tenant_id, subject);
|
|
28
|
+
CREATE INDEX IF NOT EXISTS knowledge_triples_tenant_object_idx
|
|
29
|
+
ON knowledge_triples (tenant_id, object);
|
|
30
|
+
|
|
31
|
+
-- Diary: date-range reads.
|
|
32
|
+
CREATE INDEX IF NOT EXISTS diary_entries_tenant_date_idx
|
|
33
|
+
ON diary_entries (tenant_id, date DESC);
|
|
34
|
+
|
|
35
|
+
-- Handoffs: newest-first.
|
|
36
|
+
CREATE INDEX IF NOT EXISTS handoffs_tenant_created_idx
|
|
37
|
+
ON handoffs (tenant_id, created_at DESC);
|
|
38
|
+
|
|
39
|
+
-- Daily logs: date-range reads.
|
|
40
|
+
CREATE INDEX IF NOT EXISTS daily_logs_tenant_date_idx
|
|
41
|
+
ON daily_logs (tenant_id, date DESC);
|
|
42
|
+
|
|
43
|
+
-- Rules: tenant lookup.
|
|
44
|
+
CREATE INDEX IF NOT EXISTS rules_tenant_idx
|
|
45
|
+
ON rules (tenant_id);
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@onenomad/engram-mcp",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"mcpName": "io.github.onenomad-llc/engram-mcp",
|
|
5
|
-
"description": "Engram — memory MCP server for Claude Code, plus a library API for direct in-process use. LLM-powered extraction, hybrid ANN search, tier lifecycle, spreading activation, procedural rules, real-time ingest, Mem0, and session-state.",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./dist/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./server": "./dist/server.js",
|
|
15
|
-
"./cli": "./dist/cli.js"
|
|
16
|
-
},
|
|
17
|
-
"bin": {
|
|
18
|
-
"engram-memory": "dist/server.js",
|
|
19
|
-
"engram-mcp": "dist/cli.js",
|
|
20
|
-
"engram-migrate": "dist/migrate.js"
|
|
21
|
-
},
|
|
22
|
-
"files": [
|
|
23
|
-
"dist",
|
|
24
|
-
"migrations",
|
|
25
|
-
"README.md",
|
|
26
|
-
"LICENSE",
|
|
27
|
-
"NOTICE"
|
|
28
|
-
],
|
|
29
|
-
"repository": {
|
|
30
|
-
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/OneNomad-LLC/engram-mcp.git"
|
|
32
|
-
},
|
|
33
|
-
"homepage": "https://github.com/OneNomad-LLC/engram-mcp",
|
|
34
|
-
"license": "Apache-2.0",
|
|
35
|
-
"publishConfig": {
|
|
36
|
-
"access": "public"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"clean": "rm -rf dist",
|
|
40
|
-
"build": "rm -rf dist && tsc",
|
|
41
|
-
"dev": "tsc --watch",
|
|
42
|
-
"start": "node dist/server.js",
|
|
43
|
-
"test": "node --import tsx --test tests/*.test.ts",
|
|
44
|
-
"bench": "node --import tsx benchmarks/bench.ts",
|
|
45
|
-
"bench:verbose": "node --import tsx benchmarks/bench.ts --verbose",
|
|
46
|
-
"bench:longmemeval": "node --import tsx benchmarks/longmemeval.ts",
|
|
47
|
-
"bench:locomo": "node --import tsx benchmarks/locomo.ts",
|
|
48
|
-
"bench:throughput": "node --import tsx benchmarks/ingest-throughput.ts",
|
|
49
|
-
"bench:latency": "node --import tsx benchmarks/query-latency.ts",
|
|
50
|
-
"bench:download": "bash benchmarks/download-datasets.sh",
|
|
51
|
-
"bench:all": "node --import tsx benchmarks/bench-all.ts"
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"openai": "^4.80.0",
|
|
55
|
-
"@huggingface/transformers": "^4.0.1",
|
|
56
|
-
"@lancedb/lancedb": "^0.27.2",
|
|
57
|
-
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
58
|
-
"mem0ai": "^2.4.5",
|
|
59
|
-
"zod": "^3.24.0"
|
|
60
|
-
},
|
|
61
|
-
"optionalDependencies": {
|
|
62
|
-
"pg": "^8.13.0"
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@types/node": "^22.0.0",
|
|
66
|
-
"tsx": "^4.21.0",
|
|
67
|
-
"typescript": "^5.7.0"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@onenomad/engram-mcp",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"mcpName": "io.github.onenomad-llc/engram-mcp",
|
|
5
|
+
"description": "Engram — memory MCP server for Claude Code, plus a library API for direct in-process use. LLM-powered extraction, hybrid ANN search, tier lifecycle, spreading activation, procedural rules, real-time ingest, Mem0, and session-state.",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./server": "./dist/server.js",
|
|
15
|
+
"./cli": "./dist/cli.js"
|
|
16
|
+
},
|
|
17
|
+
"bin": {
|
|
18
|
+
"engram-memory": "dist/server.js",
|
|
19
|
+
"engram-mcp": "dist/cli.js",
|
|
20
|
+
"engram-migrate": "dist/migrate.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"migrations",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"NOTICE"
|
|
28
|
+
],
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/OneNomad-LLC/engram-mcp.git"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/OneNomad-LLC/engram-mcp",
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"clean": "rm -rf dist",
|
|
40
|
+
"build": "rm -rf dist && tsc",
|
|
41
|
+
"dev": "tsc --watch",
|
|
42
|
+
"start": "node dist/server.js",
|
|
43
|
+
"test": "node --import tsx --test tests/*.test.ts",
|
|
44
|
+
"bench": "node --import tsx benchmarks/bench.ts",
|
|
45
|
+
"bench:verbose": "node --import tsx benchmarks/bench.ts --verbose",
|
|
46
|
+
"bench:longmemeval": "node --import tsx benchmarks/longmemeval.ts",
|
|
47
|
+
"bench:locomo": "node --import tsx benchmarks/locomo.ts",
|
|
48
|
+
"bench:throughput": "node --import tsx benchmarks/ingest-throughput.ts",
|
|
49
|
+
"bench:latency": "node --import tsx benchmarks/query-latency.ts",
|
|
50
|
+
"bench:download": "bash benchmarks/download-datasets.sh",
|
|
51
|
+
"bench:all": "node --import tsx benchmarks/bench-all.ts"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"openai": "^4.80.0",
|
|
55
|
+
"@huggingface/transformers": "^4.0.1",
|
|
56
|
+
"@lancedb/lancedb": "^0.27.2",
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
58
|
+
"mem0ai": "^2.4.5",
|
|
59
|
+
"zod": "^3.24.0"
|
|
60
|
+
},
|
|
61
|
+
"optionalDependencies": {
|
|
62
|
+
"pg": "^8.13.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^22.0.0",
|
|
66
|
+
"tsx": "^4.21.0",
|
|
67
|
+
"typescript": "^5.7.0"
|
|
68
|
+
}
|
|
69
|
+
}
|