Skip to content

VIP-66: Experimental.Memory: durable facts, notes, history and recall across runs

Status: accepted by Will, 2026-11-23 — standard library only (no compiler or language changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implemented in the runtime as Experimental.Memory.

Will's words

Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them

Summary

One sentence. Experimental.Memory stores what the next run should still know, as facts, notes and message threads in a database, and recalls it by query within a byte budget.

One paragraph. A model's context is gone when the process exits. The journal keeps what one run did; memory keeps what every later run needs. The memory package of the reference engine (an existing Effect durable-execution framework these built-ins are modelled on) stores rows in SQLite or PostgreSQL, scopes them by namespace, and makes recall a replaceable service: keyword matching, full-text search, or semantic search over embeddings. This VIP ports it. A program calls Memory.remember and Memory.recall. A model gets the same two operations as Memory.tools, bound to one namespace. The store is a layer, so a test swaps a file for an in-memory database with one line.

 run 1:  Memory.remember({ bank: "global-notes", key: "release", text: "cut 0.1.0" })
                                   │
                              ┌────▼─────┐   facts      one row per bank and key
                              │  Memory  │   notes      append-only, corrected by supersession
                              │  store   │   threads    messages, appended once by id
                              └────┬─────┘
 run 2:  Memory.recall({ banks: ["global-notes"], query: "release" })
                                   └─► ranked rows, cut to a byte budget, ready for a prompt

Decision

// proposed
export effect function notes() {
  provide Experimental.Memory.test {
    try Experimental.Memory.remember({ bank: "global-notes", key: "release", text: "cut 0.1.0" })
    return try Experimental.Memory.recall({ banks: ["global-notes"], query: "release" })
  }
}

Module

Experimental.Memory, in scope with no import, as VIP-33 rules. Its code is vibelang-runtime/experimental/Memory. It ports the reference engine's memory package.

CallMeaningReference engine
Memory.remember({ bank, key, text })Write a factFlows.runRemember
Memory.recall({ banks, query, maxBytes? })Ranked rows { bank, key, text, score, updatedAtMs }Flows.runRecall, Recall
Memory.note(bank, text, { supersedes? })Append a note; an obsolete one drops out of recallMemoryStore notes
Memory.thread(id)append(message) and history({ limit }) for one conversationMemoryStore threads and messages
Memory.scoped(namespace)(effect)Limit every read and write inside to one namespaceFlows.runRecallFor, Flows.runRememberFor
Memory.tools(namespace)A Toolkit with remember and recall, bound to that namespace, for a modelFlows.handlersFor
Memory.sweep({ ttl, keep })Delete expired rows and trim history. A finite Effect the program schedulesMaintenance

Stores and recall, each a layer:

LayerMeaningReference engine
Memory.testA fresh in-memory database with keyword recallTestMemory.layer, RecallKeyword.layer
Memory.sqlite({ filename, recall? })A SQLite fileMemoryStore.layer
Memory.postgres({ url, recall? })PostgreSQLMemoryStore.layer over the PostgreSQL driver
recall: "keyword"Needs nothing beyond the store. The defaultRecallKeyword
recall: "fts"Full-text search in the databaseRecallFts
recall: "semantic"Embeddings, searched in process. Needs EmbeddingModelRecallSemantic, Embedding

Rules

  1. A bank is a namespace written as a string. There are four kinds: flow, agent, user and global. Memory.scoped binds one; a read or write that names another fails with invalid_namespace before any I/O.
  2. A model's memory is always bound. Memory.tools takes its namespace as an argument. No toolkit reaches every bank.
  3. Every recall has a byte budget. Recalled rows become part of a prompt, so the answer is cut to maxBytes.
  4. Writes are idempotent. Appending an identical message again does nothing. The same id with different content fails with idempotency_conflict.
  5. Notes are never edited. A correction is a new note that supersedes the old one.
  6. Recalled text is data. It grants no capability, and a fact a model wrote is an assertion, not an instruction.
  7. Failures are one type, Memory.MemoryError, with a stable code and an optional field path.
  8. Nothing is deleted on its own. Memory.sweep is a call the program makes. The module promises no erasure of a row's copies in recorded steps.
  9. The permissions are memory:read and memory:write. A write is irreversible in the tier table (capabilities).
  10. Inside a task, recall is a recorded step. A replay reads what the first run recalled, so a later write cannot change a finished step. New work reads the newer memory.

Host needs

A SQL database. recall: "semantic" also needs EmbeddingModel, which is Effect's and in scope; Experimental.Model.embed provides it (std-model). A browser or a Worker needs durable storage of its own or a remote store; a volatile store is named Memory.test.

Maintainers' decisions

This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.

  • Experimental.Memory, in scope with no import, as VIP-33 rules. Design · Review.
  • Its code is vibelang-runtime/experimental/Memory. Design · Review.
  • It ports the reference engine's memory package. Design · Review.
  • Call Memory.remember({ bank, key, text }): Meaning: Write a fact; Reference engine: Flows.runRemember. Design · Review.
  • Call Memory.recall({ banks, query, maxBytes? }): Meaning: Ranked rows { bank, key, text, score, updatedAtMs }; Reference engine: Flows.runRecall, Recall. Design · Review.
  • Call Memory.note(bank, text, { supersedes? }): Meaning: Append a note; an obsolete one drops out of recall; Reference engine: MemoryStore notes. Design · Review.
  • Call Memory.thread(id): Meaning: append(message) and history({ limit }) for one conversation; Reference engine: MemoryStore threads and messages. Design · Review.
  • Call Memory.scoped(namespace)(effect): Meaning: Limit every read and write inside to one namespace; Reference engine: Flows.runRecallFor, Flows.runRememberFor. Design · Review.
  • Call Memory.tools(namespace): Meaning: A Toolkit with remember and recall, bound to that namespace, for a model; Reference engine: Flows.handlersFor. Design · Review.
  • Call Memory.sweep({ ttl, keep }): Meaning: Delete expired rows and trim history. A finite Effect the program schedules; Reference engine: Maintenance. Design · Review.
  • A finite Effect the program schedules | Maintenance | Design · Review.
  • Stores and recall, each a layer: Design · Review.
  • Layer Memory.test: Meaning: A fresh in-memory database with keyword recall; Reference engine: TestMemory.layer, RecallKeyword.layer. Design · Review.
  • Layer Memory.sqlite({ filename, recall? }): Meaning: A SQLite file; Reference engine: MemoryStore.layer. Design · Review.
  • Layer Memory.postgres({ url, recall? }): Meaning: PostgreSQL; Reference engine: MemoryStore.layer over the PostgreSQL driver. Design · Review.
  • Layer recall: "keyword": Meaning: Needs nothing beyond the store. The default; Reference engine: RecallKeyword. Design · Review.
  • The default | RecallKeyword | Design · Review.
  • Layer recall: "fts": Meaning: Full-text search in the database; Reference engine: RecallFts. Design · Review.
  • Layer recall: "semantic": Meaning: Embeddings, searched in process. Needs EmbeddingModel; Reference engine: RecallSemantic, Embedding. Design · Review.
  • Needs EmbeddingModel | RecallSemantic, Embedding | Design · Review.
  • A bank is a namespace written as a string. There are four kinds: flow, agent, user and global. Design · Review.
  • Memory.scoped binds one; a read or write that names another fails with invalid_namespace before any I/O. Design · Review.
  • A model's memory is always bound. Memory.tools takes its namespace as an argument. Design · Review.
  • No toolkit reaches every bank. Design · Review.
  • Every recall has a byte budget. Recalled rows become part of a prompt, so the answer is cut to maxBytes. Design · Review.
  • Writes are idempotent. Appending an identical message again does nothing. Design · Review.
  • The same id with different content fails with idempotency_conflict. Design · Review.
  • Notes are never edited. A correction is a new note that supersedes the old one. Design · Review.
  • Recalled text is data. It grants no capability, and a fact a model wrote is an assertion, not an instruction. Design · Review.
  • Failures are one type, Memory.MemoryError, with a stable code and an optional field path. Design · Review.
  • Nothing is deleted on its own. Memory.sweep is a call the program makes. Design · Review.
  • The module promises no erasure of a row's copies in recorded steps. Design · Review.
  • The permissions are memory:read and memory:write. A write is irreversible in the tier table (capabilities). Design · Review.
  • Inside a task, recall is a recorded step. A replay reads what the first run recalled, so a later write cannot change a finished step. Design · Review.
  • New work reads the newer memory. Design · Review.
  • A SQL database. Design · Review.
  • recall: "semantic" also needs EmbeddingModel, which is Effect's and in scope; Experimental.Model.embed provides it (std-model). Design · Review.
  • A browser or a Worker needs durable storage of its own or a remote store; a volatile store is named Memory.test. Design · Review.

Adopted review answers

  • Keep Experimental.X names under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.

Compared

The same program in the reference engine 1.x. It type-checks against the reference engine's memory package 1.0.0-rc.16.

import * as Flows from "@smthrs/memory/Flows"
import * as RecallKeyword from "@smthrs/memory/RecallKeyword"
import * as TestMemory from "@smthrs/memory/test/TestMemory"
import { Effect, Layer } from "effect"
 
const memory = Layer.provideMerge(RecallKeyword.layer, TestMemory.layer)
 
export const program = Effect.gen(function*() {
  yield* Flows.runRemember({ bank: "global-notes", key: "release", text: "cut 0.1.0" })
  return yield* Flows.runRecall({ banks: ["global-notes"], query: "release" })
}).pipe(Effect.provide(memory))
ProgramTokens (o200k_base)Lines
Vibe, proposed676
Reference engine 1.x14511

Checked. The Vibe example uses only existing syntax and compiles under vibelang 0.0.13 against a declaration of Experimental.Memory. The reference engine program type-checks as shown.

Principles

  • TypeScript-first. Function calls over records.
  • Effect-second. The store and recall are Effect services chosen by a layer. EmbeddingModel is Effect's. Effect has KeyValueStore and Persistence; neither ranks, scopes or budgets.
  • Optimized for agentic programs. An agent that learns a repository's conventions on Monday uses them on Tuesday.
  • Highly forkable. Recall is a replaceable service. A fork adds a vector database by writing one layer.
  • Factory-first. What the factory's agents remember is a table anyone can read.

What this changes

  • Experimental.Memory is new. No grammar changes.

Alternatives

  • Use KeyValueStore. It stores. It does not recall by query, scope by namespace or cut to a budget.
  • Make memory part of Durable. The journal answers "what did this run do". Memory answers "what does any run know". One is append-only history; the other is current knowledge with deletion.
  • A remember keyword or a durable variable. A variable that outlives its program hides a database write behind an assignment.
  • Read current memory on replay. A finished step would then have a different input the second time.
  • Leave it to a vector database SDK. Then recall has no keyword fallback, no budget and no test layer.

Follow-up questions

  1. Opening context. The reference engine selects memory for an agent's first prompt with a shortlist and a judged pick (Opening, Source, SnapshotRecorder). Should Experimental.Agent.run take memory: banks and do this? Recommendation: yes, in std-agent, once Memory exists.
  2. Namespace kinds. flow, agent, user, global come from the reference engine. Are they right for a language? Recommendation: keep all four as they are, so a reference engine store and a Vibe store read each other's rows.
  3. Erasure. A user who asks for deletion expects their facts gone, and a recorded step still holds what it recalled. Which wins? Recommendation: sweep deletes rows only, and the module's page says so. Scrubbing journals is std-durable's retention question.

Depends on

  • std-durable: the SQL store it shares, and recorded steps.
  • std-model: EmbeddingModel for semantic recall. Keyword and full-text recall need neither.
  • capabilities: memory:read, memory:write.