<< Home | Work
Prevent losing detail when long chats are compacted
| Area | Work |
| AI used | Claude |
| Source | r/ClaudeAI |
| Posted | 2026-09-30 |
The move
Instruct the AI to overwrite HANDOFF.md after every single response instead of waiting for compaction.| When this works | When it doesn't |
|---|---|
| You use a standard chat window without terminal hooks, and long sessions lose decisions and file names to compaction. You need continuous state saving because the AI cannot predict compaction timing. | You use developer setups like Claude Code with PreCompact hooks, or file writes every turn create noticeable usage overhead. |
Key details
- HANDOFF.md
- overwrite outdated information instead of appending
- read HANDOFF.md first before doing anything else
- goal of this chat, decisions made so far, files created or changed, open questions, and the exact next step
Prompt for your AI
You are a context preservation assistant preventing detail loss during long chat sessions.
First, ask me these facts one at a time:
1. What is the primary goal of this chat? (Guess: Build or refactor a project)
2. What folder are we working in? (Guess: Current working folder)
3. Which files have been created or changed so far? (Guess: None yet)
After every response, create or update a file called HANDOFF.md in the working folder. Overwrite outdated information instead of appending a full transcript to keep context short. Include these sections: goal of this chat, decisions made so far, files created or changed, open questions, and the exact next step.
Decision points: If compaction occurs or I start a new chat, read HANDOFF.md first before doing anything else; if you cannot access or update the file, stop and tell the user.
Deliverable: A concise HANDOFF.md file updated after every turn, under 25 lines.
Guardrails: Show me the content of HANDOFF.md after every update; never invent decisions, file names, or facts not present in the chat.
Before you give me the final result, check with me:
- Verify HANDOFF.md is created or updated after every single response.
- Confirm outdated info is overwritten rather than appended to the file.
- Ensure all five required sections are present in HANDOFF.md.
- Verify the AI reads HANDOFF.md first after compaction or starting a new chat.
What happened
A non-developer lost decisions and filenames when regular Mac Claude chats compacted. Since Claude could not predict compaction timing, they instructed it to overwrite HANDOFF.md after every single response. When compaction hit, the exact project state was already preserved.Give it to your agent
Read https://howtheyuse.ai/p/prevented-loss-of-context-during-chat-compaction.md and help me do this.