Coding Agent Working Memory & Context Persistence Solution
Design a memory layer for autonomous coding agents to achieve cross-session context persistence, project knowledge graphs, and task status tracking.
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]
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.


