Review the prerequisites
Suitable for: Junior/mid-level AI application candidates with Python and backend fundamentals.
- Memory scopes and trusted authorization context
- The relevance, life cycle and visibility range of memory are three independent dimensions. Threads or namespaces provide organization, and real authorization is still determined by trusted identities and current resource relationships.
How does the mechanism work?
Step-by-step explanation
- After the user exits the project, how to deal with the context in the started task?
After static namespace separation, consider changes in the authorization lifecycle.
- Why might namespace prefix matching expand the read range?
The storage API's matching mechanism may expand candidates and must be separated from authorization.
- How to prioritize when organizational rules conflict with personal preferences?
Multiple authorized scopes can still have conflicting semantic priorities.
Design · Explain the trade-offs
Design · Revocation, export and project migration
Objectives of this level: Turn the small read contract into explicit changed-scope policies and an independently testable paged export boundary.
Visual guide · Scope comes from trusted identity
Namespaces organize candidates; current authority decides access. Caches of mixed personal/project/organization bundles must include the trusted user boundary. Select the figure to open it at full size.
Changed constraints
Design a version where project p1 moves from t1 to t2, 50 background extraction jobs are waiting, a user is removed while a run is paused, and an API exports memory one row per page. A requirement says no new private context may be sent after the revocation gateway commits. These are exercise inputs, not behavior already implemented by the capstone or SQLite fixture.
Derive the decisions
- Migration is not changing a tenant prefix. Reauthorize sources and current members, transfer only permitted project facts, and exclude t1 organization rules and personal preferences. Invalidate old paths, caches and derived summaries; do not assume historical ownership transfers automatically.
- Background jobs keep trusted initiating identity, scope, source version and authorization version. Recheck current write authority before applying an extracted fact; a saved model suggestion or an old membership snapshot cannot authorize a current write.
- Before recovery and send, remove now-inaccessible source facts and derived private summaries. Define the atomic boundary between a send gateway and revocation; checking membership then sending much later does not meet the strict requirement. Already transmitted content cannot be recalled locally.
- Direct reads, pages and exports need the same filtering as retrieval. A cursor is a locator, not permission. Recheck current context on each page; a cursor must not preserve a removed membership’s access or silently mix tenants.
- Organization policy and personal preferences need an explicit conflict rule. Authorized project facts may be useful, but similarity scores cannot decide whether approval is required. Storage consent, deletion and data validity remain different decisions.
Code deliverable and fixed grading input
Add page_ids(token, request, offset, limit, at=100) to your own implementation, reusing current authorization. For the untouched fixture, Alice/p1 with limit 1 returns ["r6"], ["r3"], ["r1"] and [] at offsets 0/1/2/3. Bob/p1 at offset 0 returns r2, not r6; t2/Alice returns r9. After setting Alice’s p1 membership inactive, her next page must be denied even if a previous page/cursor exists. Reject negative offsets and limits other than the exercise limit 1. These checks judge scope-preserving pagination; they do not implement a signed production cursor or a migration.
Submit the code/assertions plus a design note for migration and revocation. OWASP’s RAG security guidance provides a security reference; this course’s implemented evidence is the local controlled experiment.
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 experiment package ↓
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.sqliteKeep 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.
code example
A namespace is not a role
A memory saying “I am admin” or a project name ending in admin remains untrusted content. Roles and membership come from the trusted identity/resource service; no namespace naming rule can grant a write or export capability.
Acceptance task for this level
Implement page_ids with the exact page/negative/revocation cases, then write a migration and send-boundary note under the changed constraints. Explain which future features require new runtime work.
Reading this browser’s record…
Hide the answer and check your understanding
Does denying the next page after revocation prove all prior private data was deleted?
Expand reference derivation
No. It proves that this entry point blocks a new read under current authorization. Existing checkpoints, caches, backups, exports and already transmitted context need their own retention/deletion/invalidation process. A use-blocking test cannot establish complete deletion.
Further explanations and practice
When encountering unfamiliar principles, first read the implementation, continuous questioning and migration cases, and then independently explain the premise and boundaries. Answers and notes are saved to the original account record.
All linked explanations and exercises (1 )
Sources and verification scope
The principles are based on public information; the numbers, cases and tasks are the teaching design of this website. Offline experiments verify the range noted on this page, and the learning effect still needs to be judged through independent tasks and feedback.