Repository navigation
feat(memory): an end user's turn writes only to their own namespace (PRD-274 Wave 3) - #1484
Merged
Merged
Conversation
…PRD-274 Wave 3)
The turn's end user is a context variable (core/security/end_user_turn.py),
held where memory is written, as memory_audience holds the reader:
- the durable store's add lands every write of an end user's turn in
mem:{ws}:end_user:{id}, tagged end_user:{id} for their erasure; a write to
another workspace during the turn is refused;
- no L2 row (so no mem:{ws}:l2 mirror) and no daily log is written: the
Context Router reads those on every chat turn of the workspace.
Nothing sets the end user yet, so every write goes where it always has.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Dave Arthur <davidarthur@hotmail.com>
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
Contributor
Pre-merge checks:
|
…, not the key's service user's The routed write rewrote the namespace and the subject tag but kept metadata.owner, which the private-row and standing-rule filters read: every end user of a key shares its service user, so they would have shared private facts. An owner is now the end user's subject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Dave Arthur <davidarthur@hotmail.com>
This was referenced Nov 11, 2026
10 of 14 tasks
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.
What and why
PRD-274 Wave 3 PR 2 is end-user chat turns: a server key's chat turn names the end user it's for. This PR is the first of four, stacked so each can be reviewed alone:
endUserIdon a server key'sPOST /api/chat, with consent required (feat(chat): a server key's chat turn for one of its end users (PRD-274 Wave 3) #1486).Nothing sets the end user until PR 3, so this PR changes no behaviour on its own.
The rule is held where memory is written, by a context variable for the turn's end user (
core/security/end_user_turn.py). That's howmemory_audienceholds the reader (Wave 4b), rather than path by path:mem:{ws}:end_user:{id}(writes_to_its_end_useronDurableMemoryStore.add).end_user:{id}, so their erasure finds it.shared_with_no_end_user): no L2 row inmemory_short_term, so nomem:{ws}:l2mirror, and no daily log. The Context Router reads both on every chat turn of the workspace, so another end user's turn, or the owner's Auto, would otherwise recall this person's conversation.How it was verified
tests/test_afp_w3_end_user_turn_writes.py(6 tests):addwrites to the end user's namespace from the workspace's and from an agent's, and their metadata names them.store_short_term,store_daily_logandstore_daily_summarywrite nothing.With the three wired files taken back to
main, the three wiring tests fail; the other three test the new module itself.Every test file touching memory writes, the durable store,
SmartMemoryManager,memory_audienceor end users passes: 41 files, 550 tests.Code shape has no errors. Its warnings are
smart_memory.pyandunified_memory_service.pygrowing, by one import and their decorators.lint-importsis clean, and ruff finds nothing on the changed lines.Tests added or updated, and they fail without this change
CI green (a lane marked non-required counts too)
Both editions considered: local (
AUTH_EDITION=local) and hosted (the same code; nothing sets the end user yet)UI change: screenshots below (none)
AI assistance
Checklist (AGENTS.md)
git commit -s)orchestrator/config.py; no hardcoded valuesV2copies)create_all-built database, head pins moved (none)orchestrator/reports/route-manifest.json(none)🤖 Generated with Claude Code