Skip to content

feat(memory): shared memory database for multi-agent deployments - #140042

Open
xmoxmo wants to merge 8 commits into
openclaw:mainfrom
xmoxmo:feat/shared-memory-multi-agent
Open

xmoxmo wants to merge 8 commits into
openclaw:mainfrom
xmoxmo:feat/shared-memory-multi-agent

Conversation

@xmoxmo

@xmoxmo xmoxmo commented Sep 6, 2026

Copy link
Copy Markdown

What Problem This Solves

When multiple agents share a single OpenClaw instance, each agent creates its own memory database. This wastes disk space, causes inconsistent search results across agents, and triggers unnecessary full reindexing when extra memory paths change.

Why This Change Was Made

This PR introduces shared memory database support for multi-agent deployments by making four coordinated changes:

  1. Force shared memory index (memory-search.ts): When the system agent is configured with an explicit default workspace (agents.defaults.workspace), force memorySearch.enabled=true and redirect store.databasePath to a shared sqlite keyed by workspace hash.

  2. Exclude extraPaths from scope hash (manager-reindex-state.ts): Remove extraPaths from the scope hash calculation so adding/removing extra memory paths doesn't trigger a full reindex of the shared database.

  3. Skip shared memory ownership assertion (openclaw-agent-db.ts, openclaw-agent-db-schema-helpers.ts): Allow multiple agents to open the same shared memory database without triggering ownership errors.

  4. Use canonical workspace for system agent (memory-runtime.ts, manager.ts): When the system agent has an explicit default workspace, use that path directly for the shared memory database instead of a per-agent subdirectory.

User Impact

  • Multi-agent deployments share a single memory database, reducing disk usage and improving search consistency
  • Adding/removing extra memory paths no longer triggers expensive full reindexing
  • System agent and memory plugin lifecycle use the same canonical workspace and SQLite database

Evidence

  • Tested against OpenClaw v2026.9.2 source
  • All four changes are minimal and focused on the shared memory path resolution
  • No changes to memory search behavior, embedding, or ranking logic

steipete and others added 5 commits September 5, 2026 04:38
Regenerate release package versions, official channel metadata, and UI/native
locales from main b6a2e5b.

Validated canonical release preparation, full generated checks, 20 UI locales,
21 native locales, production UI asset budgets, and independent P0-P2 review.
Backport the reviewed hardware scan inventory and exact release/2026.9.2
registration from openclaw#139046, preserving the frozen 2026.9.1 policy.

Backport Undici 8.10.2/7.29.1, the approved version-specific overrides and
cooldown exceptions, paired NO_PROXY normalization, and locked release
toolchain digests from openclaw#139056.

Validated 31 scanner/hardware tests, 205 proxy/guard/dispatcher tests, frozen
dependency installation, full build and SDK/UI budgets, and independent
P0-P2 review. Both patches match their canonical main landings.

(cherry picked from commit 9010252)
(cherry picked from commit d7a1753)
Lead with performance, reliability, and GPT-6 Astra support. Regenerate the
complete contribution record from release history, preserving source refs,
161 credited contributors, and unchanged historical release notes.

Verified 1,239 PR records, source packaging, full GitHub rendering, and
independent P0-P2 review.
Backport the verified main repairs for update ledger isolation, Matrix client
cleanup, paired client metadata, task cancellation, Telegram timer ownership,
Claude adapter version resolution, MCP runtime leases, and native update/node
E2E execution. Preserve strict assertions and authenticated routing contracts.

Let stable malformed database bytes reach SQLite diagnostics through the
existing verified private snapshot path. Keep the frozen worker interface;
no schema, configuration, or stored representation changes.

Match the Apple localization assertion to the release-generated Watch copy.
The Watch Rust workflow correction is supplied separately by trusted tooling.

(cherry picked from commit bcecb3d)
(cherry picked from commit df78d38)
(cherry picked from commit a20dbd7)
(cherry picked from commit 48406f2)
(cherry picked from commit b8f23d0)
(cherry picked from commit a9f5e44)
(cherry picked from commit 3383007)
(cherry picked from commit d93fb26)

Co-authored-by: Vincent Koc <[email protected]>
Lead with performance, reliability, and GPT-6 Astra support. Preserve the
complete canonical contribution record and source-reviewed SDK guidance.
@xmoxmo
xmoxmo requested a review from a team as a code owner September 6, 2026 10:36
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser app: ios App: ios app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: copilot-proxy Extension: copilot-proxy labels Sep 6, 2026
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • .github/release/clawhub-cli/package-lock.json
  • .github/release/vercel-cli/package-lock.json
  • extensions/acpx/package.json
  • extensions/amazon-bedrock/package.json
  • extensions/anthropic-vertex/package.json
  • extensions/cua-computer/package.json
  • extensions/discord/package.json
  • extensions/google/package.json
  • extensions/matrix/package.json
  • extensions/memory-lancedb/package.json
  • extensions/reef/package.json
  • extensions/slack/package.json
  • extensions/tlon/package.json
  • package.json
  • packages/ai/package.json
  • pnpm-lock.yaml
  • pnpm-workspace.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR redirects matching-workspace agents to a shared SQLite memory database and relaxes database ownership checks.

Example: Agents main and research both use /srv/workspace, with main configured as the system agent.

  • Before: Each agent stores its memory index in its own openclaw-agent.sqlite database.
  • After: Both resolve to one workspace-hashed database under state/memory.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The unchanged head retains four concrete blockers and supplies no runtime proof for the new storage behavior.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Partial
User problem: Agents indexing the same documents duplicate storage and embedding work.
Reason: Deduplication has concrete value, but automatic storage sharing requires an accepted compatibility and ownership contract; this implementation also leaves independent managers and watchers.

Merge readiness

⛔ Blocked before merge - 10 items remain

Keep open for an explicit storage-direction decision: four previously reported correctness problems remain, and the same-author replacement is still conflicting and unproven.

Priority: P2
Reviewed head: ff988081282a457c129dfaf9f5ee18a11c9efe59
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should compatible agents automatically share a physical document index under the existing system-agent configuration?
  • Recommendation: Sponsor a bounded document-index design: Continue the canonical discussion and evaluate the replacement with strict agent ownership, compatible document-only sharing, and complete lifecycle coverage.
  • Why: This changes storage and concurrency semantics beyond the documented shared-document path, and no maintainer approval of that direction appears in the inspected discussion.

Before merge

  • Add real behavior proof - Authority-chain proof required: the complete body and inspected discussion contain no after-fix CLI/Gateway trace showing compatible agents sharing, an excluded agent rejected before database access, or forgetting invalidating pending publication; provide redacted terminal output or logs without credentials, IPs, or private endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve the system agent's explicit workspace (P1) - With system agent main, defaults.workspace=/srv/common, and main.workspace=/srv/private, this helper indexes /srv/common while resolveAgentWorkspaceDir and the sharing hash still resolve /srv/private. Memory searches therefore use the wrong documents and disagree with the agent's workspace. Preserve canonical workspace precedence in this helper and the matching override in src/plugins/memory-runtime.ts.
  • Keep whole-agent database ownership checks (P1) - Open a database for alice at /tmp/memory/shared-backup/alice.sqlite, then request it as bob. The substring exception permits the persisted-owner mismatch; the corresponding cached and pending-open exceptions permit the same cross-agent borrowing. These APIs return whole agent databases, including private state, and never validate workspace or configured sharing membership. Keep generic ownership strict and place document sharing behind a separate Memory Core admission owner.
  • Include index compatibility in the sharing decision (P1) - Two matching-workspace agents with different extraPaths, embedding models, or tokenizers receive the same database because this key contains only workspace. Existing index metadata describes one configuration: manager-search-orchestration.ts:206 returns [] for the other agent's mismatched identity, and a subsequent rebuild replaces the shared tables with that agent's configuration. Require complete index compatibility before sharing, and keep incompatible or agent-local session indexes separate.
  • Route forgetting and publication fences to the searched index (P1) - After a promoted session-derived memory is indexed in the redirected database, memory forget still plans and deletes through {agentId} against the original per-agent database (memory-forget.ts:262 and :600). The searched chunks are not purged, and the shared database revision is not advanced. A shadow rebuild prepared before forgetting can consequently pass its unchanged revision check and republish removed content. Resolve deletion and revision fencing through the same index owner used by search and publication.
  • Resolve security concern: A filename is treated as sharing authority - The generic admission paths have no configured-membership check or document-table restriction, so an excluded agent requesting a matching pathname receives access beyond the proposed shared document index.
  • Resolve merge risk - The contributor must isolate the memory feature from inherited release, locale, dependency, and scanner-policy changes so its merge scope can be assessed independently.
  • Complete next step - Resolve the GitHub-reported conflicts after choosing which same-author branch will carry the implementation.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of System-agent workspace resolution - unknown: Canonical source and tests make explicit per-agent workspaces authoritative; historical blame could not complete. The PR explains default-workspace alignment without explaining why an explicit workspace should lose precedence.

Findings

  • [P1] Preserve the system agent's explicit workspace — extensions/memory-core/src/memory/manager.ts:89-95
  • [P1] Keep whole-agent database ownership checks — src/state/openclaw-agent-db-schema-helpers.ts:328-329
  • [P1] Include index compatibility in the sharing decision — src/agents/memory-search.ts:369-378
  • [high] A filename is treated as sharing authority — src/state/openclaw-agent-db-schema-helpers.ts:329

Provenance

  • System-agent workspace resolution changes intended behavior without addressing why it exists (unknown: Canonical source and tests make explicit per-agent workspaces authoritative; historical blame could not complete. The PR explains default-workspace alignment without explaining why an explicit workspace should lose precedence.)

Tests

  • Missing end-to-end proof: Missing changed-path CLI/Gateway evidence, a failing-before/passing-after shared-index regression, and a stable-release upgrade/rollback run preserving settings, private state, and deletion guarantees.
Agent review details

How this fits together

Memory Core receives agent configuration and workspace files, resolves an index manager, and returns search results backed by SQLite; forgetting and publication must address that same index.

flowchart TD
A[Agent configuration] --> B[Memory configuration resolver]
B --> C[Memory Core manager]
D[Workspace documents] --> C
C --> E[Shared SQLite index]
E --> F[Memory search results]
G[Memory forget] --> H[Per agent SQLite database]
Loading

Technical review

Best possible solution:

Use one Memory Core-owned document-index sharing contract that preserves explicit workspaces, private agent state, index compatibility, and forgetting/publication fences.

Do we have a high-confidence way to reproduce the issue?

The proposed regressions are traceable through configuration resolution, database admission, search identity checks, and forgetting; no target code was executed during this read-only review.

Is this the best way to solve the issue?

Best-fix verdict: wrong layer and incomplete; existing extraPaths already shares document inputs, while physical deduplication needs a Memory Core index owner rather than weakening whole-agent storage admission.

Full review comments:

  • [P1] Preserve the system agent's explicit workspace — extensions/memory-core/src/memory/manager.ts:89-95
    With system agent main, defaults.workspace=/srv/common, and main.workspace=/srv/private, this helper indexes /srv/common while resolveAgentWorkspaceDir and the sharing hash still resolve /srv/private. Memory searches therefore use the wrong documents and disagree with the agent's workspace. Preserve canonical workspace precedence in this helper and the matching override in src/plugins/memory-runtime.ts.
    Confidence: 0.99
  • [P1] Keep whole-agent database ownership checks — src/state/openclaw-agent-db-schema-helpers.ts:328-329
    Open a database for alice at /tmp/memory/shared-backup/alice.sqlite, then request it as bob. The substring exception permits the persisted-owner mismatch; the corresponding cached and pending-open exceptions permit the same cross-agent borrowing. These APIs return whole agent databases, including private state, and never validate workspace or configured sharing membership. Keep generic ownership strict and place document sharing behind a separate Memory Core admission owner.
    Confidence: 0.99
  • [P1] Include index compatibility in the sharing decision — src/agents/memory-search.ts:369-378
    Two matching-workspace agents with different extraPaths, embedding models, or tokenizers receive the same database because this key contains only workspace. Existing index metadata describes one configuration: manager-search-orchestration.ts:206 returns [] for the other agent's mismatched identity, and a subsequent rebuild replaces the shared tables with that agent's configuration. Require complete index compatibility before sharing, and keep incompatible or agent-local session indexes separate.
    Confidence: 0.98
  • [P1] Route forgetting and publication fences to the searched index — src/agents/memory-search.ts:378
    After a promoted session-derived memory is indexed in the redirected database, memory forget still plans and deletes through {agentId} against the original per-agent database (memory-forget.ts:262 and :600). The searched chunks are not purged, and the shared database revision is not advanced. A shadow rebuild prepared before forgetting can consequently pass its unchanged revision check and republish removed content. Resolve deletion and revision fencing through the same index owner used by search and publication.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8f3da9e8e46e.

Merge-risk options

Maintainer options:

  1. Narrow and repair the sharing owner (recommended)
    Keep generic agent database guards intact and implement compatible document sharing with one authoritative index and deletion lifecycle.
  2. Consolidate after the replacement is proven
    Resolve the product choice and validate the replacement before closing this same-author branch as superseded.

Provenance checked

  • Per-agent memory database placement changes intended behavior with a stated reason (f324f7e: The verified commit moved memory into the per-agent SQLite database as part of database-first alignment; refactor(sqlite): land database-first memory and proxy alignment #94646 describes preserving ownership and migration compatibility.)
  • Agent ownership assertions changes intended behavior with a stated reason (unknown: Existing comments and tests protect non-interchangeable agent databases; local blame and content-history searches fail on unavailable historical blobs. The PR explains its intended cross-agent exception, but workspace matching does not constrain generic database callers.)

Testing

Proof path: none.

Security

Needs attention: The ownership exception allows cross-agent access to whole databases based on their pathname.

Evidence

Security concerns:

  • [high] A filename is treated as sharing authority — src/state/openclaw-agent-db-schema-helpers.ts:329
    The generic admission paths have no configured-membership check or document-table restriction, so an excluded agent requesting a matching pathname receives access beyond the proposed shared document index.
    Confidence: 0.99

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Production versus tests Runtime/tooling +104/-19; tests/support +381/-90 Excludes manifests, lockfiles, locales, and documentation; the memory feature itself adds +78/-6 production lines and no regression tests, so the test growth does not validate sharing.
Changed storage default 1 automatic database-path override; 0 new configuration keys Existing system-agent and workspace settings now select shared storage without checking complete index compatibility.

Root-cause cluster

Relationship: same_root_cause
Canonical: #95724
Summary: The canonical issue and replacement PR address duplicate physical indexes for compatible agents; the replacement is not presently safe evidence for a superseded close.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: Physical index deduplication is a useful multi-agent improvement, with no established urgent defect in current upstream behavior.
  • add merge-risk: 🚨 compatibility: Existing workspace configuration starts selecting different index storage and the system agent's explicit workspace can be overridden.
  • add merge-risk: 🚨 session-state: Search and forgetting address different databases, breaking deletion and stale-publication guarantees.
  • add merge-risk: 🚨 security-boundary: Filename-based exceptions admit another agent's whole database without validating sharing membership.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: Physical index deduplication is a useful multi-agent improvement, with no established urgent defect in current upstream behavior.
  • merge-risk: 🚨 compatibility: Existing workspace configuration starts selecting different index storage and the system agent's explicit workspace can be overridden.
  • merge-risk: 🚨 session-state: Search and forgetting address different databases, breaking deletion and stale-publication guarantees.
  • merge-risk: 🚨 security-boundary: Filename-based exceptions admit another agent's whole database without validating sharing membership.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-09-06T10:43:03.327Z sha f43125fdeae0e5e119577678a79a5d50a6b22533 :: needs real behavior proof before merge. :: [P1] [P1] Preserve explicit memory disablement | [P1] [P1] Resolve shared storage beneath the active state root | [P1] [P1] Keep the system agent's explicit workspace authoritative | [P1] [P1] Preserve whole-agent database ownership checks | [P1] [P1] Retain source-scope invalidation before serving old hits | [P2] [P2] Route all intended participants through one sharing contract
  • reviewed 2026-09-06T11:26:43.007Z sha f43125fdeae0e5e119577678a79a5d50a6b22533 :: needs real behavior proof before merge. :: [P1] [P1] Preserve explicit memory disablement | [P1] [P1] Resolve shared storage beneath the active state root | [P1] [P1] Keep the system agent's explicit workspace authoritative | [P1] [P1] Preserve whole-agent database ownership checks | [P1] [P1] Retain source-scope invalidation before serving old hits | [P2] [P2] Route all intended participants through one sharing contract
  • reviewed 2026-09-06T12:35:53.367Z sha f43125fdeae0e5e119577678a79a5d50a6b22533 :: needs real behavior proof before merge. :: [P1] Preserve explicit memory disablement | [P1] Resolve shared storage beneath the active state root | [P1] Keep the system agent's explicit workspace authoritative | [P1] Preserve whole-agent database ownership checks | [P1] Retain source-scope invalidation before serving old hits | [P2] Route all intended participants through one sharing contract
  • reviewed 2026-09-06T13:42:36.491Z sha ff98808 :: needs real behavior proof before merge. :: [P1] Preserve the system agent's explicit workspace | [P1] Preserve whole-agent database ownership checks | [P1] Include index compatibility in the sharing decision | [P1] Route forgetting and publication fences to the searched index
  • reviewed 2026-09-27T00:37:48.748Z sha ff98808 :: needs real behavior proof before merge. :: [P1] Preserve the system agent's explicit workspace | [P1] Keep whole-agent database ownership checks | [P1] Include index compatibility in the sharing decision | [P1] Route forgetting and publication fences to the searched index
  • reviewed 2026-10-11T02:41:15.818Z sha ff98808 :: needs real behavior proof before merge. :: [P1] Preserve the system agent's explicit workspace | [P1] Keep whole-agent database ownership checks | [P1] Include index compatibility in the sharing decision | [P1] Route forgetting and publication fences to the searched index

Reviewed November 1, 2026, 4:13 PM ET / 21:13 UTC (Revision 7).

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes are blocked

OpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph.

Detected dependency graph changes:

  • .github/release/clawhub-cli/package-lock.json changed.
  • .github/release/vercel-cli/package-lock.json changed.
  • pnpm-lock.yaml changed.
  • extensions/acpx/package.json changed dependencies.
  • extensions/amazon-bedrock/package.json changed dependencies.
  • extensions/anthropic-vertex/package.json changed dependencies.
  • extensions/cua-computer/package.json changed dependencies.
  • extensions/discord/package.json changed dependencies.
  • extensions/google/package.json changed dependencies.
  • extensions/matrix/package.json changed dependencies.
  • extensions/memory-lancedb/package.json changed dependencies.
  • extensions/reef/package.json changed dependencies.
  • extensions/slack/package.json changed dependencies.
  • extensions/tlon/package.json changed dependencies.
  • package.json changed dependencies, devDependencies, packageManager.
  • packages/ai/package.json changed dependencies.

Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:

  • extensions/acpx/package.json changed dependencies.
  • extensions/amazon-bedrock/package.json changed dependencies.
  • extensions/anthropic-vertex/package.json changed dependencies.
  • extensions/cua-computer/package.json changed dependencies.
  • extensions/discord/package.json changed dependencies.
  • extensions/google/package.json changed dependencies.
  • extensions/matrix/package.json changed dependencies.
  • extensions/memory-lancedb/package.json changed dependencies.
  • extensions/reef/package.json changed dependencies.
  • extensions/slack/package.json changed dependencies.
  • extensions/tlon/package.json changed dependencies.
  • package.json changed dependencies, devDependencies, packageManager.
  • packages/ai/package.json changed dependencies.

Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed.

To remove lockfile changes, restore them from the target branch:

git fetch origin
git checkout 'origin/main' -- '.github/release/clawhub-cli/package-lock.json' '.github/release/vercel-cli/package-lock.json' 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git push

If this PR intentionally needs a dependency graph change, ask a repository admin or member of @openclaw/openclaw-secops to comment:

/allow-dependencies-change

The action will approve the current head SHA (ff988081282a457c129dfaf9f5ee18a11c9efe59) when it reruns. A later push requires a fresh approval.

OpenClaw_Wind added 3 commits September 6, 2026 21:31
When any agent shares the same workspace as the system agent, redirect
store.databasePath to a shared sqlite keyed by workspace hash under the
canonical state directory (resolveStateDir()). This respects
OPENCLAW_STATE_DIR and ensures installations with separate state roots
remain isolated.

- Preserve the existing enabled gate (no global enabled=true override)
- Check agent-specific workspace before defaults for canonical precedence
- Apply shared path to all agents with matching workspace, not just system
When multiple agents share the same workspace, they resolve to the same
shared memory database path. Skip the ownership assertion for paths
matching the shared-memory pattern (memory/shared-*) to allow
cross-agent access.

The workspace-matching logic in memory-search ensures agents only reach
databases derived from their own workspace, so this bypass is safe.
When the system agent is configured with an explicit default workspace
(agents.defaults.workspace), use that path directly for the shared
memory database instead of the per-agent subdirectory. This ensures the
system agent and the memory plugin lifecycle share the same canonical
workspace and SQLite database.

Applies to both the runtime plugin loader (memory-runtime.ts) and the
memory-core CLI/agent manager (manager.ts).

This branch has not been deployed

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

Labels

agents Agent runtime and tooling app: ios App: ios app: macos App: macos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: qa-channel Channel integration: qa-channel channel: raft Channel integration: Raft channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: synology-chat channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: admin-http-rpc extensions: anthropic extensions: arcee extensions: baseten Extension: baseten extensions: byteplus extensions: cerebras extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: cloudflare-ai-gateway extensions: cohere extensions: comfy extensions: copilot-proxy Extension: copilot-proxy extensions: crabbox extensions: deepgram extensions: deepinfra extensions: deepseek extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: document-extract extensions: duckduckgo extensions: featherless extensions: fish-audio Extension: fish-audio extensions: gmi extensions: huggingface extensions: image-generation-core extensions: inworld Extension: inworld extensions: kilocode extensions: litellm extensions: llama-cpp extensions: llm-task Extension: llm-task extensions: lmstudio extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: onepassword 1Password plugin extensions: openai extensions: policy extensions: qa-lab extensions: stepfun extensions: tencent extensions: tokenjuice Changes to the bundled tokenjuice extension extensions: vault Extension: vault extensions: web-readability extensions: webhooks gateway Gateway runtime plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: cua-computer plugin: file-transfer plugin: geolocation Geolocation plugin (IP to coarse city) plugin: google-meet plugin: imap plugin: linux-node plugin: logbook Logbook automatic work journal plugin plugin: migrate-claude plugin: migrate-hermes plugin: mxc plugin: pixverse plugin: teams-meetings Teams Meetings plugin plugin: visitor-access plugin: workboard plugin: zoom Zoom plugin scripts Repository scripts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants