Skip to documentation
Docs navigation
Docs/Pruning memory safely
Guide

Pruning memory safely

Reduce noisy active memory through deliberate lifecycle policy without treating decay, suppression, forgetting, and deletion as interchangeable.

Estimated time: 8 minutes
Level: Intermediate
Prerequisites:Installation·Quick Start

Overview

MemoGrafter does not expose one universal prune operation. Pruning is an application review workflow that selects the correct lifecycle action for stale, obsolete, incorrect, or overly broad memory while preserving auditability by default.

Choose the right state

Decay marks old or low-scoring memory inactive through maintenance policy.
Supersession identifies an older version replaced by a newer explicit update.
Conflict keeps competing active claims visible for resolution.
Forgetting is a one-way public soft lifecycle action on a memory node.
Suppression temporarily hides an entire topic and can be restored.
Physical deletion is a separate storage and retention-policy decision.

Lifecycle flow

Active memory
Forget or suppress
Filtered recall
Studio audit
Restore

Step 1: Identify candidates

candidates.ts
const snapshot = await agent.getGraphSnapshot();
const candidates = snapshot.snapshotMemories.filter(({ lifecycle }) =>
  lifecycle.decayed || lifecycle.hasConflict || lifecycle.supersededBy,
);

Step 2: Review provenance and history

review.ts
const history = await agent.getMemoryHistory(memoryId);
console.log(history.entries);
console.log(history.currentMemory);

Step 3: Apply a bounded action

lifecycle.ts
await agent.forget(memoryId);
// Or temporarily hide a whole topic:
await agent.suppressTopic(topicId);

Step 4: Verify active recall

verify.ts
const after = await agent.recall(originalQuery);
console.log(after.facts.some((fact) => fact.id === memoryId)); // false

Best practices

Change memory in small reviewed batches.
Keep application-level reasons and actor identity in your own audit system.
Compare recall quality before and after policy changes.
Use Studio and snapshots because active reads intentionally hide inactive rows.
Treat hard deletion as a separate retention and privacy design.

Common mistakes

Calling every inactive state ‘deleted’.
Forgetting a memory when temporary topic suppression is intended.
Physically deleting rows before reviewing provenance and edges.
Pruning solely by age without considering confidence or use case.
Expecting suppression to restore independently forgotten memories.