feat(FN-1553): reduce memory bloat with selective save behavior

- Update project memory instructions to encourage selective writes instead of unconditional appends
- Instruct agents to consolidate existing entries rather than add duplicates
- Add guidance to skip memory updates when no durable learnings were discovered
- Clarify what qualifies as durable learnings vs task-specific trivia
- Update user-facing memory documentation to reflect new selective behavior
- Add test coverage for selective memory write instructions
This commit is contained in:
gsxdsm
2026-04-11 00:35:39 -07:00
parent afa2e153ee
commit c8831f7b3b
6 changed files with 135 additions and 785 deletions

View File

@@ -2234,13 +2234,18 @@ describe("buildExecutionPrompt", () => {
expect(result).toContain(".fusion/memory.md");
});
it("includes append instruction for updating memory at end of execution", () => {
it("includes selective memory write instruction for durable learnings at end of execution", () => {
const task = createMockTaskDetail();
const result = buildExecutionPrompt(task, "/project", {
memoryEnabled: true,
} as any);
expect(result).toContain("append");
// Should instruct selective writes, not unconditional appends
expect(result).toMatch(/skip.*memory.*update|selectively|durable.*learnings/i);
expect(result).toMatch(/end of execution|before calling.*task_done/i);
// Should forbid task-specific trivia
expect(result).toMatch(/avoid.*trivia|task-specific.*trivia|per-task.*log/i);
// Should allow consolidation/editing
expect(result).toMatch(/consolidate|update.*refine.*existing|edit.*existing/i);
});
it("uses project-root memory path not worktree-local path", () => {