refactor(memory): derive the run's memory budget from the document limit

The prompt budget was a separate 32 KB constant; it is now twice the
per-document limit, so a full bot document and a full space document keep
fitting if either number changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MRtGG9ARfqqhma3t85Ro2u
This commit is contained in:
Claude 2026-10-03 13:27:38 +00:00
parent 4875753d9c
commit 84dff4d846
No known key found for this signature in database

View File

@ -1,6 +1,8 @@
import type { AdapterContext, MemorySnapshot, MemoryStore } from "@rakazo/adapter-kit"; import type { AdapterContext, MemorySnapshot, MemoryStore } from "@rakazo/adapter-kit";
import { MEMORY_DOCUMENT_MAX_BYTES } from "@rakazo/adapter-kit";
const MAX_AGENT_MEMORY_BYTES = 32 * 1024; /** Room for a full bot document and a full space document. */
const MAX_AGENT_MEMORY_BYTES = 2 * MEMORY_DOCUMENT_MAX_BYTES;
const OMITTED_MARKER = "[earlier notes omitted]\n"; const OMITTED_MARKER = "[earlier notes omitted]\n";
type ScopedMemoryDocument = MemorySnapshot["documents"][number] & { type ScopedMemoryDocument = MemorySnapshot["documents"][number] & {