Skip to content

feat(memory): add lifecycle controls#144

Merged
BunsDev merged 2 commits into
mainfrom
feat/memory-lifecycle
Jul 8, 2026
Merged

feat(memory): add lifecycle controls#144
BunsDev merged 2 commits into
mainfrom
feat/memory-lifecycle

Conversation

@BunsDev

@BunsDev BunsDev commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds typed memory retention classes with default expiry windows and legal-hold force guards.
  • Adds coven-code memory operator controls for list, expire, redact, delete, scoped hosted deletion, and tombstone ledger export.
  • Documents retention defaults, operator controls, and audit-ledger privacy behavior.

Context

  • Related issue/user request: fixes Add memory retention, deletion, and redaction controls #109
  • Scope: hosted/local memory lifecycle controls in core, CLI admin surface, tests, and docs.
  • Non-goals: provider additions, hosted dashboard UI, or changes to team sync semantics beyond preserving tombstone ids.

Changes

  • Parses retention_class into a typed RetentionClass and derives effective expiry from created_at when no explicit expires_at exists.
  • Adds a frontmatter upsert helper plus core expire/delete/redact helpers that preserve generated memory ids in tombstones and require --force for legal hold expiry/deletion.
  • Adds crates/cli/src/memory_admin.rs and a fast-path memory subcommand with human and JSON output.
  • Adds ledger safeguards so only canonical [REDACTED: ...] / [DELETED: ...] reason stubs are exported, never arbitrary tombstoned body content.
  • Updates configuration, commands, advanced, and docs-site configuration references.

Validation

Record exact commands and outcomes. Mark items N/A with a reason when they do not apply.

  • git diff --check — passed with exit 0.
  • cargo fmt --all — passed with exit 0.
  • CARGO_INCREMENTAL=0 cargo check --workspace — passed with exit 0.
  • CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets -- -D warnings — passed with exit 0.
  • cargo test --workspace — not run; targeted tests cover changed core and CLI surfaces per issue scope.
  • Targeted/manual checks:
    • CARGO_INCREMENTAL=0 cargo test --package claurst-core -- claudemd memdir team_memory --quiet — 105 passed, 0 failed.
    • CARGO_INCREMENTAL=0 cargo test --package claurst -- memory_admin --quiet — 5 passed, 0 failed.
    • code-review subagent reviewed the uncommitted implementation; identified ledger leakage, admin scan cap, inclusive expiry, and tombstone id preservation; fixes were implemented and re-verified.
  • Not run: full workspace tests; targeted commands above were selected to cover the touched Rust crates and required memory lifecycle behaviors.

PR Readiness

  • Diff is limited to the intended files.
  • Generated files were not edited by hand.
  • User-facing docs/help were updated or are not needed.
  • No secrets, credentials, local paths, or unrelated logs are included.
  • Remaining risks or follow-up work are listed above.

BunsDev and others added 2 commits July 8, 2026 06:07
fixes #109

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fixes #109

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 8, 2026 11:39
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Jul 8, 2026 11:39am

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds memory lifecycle controls (retention defaults, expiry, redaction, deletion) for hosted/local memory, plus an operator-facing coven-code memory CLI surface and documentation, to meet the retention/deletion requirements in #109.

Changes:

  • Introduces typed RetentionClass and derives effective expiry from created_at when expires_at is absent (with inclusive expiry handling in core).
  • Adds core helpers to expire/delete/redact memory files while preserving generated memory IDs in tombstones and guarding legal-hold entries behind --force.
  • Adds coven-code memory admin subcommands (list/expire/redact/delete/ledger) and documents retention defaults and operator workflows.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src-rust/crates/core/src/memdir.rs Adds expire/delete/redact helpers, legal-hold guard, and tombstone ID preservation.
src-rust/crates/core/src/claudemd.rs Adds RetentionClass, effective expiry derivation, and a frontmatter upsert helper; updates hosted filtering to use effective expiry.
src-rust/crates/cli/src/memory_admin.rs Implements coven-code memory operator commands, filtering, and tombstone-only ledger export.
src-rust/crates/cli/src/main.rs Wires a fast-path memory subcommand to the new admin handler.
docs/src/content/configuration.js Documents retention classes and operator commands on the docs site.
docs/configuration.md Adds retention defaults table and detailed operator control documentation.
docs/commands.md Adds memory to the command reference list.
docs/advanced.md Notes hosted invariants and the new operator memory lifecycle controls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +296 to +309
let effective_expires_at = effective_memory_expires_at(&file.frontmatter)
.map(|date| date.format("%Y-%m-%d").to_string());
let status = if file.frontmatter.deleted_at.is_some() {
MemoryStatus::Deleted
} else if file.frontmatter.redacted_at.is_some() {
MemoryStatus::Redacted
} else if effective_memory_expires_at(&file.frontmatter)
.map(|date| date < chrono::Local::now().date_naive())
.unwrap_or(false)
{
MemoryStatus::Expired
} else {
MemoryStatus::Active
};
Comment on lines +116 to +126
fn handle_redact(args: &[String]) -> anyhow::Result<()> {
let (target, reason, _force, dirs) = parse_target_reason_args(
args,
"usage: coven-code memory redact <id-or-path> --reason <text>",
)?;
let entry = resolve_for_operation(&target, dirs)?;
redact_memory_file(&entry.path, &reason)
.with_context(|| format!("failed to redact {}", entry.path.display()))?;
println!("redacted {}", entry.id);
Ok(())
}
@BunsDev
BunsDev merged commit ccd3894 into main Jul 8, 2026
4 checks passed
@BunsDev
BunsDev deleted the feat/memory-lifecycle branch July 8, 2026 12:10
BunsDev added a commit that referenced this pull request Jul 8, 2026
#145)

Ports the team-memory conflict inspection and resolution operations from
PR #142 onto the coven-code memory operator surface that landed in #144:

- coven-code memory conflicts [--dir <team-memory-path>] [--json] lists
  unresolved pull conflicts (key, kind, reason)
- coven-code memory resolve-conflict <key> [--dir <path>] removes the
  persisted conflict record after validating the key against traversal

closes #142

Co-authored-by: romgenie <5861166+romgenie@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BunsDev BunsDev mentioned this pull request Jul 8, 2026
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add memory retention, deletion, and redaction controls

2 participants