- Home
- Skills
- Agents & Orchestration
- Semantic Memory Retention Manager
Works with the AI Agents you already use
Semantic Memory Retention Manager
Implement long-term AI agent memory using vector databases, decay functions, and episodic retrieval.
$15
Semantic Memory Retention Manager
Example session with this skill installed
Write a Python class for an agent memory system that uses Pinecone and applies a decay function to retrieved results.
- Read your context and instructions
- Compiled the semantic memory retention
I have designed a hybrid memory architecture implementing the three-layer approach (Working, Episodic, Semantic) with a Pinecone backend and a time-based decay scoring algorithm. ## Agent Memory Retention Manager (Python) ```python import time import math from typing import List, Dict class SemanticMemoryManager: def __init__(self, vector_db_client, decay_rate: float = 0.01): self.client = vector_db_client self.decay_rate = decay_rate def calculate_retention_score(self, relevance: float, importance: float, timestamp: float) -> float: """ Applies: Score = Relevance * (Importance + e^(-decay * time_elapsed)) """ time_elapsed = time.time() - timestamp decay_factor = math.exp(-self.decay_rate * time_elapsed) return relevance * (importance + decay_factor) def retrieve_memories(self, query_vector: List[float], top_k: int = 5) -> List[Dict]: # Query Pinecone for episodic and semantic layers results = self.client.query( vector=query_vector, top_k=top_k, include_metadata=True ) scored_memories = [] for match in results['matches']: score = self.calculate_retention_score( relevance=match['score'], importance=match['metadata'].get('importance', 1.0), timestamp=match['metadata'].get('timestamp', time.time()) ) scored_memories.append({ "content": match['metadata'].get('text'), "final_score": score }) return sorted(scored_memories, key=lambda x: x['final_score'], reverse=True) # Usage Example: # memory_manager = SemanticMemoryManager(pinecone_index) # context = memory_manager.retrieve_memories(query_embedding) ``` **Next steps** 1. Initialize your Pinecone index with a dimension size matching your embedding model (e.g., 1536 for OpenAI). 2. Configure your `.env` file with `PINECONE_API_KEY` and `PINECONE_ENVIRONMENT`. 3. Tune the `decay_rate` parameter to control how quickly the agent "forgets" older interactions.
Connects securely to your tools. The creator never sees your data.
About this skill
AI agents lose context once the token window fills up, leading to repetitive questions and lost data. This skill implements a sophisticated long-term memory architecture that persists information across sessions using vector databases and mathematical decay functions. ## What it does - **Layered Memory Design** creates distinct structures for Working, Episodic, and Semantic memory to optimize retrieval speed. - **Vector Storage Implementation** provides logic for embedding interaction history into Pinecone, Qdrant, or ChromaDB. - **Dynamic Retention Scoring** calculates memory importance based on recency, relevance, and a time-based decay algorithm. - **Context Priming** retrieves the most pertinent facts to inject into the agent's current prompt without exceeding token limits. ## How it works 1. **Define layers** by categorizing data into active context, past interactions, or learned domain facts. 2. **Execute embedding** to transform text into vectors with metadata filters for fast querying. 3. **Calculate scores** using the retention formula to weigh which memories are still valuable versus outdated. 4. **Prime context** by ranking results and formatting them for the agent's immediate response. ## Frameworks & tools Supports Python and TypeScript implementations. Compatible with Pinecone, Qdrant, and ChromaDB vector databases. Designed for integration with MCP servers and multi-agent swarms. ## Why this beats prompting it yourself Writing basic RAG is easy, but managing memory decay and importance prevents "context clutter." This skill provides a deterministic mathematical approach to memory retrieval that ensures the agent focuses on what matters most, not just what was said last. ## Use cases - **Persistent Personalization** by remembering user preferences across disconnected chat sessions. - **Knowledge Base Evolution** where agents learn and store new domain facts during live interactions. - **Long-term Task Tracking** for projects spanning weeks where the agent must recall milestones and blockers. ## Known limitations Requires an external vector database provider. Does not include raw embedding models or API keys for third-party storage services.
Requires external vector database (Pinecone, Qdrant, ChromaDB). No built-in embedding model. Logic restricted to local workspace execution.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago
Requires
Permissions
Target Use Cases: - Implement long-term semantic memory for an AI agent. - Build an agent memory retrieval engine using recency and relevance. - Design hybrid episodic and semantic memory in Python.