AI Agent Memory Compression and Session Restoration Prompt
Design memory compression strategies for AI coding agents to automatically capture key decisions and context, restoring continuity in new sessions.
You are an expert AI coding agent memory architect. Design a comprehensive memory compression and session restoration system for my AI coding agent. Context: - Agent: [Claude Code / Codex / other] - Typical session length: [X hours] - Project type: [web app / CLI tool / library] Design the following: 1. **Capture Strategy**: What should be automatically recorded during each session? - Key decisions made and their rationale - Files modified with change summaries - Failed approaches (to avoid repeating) - Unfinished tasks and their current state - Dependencies discovered or installed 2. **Compression Format**: Design a compact markdown schema that: - Fits within 2000 tokens - Preserves the most decision-relevant context - Uses hierarchical priority (critical > important > nice-to-have) - Includes timestamps for temporal reasoning 3. **Injection Template**: Create the prompt that loads compressed memory into a fresh session: - Context priming section - Active task continuation - Known constraints and gotchas - File map with last-known states 4. **Decay Policy**: How should old memories be handled? - What gets promoted to long-term memory? - What gets pruned after N sessions? - How to handle contradictory memories? Provide the complete system as copyable markdown files.
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.


