Reference
MEM.* commands
Fifteen commands with no Redis equivalent. The dotted prefix follows the convention Redis modules use, so any client reaches these through the send-a-raw-command call it already has.
Every reply is a standard RESP type, which is what lets stock client libraries decode them. The tables below name the type rather than the literal bytes.
Index management
| Command | Reply |
|---|---|
| MEM.CREATE key [MODE SEARCH|VECTOR|HYBRID] [DIM n] [METRIC COSINE|L2|IP] [WEIGHTS kw vec rec imp] [HALFLIFE seconds] | OK, or an error if the key exists |
| MEM.INFO key | Map: mode, dim, metric, weights, halflife, records, vectors, terms, avg_doc_len, bytes |
| MEM.CONFIG key [WEIGHTS kw vec rec imp] [HALFLIFE seconds] | OK |
| MEM.CARD key | The live record count |
MODE defaults to HYBRID, METRIC to COSINE, and HALFLIFE to the server's mem-recency-halflife. DIM is required for any mode that stores vectors and must be at or below mem-max-dim.
Writing records
| Command | Reply |
|---|---|
| MEM.ADD key [ID id] TEXT text [VEC blob | FVEC n f1..fn] [META field value]... [IMPORTANCE x] [TTL seconds] [NX|XX] | The record id |
| MEM.DEL key id [id ...] | Number removed |
| MEM.SETMETA key id field value [field value ...] | Number of fields newly set |
| MEM.DELMETA key id field [field ...] | Number removed |
| MEM.EXPIRE key id seconds | 1 if set; 0 seconds clears the deadline |
Vectors
VEC takes raw little-endian float32 bytes, four per dimension, which is exactly what struct.pack or a Float32Array already holds. FVEC spells the same vector as decimal words so a query can be typed into redis-cli.
Importance defaults to 0.5 and is clamped to the 0.0–1.0 range. Text is capped by mem-max-text-bytes, and the tokenizer stops after mem-max-terms-per-doc terms.
Reading records
| Command | Reply |
|---|---|
| MEM.GET key id [NOTEXT] [WITHMETA] [WITHVEC] | The record as a map, or nil |
| MEM.MGET key id [id ...] | Array of records, nil per missing id |
| MEM.SCAN key cursor [COUNT n] [FILTER ...] | [next cursor, ids] |
Querying
| Command | Reply |
|---|---|
| MEM.SEARCH key query [TOPK k] [FILTER ...] [flags] | Ranked hits, keyword only |
| MEM.VSEARCH key (VEC blob | FVEC n f1..fn) [TOPK k] [FILTER ...] [flags] | Ranked hits, semantic only |
| MEM.QUERY key [TEXT query] [VEC blob | FVEC n f1..fn] [TOPK k] [WEIGHTS ...] [FUSION LINEAR|RRF] [FILTER ...] [flags] | Ranked hits, fused |
MEM.QUERY is the one to reach for. Given only TEXT it runs a keyword search, given only a vector a semantic one, and given both it fuses the two rankings.
Return flags
| Flag | Effect |
|---|---|
| NOTEXT | Omit the record text |
| WITHMETA | Include the metadata pairs |
| WITHVEC | Include the stored vector |
| WITHSCORES | Include the fused score and its four components |
Filters
Repeated FILTER field op value triples, ANDed, with EQ, NE, GT, GTE, LT, LTE, IN, and CONTAINS. A field beginning with @ reads the record rather than its metadata: @id, @text, @importance, @created_at, @updated_at. See filters & metadata.
Limits and errors
| Situation | Result |
|---|---|
| Key holds another type | WRONGTYPE error |
| MEM.SEARCH on a VECTOR index | Error: the mode cannot serve keyword search |
| MEM.VSEARCH on a SEARCH index | Error: the index stores no vectors |
| Vector length ≠ DIM | Error naming the expected dimension |
| TOPK above mem-max-topk | Error rather than a silent clamp |
| Scan would exceed mem-max-scan | The query is refused rather than partly answered |
A memory key answers TYPE, DEL, EXPIRE, TTL, PERSIST, RENAME, COPY, KEYS, SCAN, and DBSIZE. See data type commands.
