feat(team): share leader memory with team members (read-only)

Team members dispatched via team tasks can now read the leader's memory
files (MEMORY.md, memory/*.md) as a fallback when they have no own
memory. Memory writes are blocked for members — only the leader can
save memory files. This follows the existing team_workspace context
propagation pattern: dispatch metadata → RunRequest → context → tools.

Affected tools: read_file (interceptor), memory_get, memory_search,
list_files (interceptor). All include leader fallback with per-user →
global scope cascade.
This commit is contained in:
viettranx committed 2026-03-27 22:45:40 +07:00
1 parent e9342533e0
commit ee9f5b8aaf
10 files changed
+523 -7

No files matched your search

+2
View File
@@ -185,6 +185,8 @@ func (m *TeamToolManager) dispatchTaskToAgent(ctx context.Context, task *store.T
if originSessionKey != "" {
meta["origin_session_key"] = originSessionKey
}
// Pass leader agent ID so member agents can fallback-read leader's memory.
meta["leader_agent_id"] = team.LeadAgentID.String()
// Pass the team workspace dir so member agents write files to the shared folder.
if ws := taskTeamWorkspace(task); ws != "" {
meta["team_workspace"] = ws