feat(history): audit timeline of memory changes - #3
Merged
Conversation
Add a memory_events Meilisearch index recording create/update/delete events plus one rolled-up summary per crawl. Metadata only (no content diffs). Recording is best-effort and off the critical path via a no-wait insert, funneled through MemoryService so the CLI, MCP, and crawler all log uniformly; crawler-sourced single-file mutations are skipped in favor of the per-crawl summary. Surface: 'memd history' CLI command and a 'history' MCP tool, both filterable by action/type/scope/since. MeiliClient is now index-aware (for_index) so the log reuses the same plumbing.
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.
What
Adds an audit timeline of memory changes to memd: a record of which memories were created, updated, deleted, or crawled — when, and by which source (
cli,mcp,crawler).Surfaced as a new
memd historyCLI command and ahistoryMCP tool, both filterable byaction/type/scope/since.Why
Until now, once a memory was updated or forgotten its prior state was gone with no record the event ever happened. Users asked to see what changed over time. This gives an auditable, queryable feed of mutations.
How
memory_eventsMeilisearch index (no embedder; a plain log). One metadata-only document per event:action,memory_id, atitle/type/scopesnapshot,source,ts, plusdetailfor crawl summaries. Created idempotently at daemon startup alongsidememories.MemoryService, the single chokepoint every mutation already passes through:savelogscreateonly on a real write (the content-hash dedup early-return logs nothing).update/forgetgained aSourceargument;forgetsnapshots the doc's metadata before deleting so the row stays readable afterward.insert_no_wait— a logging failure never blocks or fails a memory mutation (mirrors the existingbump_accessedpattern).MeiliClientis now index-aware (for_index) so the log reuses the same upsert/search plumbing.docs/superpowers/specs/2026-06-15-memory-history-design.md.Notes for reviewers
memory_eventsindex is created at daemon startup, so an existing daemon must restart on this build before the log goes live. History accrues from that point forward — past mutations are not backfilled (we can't reconstruct them).memd statusnow shows anevents:count.Verification
cargo build,cargo test(36 pass, incl. 5 new history tests),cargo clippy(0 warnings),cargo fmt --check— all clean.add→historyshowed the create;forget→history --action deleteshowed the delete with the title preserved post-deletion;statusreported the event count. Test artifacts cleaned up.