Skip to content

fix(memory): skip [Memory context] blobs in auto_save#4936

Open
rareba wants to merge 3 commits intozeroclaw-labs:masterfrom
rareba:fix/4916-memory-context-autosave-skip
Open

fix(memory): skip [Memory context] blobs in auto_save#4936
rareba wants to merge 3 commits intozeroclaw-labs:masterfrom
rareba:fix/4916-memory-context-autosave-skip

Conversation

@rareba
Copy link
Copy Markdown
Contributor

@rareba rareba commented Mar 28, 2026

Summary

Closes #4916

When auto_save = true (default), the memory_recall tool output (prefixed with [Memory context]) was being saved back into brain.db as a new memory entry. Each recall then retrieved the growing blob, creating exponential memory growth (recursive snowball) that exhausts resources.

Root Cause

should_skip_autosave_content() filters [cron:], [heartbeat task], and [distilled_] prefixes but did not filter [Memory context] blobs.

Fix

Add [memory context] (case-insensitive) to the skip list in should_skip_autosave_content().

Test plan

  • Added test case for [Memory context] blob in autosave_content_filter_drops_cron_and_distilled_noise
  • Existing filter tests still pass
  • Minimal 4-line change, no risk to other autosave behavior

@github-actions github-actions bot added memory Auto scope: src/memory/** changed. core Auto scope: root src/*.rs files changed. agent Auto scope: src/agent/** changed. channel Auto scope: src/channels/** changed. config Auto scope: src/config/** changed. daemon Auto scope: src/daemon/** changed. onboard Auto scope: src/onboard/** changed. provider Auto scope: src/providers/** changed. security Auto scope: src/security/** changed. skills Auto scope: src/skills/** changed. tool Auto scope: src/tools/** changed. tests Auto scope: tests/** changed. provider:openai Auto module: provider/openai changed. provider:compatible Auto module: provider/compatible changed. provider:bedrock Auto module: provider/bedrock changed. channel:matrix Auto module: channel/matrix changed. channel:lark Auto module: channel/lark changed. channel:mqtt tool:shell tool:web provider:claude-code labels Mar 28, 2026
@rareba rareba force-pushed the fix/4916-memory-context-autosave-skip branch from d826aaf to 98aabd8 Compare March 29, 2026 02:10
…rsive snowball

When auto_save is enabled, the memory_recall tool's output (prefixed
with [Memory context]) was being persisted back into brain.db as a new
entry. Each successive recall then retrieved the growing blob, creating
exponential memory growth that eventually exhausts resources.

Add [Memory context] to the should_skip_autosave_content filter,
matching the existing treatment for [cron:], [heartbeat task], and
[distilled_] prefixes.

Closes zeroclaw-labs#4916
@rareba rareba force-pushed the fix/4916-memory-context-autosave-skip branch from 98aabd8 to 0525c17 Compare March 29, 2026 04:09
@github-actions github-actions bot removed the core Auto scope: root src/*.rs files changed. label Mar 29, 2026
@github-actions github-actions bot removed agent Auto scope: src/agent/** changed. channel Auto scope: src/channels/** changed. config Auto scope: src/config/** changed. daemon Auto scope: src/daemon/** changed. onboard Auto scope: src/onboard/** changed. provider Auto scope: src/providers/** changed. security Auto scope: src/security/** changed. skills Auto scope: src/skills/** changed. tool Auto scope: src/tools/** changed. tests Auto scope: tests/** changed. provider:openai Auto module: provider/openai changed. provider:compatible Auto module: provider/compatible changed. provider:bedrock Auto module: provider/bedrock changed. channel:matrix Auto module: channel/matrix changed. channel:lark Auto module: channel/lark changed. channel:mqtt tool:shell tool:web provider:claude-code labels Mar 29, 2026
- Remove unused `has_successful_images` variable (multimodal.rs)
- Collapse nested `if` statements (namespaced.rs)
- Merge match arms with identical bodies (web_search_tool.rs)
- Extract type alias for complex closure type (wrappers.rs)
- Elide needless lifetime annotation (wrappers.rs)
- Add separator to hex literal, gate TempDir import (schema.rs)
- Fall back to simple chat when full agent loop fails (gateway/mod.rs)
- Ignore RUSTSEC-2024-0370 proc-macro-error unmaintained advisory
@github-actions github-actions bot added core Auto scope: root src/*.rs files changed. config Auto scope: src/config/** changed. gateway Auto scope: src/gateway/** changed. tool Auto scope: src/tools/** changed. tool:web labels Mar 29, 2026
unicode-segmentation 1.13.1 is yanked but pulled in transitively by
tao/keyboard-types (tauri desktop). No upstream fix available yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Auto scope: src/config/** changed. core Auto scope: root src/*.rs files changed. gateway Auto scope: src/gateway/** changed. memory Auto scope: src/memory/** changed. tool:web tool Auto scope: src/tools/** changed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: auto_save stores [Memory context] recall blobs, creating recursive snowball that exhausts memory

1 participant