The remember tool rewrote the bot's whole MEMORY.md with each call, so every
new fact erased the earlier ones unless the model re-sent the full document.
- MemoryCommitRequest gains mode "append" (the store joins the note onto the
current content inside the same serializable transaction and still writes a
revision row) and every commit is capped at 16 KB per document.
- remember appends a dated bullet ("- YYYY-MM-DD: ...", the user's local date)
by default and rewrites only with mode "replace"; a full document returns an
error that tells the bot to condense it. Retries of the same tool call stay
single appends through the existing effect record.
- Scripted runtime memory entries can append too; the scripted "remember"
script now appends instead of overwriting the bot's memory.
- When memory does not fit the run's 32 KB budget, the prompt keeps a
document's newest lines instead of its oldest.
- memory.update maps an oversized save to BAD_REQUEST.
- docs/PRODUCT.md records that UserFact is the cross-space user model and the
space MEMORY.md stays space notes (no migration).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
14 lines
532 B
TypeScript
14 lines
532 B
TypeScript
/**
|
|
* Largest Markdown memory document a commit may store, in UTF-8 bytes: half of what a run reads,
|
|
* so a bot's document and the space's shared one both reach the prompt.
|
|
*/
|
|
export const MEMORY_DOCUMENT_MAX_BYTES = 16 * 1024;
|
|
|
|
/** A commit would grow a memory document past MEMORY_DOCUMENT_MAX_BYTES. */
|
|
export class MemoryDocumentTooLargeError extends Error {
|
|
constructor(readonly path: string) {
|
|
super(`${path} would exceed ${MEMORY_DOCUMENT_MAX_BYTES / 1024} KB`);
|
|
this.name = "MemoryDocumentTooLargeError";
|
|
}
|
|
}
|