AI编码Agent会话记忆自动摘要与上下文注入模板
设计AI编码助手的会话记忆系统,自动压缩历史会话并在新会话中注入关键上下文,提升跨会话编码效率
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.
如何使用这条提示词
- 1复制上方完整提示词。
- 2在对应模型中替换主题、人物或风格变量。
- 3生成后记录有效调整,形成自己的版本。


