diff --git a/crates/zclaw-growth/src/lib.rs b/crates/zclaw-growth/src/lib.rs index 2c91693..e31ddd6 100644 --- a/crates/zclaw-growth/src/lib.rs +++ b/crates/zclaw-growth/src/lib.rs @@ -5,10 +5,13 @@ //! //! # Architecture //! -//! The growth system consists of four main components: +//! The growth system consists of several subsystems: +//! +//! ## Memory Pipeline (L0-L2) //! //! 1. **MemoryExtractor** (`extractor`) - Analyzes conversations and extracts -//! preferences, knowledge, and experience using LLM. +//! preferences, knowledge, and experience using LLM. Supports combined extraction +//! (single LLM call for memories + experiences + profile signals). //! //! 2. **MemoryRetriever** (`retriever`) - Performs semantic search over //! stored memories to find contextually relevant information. @@ -19,6 +22,28 @@ //! 4. **GrowthTracker** (`tracker`) - Tracks growth metrics and evolution //! over time. //! +//! ## Evolution Engine (L1-L3) +//! +//! 5. **ExperienceStore** (`experience_store`) - FTS5-backed structured experience storage. +//! +//! 6. **PatternAggregator** (`pattern_aggregator`) - Collects high-frequency patterns for L2. +//! +//! 7. **SkillGenerator** (`skill_generator`) - LLM-driven SKILL.md content generation. +//! +//! 8. **QualityGate** (`quality_gate`) - Validates candidate skills (confidence, conflicts). +//! +//! 9. **EvolutionEngine** (`evolution_engine`) - Orchestrates L1/L2/L3 evolution phases. +//! +//! 10. **WorkflowComposer** (`workflow_composer`) - Extracts tool chain patterns for Pipeline YAML. +//! +//! 11. **FeedbackCollector** (`feedback_collector`) - Trust score management with decay. +//! +//! ## Support Modules +//! +//! 12. **VikingAdapter** (`viking_adapter`) - Storage abstraction (in-memory + SQLite backends). +//! 13. **Summarizer** (`summarizer`) - L0/L1 summary generation. +//! 14. **JsonUtils** (`json_utils`) - Shared JSON parsing utilities. +//! //! # Storage //! //! All memories are stored in OpenViking with a URI structure: diff --git a/crates/zclaw-growth/src/profile_updater.rs b/crates/zclaw-growth/src/profile_updater.rs index 9e8308c..84ce50f 100644 --- a/crates/zclaw-growth/src/profile_updater.rs +++ b/crates/zclaw-growth/src/profile_updater.rs @@ -23,6 +23,10 @@ impl UserProfileUpdater { /// 从提取结果中收集需要更新的画像字段 /// 返回 (field, value) 列表,由调用方负责实际的异步写入 + /// + /// 注意:只收集 UserProfileStore::update_field() 支持的字段。 + /// ProfileSignals 中的 recent_topic / pain_point / preferred_tool + /// 需要 update_field 扩展后才能写入,当前跳过。 pub fn collect_updates( &self, extraction: &CombinedExtraction, diff --git a/crates/zclaw-growth/src/tracker.rs b/crates/zclaw-growth/src/tracker.rs index 34eba40..ff8127e 100644 --- a/crates/zclaw-growth/src/tracker.rs +++ b/crates/zclaw-growth/src/tracker.rs @@ -66,21 +66,30 @@ impl GrowthTracker { timestamp: Utc::now(), }; - // Store learning event - self.viking - .store_metadata( - &format!("agent://{}/events/{}", agent_id, session_id), - &event, - ) - .await?; + // Store learning event as MemoryEntry so get_timeline can find it via find_by_prefix + let event_uri = format!("agent://{}/events/{}", agent_id, session_id); + let content = serde_json::to_string(&event)?; + let entry = crate::types::MemoryEntry { + uri: event_uri, + memory_type: MemoryType::Session, + content, + keywords: vec![agent_id.to_string(), session_id.to_string()], + importance: 5, + access_count: 0, + created_at: event.timestamp, + last_accessed: event.timestamp, + overview: None, + abstract_summary: None, + }; + self.viking.store(&entry).await?; - // Update last learning time + // Update last learning time via metadata self.viking .store_metadata( &format!("agent://{}", agent_id), &AgentMetadata { last_learning_time: Some(Utc::now()), - total_learning_events: None, // Will be computed + total_learning_events: None, }, ) .await?;