Back to prompt library
Text · General-purpose LLMAI Agent Memory Compression and Session Restoration PromptPW
CreatorPrompt2 Editorial TeamCurated by PromptWhisper
TextGeneral-purpose LLMDevelopment & Engineering

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.

12Views
Full promptReplace variables in braces, then use it directly

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.

4/12/2026

How to use this prompt

  1. 1Copy the complete prompt above.
  2. 2Replace the topic, subject, or style variables.
  3. 3Save effective changes to build your own version.