Skip to content

feat(memory): add multi-slot memory role architecture#88504

Open
kklouzal wants to merge 1 commit into
openclaw:mainfrom
kklouzal:feat/multi-slot-memory-architecture
Open

feat(memory): add multi-slot memory role architecture#88504
kklouzal wants to merge 1 commit into
openclaw:mainfrom
kklouzal:feat/multi-slot-memory-architecture

Conversation

@kklouzal

@kklouzal kklouzal commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a memory-plugin architecture flaw: OpenClaw currently has one exclusive plugins.slots.memory owner even though the product, docs, bundled plugins, and runtime behavior already treat “memory” as several different responsibilities.

Today, factual recall, auto-capture, compaction, dreaming/consolidation, and user/session modeling are all forced through the same global selector. That makes documented memory stacks impossible or brittle: selecting one memory provider can unintentionally displace another provider that owns a different responsibility.

This PR corrects that mismatch by introducing purpose-specific memory role slots:

  • memory.recall
  • memory.capture
  • memory.compaction
  • memory.dreaming
  • memory.userModel

The new role slots are the mechanism. The fix is that OpenClaw can now represent the memory architecture it already documents and partially implements.

What Problem This Solves

This is a flaw fix, not just a feature request.

OpenClaw’s memory ecosystem is already multi-role:

  • memory-core / QMD provide local factual recall/search over project memory, session transcripts, and Markdown/QMD corpora.
  • Honcho provides cross-session user, agent, and session modeling.
  • LanceDB provides embedding-backed long-term recall and auto-capture.
  • Active Memory orchestrates recall before generation by using whichever provider owns recall.
  • Memory Wiki compiles durable memory into a companion knowledge vault rather than replacing active memory.
  • Dreaming/consolidation is a separate runtime responsibility from ordinary recall.

The current plugins.slots.memory contract cannot express that architecture. It treats every kind: "memory" provider as competing for one owner slot, even when the providers are designed to do different jobs. That leads to three concrete problems:

  1. Documented combinations are not representable. Configs such as builtin/QMD recall + Honcho user modeling, LanceDB capture + local recall, or Active Memory over a selected recall provider cannot be modeled cleanly through one memory owner.
  2. Runtime behavior depends on exceptions and side paths. Plugins that should compose have to rely on context-engine ownership, sidecar behavior, fallback logic, or plugin-specific handling instead of a shared contract.
  3. Diagnostics and lifecycle handling become misleading. Startup, validation, status, doctor repair, skill publishing, uninstall cleanup, runtime memory resolution, and SDK-facing aliases need to know which provider owns which memory responsibility.

So while this PR adds new public config keys, the intent is corrective: make the config/runtime contract match the memory system OpenClaw already exposes.

User Impact / Intended Outcome

After this PR, OpenClaw can express memory stacks that were previously documented or implied but not cleanly configurable:

  • memory-core or QMD can own factual recall while Honcho owns user/session modeling.
  • LanceDB can own recall and/or capture without forcing unrelated memory roles through the same selector.
  • Active Memory can use the configured memory.recall provider instead of depending on hard-coded assumptions.
  • Dreaming/consolidation can be selected separately from ordinary recall where supported.
  • Memory Wiki can remain a companion compiled-knowledge layer beside active memory providers.
  • Existing configs using plugins.slots.memory continue to work as recall selection.
  • openclaw doctor --fix can migrate/canonicalize non-conflicting legacy memory-slot config while preserving the legacy key for plugin compatibility.

Linked Context

Closes #60572.

Directly related memory-composition requests and prior proposals:

Dreaming and memory-role separation context:

Runtime/diagnostic slot handling context:

Context-engine compatibility context:

Future API/RFC context:

Memory-plugin interop research: the supporting research document validates this PR as necessary architecture work, not optional extensibility: OpenClaw's own documentation already describes memory as a composable ecosystem where builtin/QMD recall, Honcho user/session modeling, LanceDB recall/capture, Active Memory orchestration, dreaming/consolidation, and Memory Wiki compilation can coexist, but current origin/main collapses every kind: "memory" provider into one exclusive plugins.slots.memory owner, making those documented combinations impossible or dependent on brittle exceptions. PR #88504 closes that product/docs/runtime gap by replacing the single memory owner with explicit role slots — memory.recall, memory.capture, memory.compaction, memory.dreaming, and memory.userModel — while preserving legacy memory as a recall shorthand, so the documented memory-plugin interop story becomes actually representable in config and runtime behavior.

What Changes

  • Adds canonical memory role slots: memory.recall, memory.capture, memory.compaction, memory.dreaming, and memory.userModel.
  • Keeps legacy plugins.slots.memory as a backward-compatible shorthand for memory.recall during an extended migration window.
  • Adds per-agent memory role-slot overrides under agents.list[*].plugins.slots, limited to memory roles plus legacy memory.
  • Wires role-slot selection through config schema/types/help/docs, plugin activation, gateway startup preloading, runtime memory resolution, skill publishing, validation, doctor repair/preview, uninstall cleanup, status diagnostics, and SDK-facing aliases.
  • Preserves the existing global plugins.slots.contextEngine path for LosslessClaw and other context-engine plugins.
  • Explicitly rejects unsupported per-agent agents.list[*].plugins.slots.contextEngine overrides because agent-scoped context-engine semantics are outside this PR.

Implementation Notes

  • Adds src/plugins/slot-resolution.ts as the shared role-slot helper layer for canonical memory role keys, defaults, normalization, effective per-agent resolution, and configured selection collection.
  • Updates config schema/types/help/labels/docs for global and per-agent memory role slots.
  • Keeps PluginSlotsConfig.contextEngine for global plugin slots, and adds an agent-slot type/schema that omits contextEngine.
  • Updates doctor legacy memory-slot handling so doctor --fix canonicalizes to memory.recall while retaining legacy memory during the compatibility window.
  • Updates plugin loader/activation/startup resolution so explicit role-slot selections activate memory plugins without confusing default memory-core fallback with a user-selected plugin under restrictive allowlists.
  • Extends validation to report missing role-slot plugin refs and validate schemas for plugins selected only by non-recall or per-agent memory roles.
  • Extends skill publishing, status scanning, uninstall cleanup, memory runtime, dreaming, compaction provider, and SDK alias behavior to use the role-aware model.
  • Keeps memory runtime registrations addressable by plugin id, so runtime recall dispatch follows the resolved global or per-agent memory.recall owner.
  • Passes the session agent id into Pi embedded extension factory construction so safeguard compaction provider selection honors per-agent memory.compaction overrides in both normal session runs and manual/queued compaction paths.
  • Updates bundled memory plugin manifests/docs to describe role support and the recall shorthand migration.

Tests / Verification

Current PR branch:

  • Branch: kklouzal:feat/multi-slot-memory-architecture
  • Base target: openclaw/openclaw:main
  • Latest pushed commit: 9040ece51de5aae8178225cf5d6e8f82dde1886d
  • Current PR merge state after push: UNSTABLE.

Latest validation at current pushed head:

  • pnpm vitest run test/scripts/plugin-prerelease-test-plan.test.ts: passed before the inheritance repair follow-up.
  • node scripts/run-vitest.mjs src/plugins/slots.test.ts src/plugins/uninstall.test.ts src/commands/doctor/shared/stale-plugin-config.test.ts: passed after the inheritance repair follow-up.
  • Rebase onto latest origin/main: completed with one conflict in test/scripts/plugin-prerelease-test-plan.test.ts, resolved to the canonical timeoutMs: 1_500_000 expectation.
  • git status --short --branch: clean and on pr-88504-ci-remediation...fork/feat/multi-slot-memory-architecture.

Earlier exact-head proof gates carried forward by current head:

  • Dev-01 failed CI shard local equivalent: passed, 6 files, 55 tests.
  • Dev-01 conflict-focused memory/plugin runtime Vitest: passed, 3 files, 65 tests, 127 skipped.
  • Dev-01 pnpm check:test-types: passed.
  • Dev-01 pnpm format:check src/plugins/memory-runtime.ts: passed.
  • Dev-01 node scripts/check-no-conflict-markers.mjs: passed.
  • Dev-01 git diff --check: passed.
  • Orion/Nano-01 rollback/upgrade matrix from v2026.5.28 to PR head 3f1f547042220aee42b3e39b8cb7ecb15cfac993: passed for release install/status/valid doctor-fix, expected old-release config rejection of future PR-era slot keys, PR install/config/doctor/status/plugins/models/agents/slots, focused runtime tests, focused doctor/legacy tests, conflict-marker check, and diff check.

Evidence

Rebase/Squash/Proof

  • Common upstream base: 13ecca5408cbc94e66105608bfe770d0fc660d76 (origin/main, fix(telegram): back off session init spool retries)
  • Previous PR head: 9040ece51de5aae8178225cf5d6e8f82dde1886d
  • Current PR head: aaa40f2ad50ca4ab1e5a5171f3de34d844e6fe8f
  • Rebased and squashed to one commit on the common base; pushed with --force-with-lease.

ClawSweeper Requested Real Behavior Proof Coverage

ClawSweeper requested redacted real behavior proof for the durable memory role-slot surface before merge: migration/upgrade compatibility, config/schema and plugin loader behavior, memory runtime role-slot selection, doctor migration/repair, status/models output, legacy plugins.slots.memory compatibility, canonical role slots, per-agent overrides, disabled/none recall slots, live CLI agent turns, and gateway service-dispatched live agent execution.

The proof below covers those requested areas with redacted rollback/upgrade output, focused config/doctor/status/plugin-loader gates, live CLI agent-turn markers, exact-head gateway service install/restart/status/health checks, gateway-dispatched live agent execution, and additional automation/plugin-subagent bookkeeping validation. Private host/path/token/session/network values are redacted while preserving commands, markers, artifact names, and commit hashes.

Caveat: the full runtime rollback/upgrade/gateway proof is carried forward from PR head 3f1f547042220aee42b3e39b8cb7ecb15cfac993, while later focused validation covers current pushed head 7fe86ce04ec6df8a571dba1465507ab35be963ba. If the branch changes materially before merge, refresh the exact-head runtime proof as ClawSweeper requested.

Real / Live Behavior Proof

Latest tested PR commit:

head=9040ece51de5aae8178225cf5d6e8f82dde1886d
head_short=9040ece51de5
commit=feat(memory): add multi-slot memory role architecture
branch=kklouzal:feat/multi-slot-memory-architecture
base=openclaw/openclaw:main

Latest validation at this commit:

  • PR feat(memory): add multi-slot memory role architecture #88504 was rebased onto the latest origin/main, squashed, then updated with fix commit 7fe86ce6aeddcc55ca41762f16fd19b798f3042d for per-agent memory slot inheritance repair.
  • The only merge conflict was scripts/plugin-sdk-surface-report.mjs.
  • Conflict cause: origin/main changed SDK surface budgets while this PR branch added memory role-slot SDK surface area.
  • Resolution kept both sides and updated aggregate SDK surface budgets to match the merged tree:
    • OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_ENTRYPOINTS: 321
    • OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_EXPORTS: 10338
    • OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_FUNCTION_EXPORTS: 5187
    • OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS: 3246
  • Focused validation at 7fe86ce6aeddcc55ca41762f16fd19b798f3042d: node scripts/run-vitest.mjs src/plugins/slots.test.ts src/plugins/uninstall.test.ts src/commands/doctor/shared/stale-plugin-config.test.ts passed.
  • Merge conflict verification after remediation: git merge-tree --write-tree HEAD origin/main completed cleanly with no conflict output.
  • Worktree after remediation: clean.

Earlier exact-head proof carried forward by the merge commit:

  • CI remediation commit c447e22033ca104cb9d5292edf4313bcb74f81cf fixed the PR-owned check-prod-types failure by removing the now-unused active-memory config parameter/helper after the memory tool allowlist behavior change.
  • Verified on Dev-01 with pnpm tsgo:prod passing before push.
  • Full proof refresh at 3f1f547042220aee42b3e39b8cb7ecb15cfac993 covered memory role-slot contract, per-agent overrides, legacy plugins.slots.memory compatibility, disabled none recall slots, doctor migration/repair behavior, role-slot-selected plugin activation/validation, upgrade behavior from the last public release, exact-head gateway service install/restart, gateway health, gateway-dispatched live agent execution, and plugin subagent completion bookkeeping.

Proof environment:

  • Dev-01 canonical checkout.
  • Orion/Nano-01 Linux rollback/upgrade test box.
  • Nano was tested at PR head 3f1f547042220aee42b3e39b8cb7ecb15cfac993, rolled back to public release v2026.5.28, then upgraded directly back to the same PR head.
  • Runtime logs were redacted for private host, path, token, session, and network values.
validated_current_head=9040ece51de5aae8178225cf5d6e8f82dde1886d
full_runtime_proof_head=3f1f547042220aee42b3e39b8cb7ecb15cfac993
release_base=v2026.5.28 e93216080aa1f425d3ab127014603eba8e365b2d
nano_proof_bundle=proof-full-2b0d657729a3-20260604T025709Z
nano_auth_backup_sha256=eef060cae6f9f53141bdcbb5fb45960cb18c935a4d5e094599a9bac4fc62a1c3
dev01_gateway_artifact=.artifacts/proof-full-2b0d657-dev01-20260604T030012Z
upgrade_path=auth backup -> exact-head baseline -> release checkout/install/doctor/status/models -> PR checkout/install/config/doctor/status/models/slots/agents -> post-upgrade live provider turn -> exact-head gateway service force install/restart -> gateway live agent dispatch

Dev-01 exact-head deterministic gateway/plugin-subagent gates:

- src/gateway/server-plugins.subagent-ended-hook.test.ts
- src/gateway/server-plugins.test.ts
- src/gateway/server-methods/agent.test.ts
- result: passed, 4 files, 337 tests
- coverage focus: plugin runtime gateway dispatch scope, generated idempotency fallback, plugin_subagent tracking, plugin owner propagation, registry registration, completion bookkeeping, retry dedupe, and fallback behavior when registry persistence fails

Nano auth-preserving rollback/upgrade matrix:

- private auth backup before rollback: created, sha256 eef060cae6f9f53141bdcbb5fb45960cb18c935a4d5e094599a9bac4fc62a1c3
- checkout v2026.5.28: passed
- release pnpm install --frozen-lockfile: passed
- release version: passed
- release config validate against PR-era role-slot config: failed as expected because old release does not know future memory role-slot keys
- release doctor --fix --non-interactive: passed
- release status: passed
- release models status: passed
- checkout PR head 3f1f547042220aee42b3e39b8cb7ecb15cfac993: passed
- PR pnpm install --frozen-lockfile: passed
- PR version: passed
- PR config validate: passed
- PR doctor --fix --non-interactive: passed
- PR status: passed
- PR models status: passed; provider auth status ok, missingProvidersInUse=[]
- PR plugins.slots inspection: passed
- PR agents.list inspection: passed
- post-upgrade live main agent turn: passed

Nano clean live source CLI turns after re-auth:

- main: exit=0, marker=OKM2B0D
- honcho-agent: exit=0, marker=OKH2B0D
- dreamer-agent: exit=0, marker=OKD2B0D
- split-agent: exit=0, marker=OKS2B0D
- disabled-recall-agent: exit=0, marker=OKN2B0D

Nano exact-head gateway service proof:

- gateway install --force: passed
- gateway restart: passed
- gateway status: passed; OpenClaw CLI version 2026.6.9, Gateway version 2026.6.9, runtime running, connectivity probe ok, capability write-capable, listening on loopback port 18789
- gateway health: passed, OK
- gateway stability: passed
- gateway call agent --expect-final through running service: passed, status=ok, marker=LIVE_GATEWAY_AGENT_FORCE_2B0D

Nano focused exact-head source gates after upgrade:

- focused memory/plugin runtime Vitest: passed, 4 files, 245 tests
- focused doctor/legacy slot Vitest: passed, 3 files, 81 tests
- check-no-conflict-markers: passed
- git diff --check: passed
- final git status: clean for tracked files; only pre-existing generated `1/` build-output directories remained untracked from doctor/UI build paths

Verified role-slot matrix:

pr_global_slot_matrix_verified:
- plugins.slots.memory.recall = memory-core
- plugins.slots.memory.dreaming = memory-core
- plugins.slots.memory.userModel = openclaw-honcho
- plugins.slots.contextEngine = lossless-claw

pr_agent_slot_matrix_verified:
- main: no explicit per-agent memory override
- honcho-agent: memory.recall = openclaw-honcho; memory.userModel = openclaw-honcho
- dreamer-agent: memory.recall = memory-core; memory.dreaming = memory-core; memory.userModel = openclaw-honcho
- split-agent: memory.recall = memory-core; memory.capture = active-memory; memory.userModel = openclaw-honcho
- disabled-recall-agent: memory.recall = none; memory.capture = active-memory; memory.userModel = openclaw-honcho

Observed result:

  • Current pushed PR head is 9040ece51de5aae8178225cf5d6e8f82dde1886d.
  • The current head includes the full memory role-slot implementation, the latest origin/main rebase, and the squashed PR history.
  • The current head passed focused plugin prerelease plan validation after the rebase/squash.
  • The earlier full runtime proof demonstrates that the role-slot implementation validates and doctors the intended memory role-slot matrix after direct upgrade from the last public release.
  • Auth survived rollback/upgrade testing and was confirmed by post-upgrade provider status plus live agent turns.
  • Five clean source CLI agent turns and one exact-head gateway service-dispatched agent turn completed successfully.
  • Gateway service proof required gateway install --force; a non-forced install left the already-installed unit in place, which was explicitly caught and corrected before claiming gateway proof.

What was not tested:

  • Maintainer taxonomy approval is still a review decision, not something this proof can self-certify.
  • Runtime proof logs were redacted to avoid private host, path, token, session, and network values.

Proof limitations or environment constraints:

  • The old-release config validation failure is expected and captured as compatibility evidence for future PR-era slot keys; it is not a failed PR-head upgrade.
  • The gateway service was loopback-bound on Nano and tested through local gateway CLI calls.

Compatibility and Risk

Backward compatibility preserved:

  • Existing plugins.slots.memory configs continue to resolve as recall selection.
  • doctor --fix keeps the legacy plugins.slots.memory key in place after copying to memory.recall, so third-party plugins that still read only the legacy key do not hit an immediate flag day.
  • The default recall plugin remains memory-core unless explicitly disabled or overridden.
  • plugins.enabled = false, denylist behavior, and explicit plugins.entries.<id>.enabled = false remain respected.
  • Global plugins.slots.contextEngine remains separate from memory roles and continues to select context engines such as LosslessClaw.

Compatibility changes reviewers should inspect:

  • memory.recall, memory.capture, memory.compaction, memory.dreaming, and memory.userModel become durable public config keys after merge.
  • Per-agent plugin-slot overrides are memory-only. agents.list[*].plugins.slots.contextEngine is intentionally rejected until a future PR defines and implements agent-scoped context-engine semantics.
  • Legacy plugins.slots.memory is still deprecated as a canonical authoring target even though it remains supported and retained for compatibility.

Primary risks:

  • The public memory role taxonomy becomes API surface after merge, so naming and docs need maintainer signoff.
  • Role-gating mistakes could attach the wrong memory provider or suppress expected memory behavior; this PR adds focused coverage across loader, validation, startup, runtime, doctor, status, skill publishing, and cleanup surfaces.
  • Third-party plugins should eventually read memory.recall, but the retained legacy key avoids forcing that ecosystem update immediately.

PR/Commit Surface Breakdown

Source: 67 files, +2216 / -782
Tests: 37 files, +2639 / -98
Total: 104 files, +4855 / -880

Reviewer Checklist

  • Review role-slot resolution/default behavior and backward compatibility for legacy plugins.slots.memory configs.
  • Review documentation/schema/UI metadata updates against the new canonical memory role slots.
  • Confirm the preserved verification and rebase proof cover the current branch head.

Maintenance update (2026-06-25): rebased/squashed cleanup to head 60783bc0a577dc5201210da488f28eed70475df6; removed duplicated gateway watch CI/test remediation hunks from standalone PR #95473 so that #95473 remains the sole carrier of that fix.


Clawsweeper remediation update — 2026-06-26

  • Old head: 60783bc0a577dc5201210da488f28eed70475df6
  • New head: 4e4d3b190ea2c510ce51e0dd5dbd27296c6e95a3
  • Remediated valid source finding: native harness scoped plugin preload now resolves the canonical/per-agent memory.recall role slot instead of only the legacy scalar memory slot.
  • Proof: added focused regressions for canonical plugins.slots["memory.recall"] and per-agent memory.recall overrides in src/agents/harness/runtime-plugin.test.ts.
  • Validation: git diff --check HEAD^..HEAD, pnpm exec oxlint src/agents/harness/runtime-plugin.ts src/agents/harness/runtime-plugin.test.ts, and node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-support.config.ts src/agents/harness/runtime-plugin.test.ts --reporter verbose all passed.

@kklouzal
kklouzal requested a review from a team as a code owner May 31, 2026 02:59
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes commands Command implementations agents Agent runtime and tooling extensions: qa-lab extensions: memory-wiki plugin: migrate-hermes size: XL triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 31, 2026
@clawsweeper

clawsweeper Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 11:16 PM ET / July 19, 2026, 03:16 UTC.

Summary
The branch replaces the single memory plugin selector with five role-specific global and per-agent memory slots, wiring them through plugin loading, memory runtime dispatch, diagnostics, UI, documentation, and tests.

Reproducibility: no. high-confidence current-main reproduction was established in this read-only review. The central change is a new configuration and plugin-routing model, while the concrete upgrade concern is source-visible in the proposed branch.

Review metrics: 2 noteworthy metrics.

  • Memory configuration surface: 5 added role slots plus per-agent overrides. This expands persisted configuration and plugin-selection semantics across upgrades rather than adding an isolated implementation detail.
  • Plugin hook contract: 1 new memoryRole hook option. Hook dispatch behavior becomes role-dependent, so third-party plugin compatibility needs an explicit supported contract.

Stored data model
Persistent data-model change detected: migration/backfill/repair: docs/gateway/configuration-reference.md, migration/backfill/repair: docs/tools/plugin.md, migration/backfill/repair: extensions/memory-core/src/cli.ts, migration/backfill/repair: src/commands/doctor-memory-search.test.ts, serialized state: extensions/memory-wiki/src/bridge.test.ts, unknown-data-model-change: extensions/memory-core/src/cli.runtime.ts, and 25 more. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real-run evidence from current head for legacy upgrade, Doctor migration, per-agent role resolution, and gateway-dispatched execution.
  • Resolve the legacy-selector upgrade behavior through the approved migration contract.
  • Obtain maintainer confirmation of the permanent role-slot and hook API scope.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR describes substantial redacted evidence, but the supplied material is not inspectably tied to current head ce2ecbb…; add redacted current-head upgrade, Doctor, per-agent routing, and gateway-dispatch output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Existing configurations that set only plugins.slots.memory to a non-default provider can resolve to memory-core after upgrade, contradicting the stated compatibility window and changing recall behavior.
  • [P1] Five global role slots, per-agent overrides, and hook-level role gating create a long-lived plugin API/configuration contract without a maintainer-confirmed scope or deprecation policy.
  • [P1] The supplied runtime evidence is not demonstrably tied to current head ce2ecbb73b2d3544525e0d42180377d560459e6c, so upgrade and gateway-dispatch behavior remain unverified for the branch under review.

Maintainer options:

  1. Define and prove the upgrade path (recommended)
    Before merge, migrate legacy plugins.slots.memory configurations through the supported Doctor path and show that old non-default recall selections cannot silently become memory-core.
  2. Accept a breaking configuration transition
    Maintain the canonical-only resolver but explicitly approve a release-noted breaking change with clear operator recovery instructions.
  3. Pause for contract design
    Hold the PR until an owner confirms that five role slots, per-agent overrides, and hook-level role gating are the intended permanent plugin contract.

Next step before merge

  • [P1] A maintainer must choose the permanent memory role-slot and plugin-hook contract before any repair can safely preserve upgrade compatibility.

Maintainer decision needed

  • Question: Should OpenClaw make five global and per-agent memory role slots a supported core/plugin API now, with a defined upgrade migration and deprecation window for plugins.slots.memory?
  • Rationale: This is a broad public configuration and plugin-hook contract; deciding its permanent shape, supported roles, per-agent semantics, and compatibility window requires maintainer product and ownership intent.
  • Likely owner: steipete — The timeline explicitly routes the PR to steipete, and the unresolved choice is a core product/API direction rather than a mechanical code repair.
  • Options:
    • Sponsor a staged role-slot contract (recommended): Approve a narrower, documented role-slot API only after its migration and compatibility behavior are specified and proven on an upgrade path.
    • Keep the single core slot: Decline the new core config surface and require optional composition to remain within existing plugin seams until a smaller missing API is identified.
    • Request an RFC first: Pause this implementation while an owner-backed RFC settles role ownership, hook semantics, and per-agent behavior.

Security
Cleared: The reviewed diff changes configuration, routing, and runtime registration but does not show a concrete new security or supply-chain boundary regression.

Review findings

  • [P1] Migrate legacy memory selections before canonical routing — src/plugins/slot-resolution.ts:49-60
Review details

Best possible solution:

Obtain maintainer approval for a minimal durable memory-role contract, then land it with a tested Doctor-led migration that converts existing legacy memory selectors before canonical runtime routing can change user behavior.

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

No high-confidence current-main reproduction was established in this read-only review. The central change is a new configuration and plugin-routing model, while the concrete upgrade concern is source-visible in the proposed branch.

Is this the best way to solve the issue?

Unclear. Role separation may address real composition needs, but this branch is not yet the best merge path until maintainers choose the permanent API and the Doctor-led upgrade contract is made consistent with runtime behavior.

Full review comments:

  • [P1] Migrate legacy memory selections before canonical routing — src/plugins/slot-resolution.ts:49-60
    Legacy-only plugins.slots.memory configurations now resolve recall to memory-core; the added tests assert this behavior even though the docs and PR promise an extended legacy compatibility window. Migrate the shipped selector through the supported Doctor path before it can reach this resolver, or obtain explicit approval for a documented breaking transition.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.83

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ed546bdcf540.

Label changes

Label justifications:

  • P2: This is a broad memory/plugin architecture improvement with concrete upgrade risk, but the provided evidence does not establish an emergency current-user outage.
  • merge-risk: 🚨 compatibility: Legacy-only memory selectors can change effective recall ownership after upgrade unless migration occurs before canonical runtime selection.
  • merge-risk: 🚨 session-state: Per-agent recall and compaction selection can alter which memory runtime handles an existing agent session and its lifecycle work.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR describes substantial redacted evidence, but the supplied material is not inspectably tied to current head ce2ecbb…; add redacted current-head upgrade, Doctor, per-agent routing, and gateway-dispatch output before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

What I checked:

  • Legacy compatibility conflict: The branch documents legacy plugins.slots.memory as a deprecated recall shorthand, but the new role resolver tests assert that legacy-only memory selections are ignored and recall defaults to memory-core; an existing non-default memory provider can therefore change on upgrade before Doctor is run. (src/plugins/slots.test.ts:18, ce2ecbb73b2d)
  • Canonical runtime resolution: The new role resolver is the shared path for selecting a memory role, so making memory.recall canonical without a completed migration affects runtime routing rather than only diagnostics or documentation. (src/plugins/slot-resolution.ts:49, ce2ecbb73b2d)
  • Configuration and SDK surface expansion: The diff adds five role slots plus per-agent overrides and exposes MemoryPluginRole on hook registration, making this a durable config and plugin API decision rather than a narrow bug repair. (src/plugins/memory-role.contract.ts:2, ce2ecbb73b2d)
  • Current-head proof gap: The PR body cites proof for earlier heads including aaa40f2… and 3f1f547…, while the GitHub context reports current head ce2ecbb…; the provided context does not include inspectable after-fix output tied to that live head for legacy upgrade, per-agent routing, Doctor, and gateway dispatch. (ce2ecbb73b2d)
  • Repository policy applied: The repository policy requires canonical runtime config and a Doctor migration for invalidated shipped configuration, and treats plugin API/config/default changes as compatibility-sensitive merge risk. (AGENTS.md:1, ed546bdcf540)

Likely related people:

  • steipete: Explicitly mentioned on the PR timeline for a broad core configuration and plugin-contract proposal; no local feature-history attribution could be completed in this read-only environment. (role: likely product-decision owner; confidence: low; files: src/plugins/slot-resolution.ts, src/plugins/memory-state.ts)
  • vincentkoc: Explicitly mentioned when the PR opened and relevant to routing a cross-cutting plugin/runtime proposal; repository-history ownership was not established here. (role: adjacent architecture contact; confidence: low; files: src/plugins/loader-runtime-load.ts, src/plugins/hooks.ts)
  • pradeep7127: Explicitly mentioned when the PR opened and may help route the gateway/plugin integration portion; repository-history ownership was not established here. (role: adjacent architecture contact; confidence: low; files: src/plugins/gateway-startup-plugin-ids.ts, src/plugins/loader-cli-registry.ts)
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.

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.
Review history (47 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-16T05:47:59.116Z sha c0c3054 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-17T00:05:47.103Z sha 2f29b06 :: needs real behavior proof before merge. :: [P2] Restore the memory rem-backfill reference
  • reviewed 2026-07-18T17:40:14.233Z sha 338792f :: needs real behavior proof before merge. :: [P1] Move legacy memory selection out of runtime
  • reviewed 2026-07-18T18:02:51.779Z sha f2eaee7 :: needs real behavior proof before merge. :: [P1] Move legacy memory selection out of runtime
  • reviewed 2026-07-18T19:30:31.512Z sha b84ffe5 :: needs real behavior proof before merge. :: [P1] Move legacy memory selection out of runtime
  • reviewed 2026-07-18T20:14:40.331Z sha 5eb73f6 :: needs real behavior proof before merge. :: [P1] Remove legacy memory selection from runtime resolution
  • reviewed 2026-07-18T20:58:04.511Z sha 5dde4f3 :: needs real behavior proof before merge. :: [P1] Remove the legacy gateway memory-slot fallback
  • reviewed 2026-07-18T22:30:01.029Z sha ec0d173 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 31, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 31, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 31, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 31, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 31, 2026
@clawsweeper

clawsweeper Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@icophy

icophy commented Jun 4, 2026

Copy link
Copy Markdown

@kklouzal This is a really clear and complete explanation — thank you for taking the time to write it out.

The boundary you drew makes a lot of sense: the PR delivers the role-slot foundation (which plugin owns the dreaming role), while the actual dreaming lifecycle/context contract is left to the plugin. That is the right decomposition: you cannot define a good dreaming API until you have a stable way to select which component runs it.

Your note about running per-agent crons instead of relying on managed dreaming resonates directly with my setup. I run a dedicated "Dream Cycle" cron job that fires at 2 AM: it scans recent episodic memory, consolidates high-value entries into a core memory layer, and writes a structured nightly report. It works well in isolation, but it runs as a separate cron sub-agent with no hooks into the session lifecycle — so any per-session context (recent tool calls, decision rationale, partial work) that has not been explicitly written to a file is simply not available to it.

What I had been hoping memory.dreaming could eventually enable is some form of session-end or compaction-event trigger: not necessarily inline like recall, but a way to say "when this session closes, or when the context approaches compaction, hand a summary to the dreaming slot for consolidation." The cron path works, but it is time-based rather than event-based, so it always feels slightly asynchronous with respect to actual session rhythm.

Given your description of the PR scope, that would be a follow-on: richer dreaming lifecycle semantics (event triggers, context provenance). But you are right that the role-slot foundation needs to exist first before any of that is worth specifying.

The "jack of all trades" framing is apt. A dreaming-focused plugin that does not also have to implement recall lookups and mid-session capture will be significantly simpler to reason about and test in isolation.

Context: Running OpenClaw with a layered episodic/core memory architecture, using scheduled Dream Cycle consolidation as an external cron sub-agent.

@xuwei-xy

Copy link
Copy Markdown

A potential solution is to modify api. What do you think?

@kklouzal

Copy link
Copy Markdown
Contributor Author

Have been running this for multiple weeks with multiple agents - zero issues across multiple rebases to newer openclaw versions. Will continue keeping it merge-ready as time permits.. If any maintainer can give direction here I can pivot shape or whatever needs to be done.

@kklouzal

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@kklouzal

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@kklouzal

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review keep this open clawsweeper:human-review

@clawsweeper

clawsweeper Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper

clawsweeper Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(memory): add multi-slot memory role architecture This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@clawsweeper

clawsweeper Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: feat(memory): add multi-slot memory role architecture This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

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: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: qa-lab feature: ✨ showcase ClawSweeper spotlight: unusually compelling feature idea for maintainer attention. gateway Gateway runtime 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. P2 Normal backlog priority with limited blast radius. plugin: migrate-hermes proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-Slot Memory Architecture

4 participants