Summary
memory_purge creates a safety snapshot even when no memories are actually deleted. This happens for no-op purge requests (e.g. nonexistent session or topic), causing unnecessary snapshot accumulation.
Steps to Reproduce
-
Purge by a nonexistent session:
{
"session_id": "nonexistent-session-xyz",
"reason": "test"
}
Response:
Purged 0 memory(s) for session 'nonexistent-session-xyz'
Safety snapshot: mem_snap_mem_u_d33c_27b1de26df_pre_purge_362890af
-
Purge by a non-matching topic:
{
"topic": "FUNC-TEST-NO-MATCH-XYZ",
"reason": "test"
}
Response:
Purged 0 memory(s) matching 'FUNC-TEST-NO-MATCH-XYZ'
Safety snapshot: mem_snap_mem_u_d33c_27b1de26df_pre_purge_9635fe31
Expected Behavior
When 0 memories are purged, no safety snapshot should be created.
Alternatively, provide a dry_run mode so callers can validate purge criteria without side effects.
Actual Behavior
Even zero-result purge operations generate pre_purge_* safety snapshots.
During testing, the snapshot count increased from 1 to 3 after two no-op purge calls.
Impact
- Snapshot list pollution over time
- Harder snapshot management for operators
- Unexpected side effects for exploratory/debug purge calls
Environment
- MCP server:
http://localhost/memoria-api/mcp
- Tool:
memory_purge
- Discovered during functional testing on 2026-06-25
Suggested Fix
Skip safety snapshot creation when the purge result count is 0, or gate snapshot creation behind an explicit opt-in flag.
Summary
memory_purgecreates a safety snapshot even when no memories are actually deleted. This happens for no-op purge requests (e.g. nonexistent session or topic), causing unnecessary snapshot accumulation.Steps to Reproduce
Purge by a nonexistent session:
{ "session_id": "nonexistent-session-xyz", "reason": "test" }Response:
Purge by a non-matching topic:
{ "topic": "FUNC-TEST-NO-MATCH-XYZ", "reason": "test" }Response:
Expected Behavior
When
0memories are purged, no safety snapshot should be created.Alternatively, provide a
dry_runmode so callers can validate purge criteria without side effects.Actual Behavior
Even zero-result purge operations generate
pre_purge_*safety snapshots.During testing, the snapshot count increased from 1 to 3 after two no-op purge calls.
Impact
Environment
http://localhost/memoria-api/mcpmemory_purgeSuggested Fix
Skip safety snapshot creation when the purge result count is
0, or gate snapshot creation behind an explicit opt-in flag.