AI Agent 会话压缩与记忆注入插件设计模板
为编码Agent设计自动会话压缩与上下文注入插件,参考claude-mem的架构思路,实现跨会话记忆持久化
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.
如何使用这条提示词
- 1复制上方完整提示词。
- 2在对应模型中替换主题、人物或风格变量。
- 3生成后记录有效调整,形成自己的版本。



