Light Dark

Functions

all

fn (store: Map, predicate: Fn): Bool

Return true if all entries match predicate. Mirrors ::hot::coll/all.

clear

fn (store: Map): Bool

Remove all entries from a store but keep the store itself.

Example

::store/clear(settings)

delete

fn (store: Map, key: Any): Bool

Delete an entry by key. Returns true if the key existed.

Example

::store/delete(kb, "refund-policy")

destroy

fn (store: Map): Bool

Delete the store entirely (schema + data).

Example

::store/destroy(old-store)

filter

fn (store: Map, predicate: Fn): Vec

Filter entries by a predicate fn(key, value) -> Bool. Returns a Vec of matching entries. Mirrors ::hot::coll/filter.

Example

billing-docs ::store/filter(kb, (k, v) { eq(v.category, "billing") })

find-first

fn (store: Map, predicate: Fn): Any

Return the first entry matching predicate, or null. Mirrors ::hot::coll/find-first.

Example

urgent ::store/find-first(kb, (k, v) { eq(v.priority, "urgent") })

first

fn (store: Map): Any

Return the first entry (by insertion order) as {key: ..., value: ...}, or null. Mirrors ::hot::coll/first.

get

fn (store: Map, key: Any): Any
fn (store: Map, key: Any, default: Any): Any

Get a value by key. Returns null if not found (2-arity) or default (3-arity). Mirrors ::hot::coll/get.

Example

doc ::store/get(kb, "refund-policy")
doc ::store/get(kb, "missing", {title: "default"})

is-empty

fn (store: Map): Bool

Return true if the store has no entries. Mirrors ::hot::coll/is-empty.

Example

empty ::store/is-empty(settings)

keys

fn (store: Map): Vec

Return all keys in insertion order. Mirrors ::hot::coll/keys.

Example

all-keys ::store/keys(kb)

last

fn (store: Map): Any

Return the last entry (by insertion order) as {key: ..., value: ...}, or null. Mirrors ::hot::coll/last.

length

fn (store: Map): Int

Return the number of entries. Mirrors ::hot::coll/length.

Example

count ::store/length(kb)

list

fn (store: Map): Vec
fn (store: Map, opts: Map): Vec

Paginated listing in insertion order.

Example

page ::store/list(kb, {limit: 20, offset: 0})

merge

fn (store: Map, entries: Map): Int

Merge a map of key-value pairs into the store. Mirrors ::hot::coll/merge.

Example

::store/merge(settings, {
  "smtp-host": "mail.example.com"
  "smtp-port": 587
})

put

fn (store: Map, key: Any, value: Any): Any

Write a key-value pair to a store. Auto-embeds if the store has embedding enabled. If the key already exists, the value is updated but insertion order is preserved.

Example

::store/put(kb, "refund-policy", {
  title: "Refund Policy"
  content: "Refunds are available within 30 days..."
})

put-many

fn (store: Map, entries: Map): Int

Batch write from a map of key-value pairs. Returns the count of entries written.

Example

::store/put-many(kb, {
  "doc-1": {title: "Returns", content: "Return within 30 days..."}
  "doc-2": {title: "Shipping", content: "We ship worldwide..."}
})

reduce

fn (store: Map, reducer: Fn, initial: Any): Any

Reduce over all entries. The reducer receives (acc, key, value). Mirrors ::hot::coll/reduce.

Example

total ::store/reduce(kb, (acc, k, v) { add(acc, v.amount) }, 0)
fn (store: Map, query: Str): Vec
fn (store: Map, query: Str, opts: Map): Vec

Semantic and/or keyword search. Returns a Vec of {key, value, score}.

Example

results ::store/search(kb, "how do I get my money back", {limit: 5, min-score: 0.7})

slice

fn (store: Map, start: Int): Vec
fn (store: Map, start: Int, end: Int): Vec

Return a range of entries by insertion position. Mirrors ::hot::coll/slice.

Example

first-ten ::store/slice(kb, 0, 10)

some

fn (store: Map, predicate: Fn): Bool

Return true if any entry matches predicate. Mirrors ::hot::coll/some.

vals

fn (store: Map): Vec

Return all values in insertion order. Mirrors ::hot::coll/vals.

Example

all-vals ::store/vals(kb)

Types

Embedding core

Embedding type {
    model: Str?,
    field: Str?,
    text-search: Bool?
}

Configuration for overriding system-level embedding defaults on a store Map.

Fields

  • model — Override the embedding model (e.g. "bge-base-en-v1.5", "text-embedding-3-small")
  • field — Which field of the value to embed (default: "content")
  • text-search — Also enable keyword search (default: false)

Map core

Map type {
    name: Str,
    embedding: Bool | Embedding?
}

A persistent, insertion-ordered map with optional embeddings and search.

Fields

  • name — Unique store name (e.g. "settings", "kb", "support:${stream-id}")
  • embeddingnull = off (default), true = system defaults, Embedding({...}) = override

Example

::store ::hot::store

// Plain persistent map
settings ::store/Map({name: "settings"})

// With semantic search
kb ::store/Map({name: "kb", embedding: true})

// With overrides
docs ::store/Map({name: "docs", embedding: ::store/Embedding({
  model: "text-embedding-3-small"
  field: "body"
  text-search: true
})})