feat(memory): cap auto-recall entries at 200 chars per agent - #52
Merged
Conversation
Auto-recall surfaced entry values unbounded into the context tail; one long memory could crowd out the rest. Add a per-agent max_entry_chars knob (default 200, range 1-2000) on the /memory config surface and thread it through the auto-recall search path, truncating values at whole-char boundaries with an elision marker. The interactive recall tool stays full-fidelity.
BREAKING CHANGE: /memory config keys max_entries and max_entry_chars are renamed to auto_recall_max_entries and auto_recall_max_chars. Stored configs with old keys silently fall back to defaults (3/200).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Auto-recall surfaces memory entries into the context tail with each entry's value rendered unbounded — a single long memory could crowd out the rest of the recalled set. The 200-char-per-entry default described in
docs/src/design/autonomous_memory.mdwas never implemented.This adds the cap:
max_entry_charson the per-agent auto-recall config — default 200, settable 1–2000 via/memory config set max_entry_chars <n>, shown in/memory config show.search_memory/format_entry, which truncate an entry's value to the cap at whole-char boundaries with an…elision marker. Multibyte values are never split mid-character.recalltool keeps full-fidelity output — it is not the context-tail path. Themax_entriescount, bank selection, and defaults are unchanged; configs stored before this change deserialize with the 200-char default.Tests
search_memory(…, Some(20))honors a non-default cap end-to-end through the storeDocs
sessions.mdlists only skills as aPromptAugmentationcontributor — memory recall is aContextTailcontribution.Breaking change
Follow-up rename (breaking, accepted at this stage of development): the auto-recall config keys
max_entriesandmax_entry_charsare renamed toauto_recall_max_entries(default 3, range 1–20) andauto_recall_max_chars(default 200, range 1–2000)./memory config setwith an old key now returns an unknown-key warning listing the valid keys, and stored configs with old keys silently fall back to defaults (3/200).