Cap vendored OptMem wake context

This commit is contained in:
Ollie Agent 2026-08-18 14:12:04 +02:00
parent af478550a9
commit dc45bd3b3f
1 changed files with 5 additions and 1 deletions

View File

@ -53,7 +53,8 @@ KNOBS = {
"PART_CHARS": (20000, "output paging: largest part, in bytes"),
"PART_LINES": (500, "output paging: largest part, in lines"),
}
WAKE_LINES = KNOBS["WAKE_LINES"][0] # ~8k tokens of dense text, in 2 parts
WAKE_LINES = 96
MAX_WAKE_LINES = 96
ENTRY_CHARS = KNOBS["ENTRY_CHARS"][0]
# Every harness truncates a command that prints too much, and each drops a
# different piece: Claude Code cuts the middle at 30,000 chars, pi cuts the
@ -161,6 +162,9 @@ def size(k, v, where=""):
if not v.isdigit() or int(v) < 1:
die("%s%s must be a positive whole number, not '%s'." % (where, k, v))
top = min(TREE_REC - 8, LOG_REC - 40)
if k == "WAKE_LINES" and int(v) > MAX_WAKE_LINES:
die("%sWAKE_LINES is at most %d to keep wake within the agent context "
"budget." % (where, MAX_WAKE_LINES))
if k == "ENTRY_CHARS" and int(v) > top:
die("%sENTRY_CHARS is at most %d: a memory has to fit the fixed-width "
"records." % (where, top))