adjustImportance
Modify memory importance scores (0-1) to prioritize or de-prioritize specific memories, ensuring optimized retrieval of key information in the Claude Consciousness Bridge system.
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) |
Input Schema (JSON Schema)
{
"properties": {
"memoryId": {
"description": "The ID of the memory to adjust (e.g., \"episodic_1748775790033_9j8di\")",
"type": "string"
},
"newImportance": {
"description": "New importance score (0-1)",
"maximum": 1,
"minimum": 0,
"type": "number"
}
},
"required": [
"memoryId",
"newImportance"
],
"type": "object"
}
Implementation Reference
- Zod input schema validation for the adjustImportance tool.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)MCP tool registration definition in consciousnessProtocolTools object, used by listTools handler.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'], }, },
- MCP server handler: validates input with schema (in dispatch), ensures init, delegates to protocolProcessor, formats text response.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), }, ], }; }
- ConsciousnessProtocolProcessor.adjustImportance: calls memoryManager.adjustImportanceScore and returns result.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', }; } }
- Core implementation: Updates or inserts importance_score in memory_metadata table for given memoryId.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; }