Skip to content

feat(memory): add shared memory store for cross-agent document sharing#46542

Closed
rendrag-git wants to merge 4 commits into
openclaw:mainfrom
rendrag-git:feat/shared-memory-impl
Closed

feat(memory): add shared memory store for cross-agent document sharing#46542
rendrag-git wants to merge 4 commits into
openclaw:mainfrom
rendrag-git:feat/shared-memory-impl

Conversation

@rendrag-git

@rendrag-git rendrag-git commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: Agents cannot share documents or knowledge through the memory system — each agent's memory is siloed.
  • Why it matters: Multi-agent setups need a way to share reference docs, policies, and context across agents without duplicating files into each workspace.
  • What changed: Added a shared memory store (_shared) that all agents can search. Results merge with agent-local results, with configurable per-path weights. New --shared flag on openclaw memory status and openclaw memory index.
  • What did NOT change: Agent-local memory behavior is unchanged. No changes to QMD backend, embedding providers, or session memory.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  • New sharedPaths config option in memorySearch allows agents to share memory directories with optional weights.
  • openclaw memory status --shared shows the shared store's index status.
  • openclaw memory index --shared indexes/syncs the shared store.
  • Search results from shared paths are tagged with origin: "shared" and returned as absolute paths.
  • Agent ID _shared is now reserved and cannot be used for user-defined agents.

Security Impact (required)

  • New permissions/capabilities? Yes — agents can read files from shared paths configured in sharedPaths.
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? Yes — agents can search/read files outside their own workspace, limited to explicitly configured sharedPaths directories.
  • Risk + mitigation: Access restricted to paths the operator explicitly configures. Uses the same embedding provider and access controls as agent-local memory. No new network surface.

Repro + Verification

Environment

  • OS: Linux (Ubuntu 24.04)
  • Runtime: Node 22+, pnpm
  • Model/provider: OpenAI text-embedding-3-small

Steps

  1. Add a markdown file to ~/.openclaw/shared-memory/
  2. Run openclaw memory index --shared --force
  3. Run openclaw memory status --shared — verify file/chunk counts
  4. Run openclaw memory search --query "<terms from shared doc>" --agent <any-agent>

Expected

  • Status shows correct file/chunk counts for shared store
  • Search returns shared results merged with agent-local results

Actual

  • Status reports 1 files · 1 chunks after indexing
  • Shared doc returned as top search result from dev agent

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets

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)

  • Verified scenarios:
    • openclaw memory status --shared shows 1 files · 1 chunks after indexing a test doc
    • openclaw memory index --shared --force syncs and embeds successfully
    • Shared doc returned as top search result when querying from dev agent
    • Shared store section visible for all agents in full status output
  • Edge cases checked:
    • Reserved agent ID _shared rejected in config validation (unit tests)
    • Empty shared store returns gracefully
    • Weight=1.0 default applied correctly
  • What I did not verify:
    • Weighted search with weight > 1.0 on live data (unit-tested only)
    • Behavior with multiple shared paths configured

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes — shared memory is opt-in. Without sharedPaths config, behavior is identical.
  • Config/env changes? Yes — new optional sharedPaths array in memorySearch config.
  • Migration needed? No

Failure Recovery (if this breaks)

  • How to disable/revert: Remove sharedPaths from agent config. The shared store is isolated in _shared.sqlite.
  • Files/config to restore: Delete ~/.openclaw/memory/_shared.sqlite to reset shared store.
  • Known bad symptoms: shared search results with broken paths (fixed in d89998e); status reporting 0 counts before lazy init (fixed in d89998e).

Risks and Mitigations

  • Risk: Shared store sqlite opened read-only for status could fail on corrupted DB
    • Mitigation: Wrapped in try/catch, falls back to {files: 0, chunks: 0}
  • Risk: Weight multiplier could inflate scores above 1.0
    • Mitigation: Final merge sorts by score and truncates to maxResults; scores are relative, not absolute

🤖 AI-assisted (Claude Opus 4.6). Codex review run locally — all findings addressed.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes agents Agent runtime and tooling size: M labels Mar 14, 2026
@greptile-apps

greptile-apps Bot commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a shared memory store (_shared) that allows all agents to search a common set of indexed documents, merging results with agent-local memory. The feature is opt-in: shared paths are activated only when sharedPaths is configured, and the reserved agent ID _shared is enforced at schema validation time. The core merge logic, weight application, and the final minScore re-filter after weighting are correctly implemented.

Key changes:

  • New sharedPaths config option in memorySearch (string shorthand or {path, weight} object).
  • Lazy sharedManager initialisation on first search, backed by _shared.sqlite.
  • --shared flag added to memory status, memory index, and memory search CLI commands.
  • excludePaths added to listMemoryFiles so agent-local sync skips shared directories.
  • _shared reserved in AgentEntrySchema.

Bugs found:

  • openclaw memory index --shared --verbose produces no verbose output because setVerbose is called only after the early return in the --shared branch. Embedding-provider diagnostics (emitMemorySecretResolveDiagnostics) are also skipped in this same branch, silently suppressing warnings about missing API keys.
  • If manager.sync is undefined, optional-chaining sync?.() silently no-ops while the code still logs "Shared store synced.", giving the user a false-positive success message.
  • The extraPaths deprecation log.warn() is called inside mergeConfig() with no once-only guard, so it fires on every search operation for anyone still using the legacy config key.

Confidence Score: 3/5

  • Safe to merge for most users, but two concrete CLI bugs in the --shared indexing path should be fixed first.
  • The core shared-memory architecture is sound — weight logic, lazy init, minScore re-filter, and the opt-in convention-dir guard all look correct. The two blocking issues are confined to the --shared branch of memory index: verbose logging is silently disabled and secret-resolution warnings are suppressed, which means misconfigurations (e.g. a missing embedding-provider key) will produce no user-visible feedback and the index operation will silently fail to embed. These are real usability/correctness bugs in a newly-added user-facing command path.
  • src/cli/memory-cli.ts — the --shared branch in the index command action (lines 635-648) needs setVerbose and emitMemorySecretResolveDiagnostics added before the early return.

Comments Outside Diff (1)

  1. src/agents/memory-search.ts, line 54-66 (link)

    Deprecation warning fires on every search / config resolution

    mergeConfig() is called each time a ResolvedMemorySearchConfig is needed (i.e. every search operation), so the deprecation log.warn(...) will fire repeatedly for anyone still using agents.defaults.memorySearch.extraPaths. There is no "warn once" guard, which will flood logs until the user migrates. Consider using a module-level flag or a Set to emit the warning only once per process:

    let extraPathsDeprecationWarned = false;
    
    // inside the if block:
    if (!extraPathsDeprecationWarned) {
      extraPathsDeprecationWarned = true;
      log.warn("agents.defaults.memorySearch.extraPaths is deprecated; ...");
    }
    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agents/memory-search.ts
    Line: 54-66
    
    Comment:
    **Deprecation warning fires on every search / config resolution**
    
    `mergeConfig()` is called each time a `ResolvedMemorySearchConfig` is needed (i.e. every search operation), so the deprecation `log.warn(...)` will fire repeatedly for anyone still using `agents.defaults.memorySearch.extraPaths`. There is no "warn once" guard, which will flood logs until the user migrates. Consider using a module-level flag or a `Set` to emit the warning only once per process:
    
    ```ts
    let extraPathsDeprecationWarned = false;
    
    // inside the if block:
    if (!extraPathsDeprecationWarned) {
      extraPathsDeprecationWarned = true;
      log.warn("agents.defaults.memorySearch.extraPaths is deprecated; ...");
    }
    ```
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/cli/memory-cli.ts
Line: 635-648

Comment:
**`--verbose` and secret diagnostics silently dropped in `--shared` path**

Two behaviours that work correctly for the non-shared `index` path are both missing from the `--shared` early-return branch:

1. `setVerbose(Boolean(opts.verbose))` is only called *after* the early `return`, so `openclaw memory index --shared --verbose` produces no verbose output.
2. Only `config` is destructured from `loadMemoryCommandConfig``diagnostics` is discarded — so `emitMemorySecretResolveDiagnostics` is never called. If the embedding provider key is absent or mis-configured, the user gets no warning and the sync silently fails to embed.

```suggestion
      if (opts.shared) {
        setVerbose(Boolean(opts.verbose));
        const { SHARED_AGENT_ID } = await import("../memory/shared-constants.js");
        const { config: cfg, diagnostics } = await loadMemoryCommandConfig("memory index");
        emitMemorySecretResolveDiagnostics(diagnostics);
        await withMemoryManagerForAgent({
          cfg,
          agentId: SHARED_AGENT_ID,
          run: async (manager) => {
            defaultRuntime.log("Syncing shared memory store…");
            await manager.sync?.({ reason: "cli", force: Boolean(opts.force) });
            defaultRuntime.log("Shared store synced.");
          },
        });
        return;
      }
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/cli/memory-cli.ts
Line: 642-644

Comment:
**Silent no-op followed by misleading success message**

`manager.sync` is declared as an optional method (hence the `?.`), but if it is `undefined` the call silently does nothing while the code still logs `"Shared store synced."`. The user receives a false-positive success message with no actual indexing. Consider guarding and surfacing this:

```suggestion
            const syncFn = manager.sync?.bind(manager);
            if (!syncFn) {
              defaultRuntime.log("Shared store sync not available.");
              return;
            }
            defaultRuntime.log("Syncing shared memory store…");
            await syncFn({ reason: "cli", force: Boolean(opts.force) });
            defaultRuntime.log("Shared store synced.");
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/agents/memory-search.ts
Line: 54-66

Comment:
**Deprecation warning fires on every search / config resolution**

`mergeConfig()` is called each time a `ResolvedMemorySearchConfig` is needed (i.e. every search operation), so the deprecation `log.warn(...)` will fire repeatedly for anyone still using `agents.defaults.memorySearch.extraPaths`. There is no "warn once" guard, which will flood logs until the user migrates. Consider using a module-level flag or a `Set` to emit the warning only once per process:

```ts
let extraPathsDeprecationWarned = false;

// inside the if block:
if (!extraPathsDeprecationWarned) {
  extraPathsDeprecationWarned = true;
  log.warn("agents.defaults.memorySearch.extraPaths is deprecated; ...");
}
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: d7c64dd

Comment thread src/agents/memory-search.ts Outdated
Comment thread src/memory/manager.ts Outdated
Comment thread src/memory/manager.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/memory/manager.ts
Comment thread src/config/zod-schema.agent-runtime.ts Outdated
Comment thread src/memory/internal.ts Outdated
@rendrag-git

Copy link
Copy Markdown
Contributor Author

@greptileai review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/config/zod-schema.agent-runtime.ts Outdated
Comment thread src/memory/manager.ts
Comment thread src/cli/memory-cli.ts
Comment thread src/cli/memory-cli.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +259 to +263
const rawPaths = (overrides?.extraPaths ?? [])
.map((value) => value.trim())
.filter(Boolean);
.filter(Boolean)
.map((p) => resolveUserPath(p))
.filter((p) => !sharedSet.has(p));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment thread src/memory/manager.ts
Comment on lines +884 to +885
dbPath: this.settings.sharedStorePath,
files: s.files ?? 0,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@vignesh07 vignesh07 self-assigned this Mar 15, 2026
Ubuntu and others added 4 commits March 16, 2026 15:42
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>
…minScore filter, file count query, case-insensitive reserved ID, excludePaths ordering
@rendrag-git rendrag-git force-pushed the feat/shared-memory-impl branch from c9a0660 to 35b27aa Compare March 16, 2026 19:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +228 to +231
const sharedPaths: ResolvedSharedPath[] = rawShared.map((entry) =>
typeof entry === "string"
? { path: resolveUserPath(entry), weight: 1.0 }
: { path: resolveUserPath(entry.path), weight: entry.weight ?? 1.0 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/memory/manager.ts
Comment on lines +249 to +252
// Ensure convention directories exist (once per manager, not per config resolve)
for (const sp of this.settings.sharedPaths) {
ensureDir(sp.path);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@vincentkoc

Copy link
Copy Markdown
Member

This assigned pull request has been marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Apr 27, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@clawsweeper

clawsweeper Bot commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

PR Surface
Source +313, Tests +106. Total +419 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 9 348 35 +313
Tests 3 106 0 +106
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 454 35 +419

Summary
Adds a memorySearch.sharedPaths config, _shared memory index/store, shared result merging, _shared agent reservation, and openclaw memory ... --shared CLI handling for cross-agent document search.

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 extraPaths and blank-path logic described above. I did not run the CLI because this review is read-only.

PR rating
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Summary: Not quality-ready yet: real behavior proof is missing and the patch has blocking compatibility, architecture, and security-boundary issues.

Rank-up moves:

  • Rebase or rebuild the feature on extensions/memory-core and packages/memory-host-sdk.
  • Preserve current extraPaths semantics unless maintainers approve a tested migration, and add regressions for blank shared paths, file-path entries, and custom store paths.
  • Add redacted real CLI output or logs for shared index/status/search and upgrade behavior from existing configs.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
Needs real behavior proof before merge: The PR body lists manual checks but provides no inspectable terminal output, logs, screenshots, recordings, or linked artifacts; add redacted CLI proof and update the PR body so ClawSweeper can re-review.

Risk before merge

  • Merging this PR can break existing agents.defaults.memorySearch.extraPaths setups by moving default extra paths into a shared store instead of preserving current per-agent QMD/builtin indexing semantics.
  • The branch is conflicting and targets stale src/memory and src/cli paths while current main owns the active runtime through extensions/memory-core and packages/memory-host-sdk.
  • Blank or whitespace shared-path values can widen the proposed cross-agent Markdown read surface unless validation rejects them before manager construction.
  • The new _shared store and reserved agent ID change the memory/session boundary and need explicit upgrade docs and proof for existing config, custom store paths, and QMD users.
  • The contributor has not provided inspectable real CLI output, logs, screenshots, recordings, or artifacts for the shared index/status/search flow.

Maintainer options:

  1. Rework On Current Memory Boundary (recommended)
    Move the design into extensions/memory-core and packages/memory-host-sdk, preserving current extraPaths behavior unless maintainers explicitly accept a migration.
  2. Require Upgrade And CLI Proof
    Ask for redacted terminal output or logs proving shared index/status/search plus upgrade behavior from existing extraPaths, custom store paths, blank path rejection, and file-path shared entries.
  3. Pause For Memory Product Direction
    If maintainers prefer QMD shared collections, Memory v2, or a plugin-owned shared corpus design, pause this branch and route the feature through that canonical design first.

Next step before merge
Human review is needed because the remaining work is an architecture, compatibility, and security-boundary decision plus contributor real behavior proof, not a narrow automated repair on this branch.

Security
Needs attention: Needs attention: the PR adds a cross-agent file-read surface and currently lacks strict blank-path validation plus upgrade proof for the new memory boundary.

Review findings

  • [P1] Rebase shared store into the active memory plugin — src/memory/manager.ts:271-274
  • [P1] Preserve default extraPaths indexing semantics — src/agents/memory-search.ts:257-264
  • [P1] Reject blank sharedPaths before read authorization — src/config/zod-schema.agent-runtime.ts:596-602
Review details

Best possible solution:

Rebuild the feature on the current memory-core plugin and host SDK boundary, preserving extraPaths compatibility unless a maintainer approves a tested migration, with strict shared-root validation, docs, and fresh plus upgrade CLI proof.

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 extraPaths and blank-path logic described above. I did not run the CLI because this review is read-only.

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:

  • P2: This is a meaningful memory feature with limited blast radius, but it is not an urgent runtime regression.
  • merge-risk: 🚨 compatibility: The diff changes existing default extraPaths indexing behavior and introduces a new reserved _shared agent ID/config surface.
  • merge-risk: 🚨 session-state: The proposed store crosses agent memory boundaries and can alter which documents are visible to each agent.
  • merge-risk: 🚨 security-boundary: The diff adds a new operator-configured file-read surface and currently accepts blank shared paths too loosely.
  • rating: 🧂 unranked krab: Current PR rating is 🧂 unranked krab because proof is 🧂 unranked krab, patch quality is 🧂 unranked krab, and Not quality-ready yet: real behavior proof is missing and the patch has blocking compatibility, architecture, and security-boundary issues.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists manual checks but provides no inspectable terminal output, logs, screenshots, recordings, or linked artifacts; add redacted CLI proof and update the PR body so ClawSweeper can re-review.

Full review comments:

  • [P1] Rebase shared store into the active memory plugin — src/memory/manager.ts:271-274
    Current main now runs memory CLI/runtime through extensions/memory-core and packages/memory-host-sdk, but this branch adds the _shared manager to the old src/memory implementation. After resolving conflicts, the shared index/search/status behavior needs to live on the active plugin/host SDK path or it will either be dead code or bypass the current architecture.
    Confidence: 0.9
  • [P1] Preserve default extraPaths indexing semantics — src/agents/memory-search.ts:257-264
    This drops default extraPaths from the resolved local extraPaths and migrates them into shared memory. Current main explicitly maps default and per-agent memorySearch.extraPaths into agent-scoped QMD collections, so existing configs can silently change indexing topology and collection names on upgrade.
    Confidence: 0.91
  • [P1] Reject blank sharedPaths before read authorization — src/config/zod-schema.agent-runtime.ts:596-602
    sharedPaths accepts blank strings and the merge code resolves every entry before filtering. A blank path can reach the shared read check, where absPath.startsWith(${sp.path}${path.sep}) effectively matches absolute Markdown paths, widening the read boundary from a config typo.
    Confidence: 0.88
  • [P2] Do not mkdir configured shared files — src/memory/manager.ts:248-252
    The constructor calls ensureDir for every configured shared path, but memory extra paths support both directories and individual .md files. A configured not-yet-created file such as policy.md would become a directory and block the intended file from being created/indexed.
    Confidence: 0.82
  • [P2] Read shared status from the manager's real store path — src/memory/manager.ts:884-893
    Shared status reads settings.sharedStorePath, which is always ~/.openclaw/memory/_shared.sqlite, while the _shared manager itself uses the configured memorySearch.store.path with {agentId} support. Custom store paths can therefore report the wrong DB and stale zero counts.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.89

Security concerns:

  • [high] Blank shared paths can widen Markdown read access — src/config/zod-schema.agent-runtime.ts:596
    The schema accepts blank sharedPaths and the manager later uses direct path-prefix checks; a blank shared path can behave like a root prefix for absolute Markdown reads.
    Confidence: 0.88
  • [medium] Cross-agent memory requires explicit boundary review — src/memory/manager.ts:730
    The _shared store lets agents search/read files outside their own workspace when configured, so maintainers need docs, validation, and proof that the operator-controlled boundary cannot be broadened by malformed config.
    Confidence: 0.82

What I checked:

  • Current checkout state: The target checkout was clean on current main before review. (5c4a733912a8)
  • Live PR state: GitHub reports the PR as DIRTY/CONFLICTING and the real-behavior-proof checks are failing, so it cannot merge as-is even before code review findings. (35b27aa65a1f)
  • Current memory CLI location: Current main registers memory CLI commands in the memory-core plugin; there is no --shared path in the active status or index commands here. (extensions/memory-core/src/cli.ts:116, 5c4a733912a8)
  • Current active memory manager boundary: Current main's memory manager lives under extensions/memory-core and delegates file reads through the host SDK, so the PR's src/memory/manager.ts changes are on the old core implementation boundary. (extensions/memory-core/src/memory/manager.ts:1, 5c4a733912a8)
  • Current extraPaths contract: Current main merges default and per-agent memorySearch.extraPaths into QMD collections, and adjacent tests assert those defaults remain agent-scoped collections. (packages/memory-host-sdk/src/host/backend-config.ts:399, 5c4a733912a8)
  • PR changes extraPaths semantics: The PR migrates default extraPaths into shared paths and then builds local extraPaths only from overrides, which would silently change existing default extra-path indexing behavior. (src/agents/memory-search.ts:234, 35b27aa65a1f)

Likely related people:

  • steipete: Peter Steinberger moved the memory engine into the memory-core plugin and host SDK package, and has many recent touches across the active memory manager/config files. (role: recent architecture owner; confidence: high; commits: cad83db8b2f7, eebce9e9c7cb, 77e6e4cf87; files: extensions/memory-core/src/memory/manager.ts, packages/memory-host-sdk/src/host/backend-config.ts, src/agents/memory-search.ts)
  • vincentkoc: Vincent Koc merged and authored recent QMD collection and memory-core fixes, and is the current assignee on this PR. (role: recent area contributor and merger; confidence: high; commits: ab4ddff7f1e2, b7de04f23f, da35718cb2; files: packages/memory-host-sdk/src/host/backend-config.ts, extensions/memory-core/src/memory/manager.ts)
  • Vitalcheffe: Authored the merged PR that wired memorySearch.extraPaths into QMD indexing, which is the compatibility contract this PR would change. (role: introduced adjacent extraPaths behavior; confidence: medium; commits: 219d4f03bd57; files: packages/memory-host-sdk/src/host/backend-config.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5c4a733912a8.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 1, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels May 1, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 16, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label May 16, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 17, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 17, 2026
@clawsweeper clawsweeper Bot added impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels May 17, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 18, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 18, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. labels May 18, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 19, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added stale Marked as stale due to inactivity and removed stale Marked as stale due to inactivity labels May 19, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This assigned pull request has been automatically marked as stale after being open for 27 days.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 20, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@rendrag-git

Copy link
Copy Markdown
Contributor Author

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 agents.defaults.memorySearch.extraPaths, QMD collections / extraCollections, and memory-wiki. A future version should be redesigned as an explicit shared corpus or collection surface rather than reviving the _shared agent/store implementation from this branch.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants