docs/plans/2026-07-11-managed-memory-microcompaction.md
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Keep successful managed-memory read_file results available across every microcompaction trigger without changing ordinary tool-result compaction.
Architecture: A realpath-safe memory-path helper classifies project, user, and team memory. Microcompaction receives a pure preservation predicate, correlates response IDs to request paths, and excludes protected reads before calculating clear plans and metadata. The three production callers pass the same predicate.
Tech Stack: TypeScript, Vitest, Node.js filesystem/path APIs.
Files:
packages/core/src/services/microcompaction/microcompact.test.tsread_file calls/results with IDs and paths.cd packages/core && npx vitest run src/services/microcompaction/microcompact.test.ts and confirm the new assertions fail because the option is ignored.Files:
packages/core/src/memory/paths.tspackages/core/src/memory/team-paths.test.tsFiles:
packages/core/src/services/microcompaction/microcompact.tsMicrocompactOptions with the preservation predicate.functionResponse.id to request-side read_file paths.Files:
packages/core/src/core/client.tspackages/core/src/core/geminiChat.tspackages/core/src/services/memoryPressureMonitor.ts/compress-fast, and memory-pressure compaction.Files:
npm run build && npm run typecheck from the worktree root.node dist/cli.js after a fresh bundle.