Agent Application DevelopmentAccount
Knowledge catalogChoose core direction and segmented content
knowledge unit 26AdvancedImplementationAbout 14 minutes

Understand → Implement → Debug → Design

Revoke memories, clean up derivatives, and prevent stale data from returning

Connect deletion to recovery and handle old state with undo versioning, provenance verification, physical cleanup, and failure testing.

AmnesticsCancelCheckpointversionrestore

Knowledge content check2026-10-03 · Check the source of the original question2026-10-02

Which step do you want to learn from this knowledge point?

Select the starting point based on the current basis, or you can go deeper one by one. When you encounter an unfamiliar concept, go back to the core principles first; use the knowledge exercises to check your understanding when you are finished.

Understand first

New to this knowledge point

Complete the prerequisite concepts, read the principles and counterexamples, and then explain why in your own words.

Start with core principles →

Implement next

Prepare to write the principles into code

Understand implementation steps and boundaries, complete small tasks, and check results against acceptance requirements.

View the code example →

Debug failures

Need to handle failures and changes in conditions

Follow the continuous questioning to locate the failure premise, and then compare the migration cases to explain how the plan should be adjusted.

Continue to delve deeper into the problem →

Compare designs

Need to design or review plans

Combine engineering deductions and senior self-evaluation standards to explain the applicable conditions, costs and alternatives of the plan.

Analyze engineering scenarios →
Knowledge unit directory

LEARN · PRACTICE · REFLECT

Knowledge learning and personal records

My notes and review ↗

First read along the principles, Q&A and migration cases. When you need to check your understanding, switch to reinforcement exercises or start personal recording.

Answers and personal notes

Each modified commit will be kept as an independent history. Your level of mastery is up to you to evaluate yourself against the standards.

Core concept · Revoke memories, clean up derivatives, and prevent stale data from returning

Understand the core principles first

Preparatory concepts:Copy and derive data, Version condition writing, Checkpoint recovery

Deleting the text and prohibiting its reuse are separate steps. The authoritative revocation state must participate in reads and writebacks before the old replica, otherwise old checkpoints, backfills, or caches will reintroduce deleted facts.

One deletion does not erase a dependency chain

Memory may appear in summaries, vectors, answer caches, and checkpoints. A store delete handles its specified item without finding every derivative. Recovery can write an old summary back after deletion. This resurrection reflects missing cross-copy revocation rules.

Revoke use before physical cleanup

Record revocation and a new version in authoritative metadata. Filter revoked references before reads and model dispatch, checking versions on writeback. Then clean text, vectors, and caches through source dependencies and track each confirmation. Tombstones retain only the non-payload information needed to prevent resurrection, under the retention policy. Audit convenience cannot justify indefinite retention of deleted text.

Versions prevent stale writeback

A scope epoch invalidates all earlier context at the cost of broad rebuilding. Per-item versions are more precise but require summary dependencies and additional checks. Combine item revocations with scope changes for major authorization events. This is application design, not automatic end-to-end erasure by a framework.

State the actual deletion boundary

Database deletion cannot recall data already sent remotely. Define when revocation takes effect, future-use prevention, and cleanup progress. Hidden UI content does not establish that every copy disappeared. Restored backups, offline indexes, and retries must merge current revocations before serving data. Serving yesterday’s restored database directly can resurrect later deletions.

Check understanding with a question

After the user deletes the memory, why is it possible to revive it by restoring from an old Checkpoint? How to stop it?

Deleting a store row does not erase summaries, checkpoints, vectors, or caches. Record revocation and advance the scope version, checking references before recovery and use. Reject stale writeback of revoked facts. Invalidate use first, then clean copies asynchronously and report progress. Database deletion cannot recall data already sent to remote models or tools.

Implementation and trade-offs

Deleting a record does not mean deleting all used paths.

Long-term memory may be copied into summaries, checkpoints, retrieval caches, vector indexes, derived facts, and debug traces. If the recovery logic trusts the complete memory text in the old checkpoint, it can bypass the deletion of the long-term store. A more insidious situation is when a background fetch task reads an old conversation, then writes out the same facts again after the deletion is complete. The delete interface of LangGraph store is responsible for deleting the key; checkpoint is another state persistence mechanism, and it cannot be inferred that all derived data will disappear automatically. This requires the application to establish its own deletion and recovery contracts.

Use revocation versions to fence reads and writes

Maintain memory_epoch on user or project scope. When deleting, write the tombstone in the transaction, increase the epoch, and make the main database record unreadable. Checkpoint only saves the memory_id, source version and reading epoch. After recovery, the current epoch is queried first; if there is any inconsistency, the summary containing the memory is recalled and reconstructed. Background writes also carry the epoch when reading, the current version must be compared when submitting, and old task writes are rejected. The epoch only prevents old generation submissions; new tasks must also check tombstones bound to stable memory identifiers, sources, and derivation relationships, and cannot change IDs to reconstruct revoked facts. Exclude revoked source clips when extracting. Record-by-record undo can be more granular, and scoped epochs are easier to implement but invalidate the entire cache for that scope; the choice depends on the amount of data and frequency of deletions.

Logical invalidation and physical cleanup are completed in stages

The API can return "discontinued" before cleaning up deletable copies in vector indexes, caches, summaries, historical states, and backups. Each cleanup target has job status and failure retries, and you cannot just set a deleted boolean and declare that all replicas have been cleared. Avoid writing sensitive original text to the log again when retaining deletion receipts and necessary audit metadata. When restoring old backups, synchronize the undo records first, otherwise the historical copies will re-enter the service. The retention policy and allowed cleanup scope should be defined by product and data management requirements. The mechanism in this article belongs to engineering design and does not replace specific compliance judgment.

The focus of acceptance is old status and concurrent writing

Create a preference, form a checkpoint and summary, then delete it and restore it from the old checkpoint. Neither the request recovery context nor the final answer nor the newly generated summary contain it. Concurrency tests have background fetches stop before writes and continue after deletions, requiring epoch comparisons to reject old writes. Also covers vector cleanup failures, cache not flushed, and backup restores. The example only demonstrates the rejection of old content after version mismatch; there is still a race condition between pre-call verification and actual sending, and strong semantics require unified submission coordination. Remote requests that have been sent and results that have been read by the user cannot be reversed through the delete operation.

code example

The old checkpoint refuses to restore the original text when it encounters a revoked version.

The Python standard library works. The demonstration logic is rejected and does not demonstrate physical deletion, index cleaning or cross-system sending coordination; production still needs to deal with the race condition of verification and calling.

import sqlite3
c = sqlite3.connect(':memory:')
c.executescript("CREATE TABLE scopes(id TEXT PRIMARY KEY, epoch INTEGER); CREATE TABLE memory(id TEXT PRIMARY KEY, scope TEXT, body TEXT, deleted INTEGER); INSERT INTO scopes VALUES('u1',1); INSERT INTO memory VALUES('m1','u1','prefer email summaries',0);")
checkpoint = {'scope':'u1', 'epoch':1, 'memory_id':'m1'}
with c:
    c.execute("UPDATE memory SET deleted=1 WHERE id='m1'")
    c.execute("UPDATE scopes SET epoch=epoch+1 WHERE id='u1'")
def restore(cp):
    epoch = c.execute('SELECT epoch FROM scopes WHERE id=?',(cp['scope'],)).fetchone()[0]
    if epoch != cp['epoch']: return 'rebuild context'
    row = c.execute('SELECT body FROM memory WHERE id=? AND scope=? AND deleted=0',(cp['memory_id'],cp['scope'])).fetchone()
    return row[0] if row else 'rebuild context'
print(restore(checkpoint))

expected output

rebuild context

Engineering deduction

scene
Hypothetical engineering scenario: The user revokes the "Send Email Digest" preference and an old task is subsequently resumed.
design decisions
Improve the user memory epoch, recall it again during recovery, and prohibit old background extraction tasks from writing canceled versions.
Verify target
The acceptance goal is that the plan after restoration will no longer use the old preferences as the basis for sending emails.
applicable boundary
Already sent emails cannot be undone; physical cleanup of historical copies is tracked separately.

Continuous questions and answers

Continue reading along with the premises and constraints of the problem. Understand the reference answers first, then try to put away the answers and explain the cause and effect and trade-offs in your own words.

Draw inferences from one example: If the conditions change, how to deduce it?

First find out the conditions for change, and then determine which premises in the original plan still hold true. The following cases are teaching deductions to facilitate the transfer of principles to new problems.

Memory correction rather than outright deletion

Changing conditions:The user changed "Use Java" to "Use Go for the current project"

Extended question:Can I directly overwrite the string and keep the old digest?

Derivation and reference solutions

No. New fact records specify scope and validity time, invalidating conflicting old facts and allowing summaries, indexes, and caches that depend on the old facts to be rebuilt. If the new fact only applies to the current project, other project memories should not be accidentally deleted. Keep the source of corrections to avoid old Checkpoints rewriting Java to current facts.

The principles that remain unchanged:Both correction and revocation require controlling the propagation of old versions, but the scope of invalidation is determined by the fact scope.

Re-import after offline export

Changing conditions:Old memory copies exist outside the system

Extended question:The deleted memory appears in the imported file again. Do you want to restore it?

Derivation and reference solutions

When importing, the stable identity, source generation and revocation records are checked, and the resurrection of old records is refused by default. When the user explicitly requests to resave, it can be processed according to the new authorization and new generation, and the old deletion is still valid; the content cannot be regarded as a new fact just because the file was recently uploaded. Sensitive imports that cannot be associated with identities require more conservative admissions.

The principles that remain unchanged:Arrival time cannot override authoritative revocation, and legal re-creation must have a new and explicit basis.

Easy to make mistakes

  • Only delete vectors, do not delete or block summary sources
  • When restoring an old checkpoint, trust the original text directly.
  • There is no version check in background extraction, and it is written back after deletion.
  • Declare "discontinued" as "all backups physically deleted"

References

It is designed based on public technical information; the reference materials support the technical mechanism, and the scenarios and scoring standards are designed by this website and do not represent the original interview questions of a certain company. New Q&A and migration cases are added for principle explanation, and source verification and case operation verification are recorded separately.

Check how far you understand

After reading, you can explain the principles, boundaries, and trade-offs against these standards. It is up to you to evaluate your mastery; if further verification is needed, complete the small tasks below.

Basic standards met
Understand that deleting a master record does not equal cleaning up all derived copies.
Intermediate and advanced signals
Check tombstones, versions, and reference validity when restoring.
Senior criteria
Verification of design summary reconstruction, cache index invalidation and old backup recovery non-resurrection.

View verification records for independent examples

Continue to do advanced research experiments

Why can’t the old context continue to be used after the policy changes?

Transferring pre-retrieval filtered ideas to memory versions and recovery. Observe how existing drafts become invalid after cancellation.

Read full text and fault analysis → · Download Reliability Experiment v3 ↓

python3 cli.py memory-put --db memory.sqlite
python3 cli.py submit --db memory.sqlite
python3 cli.py run --db memory.sqlite --lease-seconds 2 --fault after_draft
python3 cli.py memory-forget --db memory.sqlite
# 等待至少 2 秒后分别执行
python3 cli.py run --db memory.sqlite
python3 cli.py inspect --db memory.sqlite

Keep evidence and check item by item

  • The draft checkpoint already exists after the first exit.
  • Recovery after memory-forget gets failed with memory_changed_or_expired.
  • No publish checkpoint; explain the difference between fail blocking and complete deletion.

Verify local scope, version, and undo blocking; old checkpoints remain, no complete deletion of logs, backups, or checkpoints is provided.

Hands-on verificationComplete on demand · Suggestions15 minutes

Recovering from an old checkpoint with revoked memories, illustrating the filtering and rebuilding process.

Expand acceptance requirements and checkpoints
  • Undo records do not enter the model
  • Old summaries cannot continue to leak content
  • Recovery results are auditable

Key inspections

  • Ability to enumerate state and derived copies that still exist after deletion
  • Ability to design reads for immediate invalidation and subsequent physical cleanup
  • Ability to verify current permissions and versions before restoring old checkpoints
  • Can handle race conditions between deletion and background fetch and write