Skip to content

fix(agent): align AgentMemory decay with EbbinghausAlgorithm - #1150

Open
knqiufan wants to merge 2 commits into
oceanbase:mainfrom
knqiufan:fix/agent-ebbinghaus-decay-1149
Open

fix(agent): align AgentMemory decay with EbbinghausAlgorithm#1150
knqiufan wants to merge 2 commits into
oceanbase:mainfrom
knqiufan:fix/agent-ebbinghaus-decay-1149

Conversation

@knqiufan

@knqiufan knqiufan commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Replace the hard-coded linear decay in MultiAgentMemoryManager.update_memory_decay() and MultiUserMemoryManager.update_memory_decay() with EbbinghausAlgorithm.calculate_current_retention(), keeping Agent cache retention_score in sync with metadata.intelligence.
  • Introduce shared helpers in src/powermem/agent/utils/retention.py for retention calculation, cache/metadata synchronization, cleanup classification, and persistence.
  • Update cleanup_forgotten_memories() in both managers to use Ebbinghaus should_forget() / should_archive() instead of fixed linear thresholds on stale cache scores.
  • Persist decay/archive metadata through storage.update_memory() so scheduled decay passes do not re-trigger the intelligence plugin.
  • Preserve legacy string memory IDs when loading memories from storage into Agent caches, while retaining normalized int/string cache variants for modern Snowflake IDs.

Test plan

  • python -m pytest tests/unit/test_issue_925_agent_memory_share.py::test_multi_agent_loads_legacy_agent_scope_as_agent_group -q
  • python -m pytest tests/unit/agent/test_memory_id_normalize.py -q
  • python -m pytest tests/unit/agent/test_agent_retention_decay.py -q

Fixes #1149

…se#1149)

Replace the hard-coded linear decay in MultiAgent/MultiUser update_memory_decay() and cleanup_forgotten_memories() with shared Ebbinghaus retention helpers. Sync metadata.intelligence on decay passes, persist via storage.update_memory, and add regression tests.
@knqiufan knqiufan changed the title fix(agent): align AgentMemory decay with EbbinghausAlgorithm (#1149) fix(agent): align AgentMemory decay with EbbinghausAlgorithm Jul 6, 2026
Keep storage-loaded legacy string memory IDs from being coerced to Snowflake ints when synchronizing Agent caches, while retaining normalized cache variants for modern IDs.

Copy link
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AgentMemory update_memory_decay() uses linear formula instead of EbbinghausAlgorithm

2 participants