Hi,
we’re experiencing an issue when trying to add metadata to the memory threads.
Our goal is to separate threads for each agent based on the user who is using it, so that every agent maintains isolated context per user.
To achieve this, we’ve extended the Memory class in order to inject and manage custom metadata on the threads.
However, we’re not sure if this is the correct or recommended approach within Mastra’s architecture.
We’d like to know:
Is it possible (or supported) to attach custom metadata directly to threads?
Is extending the Memory class the right way to implement user-based thread separation, or is there a more suitable pattern?
Are there any examples or best practices for handling per-user or per-agent memory isolation?
Thanks in advance for your help!