#9678: Cross-agent memory read allowlist
agents
size: M
Cluster:
Memory Management Enhancements
Closes #9618
## Summary
- Add per-agent memory allowlist (agents.list[].memory.allowReadFrom) for cross-agent reads.
- Extend memory_search/memory_get with optional target params and clear tool descriptions.
- Return explicit errors for unauthorized targets; self always allowed.
- Add tests for default behavior, allowlist, denial, and all merge.
## Notes
- Default behavior remains self-only unless allowlist is configured.
- "*" grants access to all other agents.
- memory_search results include agentId for follow-up memory_get.
- memory_search preserves provider/model/fallback metadata even when querying multiple targets (uses the first successful target), for back-compat.
- Largely AI-assisted (Claude). Tested locally.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an explicit per-agent allowlist for cross-agent memory reads (`agents.list[].memory.allowReadFrom`), and extends the `memory_search` / `memory_get` tools with optional targeting parameters (`agent`, `agents`, `all`) plus clearer tool descriptions and denial errors. `memory_search` now merges and sorts results across the allowed targets and annotates each hit with `agentId` to support follow-up `memory_get` calls. Config schema/types are updated to accept the new `memory` block under agent entries, and new tests cover default self-only behavior, allowlisted access, denial, and `all=true` merging.
<h3>Confidence Score: 4/5</h3>
- This PR is close to safe to merge but has a small response-shape regression to address.
- Core allowlist enforcement and config plumbing look consistent, and tests exercise the main cross-agent search paths. The main concern is a concrete behavior regression in `memory_search`: multi-target queries omit provider/model/fallback metadata entirely due to a conditional assignment, which could break existing consumers that expect these fields.
- src/agents/tools/memory-tool.ts
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11761: fix(gateway): expose memory/ directory files in agents.files RPC
by advaitpaliwal · 2026-02-08
80.5%
#8252: Config: honor legacy memorySearch alias
by sauerdaniel · 2026-02-03
78.2%
#14734: test(agents): guard against stale allowAgents in existing sessions
by davidahmann · 2026-02-12
75.3%
#19022: memory: support per-agent QMD collection paths
by Whoaa512 · 2026-02-17
74.8%
#12808: docs(subagents): clarify allowAgents is per-agent only
by JBrady · 2026-02-09
74.8%
#21217: fix: memory prune command to prevent unbounded MEMORY.md growth
by theognis1002 · 2026-02-19
74.6%
#23566: Gateway:expose memory/*.md in agents.files RPC
by SepehrShapouri · 2026-02-22
74.5%
#11179: fix(memory): replace confusing "No API key" errors in memory tools ...
by liuxiaopai-ai · 2026-02-07
74.3%
#19920: fix(memory): populate FTS index in FTS-only mode so search returns ...
by forketyfork · 2026-02-18
73.7%
#19329: feat: add per-agent compaction and context pruning overrides
by curtismercier · 2026-02-17
73.2%