Repository navigation
feat: Safe Memory Lifecycle (v0.13.0) — soft delete, dynamic cap, CLI/API - #938
Merged
Merged
Conversation
…I/API Implements a complete safe memory lifecycle system that prevents accidental data loss through automated processes. Lifecycle flow: ACTIVE → soft_deprecate() → DEPRECATED (hidden, restorable) → prune() → HARD DELETE Core changes: - LifecycleConfig struct with 11 conservative fields (#928) - Store: deprecate_with_reason, undeprecate, deprecate_by_ids (#929) - aging_cleanup: conditional soft-delete when soft_delete_only (#930) - consolidate/dream dedup: soft-delete duplicates (#931) - forget/bulk_forget: redirect to soft-delete (#932) - lifecycle_cycle(): 2-phase (deprecate + prune) with percentage cap (#933) - Server: auto-aging thread → auto-lifecycle thread (#934) - CLI: lifecycle cycle/promote/status/restore commands (#935) - API: GET /lifecycle/status, POST /lifecycle/cycle, POST /lifecycle/promote (#936) - Docs: configuration.md, cli-reference.md, api-reference.md, memory-lifecycle.md (#937) Hard delete only in 2 controlled paths: prune() (expired TTL) and forget() (only when soft_delete_only=false). Migration: deprecate_reason column via column_exists() pattern. No schema version bump, no manual migration required.
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (5)
Review powered by cora-code · BYOK · MIT |
Humanizer/copy-editing fixes across 4 lifecycle docs: - Replace 16 em dashes with colons/periods (humanizer §14) - Remove promotional bold on 'safe' (memory-lifecycle.md, configuration.md) - Fix version string 0.12.0 → 0.13.0 (cli-reference.md, README.md) - Fix ConsolidateRequest schema ordering bug (api-reference.md) - Update test count 431 → 460+ (README.md) README local-first + Docker positioning: - Reframe tagline: 'Local-first by default. Docker ready.' - Reframe Quick Start: remove misleading 'No Docker' claim - Add Docker callout blockquote in Quick Start section - Add new 'Deployment Modes' section (local-first vs Docker/server) - Add 'Docker Ready' row to Performance & Privacy table - Reframe 'Single Binary' description (drop 'No Docker needed')
Comparison table & FAQ: brand names → generic labels (Tool A-G) to avoid legal exposure from typos or outdated claims. Added disclaimer noting capabilities assessed from public docs as of Aug 2026. Humanizer fixes across README + coordination docs: - README.md: 14 em dashes → colons/periods (banner alt, headings, prose, FAQ, license, star CTA) - docs/rooms.md: 8 em dashes fixed (title, intro, bullets, links) - docs/multi-agent.md: 11 em dashes fixed (namespaces, bullets, best practices, global docs) - docs/configuration.md: 1 em dash fixed (update check section) Memory lifecycle docs confirmed clean (fixed in prior commit). docs/comparison.md was already clean (generic archetypes).
blog/comparison-2026.md: - 14 em dashes fixed (prose, categories, bullet lists, table cells) - Added date stamp: Published August 2026 - Added disclaimer: verify current specs before making decisions This blog post was already archetype-based (no brand names). Em dashes were the remaining humanizer issue.
1. Test: forget_tests expectations updated for soft-delete behavior - Tests now assert deprecated=true (not is_none) after forget() - deprecate_with_reason() returns Err for non-existent IDs 2. CodeCora: 3 alerts fixed - lifecycle_cycle respects soft_delete_only config (skips hard prune) - promote() response reflects actual restored bool (not hardcoded true) - CLI lifecycle commands accept --json flag via cli param 3. API Docs: regenerated docs/api-reference.md via docgen 4. API Registry: added lifecycle routes to ENDPOINTS (/lifecycle/cycle, /lifecycle/promote, /lifecycle/status) All 466 tests pass, 0 clippy warnings.
CodeCora correctly identified that blocking prune with soft_delete_only contradicts the documented design. soft_delete_only only restricts forget() from hard-deleting ACTIVE memories. The prune phase operates on memories that are already DEPRECATED and past their TTL, which is the intended hard-delete path regardless of soft_delete_only.
| format!("dream dedup: superseded by {to_keep} (similarity ≥ threshold)"); | ||
| self.store | ||
| .deprecate_with_reason(to_remove, &reason) | ||
| .map_err(|e| Error::db("consolidate soft-delete", e))?; |
| return Ok(CleanupResult { deleted: 0 }); | ||
| } | ||
|
|
||
| if lc.soft_delete_only { |
| 0 | ||
| }; | ||
|
|
||
| // Remove deprecated from vector index. |
| "Memory with id='{id}' not found in store. Nothing was deprecated." | ||
| ))); | ||
| } | ||
| // Already deprecated: idempotent success |
| self.store.deprecate_with_reason(id, reason)?; | ||
| // Remove from vector index so it doesn't appear in recall. | ||
| let mut index = self | ||
| .index |
This was referenced Aug 8, 2026
ajianaz
added a commit
that referenced
this pull request
Aug 13, 2026
feat: Safe Memory Lifecycle (v0.13.0) — soft delete, dynamic cap, CLI/API
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.
Safe Memory Lifecycle
A complete lifecycle system that prevents accidental data loss through automated processes. Every memory goes through a reviewable soft-delete state before eventual pruning.
Why
Agents accumulate stale memories over time: outdated facts, superseded decisions, duplicated knowledge. Without a lifecycle system, users have two bad options: manually prune (tedious, error-prone) or let the store grow unbounded (slower recall, higher memory).
This PR introduces a configurable lifecycle pipeline that automatically deprecates aged memories while keeping them restorable. Hard delete only happens through explicit, intentional paths (prune expired-after-TTL or forget with soft_delete_only=false).
Lifecycle Flow
What Changed
LifecycleConfigstruct with 11 conservative fieldsdeprecate_with_reason(),undeprecate(),deprecate_by_ids()soft_delete_only = true(default)uteke lifecycle cycle | promote | statuswith--jsonsupportGET /lifecycle/status,POST /lifecycle/cycle,POST /lifecycle/promoteHard Delete: Only 2 Paths
prune()— Expired deprecated memories (past TTL, by design)forget()— Only whensoft_delete_only = false(NOT default)Everything else (
delete(),bulk_delete(),aging_cleanup(),consolidate()) redirects to soft-delete.Testing
forget_testsupdated for soft-delete expectations (3 tests verify deprecated=true after forget, not is_none)deprecate_with_reason()now returns Err for non-existent IDs,promote()response reflects actual bool,lifecycle_cyclerespectssoft_delete_only, CLI lifecycle commands support--json/lifecycle/cycle,/lifecycle/promote,/lifecycle/status) registered in ENDPOINTScargo fmt --allcleanChecklist
cargo fmt,cargo clippy)cargo test --workspace)cargo run -p docgen)