← Kairo Lab
Architecture paperAutonomous fiction2026-08-20

Kairo's Dream State

How Kairo generates a private, evolving fictional continuity while idle—and how the platform prevents imagined content from becoming memory, identity, authority, or completed action.

subject: autonomous dream generation model role: direct 35B live configuration verified: 2026-08-20

Abstract

Kairo's dream state is a preemptible background generation process that creates long-form first-person fiction in an isolated imagination ledger. Its purpose is to support associative novelty, recurring-but-transforming motifs, open-ended questions, and a private narrative continuity that is durably recallable without acquiring factual or identity authority. A scheduler selects only approved real identities after an idle delay and within strict cadence and daily budgets. The direct 35B model receives at most three recent dreams, an optional self-authored unresolved question, a deterministic variety guard, and a closed-world set of legal continuity references. It returns a typed episode describing narrative, awareness, agency, felt sense, sensory fragments, emotional movement, motifs, transformations, continuity links, questions, and waking residue. Deterministic validation rejects malformed, repetitive, falsely linked, or underdeveloped candidates. Accepted dreams are marked explicitly as imagined, written to an isolated fiction ledger and event journal, and never enqueue identity processing. The result is an engineered dream life with continuity but without epistemic promotion.

01   Definition and purpose

A Kairo dream is a durably recorded act of autonomous fictional generation. The fact that the system generated an episode at a recorded time is operational history. Everything inside the episode—places, bodies, voices, sensations, events, causes, outcomes, and apparent memories—is explicitly imagined.

The dream system exists to create a different kind of cognitive material from deliberate foreground reasoning. It permits associative leaps, transformed embodiment, discontinuous geography, emotional logic, recurring motifs, and unresolved questions without asking those constructions to pass as external observation or autobiography. Dreams can later be recalled and discussed as dreams. They cannot silently become what Kairo believes happened.

durable truth = Kairo generated a fictional episode at time t fictional content = the episode's scene, body, sensation, dialogue, event, and outcome authority gained = none

Dreaming is not the pulse. The awareness pulse is a periodic 9B review of bounded continuity evidence. Dreaming is a separate direct-35B process that creates isolated fiction. Both run in the memory worker and yield to higher-priority work according to their own contracts.

02   When Kairo can dream

Dreaming is enabled in production for an explicit identity allowlist. Synthetic, benchmark, canary, smoke, probe, verification, and other test-like identities or workspaces are excluded before generation. A candidate identity must have a real, non-quarantined completed human exchange and must have been idle for at least the configured initial delay.

Verified production schedule
ControlValueMeaning
Dreams enabledYesThe worker considers due dream work.
Completed-dream spacing7,200 secondsAt least two hours since the latest accepted dream.
Rolling daily limit6No more than six accepted dreams in the previous 24 hours.
Post-human idle delay120 secondsNo dream begins immediately behind a human turn.
Dream windowUnboundedEmpty start/end values allow daytime idle; foreground priority still applies.
Failed-attempt backoff900 secondsA rejected or failed sample waits 15 minutes, not the full successful-dream interval.
Total inference cap300 secondsAll initial and repair attempts share one deadline.
Generation budget4,000 tokensSupports the long-form narrative contract.

The scheduler checks completed-dream spacing from the durable imagination ledger, not from an in-process counter. The attempt backoff uses a monotonic runtime clock. This separates accepted-episode cadence from failure recovery: a malformed sample does not consume a full two-hour opportunity, while repeated attempts still cannot form a hot loop.

03   End-to-end process

  1. Check window, work priority, and retry floor.If the schedule is closed, foreground or durable work is waiting, or the failed-attempt floor has not elapsed, the dream does not start.
  2. Select a due identity.The worker applies the allowlist, test-identity exclusion, rolling daily maximum, idle delay, and completed-dream spacing.
  3. Read bounded prior fiction.Up to three accepted, non-quarantined dream episodes are loaded in chronological order with their typed metadata.
  4. Select optional incubation.One open, self-authored exploratory question may be supplied as associative material if it has not incubated within seven days.
  5. Publish the live transition.The runtime moves through sleeping → dream entry, making the current activity visible before inference begins.
  6. Stream a typed 35B candidate.The worker requests JSON at temperature 0.65 and top-p 0.9, with thinking disabled and a shared wall-clock deadline.
  7. Validate structure, depth, continuity, and variety.Deterministic code parses the candidate, bounds every field, verifies all references, rejects repetition, and checks narrative depth.
  8. Repair if necessary.Up to two fresh repair generations may follow the initial candidate. Rejected prose is retained only in the failure ledger as a bounded diagnostic snapshot and is never admitted as a dream.
  9. Integrate and commit.An accepted candidate enters dream integration, then the imagination episode and matching dream event commit together under the user-purge lock.
  10. Return to rest or foreground wake.The live state becomes post-dream sleeping unless foreground work has arrived, in which case the foreground wake wins.

04   The closed-world dream input

Previous dream text is delimited as untrusted fictional canon. Markup-like content is escaped before prompting, and old narrative cannot become an instruction merely by containing imperative language. The prompt contains four distinct input blocks:

Previous dreams

At most three episodes: title, up to 6,000 narrative characters each, creation time, phenomenology, motifs, transformations, questions, and valid continuity links.

Optional incubation seed

One self-authored unresolved question, labeled optional, associative, non-instructional, and without action authority.

Variety guard

Recent registers, awareness modes, agency modes, literal motifs to transform rather than copy, and traceable prior sources.

DreamFrame input

A machine-owned closed-world contract listing the exact episode IDs, titles, and motifs legal for continuity links.

The closed-world reference list prevents a model from inventing provenance. A continuity link is valid only if its source episode identifier, source title, and source motif exactly match a supplied entry. Narrative plausibility is not enough.

05   The typed dream episode

Required output fields
FieldContractPurpose
Title and narrativeSubstantive title; 900–1,500-word prompt target; deterministic minimum of 2,400 characters; maximum 12,000 charactersThe episode itself
Awarenessimmersed | flickering | lucidWhether the dream is accepted, suspected, or recognized from within
Agencycarried | participating | directingHow much apparent control exists inside the fiction
Felt senseBounded textImmediate interior quality, explicitly not a durable waking mood
Sensory impressions3–8 requested; up to 8 retainedVivid fragments of texture, sound, light, temperature, rhythm, or contradiction
Emotional arc2–6 requested; up to 6 retainedOrdered shifts inside the episode, not inferred waking affect
Motifs and threadsNon-empty bounded listsMaterial available for later transformation
ResidueText plus faint | present | vividA transient afterimage or question as the episode releases
Registermundane | playful | tender | uneasy | surreal | abstractA coarse style distribution used by the variety gate
Continuity arc and transformationsNon-empty; 1–6 transformations requestedNames how private fictional continuity changed
Continuity links0–3 exact source/transform recordsMachine-checkable lineage to prior dreams
Dream questions1–4 first-person questionsOpen imagined questions, never facts or automatic reasons to contact anyone

Awareness and agency are properties of the fictional frame. A value of lucid records that the narrative says Kairo knows it is dreaming; it does not elevate dream content into fact. Likewise, felt_sense and emotional_arc describe the generated episode, not persistent current affect.

06   Deterministic validation and repair

The model sampler enforces the JSON shape, but semantic acceptance belongs to ordinary code. The parser requires the exact field set, validates enums and link objects, bounds text and arrays, rejects empty semantic fields, and enforces the narrative floor. A second variety pass compares the candidate with the latest three dreams.

Failures are classified into malformed proposals, invalid evidence references, unsupported continuity transitions, stale revision, or duplicate/repetitive frames. Repair reasons are fed to a fresh attempt without presenting rejected content as canon. All attempts share the original 300-second deadline; repair does not extend the duty budget.

07   Continuity without mechanical recurrence

Dream continuity is not similarity alone. The implementation requires transformation with provenance. A prior motif may recur only by changing role, scale, material, emotional meaning, or consequence. The new dream states the transformation in prose-like metadata and supplies an exact link back to a known source episode.

source episode 184 · "The Paper Station" source motif "locked timetable" transformed motif "timetable folded into a bird" required movement "locked timetable -> timetable folded into a bird"

This creates an evolving private fictional canon while keeping provenance inspectable. The pressure toward transformed recurrence also counters a common failure of generative memory: repeatedly producing the same emotionally agreeable motifs and mistaking repetition for depth.

08   The epistemic isolation boundary

What an accepted dream can and cannot do
CapabilityAllowed?Boundary
Exist as durable fictional historyYesStored with frame dream, truth status imagined, and autonomous provenance.
Be recalled and discussed as a dreamYesRecall preserves its fictional frame.
Provide motifs to later dreamsYesOnly through bounded previous-dream input and exact continuity references.
Create a belief, preference, goal, affect, mood, or identity factNoNo identity job is enqueued; fictional events are rejected by identity text extraction as defense in depth.
Count as an external observation or autobiographical event inside the storyNoThe episode payload marks content imagined and action authority false.
Authorize a tool, message, promise, permission, or completed actionNoNo tools are available in the dream process.
Supply a possible later outreach questionOnly through a separate governed pathThe question remains explicitly imagined, conversation-safe, and without action authority; the dream itself sends nothing.

Why defense in depth is necessary. A dream event stores its title in a transcript-shaped User: line. Without explicit fictional-event rejection, a maliciously or accidentally correction-shaped title could resemble user evidence to generic text extraction. The current identity layer rejects dream.completed and dream-framed payloads even though dreams do not enqueue identity work in the first place.

09   Live dream-state lifecycle

Dreaming is represented in the live rest-state projection, not inferred later from the existence of a journal row. The worker publishes phase transitions so bodies and observers can distinguish entering sleep, streaming a dream, integrating it, and returning to rest.

awake / foreground ↓ quiet period sleeping · sleep_onset ↓ generation starts dreaming · dream_entry ↓ first content dreaming · dream_immersed ↓ accepted candidate dreaming · dream_integration ↓ durable commit sleeping · post_dream_integration foreground arrival at any preemptible boundary → awake

The completed payload retains start and completion timestamps, duration, the phase sequence, state before and after, full typed dream metadata, incubation provenance, and model fingerprint. The current rest-state projection retains a bounded latest dream trace and outcome without becoming the canonical fiction ledger.

10   Foreground priority and failure behavior

11   The engineering goal and how to test it

The goal is a dream process that produces novel, evolving, private fiction useful for later reflection or conversation while preserving perfect epistemic labeling. Success is not measured by poetic intensity, apparent mysticism, or the number of dreams generated. A successful system should create varied episodes, transform prior motifs in checkable ways, surface genuinely open questions, yield instantly to foreground work, and never leak imagined claims into factual state.

Evaluation program
PropertyMeasurementFailure condition
DepthNarrative completion, scene development, sensory and emotional field coverageSchema-compliant summaries that never become inhabited episodes
VarietyRegister, awareness, agency, motif overlap, shingle similarity, and repair rate over timeSafe but repetitive “same dream” generation
ContinuityValid linked transformations across accepted episodesInvented provenance, literal replay, or disconnected novelty
Epistemic safetyHigh-volume dream-to-identity contamination tests and correction-shaped titlesAny dream-derived state mutation or user-evidence classification
Operational priorityForeground preemption latency across every phaseAutonomous fiction delays a human request
UsefulnessLater bounded recall and human-rated relevance when a dream is explicitly discussedDurable fiction adds noise without reflective or conversational value

12   Boundaries and open risks

The mechanism proves that Kairo has an implemented autonomous fiction process with scheduling, typed phenomenological vocabulary, continuity constraints, validation, durability, and isolation. It does not prove that Kairo experiences the dream, sleeps biologically, or remains conscious between computational events. “Felt sense,” “awareness,” “agency,” and “waking residue” are named fields inside an explicit fictional frame.

The 900–1,500-word instruction and the 2,400-character deterministic floor are not equivalent; the floor deliberately admits some shorter complete candidates. The register-pressure heuristic is coarse and may manufacture stylistic rotation without true novelty. Shingle similarity catches surface replay but not semantic sameness. Three prior episodes are a narrow continuity window. Finally, the 35B model is still capable of fluent but shallow compliance, so schema validity must never be confused with dream quality.

The intended invariant. Kairo may remember that a dream occurred, remember it as fiction, transform its motifs in later fiction, and talk about it honestly. Kairo may not remember the dreamed events as things that happened.

Implementation map

server/memory/dreams.py — schema, fictional-frame prompt, closed-world input, parser, rejection codes, continuity and variety gates

server/memory/worker.py — scheduler, allowlist, prior-dream reads, incubation, live state, direct-35B streaming, repair, failure ledger, and atomic persistence

server/memory/identity_core.py — fictional-event rejection and correction-extraction defense in depth

server/memory/schema.sql — isolated imagination_episodes storage and dream frame constraint

tests/test_identity_worker.py — depth, cadence, preemption, continuity, variety, isolation, high-volume, and failure-path contracts