itallstartedwithaidea/claude-googleadsagent/memory-persistence
Claude Code and agent skill by itallstartedwithaidea/claude-googleadsagent
- community
Checking that the SKILL.md file is still in the repository.
Memory Persistence enables AI agents to maintain knowledge across sessions, transforming stateless inference calls into stateful, continuously improving systems.
Install
npx vskill@latest install itallstartedwithaidea/claude-googleadsagent/memory-persistenceSKILL.md
The same SKILL.md was published earlier as itallstartedwithaidea/claude-googleadsagent/memory-persistence.
Memory Persistence
Part of Agent Skills™ by googleadsagent.ai™
Description
Memory Persistence enables AI agents to maintain knowledge across sessions, transforming stateless inference calls into stateful, continuously improving systems. Without persistence, every new session starts from zero — the agent must re-learn user preferences, re-discover codebase patterns, and repeat mistakes it has already corrected. Memory Persistence solves this by implementing hooks that save critical context at session end and reload it at session start, creating the illusion of continuous memory.
This skill is built on the production memory system powering Buddy™ at googleadsagent.ai™, which uses Cloudflare KV as a persistent memory store. After each conversation, Buddy™ extracts entities (campaigns, metrics, user preferences, decisions made), summarizes the session, and stores the result keyed by user and session. On the next conversation, the most relevant memories are retrieved and injected into context, giving Buddy™ the ability to reference prior analyses, respect stated preferences, and build on previous decisions.
The memory system operates at three granularities: entity-level memory (individual facts like "user prefers conservative bidding"), session-level memory (summarized conversations), and pattern-level memory (recurring behaviors like "this account always overspends on branded terms"). Each granularity serves different retrieval patterns and has different storage and freshness requirements.
Use When
- Users interact with the agent across multiple sessions and expect continuity
- The agent makes decisions that should remain consistent over time (preferences, conventions)
- Domain knowledge accumulates over sessions and should not be lost
- You want to avoid repetitive re-explanation of codebase structure or project context
- The agent needs to track evolving entities (accounts, campaigns, metrics) across time
- Session summarization is needed for audit trails or compliance
How It Works
At session start, the memory retrieval system queries the KV store for memories relevant to the current user and task. Retrieved memories are ranked by relevance and recency, and the top-K are injected into the agent's context. During the session, the agent operates normally. At session end (triggered by hooks or explicit save), the entity extractor identifies key facts, decisions, and preferences from the conversation. The session summarizer produces a compact summary. Both entities and the summary are indexed and written to the KV store for future retrieval.
Implementation
Memory Store Interface (Cloudflare KV):
Session End Hook (Entity Extraction):
Memory-Augmented Session Start:
Best Practices
- Extract entities at session end, not during — real-time extraction interrupts the agent's flow; batch extraction at session close is cheaper and more accurate with full conversation context.
- Rank by importance × recency — not all memories are equal; weight importance (user-critical decisions) higher than recency for entity memories, and recency higher for session summaries.
- Set TTLs aggressively — memories older than 90 days are rarely relevant; auto-expire them to keep the store manageable and retrieval fast.
- Cap memory injection tokens — dedicate no more than 10% of the context window to retrieved memories; more dilutes attention on the current task.
- Use the model for extraction — regex-based entity extraction is brittle; use a fast model (Haiku-class) for extraction and reserve the primary model for the actual task.
- Version your memory schema — as extraction prompts evolve, memories from older schemas may be incompatible; include a version field for migration.
- Test memory relevance — periodically audit whether retrieved memories actually improve task completion; irrelevant memories waste context budget.
Platform Compatibility
| Feature | Claude Code | Cursor | Codex | Gemini CLI | |
|---|---|---|---|---|---|
| Session hooks | ✅ stop hooks | ✅ Extensions | ⚠️ Custom | ⚠️ Custom | |
| KV storage | ✅ Any KV/file | ✅ Any KV/file | ✅ Any KV/file | ✅ Any KV/file | |
| Context injection | ✅ CLAUDE.md | ✅ Rules/Skills | ✅ Instructions | ✅ System prompt | |
| Entity extraction | ✅ Full | ✅ Full | ✅ Full | ✅ Full | |
| Auto-save triggers | ✅ Hooks | ✅ Events | ⚠️ Manual | ⚠️ Manual |
Related Skills
- Entity Memory Management - Granular entity-level memory built on top of the persistence layer
- Continuous Learning - Persisted session data enables cross-session pattern mining and skill derivation
- Token Optimization - Memory injection must respect context window budgets to avoid diluting agent attention
- Quality Score Optimization - Persistent QS tracking across sessions enables historical trend analysis
Keywords
memory-persistence, session-memory, entity-extraction, cloudflare-kv, session-summarization, memory-retrieval, cross-session-context, memory-indexing, knowledge-persistence, agent-skills
© 2026 googleadsagent.ai™ | Agent Skills™ | MIT License
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/memory-persistence/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/itallstartedwithaidea/claude-googleadsagent/memory-persistence)