feat(hermes): implement intelligence pipeline — 4 chunks, 684 tests passing
Hermes Intelligence Pipeline closes breakpoints in ZCLAW's existing intelligence components with 4 self-contained modules: Chunk 1 — Self-improvement Loop: - ExperienceStore (zclaw-growth): FTS5+TF-IDF wrapper with scope prefix - ExperienceExtractor (desktop/intelligence): template-based extraction from successful proposals with implicit keyword detection Chunk 2 — User Modeling: - UserProfileStore (zclaw-memory): SQLite-backed structured profiles with industry/role/expertise/comm_style/recent_topics/pain_points - UserProfiler (desktop/intelligence): fact classification by category (Preference/Knowledge/Behavior) with profile summary formatting Chunk 3 — NL Cron Chinese Time Parser: - NlScheduleParser (zclaw-runtime): 6 pattern matchers for Chinese time expressions (每天/每周/工作日/间隔/每月/一次性) producing cron expressions - Period-aware hour adjustment (下午3点→15, 晚上8点→20) - Schedule intent detection + task description extraction Chunk 4 — Trajectory Compression: - TrajectoryStore (zclaw-memory): trajectory_events + compressed_trajectories - TrajectoryRecorderMiddleware (zclaw-runtime/middleware): priority 650, async non-blocking event recording via tokio::spawn - TrajectoryCompressor (desktop/intelligence): dedup, request classification, satisfaction detection, execution chain JSON Schema migrations: v2→v3 (user_profiles), v3→v4 (trajectory tables)
This commit is contained in:
@@ -93,4 +93,47 @@ pub const MIGRATIONS: &[&str] = &[
|
||||
// v1→v2: persist runtime state and message count
|
||||
"ALTER TABLE agents ADD COLUMN state TEXT NOT NULL DEFAULT 'running'",
|
||||
"ALTER TABLE agents ADD COLUMN message_count INTEGER NOT NULL DEFAULT 0",
|
||||
// v2→v3: user profiles for structured user modeling
|
||||
"CREATE TABLE IF NOT EXISTS user_profiles (
|
||||
user_id TEXT PRIMARY KEY,
|
||||
industry TEXT,
|
||||
role TEXT,
|
||||
expertise_level TEXT,
|
||||
communication_style TEXT,
|
||||
preferred_language TEXT DEFAULT 'zh-CN',
|
||||
recent_topics TEXT DEFAULT '[]',
|
||||
active_pain_points TEXT DEFAULT '[]',
|
||||
preferred_tools TEXT DEFAULT '[]',
|
||||
confidence REAL DEFAULT 0.0,
|
||||
updated_at TEXT NOT NULL
|
||||
)",
|
||||
// v3→v4: trajectory recording for tool-call chain analysis
|
||||
"CREATE TABLE IF NOT EXISTS trajectory_events (
|
||||
id TEXT PRIMARY KEY,
|
||||
session_id TEXT NOT NULL,
|
||||
agent_id TEXT NOT NULL,
|
||||
step_index INTEGER NOT NULL,
|
||||
step_type TEXT NOT NULL,
|
||||
input_summary TEXT,
|
||||
output_summary TEXT,
|
||||
duration_ms INTEGER DEFAULT 0,
|
||||
timestamp TEXT NOT NULL
|
||||
)",
|
||||
"CREATE INDEX IF NOT EXISTS idx_trajectory_session ON trajectory_events(session_id)",
|
||||
"CREATE TABLE IF NOT EXISTS compressed_trajectories (
|
||||
id TEXT PRIMARY KEY,
|
||||
session_id TEXT NOT NULL,
|
||||
agent_id TEXT NOT NULL,
|
||||
request_type TEXT NOT NULL,
|
||||
tools_used TEXT,
|
||||
outcome TEXT NOT NULL,
|
||||
total_steps INTEGER DEFAULT 0,
|
||||
total_duration_ms INTEGER DEFAULT 0,
|
||||
total_tokens INTEGER DEFAULT 0,
|
||||
execution_chain TEXT NOT NULL,
|
||||
satisfaction_signal TEXT,
|
||||
created_at TEXT NOT NULL
|
||||
)",
|
||||
"CREATE INDEX IF NOT EXISTS idx_ct_request_type ON compressed_trajectories(request_type)",
|
||||
"CREATE INDEX IF NOT EXISTS idx_ct_outcome ON compressed_trajectories(outcome)",
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user