Skip to content

refactor(memory-wiki): move compiled cache to plugin state - #110167

Merged
steipete merged 17 commits into
mainfrom
refactor/async-memory-prompt-preparation
Jul 18, 2026
Merged

steipete merged 17 commits into
mainfrom
refactor/async-memory-prompt-preparation

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Memory plugins could only contribute synchronous system-prompt text. Memory Wiki therefore persisted its compiled agent digest and claim index in legacy state files, then read those files during prompt assembly. That created a prompt-path filesystem dependency, stale-owner risk, and cache lifecycle behavior outside the plugin state owner.

Why This Change Was Made

This adds one narrow async memory prompt-preparation registration. The agent run validates stable owner and vault-instance identity, loads prepared state before prompt assembly, and hands an immutable snapshot to synchronous prompt builders. Recompilation atomically replaces the snapshot; owner removal deletes its state.

Memory Wiki now stores its rebuildable compiled snapshot as a plugin blob in shared SQLite. Compile publishes one atomic replacement, prompt preparation and queries load the same snapshot, inactive owners are removed at plugin start, and stale legacy files are cleanup-only doctor debt. There is no file migration, polling, watcher, process decoded cache, or prompt-path filesystem I/O.

Context-engine assembly executes inside the same prepared-memory scope, including sandbox context, so custom engines preserve the async supplements without changing the synchronous context-engine contract.

AI-assisted implementation. Maintainer-requested architecture and migration.

User Impact

Memory Wiki prompts and queries use one lifecycle-owned compiled snapshot. Restarts reload the SQLite blob, recompiles replace it atomically, removed vault owners lose their cached state, and old cache files are safely deleted by doctor instead of being read or migrated.

Evidence

  • node scripts/run-vitest.mjs extensions/memory-wiki/src/compiled-cache.integration.test.ts extensions/memory-wiki/src/prompt-section.test.ts extensions/memory-wiki/src/compile.test.ts extensions/memory-wiki/index.test.ts extensions/memory-wiki/src/vault.test.ts extensions/memory-wiki/doctor-contract-api.test.ts extensions/memory-wiki/src/bridge.test.ts test/scripts/check-database-first-legacy-stores.test.ts — 550 tests passed.
  • node scripts/run-vitest.mjs src/plugins/memory-state.test.ts src/context-engine/context-engine.test.ts extensions/memory-wiki/index.test.ts extensions/memory-wiki/src/compiled-cache.integration.test.ts — 81 tests passed.
  • node scripts/run-vitest.mjs src/agents/harness/context-engine-lifecycle.test.ts src/agents/embedded-agent-runner/run/attempt-stream-runtime-prepare.test.ts extensions/memory-wiki/index.test.ts extensions/memory-wiki/src/compiled-cache.integration.test.ts — 31 tests passed.
  • Exact-head Blacksmith Testbox: pnpm check:changed passed all API, SDK surface, typecheck, lint, database-first, cycle, sidecar, and security lanes.
  • Exact-head Blacksmith Testbox: pnpm test extensions/memory-wiki passed 37 files / 321 tests.
  • Exact-head Blacksmith Testbox: pnpm build passed.
  • Fresh autoreview: no accepted or actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts agents Agent runtime and tooling extensions: memory-wiki extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 17, 2026

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

Copy link
Copy Markdown
Contributor

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: 13f55faa60

ℹ️ 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 +181 to +182
export function createWikiPromptSectionBuilder(): MemoryPromptSectionBuilder {
return ({ availableTools }) => buildWikiToolGuidance(availableTools);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Preserve compiled wiki digest in CLI prompts

When context.includeCompiledDigestPrompt is enabled, moving the digest out of this synchronous builder means prompts built through synchronous production callers no longer get the compiled wiki snapshot. src/agents/cli-runner/prepare.ts:1070 still calls buildCliAgentSystemPrompt()/buildConfiguredAgentSystemPrompt() without a preparedMemoryPrompt, so CLI-backed agent runs now receive only the wiki tool guidance from this builder, whereas the previous builder synchronously read agent-digest.json and appended the snapshot. Please add an async preparation handoff for the CLI prompt path (and similar synchronous prompt-inspection callers) before removing the digest from the builder.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 10:00 PM ET / July 18, 2026, 02:00 UTC.

Summary
The PR replaces Memory Wiki vault cache files with plugin-owned SQLite blob state and adds asynchronous memory-prompt preparation through the plugin SDK and agent/context-engine runtimes.

PR surface: Source +1128, Tests +996, Docs +28, Generated 0, Other 0. Total +2152 across 56 files.

Reproducibility: yes. source-reproducible: enable the compiled digest prompt for a large vault and trace the preparer’s loadMemoryWikiCompiledCache() call, which loads the combined digest-and-claims snapshot before prompt assembly. A live large-vault measurement was not supplied or independently run.

Review metrics: 2 noteworthy metrics.

  • Public memory SDK surface: 1 new registration API. The new async preparation registration changes the plugin lifecycle contract shared by bundled and external plugins.
  • Persisted cache model: 2 legacy cache files removed; 1 SQLite blob snapshot added. The migration changes cache ownership, restart behavior, and prompt/query data loading paths.

Stored data model
Persistent data-model change detected: database schema: docs/refactor/database-first.md, migration/backfill/repair: docs/refactor/database-first.md, migration/backfill/repair: extensions/memory-wiki/doctor-contract-api.test.ts, persistent cache schema: docs/cli/wiki.md, persistent cache schema: docs/refactor/database-first.md, persistent cache schema: extensions/memory-wiki/README.md, and 55 more. Confirm migration or upgrade compatibility proof before merge.

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

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

Rank-up moves:

  • [P1] Split digest-only prompt reads from full claims-query reads and add focused regression coverage.
  • [P1] Add redacted real-run evidence showing compile, restart reload, prompt projection, and inactive-owner cleanup.
  • Obtain maintainer confirmation that the new public plugin-SDK lifecycle registration is the intended permanent contract.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body reports tests, checks, and a build, but no inspectable after-fix real run demonstrates compile, restart reload, prompt projection, and owner cleanup; add redacted terminal output, runtime logs, or a recording and update the PR body for re-review.

Risk before merge

  • [P1] Merging a public registerMemoryPromptPreparation SDK contract creates a compatibility-sensitive lifecycle API without independently verified maintainer acceptance or upgrade evidence.
  • [P1] Prompt assembly may now decompress and parse the complete claims query cache on every eligible prompt, producing avoidable latency and memory pressure for large Memory Wiki vaults.
  • [P1] Replacing rebuildable vault caches with SQLite state changes restart, rollback, owner cleanup, and external-compile behavior; the PR body does not provide inspectable real-runtime proof for those paths.

Maintainer options:

  1. Split prompt and query cache payloads (recommended)
    Store or retrieve a digest-only payload for prompt preparation, with the full claims payload loaded only by query paths; then add a focused large-cache regression test.
  2. Accept the combined payload deliberately
    Maintainers may accept the performance tradeoff only with documented cache-size bounds and real-runtime evidence that large vault prompt latency remains acceptable.
  3. Pause the public API expansion
    Hold the PR if maintainers do not want to commit to the new plugin-SDK lifecycle contract yet.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Split the Memory Wiki compiled cache into digest-only prompt reads and claims-query reads; add focused regression coverage proving prompt preparation does not deserialize claims.

Next step before merge

  • [P1] The digest-only repair is mechanical, but accepting the new public plugin-SDK lifecycle contract requires maintainer direction and the PR carries a protected maintainer label.

Maintainer decision needed

  • Question: Should the new public async memory-prompt preparation API be accepted as a general plugin-SDK contract, or should this refactor stay behind a Memory Wiki-specific/internal seam until broader plugin use cases are established?
  • Rationale: The PR adds a new exported plugin API and changes prompt lifecycle semantics across embedded, Codex, CLI, and context-engine paths; source-level correctness alone cannot select the permanent public contract.
  • Likely owner: steipete — The supplied history shows steipete carrying the proposed cross-cutting API and Memory Wiki lifecycle design; confidence remains limited without an independent current-main provenance pass.
  • Options:
    • Accept the SDK contract with safeguards (recommended): Approve the public registration after digest-only loading and documented lifecycle/compatibility proof are added.
    • Keep it owner-scoped for now: Rework the change so Memory Wiki owns the asynchronous loading seam without publishing a general plugin-SDK registration yet.

Security
Cleared: The reviewed diff adds no dependency source, workflow permission, secret-handling, package-resolution, or external-code-execution change with a concrete security or supply-chain regression.

Review findings

  • [P2] Split the digest from the claims payload before prompt preparation — extensions/memory-wiki/src/prompt-section.ts:1-8
Review details

Best possible solution:

Split Memory Wiki’s prompt digest into a digest-only persisted/read path, retain the full claims payload for query operations, and add redacted real-run evidence covering compile, gateway restart, prompt output, and owner removal before merge.

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

Yes, source-reproducible: enable the compiled digest prompt for a large vault and trace the preparer’s loadMemoryWikiCompiledCache() call, which loads the combined digest-and-claims snapshot before prompt assembly. A live large-vault measurement was not supplied or independently run.

Is this the best way to solve the issue?

No: moving rebuildable state to plugin-owned SQLite is directionally sound, but using one combined cache payload for both prompt and query paths is not the narrowest solution because prompt construction requires only the compact digest.

Full review comments:

  • [P2] Split the digest from the claims payload before prompt preparation — extensions/memory-wiki/src/prompt-section.ts:1-8
    createWikiPromptSectionPreparer needs only the compact digest, but this path loads the combined compiled snapshot that includes every query claim. Large vaults therefore decompress and parse the full claims cache on each prompt preparation; add a digest-only blob/read path and preserve the full payload for query operations.
    Confidence: 0.88

Overall correctness: patch is incorrect
Overall confidence: 0.78

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: The PR changes shared agent prompt construction and a persisted Memory Wiki cache used during normal agent runs.
  • merge-risk: 🚨 compatibility: A new public plugin-SDK registration and changed cache persistence behavior can affect plugin implementations and existing Memory Wiki upgrades.
  • merge-risk: 🚨 session-state: Prepared prompt snapshots are run-scoped and depend on durable cache owner and vault-generation identity across restarts and cleanup.
  • 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 real behavior proof before merge: The PR body reports tests, checks, and a build, but no inspectable after-fix real run demonstrates compile, restart reload, prompt projection, and owner cleanup; add redacted terminal output, runtime logs, or a recording and update the PR body for re-review.
Evidence reviewed

PR surface:

Source +1128, Tests +996, Docs +28, Generated 0, Other 0. Total +2152 across 56 files.

View PR surface stats
Area Files Added Removed Net
Source 31 1559 431 +1128
Tests 15 1247 251 +996
Docs 7 48 20 +28
Config 0 0 0 0
Generated 1 11 11 0
Other 2 5 5 0
Total 56 2870 718 +2152

What I checked:

  • Prompt preparation reads the full snapshot: The proposed prompt preparer imports and calls loadMemoryWikiCompiledCache, while the compiled cache snapshot contains both the digest and the full claims array; this preserves the earlier performance concern because prompt rendering needs only the digest. (extensions/memory-wiki/src/prompt-section.ts:1, e289b0a8809e)
  • Single compressed cache payload: The new compiled-cache module represents the cache as one compressed plugin blob carrying the digest and query claims, so prompt preparation must decompress and parse query data that it does not use. (extensions/memory-wiki/src/compiled-cache.ts:1, e289b0a8809e)
  • Prior review blocker remains relevant: The previous completed review identified the same concern: prompt preparation needs only the digest but loadMemoryWikiCompiledCache() reads the combined cache. The current supplied diff still shows the prompt preparer calling that API. (extensions/memory-wiki/src/prompt-section.ts:1, e289b0a8809e)
  • Proof is test-only: The PR body reports focused Vitest runs, changed checks, an extension suite, and a build, but contains no linked recording, terminal output, runtime log, or artifact demonstrating the changed behavior in a real setup. (e289b0a8809e)
  • Protected maintainer handling: The PR has the maintainer label, so conservative cleanup must not auto-close it even though it is a large refactor. (e289b0a8809e)

Likely related people:

  • steipete: The supplied commit history shows this person authored the 17-commit Memory Wiki cache and shared memory-prompt lifecycle refactor; no independent current-main ownership trail could be verified in the read-only environment. (role: recent area contributor; confidence: low; commits: bfe58c394e1f, 7789e3a91fc9, e289b0a8809e; files: extensions/memory-wiki/src/compiled-cache.ts, src/plugins/memory-state.ts, src/agents/memory-prompt-prepare.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 (5 earlier review cycles)
  • reviewed 2026-07-17T20:58:05.807Z sha 13f55faa60bb9e0f3f36b2017da8a8ad81300430 :: needs real behavior proof before merge. :: [P2] Prepare the compiled digest for CLI prompt construction
  • reviewed 2026-07-17T21:31:33.092Z sha 4c9101a :: needs real behavior proof before merge. :: [P1] Prepare compiled Memory Wiki state for CLI prompt builds | [P1] Pass the resolved agent into context-engine preparation | [P2] Avoid decoding the full claims index for prompt-only preparation | [P1] Resolve durable cache owners when a vault appears after startup
  • reviewed 2026-07-17T22:13:18.399Z sha 4c9101a :: needs real behavior proof before merge. :: [P2] Avoid decoding the full claims index for prompt preparation
  • reviewed 2026-07-18T01:42:28.815Z sha 345946a :: needs real behavior proof before merge. :: [P2] Avoid decoding the full claims index for prompt preparation
  • reviewed 2026-07-18T01:52:07.128Z sha a39199df0ac00aedbffba6b830623f9dc1b04a29 :: needs real behavior proof before merge. :: [P2] Avoid loading the full claims cache for prompt preparation

@steipete
steipete force-pushed the refactor/async-memory-prompt-preparation branch 2 times, most recently from 6c27397 to 6a1348c Compare July 17, 2026 21:08

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

Copy link
Copy Markdown
Contributor

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: 6a1348ca05

ℹ️ 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".

{
availableTools: new Set(params.availableTools),
citationsMode: params.citationsMode,
agentId: resolveAgentIdFromSessionKey(params.sessionKey),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Pass the resolved agent into memory preparation

When a non-legacy context engine runs for an agent whose session key is unscoped or legacy (for example the global queue used by global-scope agent runs), deriving the owner from params.sessionKey resolves to main, so agent-scoped memory-wiki preparation will load the wrong vault or throw Unknown memory-wiki agentId: main. The embedded caller already has the resolved sessionAgentId, so this helper should accept/use that value rather than reparsing the session key for the prepared memory context.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the refactor/async-memory-prompt-preparation branch from 8654cc9 to 99093c3 Compare July 17, 2026 21:18
@clawsweeper clawsweeper Bot removed the rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. label Jul 17, 2026

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

Copy link
Copy Markdown
Contributor

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: 99093c338c

ℹ️ 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".

return [];
}
return [...toolGuidance, ...digestLines];
const snapshot = await loadMemoryWikiCompiledCache(config);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Avoid parsing the full claims cache for prompt digests

When includeCompiledDigestPrompt is enabled, this prompt preparer only needs snapshot.digest, but loadMemoryWikiCompiledCache() reads the single compiled-cache blob that also contains the full claims array and synchronously gunzips/JSON-parses it. For large wiki vaults, every prompt preparation now pays to parse the entire query cache even though the prompt renders only the top digest pages; previously this path read just the small agent-digest.json. Please split the digest into a digest-only blob/read path or otherwise avoid loading all claims during prompt assembly.

Useful? React with 👍 / 👎.

Comment on lines +168 to +170
const active = resolveActiveVault(config);
if (!active) {
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Activate cache owners from durable metadata on read

If a running gateway starts before the configured vault exists, the startup service skips activating that owner; a later documented openclaw wiki compile in another process can create the vault and write the shared SQLite compiled cache, but this read path still returns null because activeVaults was never populated in this process. That leaves the compiled prompt digest unavailable until a gateway restart or some same-process wiki operation initializes the vault, so the read path should be able to validate the stored metadata against the current vault generation instead of requiring prior process-local activation.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jul 17, 2026
@steipete
steipete force-pushed the refactor/async-memory-prompt-preparation branch from 4c9101a to 345946a Compare July 18, 2026 01:39
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 18, 2026
@steipete
steipete force-pushed the refactor/async-memory-prompt-preparation branch from a39199d to e289b0a Compare July 18, 2026 01:57
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 18, 2026
@steipete
steipete merged commit d8f2645 into main Jul 18, 2026
125 of 127 checks passed
@steipete
steipete deleted the refactor/async-memory-prompt-preparation branch July 18, 2026 02:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Copy link
Copy Markdown
Contributor

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: e289b0a880

ℹ️ 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 +360 to +361
if (isMetadata(metadata) && ownerIds.has(metadata.ownerId)) {
continue;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Delete stale cache rows when vault identity changes

When an existing owner keeps the same owner id but changes or recreates its vault path/generation, the startup cleanup in extensions/memory-wiki/index.ts passes only owner ids, and this branch preserves every blob for that owner. The read path rejects those old rows via vaultPath/vaultGeneration, but they are never deleted, so stale compiled snapshots from a no-longer-configured vault remain in shared SQLite and continue counting against the blob namespace. Please key cleanup on the active owner identity plus vault path/generation/publication, or delete rows for the owner before activating the replacement vault.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 18, 2026
…110167)

* feat(plugin-sdk): prepare memory prompts asynchronously

* refactor(memory-wiki): move compiled cache to plugin state

* fix(plugin-sdk): export memory prompt preparer type

* refactor(plugin-sdk): keep prompt preparer type private

* test(memory-wiki): isolate compiled cache state

* chore(memory-wiki): satisfy changed gates

* fix(memory): preserve prepared prompts across context engines

* docs(plugin-sdk): refresh API baseline

* fix(memory): revalidate prepared prompt ownership

* fix(codex): propagate sandboxed memory context

* test(memory-wiki): seed durable vault identity

* refactor(memory-wiki): keep cache lifecycle internal

* fix(memory-wiki): harden compiled cache publication

* style(memory-wiki): format cache lifecycle changes

* test(memory-wiki): support extension test lib target

* style(memory-wiki): remove redundant catch

* refactor(memory-wiki): keep vault generation helper private
steipete added a commit that referenced this pull request Oct 15, 2026
Share Google SSE startup, OpenAI voice configuration preparation and MiniMax
request credentials. Reuse the SDK FIFO permit pool for Session Share and
return Logbook's committed standup receipt instead of rereading its write.
Remove repeated ONNX validation after the existing schema boundary and unused
response/header copies. Preserve public surfaces, auth, resource bounds,
snapshot limits, user-data durability and shutdown settlement. Phase E stays
untouched. Simplify ordinary Memory Core sync-error bookkeeping and remove
late-probe cache fencing and synthetic multi-process LanceDB startup retries.
Remove redundant Bonjour sentinel/cleanup/listener defenses while retaining
network-error handling and stop settlement.
Net production reduction: 217 lines;
test reduction: 204 lines.

Best-effort tradeoffs accepted:
- Active Memory's synthetic maximum-Date clock no longer bypasses caching;
  d649548 introduced the forced-clock fixture, not a human-use report.
- Voice Call's synthetic maximum-Date clock uses numeric expiry and always
  admits the cache entry before native Promise rejection cleanup;
  55d4456 introduced the forced-clock fixture, not a human-use report.
- Future mutation of an internal webhook response is not isolated by copies;
  #118754 records synthetic HTTP proof, and no current consumer mutates it.
- A publication racing compiled-cache reconciliation is picked up on the next
  lifecycle refresh; #110167 pins a synthetic lookup interleaving, not an incident.
- A later parallel standup may overwrite the stored day, while each caller gets
  its own committed receipt; #99930/#144982 add the self-reread without an incident.
- Deliberate mutation of Fal's internal image array during credential lookup may
  reach provider validation; migration 0f54ca2 already had a guarded caller.
- Future mutation of Comfy's internal GET headers is not isolated by extra copies;
  #167205 retained these copies, but the current consumers are read-only.
- An embedding probe finishing during adapter replacement can cache old
  availability for the existing 30-second TTL or until invalidation; #144252
  and related #135599/#141280 describe architecture/synthetic lifecycle proof,
  not a human incident. Provider authority and shutdown drainage stay intact.
- A competing LanceDB initializer exposing a table before its first readable
  version may fail startup and need the next invocation/restart. #105896's
  retry proof coordinates six processes; #105680 describes source inference,
  and its review explicitly notes that no actual failure log was supplied.
  Atomic existOk creation, schema/agent checks and user-data durability stay.
- Internal handled-sync failure calls no longer re-check a tracked-active flag;
  #133239 introduced the bookkeeping, but every production caller is already
  inside tracked sync. A future untracked internal caller records its advisory
  failure directly. Deferred work and real overlapping failure identity stay.
- Nonfinite ONNX logits still fail at the TypeBox IPC schema boundary; #153476
  redundantly scanned the same validated vector a second time. No malformed
  network/worker input is newly admitted.
- Bonjour's fixed-path existsSync no longer catches impossible filesystem
  exceptions; direct 989cfd1 cites no incident and Node already returns false.
  A throwing monkey-patch now fails startup visibly.
- Bonjour cleanup no longer repeats stopPromise's once-only bookkeeping;
  ddc2036 added the flag for smoke stabilization without a user incident.
  Failed startup cannot expose a stop handle; SDK unsubscribe is idempotent.
- Bonjour's fixed EventEmitter listeners no longer swallow attachment errors;
  direct 7389fc0 cites no incident, and pinned Ciao inherits ordinary on().
  A future dependency-contract violation follows existing startup cleanup.

Proof: targeted production/test types, syntax lint, formatting, zero runtime
and Madge cycles, SDK source boundaries, lint-suppressions and focused plugin
owner/sibling suites. Fresh independent review's sole ONNX finding is disproved
by actual parseWorkerReply rejecting NaN and both infinities, as the installed
TypeBox validator calls Number.isFinite. No accepted finding remains.

One kept Memory Core generation-lease case hits its unchanged five-second
embedding-start deadline on both candidate and unchanged task base 9e3e16c.
It bypasses changed outcome/probe bookkeeping. It is not claimed passing or
fixed. Typed-lint declaration preparation and full Active Memory suite startup
also exceeded unchanged deadlines. Broad build/check-changed and PR CI unrun.
Below-500 branch-only packet for bundling; Phase E remains untouched.
steipete added a commit that referenced this pull request Oct 15, 2026
* refactor(plugins): consolidate provider and feature paths

Share Google SSE startup, OpenAI voice configuration preparation and MiniMax
request credentials. Reuse the SDK FIFO permit pool for Session Share and
return Logbook's committed standup receipt instead of rereading its write.
Remove repeated ONNX validation after the existing schema boundary and unused
response/header copies. Preserve public surfaces, auth, resource bounds,
snapshot limits, user-data durability and shutdown settlement. Phase E stays
untouched. Simplify ordinary Memory Core sync-error bookkeeping and remove
late-probe cache fencing and synthetic multi-process LanceDB startup retries.
Remove redundant Bonjour sentinel/cleanup/listener defenses while retaining
network-error handling and stop settlement.
Net production reduction: 217 lines;
test reduction: 204 lines.

Best-effort tradeoffs accepted:
- Active Memory's synthetic maximum-Date clock no longer bypasses caching;
  d649548 introduced the forced-clock fixture, not a human-use report.
- Voice Call's synthetic maximum-Date clock uses numeric expiry and always
  admits the cache entry before native Promise rejection cleanup;
  55d4456 introduced the forced-clock fixture, not a human-use report.
- Future mutation of an internal webhook response is not isolated by copies;
  #118754 records synthetic HTTP proof, and no current consumer mutates it.
- A publication racing compiled-cache reconciliation is picked up on the next
  lifecycle refresh; #110167 pins a synthetic lookup interleaving, not an incident.
- A later parallel standup may overwrite the stored day, while each caller gets
  its own committed receipt; #99930/#144982 add the self-reread without an incident.
- Deliberate mutation of Fal's internal image array during credential lookup may
  reach provider validation; migration 0f54ca2 already had a guarded caller.
- Future mutation of Comfy's internal GET headers is not isolated by extra copies;
  #167205 retained these copies, but the current consumers are read-only.
- An embedding probe finishing during adapter replacement can cache old
  availability for the existing 30-second TTL or until invalidation; #144252
  and related #135599/#141280 describe architecture/synthetic lifecycle proof,
  not a human incident. Provider authority and shutdown drainage stay intact.
- A competing LanceDB initializer exposing a table before its first readable
  version may fail startup and need the next invocation/restart. #105896's
  retry proof coordinates six processes; #105680 describes source inference,
  and its review explicitly notes that no actual failure log was supplied.
  Atomic existOk creation, schema/agent checks and user-data durability stay.
- Internal handled-sync failure calls no longer re-check a tracked-active flag;
  #133239 introduced the bookkeeping, but every production caller is already
  inside tracked sync. A future untracked internal caller records its advisory
  failure directly. Deferred work and real overlapping failure identity stay.
- Nonfinite ONNX logits still fail at the TypeBox IPC schema boundary; #153476
  redundantly scanned the same validated vector a second time. No malformed
  network/worker input is newly admitted.
- Bonjour's fixed-path existsSync no longer catches impossible filesystem
  exceptions; direct 989cfd1 cites no incident and Node already returns false.
  A throwing monkey-patch now fails startup visibly.
- Bonjour cleanup no longer repeats stopPromise's once-only bookkeeping;
  ddc2036 added the flag for smoke stabilization without a user incident.
  Failed startup cannot expose a stop handle; SDK unsubscribe is idempotent.
- Bonjour's fixed EventEmitter listeners no longer swallow attachment errors;
  direct 7389fc0 cites no incident, and pinned Ciao inherits ordinary on().
  A future dependency-contract violation follows existing startup cleanup.

Proof: targeted production/test types, syntax lint, formatting, zero runtime
and Madge cycles, SDK source boundaries, lint-suppressions and focused plugin
owner/sibling suites. Fresh independent review's sole ONNX finding is disproved
by actual parseWorkerReply rejecting NaN and both infinities, as the installed
TypeBox validator calls Number.isFinite. No accepted finding remains.

One kept Memory Core generation-lease case hits its unchanged five-second
embedding-start deadline on both candidate and unchanged task base 9e3e16c.
It bypasses changed outcome/probe bookkeeping. It is not claimed passing or
fixed. Typed-lint declaration preparation and full Active Memory suite startup
also exceeded unchanged deadlines. Broad build/check-changed and PR CI unrun.
Below-500 branch-only packet for bundling; Phase E remains untouched.

* refactor(plugins): consolidate remaining feature and provider owners

Replace ACPX trust scanning with the existing TOML parser, consolidate Logbook operation dispatch, reuse SDK FIFO playback admission, and prepare wiki claims once. Remove repeated internal validation and redundant copies while retaining external validation, live authority, resource bounds, durability and Phase E. Shrink only the assertion allowances eliminated by these removals. The complete branch removes 750 net production lines. Accepted timing and internal-mutation tradeoffs, provenance, review decisions and proof are recorded in the PR body and requested local ledger.

* test(plugins): align checks with simplified owners
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 16, 2026
…aw#173064)

* refactor(plugins): consolidate provider and feature paths

Share Google SSE startup, OpenAI voice configuration preparation and MiniMax
request credentials. Reuse the SDK FIFO permit pool for Session Share and
return Logbook's committed standup receipt instead of rereading its write.
Remove repeated ONNX validation after the existing schema boundary and unused
response/header copies. Preserve public surfaces, auth, resource bounds,
snapshot limits, user-data durability and shutdown settlement. Phase E stays
untouched. Simplify ordinary Memory Core sync-error bookkeeping and remove
late-probe cache fencing and synthetic multi-process LanceDB startup retries.
Remove redundant Bonjour sentinel/cleanup/listener defenses while retaining
network-error handling and stop settlement.
Net production reduction: 217 lines;
test reduction: 204 lines.

Best-effort tradeoffs accepted:
- Active Memory's synthetic maximum-Date clock no longer bypasses caching;
  1802f6b introduced the forced-clock fixture, not a human-use report.
- Voice Call's synthetic maximum-Date clock uses numeric expiry and always
  admits the cache entry before native Promise rejection cleanup;
  c7b888b introduced the forced-clock fixture, not a human-use report.
- Future mutation of an internal webhook response is not isolated by copies;
  openclaw#118754 records synthetic HTTP proof, and no current consumer mutates it.
- A publication racing compiled-cache reconciliation is picked up on the next
  lifecycle refresh; openclaw#110167 pins a synthetic lookup interleaving, not an incident.
- A later parallel standup may overwrite the stored day, while each caller gets
  its own committed receipt; openclaw#99930/openclaw#144982 add the self-reread without an incident.
- Deliberate mutation of Fal's internal image array during credential lookup may
  reach provider validation; migration d365cd8 already had a guarded caller.
- Future mutation of Comfy's internal GET headers is not isolated by extra copies;
  openclaw#167205 retained these copies, but the current consumers are read-only.
- An embedding probe finishing during adapter replacement can cache old
  availability for the existing 30-second TTL or until invalidation; openclaw#144252
  and related openclaw#135599/openclaw#141280 describe architecture/synthetic lifecycle proof,
  not a human incident. Provider authority and shutdown drainage stay intact.
- A competing LanceDB initializer exposing a table before its first readable
  version may fail startup and need the next invocation/restart. openclaw#105896's
  retry proof coordinates six processes; openclaw#105680 describes source inference,
  and its review explicitly notes that no actual failure log was supplied.
  Atomic existOk creation, schema/agent checks and user-data durability stay.
- Internal handled-sync failure calls no longer re-check a tracked-active flag;
  openclaw#133239 introduced the bookkeeping, but every production caller is already
  inside tracked sync. A future untracked internal caller records its advisory
  failure directly. Deferred work and real overlapping failure identity stay.
- Nonfinite ONNX logits still fail at the TypeBox IPC schema boundary; openclaw#153476
  redundantly scanned the same validated vector a second time. No malformed
  network/worker input is newly admitted.
- Bonjour's fixed-path existsSync no longer catches impossible filesystem
  exceptions; direct 1fa8665 cites no incident and Node already returns false.
  A throwing monkey-patch now fails startup visibly.
- Bonjour cleanup no longer repeats stopPromise's once-only bookkeeping;
  2ef6daa added the flag for smoke stabilization without a user incident.
  Failed startup cannot expose a stop handle; SDK unsubscribe is idempotent.
- Bonjour's fixed EventEmitter listeners no longer swallow attachment errors;
  direct 836f011 cites no incident, and pinned Ciao inherits ordinary on().
  A future dependency-contract violation follows existing startup cleanup.

Proof: targeted production/test types, syntax lint, formatting, zero runtime
and Madge cycles, SDK source boundaries, lint-suppressions and focused plugin
owner/sibling suites. Fresh independent review's sole ONNX finding is disproved
by actual parseWorkerReply rejecting NaN and both infinities, as the installed
TypeBox validator calls Number.isFinite. No accepted finding remains.

One kept Memory Core generation-lease case hits its unchanged five-second
embedding-start deadline on both candidate and unchanged task base d6898f3.
It bypasses changed outcome/probe bookkeeping. It is not claimed passing or
fixed. Typed-lint declaration preparation and full Active Memory suite startup
also exceeded unchanged deadlines. Broad build/check-changed and PR CI unrun.
Below-500 branch-only packet for bundling; Phase E remains untouched.

* refactor(plugins): consolidate remaining feature and provider owners

Replace ACPX trust scanning with the existing TOML parser, consolidate Logbook operation dispatch, reuse SDK FIFO playback admission, and prepare wiki claims once. Remove repeated internal validation and redundant copies while retaining external validation, live authority, resource bounds, durability and Phase E. Shrink only the assertion allowances eliminated by these removals. The complete branch removes 750 net production lines. Accepted timing and internal-mutation tradeoffs, provenance, review decisions and proof are recorded in the PR body and requested local ledger.

* test(plugins): align checks with simplified owners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex extensions: memory-wiki maintainer Maintainer-authored PR 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. P1 High-priority user-facing bug, regression, or broken workflow. 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.

1 participant