Skip to content

refactor(memory): deduplicate promotion and CLI flows - #115706

Merged
steipete merged 1 commit into
mainfrom
refactor/loc-memory-promotion-cli
Jul 29, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/loc-memory-promotion-cli

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The recently expanded memory-core implementation repeated the same command setup and short-term store lifecycle across multiple CLI and promotion paths. That duplication made agent selection, secret diagnostics, manager cleanup, phase-signal pruning, and recall-store write ordering easier to drift independently.

Why This Change Was Made

This AI-assisted refactor adds one existing-module withMemoryCommand seam for config/secret resolution, single-or-all-agent selection, manager lifecycle, and host leases; one phase-signal updater parameterized by the phase mutation; and one recall-store updater that preserves the existing post-write event ordering. The recall and grounded-candidate provenance calculations and their different event shapes remain separate and explicit.

User Impact

No user-visible behavior changes. Memory CLI commands retain their output and diagnostic routing, and dreaming promotion signals retain the same lock, pruning, persistence, provenance, and event semantics.

Evidence

  • Numstat: production +512/-554 (net -42); tests +0/-0. The current-main duplication was smaller than the older lane snapshot, so this does not claim the original -150..-190 estimate.
  • OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/memory-core/src/cli.test.ts — 75 tests passed.
  • OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs extensions/memory-core/src/short-term-promotion.test.ts extensions/memory-core/src/short-term-promotion-metadata.test.ts — 86 tests passed.
  • Post-rebase combined proof — 3 files, 161 tests passed.
  • node scripts/check-changed.mjs -- <six changed files> — passed on Blacksmith Testbox (run 30429174678), including format, Knip, extension prod/test typecheck, lint, database-first storage, and import cycles.
  • A broad initial extensions/memory-core run passed 1,228/1,234 tests. Four REM CLI failures exposed a missing agentId destructure and were fixed; the remaining untouched manager blank-query failure and legacy-cleanup timeout reproduced together in isolation and are outside this diff.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --engine codex --model gpt-5.6-sol --thinking high — clean, no accepted/actionable findings.
  • Shared CLI ownership is at extensions/memory-core/src/cli-runtime-common.ts:148; phase mutation is at extensions/memory-core/src/short-term-promotion-stats.ts:230; recall store ordering is at extensions/memory-core/src/short-term-promotion-record.ts:136.
  • Final self-review re-read every semantic hunk against all eight CLI callers, the store/lock owners, divergent event/provenance branches, and focused tests. It corrected index diagnostic routing and removed five obsolete exports; no other actionable issue remained.

@steipete
steipete marked this pull request as ready for review July 29, 2026 06:52
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core size: XL maintainer Maintainer-authored PR labels Jul 29, 2026
@steipete
steipete force-pushed the refactor/loc-memory-promotion-cli branch from 2af55e0 to a4864e6 Compare July 29, 2026 06:59
@steipete
steipete merged commit dd459ac into main Jul 29, 2026
87 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant