{"_id":"@aman_asmuei/amem-core","_rev":"10-003fb3057376bdfbc575b1f94f4a4357","name":"@aman_asmuei/amem-core","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"@aman_asmuei/amem-core","version":"0.1.0","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.1.0","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"6bcaff46217e680e67671e5a4567b94e721c13f3","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.1.0.tgz","fileCount":56,"integrity":"sha512-mdzCwrSGHY8nTR3OxodIhz5JwGNYWp8vi6T4MRc0Cy0AH6ELt0ZU3L3+oNfc9zTorHpZc0jvuJu+DOnNZqYRbA==","signatures":[{"sig":"MEYCIQCBFiP6AIHdYh/O73gKxUobvhnNTbJa9fP/yQK2SGM2TgIhAK0sMyw5lQUqlAw56/GgUGuS8v43zgA2b6xbHBXkzqs+","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":325323},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"9dfda261ea33fa28112634581c0a43b774e3a4bd","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","better-sqlite3":"^12.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"optionalDependencies":{"hnswlib-node":"^3.0.0","@huggingface/transformers":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.1.0_1775271207466_0.3512855204832557","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@aman_asmuei/amem-core","version":"0.2.0","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.2.0","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"61209513c6ed1a6319466eff8b68d673bc8fdb8b","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.2.0.tgz","fileCount":56,"integrity":"sha512-IuYtJaRHC/m6Uhk43cnNL8+YieP2Qe0NfTQn4eUW2fBm4Y2aQ5h+8bS/4KMHMzl3tVOgQGQ13Ux4TyCDFAuk9Q==","signatures":[{"sig":"MEQCIASeUkeO5RnqnoOOgcZld0HGkuf/7JHmOOPaTMruIfbJAiBUYnkKc86yS85kPkmENEsmDeJN/mWYDfn2+2KwllKOCw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":339274},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"a463f5a7e7c90f2d7ae3630d6d80e0f6c133ce8f","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","better-sqlite3":"^12.0.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"optionalDependencies":{"hnswlib-node":"^3.0.0","@huggingface/transformers":"^3.8.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.2.0_1775322215805_0.999197765206217","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aman_asmuei/amem-core","version":"0.3.0","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.3.0","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"09517b0beb66bb2a41621dac723097770a05c473","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.3.0.tgz","fileCount":56,"integrity":"sha512-rPwl0QbslihyVSRqaevs8+AMvReLUueEC4hp/RWlSVzhbbTyq9BdbvR1DdtmY/XeFCGU6y7RWtwvvZYt7p+uMQ==","signatures":[{"sig":"MEYCIQDPA8hyff9A00+T5VujpFl+EqAhXi2re+6FBCzKyWlaoQIhANX+zHMwEzpOJLy+TKVaBeyebbV5rf5rp93SdWlcv4gG","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":341109},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"4850069ff06deed70ac66048a9c4b1abf8ba2583","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.3.0_1775562008450_0.11473215652522839","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@aman_asmuei/amem-core","version":"0.4.0","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.4.0","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"e6d596a774d5ee466ed144e49a46edaf9a1893a5","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.4.0.tgz","fileCount":56,"integrity":"sha512-//fxyDwFF1ipMVMT9px1y6xlMUgYd/PtvD5sii/T40tAQ4FzA05KRAVhGF1+QAAkfdIZA0guT/+r6f9nfPxblw==","signatures":[{"sig":"MEQCICMczAzHq6hn5i23bO9FhdnAd4X5tR4Dg2wKYRopbN5nAiBdpqUTgNxQ39opXElyNE/3Ii1Rpa+j0mveUqUWIzAHKQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":356042},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"2274b578554a2acd40cf5975e2f77ed292da96a4","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.4.0_1775575679999_0.6340020355359486","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@aman_asmuei/amem-core","version":"0.4.1","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.4.1","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"16fb1ae5740dfd78e6d60aa420a22e5f96106390","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.4.1.tgz","fileCount":56,"integrity":"sha512-bZnMkY+eU+ZMxgnTtgfKwgmeo9c7/lkpRGzDR+gnzwIiGjU82b9/Rpb+bK9xpojqx4FVrzyk3NnPWDXWewxXMg==","signatures":[{"sig":"MEUCIDyHcBAu+fjR7EkKoAl1P9dVXBu55zx77C73OgMW3OSWAiEAm0irYMm0zlPcXE8dBkdeFL54++Z0E4X7BKg32PBLVxI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":356072},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"5cd833bc80f75acfb3acb0a6af5f69083927c0d9","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.4.1_1775578024436_0.6498694985770692","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@aman_asmuei/amem-core","version":"0.4.2","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.4.2","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"aaedbb1f3411837c0e565c83a69d69f974c2d119","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.4.2.tgz","fileCount":56,"integrity":"sha512-9BEocnkd47zAqYVF4S6Pbrx4Kf/g5XGSdnZ2NeE/pYj5mncd79MOgwQVnOIr9KXOsPWm48IwETaq65QJdK7umw==","signatures":[{"sig":"MEUCIDjNR7wGYOStV8iMbz3nqPIPAYjM/rlIqg0fET68BoOfAiEAxHP+zRvBXzin0x1GiJNFbayJg4paZW/bXHWsCPcLjuM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":360185},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"dd2237671dbd5d2f5cf7f7955274fc46b980adbe","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.4.2_1775607223408_0.637501618266058","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@aman_asmuei/amem-core","version":"0.5.0","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.5.0","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"9920a0fbb6086e33a37b4fa554354ad511173e35","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.5.0.tgz","fileCount":56,"integrity":"sha512-SBxctehOFuHxYx5/r5d7C7WapyfsARbxVQcBe2zCBFAOqfpCjptsaXDuNZTD5Wo62IT+20keMhCScEujGqdwbg==","signatures":[{"sig":"MEUCIHEt6B2Osj9kBwIrM5Rdhho518KM5WgFz5SsSOXpjZ2GAiEApu6EDtNhWjQ4fLm6DnOuKjY0YV/9TOvRl3AKTVSm138=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":371038},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"922bf39a92e02ca5335b1a730cb649464dfcf9b2","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.5.0_1775652999559_0.5724049593925866","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@aman_asmuei/amem-core","version":"0.5.1","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.5.1","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"abbf71a8b7336931b67aff0ef2f277ab4d67e0f0","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.5.1.tgz","fileCount":56,"integrity":"sha512-HNhbrlQWfKof95/hk9WH3AcPVu9Ux8zcMWAl2hTfW3ZkeTnJhHm5gGGDKm9IlzqoFk2w5wbZ5pGC/APRtZjCaQ==","signatures":[{"sig":"MEYCIQC0rkjqcRgYkJ6qmO0bN27vWT6b65hSq9tI3zHn7dm1mAIhAMdEK1dLnh4u5UQkd4EBRWMzYIkGtP5e6QpCILNEg82v","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":375009},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"34802d72189d261fdecd2398d6d7b109ed9c37f1","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.5.1_1776208783856_0.38133798709917976","host":"s3://npm-registry-packages-npm-production"}},"0.5.2":{"name":"@aman_asmuei/amem-core","version":"0.5.2","author":{"name":"Aman Asmuei"},"license":"MIT","_id":"@aman_asmuei/amem-core@0.5.2","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"homepage":"https://github.com/amanasmuei/amem#readme","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"dist":{"shasum":"1be99e667b0baa8fc92374f7af8c6b359510d2b8","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.5.2.tgz","fileCount":56,"integrity":"sha512-bjQ1PYzvPNknE0VP5Q33sXuC71IkAiRcy7rYIUWq52qAA4yUKwvv6KO/D8m/+cNchZ4+c/HA0q5wH7ALYb+uNA==","signatures":[{"sig":"MEQCIDqCjJ97EJXRdKMC8l5Lc3UPvVSvULh55HoEnxDlfmKtAiA+8TvJvyKBzqwDQLROmH5YEof0w0fzkQKZoPz9f4beJQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":381452},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"e8f40b580ea9b4a867f56c0a31b75e56cfa60a99","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","prepare":"npm run build","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts"},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"repository":{"url":"git+https://github.com/amanasmuei/amem.git","type":"git","directory":"amem-core"},"_npmVersion":"10.9.7","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","directories":{},"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.25.0","hnswlib-node":"^3.0.0","better-sqlite3":"^12.0.0","@huggingface/transformers":"^3.8.0"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.21.0","vitest":"^3.0.0","typescript":"^5.6.0","@types/node":"^22.0.0","@types/better-sqlite3":"^7.6.0"},"_npmOperationalInternal":{"tmp":"tmp/amem-core_0.5.2_1776224388285_0.07525205511892374","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@aman_asmuei/amem-core","version":"0.6.0","description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc","dev":"tsc --watch","test":"vitest run","test:watch":"vitest","bench:quick":"tsx bench/quick-recall.ts","bench:longmemeval":"tsx bench/longmemeval/run.ts","prepare":"npm run build"},"dependencies":{"@huggingface/transformers":"^3.8.0","better-sqlite3":"^12.0.0","hnswlib-node":"^3.0.0","zod":"^3.25.0"},"devDependencies":{"@types/better-sqlite3":"^7.6.0","@types/node":"^22.0.0","tsx":"^4.21.0","typescript":"^5.6.0","vitest":"^3.0.0"},"engines":{"node":">=18.0.0"},"license":"MIT","author":{"name":"Aman Asmuei"},"repository":{"type":"git","url":"git+https://github.com/amanasmuei/amem.git","directory":"amem-core"},"_id":"@aman_asmuei/amem-core@0.6.0","gitHead":"de4cb8bce82ccd34e1b87e6df10d41bdcdd7cd9e","bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"homepage":"https://github.com/amanasmuei/amem#readme","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-Y77fGkFywX0GdcyLbYNFX6tooEU3XuWp1Q/laxuej3kJKhg0ao9KASSsQUTeqMV9fa/g9ueRRboTprAfZf2PaQ==","shasum":"2fc66c7eaddf8aa38b190a21ee1e670a84399a02","tarball":"https://registry.npmjs.org/@aman_asmuei/amem-core/-/amem-core-0.6.0.tgz","fileCount":59,"unpackedSize":404307,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDem4FpeQM7kQpQO9L5Ygr/9JSnpQcC1R6+RX0Dyq3OJQIhAN5X7eDMQa84DcwmY/JDMRN1KGhh7oV9oYlOQHnL90bx"}]},"_npmUser":{"name":"aman_asmuei","email":"amanasmuei@gmail.com"},"directories":{},"maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/amem-core_0.6.0_1776561188981_0.4807243434223609"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-04T02:53:27.332Z","modified":"2026-04-19T01:13:09.249Z","0.1.0":"2026-04-04T02:53:27.610Z","0.2.0":"2026-04-04T17:03:35.965Z","0.3.0":"2026-04-07T11:40:08.605Z","0.4.0":"2026-04-07T15:28:00.171Z","0.4.1":"2026-04-07T16:07:04.607Z","0.4.2":"2026-04-08T00:13:43.554Z","0.5.0":"2026-04-08T12:56:39.769Z","0.5.1":"2026-04-14T23:19:44.060Z","0.5.2":"2026-04-15T03:39:48.442Z","0.6.0":"2026-04-19T01:13:09.129Z"},"bugs":{"url":"https://github.com/amanasmuei/amem/issues"},"author":{"name":"Aman Asmuei"},"license":"MIT","homepage":"https://github.com/amanasmuei/amem#readme","repository":{"type":"git","url":"git+https://github.com/amanasmuei/amem.git","directory":"amem-core"},"description":"Core memory library for AI tools — database, embeddings, scoring, retrieval","maintainers":[{"name":"aman_asmuei","email":"amanasmuei@gmail.com"}],"readme":"<div align=\"center\">\n\n# amem-core\n\n### Long-term memory for AI agents that actually retrieves the right thing.\n\n**97.8% R@5 on LongMemEval-S** &nbsp;·&nbsp; **~14ms p50 recall** &nbsp;·&nbsp; Local-first &nbsp;·&nbsp; TypeScript\n\n<br/>\n\n[![npm version](https://img.shields.io/npm/v/@aman_asmuei/amem-core?style=for-the-badge&logo=npm&logoColor=white&color=cb3837)](https://www.npmjs.com/package/@aman_asmuei/amem-core)\n&nbsp;\n[![License](https://img.shields.io/badge/license-MIT-blue?style=for-the-badge)](./LICENSE)\n&nbsp;\n![Node](https://img.shields.io/badge/node-%E2%89%A518-brightgreen?style=for-the-badge&logo=node.js&logoColor=white)\n&nbsp;\n![TypeScript](https://img.shields.io/badge/TypeScript-strict-3178c6?style=for-the-badge&logo=typescript&logoColor=white)\n&nbsp;\n![Tests](https://img.shields.io/badge/tests-285%20passing-brightgreen?style=for-the-badge)\n\n<br/>\n\n[**Benchmarks**](#-benchmarks) &nbsp;·&nbsp;\n[**Quick Start**](#-quick-start) &nbsp;·&nbsp;\n[**Capabilities**](#-whats-inside) &nbsp;·&nbsp;\n[**API**](#-api-reference) &nbsp;·&nbsp;\n[**vs mempalace**](#-honest-comparison) &nbsp;·&nbsp;\n[**Roadmap**](#-roadmap)\n\n</div>\n\n---\n\n## 📊 Headline numbers\n\n<div align=\"center\">\n\n| Variant / Metric | **R@1** | **R@3** | **R@5** | **R@10** |\n|:---|:---:|:---:|:---:|:---:|\n| **LongMemEval-S, session-level** *(apples-to-apples with mempalace)* | **95.0%** | **97.0%** | **🏆 97.8%** | **99.0%** |\n| **LongMemEval-Oracle, turn-level** *(strict paper metric)* | 66.2% | 90.8% | 94.6% | 97.5% |\n\n*v0.5.1 default pipeline (bi-encoder + int8 batched cross-encoder reranker), all 500 questions scoreable, zero API calls. Recall latency: **13.9ms p50** on synthetic 60-query workload (`bench/profile-recall.ts`).*\n\n</div>\n\nThese are real numbers from a real run, on a real benchmark, with the package you can `npm install` right now. Reproducible: `npm run bench:longmemeval`.\n\n---\n\n## 🤔 Why this exists\n\nMost AI memory systems fall into one of two traps:\n\n1. **Toy demos** that store and retrieve happy-path strings, with no published numbers.\n2. **Research projects** that achieve great recall but ship in Python with vector DBs, model servers, and a deployment story that doesn't fit your TypeScript app.\n\n`amem-core` is the missing middle: **production-grade retrieval quality, in-process, single dependency, runs anywhere Node runs.** No Docker. No Pinecone. No OpenAI key. No Python.\n\n---\n\n## 🚀 Quick start\n\n```bash\nnpm install @aman_asmuei/amem-core\n```\n\n```ts\nimport { createDatabase, storeMemory, recall } from \"@aman_asmuei/amem-core\";\n\n// 1. Open (or create) a memory database — single SQLite file\nconst db = createDatabase(\"./my-memory.db\");\n\n// 2. Store a few memories\nawait storeMemory(db, {\n  content: \"PostgreSQL is the default database for all backend services.\",\n  type: \"decision\",\n  tags: [\"database\", \"infrastructure\"],\n});\n\nawait storeMemory(db, {\n  content: \"Authentication uses JWT tokens signed with RS256, 15-minute expiry.\",\n  type: \"fact\",\n  tags: [\"auth\", \"security\"],\n});\n\nawait storeMemory(db, {\n  content: \"Never deploy to production on Friday afternoons.\",\n  type: \"decision\",\n  tags: [\"deployment\", \"policy\"],\n});\n\n// 3. Recall semantically — no exact-keyword match needed\nconst result = await recall(db, {\n  query: \"what database do we use\",\n  limit: 5,\n});\n\nconsole.log(result.memories[0].content);\n// → \"PostgreSQL is the default database for all backend services.\"\n```\n\nThat's it. Embeddings download automatically on first call (~25 MB, one time). No API keys.\n\n---\n\n## 📦 What's inside\n\n`amem-core` is more than `store` + `recall`. The full feature set, all in one package:\n\n### 🔍 Retrieval\n- **Local vector embeddings** — 384-dim `bge-small-en-v1.5` via `@huggingface/transformers`. No API keys, no network calls after first model download.\n- **HNSW approximate-nearest-neighbour** index via `hnswlib-node` for fast semantic search at scale.\n- **Hybrid recall** — combines vector similarity, FTS5 full-text, tag matching, and recency scoring.\n- **Query expansion** — rewrites short queries into richer search terms before recall.\n- **Cross-encoder reranking** — optional precision boost on top-K candidates.\n\n### ⏱ Temporal model\n- **Validity windows** — every memory has `valid_from` and `valid_until`. Recall filters expired memories by default.\n- **\"What was true in January?\"** — explicit temporal queries supported via `validUntil`-aware filtering.\n- **Auto-expire on contradiction** — when a new memory contradicts an existing one (high cosine similarity, conflicting content), the old one is auto-expired with a reason logged.\n\n### 🧠 Knowledge graph\n- **Memory relations** — typed edges (`relates_to`, `contradicts`, `supersedes`, etc.) with their own validity windows.\n- **Auto-relate** — discovers and creates relations between newly-stored memories automatically.\n\n### 🪞 Reflection & quality\n- **Clustering** — groups related memories for higher-level insights.\n- **Contradiction detection** — flags conflicting facts with configurable similarity thresholds.\n- **Gap analysis** — identifies underrepresented topics so you know what's missing.\n- **Consolidation** — merges duplicates, prunes stale, promotes frequently accessed, decays idle.\n\n### 🏢 Multi-tenancy\n- **Per-scope storage** — every memory is tagged with a `scope` string (e.g. `dev:plugin`, `tg:12345`, `agent:productivity`). One DB, many tenants, no cross-contamination.\n- **Tier management** — `active` / `archived` / `expired` tiers with explicit transitions.\n- **Doctor command** — health check across DB integrity, embedding freshness, schema migrations.\n\n---\n\n## 📊 Benchmarks\n\n### LongMemEval (Oracle) — turn-level recall\n\n[LongMemEval](https://github.com/xiaowu0162/LongMemEval) is the standard long-term-memory benchmark for LLM systems, by Wu et al. The Oracle variant contains **500 evaluation questions** across six task types (single-session, multi-session, knowledge-update, temporal-reasoning) with gold-evidence turns labelled in each conversation history.\n\n**Setup:** default `amem-core` recall pipeline — local `bge-small-en-v1.5` bi-encoder embeddings + `Xenova/ms-marco-MiniLM-L-6-v2` cross-encoder *adaptively* reranking the top-30 candidates (skipped for advice-seeking queries where the MS-MARCO reranker systematically hurts). All in-process. All CPU. No API keys.\n\n<div align=\"center\">\n\n| Metric | Score |\n|:---:|:---:|\n| **R@1**  | **66.2%** |\n| **R@3**  | **90.8%** |\n| **R@5**  | **🏆 94.6%** |\n| **R@10** | **97.5%** |\n\n**479** scoreable questions · **301s** runtime · **CPU only** · **Node 22**\n\n</div>\n\n#### Pipeline evolution\n\nThree tracked runs on the same 500-question set, same hardware:\n\n| Pipeline | R@1 | R@3 | R@5 | R@10 | recall p50 |\n|:---|---:|---:|---:|---:|---:|\n| v0.3.0 — bi-encoder only | 46.6% | 78.5% | 91.0% | 97.7% | — |\n| v0.4.0 — + cross-encoder reranker | 64.9% | 91.0% | 94.6% | 97.7% | — |\n| v0.4.2 — + adaptive rerank | 65.6% | 91.0% | 94.8% | 97.7% | ~38ms |\n| **v0.5.1 — + batched + int8 rerank (current)** | **66.2%** | **90.8%** | **94.6%** | **97.5%** | **13.9ms** |\n| Δ (v0.3.0 → v0.5.1) | **+19.6** | **+12.3** | **+3.6** | -0.2 | — |\n\nEach step is a real, reproducible benchmark run — not a projection. The small R@3/R@5/R@10 dip from v0.4.2 → v0.5.1 is **1 question of 479** (within run-to-run noise); the rank-correlation between v0.4.2 fp32 and v0.5.1 int8 is **0.995**, and R@1 actually improved.\n\n#### Per question type (current)\n\n| Type | n | R@1 | R@3 | R@5 | R@10 |\n|:---|---:|---:|---:|---:|---:|\n| `single-session-user` | 64 | **84.4%** 🏆 | 95.3% | 96.9% | 98.4% |\n| `multi-session` | 125 | 71.2% | 92.8% | 97.6% | 99.2% |\n| `knowledge-update` | 72 | 59.7% | 95.8% | **100.0%** 🏆 | 100.0% |\n| `single-session-preference` | 30 | 63.3% | 90.0% | 96.7% | 96.7% |\n| `single-session-assistant` | 56 | 58.9% | 85.7% | 87.5% | 94.6% |\n| `temporal-reasoning` | 132 | 59.8% | 86.4% | 90.2% | 95.5% |\n\n#### Reproduce it yourself\n\n```bash\ngit clone https://github.com/amanasmuei/amem-core.git\ncd amem-core\nnpm install\ncurl -sL -o bench/longmemeval/longmemeval_oracle.json \\\n  https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned/resolve/main/longmemeval_oracle.json\nnpm run bench:longmemeval\n```\n\nQuick smoke test on 5 questions: `LME_SAMPLE=5 npm run bench:longmemeval`\n\n#### Recall latency (v0.5.1+)\n\nPer-stage latency, synthetic 60-query workload, cold-cache queries, M-class macOS:\n\n| Stage | p50 | share |\n|:---|---:|---:|\n| embed (bi-encoder, `bge-small-en-v1.5`) | 3.0ms | 22% |\n| retrieve (HNSW + multi-strategy + SQLite) | 0.1ms | 1% |\n| **rerank (batched int8 cross-encoder, top-30)** | **10.3ms** | **74%** |\n| **Total** | **13.9ms** | 100% |\n\nVersus v0.4.2 (sequential fp32 cross-encoder):\n\n| | v0.4.2 | v0.5.1 | Δ |\n|:---|---:|---:|---:|\n| rerank p50 | 34.5ms | **10.3ms** | **3.3x faster** |\n| total recall p50 | 38.4ms | **13.9ms** | **2.8x faster** |\n| steady-state RSS | 767 MB | **551 MB** | **-28%** |\n\nTwo changes, no API surface impact:\n\n1. **Cross-encoder is now batched.** The previous path ran N individual `tokenizer(pair) → model(inputs)` calls sequentially (\"one at a time to keep peak memory low\"). Re-measured — a single batched call per chunk of 64 pairs is strictly faster AND lower peak RSS (less GC churn). Scores bit-identical (`bench/rerank-batch-probe.ts`).\n2. **Cross-encoder is loaded with `dtype: \"int8\"`.** Rank-correlation 0.995 with fp32 baseline, top-1 agreement is 100% on the probe set. fp16 was tested and is *slower* on CPU (no hardware half-float path in onnxruntime-node) — do not use.\n\nEnable the stage profiler yourself via `AMEM_PROFILE=1` — `getProfileSamples()` exports the per-stage samples. Zero overhead when unset.\n\n#### Honest notes\n\n- **The cross-encoder reranker is the headline win.** Lifted R@1 from 46.6% → 66.2% (+19.6) and R@3 from 78.5% → 90.8% (+12.3) across the full 500-question set. Default-on; opt out with `recall(db, { query, rerank: false })` for the fastest possible path.\n- **Adaptive rerank fixes the preference regression.** The MS-MARCO-trained cross-encoder systematically promotes assistant-paraphrase text above the user's original preference statement. `amem-core` detects advice-seeking queries (`recommend`, `suggest`, `any tips`, `help me find`...) and falls back to bi-encoder order for those, while still reranking direct lookup queries. Preference R@5 recovered from 93.3% → 96.7% (+3.4). Details: see `isAdviceSeekingQuery()` in `src/recall.ts` and the diagnostic in `bench/preference-diag.ts`.\n- **Temporal reasoning is still the weakest type** (90.2% R@5). `amem-core` stores `valid_from` / `valid_until` per memory but the default scorer doesn't yet use them as ranking signals. Next ticket.\n- **HNSW ANN index** exists in the codebase but isn't wired into the default recall path — currently exposed only via `buildVectorIndex` for explicit batched search at scale. Only matters at 100k+ memory scale.\n- Run is fully reproducible — every commit can re-execute the benchmark and append to `bench/longmemeval/results.json`.\n\n#### Implementation note: cross-encoder via raw model API\n\nThe reranker uses `Xenova/ms-marco-MiniLM-L-6-v2`. We deliberately bypass the higher-level `pipeline(\"text-classification\", ...)` API in `@huggingface/transformers` and call `AutoTokenizer` + `AutoModelForSequenceClassification` directly to read the raw relevance logit. The pipeline normalizes single-class regression heads to a constant `score: 1.0` for every input — silently broken for ranking. Verified via probe scripts in `bench/rerank-probe*.ts`. See the `Cross-Encoder Reranker` block in `src/embeddings.ts` for the implementation.\n\n### LongMemEval-S — session-level recall (apples-to-apples)\n\nSame dataset and metric mempalace publishes against. **500/500 questions scoreable** (no N/A). All-default pipeline, zero API calls.\n\n<div align=\"center\">\n\n| Metric | Score |\n|:---:|:---:|\n| **R@1**  | **95.0%** |\n| **R@3**  | **97.0%** |\n| **R@5**  | **🏆 97.8%** |\n| **R@10** | **99.0%** |\n\n**500** scoreable questions · **14,033s** runtime *(≈3.9h on M-class CPU; embedding-storage dominates)* · mean gold rank **1.24**\n\n</div>\n\n#### Per question type\n\n| Type | n | R@1 | R@3 | R@5 | R@10 |\n|:---|---:|---:|---:|---:|---:|\n| `single-session-assistant` | 56 | **100.0%** 🏆 | 100.0% | 100.0% | 100.0% |\n| `knowledge-update` | 78 | 98.7% | **100.0%** | 100.0% | 100.0% |\n| `single-session-user` | 70 | 98.6% | 100.0% | 100.0% | 100.0% |\n| `multi-session` | 133 | 97.0% | 98.5% | 98.5% | 99.2% |\n| `temporal-reasoning` | 133 | 91.0% | 94.0% | 95.5% | 97.0% |\n| `single-session-preference` | 30 | 76.7% | 83.3% | 90.0% | **100.0%** |\n\n**Reproduce:**\n\n```bash\nLME_VARIANT=s LME_METRIC=session npm run bench:longmemeval\n```\n\n#### Honest notes for the S-session run\n\n- **`single-session-preference` is the new weakest type** at R@1 76.7% — the cross-encoder's bias toward assistant-paraphrase text still bites on session-level scoring even with adaptive rerank. Open work.\n- **`temporal-reasoning` improves dramatically from turn-level to session-level** (R@5: 90.2% → 95.5%). Time signals matter most for ranking the *exact* gold turn; at session granularity, getting the right conversation is enough.\n- **`single-session-assistant` is a perfect 100% across the board.** When the assistant turn is the answer, the cross-encoder loves it.\n- All numbers are reproducible from the committed `bench/longmemeval/run.ts` against the public `longmemeval_s_cleaned.json` dataset.\n\n### Quick recall (proof-of-life)\n\nA small hand-crafted sanity benchmark — 20 distinct memories, 10 lookup queries with known gold-truth. For fast smoke tests during development.\n\n| Metric | Score |\n|---|---|\n| R@1  | 70.0% |\n| R@3  | 90.0% |\n| R@5  | 90.0% |\n| R@10 | 100.0% |\n\n```bash\nnpm run bench:quick\n```\n\n---\n\n## 🥊 Honest comparison\n\nHow `amem-core` stacks up against [mempalace](https://github.com/MemPalace/mempalace), the most-talked-about open-source AI memory system.\n\n**Before the headline numbers — the methodology you need to compare fairly:**\n\nLongMemEval has three dataset variants and two scoring granularities, and they produce *very* different numbers on the same system:\n\n| Axis | Easier ← → Harder |\n|---|---|\n| **Variant** | Oracle (evidence-only, no distractors) → S (~40 sessions/Q) → M (~500 sessions/Q) |\n| **Metric** | Session-level R@K (did any retrieved item belong to the gold *session*?) → Turn-level R@K (did it hit the gold *message*?) |\n\nSession-level ≥ turn-level on the same data by construction. Oracle ≥ S ≥ M by construction. A \"94.6% R@5\" and a \"96.6% R@5\" are not comparable unless you know which axis each was measured on.\n\n### The numbers, honestly labelled\n\n| Measurement | amem-core (v0.5.1) | mempalace |\n|---|---|---|\n| **Oracle, turn-level R@5** | **94.6%** *(default pipeline)* | not reported |\n| **Oracle, session-level R@5** | **100.0%** *(500/500 Q)* | not reported |\n| **S, turn-level R@5** | 91.2% *(v0.4.2 baseline; v0.5.1 re-run pending)* | not reported |\n| **S, session-level R@5** | **🏆 97.8%** *(500/500 Q, default pipeline, no API)* | 96.6% *(raw ChromaDB, no LLM)* |\n| **S, session-level R@5 (with LLM rerank)** | *not implemented* | 98.4% on held-out / 100.0% on full set *(Claude Haiku, ~500 API calls per run)* |\n\n**The apples-to-apples row is \"S, session-level R@5\":** amem-core lands at **97.8%** (R@1 95.0%, R@3 97.0%, R@10 99.0%, all 500 questions scoreable). That is **+1.2pp above mempalace's raw-mode headline number** and just **0.6pp behind their LLM-reranked held-out number** — with zero API calls and no Python/ChromaDB process.\n\nThe mempalace \"100%\" figure comes with [their own disclosure](https://github.com/MemPalace/mempalace/blob/develop/benchmarks/BENCHMARKS.md) that three targeted fixes were written after examining specific failing questions — they call it *\"teaching to the test\"* explicitly. On a clean 450-Q held-out split the honest number is **98.4%** (still with Haiku reranking).\n\n### Capability-wise\n\n| | **amem-core** | mempalace |\n|---|---|---|\n| **Runtime** | TypeScript / Node (≥18) | Python 3.9+ |\n| **Storage** | SQLite (single file) | SQLite + ChromaDB |\n| **Vector index** | HNSW (`hnswlib-node`) | ChromaDB |\n| **Embeddings** | Local `bge-small-en-v1.5`, no API | Local (ChromaDB default) |\n| **Cross-encoder rerank** | Local `ms-marco-MiniLM` (int8, batched) | Optional Claude Haiku API |\n| **Zero API keys for default pipeline** | ✅ | ✅ *(raw mode only)* |\n| **Recall latency (p50)** | **~14 ms** local only | not published |\n| **Validity windows** | ✅ `valid_from` / `valid_until` | ✅ |\n| **Contradiction detection** | ✅ auto-expire | ✅ |\n| **Knowledge graph** | ✅ typed relations | ✅ |\n| **Multi-tenant** | ✅ scope-routed | ✅ wings/rooms |\n| **Single dependency tree** | ✅ pure `npm install` | ❌ Python + ChromaDB server |\n| **Install size** | ~250 MB (with model) | ~500 MB+ |\n\n### Honest takeaways\n\n1. **On the apples-to-apples benchmark (S + session-level), amem-core wins on raw quality.** 97.8% R@5 vs mempalace's 96.6% raw, with zero API calls. mempalace pulls ahead only when they layer Claude Haiku reranking on top (98.4% held-out / 100% with admitted overfitting), which costs ~500 API calls per run.\n2. **The Haiku-rerank path is open to amem-core too.** It's deliberately not in the default pipeline because the local cross-encoder reaches 97.8% on its own and the marginal lift to ~98.5% isn't worth the API dependency for most deployments. If you want it, it's straightforward to add as an opt-in.\n3. **The real choice is about the deployment shape, not the recall percentage.** Pick `amem-core` for a TypeScript stack with zero API dependencies and one `npm install`. Pick mempalace for a Python stack with deeper LLM-routing scaffolding if that's the shape you want.\n\n---\n\n## 📚 API reference\n\n### `createDatabase(path: string): AmemDatabase`\n\nOpens (or creates) a SQLite database at `path` with WAL mode, FTS5, and all required tables and indexes.\n\n### `storeMemory(db, opts): Promise<StoreResult>`\n\nStore a memory. Auto-generates the embedding, auto-detects contradictions, auto-expires superseded memories, auto-discovers relations.\n\n| Field | Type | Default | Description |\n|---|---|---|---|\n| `content` | `string` | *(required)* | The memory text |\n| `type` | `MemoryTypeValue` | `\"fact\"` | `correction` / `decision` / `pattern` / `preference` / `topology` / `fact` |\n| `tags` | `string[]` | `[]` | Searchable tags |\n| `confidence` | `number` | `0.8` | 0-1 confidence score |\n| `scope` | `string` | `\"global\"` | Tenant / project scope |\n| `source` | `string` | `\"conversation\"` | Provenance of the memory |\n\n### `recall(db, opts): Promise<RecallResult>`\n\nHybrid semantic + keyword + recency search.\n\n| Field | Type | Default | Description |\n|---|---|---|---|\n| `query` | `string` | *(required)* | Search query |\n| `limit` | `number` | `10` | Max results |\n| `type` | `string` | `undefined` | Filter by memory type |\n| `tag` | `string` | `undefined` | Filter by tag |\n| `scope` | `string` | `undefined` | Filter by scope |\n| `minConfidence` | `number` | `undefined` | Minimum confidence threshold |\n| `explain` | `boolean` | `false` | Include score breakdown per result |\n\n### `buildContext(db, topic, opts?): Promise<ContextResult>`\n\nLoad all relevant context for a topic, organized by memory type with token budgeting.\n\n### `consolidateMemories(db, cosineSim, opts): ConsolidationReport`\n\nMerge duplicates, prune stale memories, promote frequently accessed ones, decay idle ones.\n\n### `reflect(db, opts?): ReflectionReport`\n\nRun the reflection layer: clustering, contradiction detection, gap analysis, synthesis candidates.\n\n### `generateEmbedding(text: string): Promise<Float32Array | null>`\n\nGenerate a 384-dim embedding vector using `bge-small-en-v1.5`. Returns `null` if the model is not yet loaded.\n\n### `syncFromClaude(db, projectFilter?, dryRun?): Promise<SyncResult>`\n\nImport Claude Code auto-memory files (`~/.claude/projects/*/memory/*.md`) into amem.\n\n### `syncToCopilot(db, opts?): CopilotSyncResult`\n\nExport amem memories to `.github/copilot-instructions.md`, grouped by type, wrapped in `<!-- amem:start/end -->` markers. Preserves existing non-amem content.\n\n```ts\nimport { createDatabase, syncToCopilot } from \"@aman_asmuei/amem-core\";\n\nconst db = createDatabase(\"~/.amem/memory.db\");\nconst result = syncToCopilot(db, { projectDir: \"/my/project\" });\n// → { file: \"/my/project/.github/copilot-instructions.md\", memoriesExported: 12 }\n```\n\n### `runDiagnostics(db): DiagnosticReport`\n\nHealth check across DB integrity, embedding freshness, schema migrations, vector index state.\n\n> Full type definitions ship with the package — your editor will autocomplete the rest.\n\n---\n\n## 🏗 Architecture\n\n```\n                    ┌─────────────────────────────┐\n                    │      your application       │\n                    └──────────────┬──────────────┘\n                                   │\n                                   ▼\n                  ┌─────────────────────────────────┐\n                  │       @aman_asmuei/amem-core    │\n                  │                                 │\n                  │   ┌──────────┐  ┌──────────┐    │\n                  │   │  store   │  │  recall  │    │\n                  │   └────┬─────┘  └────┬─────┘    │\n                  │        │             │          │\n                  │   ┌────▼─────────────▼─────┐    │\n                  │   │   embeddings (HF)       │   │\n                  │   │   bge-small-en-v1.5     │   │\n                  │   └────────────┬────────────┘   │\n                  │                │                │\n                  │   ┌────────────▼────────────┐   │\n                  │   │   HNSW (hnswlib-node)   │   │\n                  │   └────────────┬────────────┘   │\n                  │                │                │\n                  │   ┌────────────▼────────────┐   │\n                  │   │   SQLite + FTS5 + WAL   │   │\n                  │   └─────────────────────────┘   │\n                  └─────────────────────────────────┘\n```\n\nSingle dependency tree. No Python. No vector DB process. No API keys. The whole engine is one `npm install` and one `.db` file.\n\n---\n\n## 🛣 Roadmap\n\nNearest tickets, in priority order:\n\n- [x] **Wire cross-encoder reranking into default recall path** — shipped: R@1 46.6% → 64.9% (+18.3), R@5 91.0% → 94.6% (+3.6)\n- [x] **Skip rerank for advice-seeking queries** — shipped: preference R@5 recovered 93.3% → 96.7%, overall R@5 94.6% → 94.8%\n- [x] **Batched + int8-quantized cross-encoder** — shipped in v0.5.1: rerank 34.5ms → 10.3ms (3.3x), total recall 38.4ms → 13.9ms (2.8x), rank-corr 0.995 with fp32\n- [ ] **Time-aware ranking signal** — use `valid_from` / `valid_until` distance from query date to lift `temporal-reasoning` (currently weakest type at 89.4% R@5)\n- [ ] **Wire HNSW into the hot path** — currently exposed only via explicit `buildVectorIndex` calls\n- [ ] **Run LongMemEval-S and LongMemEval-M variants** — full haystack benchmarks, not just Oracle\n- [ ] **PDPA / GDPR export** — `exportScope(scope)` for user-data takeout requests\n- [ ] **Schema versioning sentinel** — explicit `_schema_version` table for safer future migrations\n\n---\n\n## 🧬 Relationship to amem\n\n| | **amem-core** | **amem** |\n|---|---|---|\n| **What** | Pure TypeScript library | MCP server + CLI wrapping it |\n| **Use case** | Embed in your app | Plug into Claude Code, Copilot, Cursor |\n| **Install** | `npm install @aman_asmuei/amem-core` | `npm install -g @aman_asmuei/amem` |\n\n`amem-core` is the engine. `amem` is the vehicle.\n\n---\n\n## 📜 License\n\n[MIT](./LICENSE) — use it commercially, modify it, ship it. Just don't claim you wrote it.\n\n---\n\n<div align=\"center\">\n\nBuilt with ❤️ in 🇲🇾 **Malaysia** by **[Aman Asmuei](https://github.com/amanasmuei)**\n\n[**GitHub**](https://github.com/amanasmuei/amem-core) &nbsp;·&nbsp;\n[**npm**](https://www.npmjs.com/package/@aman_asmuei/amem-core) &nbsp;·&nbsp;\n[**Issues**](https://github.com/amanasmuei/amem-core/issues)\n\n<sub>Part of the <strong><a href=\"https://github.com/amanasmuei\">aman ecosystem</a></strong> — local-first AI tools from Southeast Asia 🌏</sub>\n\n</div>\n","readmeFilename":"README.md"}