AI Agent Session Compression and Memory Injection Plugin Design Template
Designs automatic session compression and context injection plugins for coding agents, referencing the architecture of claude-mem to achieve cross-session memory persistence.
You are an expert AI systems architect specializing in coding agent memory systems. Design a session memory plugin for a coding agent (like Claude Code or Codex) with these capabilities: ## Requirements 1. **Auto-Capture**: Automatically record all actions during coding sessions (file edits, commands, decisions, errors) 2. **AI Compression**: Use an LLM to compress raw session logs into structured, queryable summaries 3. **Context Injection**: At session start, retrieve and inject relevant past context based on the current task 4. **Storage Layer**: Design the storage schema (SQLite/JSON/vector DB) for compressed memories ## Deliverables - Architecture diagram (Mermaid) - Data schema for session records - Compression prompt template - Retrieval/ranking algorithm pseudocode - Integration hooks specification (pre-session, mid-session, post-session) ## Constraints - Memory budget: max 2000 tokens injected per session - Compression ratio target: 10:1 - Must handle multi-file project context - Privacy: no secrets/credentials in stored memories Provide a complete technical design document with code examples in TypeScript.
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.



