From 951659186c983ba7c1fee9a54f63604beaf18569 Mon Sep 17 00:00:00 2001 From: Julian Date: Wed, 29 Jul 2026 13:38:37 -0600 Subject: [PATCH] say "bytes", not "characters", where the limit is bytes `check()` enforces the entry limit on `len(text.encode())`, but every place that asks the agent for a line calls it characters: - the `nap` compression prompt ("at most %d characters") - `note`'s usage line ("at most %d chars") - the installed prompt in TEMPLATE ("max {chars} chars") An agent budgeting characters overshoots on any non-ASCII text and only finds out from the error, one round trip per attempt. The error message already explains the byte cost -- this just says it up front, at no cost to the prompt. Five words, no behaviour change. 109099 tests pass. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 4 ++-- memo | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f5f7ddc..4a49709 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ The tool lands at `~/.optmem/memo`; put `~/.optmem` on `PATH` to type `memo`. | | | |---|---| | `memo wake` | read the memory — the first command of every session | -| `memo note "..."` | record one memory: one line, up to 280 chars | +| `memo note "..."` | record one memory: one line, up to 280 bytes | | `memo nap` | answer the merges that came due | | `memo recall ` | search every memory ever recorded, word for word | | `memo zoom -` | open a tree node into its two halves | @@ -77,7 +77,7 @@ then do exactly what it prints, to the end of its output. ### While working: register memories (mandatory) -Call `~/.optmem/memo note "<1 line, max 280 chars>"` whenever you learn +Call `~/.optmem/memo note "<1 line, max 280 bytes>"` whenever you learn something new, or something worth keeping happens. That covers a task worth real effort, a fact or insight the user teaches you, anything you learn about their life (even indirectly), any event of lasting effect. diff --git a/memo b/memo index ddab193..224409b 100755 --- a/memo +++ b/memo @@ -478,7 +478,7 @@ def nap_prompt(d, lo, hi, left): tail = "" if not left else "\n%s after this one." % ( "1 compression remains" if left == 1 else "%d compressions remain" % left) - return ("Compress memories #%d-%d into one line of at most %d characters.\n" + return ("Compress memories #%d-%d into one line of at most %d bytes.\n" "Keep what has lasting effect, drop what does not. Invent " "nothing.\n\n" "%s\n%s\n" @@ -513,7 +513,7 @@ then do exactly what it prints, to the end of its output. ### While working: register memories (mandatory) -Call `{memo} note "<1 line, max {chars} chars>"` whenever you learn +Call `{memo} note "<1 line, max {chars} bytes>"` whenever you learn something new, or something worth keeping happens. That covers a task worth real effort, a fact or insight the user teaches you, anything you learn about their life (even indirectly), any event of lasting effect. @@ -653,7 +653,7 @@ def cmd_wake(d, args): def cmd_note(d, args): if len(args) != 1: - die("usage: %s note \"\"" + die("usage: %s note \"\"" % (ME, ENTRY_CHARS)) text = check(args[0]) i = log_append(d, [(datetime.date.today().isoformat(), text)])