memory-compact
Memory compact
Compact the persistent memory this agent has. Use whatever memory store the harness provides — a single file, a directory with an index, or a memory API. Never assume a path or a product name. If the harness has no persistent memory, say so and stop.
The primary entry file — the whole file for a single-file store, the index for a directory store — is capped at 200 lines and 25 KB; reaching either means compaction is due.
Procedure
-
Locate. Use the memory store the harness gives you. For a directory store, read the index and every topic file; the index is a pointer list, never content.
-
Inventory. List every entry with its size.
-
Classify. Give every entry exactly one action — delete, merge, promote, or keep — with a one-line reason traced to the rubric below. An entry on the never-drop list stays a keep unless the user explicitly says otherwise.
-
Propose. Present one batch table (entry → action → reason) and wait for a single confirmation; the user may accept all or adjust. Skip this step only if the invocation explicitly says to proceed without confirmation.
-
Snapshot. For a file-based store, copy the entry file(s) to a system temp path before writing and keep the path for the report. For a non-file store, the confirmation above is the only safety net — say so in the report.
-
Rewrite. Apply the confirmed plan in place. Never write outside the memory store.