fix(memory): make auto-prune observable and age-safe - #121
Merged
Conversation
Protect newly stored insights with a configurable grace period based on physical insertion time, including historical imports and legacy writers. Return pruned IDs and atomically record each deletion so audit failures roll back the triggering write.
Grivn
force-pushed
the
codex/issue-83-autoprune-audit
branch
from
August 30, 2026 19:59
c364c93 to
71c067a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stored_at), not historicalcreated_atauto_pruned_idsfrom remember/import operationsMNEMON_AUTO_PRUNE_MIN_AGEaccepts a Go duration, an integer number of days, or0to disable the grace period. Invalid and negative values fall back safely to the default.The nullable
stored_atmigration includes a backfill, an index, and a trigger for legacy/external writers. This protects newly imported historical records: an old event timestamp no longer makes a row immediately eligible for pruning after it first enters the local store.Relationship to existing work
This is a broader independent solution than #108. Both address the newborn-insight grace period, but this PR additionally handles historical imports through
stored_at, exposes exact pruned IDs, and makes audit/write behavior transactional. It preserves the existingpruneoperation name introduced by #96 and the configurable insight ceiling already on master from #109.If maintainers prefer #108's opt-in/default-off policy, the default and environment naming can be adjusted without changing the transaction or
stored_atdesign.Verification
make testgo test -race ./internal/memory/store ./cmd/memorymnemon-syncconvergence harness passes against the migrated schemagit diff --checkCloses #83.