Skip to main content
Glama

prioritize_memory

Prioritize important memories for AI development by analyzing current tasks, critical decisions, code changes, blockers, and next steps to focus on what matters most.

Instructions

important|priority|prioritize|what matters - Prioritize memories by importance

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
currentTaskYesCurrent task description
criticalDecisionsNoList of critical decisions made
codeChangesNoImportant code changes
blockersNoCurrent blockers or issues
nextStepsNoPlanned next steps

Implementation Reference

  • The main handler function that evaluates and prioritizes existing memories based on relevance to the current task, critical decisions, code changes, blockers, and next steps. It scores memories using keyword matching and category checks, updates priorities in the database, and returns a sorted list of top 20 high-priority memories.
    export async function prioritizeMemory(args: {
      currentTask: string;
      criticalDecisions?: string[];
      codeChanges?: string[];
      blockers?: string[];
      nextSteps?: string[]
    }): Promise<ToolResult> {
      const { currentTask, criticalDecisions = [], codeChanges = [], blockers = [], nextSteps = [] } = args;
    
      try {
        const mm = MemoryManager.getInstance();
        const allMemories = mm.list();
        const prioritizedMemories: Array<{ memory: MemoryItem; priority: number; reason: string }> = [];
    
        for (const memory of allMemories) {
          let priority = 0;
          let reason = '';
    
          // Analyze importance based on content
          if (memory.value.includes('error') || memory.value.includes('Error')) {
            priority = 0.9;
            reason = 'error info';
          } else if (memory.value.includes('decision') || memory.value.includes('Decision')) {
            priority = 0.8;
            reason = 'decision';
          } else if (memory.value.includes('code') || memory.value.includes('function')) {
            priority = 0.7;
            reason = 'code-related';
          } else if (memory.category === 'context') {
            priority = 0.6;
            reason = 'context';
          } else if (memory.category === 'project') {
            priority = 0.7;
            reason = 'project';
          } else {
            priority = 0.5;
            reason = 'general';
          }
    
          // Boost priority for memories related to current task
          if (memory.value.toLowerCase().includes(currentTask.toLowerCase())) {
            priority += 0.2;
            reason += ' +task';
          }
    
          // Boost priority for critical decisions
          for (const decision of criticalDecisions) {
            if (memory.value.toLowerCase().includes(decision.toLowerCase())) {
              priority += 0.15;
              reason += ' +critical';
              break;
            }
          }
    
          // Boost priority for code changes
          for (const change of codeChanges) {
            if (memory.value.toLowerCase().includes(change.toLowerCase())) {
              priority += 0.1;
              reason += ' +change';
              break;
            }
          }
    
          // Boost priority for blockers
          for (const blocker of blockers) {
            if (memory.value.toLowerCase().includes(blocker.toLowerCase())) {
              priority += 0.25;
              reason += ' +blocker';
              break;
            }
          }
    
          // Boost priority for memories related to planned next steps
          for (const step of nextSteps) {
            if (memory.value.toLowerCase().includes(step.toLowerCase())) {
              priority += 0.15;
              reason += ' +nextstep';
              break;
            }
          }
    
          // Cap priority at 1.0
          priority = Math.min(1.0, priority);
    
          if (priority >= 0.6) {
            prioritizedMemories.push({ memory, priority, reason });
    
            // Update priority in database
            mm.setPriority(memory.key, Math.floor(priority * 100));
          }
        }
    
        const sortedMemories = prioritizedMemories
          .sort((a, b) => b.priority - a.priority)
          .slice(0, 20);
    
        const resultList = sortedMemories.map(pm =>
          `• [${(pm.priority * 100).toFixed(0)}%] ${pm.memory.key} (${pm.reason}): ${pm.memory.value.substring(0, 60)}${pm.memory.value.length > 60 ? '...' : ''}`
        ).join('\n');
    
        return {
          content: [{
            type: 'text',
            text: `✓ Prioritized ${sortedMemories.length} memories for "${currentTask}":\n${resultList || 'None'}`
          }]
        };
      } catch (error) {
        return {
          content: [{ type: 'text', text: `✗ Error: ${error instanceof Error ? error.message : 'Unknown error'}` }]
        };
      }
    }
  • The ToolDefinition object that defines the tool's name, description, input schema (with properties for task context and boosts), and annotations.
    export const prioritizeMemoryDefinition: ToolDefinition = {
      name: 'prioritize_memory',
      description: 'important|priority|prioritize|what matters - Prioritize memories by importance',
      inputSchema: {
        type: 'object',
        properties: {
          currentTask: { type: 'string', description: 'Current task description' },
          criticalDecisions: { type: 'array', items: { type: 'string' }, description: 'List of critical decisions made' },
          codeChanges: { type: 'array', items: { type: 'string' }, description: 'Important code changes' },
          blockers: { type: 'array', items: { type: 'string' }, description: 'Current blockers or issues' },
          nextSteps: { type: 'array', items: { type: 'string' }, description: 'Planned next steps' }
        },
        required: ['currentTask']
      },
      annotations: {
        title: 'Prioritize Memory',
        audience: ['user', 'assistant']
      }
    };
  • src/index.ts:104-160 (registration)
    Registration of the tool definition in the central tools array used for listing available tools via MCP protocol.
    const tools: ToolDefinition[] = [
      // Time Utility Tools
      getCurrentTimeDefinition,
    
      // Semantic Code Analysis Tools (Serena-inspired)
      findSymbolDefinition,
      findReferencesDefinition,
    
      // Sequential Thinking Tools
      createThinkingChainDefinition,
      analyzeProblemDefinition,
      stepByStepAnalysisDefinition,
      breakDownProblemDefinition,
      thinkAloudProcessDefinition,
      formatAsPlanDefinition,
    
      // Browser Development Tools
      monitorConsoleLogsDefinition,
      inspectNetworkRequestsDefinition,
    
      // Memory Management Tools
      saveMemoryDefinition,
      recallMemoryDefinition,
      listMemoriesDefinition,
      deleteMemoryDefinition,
      searchMemoriesDefinition,
      updateMemoryDefinition,
      autoSaveContextDefinition,
      restoreSessionContextDefinition,
      prioritizeMemoryDefinition,
      startSessionDefinition,
    
      // Convention Tools
      getCodingGuideDefinition,
      applyQualityRulesDefinition,
      validateCodeQualityDefinition,
      analyzeComplexityDefinition,
      checkCouplingCohesionDefinition,
      suggestImprovementsDefinition,
    
      // Planning Tools
      generatePrdDefinition,
      createUserStoriesDefinition,
      analyzeRequirementsDefinition,
      featureRoadmapDefinition,
    
      // Prompt Enhancement Tools
      enhancePromptDefinition,
      analyzePromptDefinition,
      enhancePromptGeminiDefinition,
    
      // Reasoning Tools
      applyReasoningFrameworkDefinition,
    
      // UI Preview Tools
      previewUiAsciiDefinition
    ];
  • src/index.ts:652-653 (registration)
    Dispatch registration in the main tool execution switch statement that routes calls to the prioritizeMemory handler.
    case 'prioritize_memory':
      return await prioritizeMemory(args as any) as CallToolResult;
Behavior2/5

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

No annotations are provided beyond a basic title, so the description carries the full burden of behavioral disclosure. The description mentions 'prioritize' which implies some kind of ordering or ranking operation, but doesn't explain what the tool actually does behaviorally: Does it modify existing memories? Create new prioritized views? Return sorted lists? How does it determine importance? Without annotations and with minimal description, the behavioral characteristics are largely opaque.

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

Conciseness3/5

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

The description is extremely concise ('Prioritize memories by importance'), but this brevity comes at the cost of clarity and completeness. While it's front-loaded and wastes no words, it's arguably under-specified rather than appropriately concise. The keywords at the beginning ('important|priority|prioritize|what matters') appear to be search terms rather than part of the functional description, which is unconventional.

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

Completeness2/5

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

Given that this is a 5-parameter tool with no output schema and no behavioral annotations, the description is insufficiently complete. It doesn't explain what the tool returns, how the prioritization works, what 'importance' means in this context, or how the parameters influence the outcome. For a tool that presumably performs some non-trivial operation on memories, more context is needed to understand its function and appropriate use.

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 description coverage is 100%, so all parameters are documented in the schema itself. The description adds no information about any parameters beyond what's already in the schema descriptions. It doesn't explain how these parameters relate to the prioritization process or what the tool does with them. The baseline score of 3 reflects adequate parameter documentation coming entirely from the schema, not from the description.

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

Purpose2/5

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

The description 'Prioritize memories by importance' is essentially a tautology that restates the tool name 'prioritize_memory' with minimal added meaning. While it clarifies the resource ('memories') and the action ('prioritize'), it lacks specificity about what prioritization entails or how it differs from sibling tools like 'list_memories', 'recall_memory', or 'save_memory'. The description doesn't explain what 'prioritize' means in this context.

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

Usage Guidelines1/5

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

The description provides no guidance on when to use this tool versus alternatives. There are multiple memory-related sibling tools (list_memories, recall_memory, save_memory, update_memory, delete_memory, search_memories), but the description offers no context about when prioritization is appropriate versus listing, recalling, or searching memories. No explicit when/when-not statements or alternative recommendations are present.

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/ssdeanx/ssd-ai'

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