memory-store

v1.4.4
@melandlabs/memory-store Checked 2 days ago Published 1 month ago

OpenContext memory storage + search SDK with HTTP and MCP server entry points.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

memory.health

Returns the health status of the memory store.

memory.search Search Memory

Cross-source semantic search across raw messages, insights, and uploaded knowledge. Set `synthesize: true` to opt into LLM synthesis over the gathered evidence. With synthesis enabled, the response carries `answer`, `evidence`, `results`, and `warnings`; otherwise just `results`, `evidence`, and `count`.

ParameterTypeDescription
query *string
userId *string
authTokenstring
botIdsarray
documentIdsarray
includeArchivedInsightsboolean
includeRetrievalDiagnosticsboolean
limitinteger
mergeStrategystring
reasoningStrategystringLLM reasoning strategy. `rewrite` rephrases the query before embedding; `iterative` runs a planner that searches, notes evidence, and searches again; `union` merges the planner's evidence with the bas…
responseSchemaobject
rrfKinteger
rrfWeightsobject
sessionNeighborExpansionobject
sourcesarrayDefault: ['memory','insights','knowledge','workspace']
synthesizeOpt-in LLM synthesis. `true` returns `{ answer, evidence, results, warnings }`. `synthesize.responseSchema` extracts `answer` from a JSON payload.
thresholdnumberOptional similarity floor. Omit it to let the default RRF pipeline fuse the full candidate window.
tiersarrayEvidence tiers. Default: ['raw','insight','knowledge','workspace']; synthesis additionally includes 'summary'.

memory.writeRawMessage Write Raw Message

Persist a single raw message to the user's memory store.

ParameterTypeDescription
message *object
userId *string
embedOnInsertbooleanWhen true AND the host wired `unified.embedQuery`, fill in any missing `embedding` server-side via that embedder. Required when the active memory backend is sqlite-vec and the caller doesn't pre-embed…

memory.getRawMessage Get Raw Message

Fetch a single raw message by its message id.

ParameterTypeDescription
messageId *string
userId *string

memory.consolidate Consolidate

Agentic write-back: gathers evidence like `memory.search({ synthesize: true })`, builds a memory-consolidation plan, optionally asks the LLM to veto unsafe entries, then persists via the attached graph store + soft-deprecates via the storage adapter. Set `dryRun: true` to inspect the plan without writing.

ParameterTypeDescription
ownerScopeUserId *stringRequired: who owns the writes.
query *string
userId *string
authTokenstring
botIdsarray
dateFromstring
dateTostring
dryRunboolean
expectedVersionstring
limitinteger
llmPlanReviewMaxTokensinteger
thresholdnumber
tiersarrayDefault: ['summary','raw','insight','knowledge']

memory.distill Distill Entities

Extract `EntityEdge`s from a single raw message via the host's `unified.entityExtractor`. Returns `{ edges, warnings }`. Without the extractor wired in, returns an empty list with a `distill_extractor_not_configured` warning. Persistence is the host's responsibility — the MCP transport cannot carry host-side `persist` callbacks. Call `distillRawMessage` directly from host code if you need round-trip persistence.

ParameterTypeDescription
content *string
messageId *string
userId *string

memory.derive Derive Facts

Synthesize `DerivedFact`s over a window of candidate fact texts via the host's `unified.deriver`. Returns `{ facts, warnings }`. Without the deriver wired in, returns an empty list with a `derive_deriver_not_configured` warning. Persistence is the host's responsibility — the MCP transport cannot carry host-side `persist` callbacks. Call `deriveFacts` directly from host code if you need round-trip persistence.

ParameterTypeDescription
userId *string
botIdsarray
candidateLimitinteger
candidateTextsarrayPre-computed candidate fact texts. When omitted, the SDK pulls up to `candidateLimit` (default 50) texts via the lexical sub-query.
dateFromstring
dateTostring
factTypesarrayOptional FactType filter forwarded to the lexical candidate-fetch fallback.
peersarrayOptional peer scope forwarded to the lexical candidate-fetch fallback.
querystringOptional topical query used to derive lexical keywords when `candidateTexts` is omitted. Loop-engine schedulers should pass the topic they want synthesized facts about (e.g. 'cat preferences'). Withou…
windowFromnumberOptional time-window start (ms) forwarded to the deriver.
windowTonumberOptional time-window end (ms) forwarded to the deriver.

memory.vsaStore VSA Store Fact

Persist a (role, filler) binding into the user's VSA memory. The vectors are stored as Float32 BLOBs alongside the labels; later `memory.vsaRecall` rebuilds the memory vector and picks the best vocabulary match.

ParameterTypeDescription
fillerLabel *string
fillerVector *array
roleLabel *string
roleVector *array
userId *string
botIdstring
factIdstring
scopeTagstring

memory.vsaRecall VSA Recall

Rebuild the user's VSA memory vector from stored (role, filler) facts, unbind by the requested role, and cleanup against the supplied vocabulary. Returns the best-match label plus a sorted score list and warnings (e.g. low confidence, dim mismatch).

ParameterTypeDescription
roleLabel *string
roleVector *array
userId *string
vocabulary *array
botIdstring
maxFactsinteger
scopeTagstring

memory.vsaList VSA List Facts

List the (role, filler) facts stored for a user. Vectors are stripped from the response — for the underlying storage layer, query SQLite directly.

ParameterTypeDescription
userId *string
botIdstring
includeDeprecatedboolean
scopeTagstring

memory.vsaForget VSA Forget Facts

Soft-delete one or more VSA facts by id. Idempotent — facts already deprecated return `deprecatedCount: 0`.

ParameterTypeDescription
factIds *array
userId *string
reasonstring

memory.okfImport Import OKF Document

Convert an OKF v0.2 document (YAML front-matter + Markdown body) into a RawMessage and persist it under the given userId. Returns the new messageId and factType on success, or an `issues[]` array on validation failure.

ParameterTypeDescription
document *object
userId *string
botIdstring
platformstring

memory.okfExport Export OKF Documents

Query the user's RawMessage records and return them as OKF v0.2 documents (frontMatter + body). Optional filters: botId, platform, since/until (ISO 8601 or epoch ms), okf types, includeArchived.

ParameterTypeDescription
userId *string
botIdstring
includeArchivedboolean
platformstring
sincestring
typesarray
untilstring