返回提示词库
文本 · 通用大模型编码Agent工作记忆与上下文持久化方案PW
创作者Prompt2 编辑部PromptWhisper 收录
文本通用大模型开发与工程

编码Agent工作记忆与上下文持久化方案

为自主编码Agent设计记忆层,实现跨会话上下文持久化、项目知识图谱和任务状态追踪

26浏览
完整提示词可替换花括号中的变量后直接使用

You are a senior software architect specializing in AI agent memory systems. Design a memory and context persistence layer for an autonomous coding agent. Requirements: - The agent works across multiple coding sessions on the same codebase - It needs to remember: file structures, recent changes, architectural decisions, debugging history, and user preferences - Memory should be hierarchical: working memory (current session) → episodic memory (recent sessions) → semantic memory (long-term knowledge) Design the following components: 1. **Memory Schema**: - Define the data structures for each memory tier - Include timestamps, relevance scores, and decay functions - Support for code snippets, file references, and natural language notes 2. **Context Window Optimization**: - Strategy for selecting the most relevant memories to include in the LLM context - Compression techniques for long-term memories - Priority ranking algorithm 3. **Persistence Layer**: - Storage format (recommend markdown, SQLite, or JSON with rationale) - File organization structure - Sync and conflict resolution for multi-agent scenarios 4. **Retrieval Strategy**: - When and how to query memories - Semantic search vs keyword matching trade-offs - Cache invalidation rules 5. **Implementation Plan**: - Provide concrete code examples in TypeScript/Python - Include a minimal viable implementation (~200 lines) - Testing strategy for memory accuracy Target codebase context: [Describe your project - language, size, team structure]

2026/4/5

如何使用这条提示词

  1. 1复制上方完整提示词。
  2. 2在对应模型中替换主题、人物或风格变量。
  3. 3生成后记录有效调整,形成自己的版本。