feat(memory): add shared memory store for cross-agent document sharing#46542
feat(memory): add shared memory store for cross-agent document sharing#46542rendrag-git wants to merge 4 commits into
Conversation
Greptile SummaryThis PR introduces a shared memory store ( Key changes:
Bugs found:
Confidence Score: 3/5
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d89998e0d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@greptileai review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d7c64dd633
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9a0660618
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const rawPaths = (overrides?.extraPaths ?? []) | ||
| .map((value) => value.trim()) | ||
| .filter(Boolean); | ||
| .filter(Boolean) | ||
| .map((p) => resolveUserPath(p)) | ||
| .filter((p) => !sharedSet.has(p)); |
There was a problem hiding this comment.
Resolve extraPaths relative to each agent workspace
mergeConfig now applies resolveUserPath to agent extraPaths before they are passed to indexing, which resolves relative entries against the process working directory instead of the agent workspace. Previously these relative paths were resolved in normalizeExtraMemoryPaths(workspaceDir, ...), so configs like extraPaths: ["../team-docs"] now target a different location and local memory files are silently missed.
Useful? React with 👍 / 👎.
| dbPath: this.settings.sharedStorePath, | ||
| files: s.files ?? 0, |
There was a problem hiding this comment.
Report shared status from the actual shared DB path
Shared status currently reports and reads counts from this.settings.sharedStorePath, but the _shared manager persists to settings.store.path (which can be changed via memorySearch.store.path). With a custom store path, memory status can show an incorrect shared DB location and stale 0 files/0 chunks counts even when shared indexing succeeded.
Useful? React with 👍 / 👎.
Adds a shared memory namespace (_shared) that reuses the full MemoryIndexManager pipeline (sync, embedding, vector search, FTS, file watching, dirty tracking). Includes per-path weight matching, readFile support for shared paths, convention directory auto-creation, deprecation warning for extraPaths migration, --shared CLI flag on status/search/index, and test coverage for excludePaths filtering. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…status from sqlite
…minScore filter, file count query, case-insensitive reserved ID, excludePaths ordering
…path, guard sync no-op
c9a0660 to
35b27aa
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35b27aa65a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const sharedPaths: ResolvedSharedPath[] = rawShared.map((entry) => | ||
| typeof entry === "string" | ||
| ? { path: resolveUserPath(entry), weight: 1.0 } | ||
| : { path: resolveUserPath(entry.path), weight: entry.weight ?? 1.0 }, |
There was a problem hiding this comment.
Filter empty sharedPaths entries before path resolution
mergeConfig currently maps every sharedPaths item through resolveUserPath without trimming/filtering blank values, so entries like "" or whitespace become "" in settings.sharedPaths. That later interacts badly with MemoryIndexManager.readFile's shared-path check (absPath.startsWith(${sp.path}${path.sep})), because an empty sp.path effectively matches every absolute path ("/" prefix on POSIX), turning a config typo into broad .md file-read access outside intended shared directories.
Useful? React with 👍 / 👎.
| // Ensure convention directories exist (once per manager, not per config resolve) | ||
| for (const sp of this.settings.sharedPaths) { | ||
| ensureDir(sp.path); | ||
| } |
There was a problem hiding this comment.
Skip mkdir for shared paths that are files
The constructor eagerly calls ensureDir for each configured shared path, but shared paths are later treated as extraPaths that can be either directories or individual files. If a user configures a not-yet-created file path (for example ~/shared/policy.md), this code creates a directory at that file path, which then prevents creating/indexing the intended markdown file until manual cleanup.
Useful? React with 👍 / 👎.
|
This assigned pull request has been marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Codex review: needs real behavior proof before merge. Latest ClawSweeper review: 2026-05-23 23:15 UTC / May 23, 2026, 7:15 PM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
PR Surface View PR surface stats
Summary Reproducibility: yes. for the review blockers by source inspection: current main uses the memory-core plugin/host SDK boundary, while the PR head still edits stale memory paths and contains the PR rating Rank-up moves:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. Real behavior proof Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Rebuild the feature on the current memory-core plugin and host SDK boundary, preserving Do we have a high-confidence way to reproduce the issue? Yes for the review blockers by source inspection: current main uses the memory-core plugin/host SDK boundary, while the PR head still edits stale memory paths and contains the Is this the best way to solve the issue? No. The submitted implementation is not the best path because it mixes a new cross-agent memory feature with stale core files and compatibility-sensitive config migration; the safer direction is a current plugin-boundary design with explicit validation, docs, and upgrade proof. Label justifications:
Full review comments:
Overall correctness: patch is incorrect Security concerns:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5c4a733912a8. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Closing this for now. The original branch targets stale memory runtime/CLI paths and no longer matches current memory-core / memory-host-sdk architecture. The underlying idea was useful, but current vanilla OpenClaw now covers the common shared-knowledge cases through Also noting that the linked issue #46558 is already closed, so this close does not leave an active tracking issue for a first-class shared corpus. |
Summary
_shared) that all agents can search. Results merge with agent-local results, with configurable per-path weights. New--sharedflag onopenclaw memory statusandopenclaw memory index.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
sharedPathsconfig option inmemorySearchallows agents to share memory directories with optional weights.openclaw memory status --sharedshows the shared store's index status.openclaw memory index --sharedindexes/syncs the shared store.origin: "shared"and returned as absolute paths._sharedis now reserved and cannot be used for user-defined agents.Security Impact (required)
Yes— agents can read files from shared paths configured insharedPaths.NoNoNoYes— agents can search/read files outside their own workspace, limited to explicitly configuredsharedPathsdirectories.Repro + Verification
Environment
Steps
~/.openclaw/shared-memory/openclaw memory index --shared --forceopenclaw memory status --shared— verify file/chunk countsopenclaw memory search --query "<terms from shared doc>" --agent <any-agent>Expected
Actual
1 files · 1 chunksafter indexingEvidence
All 9 new tests pass:
src/config/config.reserved-agent-id.test.ts(2 tests)src/config/zod-schema.agent-runtime.test.ts(4 tests)src/memory/manager.shared-memory.test.ts(3 tests)Build (
pnpm build) and lint (pnpm check) pass clean.Codex review run locally — 3 findings (P1: broken shared paths, P2: weights applied too late, P3: status showing 0 counts) all addressed in d89998e.
Human Verification (required)
openclaw memory status --sharedshows1 files · 1 chunksafter indexing a test docopenclaw memory index --shared --forcesyncs and embeds successfully_sharedrejected in config validation (unit tests)weight > 1.0on live data (unit-tested only)Review Conversations
Compatibility / Migration
Yes— shared memory is opt-in. WithoutsharedPathsconfig, behavior is identical.Yes— new optionalsharedPathsarray inmemorySearchconfig.NoFailure Recovery (if this breaks)
sharedPathsfrom agent config. The shared store is isolated in_shared.sqlite.~/.openclaw/memory/_shared.sqliteto reset shared store.Risks and Mitigations
{files: 0, chunks: 0}maxResults; scores are relative, not absolute🤖 AI-assisted (Claude Opus 4.6). Codex review run locally — all findings addressed.