feat(memory): add dormant tracking and reinforcement mechanism

Wave 2c - Dormant workspace tracking:
- Add lastActivityAt to WorkspaceMemoryStore
- Implement calculateDormantDays with 14-day grace period
- Wire dormant days into retention-strength calculation

Wave 3 - Reinforcement:
- Add lastReinforcedSessionID to LongTermMemoryEntry
- Implement reinforceMemory with guards (same-session, 1hr interval, max 6)
- Set retentionClock on memory creation in extractors.ts and plugin.ts

Tests: 219 → 222, all pass
This commit is contained in:
Ralph Chang
2026-04-29 14:32:39 +08:00
parent 4097815f3e
commit ffb612226c
7 changed files with 151 additions and 16 deletions
+5
View File
@@ -772,6 +772,11 @@ test("session.compacted promotes pending memories to workspace memory and clears
const workspacePrompt = after.system.find((part: string) => part.startsWith("Workspace memory"));
assert.match(workspacePrompt ?? "", /Use frozen rendered snapshots for cache stability/);
const workspace = await loadWorkspaceMemory(tmpDir);
const promoted = workspace.entries.find(entry => entry.id === "mem_pending_1");
assert.ok(typeof promoted?.retentionClock === "number",
"legacy pending memory should receive a retention clock when promoted");
} finally {
await rm(tmpDir, { recursive: true, force: true });
}