kienbui1995/magic-powers/agentic-memory
Claude Code and agent skill by kienbui1995/magic-powers
- community
Checking that the SKILL.md file is still in the repository.
Use when designing memory systems for AI agents — tiered memory architecture (in-context, session, long-term, episodic), context window management, memory compression, and retrieval strategies for persistent agent state.
Install
npx vskill@latest install kienbui1995/magic-powers/agentic-memorySKILL.md
The same SKILL.md was published earlier as kienbui1995/magic-powers/agentic-memory.
Agentic Memory
Overview
Agents forget everything between sessions by default. Building memory into agents requires deliberate architecture: choosing what to store, where, for how long, and how to retrieve it efficiently without polluting the context window.
When to Use
- Building an agent that needs to remember across sessions
- Agent context window filling up in long conversations
- Designing multi-session user personalization for agents
- Agent needs to recall past decisions, completed tasks, or user preferences
- Building memory for multi-agent systems where agents share state
Core Jobs
1. Memory Tier Architecture
Four tiers, each with different storage, latency, and persistence:
| Tier | Storage | Latency | Lifetime | Use case | |
|---|---|---|---|---|---|
| In-context | Token window (4K-200K) | 0ms | Current session | Active task state, recent tool results, current conversation | |
| Session | Redis / Postgres | 1-10ms | One conversation | Conversation history, user preferences in session, task progress | |
| Long-term | Vector DB + key-value | 10-100ms | Persistent | User facts, learned patterns, past decisions | |
| Episodic | DB + vector embeddings | 50-200ms | Persistent | Past task completions, examples, learned workflows |
Retrieve memory before the agent starts working — not mid-task. Front-loading relevant memory prevents mid-loop context changes.
2. Context Window Management
The most common practical problem — context fills up in long conversations:
Strategies by situation:
- Short conversations (<20 turns): keep everything, no pruning needed
- Medium (20-50 turns): sliding window — keep last N turns
- Long (50+ turns): summarize old + keep recent
- Very long (100+ turns): hierarchical summary (summary of summaries)
3. Long-Term Memory: What to Store
Not everything should be remembered. Use selective storage:
Memory decay: Old, unaccessed memories should decay in confidence. Facts accessed frequently = higher confidence. Implement a cron job that reduces confidence by a small delta each week and prunes below a threshold (e.g., confidence < 0.2).
4. Episodic Memory: Past Tasks
Agents improve by referencing how similar tasks were completed:
Only store completed tasks with quality_score above a threshold (e.g., > 0.7). Storing low-quality episodes teaches the agent bad patterns.
5. Memory for Multi-Agent Systems
When multiple agents share memory:
Multi-agent memory patterns:
- Blackboard: shared workspace all agents read/write — simple but needs optimistic locking to prevent race conditions
- Message passing: agents communicate via explicit messages, not shared state — preferred for reliability
- Hierarchical: orchestrator owns memory, shares summaries with workers — good for privacy between agents
Key Concepts
- Context window — tokens currently visible to the model; finite; expensive to fill
- Sliding window — keep only last N turns in context; simple but loses early context
- Summarization — compress old context into dense summary; loses detail, saves tokens
- Episodic memory — memories of specific past events (tasks completed, decisions made)
- Semantic memory — facts and knowledge (user preferences, domain knowledge)
- Memory decay — old unused memories lose confidence over time; prevents stale facts accumulating
- Selective storage — not every message is worth storing long-term; classify before storing
- Mem0 / Letta — production-ready frameworks for agent memory management
Checklist
- [ ] In-context messages managed to stay within token budget?
- [ ] Summarization strategy defined for conversations >20 turns?
- [ ] Long-term memory stores only actionable facts (not everything)?
- [ ] Episodic memory recording completed tasks for few-shot retrieval?
- [ ] Memory retrieval happens before agent starts working (not mid-task)?
- [ ] Multi-agent systems use explicit shared memory with defined scope (not ad-hoc)?
- [ ] Memory decay implemented (old facts reduce in confidence over time)?
- [ ] GDPR compliance: user can request full memory deletion?
- [ ] Low-quality episodes excluded from episodic store?
Key Outputs
- Memory architecture diagram: which tier, what's stored, how long, retrieval method
- Context management strategy: window size, pruning policy, summarization trigger threshold
- Storage schema for each tier: fields, indexes, retention policy, decay schedule
Output Format
- 🔴 Critical — no context management (agent crashes on long conversations), storing every message verbatim long-term (expensive, noisy retrieval), no memory across sessions when the use case explicitly requires continuity
- 🟡 Warning — only in-context memory (restarts completely fresh each conversation), no summarization strategy for long conversations, multi-agent agents sharing memory without defined scope or synchronization
- 🟢 Suggestion — implement episodic memory for few-shot learning from past task completions, use Mem0/Letta for production-ready memory management rather than building from scratch
Anti-Patterns
- Storing every message verbatim long-term — expensive, retrieval becomes noisy, important facts buried under chatter
- No memory across sessions when users expect continuity — breaks user experience, agent feels dumb and forgetful
- Loading all long-term memories into context on every request — context pollution; retrieve only what's relevant to the current query
- Multi-agent systems reading/writing same key without synchronization — race conditions cause inconsistent state
- Never expiring memories — stale facts accumulate and contradict new information (e.g., agent remembers old job title)
- Summarizing too aggressively — losing important details from early in a conversation that become relevant later
- Storing low-quality episodic memories — agent learns bad patterns from failed or mediocre task completions
Integration
- Use with
agentic-ai-patternsfor understanding where memory fits in the observe-think-act agent loop - Use with
rag-architecturefor vector search patterns in long-term memory retrieval - Use with
llm-observabilityto track memory hit rates, context window utilization, and retrieval latency - Use with
agentic-security— retrieved memories are external data and should be treated as untrusted if user-supplied - Agent:
@ai-engineeruses this when designing stateful agent systems
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/agentic-memory/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/kienbui1995/magic-powers/agentic-memory)