Skip to main content

Module memory

Module memory 

Source
Expand description

MEMORY.md: the durable facts the agent learned, and the budget that keeps them honest.

The file is a flat list of entries separated by a line holding §:

the model server is on the LAN
§
Max prefers local inference over cloud
§
Max prefers local inference over cloud

Nothing here is clever. An entry is free text, it may span lines, and a memory that needs a date carries it in the text — no timestamps are stored, because the file is also meant to be read and edited by hand.

Two writers (the CLI and the dashboard) can be alive at once, so every mutation takes an advisory flock on <file>.lock and replaces the file atomically (write to a temp file in the same directory, then rename). A reader therefore never sees half a file, and a crash cannot leave one.

Structs§

Memory
One profile’s memory file.

Enums§

Outcome
What a mutation did, in words worth showing the person watching.

Constants§

DEFAULT_BUDGET_CHARS
Ceiling on the rendered file, in characters, unless the config says otherwise.
SEPARATOR
The line that separates two entries.

Functions§

parse
Entries out of the file text: a line holding § separates them, blank lines around it and at the ends are dropped, and anything else (including blank lines inside an entry) is kept.
render
Entries back into the file text, ending with a newline so appends stay one-per-block.