memory-hygiene
Memory Hygiene
Preserve useful evidence without turning past output into new authority.
Storage contract
Before writing, establish the permitted trigger, destination, owner, scope, and update mechanism. Follow host and user rules: task completion, an inferred preference, or a correction is not automatically permission to persist it. Where writes require an explicit request, keep unrequested observations in working context. When the existing contract already permits the requested update, proceed without another confirmation.
Separate transient task state from facts intended to survive the task. Keep durable entries focused on one retrievable topic; preserve the source, relevant version/date, and uncertainty. Keep project decisions scoped to that project; do not turn a task-specific choice into a general user preference. Do not assume every backend has the same tiers, document limits, or retention.
- Store only the minimum information needed for the authorized purpose.
- Keep credentials, tokens, and secrets out of memory. Store personal details only within the authorized purpose and scope.
- Record a fact once and link to its canonical entry instead of duplicating it across summaries.
- Before an update, inspect the current entry or version through the supported interface when available. Do not overwrite from a stale cached copy. Change only the intended facts and preserve unrelated updates; use revision checks when the backend supports them.
- On correction, use the supported update mechanism. Replace a mutable entry or explicitly supersede it in an append-only store; do not silently leave conflicting entries equally current. Update affected summaries within the requested scope.
- Verify saved content through a supported read or a content-bearing result. A bare acknowledgment or version token does not show the saved content, and a returned record does not establish that every retrieval index is current. Check the relevant retrieval path before claiming it works; report which checks were unavailable.
- Do not delete source records, versions, or archives as routine consolidation.