Menu
popagent
publicLatest change 324ce6d82a1e3e0f842da61c5c6109199a026104 - Control internal agent memory lifecycle by Ólafur Búi Ólafsson
import { beforeAll, describe, expect, test } from "bun:test";
import { MemorySettingsStore } from "./memory-settings";
const store = new MemorySettingsStore();
beforeAll(() => store.init());
describe("MemorySettingsStore", () => {
test("persists conversation compaction settings", async () => {
const original = await store.get();
const input = {
autoCompact: !original.autoCompact,
observationTokens: 24_000,
reflectionTokens: 48_000,
recentMessagePercent: 25,
asyncBuffering: false,
bufferIntervalPercent: 25,
bufferOnIdle: false,
observationBlockPercent: 130,
reflectionBufferPercent: 60,
reflectionBlockPercent: 140,
optimizeObserverContext: true,
previousObserverTokens: 3_000,
retrievalEnabled: true,
retrievalScope: "thread" as const,
temporalMarkers: true,
activateAfterIdle: "5m" as const,
activateOnProviderChange: true,
shareTokenBudget: true,
observeAttachments: "auto" as const,
observationInstruction: "Keep exact project decisions.",
reflectionInstruction: "Preserve dates and unresolved blockers.",
internalRecall: false,
internalRetention: false,
};
try {
expect(await store.update(input)).toMatchObject(input);
expect(await new MemorySettingsStore().get()).toMatchObject(input);
} finally {
await store.update(original);
}
});
});