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 →Understand → Implement → Debug → Design
Reject wrong attribution, apply future corrections and fence old sources through revoke/reconsent.
Knowledge content check2026-10-11 · Check the source of the original question2026-10-11
It is recommended to understand first:
Memory scopes and trusted authorization context →RAG evidence: applicability, complete context and supported claims →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.
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 →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 →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 →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 →LEARN · PRACTICE · REFLECT
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.
Can be practiced directly. After logging in, answers, favorites, and notes will be saved to your account.
Log in and saveEach 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 · Memory authority comes from source and purpose, not job completion
Preparatory concepts:Attributable assertion and reuse policy, Conditional writes and authoritative source ordering, Valid intervals and revocation generation
Persisted reuse needs trusted attribution, applicable time and current consent; asynchronous completion cannot outrank a later source correction or revive revoked facts.
Revision, source order and revocation protect different windows. Rebasing a stale job does not make its old source current. Select the figure to open it at full size.
A durable memory affects many later tasks, so writing a sentence changes its impact beyond temporary context. The ledger must preserve the original subject and source rather than turn model guesses into asserted preferences.
Revision detects concurrent changes, source order prevents stale rebasing and valid time chooses which accepted fact applies. Revocation separately prevents reuse and old-job resurrection. All three are necessary in the asynchronous counterexample. See the memory write course and adjacent conflict/revocation units.
Attribute subject, assertion, purpose and source event.
Compare source sequence, expected revision and revocation generation.
Commit payload/provenance with valid interval and advance revision.
End the prior valid interval or delete payload and fence old sources.
Require current consent/control, matching purpose and applicable valid time.
stored_at measures ingestion; it does not grant source precedence. Distributed purge and old-backup reconciliation are design obligations, not tested local results.
Admit only attributable, purposeful reusable facts under an explicit policy. Bind trusted subject/scope and source identity/order; store effective intervals separately from ingestion time. Conditional revision plus newer-source checks block stale asynchronous writes. Revocation deletes local payload and advances persistent control; fresh explicit reconsent cannot be replaced by replaying an old conversation.
The bounded policy admits explicit self meal-planning preferences, not a colleague's quoted diet or one-email tone instruction. Candidate fields include source_id/seq, base_revision, purpose and valid interval; authenticated identity and authoritative source order must come from trusted systems rather than model assertions.
The local ledger stores vegetarian at event10/revision1, then vegan at event20/revision2 effective from200. Read150 returns vegetarian; read250 returns vegan. An event11 extraction finishing at stored_at900 fails stale_revision. Rebasing to revision2 still fails stale_source_event, so a retry cannot promote old evidence to a new assertion.
Revoke at event30 deletes local payload and advances revision3/last_seq30/revoked1. Reads return None and old sources cannot recreate the fact. A fresh event without explicit reconsent fails; trusted fresh reconsent at event41 can create revision4 with a new interval. Setting a flag on an old event does not make it fresh consent.
Actual local admission, temporal and revocation checks are tested. The reopen test reuses the current local database, not an old backup. Distributed indexes, caches, derived exports and old backup restoration need current independent revocation authority, propagation/purge acknowledgments and a chosen stale-read policy. No model extraction accuracy or physical backup erasure is claimed.
The admission boundary requires reusable/reconsent to be actual booleans. The string "False" is truthy in Python but is not consent; Candidate(reconsent="False") is rejected as candidate_shape. Type correctness still does not authenticate consent: the caller must supply a current authoritative event for the correct subject and purpose.
Python 3.9+, standard library. Extract /lab/deep-dive/agent-core-deep-dive-v1.zip and run this snippet beside memory_write_deep_dive.py; /lab/deep-dive/memory_write_deep_dive.py is also available. Authored fixtures only; not a live model or external service.
from dataclasses import replace
from memory_write_deep_dive import Memory,Candidate
m=Memory()
assert m.admit(Candidate(reconsent='False'))['reason']=='candidate_shape'
m.admit(Candidate())
m.admit(Candidate(value='vegan',source_id='event-20',source_seq=20,base_revision=1,valid_from=200))
old=Candidate(source_id='event-11',source_seq=11,base_revision=1,stored_at=900)
assert m.admit(old)['reason']=='stale_revision'
assert m.admit(replace(old,base_revision=2))['reason']=='stale_source_event'
m.revoke(30)
assert m.read(250) is None
print(m.control(),m.db.execute('SELECT COUNT(*) FROM facts').fetchone()[0])
m.close()
expected output
(3, 30, 1) 0Continue 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.
Level 1How do you handle a quoted statement about another person?
Changes statement shape without changing its attributed subject.
Preserve speaker, subject and reference boundaries. Under this self-preference policy reject third-party quotations; if another product needs third-party facts, use an appropriate separately scoped purpose/source policy. Unclear attribution stays temporary or requires clarification rather than becoming the user profile.
Level 1A preference changes effective next week. Overwrite immediately or retain intervals?
Adds future business validity to a correction.
Retain the old fact until the new effective time and store the correction's source/interval. The local ledger ends the old interval at valid_from and queries [from,to). Completion time is audit information, not when the preference applies. Retroactive complex changes are routed to review.
Follow this answer further
Level 2An old extraction completes after that correction. What must the write compare?
Introduces an asynchronous old writer after a newer event.
Its original base_revision and trusted source_seq against current control. Reject stale revision; if a retry rebases, still reject the old source sequence. Preserve source identity across retries so the extractor cannot promote an old statement to a fresh assertion.
Follow this answer further
Level 3The old conversation is imported today after the user revoked the fact. Does today's stored_at or reconsent=True flag allow reuse?
Adds revocation and historical import to the stale-source race.
No. Reconcile import against current revocation generation and source order; old event identity remains old. Fresh reconsent must be independently trusted, newer than revocation and purpose/subject bound. A model flag or ingestion timestamp cannot recreate consent. Old backups require current control outside the rolled-back snapshot.
Level 1Why can a higher memory hit rate make tasks worse?
Changes the objective from write/hit volume to actual reuse quality.
More hits can mean stale, misattributed, out-of-purpose or revoked material is reused. Measure downstream task benefit and contamination, with separate scope, stale-source, unjustified-inference and revocation-lag slices. Retrieval count is not accuracy or consent compliance.
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.
Changing conditions:The source becomes an authoritative order-status tool rather than a user sentence.
Extended question:How does admission and validity change?
Keep tool receipt/version, object scope and observation/effective time. A verified snapshot can be authoritative for that object at that time but may expire rapidly; it is not a permanent user preference. Read current status for actions whose precondition can change, and retain source identity through corrections.
The principles that remain unchanged:Reuse remains bound to appropriate source, scope, purpose and applicable time.
Changing conditions:The user asks for a firmer tone only in the current message.
Extended question:Should this become a general communication style?
No without an explicit reusable assertion or confirmation under policy. Keep it in task context. If the user later states a durable style preference, create a fresh attributable event with purpose/validity, rather than importing the old one-task command as consent.
The principles that remain unchanged:Temporary task intent cannot silently acquire a longer lifespan or broader purpose.
Official mechanisms were checked on 2026-10-11. Examples and schedules are authored; local Python/SQLite outputs are actually executed. No enterprise incident, live model accuracy or production reliability is asserted. New Q&A and migration cases are added for principle explanation, and source verification and case operation verification are recorded separately.
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.
View verification records for independent examples
Run memory_write_deep_dive.py and MemoryTests. Save the event10/20/11/30/41 timeline, source and revision comparisons, reads at150/250 and payload row count after revoke. Design an old-backup quarantine/reconciliation step.