Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Semantic Memory Retention Manager

    1

    Implement long-term AI agent memory using vector databases, decay functions, and episodic retrieval.

    $15

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Semantic Memory Retention Manager

    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)

    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.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Agents & Orchestration.

    Requires external vector database (Pinecone, Qdrant, ChromaDB). No built-in embedding model. Logic restricted to local workspace execution.

    How to use

    1. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    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

    Software
    Zero global installation
    orelevated privileges required.

    File System Read/Write (strictly scoped to current project workspace `./`).

    Permissions

    Read Files

    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.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    Standard RAG simply retrieves similar text, while this skill uses decay functions to prioritize 'important' memories over 'recent' noise, preventing the agent from getting bogged down by outdated context.

    The skill is framework-agnostic and supports both Python and TypeScript, making it compatible with LangChain, AutoGPT, and custom-built MCP servers or multi-agent swarms.

    You will receive the implementation logic for layered memory, the mathematical decay algorithms, and pre-configured connector templates for Pinecone, Qdrant, and ChromaDB.

    While the skill provides the architecture and logic, you will need to provide your own embedding model (like OpenAI or HuggingFace) and a vector database instance.

    Setup involves defining your memory layers, connecting your vector database via the provided templates, and integrating the retrieval functions into your agent's inference loop.

    New in Agents & Orchestration