Multi-tenant Phase 1: tenant context + guest agent + per-user memory - #13
Merged
Conversation
…isolation
The foundation for letting friends try Aria without seeing the owner's data.
- tenant.py: a contextvars-based current-user seam. Owner = no context (unchanged);
a guest is set per-request, routing memory/profile/toolset to that user.
- memory.py: when a guest is set, add_memory/search_memory hit that guest's OWN ChromaDB
collection (mem_<user>) and load_profile() returns {}. Owner path byte-for-byte the same
(scratchpad + aria_memory collection + profile.json).
- agent_core.py: build_tools(guest=True) returns an account-free subset (add_memory,
search_memory, get_weather, web_search, fetch_webpage) — no email/calendar/contacts/
notes/reminders/music/home/browser/system. build_agent(guest=True) builds it; the system
prompt gets a GUEST MODE banner and empty profile/standing-rules.
Isolation proven with tests (routing mocked since real vectors need network): guest add/
search hit mem_<user>; owner uses the scratchpad; guest toolset excludes account tools;
guest profile is empty. 212 tests pass; owner path unchanged.
Next: Phase 2 wires this into webvoice (per-friend tokens → user_id → guest agent).
Assisted-by: Claude Code (Opus 4.8)
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.
Foundation for the friends-trial (the "personalization, no email/calendar" scope) — and the first slice of SaaS multi-tenancy. Lets one Aria serve isolated guests without exposing the owner's data.
What's here
tenant.py— acontextvarscurrent-user seam. Owner runs with no context (everything unchanged); a guest is set per-request.memory.py— when a guest is set:add_memory/search_memoryroute to that guest's own ChromaDB collection (mem_<user>), andload_profile()returns{}. Owner path is byte-for-byte identical (scratchpad +aria_memory+profile.json).agent_core.py—build_tools(guest=True)returns an account-free subset (memory + weather + web only — no email/calendar/contacts/notes/reminders/music/home/browser/system).build_agent(guest=True)builds it; the system prompt gets a GUEST MODE banner + empty profile/standing-rules.Safety
is_guest()isFalsewith no context; 45 tools; 212 tests pass.build_agent/tenant.py); Phase 2 (webvoice) enforces this.9 new tests prove the routing/isolation (real vectors need network, so routing is mocked).
🤖 Generated with Claude Code