MemOS icon indicating copy to clipboard operation
MemOS copied to clipboard

memory_search tool hardcoded owner defaults to "agent:main" instead of current agent

Open souankou opened this issue 8 months ago • 4 comments

Pre-submission checklist | 提交前检查

  • [x] I have searched existing issues and this hasn't been mentioned before | 我已搜索现有问题,确认此问题尚未被提及
  • [x] I have read the project documentation and confirmed this issue doesn't already exist | 我已阅读项目文档并确认此问题尚未存在
  • [x] This issue is specific to MemOS and not a general software issue | 该问题是针对 MemOS 的,而不是一般软件问题

Bug Description | 问题描述

The memory_search tool uses hardcoded owner="agent:main" when no explicit owner parameter is provided.

This breaks the documented multi-agent isolation: "检索时自动过滤为当前 Agent + public"

Expected: Auto-detect agentId from ctx.workspaceDir or hookCtx.agentId

Workaround: Extract agentId from workspaceDir path (workspace-dev → agent:dev)

How to Reproduce | 如何重现

  1. Set up multiple agents (workspace-dev, workspace-javis)
  2. Call memory_search without owner parameter
  3. Check logs: shows owner=agent:main instead of agent:dev

Environment | 环境信息

  • OpenClaw: 2026.3.8
  • MemOS plugin: 1.0.5
  • OS: Linux Ubuntu
  • Node: v24.14.0

Additional Context | 其他信息

No response

Willingness to Implement | 实现意愿

  • [ ] I'm willing to implement this myself | 我愿意自己解决
  • [ ] I would like someone else to implement this | 我希望其他人来解决

souankou avatar Mar 23 '26 06:03 souankou

Also affected. Multiple agents (main, coder, nas-ops, finance, etc.) share the same workspace and can not distinguish their memories through search results. The hardcoded "agent:main" owner default breaks the documented multi-agent isolation.

Would also love to see this fixed — a workaround using workspaceDir path inference (workspace-coder → agent:coder) would work well for our use case.

:+1:

z6166 avatar Mar 26 '26 11:03 z6166

I’m experiencing the same issue.

GavinTan avatar Mar 27 '26 10:03 GavinTan

Starting from version v1.0.8, the agent_id has been obtained from the context.

Hun-ger avatar Apr 16 '26 08:04 Hun-ger

Hey @souankou! Thanks for the contribution — already solved the issue, thanks for helping us to catch the bug! 🐞

Btw if you enjoyed contributing and want to stay connected with the project, we run a Discord server for contributors, a chill space to discuss features, ask questions, or pick up new issues  👉🏻 MemOS Discord Server (Contributor Exclusive)

Thanks again for shipping this, and happy MemOSing 🧠✨

angarchie avatar May 19 '26 13:05 angarchie