feat(memory): add grounded REM backfill lane (#63273)

Merged via squash.

Prepared head SHA: 4450f25485
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
Mariano
2026-04-08 20:23:28 +02:00
committed by GitHub
parent 9e4f478f86
commit dbf5960bd9
10 changed files with 1842 additions and 94 deletions

View File

@@ -8,6 +8,7 @@ import type {
MemoryCommandOptions,
MemoryPromoteCommandOptions,
MemoryPromoteExplainOptions,
MemoryRemBackfillOptions,
MemoryRemHarnessOptions,
MemorySearchCommandOptions,
} from "./cli.types.js";
@@ -59,6 +60,11 @@ async function runMemoryRemHarness(opts: MemoryRemHarnessOptions) {
await runtime.runMemoryRemHarness(opts);
}
async function runMemoryRemBackfill(opts: MemoryRemBackfillOptions) {
const runtime = await loadMemoryCliRuntime();
await runtime.runMemoryRemBackfill(opts);
}
export function registerMemoryCli(program: Command) {
const memory = program
.command("memory")
@@ -95,6 +101,10 @@ export function registerMemoryCli(program: Command) {
"openclaw memory rem-harness --json",
"Preview REM reflections, candidate truths, and deep promotion output.",
],
[
"openclaw memory rem-backfill --path ./memory",
"Write grounded historical REM entries into DREAMS.md for UI review.",
],
["openclaw memory status --json", "Output machine-readable JSON (good for scripts)."],
])}\n\n${theme.muted("Docs:")} ${formatDocsLink("/cli/memory", "docs.openclaw.ai/cli/memory")}\n`,
);
@@ -177,9 +187,22 @@ export function registerMemoryCli(program: Command) {
.command("rem-harness")
.description("Preview REM reflections, candidate truths, and deep promotions without writing")
.option("--agent <id>", "Agent id (default: default agent)")
.option("--path <file-or-dir>", "Seed the harness from historical daily memory file(s)")
.option("--grounded", "Also render a grounded day-level REM preview")
.option("--include-promoted", "Include already promoted deep candidates", false)
.option("--json", "Print JSON")
.action(async (opts: MemoryRemHarnessOptions) => {
await runMemoryRemHarness(opts);
});
memory
.command("rem-backfill")
.description("Write grounded historical REM summaries into DREAMS.md for UI review")
.option("--agent <id>", "Agent id (default: default agent)")
.option("--path <file-or-dir>", "Historical daily memory file(s) or directory")
.option("--rollback", "Remove previously written grounded REM backfill entries", false)
.option("--json", "Print JSON")
.action(async (opts: MemoryRemBackfillOptions) => {
await runMemoryRemBackfill(opts);
});
}