Expand description
What of an agent’s Personal Memory fits in a delivery, and what the agent is told about the rest
(the re-send after a compaction; memory_delivery composes and splits what this keeps).
A delivery carries at most HOOK_PARTS * MAX_PART_CHARS characters. Before this, the files went in by
name and the cut fell wherever the budget ended: one stale 50 KB snapshot at the front used it all, and
every later file, including the one the index marks “read first”, showed as not sent.
- Order: newest first (the file’s
modifiedfrontmatter, else its mtime), done where the files are read. - Index: Personal Memory goes in as an index (
index.rs), one line per file, always complete. Only files markeddeliver: always(up toALWAYS_MAX_FILESfiles andALWAYS_MAX_CHARScharacters) go in full. - Fit: Global Memory entries that still don’t fit are left out whole and listed by name with the way to read them, never cut at the end of the text.
- Hygiene: on a compaction, one note when Personal Memory is over
PERSONAL_BUDGET_CHARS, a file is over the cap, or a project file hasn’t been touched forSTALE_DAYS. AgentMux never deletes memory: it can’t tell a stale snapshot from a durable rule, so the agent trims its own.
Structs§
- Fitted
- What the model gets to read: everything that fit, and a note about the rest.
- Seen
- What a Personal Memory file looks like to the hygiene check.
Constants§
- FILE_
CAP_ CHARS - The most characters one Personal Memory file contributes.
- NO_CAP
- A capacity for a delivery that has no part cap (the fallback’s one message).
- PERSONAL_
BUDGET_ CHARS - Personal Memory above this (in characters, counted before the cap’s cut) is worth pruning.
- STALE_
DAYS - A
projectfile untouched for this many days is called stale.
Functions§
- fit
- Caps the Personal files and keeps, in the order given (the caller put the newest first), as many as fit in
one delivery after
reserve_chars(the running summary and anything else that rides along). Global Memory goes in whole entries only; Personal Memory goes in the index, and the few files markeddeliver: alwaysin full within their limit. The tail is the left-out note, and the hygiene note whenhygieneis set. - frontmatter_
value - The value of
keyin the frontmatter block at the top oftext(---…---), at any indent so a nestedmetadata:key is found too. - hygiene_
note - The note asking the agent to trim its Personal Memory, when it needs it: over the budget, a file over the
cap, or a project file stale for
STALE_DAYS. - skipped_
note - The note naming the Global Memory entries left out of the delivery, with how to read each.