feat(memory): added memory_edit tool and stats/diagnose commands

- Added `memory_edit` tool for update, forget, and invalidate operations on Mnemosyne memories by id.
- Added `stats` and `diagnose` methods to `MemoryBackend` interface with Mnemosyne implementations.
- Exposed `/memory stats` and `/memory diagnose` slash commands in TUI and ACP modes.
- Refactored recall output to include memory ids via `formatScopedRecallWithIds`.
This commit is contained in:
can1357
2026-05-30 16:48:02 +02:00
parent 7ba28ada5b
commit 6b4accd05e
14 changed files with 489 additions and 13 deletions
@@ -620,12 +620,28 @@ export class CommandController {
return;
}
if (action === "stats" || action === "diagnose") {
const hook = action === "stats" ? backend.stats : backend.diagnose;
try {
const payload = await hook?.(agentDir, this.ctx.sessionManager.getCwd(), this.ctx.session);
if (!payload) {
this.ctx.showWarning(`Memory ${action} is not available for the ${backend.id} backend.`);
return;
}
showMarkdownPanel(this.ctx, `Memory ${action === "stats" ? "Stats" : "Diagnostics"}`, payload);
} catch (error) {
this.ctx.showError(`Memory ${action} failed: ${error instanceof Error ? error.message : String(error)}`);
}
return;
}
if (action === "mm") {
await this.#handleMentalModelsSubcommand(argumentText);
return;
}
this.ctx.showError("Usage: /memory <view|clear|reset|enqueue|rebuild|mm ...>");
this.ctx.showError("Usage: /memory <view|stats|diagnose|clear|reset|enqueue|rebuild|mm ...>");
}
async #handleMentalModelsSubcommand(argumentText: string): Promise<void> {