Dreams

Every Mneva brain wanders nightly. The wander daemon picks three random memories from your tenant, asks a small LLM to find one surprising connection among them, novelty-scores the result against prior dreams, and stores survivors. Next session, recall_dreams surfaces them.

This is the most categorically novel thing Mneva ships. Other memory products are retrieval stores — they answer questions you ask. Mneva produces unprompted thoughts between sessions. None of mem0, Letta, Zep, or the reference MCP memory servers wander.

What wander does

For each tenant brain, on each nightly run:

  1. Sample three memories at random. (More memories soon — for v1, three.) The wander only runs when the tenant has at least 10 memories total — with fewer than that the recombination has nothing meaningful to find, and Haiku's honest verdict ("no clear connection") dominates the output. A request to wander a thin tenant returns skipped: "not enough memories yet" with a threshold field, so the caller knows why.
  2. Prompt: "find ONE surprising connection or insight among these three memories and express it in two sentences. Be specific. Avoid platitudes."
  3. Embed the candidate thought.
  4. Compute the highest cosine similarity to any prior dream in this brain.
  5. If similarity >= 0.85 (the novelty floor), drop the candidate as a near-duplicate.
  6. Otherwise persist the dream with its source memory ids and novelty score.

Recombination model: Anthropic Haiku 4.5 by default (~$0.0005/wander). Falls back to local Ollama (qwen2.5:3b) on the engine box if the Anthropic API is unreachable, so the wander loop never silently dies.

The novelty floor

The 0.85 cosine threshold is not arbitrary. It's calibrated against mxbai-embed-large (1024-d) on our test brains:

  • ~0.50-0.60 — two unrelated sentences from the same domain
  • ~0.65-0.75 — sentences that say genuinely related things
  • ~0.85+ — paraphrases of the same idea

We want each dream to say something not yet said. A candidate that crosses 0.85 to a prior dream is almost certainly that prior dream restated. Drop it.

The floor fires. In our own testing, the second wander cycle on the same three memories produced a candidate at similarity 0.87 to the first dream; it was correctly rejected.

A real dream

Test brain, three memories:

  • we use Postgres 15 for the user database
  • image uploads max 10MB, stored in S3 us-east-1
  • the public API rate limits at 100/min

The dream that survived novelty checking:

The 10MB image upload limit combined with the 100/min rate limit means a single user could theoretically upload 1GB of images per minute (100 requests × 10MB), which would quickly exhaust S3 egress costs and overwhelm your us-east-1 bucket without any concurrent upload throttling at the application layer.

Nobody asked for that. The three memories had no obvious connection. Wander found one — and a real one, the kind of capacity-bound an engineer should know about.

Operational shape

  • Schedule: nightly at 04:17 UTC + up to 30 min jitter (systemd OnCalendar=*-*-* 04:17:00, RandomizedDelaySec=30m).
  • Concurrency: the wander daemon runs MNEVA_WANDER_CONCURRENCY tenants in parallel (default 4, capped 1..16). At 4-wide, a 20,000-tenant brain pool fits comfortably in the nightly quiet window.
  • Cost: ~$0.0005/tenant/night on Haiku. At 10,000 tenants that's $1.50/month. Free on the Ollama fallback.
  • Read-once: recall_dreams returns unread dreams and stamps read_at on retrieval. A dream lands exactly once — surfacing it every recall would stop being a dream and start being a notification.

See also

Was this page helpful?