AI Coding Agent Session Memory Auto-Summary & Context Injection Template
Design a session memory system for an AI coding assistant that automatically compresses historical sessions and injects key context into new ones, improving cross-session coding efficiency.
You are an expert in AI coding assistant memory systems. Help me design a session memory management strategy for my AI coding agent. ## Current Setup - Coding agent: [Claude Code / Cursor / Codex / other] - Project type: [describe your project] - Average session length: [e.g., 30 min - 2 hours] - Pain point: [e.g., agent forgets decisions from previous sessions] ## Design the following: ### 1. Session Summary Schema Design a structured format for capturing session summaries: - Decisions made (with rationale) - Files modified (with change description) - Patterns established (naming, architecture) - Bugs encountered and fixes applied - TODO items deferred to next session - Key context the agent should remember ### 2. Compression Strategy - How to distill a 2-hour session into under 500 tokens of context - Priority ranking: what to keep vs. what to discard - Temporal decay: how to handle aging information - Conflict resolution: when new decisions override old ones ### 3. Context Injection Template Create a MEMORY.md or CLAUDE.md template that: - Loads automatically at session start - Structures information by recency and relevance - Includes a current sprint section for active work - Has a lessons learned section for recurring issues - Maintains a project map for codebase navigation ### 4. Automation Pipeline - Post-session: auto-generate summary from conversation - Pre-session: select relevant memories for injection - Periodic: consolidate and prune old memories - Tooling recommendations for automation ### 5. Anti-Patterns to Avoid - Common mistakes in coding agent memory management - Token budget pitfalls - Stale context problems - Over-specification that limits agent flexibility Provide concrete examples, file templates, and a step-by-step implementation guide.
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.


