Expand description
Apply, reject and revert a personal-memory dream (docs/specs/SPEC_DREAMS_BACKGROUND_MEMORY_ORGANIZING_2026_11_27.md
§2.6, §9; build step 3). The plan, what each file must be like and what to do to it, is memory::dream_apply; this
runs it.
Each file write is the ordinary versioned write, with the version recorded first and the label dream set here by
srv (a caller can never name it: source_for_caller), so the drift detector finds the file matching its latest
version and records nothing, history and diff show the dream’s change as a version, and a revert is one more version.
A removal deletes the file and its mirror row; the memory record notes it at the next reconcile, as it does a file
the agent removed. Global Memory is not here: its entries are rows, not files.
The plan is checked before anything runs and each file again just before it is touched. A step whose file is already as the step leaves it is not run again, so an apply or a revert that stops half way (an I/O error) is finished by running it again. An operation is noted as applied as soon as its files are done; a half-applied dream cannot be rejected.
Enums§
- Ran 🔒
- How an apply or a revert ended.
Constants§
- REMOVED 🔒
- The sentinel an operation that only removed files notes as the version it wrote (it wrote none).
Functions§
- decision_
lock 🔒 - One decision about a dream at a time. The RPC engine runs requests at once (two windows, a double click), and an
apply that is checked as
ready, writes files and only then moves the dream must not meet a reject that sees no applied operation yet: the files would change under a rejected dream, which a revert (it needsapplied) cannot undo. The guard is held to the end of the apply, reject or revert. - dream_
apply_ 🔒impl - Apply a
readydream, whole or not at all.Stalewhen a file is not as the pass read it: nothing is changed. - dream_
reject_ 🔒impl - Reject a
readydream: nothing is written. A half-applied dream cannot be rejected. - dream_
revert_ 🔒impl - Revert an
applieddream: each file back as the pass read it, as new versions (revert), while each file is still what the dream left.Stalenames a file that was edited since: nothing is changed. - guard 🔒
- live_
hash 🔒 - The hash of a live memory file,
Nonewhen it does not exist. Never the mirror: the files are what apply changes. - load 🔒
- load_
any 🔒 - A dream of either kind, for a decision that writes no files.
- move_to 🔒
- Move the dream, or say why not. A false answer means another call moved it first.
- note_
for 🔒 - What an applied operation notes: the version that wrote its file, else that it only removed files.
- place 🔒
- The owner and the folder a dream’s files are in.
- publish 🔒
- put 🔒
- Write
contentasfile’s next version and into the folder; returns the version’s id. - read_
heads 🔒 - Every file the operations name, as it is now.
- run_
step 🔒 - Run one step after checking its file once more.
- run_
steps 🔒 - Run
steps, one operation’s steps after another’s.after_opis told as each operation’s steps finish. - take_
away 🔒 - Remove
fileand its mirror row. A file already gone is not an error.