Feat: memory deletion — clearNamespace / forget / list (soft-delete) [WALM-115]#287
Draft
hungtranphamminh wants to merge 6 commits into
Draft
Feat: memory deletion — clearNamespace / forget / list (soft-delete) [WALM-115]#287hungtranphamminh wants to merge 6 commits into
hungtranphamminh wants to merge 6 commits into
Conversation
…-115]
Add a soft-delete tombstone (deleted_at, migration 010) and three owner-scoped
endpoints on the relayer:
- POST /api/clear-namespace — soft-delete every memory in a namespace
- POST /api/list — enumerate a namespace (metadata only, no decrypt),
keyset-paginated via (created_at, id) cursor + has_more
- POST /api/memories/forget — soft-delete one memory by its per-row id
Soft-delete stops a memory surfacing in recall (and the analyze pre-extraction
context) while retaining the row; the underlying Walrus blob persists. The hard
DELETE path (/api/forget) is left untouched for benchmark-harness cleanup.
stats() now excludes tombstoned rows. Includes Rust unit tests (SQL invariants,
cursor keyset/tie-break, stats live-only) and e2e coverage (clear, list+forget,
pagination, per-row, cross-owner).
Expose the relayer's soft-delete endpoints on the TS SDK: clearNamespace(ns),
list(ns, { limit, cursor }) (metadata-only, cursor-paginated with has_more /
next_cursor), and forget(id). Docstrings carry the honest semantics — un-recallable
not erased, 0 = safe idempotent no-op, clearNamespace clears what exists at call
time. Bump 0.0.7 -> 0.0.8.
Mirror the memory-deletion API on the Python SDK: clear_namespace, list (with cursor pagination), and forget on both the async MemWal and the sync MemWalSync, plus the ClearNamespaceResult / MemoryListItem / ListResult / ForgetResult dataclasses and exports. Same honest docstrings as the TS SDK. Bump 0.1.4 -> 0.1.5.
Add the three deletion tools to the MCP sidecar (scripts/mcp/tools) and register default-namespace injection for clear_namespace + list in the client bridge (forget is id-scoped, so excluded). These call the SDK's clearNamespace/list/forget. Dormant until the MCP go-live: the sidecar Docker build installs a pinned published SDK that predates these methods, so the tools resolve them only once the sidecar is built against the new SDK (separate go-live PR). No version bump here.
…WALM-115] Add the memory-deletion API to the public docs: the 3 endpoints in the relayer api-reference, the TS + Python SDK method references, the SDK overview method lists, and a Quick Start snippet in the SDK README. Carries the honest semantics (soft-delete = un-recallable not erased; 0/cleared/forgotten = safe no-op; list is metadata-only + cursor-paginated). The hard /api/forget stays undocumented (harness-only), matching existing convention.
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
Why
The SDK exposed
remember/recall/restorebut no way to delete a memory or clear a namespace. After an agent reset, stale memories keep surfacing inrecall()— reported by two Walrus-Sessions-4 integrators (#258, +1 in-thread): a reset agent self-anchored on its own discarded outputs, and "day-one vs day-four" demo integrity broke on the same wallet. The only workaround (rotate the namespace string) orphans data forever.What
Adds owner-scoped memory deletion across the stack. Deletion is soft — a deleted memory immediately stops surfacing in
recall(), but the underlying Walrus blob persists (un-recallable, not erased).clearNamespace(ns)— soft-delete every memory in a namespace (the reset primitive).forget(id)— soft-delete a single memory by its per-row id.list(ns, { limit, cursor })— enumerate a namespace (metadata only — id, blob_id, created_at, importance; no decrypted text), cursor-paginated viahas_more/next_cursor.Delivered in: the relayer (
/api/clear-namespace,/api/list,/api/memories/forget) plus adeleted_atmigration, the TS SDK (0.0.8), and the Python SDK (0.1.5) — with unit + e2e tests and public API-reference docs (relayer + both SDKs). MCP sidecar tools are included but dormant — see Related.Solution
deleted_attombstone (migration 010): deletion stops a memory surfacing inrecall()(and the analyze pre-extraction context) while retaining the row. The underlying Walrus blob is user-owned and persists — "delete" means un-recallable, not cryptographically erased (carried honestly in all docstrings). Fits the privacy floor: no new server-readable plaintext./api/forgetis left untouched for benchmark-harness cleanup;clearNamespaceis a separate soft path.list()keyset pagination on(created_at, id)(stable tie-break, no skip/dup under concurrent deletes); metadata-only so it's decrypt-free.forget(id)of an id you don't own is a clean no-op (no cross-owner existence oracle).Types of Changes
Testing
cargo test/ harness tests passChecklist
Related
memwal_clear_namespace/memwal_list/memwal_forget) are added but dormant: the sidecar's Docker build installs a pinned published SDK that predates these methods, so the tools resolve them only once the sidecar is built against the new SDK. No MCP version bump in this PR.deleted_at IS NULLin restore's blob-discovery).