Skip to main content
Glama

apply_memento_confidence_decay

Adjust memory confidence scores based on last access time to maintain knowledge freshness. Applies intelligent decay rules with different rates for critical, important, general, and temporary information.

Instructions

Apply automatic confidence decay based on last access time.

Use for:

  • System maintenance to keep knowledge base fresh

  • Applying intelligent decay rules

  • Monthly confidence adjustment routine

Intelligent decay rules:

  • Critical memories (security, auth, api_key, password, critical, no_decay tags): NO DECAY

  • High importance memories: Reduced decay based on importance score

  • General knowledge: Standard 5% monthly decay (decay_factor=0.95)

  • Temporary context: Higher decay rate

Decay formula: monthly_decay = confidence × decay_factor^(months_since_last_access)

Minimum confidence: 0.1 (won't decay below this)

Returns:

  • Number of relationships updated

  • Summary of decay applied

  • Breakdown by memory type

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
memory_idNoOptional memory ID. When provided, applies decay only to relationships of that specific memory (and updates their decay_factor based on the memory's importance and tags). When omitted, applies decay to all relationships system-wide.

Implementation Reference

  • The exact handler function for the `apply_memento_confidence_decay` tool, which calculates the scope and invokes the database's confidence decay logic.
    async def handle_apply_memento_confidence_decay(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle apply_confidence_decay tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - memory_id: Optional memory ID to apply decay only to its relationships
    
        Returns:
            CallToolResult with decay results or error message
        """
        memory_id = arguments.get("memory_id")
    
        # Count total relationships before decay to compute skipped
        if memory_id:
            count_rows = await memory_db._execute_sql(
                "SELECT COUNT(*) as total FROM relationships WHERE from_id = ? OR to_id = ?",
                (memory_id, memory_id),
            )
        else:
            count_rows = await memory_db._execute_sql(
                "SELECT COUNT(*) as total FROM relationships"
            )
    
        total_rels = count_rows[0]["total"] if count_rows else 0
    
        updated_count = await memory_db.apply_confidence_decay(memory_id)
    
        skipped = total_rels - updated_count
    
        # Build breakdown text
        scope = f"memory {memory_id}" if memory_id else "all memories (system-wide)"
        lines = [
            f"**Confidence decay applied** ({scope})\n",
            f"| | Count |",
            f"|---|---|",
            f"| Relationships updated | {updated_count} |",
            f"| Skipped (no last_accessed or at min confidence 0.1) | {skipped} |",
            f"| Total relationships in scope | {total_rels} |",
        ]
    
        if updated_count == 0 and total_rels > 0:
            lines.append(
                "\n⚠️ All relationships were skipped — they may already be at minimum "
                "confidence (0.1) or have no `last_accessed` timestamp."
            )
    
        return CallToolResult(
            content=[TextContent(type="text", text="\n".join(lines))]
        )
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Excellent coverage: discloses mathematical decay formula, minimum confidence floor (0.1), tag-based protections (no decay for security/auth tags), relationship scope (updates relationships, not memories directly), and detailed return value structure (count, summary, breakdown).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear section headers (Use for, Intelligent decay rules, Decay formula, Returns). Front-loaded with primary purpose. Slightly verbose but every section earns its place—the formula, protection rules, and return specifications are essential for safe invocation. No filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive coverage for a complex operation. Compensates for missing output schema by explicitly documenting return values (count, summary, breakdown). Covers complex behavioral tiers (critical/high/general/temporary), mathematical formula, and edge case handling (minimum confidence) despite simple single-parameter input.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% description coverage for the single memory_id parameter, including behavior when omitted (system-wide) versus provided (specific memory). Main description focuses on algorithmic behavior rather than repeating parameter details, which is appropriate given comprehensive schema documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Excellent specificity: 'Apply automatic confidence decay based on last access time' clearly identifies the verb (apply), resource (confidence/memento relationships), and mechanism (time-based decay). Distinguishes from sibling tools like adjust_memento_confidence and boost_memento_confidence by emphasizing the automatic, time-driven nature versus manual adjustments.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit 'Use for:' section with three concrete scenarios (system maintenance, intelligent decay rules, monthly routines). However, lacks explicit 'when not to use' guidance or direct comparison to manual adjustment alternatives (adjust_memento_confidence, boost_memento_confidence) in the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/x-hannibal/mcp-memento'

If you have feedback or need assistance with the MCP directory API, please join our Discord server