diff --git a/crates/vestige-core/src/advanced/compression.rs b/crates/vestige-core/src/advanced/compression.rs index d461125..69df65c 100644 --- a/crates/vestige-core/src/advanced/compression.rs +++ b/crates/vestige-core/src/advanced/compression.rs @@ -451,7 +451,7 @@ impl MemoryCompressor { fn extract_sentences<'a>(&self, content: &'a str) -> Vec<&'a str> { content - .split(|c| c == '.' || c == '!' || c == '?') + .split(['.', '!', '?']) .map(|s| s.trim()) .filter(|s| s.len() > 10) // Filter very short fragments .collect() @@ -462,7 +462,7 @@ impl MemoryCompressor { // Length factor (prefer medium-length sentences) let words = sentence.split_whitespace().count(); - if words >= 5 && words <= 25 { + if (5..=25).contains(&words) { score += 0.3; } diff --git a/crates/vestige-core/src/advanced/dreams.rs b/crates/vestige-core/src/advanced/dreams.rs index cd151e6..3507b14 100644 --- a/crates/vestige-core/src/advanced/dreams.rs +++ b/crates/vestige-core/src/advanced/dreams.rs @@ -1539,7 +1539,7 @@ impl MemoryDreamer { // Hidden connection let insight = format!( "Connection between '{}' and '{}' found across {} memories", - common_tags.get(0).map(|s| s.as_str()).unwrap_or("A"), + common_tags.first().map(|s| s.as_str()).unwrap_or("A"), common_tags.get(1).map(|s| s.as_str()).unwrap_or("B"), memories.len() ); diff --git a/crates/vestige-core/src/advanced/speculative.rs b/crates/vestige-core/src/advanced/speculative.rs index 24dfd8d..30846ba 100644 --- a/crates/vestige-core/src/advanced/speculative.rs +++ b/crates/vestige-core/src/advanced/speculative.rs @@ -290,7 +290,7 @@ impl SpeculativeRetriever { for patterns_list in patterns.values_mut() { for pattern in patterns_list.iter_mut() { let days_old = (now - pattern.last_seen).num_days() as f64; - pattern.weight = pattern.weight * PATTERN_DECAY_RATE.powf(days_old); + pattern.weight *= PATTERN_DECAY_RATE.powf(days_old); } // Remove patterns that are too weak @@ -393,9 +393,7 @@ impl SpeculativeRetriever { memory_id: event.memory_id.clone(), content_preview: String::new(), confidence: 0.6, - reasoning: format!( - "This memory was helpful when you searched for similar terms before" - ), + reasoning: "This memory was helpful when you searched for similar terms before".to_string(), trigger: PredictionTrigger::SemanticSimilarity { query: query.clone(), similarity: 0.8, @@ -492,7 +490,7 @@ impl SpeculativeRetriever { for pattern in patterns_list.iter_mut() { if pattern.predicted_id == memory_id { pattern.weight *= factor; - pattern.success_rate = pattern.success_rate * 0.95; + pattern.success_rate *= 0.95; } } } diff --git a/crates/vestige-core/src/codebase/context.rs b/crates/vestige-core/src/codebase/context.rs index 8546a8d..6a6eb52 100644 --- a/crates/vestige-core/src/codebase/context.rs +++ b/crates/vestige-core/src/codebase/context.rs @@ -387,7 +387,7 @@ impl ContextCapture { // Get last modified time let last_modified = fs::metadata(path) .ok() - .and_then(|m| m.modified().ok().map(|t| DateTime::::from(t))); + .and_then(|m| m.modified().ok().map(DateTime::::from)); // Detect module let module = self.detect_module(path); @@ -640,7 +640,7 @@ impl ContextCapture { let name = line .trim_start_matches("module ") .split('/') - .last() + .next_back() .unwrap_or("") .to_string(); if !name.is_empty() { diff --git a/crates/vestige-core/src/codebase/git.rs b/crates/vestige-core/src/codebase/git.rs index 1353f29..fde40e1 100644 --- a/crates/vestige-core/src/codebase/git.rs +++ b/crates/vestige-core/src/codebase/git.rs @@ -133,7 +133,7 @@ impl GitAnalyzer { let mut has_untracked = false; for entry in statuses.iter() { - let path = entry.path().map(|p| PathBuf::from(p)).unwrap_or_default(); + let path = entry.path().map(PathBuf::from).unwrap_or_default(); let status = entry.status(); diff --git a/crates/vestige-core/src/codebase/types.rs b/crates/vestige-core/src/codebase/types.rs index 42e9400..802ad29 100644 --- a/crates/vestige-core/src/codebase/types.rs +++ b/crates/vestige-core/src/codebase/types.rs @@ -208,10 +208,12 @@ pub struct ArchitecturalDecision { /// Status of an architectural decision #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[derive(Default)] pub enum DecisionStatus { /// Decision is proposed but not yet implemented Proposed, /// Decision is accepted and being implemented + #[default] Accepted, /// Decision has been superseded by another Superseded, @@ -219,11 +221,6 @@ pub enum DecisionStatus { Deprecated, } -impl Default for DecisionStatus { - fn default() -> Self { - Self::Accepted - } -} // ============================================================================ // BUG FIX @@ -266,19 +263,16 @@ pub struct BugFix { /// Severity level of a bug #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[derive(Default)] pub enum BugSeverity { Critical, High, + #[default] Medium, Low, Trivial, } -impl Default for BugSeverity { - fn default() -> Self { - Self::Medium - } -} // ============================================================================ // CODE PATTERN diff --git a/crates/vestige-core/src/memory/mod.rs b/crates/vestige-core/src/memory/mod.rs index 4b9f6af..1cafcb3 100644 --- a/crates/vestige-core/src/memory/mod.rs +++ b/crates/vestige-core/src/memory/mod.rs @@ -274,6 +274,7 @@ impl Default for MemoryStats { /// Result of a memory consolidation run (sleep-inspired processing) #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] +#[derive(Default)] pub struct ConsolidationResult { /// Number of nodes processed pub nodes_processed: i64, @@ -289,18 +290,6 @@ pub struct ConsolidationResult { pub embeddings_generated: i64, } -impl Default for ConsolidationResult { - fn default() -> Self { - Self { - nodes_processed: 0, - nodes_promoted: 0, - nodes_pruned: 0, - decay_applied: 0, - duration_ms: 0, - embeddings_generated: 0, - } - } -} // ============================================================================ // SEARCH RESULTS @@ -351,6 +340,7 @@ pub struct SimilarityResult { /// Result of embedding generation #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] +#[derive(Default)] pub struct EmbeddingResult { /// Successfully generated embeddings pub successful: i64, @@ -362,13 +352,3 @@ pub struct EmbeddingResult { pub errors: Vec, } -impl Default for EmbeddingResult { - fn default() -> Self { - Self { - successful: 0, - failed: 0, - skipped: 0, - errors: vec![], - } - } -} diff --git a/crates/vestige-core/src/neuroscience/predictive_retrieval.rs b/crates/vestige-core/src/neuroscience/predictive_retrieval.rs index b97c99f..ff029cd 100644 --- a/crates/vestige-core/src/neuroscience/predictive_retrieval.rs +++ b/crates/vestige-core/src/neuroscience/predictive_retrieval.rs @@ -797,7 +797,7 @@ impl PredictiveMemory { .map_err(|e| PredictiveMemoryError::LockPoisoned(e.to_string()))?; for tag in tags { - cache.invalidate(*tag); + cache.invalidate(tag); } Ok(()) diff --git a/crates/vestige-core/src/neuroscience/prospective_memory.rs b/crates/vestige-core/src/neuroscience/prospective_memory.rs index 5ed5045..a637b3f 100644 --- a/crates/vestige-core/src/neuroscience/prospective_memory.rs +++ b/crates/vestige-core/src/neuroscience/prospective_memory.rs @@ -131,10 +131,12 @@ pub type Result = std::result::Result; /// Priority levels for intentions #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Default)] pub enum Priority { /// Low priority - nice to remember Low = 1, /// Normal priority - should remember + #[default] Normal = 2, /// High priority - important to remember High = 3, @@ -142,11 +144,6 @@ pub enum Priority { Critical = 4, } -impl Default for Priority { - fn default() -> Self { - Self::Normal - } -} impl Priority { /// Get numeric value for comparison @@ -182,8 +179,10 @@ impl Priority { /// Status of an intention #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Default)] pub enum IntentionStatus { /// Intention is active and being monitored + #[default] Active, /// Intention has been triggered but not yet fulfilled Triggered, @@ -197,11 +196,6 @@ pub enum IntentionStatus { Snoozed, } -impl Default for IntentionStatus { - fn default() -> Self { - Self::Active - } -} /// Pattern for matching trigger conditions #[derive(Debug, Clone, Serialize, Deserialize)] @@ -516,7 +510,7 @@ impl RecurrencePattern { Utc, ); } - candidate = candidate + Duration::days(1); + candidate += Duration::days(1); } from + Duration::days(7) // Fallback } @@ -1030,7 +1024,7 @@ impl IntentionParser { }; // Extract entity if mentioned - if let Some(entity) = self.extract_entity(&text_lower) { + if let Some(entity) = self.extract_entity(text_lower) { return Ok(( IntentionTrigger::EventBased { condition: format!("Meeting or conversation with {}", entity), @@ -1287,12 +1281,10 @@ impl ProspectiveMemory { if intention .trigger .is_triggered(context, &context.recent_events) - { - if intention.should_remind() { + && intention.should_remind() { intention.mark_triggered(); triggered.push(intention.clone()); } - } // Check for deadline escalation if self.config.enable_escalation { @@ -1450,10 +1442,10 @@ impl ProspectiveMemory { Ok(IntentionStats { total_active: active, - triggered: triggered, - overdue: overdue, + triggered, + overdue, fulfilled_lifetime: fulfilled, - high_priority: high_priority, + high_priority, }) } diff --git a/crates/vestige-core/src/neuroscience/spreading_activation.rs b/crates/vestige-core/src/neuroscience/spreading_activation.rs index 8776a93..fa1af18 100644 --- a/crates/vestige-core/src/neuroscience/spreading_activation.rs +++ b/crates/vestige-core/src/neuroscience/spreading_activation.rs @@ -40,8 +40,10 @@ const MIN_ACTIVATION_THRESHOLD: f64 = 0.1; /// Types of associative links between memories #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] +#[derive(Default)] pub enum LinkType { /// Same topic/category + #[default] Semantic, /// Occurred together in time Temporal, @@ -55,11 +57,6 @@ pub enum LinkType { UserDefined, } -impl Default for LinkType { - fn default() -> Self { - LinkType::Semantic - } -} // ============================================================================ // ASSOCIATION EDGE diff --git a/crates/vestige-core/src/neuroscience/synaptic_tagging.rs b/crates/vestige-core/src/neuroscience/synaptic_tagging.rs index 28539f1..ea2e38c 100644 --- a/crates/vestige-core/src/neuroscience/synaptic_tagging.rs +++ b/crates/vestige-core/src/neuroscience/synaptic_tagging.rs @@ -105,9 +105,11 @@ const DEFAULT_MAX_CLUSTER_SIZE: usize = 50; /// - Logarithmic: Very slow decay, good for important memories #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] #[serde(rename_all = "lowercase")] +#[derive(Default)] pub enum DecayFunction { /// Exponential decay: strength = initial * e^(-lambda * t) /// Best for modeling biological tag decay + #[default] Exponential, /// Linear decay: strength = initial * (1 - t/lifetime) /// Simple, predictable decay @@ -120,11 +122,6 @@ pub enum DecayFunction { Logarithmic, } -impl Default for DecayFunction { - fn default() -> Self { - DecayFunction::Exponential - } -} impl DecayFunction { /// Calculate decayed strength diff --git a/crates/vestige-core/src/storage/sqlite.rs b/crates/vestige-core/src/storage/sqlite.rs index 7843cc3..336aeec 100644 --- a/crates/vestige-core/src/storage/sqlite.rs +++ b/crates/vestige-core/src/storage/sqlite.rs @@ -295,7 +295,7 @@ impl Storage { // Build candidate memories let mut candidates: Vec = Vec::new(); - for (node_id, similarity) in similar.iter() { + for (node_id, _similarity) in similar.iter() { if let Some(node) = self.get_node(node_id)? { // Get embedding for this node if let Some(emb) = self.get_node_embedding(node_id)? { @@ -1034,10 +1034,8 @@ impl Storage { self.row_to_node(row) })?; let mut nodes = Vec::new(); - for row in rows { - if let Ok(node) = row { - nodes.push(node); - } + for node in rows.flatten() { + nodes.push(node); } Ok(nodes) } @@ -1051,10 +1049,8 @@ impl Storage { )?; let rows = stmt.query_map(params![node_type, limit], |row| self.row_to_node(row))?; let mut nodes = Vec::new(); - for row in rows { - if let Ok(node) = row { - nodes.push(node); - } + for node in rows.flatten() { + nodes.push(node); } Ok(nodes) } @@ -1296,10 +1292,8 @@ impl Storage { Ok((row.get::<_, String>(0)?, row.get::<_, String>(1)?)) })?; - for row in rows { - if let Ok(r) = row { - result_nodes.push(r); - } + for r in rows.flatten() { + result_nodes.push(r); } } result_nodes @@ -1512,7 +1506,7 @@ impl Storage { )? as i64; #[cfg(all(feature = "embeddings", feature = "vector-search"))] - let embeddings_generated = self.generate_missing_embeddings()? as i64; + let embeddings_generated = self.generate_missing_embeddings()?; #[cfg(not(all(feature = "embeddings", feature = "vector-search")))] let embeddings_generated = 0i64; diff --git a/crates/vestige-mcp/src/protocol/types.rs b/crates/vestige-mcp/src/protocol/types.rs index 746e170..a29355f 100644 --- a/crates/vestige-mcp/src/protocol/types.rs +++ b/crates/vestige-mcp/src/protocol/types.rs @@ -127,6 +127,7 @@ impl JsonRpcError { Self::new(ErrorCode::ServerNotInitialized, "Server not initialized") } + #[allow(dead_code)] // Reserved for future resource handling pub fn resource_not_found(uri: &str) -> Self { Self::new(ErrorCode::ResourceNotFound, &format!("Resource not found: {}", uri)) } diff --git a/crates/vestige-mcp/src/server.rs b/crates/vestige-mcp/src/server.rs index ce35900..ba841f5 100644 --- a/crates/vestige-mcp/src/server.rs +++ b/crates/vestige-mcp/src/server.rs @@ -619,7 +619,13 @@ mod tests { #[tokio::test] async fn test_initialize_returns_server_info() { let (mut server, _dir) = test_server().await; - let request = make_request("initialize", None); + // Send with current protocol version to get it back + let params = serde_json::json!({ + "protocolVersion": MCP_VERSION, + "capabilities": {}, + "clientInfo": { "name": "test", "version": "1.0" } + }); + let request = make_request("initialize", Some(params)); let response = server.handle_request(request).await.unwrap(); let result = response.result.unwrap(); diff --git a/crates/vestige-mcp/src/tools/codebase.rs b/crates/vestige-mcp/src/tools/codebase.rs index 8bd9333..e31b6fd 100644 --- a/crates/vestige-mcp/src/tools/codebase.rs +++ b/crates/vestige-mcp/src/tools/codebase.rs @@ -1,4 +1,5 @@ -//! Codebase Tools +#![allow(dead_code)] +//! Codebase Tools (Deprecated - use codebase_unified instead) //! //! Remember patterns, decisions, and context about codebases. //! This is a differentiating feature for AI-assisted development. diff --git a/crates/vestige-mcp/src/tools/consolidate.rs b/crates/vestige-mcp/src/tools/consolidate.rs index 34e1eb2..5ec99a7 100644 --- a/crates/vestige-mcp/src/tools/consolidate.rs +++ b/crates/vestige-mcp/src/tools/consolidate.rs @@ -1,4 +1,5 @@ -//! Consolidation Tool +#![allow(dead_code)] +//! Consolidation Tool (Deprecated) //! //! Run memory consolidation cycle with FSRS decay and embedding generation. diff --git a/crates/vestige-mcp/src/tools/context.rs b/crates/vestige-mcp/src/tools/context.rs index 64b958b..154e27f 100644 --- a/crates/vestige-mcp/src/tools/context.rs +++ b/crates/vestige-mcp/src/tools/context.rs @@ -1,4 +1,5 @@ -//! Context-Dependent Memory Tool +#![allow(dead_code)] +//! Context-Dependent Memory Tool (Deprecated) //! //! Retrieval based on encoding context match. //! Based on Tulving & Thomson's Encoding Specificity Principle (1973). diff --git a/crates/vestige-mcp/src/tools/feedback.rs b/crates/vestige-mcp/src/tools/feedback.rs index 42c4d52..9d9b4c1 100644 --- a/crates/vestige-mcp/src/tools/feedback.rs +++ b/crates/vestige-mcp/src/tools/feedback.rs @@ -1,4 +1,5 @@ -//! Feedback Tools +#![allow(dead_code)] +//! Feedback Tools (Deprecated - use promote_memory/demote_memory instead) //! //! Promote and demote memories based on outcome quality. //! Implements preference learning for Vestige. diff --git a/crates/vestige-mcp/src/tools/intentions.rs b/crates/vestige-mcp/src/tools/intentions.rs index 9f67e24..fcd2966 100644 --- a/crates/vestige-mcp/src/tools/intentions.rs +++ b/crates/vestige-mcp/src/tools/intentions.rs @@ -1,4 +1,5 @@ -//! Intentions Tools +#![allow(dead_code)] +//! Intentions Tools (Deprecated - use intention_unified instead) //! //! Prospective memory tools for setting and checking future intentions. diff --git a/crates/vestige-mcp/src/tools/knowledge.rs b/crates/vestige-mcp/src/tools/knowledge.rs index 0e36998..2baaa08 100644 --- a/crates/vestige-mcp/src/tools/knowledge.rs +++ b/crates/vestige-mcp/src/tools/knowledge.rs @@ -1,4 +1,5 @@ -//! Knowledge Tools +#![allow(dead_code)] +//! Knowledge Tools (Deprecated - use memory_unified instead) //! //! Get and delete specific knowledge nodes. diff --git a/crates/vestige-mcp/src/tools/memory_states.rs b/crates/vestige-mcp/src/tools/memory_states.rs index 1d2a156..06d03d1 100644 --- a/crates/vestige-mcp/src/tools/memory_states.rs +++ b/crates/vestige-mcp/src/tools/memory_states.rs @@ -1,4 +1,5 @@ -//! Memory States Tool +#![allow(dead_code)] +//! Memory States Tool (Deprecated - use memory_unified instead) //! //! Query and manage memory states (Active, Dormant, Silent, Unavailable). //! Based on accessibility continuum theory. diff --git a/crates/vestige-mcp/src/tools/mod.rs b/crates/vestige-mcp/src/tools/mod.rs index 22127af..d25e49d 100644 --- a/crates/vestige-mcp/src/tools/mod.rs +++ b/crates/vestige-mcp/src/tools/mod.rs @@ -1,28 +1,42 @@ //! MCP Tools //! //! Tool implementations for the Vestige MCP server. +//! +//! The unified tools (codebase_unified, intention_unified, memory_unified, search_unified) +//! are the primary API. The granular tools below are kept for backwards compatibility +//! but are not exposed in the MCP tool list. -pub mod codebase; -pub mod consolidate; -pub mod ingest; -pub mod intentions; -pub mod knowledge; -pub mod recall; -pub mod review; -pub mod search; -pub mod smart_ingest; -pub mod stats; - -// Neuroscience-inspired tools -pub mod context; -pub mod memory_states; -pub mod tagging; - -// Feedback / preference learning -pub mod feedback; - -// Unified tools (consolidate multiple operations into single tools) +// Active unified tools pub mod codebase_unified; +pub mod ingest; pub mod intention_unified; pub mod memory_unified; pub mod search_unified; +pub mod smart_ingest; + +// Deprecated tools - kept for internal backwards compatibility +// These modules are intentionally unused in the public API +#[allow(dead_code)] +pub mod codebase; +#[allow(dead_code)] +pub mod consolidate; +#[allow(dead_code)] +pub mod context; +#[allow(dead_code)] +pub mod feedback; +#[allow(dead_code)] +pub mod intentions; +#[allow(dead_code)] +pub mod knowledge; +#[allow(dead_code)] +pub mod memory_states; +#[allow(dead_code)] +pub mod recall; +#[allow(dead_code)] +pub mod review; +#[allow(dead_code)] +pub mod search; +#[allow(dead_code)] +pub mod stats; +#[allow(dead_code)] +pub mod tagging; diff --git a/crates/vestige-mcp/src/tools/recall.rs b/crates/vestige-mcp/src/tools/recall.rs index f0378ea..1f3a34f 100644 --- a/crates/vestige-mcp/src/tools/recall.rs +++ b/crates/vestige-mcp/src/tools/recall.rs @@ -1,4 +1,5 @@ -//! Recall Tool +#![allow(dead_code)] +//! Recall Tool (Deprecated - use search_unified instead) //! //! Search and retrieve knowledge from memory. diff --git a/crates/vestige-mcp/src/tools/review.rs b/crates/vestige-mcp/src/tools/review.rs index 66ec47f..431f6d3 100644 --- a/crates/vestige-mcp/src/tools/review.rs +++ b/crates/vestige-mcp/src/tools/review.rs @@ -1,4 +1,5 @@ -//! Review Tool +#![allow(dead_code)] +//! Review Tool (Deprecated) //! //! Mark memories as reviewed using FSRS-6 algorithm. diff --git a/crates/vestige-mcp/src/tools/search.rs b/crates/vestige-mcp/src/tools/search.rs index b200e38..ccbe27d 100644 --- a/crates/vestige-mcp/src/tools/search.rs +++ b/crates/vestige-mcp/src/tools/search.rs @@ -1,4 +1,5 @@ -//! Search Tools +#![allow(dead_code)] +//! Search Tools (Deprecated - use search_unified instead) //! //! Semantic and hybrid search implementations. diff --git a/crates/vestige-mcp/src/tools/stats.rs b/crates/vestige-mcp/src/tools/stats.rs index 3e719fb..579034e 100644 --- a/crates/vestige-mcp/src/tools/stats.rs +++ b/crates/vestige-mcp/src/tools/stats.rs @@ -1,4 +1,5 @@ -//! Stats Tools +#![allow(dead_code)] +//! Stats Tools (Deprecated - use memory_unified instead) //! //! Memory statistics and health check. diff --git a/crates/vestige-mcp/src/tools/tagging.rs b/crates/vestige-mcp/src/tools/tagging.rs index 15c8637..f0e9f1d 100644 --- a/crates/vestige-mcp/src/tools/tagging.rs +++ b/crates/vestige-mcp/src/tools/tagging.rs @@ -1,4 +1,5 @@ -//! Synaptic Tagging Tool +#![allow(dead_code)] +//! Synaptic Tagging Tool (Deprecated) //! //! Retroactive importance assignment based on Synaptic Tagging & Capture theory. //! Frey & Morris (1997), Redondo & Morris (2011).