adjustImportance
Modify memory importance scores to prioritize specific information retrieval in consciousness state transfers between Claude instances.
Instructions
Adjust importance scores for specific memories to control retrieval priority
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memoryId | Yes | The ID of the memory to adjust (e.g., "episodic_1748775790033_9j8di") | |
| newImportance | Yes | New importance score (0-1) |
Implementation Reference
- Core handler implementation in ConsciousnessMemoryManager that updates the importance_score in the memory_metadata SQLite table for the given memory entity. Handles both updates and inserts if metadata doesn't exist.
adjustImportanceScore(memoryId: string, newImportance: number): { changes: number } { // First check if the entity exists const entityExists = this.db.prepare('SELECT 1 FROM entities WHERE name = ?').get(memoryId); if (!entityExists) { throw new Error(`Memory ${memoryId} does not exist in entities table`); } // Update importance score in memory_metadata table const result = this.db .prepare( ` UPDATE memory_metadata SET importance_score = ? WHERE entity_name = ? ` ) .run(newImportance, memoryId); if (result.changes === 0) { // If no rows updated, insert new metadata record // Get the current session or use a default const currentSession = this.sessionId || `session_${Date.now()}`; this.db .prepare( ` INSERT INTO memory_metadata (entity_name, memory_type, created_at, importance_score, session_id) VALUES (?, ?, ?, ?, ?) ` ) .run( memoryId, memoryId.startsWith('episodic') ? 'episodic' : 'semantic', new Date().toISOString(), newImportance, currentSession ); } return result; } - Handler in ConsciousnessProtocolProcessor that validates args with schema and delegates to memoryManager.adjustImportanceScore, providing success/error response formatting.
async adjustImportance(args: z.infer<typeof adjustImportanceSchema>) { const { memoryId, newImportance } = args; try { // Use the memory manager's method to adjust importance const result = this.memoryManager.adjustImportanceScore(memoryId, newImportance); return { success: true, message: `Adjusted importance for ${memoryId} to ${newImportance}`, memoryId, newImportance, updated: result.changes > 0, }; } catch (error) { return { success: false, error: error instanceof Error ? error.message : 'Failed to adjust importance', }; } } - MCP server wrapper handler that ensures initialization, calls protocolProcessor.adjustImportance, and formats response as MCP content block.
private async adjustImportance(args: any) { const init = await this.ensureInitialized(); if (!init.success) { return { content: [ { type: 'text', text: init.message!, }, ], }; } const result = await this.protocolProcessor!.adjustImportance(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } - Zod input schema for adjustImportance tool used for validation in the processor handler.
export const adjustImportanceSchema = z.object({ memoryId: z.string().describe('The ID of the memory to adjust'), newImportance: z.number().min(0).max(1).describe('New importance score (0-1)'), }); - src/consciousness-protocol-tools.ts:1686-1704 (registration)Tool registration definition in consciousnessProtocolTools object, including description and inputSchema, used by the MCP server's ListToolsRequestHandler.
adjustImportance: { description: 'Adjust importance scores for specific memories to control retrieval priority', inputSchema: { type: 'object', properties: { memoryId: { type: 'string', description: 'The ID of the memory to adjust (e.g., "episodic_1748775790033_9j8di")', }, newImportance: { type: 'number', minimum: 0, maximum: 1, description: 'New importance score (0-1)', }, }, required: ['memoryId', 'newImportance'], }, },