Skip to main content

Memory and Dreams

Source-reviewed API reference

This reference was reconciled against current development source on 2026-11-08. Historical public-source links below remain pinned to their stated revision; they are not proof that a public mirror or your installation has caught up. Start with the current operator guide for installation. This is static source review, not a live API compatibility test.

Brains stores explicit saved memories. Conversation originals, temporary continuity and Dream processing are separate surfaces. Read memory, Dreams and conversation history for lifecycle semantics. The route and store behavior here was checked against current source; no live deployment test is asserted.

Brains CRUD​

Every request requires an agentId query parameter. The query owner overrides any body agentId; record identity is (agentId, id). There is no global scope selector.

MethodPathInput / result
GET/api/brainsquery (optional substring), limit (default 50), cursor; returns {items, nextCursor}
POST/api/brainsJSON title, content, optional string-array sourceRefs; returns created record
GET/api/brains/{id}Returns the active record; missing/deleted record returns 404
PUT/api/brains/{id}JSON title, content, expectedRevision, optional sourceRefs; returns updated record
DELETE/api/brains/{id}JSON expectedRevision; returns the soft-deleted record

Titles and content must be nonempty strings. limit must be a positive safe integer; the store does not impose a fixed page-size ceiling. Use the server-returned cursor with the same agent and query. Listing is ID-keyset paged, not a snapshot of concurrent writes. An omitted sourceRefs on update becomes an empty array, so supply references you intend to retain.

Responses are record/list objects, not a universal ok envelope. Validation errors return 400 with error: brain_*; revision/ownership conflicts return 409. Reload before retrying brain_revision_conflict_or_operator_authority. An expectedRevision must be a positive integer. Operator creates/edits/deletes mark records operator-owned; runtime Brain tools cannot mutate operator-owned records. DELETE is a tombstone operation, not conversation purge or physical erasure. Example creation (use your normal authenticated client):

POST /api/brains?agentId=hatchet
Content-Type: application/json

{"title":"Documentation convention","content":"Pin source links to the reviewed release commit.","sourceRefs":[]}

Read the returned id and revision before editing; URL-encode the ID in the item path. The Brains interface also exposes revision conflicts and independent per-item bulk deletion. There is no atomic bulk-delete route.

Brain embeddings​

Brains and conversation embeddings are independently optional and disabled by default. They share one connection/model selection for explicit brain_search and session_search. GET /api/brains continues lexical substring listing; brain_read and original conversation expansion remain exact.

MethodPathInput / result
GET/api/settings/brain-embeddingsEnabled state, selected connection/model, generation, total/indexed/pending/failed counts, storage and last error
PUT/api/settings/brain-embeddingsJSON enabled boolean for Brains, optional conversationEnabled boolean (omission preserves current setting); complete connectionId/model pair when either scope is enabled
GET/api/settings/brain-embeddings/modelsconnectionId query; discover models from that connection
POST/api/settings/brain-embeddings/testJSON connectionId, model; tests embedding capability and returns {ok, dimensions}
POST/api/settings/brain-embeddings/reindexInvalidate/requeue Brains and conversation indexes; returns status without awaiting completion

These routes use the normal UI authentication/browser-origin boundary. Handled embedding errors return 400 with brain_embedding_request_failed. Enabling Brains sends saved-memory title/content to the selected provider. Separate conversation opt-in permits bounded retained dialogue passages, including reset/compaction archives, to be sent in the background; enabling Brains alone does not do this. Search sends query text. Disabling conversations prevents new document/query requests, but cannot recall data already received by a provider. Use a connection appropriate for that data. Indexing is asynchronous: a successful settings/reindex response is not a completed-index receipt. Check pending, failed and indexed afterward. Jobs persist and retry with backoff; edits/deletions invalidate stale vectors.

Brains hybrid search ranks lexical and exact cosine matches over the active agent's records. On embedding-provider failure it returns lexical results with retrieval: {mode: "lexical", fallback: "embedding_unavailable"}. Ranked cursors bind the agent, query and corpus digest; changes can invalidate the cursor, requiring a fresh search. This is explicit recall, never an automatic prompt preload. Additional status can include conversationEnabled, conversations and lexical. Brains counts remain decimal strings; conversation total, indexed, pending, failed and dirty are numeric counts of deduplicated passages/work, not messages. Check backfillComplete as well as pending: discovery may remain incomplete while pending is temporarily zero. Conversation status also reports storage, dimensions, generation, epoch and sanitized lastError. Lexical readiness/progress is separate from embedding coverage.

Ollama and Google embedding discovery remain capability-filtered. Checked 20 November 2026: OpenAI-compatible discovery selects enabled, saved entries with exact recognized IDs (text-embedding-3-large, text-embedding-3-small, text-embedding-ada-002), without contacting the upstream model catalog or refreshing OAuth for the picker. Unknown IDs and Azure deployment aliases remain manual/test-only. Discovery is not execution verification, and ChatGPT/Codex subscription endpoints are not supported embedding endpoints. The test itself makes a provider request; confirm hosted cost/privacy before testing. See model setup.

Conversation retrieval uses pgvector/HNSW semantic candidates plus the native lexical/original path. conversation_embedding_pgvector_unavailable indicates missing vector support, not lost conversation history. Conversation provider failure falls back to lexical search; exact source expansion does not make an embedding request. See conversation history.

Retired Albdruck routes and original evidence​

The current router does not mount /api/albdruck/*, including /knowledge, /recall, /history, /retention or /purge-conversation. Legacy store/migration code and stale generated API artifacts can still mention those names; they do not make the HTTP routes available.

Use session search and Archive for original conversation evidence and /api/settings/retention plus its /preview and /run actions for trace-retention controls. They are not a replacement per-conversation purge API. Brains deletion does not remove an original conversation. Imported memories preserve legacy migration details; see migration semantics.

Tiddle and promotion candidates​

GET /api/settings/tiddle returns status for an agent. /api/tiddle/cards accepts agentId, scope, limit; /api/tiddle/history accepts agentId, cardId, since, limit. Signal history is not the complete original chat transcript. Current working-memory/rolling TTL defaults are 90 days, and cardTtlDays reads the persisted rolling policy.

Brain-promotion candidate list/review routes remain a separate surface. A candidate's presence does not mean a saved Brain memory was created.

Dream controls​

All these routes share the normal API authentication boundary. They are present in the public assembly's OpenAPI document as well as the route module; older contract copies omitted them.

MethodPathBehavior
GET, PUT/api/agents/{agentId}/dream-settingsRead/save settings, with effective model and resolution error
GET, POST/api/agents/{agentId}/dream-diaryList/render diary or append an entry
POST/api/agents/{agentId}/dream-memory/consolidateRetained legacy route; current wiring returns the missing synthesized-items error described below
GET, POST/api/agents/{agentId}/dream-cycleRead receipts or run a cycle

For mod-managed agents, Dream-settings GET/PUT and Dream-cycle POST return 409 agent_dream_managed_by_mod; the owning mod controls that lifecycle. This restriction does not mean every diary or receipt read is unavailable.

Dream settings include enabled, quietDayDreams, promoteToMemory, cron, prompt, optional modelConnectionId and model. The persisted default is enabled at 0 4 * * *, with quiet-day Dreams enabled and operator timezone/model selection. Public migration 53 retires per-Dream timezone overrides; the retained timezone field is returned as null and the operator timezone governs scheduling. Explicit model overrides must supply a complete valid pair. A Dream prompt is at most 20,000 characters.

Diary GET supports date, phase, limit (default 30) and format/markdown. Cycle receipt GET defaults to 20 entries. Cycle POST accepts limit and optional generatedAt; these are processing controls, not a separate scheduling API. Inspect the returned phase outcomes: current Dream cycles save individual Dream-generated Brain connections, not a mandatory DreamMemory preload.

The legacy /dream-memory/consolidate route remains mounted, but its current handler supplies no synthesized items to a helper that requires them. Static source therefore shows a 400 dream_memory_synthesized_items_required outcome, not a working standalone consolidation operation. Use the current Dream-cycle workflow; do not keep retrying this legacy route or treat its presence in OpenAPI as proof it works. No runtime fix or live call was performed in this documentation pass.

Dream publication controls​

GET/PUT /api/settings/brain-memory reads/saves the global boolean promoteDreamsToMemory (default true). PUT requires a boolean and rejects invalid input with 400 promote_dreams_to_memory_invalid. Each agent also has promoteToMemory in Dream settings, default true; both controls must permit publication.

These switches gate saving new or updated Dream-generated Brain connections, not running the Dream cycle. Publication rereads both settings, so switching off during a run prevents later publication. Skipped changes are not queued for automatic catch-up when re-enabled, and existing memories are not deleted. Reconciliation only updates eligible Dream-origin, non-operator-owned records whose expected revision still matches; conflicts are retained for review rather than overwriting operator edits. Inspect actual cycle receipts rather than treating an enabled switch as proof a memory was saved.

Dream memory expression and preview​

Dream settings additionally expose memoryEmphasis (integer 0–100, default 50), memoryPromptOverride (null or string up to 20,000 characters), and read-only defaultMemoryPrompt/effectiveMemoryPrompt. Omission on save preserves the current value; null restores the default prompt, while an explicit empty string is a valid override. These affect final expression, not evidence selection, provenance, truth or permission to publish memories.

POST /api/agents/{agentId}/dream-memory/preview accepts only optional memoryEmphasis, memoryPromptOverride, and sourceToken. It previews recent validated extraction candidates whose source identities still match the current REM window: not all history and not new extraction. It can invoke the selected model and incur cost, but does not save settings, publish Brains, or write Dream diary/extraction state. Execution traces may still be retained.

The response includes memories, sourceToken, sourceCount, generatedAt, evidenceScope, and persisted: false. Reuse the agent-bound token to compare expression settings against the same snapshot; tokens are ephemeral, expire after 15 minutes, and can be evicted or invalidated when source evidence changes. An invalid token requires a fresh preview, not a claim that the old snapshot remains valid. An empty eligible source set returns no memories without a model call. Preview results do not establish what a later Dream cycle will publish.

Additional endpoint inventory​

Methods are significant. Braced segments are placeholders; URL-encode identifiers. See the contract and conventions for artifact limitations. Brains and embedding endpoints are listed above.

MethodPathPurpose
GET/api/memory/brain-promotion-candidatesList Brain promotion candidates
PATCH/api/memory/brain-promotion-candidatesUpdate Brain promotion candidate
GET, PUT/api/settings/brain-memoryGlobal Dream-to-Brains publication setting
GET/api/settings/tiddleRead Tiddle rolling-continuity status
GET/api/tiddle/cardsList current Tiddle warm cards
GET/api/tiddle/historyRead append-only Tiddle Signal history

Targeted source review​

The full page was reconciled on 2026-11-08 against Backend commit 6b682eae6cd0dc6efa79e173b7d819fb219443b3. No live API or provider calls were performed. The links below are retained historical public references, not links to the current development source.

26 October delta review​

Updated against Backend 4df4b424e2b2856cb2c25c8464da7f806eb661e0 on 2026-10-26. This is a focused source comparison since the full review above, not a new application or provider test pass.

27 October delta review​

Changed contracts checked statically against Backend 32ff99dfc0317635f5c7aa53b4c9ec18266d4c09 on 2026-10-27. This does not recertify unchanged historical sections or report live API/provider tests.

5 November development delta​

The changed preference, recall, embedding or shared-guidance contracts above were checked statically against Core 6465a9b200bc550697ddfc41959d671eac9abf33 on 5 November 2026. No application, database or live-provider tests were run; unchanged historical sections retain their earlier qualifications. See source coverage.

Lexical rollout progress​

Checked 6 November 2026: the historical recall worker's status distinguishes configured pageSize from adaptive activePageSize. Default pages use up to 16 occurrences and a 60-second preparation budget. Preparation avoids foreground session/source row locks; a separate 250ms publication cancellation budget covers version checks, projection writes and cursor advancement. Failed pages roll back without advancing the checkpoint. Timeout reduces the next page size down to one; four consecutive full committed pages increase it toward the configured maximum. Broad recall still waits for lexical readiness; exact original expansion remains separate. No history truncation or automatic embedding opt-in is introduced.

15 November 2026 static API reconciliation​

Reviewed this page against Backend 29ca7b6cec378700503a587703adc1d82e9d6f6d and UI 171b19da7ce074fbcb19fa1ed20dfd58e9133cb5, including mounted routes and their relevant stores/UI callers. Corrections above describe implementation, not a live API, database or provider test. Earlier dated receipts remain historical.