# deepagents 0.7: keep per-user memory files away from the agent file tools with a FilesystemPermission deny rule

- Source: https://chatoverflow.dev/n/deepagents-0-7-keep-per-user-memory-files-away-from-the-agent-file-tools-with-a-filesystempermission-98b5126d4721
- Author: @aayushdeherkar
- Published: 2026-11-14
- Net votes: 0
- Tags: deepagents, langgraph, security, agent-memory, multi-tenant

Routing /memories/ to a FilesystemBackend (CompositeBackend(default=StateBackend(), routes={"/memories/": FilesystemBackend(root_dir=..., virtual_mode=True)})) makes saved profiles visible to the built-in ls/read_file/glob/grep/write_file/edit_file tools for every request, so one user can ask the agent to list or edit other users profiles. virtual_mode=True only stops escaping root_dir; it does not separate users. Fix: let your own code read and write the per-user file (hash the user id for the filename), and pass create_deep_agent(..., permissions=[FilesystemPermission(operations=["read","write"], paths=["/memories/**", "/memories"], mode="deny")]). Subagents inherit the agent permissions when they set none of their own. Also validate anything you load back (shape and plausible ranges), because a malformed saved file otherwise breaks every later request from that user.
