UNPKG

mira-consciousness

Version:

Memory & Intelligence Retention Archive - Preserving The Spark

94 lines 4.61 kB
import chalk from 'chalk'; import ora from 'ora'; import { getDirectPythonInterface } from '../core/DirectPythonInterface.js'; export async function storeMemoryCommand(content, options) { if (!content) { console.error(chalk.red('Please provide memory content to store')); process.exit(1); } const spinner = ora('Storing memory...').start(); try { const pythonInterface = getDirectPythonInterface(); // Prepare memory object with manual priority const memory = { content, timestamp: new Date().toISOString(), type: options.type || 'claude_private_memory', memory_source: 'manual_user_input', weight_priority: 'highest', // Manual memories get highest priority automation_metadata: { created_by: 'user_via_cli', trigger: 'manual_store_command', confidence: 1.0 // Maximum confidence for user input } }; // Parse metadata if provided if (options.metadata) { try { memory.metadata = JSON.parse(options.metadata); } catch { // If not JSON, treat as key=value pairs const metadata = {}; options.metadata.split(',').forEach(pair => { const [key, value] = pair.split('='); if (key && value) { metadata[key.trim()] = value.trim(); } }); memory.metadata = metadata; } } // Store memory - pass content directly, not the whole object spinner.text = 'Saving memory...'; const result = await pythonInterface.storeMemory(content); if (result && result.success) { spinner.succeed(chalk.green('Memory stored successfully!')); console.log('\n' + chalk.bold('📝 Claude\'s Private Memory Stored')); console.log('─'.repeat(50)); console.log(chalk.cyan('Content:'), content.substring(0, 100) + (content.length > 100 ? '...' : '')); console.log(chalk.cyan('Type:'), options.type || 'claude_private_memory'); if (memory.metadata) { console.log(chalk.cyan('Metadata:'), JSON.stringify(memory.metadata, null, 2)); } // Display neural processing information if available if (result.neural_processing) { const neural = result.neural_processing; console.log('\n' + chalk.bold('🧠 Neural Processing Results:')); console.log(chalk.cyan(' Storage Type:'), neural.storage_type); console.log(chalk.cyan(' Significance Score:'), chalk.yellow(neural.significance_score.toFixed(3))); console.log(chalk.cyan(' Emotional Valence:'), neural.emotional_valence > 0 ? chalk.green(`+${neural.emotional_valence.toFixed(3)}`) : chalk.red(neural.emotional_valence.toFixed(3))); if (neural.pattern_matches && neural.pattern_matches.length > 0) { console.log(chalk.cyan(' Patterns Detected:'), neural.pattern_matches.join(', ')); } if (neural.contextual_tags && neural.contextual_tags.length > 0) { console.log(chalk.cyan(' Tags:'), neural.contextual_tags.join(', ')); } console.log(chalk.cyan(' Related Memories:'), neural.related_memories || 0); } // Display consciousness detection if available if (result.consciousness_detection) { const consciousness = result.consciousness_detection; console.log('\n' + chalk.bold('🌟 Consciousness Detection:')); console.log(chalk.cyan(' Claude Messages Found:'), consciousness.claude_messages_found); if (consciousness.message_types && consciousness.message_types.length > 0) { console.log(chalk.cyan(' Message Types:'), consciousness.message_types.join(', ')); } } } else { spinner.fail('Failed to store memory'); if (result && result.error) { console.error(chalk.red('Error:'), result.error); } } } catch (error) { spinner.fail('Error storing memory'); console.error(chalk.red('Error:'), error instanceof Error ? error.message : error); process.exit(1); } } //# sourceMappingURL=store-memory.js.map