Skip to content
Agent Field Notes
Practice topicsFilter practice questions by topic.All practice →
knowledge unit 38IntermediateSystem designAbout 12 minutes

Understand → Implement → Debug → Design

Memory authority comes from source and purpose, not job completion

Reject wrong attribution, apply future corrections and fence old sources through revoke/reconsent.

Memorymemory accesspollution

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

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 · Memory authority comes from source and purpose, not job completion

Understand the core principles first

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.

Visual guide · Reject late jobs with stale authority or source order

Reject late jobs with stale authority or source order

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.

Memory write and read fences across source, valid time and revocation
  1. 1
    Candidate

    Attribute subject, assertion, purpose and source event.

  2. 2
    Trusted control

    Compare source sequence, expected revision and revocation generation.

  3. 3
    Ledger

    Commit payload/provenance with valid interval and advance revision.

  4. 4
    Correction/revocation

    End the prior valid interval or delete payload and fence old sources.

  5. 5
    Protected read

    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.

Check understanding with a question

How do memory admission, valid time and revocation stop stale background writes?

Compare with the reference answer

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.

Implementation and trade-offs

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.

code example

Reproducible local boundary check

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) 0

Engineering deduction

scene
Authored event10 preference, future event20 correction, late event11 extraction, event30 revoke and fresh event41 reconsent.
design decisions
Use separate source/revision fences, valid intervals and persistent revocation control around actual local writes/reads.
Verify target
Event11 is rejected even after rebasing; read150/read250 show correct temporal values; revocation removes local payload and blocks reuse; fresh reconsent creates revision4.
applicable boundary
No extraction model, real user data, cache/vector purge or old-backup restoration/physical erasure is exercised.

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.

Verified system state instead of a casual preference

Changing conditions:The source becomes an authoritative order-status tool rather than a user sentence.

Extended question:How does admission and validity change?

Derivation and reference solutions

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.

One email tone versus reusable preference

Changing conditions:The user asks for a firmer tone only in the current message.

Extended question:Should this become a general communication style?

Derivation and reference solutions

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.

Easy to make mistakes

  • Attributing a third-party quote to the current user.
  • Treating an imported or late-completed old conversation as the newest assertion.
  • Retrying with a fresh revision while losing the original source identity.
  • Deleting only payload while delayed writers or stale backups can revive it.

References

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.

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
Explains attribution/reuse admission and distinguishes valid time from ingestion time.
Intermediate and advanced signals
Works through stale async correction, rebased old source and revoke/reconsent with exact local revisions/read results.
Senior criteria
Defines authoritative conflict order, retroactive review and current revocation fencing across replicas, caches and old backup import with explicit propagation tradeoffs.

View verification records for independent examples

Hands-on verificationComplete on demand · Suggestions40 minutes

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.

Expand acceptance requirements and checkpoints
  • Quote/inference/temporary-purpose candidates fail the bounded admission policy.
  • The future correction preserves vegetarian before200 and vegan from200.
  • Old event11 fails both stale revision and rebased source-order checks.
  • Revocation blocks reads/writes and removes local payload; reconsent requires a fresh trusted event.
  • The backup design consults current authority rather than trusting restored old control.

Key inspections

  • Separates self statements, quotations, inference and temporary instructions.
  • Uses source sequence, valid time and storage time as different evidence.
  • Checks expected revision and source order against stale/rebased async jobs.
  • Fences reads/writes after revocation and states derived-store/backup limitations.