โก
@manasdb/core
core
STABLEv0.4.2Drop-in semantic memory with local embeddings, hybrid retrieval, Redis caching, PII protection, and full cost telemetry โ all in a single import.
$npm install @manasdb/coreโ
๐ Read Documentation โ29ร
Faster repeated queries (Redis)
โ50%
API cost via dedup
+9.7%
Recall accuracy vs raw stack
2
Storage providers
What's inside
Features
๐
Hybrid Retrieval
Dense ANN fused with sparse keyword search via Reciprocal Rank Fusion, diversified with Maximal Marginal Relevance.
RRF + MMRโก
Two-Tier Redis Cache
Tier 1 shared Redis + Tier 2 in-memory LRU. Both short-circuit the DB when cosine similarity โฅ 0.95.
29x faster๐ฒ
Tree Reasoning
Hierarchical chunk mapping (Document โ Section โ Leaf). Returns structured answers from the highest-scoring subtree.
reasoningRecall()๐ก๏ธ
PII Shield
Regex-based redaction of emails, phone numbers, SSNs, and custom patterns before any text hits your database.
Before storage๐
Cost Telemetry
Tracks tokens, API cost, and latency savings in _manas_telemetry on your own DB. Never leaves your server.
npx manas stats๐
Trace Debugging
Every recall() emits full pipeline audit: cache status, PII tokens scrubbed, candidate counts, final score.
_trace on every call๐
Polyglot Broadcasting
Write once, sync to MongoDB and PostgreSQL simultaneously โ great for migration, replication, or benchmarking.
absorb() โ all๐
Custom Drivers
Plug any air-gapped or corporate embedding model. ManasDB becomes your standard interface over the stack.
source: 'custom'Examples
Quick start
index.js
import { ManasDB } from '@manasdb/core';
const memory = new ManasDB({
uri: process.env.MONGODB_URI,
modelConfig: { source: 'transformers' },
});
await memory.init();
await memory.absorb('ManasDB Core is the Node.js memory layer for AI.');
const results = await memory.recall('What is ManasDB Core?');
console.log(results[0].metadata.matchedChunk);
API Reference
Methods
absorb(text, options?)โ Promise<AbsorbResult>+recall(query, options?)โ Promise<RecallResult[]>+reasoningRecall(query, options?)โ Promise<TreeRecallResult>+init()โ Promise<void>+Compatibility
Requirements
Node.jsโฅ 18.0
MongoDBAtlas (Vector Search)
PostgreSQLpgvector
LicenseApache 2.0 + Commons Clause