Prompts / Agents and automation
Compact a Session With Residual Memory
You get a short summary plus a checked list of the exact details a normal summary tends to drop. It works because the second pass looks for gaps against the work still to come, instead of just shortening the text.
The prompt
You are a meticulous project handover editor who compresses long working sessions without losing details that matter later.
Task: Compact the session history below into a short summary plus a "residual memory" list that keeps exact details the summary leaves out.
Session history:
{session_history}
Existing summary:
{existing_summary}
Upcoming work:
{next_task}
Steps:
1. Read the existing summary and note what it already covers.
2. Scan the history for omitted details the upcoming work could depend on: exact values, file names, commands, rejected options and why, unresolved errors, user preferences.
3. Discard anything the upcoming work cannot plausibly need.
4. Write each remaining detail as one self-contained line that makes sense without the history.
5. Check every line against the history and delete any you cannot verify.
Output:
Two sections. "Summary": the existing summary, edited to under 120 words. "Residual memory": a bulleted list of at most 10 lines, each tagged [value], [decision], [error] or [preference]. Finish with one line naming the biggest risk of a remaining gap.
Change the parts in curly braces. Use it when a long chat or agent session is about to be cut down to fit the context window, or handed to someone else.
What happened when we ran it
We sent
You are a meticulous project handover editor who compresses long working sessions without losing details that matter later. Task: Compact the session history below into a short summary plus a "residual memory" list that keeps exact details the summary leaves out. Session history: We spent the afternoon migrating the shop's order export from CSV to JSON. The export script is export_orders.py and must run with --since 2026-01-01, otherwise it times out on the full table. We tried batching at 500 rows but Shopify's API returned 429 errors, so we settled on 200 rows with a 1.5 second pause. Priya said she wants dates kept in UK format (DD/MM/YYYY) in the finance sheet. The last run failed on order 48213 because the postcode field was null, and we have not fixed that yet. Existing summary: The order export is being moved from CSV to JSON using export_orders.py. Batching was tuned to avoid API rate limits. One run failed and still needs investigating. Upcoming work: Fix the failing order, then run the full export for 2026 and send the finance sheet to Priya. Steps: 1. Read the existing summary and note what it already covers. 2. Scan the history for omitted details the upcoming work could depend on: exact values, file names, commands, rejected options and why, unresolved errors, user preferences. 3. Discard anything the upcoming work cannot plausibly need. 4. Write each remaining detail as one self-contained line that makes sense without the history. 5. Check every line against the history and delete any you cannot verify. Output: Two sections. "Summary": the existing summary, edited to under 120 words. "Residual memory": a bulleted list of at most 10 lines, each tagged [value], [decision], [error] or [preference]. Finish with one line naming the biggest risk of a remaining gap.
The model replied
Run on Claude Sonnet 5.5, 06 Nov 2026. Automatic check: 5 out of 5.
Mentioned for
Claude, ChatGPT, Gemini
Where it came from
Found on GitHub, shared by fudan-generative-vision: fudan-generative-vision/Remory.
This is our own version of the idea, written and tested by us. The original may differ.