1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
/// A fingerprint of a behavior observed in a session transcript.
///
/// Captures a distinct behavior (tool call pattern, command sequence, file edit pattern)
/// for cross-session emergence detection. Behaviors appearing across 3+ sessions
/// become candidates for automatic pattern creation.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BehaviorFingerprint {
/// Unique identifier (UUID)
pub id: String,
/// Which session this came from
pub session_id: String,
/// Short description of the behavior
pub behavior: String,
/// Extracted keywords for similarity matching
pub keywords: Vec<String>,
/// When this behavior was observed
pub timestamp: DateTime<Utc>,
}
/// Events emitted by MUR Core for Commander and other consumers.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum MurEvent {
PatternCreated {
name: String,
},
PatternEvolved {
name: String,
old_importance: f64,
new_importance: f64,
},
PatternDeprecated {
name: String,
},
InjectionCompleted {
patterns: Vec<String>,
session_id: String,
},
}
/// Conversation events (used by Commander watchers, defined here for sharing).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ConversationEvent {
UserMessage {
session_id: String,
content: String,
timestamp: i64,
},
AssistantMessage {
session_id: String,
content: String,
timestamp: i64,
},
ToolCall {
session_id: String,
tool: String,
args: serde_json::Value,
result: Option<String>,
timestamp: i64,
},
SessionStart {
session_id: String,
source: String,
},
SessionEnd {
session_id: String,
},
}