Repository navigation
refactor(memory-core): split CLI runtime - #114013
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 26, 2026, 12:33 AM ET / 04:33 UTC. ClawSweeper reviewWhat this changesThis PR decomposes Memory Core’s lazy CLI implementation into separate status, index/search, REM, and shared-support modules while keeping the existing lazy CLI entry boundary. Merge readinessKeep this PR open for maintainer review. It is a scoped internal refactor with no concrete patch defect identified from the supplied diff and validation evidence, but the protected Priority: P3 Review scores
Verification
How this fits togetherMemory Core’s CLI accepts operator commands for status, indexing, search, promotion, and REM workflows. The lazy runtime loads command handlers, resolves configuration and secrets, acquires the memory manager, and emits command output or diagnostics. flowchart LR
A[Memory CLI commands] --> B[Lazy CLI entry]
B --> C[Runtime barrel]
C --> D[Status and repair handlers]
C --> E[Index search and promotion]
C --> F[REM handlers]
D --> G[Memory manager]
E --> G
F --> G
G --> H[CLI output and JSON diagnostics]
Decision needed
Why: The patch intentionally chooses ownership boundaries for a large internal runtime; tests support the refactor, but the protected maintainer label reserves acceptance of that structural direction for a human owner. Before merge
Agent review detailsSecurityNone. PR surfaceSource -4, Tests 0, Other -1. Total -5 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Land the focused refactor only after maintainer review confirms the barrel exports preserve the lazy CLI contract and the exact head completes its required checks; retain the focused command coverage as the regression guard. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR refactors an existing CLI implementation rather than fixing a reported failing user workflow. The review question is contract preservation across existing commands. Is this the best way to solve the issue? Yes, conditionally: keeping the existing lazy entry and using a small delegating barrel is a maintainable way to divide the oversized runtime, provided the owner approves these module boundaries and command contracts remain unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc3476b116b9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
13ea9b2 to
b517ce0
Compare
|
Land-ready proof for head
Known gaps: none for this behavior-neutral refactor. No config, API, persistence format, or schema changes are present. |
|
Merged via squash.
|
* refactor(memory-core): split CLI runtime * refactor(memory-core): narrow CLI helper exports * test(memory-core): follow secret resolver split
What Problem This Solves
The memory-core CLI runtime combined status diagnostics, source scanning, indexing, search, promotion, REM preview, and REM backfill in one 2,053-line lazy runtime module with a grandfathered max-lines suppression.
Why This Change Was Made
This maintainer-requested refactor keeps the existing
cli.ts -> import("./cli.runtime.js")lazy boundary unchanged. The runtime barrel now delegates to focused status, index/search/promotion, REM, and shared-support modules; every production module is below 700 lines, the max-lines suppression and baseline entry are removed, and total source LOC decreases by five.Accepted tradeoff: index/search and promotion remain together because they share the manager lifecycle and output primitives; splitting them again would add module contracts without reducing ownership complexity. The index progress formatter was folded to one duration helper while retaining the same elapsed and ETA output.
User Impact
No user-visible behavior changes. Memory status, indexing, search, promotion, REM preview/backfill, JSON output, diagnostics, and the lazy loading contract remain unchanged.
AI-assisted refactor, reviewed and understood by the maintainer agent.
Evidence
node scripts/run-vitest.mjs extensions/memory-core/src/cli.test.ts extensions/memory-core/cli-metadata.test.ts— 2 files, 76 tests passed.tbx_01kye9f2drdadmvb8210xf4aq8:pnpm check:changed && pnpm buildpassed, including extension production/test types, lint, max-lines ratchet, plugin boundaries, import-cycle checks, and the built lazy runtime graph. Actions run: https://github.com/openclaw/openclaw/actions/runs/30187161169--mode uncommitted— clean, no accepted/actionable findings. The older global helper crashed in its JavaScript sanitizer before engine invocation; the current repository helper completed with the same Codex engine and bundle contract.git diff --check— passed.