Add heartbeat thought appraisals
This commit is contained in:
parent
abe0e771df
commit
3dcd6fb189
7 changed files with 482 additions and 7 deletions
|
|
@ -198,12 +198,17 @@ fn character_turn_packet(
|
|||
"bridge": {
|
||||
"schema_version": "epiphany.cognition_bridge.v0",
|
||||
"contract": "Synthesize or separate the lanes, name saturation and unresolved tension, then choose bubble, draft, finding, silence, or selfPatch. The bridge may steer attention; it may not mutate project truth."
|
||||
},
|
||||
"appraisal": {
|
||||
"schema_version": "epiphany.agent_thought_appraisal.v0",
|
||||
"contract": "Project the active thought cluster through this actor's own personality vectors before reacting. Interpretation, emotion, and reaction are participant-local; state mutation still requires reviewed selfPatch or project-state acceptance."
|
||||
}
|
||||
},
|
||||
"guardrails": [
|
||||
"Humans talk to Face; other organs expose internals through Aquarium and typed artifacts rather than becoming direct chats.",
|
||||
"Use character-local projection: the actor receives its own dossier and visible stimulus, not omniscient hidden state.",
|
||||
"Run both cognition lanes before choosing an output: analytic keeps the promise honest, associative keeps the living signal from going flat.",
|
||||
"Appraise the thought cluster through this role's personality before reacting; do not use a global mood knob as a substitute for participant-local appraisal.",
|
||||
"If speech or action would be noise, return silence plus bounded rumination or selfPatch.",
|
||||
"Posting, state mutation, objective adoption, and semantic acceptance remain separate reviewed Epiphany surfaces."
|
||||
],
|
||||
|
|
@ -215,6 +220,8 @@ fn character_turn_packet(
|
|||
"analyticThread": "object",
|
||||
"associativeThread": "object",
|
||||
"bridgeSynthesis": "object",
|
||||
"appraisal": "object",
|
||||
"reaction": "object",
|
||||
"decision": "bubble|draft|finding|silence|blocked",
|
||||
"selfPatch": "optional bounded role memory mutation"
|
||||
}
|
||||
|
|
@ -262,7 +269,9 @@ fn run_smoke() -> Result<Value> {
|
|||
.as_str()
|
||||
.is_some_and(|text| text.contains("Aquarium"))
|
||||
&& packet["cognitionLanes"]["schema_version"] == "epiphany.cognition_lanes.v0"
|
||||
&& packet["cognitionLanes"]["bridge"]["schema_version"] == "epiphany.cognition_bridge.v0";
|
||||
&& packet["cognitionLanes"]["bridge"]["schema_version"] == "epiphany.cognition_bridge.v0"
|
||||
&& packet["cognitionLanes"]["appraisal"]["schema_version"]
|
||||
== "epiphany.agent_thought_appraisal.v0";
|
||||
Ok(serde_json::json!({
|
||||
"ok": ok,
|
||||
"turnPath": path,
|
||||
|
|
|
|||
|
|
@ -387,6 +387,9 @@ fn run_smoke(agent_store: &Path) -> Result<serde_json::Value> {
|
|||
&& routine["routine"]["bridge"]["schema_version"] == "epiphany.cognition_bridge.v0"
|
||||
&& routine["routine"]["candidateInterventions"]["schema_version"]
|
||||
== "epiphany.candidate_interventions.v0"
|
||||
&& routine["routine"]["appraisals"]["schema_version"]
|
||||
== "epiphany.agent_thought_appraisals.v0"
|
||||
&& routine["routine"]["reactions"]["schema_version"] == "epiphany.agent_reactions.v0"
|
||||
&& routine_status["sleepCycle"]["schema_version"] == "epiphany.sleep_cycle.v0";
|
||||
|
||||
let result = serde_json::json!({
|
||||
|
|
|
|||
|
|
@ -70,6 +70,10 @@ pub struct EpiphanyHeartbeatStateEntry {
|
|||
#[cultcache(key = 12, default)]
|
||||
pub candidate_interventions: Option<Value>,
|
||||
#[cultcache(key = 13, default)]
|
||||
pub appraisals: Option<Value>,
|
||||
#[cultcache(key = 14, default)]
|
||||
pub reactions: Option<Value>,
|
||||
#[cultcache(key = 15, default)]
|
||||
pub extra: BTreeMap<String, Value>,
|
||||
}
|
||||
|
||||
|
|
@ -348,6 +352,8 @@ pub fn default_heartbeat_state(target_heartbeat_rate: f64) -> EpiphanyHeartbeatS
|
|||
thought_lanes: None,
|
||||
bridge: None,
|
||||
candidate_interventions: None,
|
||||
appraisals: None,
|
||||
reactions: None,
|
||||
extra: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
|
|
@ -454,6 +460,8 @@ pub fn heartbeat_status_projection(
|
|||
"thoughtLanes": state.thought_lanes,
|
||||
"bridge": state.bridge,
|
||||
"candidateInterventions": state.candidate_interventions,
|
||||
"appraisals": state.appraisals,
|
||||
"reactions": state.reactions,
|
||||
"availableActions": ["init", "tick", "complete", "status", "routine"],
|
||||
}))
|
||||
}
|
||||
|
|
@ -469,11 +477,15 @@ pub fn run_void_routine_store(
|
|||
patch_missing_participants(&mut state);
|
||||
|
||||
let memory_records = collect_role_memory_records(options.agent_store.as_deref())?;
|
||||
let appraisal_profiles = collect_role_appraisal_profiles(options.agent_store.as_deref())?;
|
||||
let resonance = build_memory_resonance(&memory_records);
|
||||
let incubation = build_incubation(&state.incubation, &resonance, &memory_records);
|
||||
let thought_lanes = build_thought_lanes(&resonance, &incubation, &memory_records);
|
||||
let bridge = build_thought_bridge(&state.bridge, &thought_lanes, &resonance, &incubation);
|
||||
let candidate_interventions = build_candidate_interventions(&bridge, &incubation);
|
||||
let appraisals =
|
||||
build_agent_appraisals(&appraisal_profiles, &thought_lanes, &incubation, &bridge);
|
||||
let reactions = build_agent_reactions(&appraisals, &bridge);
|
||||
let sleep_cycle =
|
||||
update_sleep_cycle(state.sleep_cycle.as_ref(), &incubation, options.allow_dream);
|
||||
let run_id = format!("epiphany-void-routine-{}", now_stamp());
|
||||
|
|
@ -491,10 +503,13 @@ pub fn run_void_routine_store(
|
|||
"thoughtLanes": thought_lanes,
|
||||
"bridge": bridge,
|
||||
"candidateInterventions": candidate_interventions,
|
||||
"appraisals": appraisals,
|
||||
"reactions": reactions,
|
||||
"reviewNotes": [
|
||||
"Void is reference material, not a runtime dependency.",
|
||||
"The routine mutates only typed heartbeat physiology fields; project truth and role memory mutation stay on their dedicated reviewed surfaces.",
|
||||
"Analytic and associative lanes are cognition context, not hidden authority; the bridge decides draft, speech, silence, or further incubation.",
|
||||
"Appraisal projects clustered thoughts through each agent's own personality vectors; reaction is derived from that appraisal and remains separate from state mutation.",
|
||||
"Sleep is maintenance: slow rumination, memory compression, and dream residue, not absence."
|
||||
],
|
||||
});
|
||||
|
|
@ -505,6 +520,8 @@ pub fn run_void_routine_store(
|
|||
state.thought_lanes = Some(thought_lanes);
|
||||
state.bridge = Some(bridge);
|
||||
state.candidate_interventions = Some(candidate_interventions);
|
||||
state.appraisals = Some(appraisals);
|
||||
state.reactions = Some(reactions);
|
||||
state.extra.insert(
|
||||
"voidRoutine".to_string(),
|
||||
serde_json::json!({
|
||||
|
|
@ -1227,6 +1244,8 @@ fn artifact_summary(payload: &Value) -> Value {
|
|||
"isNapping": payload.pointer("/sleepCycle/isNapping"),
|
||||
"resonanceCount": payload.pointer("/memoryResonance/pairs").and_then(Value::as_array).map(Vec::len),
|
||||
"incubationCount": payload.pointer("/incubation/themes").and_then(Value::as_array).map(Vec::len),
|
||||
"appraisalCount": payload.pointer("/appraisals/participantAppraisals").and_then(Value::as_array).map(Vec::len),
|
||||
"reactionCount": payload.pointer("/reactions/reactions").and_then(Value::as_array).map(Vec::len),
|
||||
});
|
||||
}
|
||||
let event = if payload.get("actionId").is_some() {
|
||||
|
|
@ -1397,6 +1416,28 @@ struct RoleMemoryRecord {
|
|||
tokens: BTreeSet<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct RoleAppraisalProfile {
|
||||
role_id: String,
|
||||
agent_id: String,
|
||||
display_name: String,
|
||||
traits: Vec<PersonalityTraitProjection>,
|
||||
reactivity: f64,
|
||||
plasticity: f64,
|
||||
expressiveness: f64,
|
||||
guardedness: f64,
|
||||
values: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct PersonalityTraitProjection {
|
||||
group: String,
|
||||
name: String,
|
||||
activation: f64,
|
||||
plasticity: f64,
|
||||
weight: f64,
|
||||
}
|
||||
|
||||
fn collect_role_memory_records(agent_store: Option<&Path>) -> Result<Vec<RoleMemoryRecord>> {
|
||||
let Some(agent_store) = agent_store else {
|
||||
return Ok(Vec::new());
|
||||
|
|
@ -1440,6 +1481,117 @@ fn collect_role_memory_records(agent_store: Option<&Path>) -> Result<Vec<RoleMem
|
|||
Ok(records)
|
||||
}
|
||||
|
||||
fn collect_role_appraisal_profiles(
|
||||
agent_store: Option<&Path>,
|
||||
) -> Result<Vec<RoleAppraisalProfile>> {
|
||||
let Some(agent_store) = agent_store else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let mut profiles = Vec::new();
|
||||
for role_id in ROLE_ORDER {
|
||||
let Some(entry) =
|
||||
crate::agent_memory::load_agent_memory_entry_for_role(agent_store, role_id)?
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
let mut traits = Vec::new();
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"underlying_organization",
|
||||
&entry.agent.canonical_state.underlying_organization,
|
||||
);
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"stable_dispositions",
|
||||
&entry.agent.canonical_state.stable_dispositions,
|
||||
);
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"behavioral_dimensions",
|
||||
&entry.agent.canonical_state.behavioral_dimensions,
|
||||
);
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"presentation_strategy",
|
||||
&entry.agent.canonical_state.presentation_strategy,
|
||||
);
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"voice_style",
|
||||
&entry.agent.canonical_state.voice_style,
|
||||
);
|
||||
collect_trait_group(
|
||||
&mut traits,
|
||||
"situational_state",
|
||||
&entry.agent.canonical_state.situational_state,
|
||||
);
|
||||
traits.sort_by(|left, right| right.weight.total_cmp(&left.weight));
|
||||
let top_weighted = traits.iter().take(8).collect::<Vec<_>>();
|
||||
let reactivity = average(top_weighted.iter().map(|item| item.activation)).unwrap_or(0.5);
|
||||
let plasticity = average(top_weighted.iter().map(|item| item.plasticity)).unwrap_or(0.5);
|
||||
let expressiveness = average(
|
||||
traits
|
||||
.iter()
|
||||
.filter(|item| item.group == "voice_style" || item.group == "presentation_strategy")
|
||||
.map(|item| item.activation),
|
||||
)
|
||||
.unwrap_or(reactivity);
|
||||
let guardedness = average(
|
||||
traits
|
||||
.iter()
|
||||
.filter(|item| {
|
||||
let name = item.name.as_str();
|
||||
name.contains("guard")
|
||||
|| name.contains("shame")
|
||||
|| name.contains("risk")
|
||||
|| name.contains("caution")
|
||||
|| name.contains("contingent")
|
||||
|| name.contains("defens")
|
||||
})
|
||||
.map(|item| item.activation),
|
||||
)
|
||||
.unwrap_or((1.0 - expressiveness * 0.45).clamp(0.0, 1.0));
|
||||
let values = entry
|
||||
.agent
|
||||
.canonical_state
|
||||
.values
|
||||
.iter()
|
||||
.take(5)
|
||||
.map(|value| value.label.clone())
|
||||
.collect();
|
||||
profiles.push(RoleAppraisalProfile {
|
||||
role_id: (*role_id).to_string(),
|
||||
agent_id: entry.agent.agent_id,
|
||||
display_name: entry.agent.identity.name,
|
||||
traits,
|
||||
reactivity: round3(reactivity),
|
||||
plasticity: round3(plasticity),
|
||||
expressiveness: round3(expressiveness),
|
||||
guardedness: round3(guardedness),
|
||||
values,
|
||||
});
|
||||
}
|
||||
Ok(profiles)
|
||||
}
|
||||
|
||||
fn collect_trait_group(
|
||||
traits: &mut Vec<PersonalityTraitProjection>,
|
||||
group: &str,
|
||||
source: &BTreeMap<String, crate::agent_memory::GhostlightTraitVector>,
|
||||
) {
|
||||
for (name, vector) in source {
|
||||
let activation = vector.current_activation.clamp(0.0, 1.0);
|
||||
let plasticity = vector.plasticity.clamp(0.0, 1.0);
|
||||
traits.push(PersonalityTraitProjection {
|
||||
group: group.to_string(),
|
||||
name: name.clone(),
|
||||
activation,
|
||||
plasticity,
|
||||
weight: round3(activation * (0.65 + plasticity * 0.35)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn build_memory_resonance(records: &[RoleMemoryRecord]) -> Value {
|
||||
let mut pairs = Vec::new();
|
||||
for (left_index, left) in records.iter().enumerate() {
|
||||
|
|
@ -1785,6 +1937,305 @@ fn build_candidate_interventions(bridge: &Value, incubation: &Value) -> Value {
|
|||
})
|
||||
}
|
||||
|
||||
fn build_agent_appraisals(
|
||||
profiles: &[RoleAppraisalProfile],
|
||||
thought_lanes: &Value,
|
||||
incubation: &Value,
|
||||
bridge: &Value,
|
||||
) -> Value {
|
||||
let thought_tokens = cognition_tokens(thought_lanes, incubation, bridge);
|
||||
let thought_pressure = thought_pressure(thought_lanes, incubation);
|
||||
let bridge_decision = bridge
|
||||
.pointer("/decision/speakDecision")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("silence");
|
||||
let focus = incubation
|
||||
.get("themes")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|themes| themes.first())
|
||||
.and_then(|theme| theme.get("themeId"))
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("no-active-theme");
|
||||
let appraisals = profiles
|
||||
.iter()
|
||||
.map(|profile| {
|
||||
let projection = personality_projection(profile, &thought_tokens);
|
||||
let alignment = projection
|
||||
.iter()
|
||||
.filter_map(|item| item.get("projection").and_then(Value::as_f64))
|
||||
.next()
|
||||
.unwrap_or(profile.reactivity);
|
||||
let arousal = round3(
|
||||
(thought_pressure * (0.35 + profile.reactivity * 0.45 + profile.plasticity * 0.2))
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
let guardedness = round3(
|
||||
(profile.guardedness * 0.65 + thought_pressure * 0.25 + (1.0 - alignment) * 0.1)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
let curiosity = round3(
|
||||
((1.0 - profile.guardedness) * 0.25 + alignment * 0.45 + profile.plasticity * 0.3)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
let urgency = round3((arousal * 0.65 + guardedness * 0.25 + thought_pressure * 0.1).clamp(0.0, 1.0));
|
||||
let valence = round3((0.55 + curiosity * 0.2 - guardedness * 0.18).clamp(0.0, 1.0));
|
||||
let label = interpretation_label(bridge_decision, arousal, guardedness, curiosity);
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.agent_thought_appraisal.v0",
|
||||
"appraisalId": format!("appraisal-{}-{}", profile.role_id, stable_theme_suffix(focus)),
|
||||
"reviewStatus": "generated_unreviewed",
|
||||
"participantAgentId": profile.agent_id,
|
||||
"roleId": profile.role_id,
|
||||
"currentCharacterStateRef": format!("state/agents.msgpack#{}", profile.role_id),
|
||||
"thoughtClusterRef": focus,
|
||||
"participantLocalContext": {
|
||||
"displayName": profile.display_name,
|
||||
"values": profile.values,
|
||||
"reactivity": profile.reactivity,
|
||||
"plasticity": profile.plasticity,
|
||||
"expressiveness": profile.expressiveness,
|
||||
"guardedness": profile.guardedness,
|
||||
},
|
||||
"observableThoughtSummary": strongest_thought_summary(thought_lanes, incubation),
|
||||
"personalityProjection": projection,
|
||||
"interpretation": format!("{} appraises {} through its current personality vector; reaction should follow this appraisal rather than a global mood knob.", profile.display_name, focus),
|
||||
"emotionalAppraisal": {
|
||||
"valence": valence,
|
||||
"arousal": arousal,
|
||||
"urgency": urgency,
|
||||
"curiosity": curiosity,
|
||||
"guardedness": guardedness,
|
||||
"thoughtPressure": round3(thought_pressure),
|
||||
},
|
||||
"interpretationLabel": label,
|
||||
"confidenceNotes": "Deterministic first-pass appraisal from typed role personality vectors and clustered thought state; useful as reaction guidance, not reviewed truth.",
|
||||
"candidateImplications": {
|
||||
"reactionMode": reaction_mode(&label, bridge_decision),
|
||||
"reactionIntensity": round3((urgency * 0.55 + arousal * 0.3 + curiosity * 0.15).clamp(0.0, 1.0)),
|
||||
"shouldSpeak": bridge_decision == "draft" && profile.role_id == "face" && guardedness < 0.75,
|
||||
"shouldIncubate": bridge_decision != "silence" && guardedness >= 0.55,
|
||||
},
|
||||
"review": {
|
||||
"acceptedForMutation": false,
|
||||
"rationale": "Appraisal may steer reaction and display; state mutation still requires the explicit selfPatch or project-state review path.",
|
||||
},
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.agent_thought_appraisals.v0",
|
||||
"updatedAt": now_iso(),
|
||||
"thoughtClusterRef": focus,
|
||||
"participantAppraisals": appraisals,
|
||||
})
|
||||
}
|
||||
|
||||
fn build_agent_reactions(appraisals: &Value, bridge: &Value) -> Value {
|
||||
let bridge_decision = bridge
|
||||
.pointer("/decision/speakDecision")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("silence");
|
||||
let reactions = appraisals
|
||||
.get("participantAppraisals")
|
||||
.and_then(Value::as_array)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.map(|appraisal| {
|
||||
let role_id = appraisal
|
||||
.get("roleId")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("unknown");
|
||||
let arousal = appraisal
|
||||
.pointer("/emotionalAppraisal/arousal")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(0.0);
|
||||
let guardedness = appraisal
|
||||
.pointer("/emotionalAppraisal/guardedness")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(0.0);
|
||||
let curiosity = appraisal
|
||||
.pointer("/emotionalAppraisal/curiosity")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(0.0);
|
||||
let mode = appraisal
|
||||
.pointer("/candidateImplications/reactionMode")
|
||||
.and_then(Value::as_str)
|
||||
.unwrap_or("hold");
|
||||
let intensity = appraisal
|
||||
.pointer("/candidateImplications/reactionIntensity")
|
||||
.and_then(Value::as_f64)
|
||||
.unwrap_or(0.0);
|
||||
serde_json::json!({
|
||||
"reactionId": format!("reaction-{}-{}", role_id, now_stamp()),
|
||||
"roleId": role_id,
|
||||
"participantAgentId": appraisal.get("participantAgentId"),
|
||||
"appraisalId": appraisal.get("appraisalId"),
|
||||
"mode": mode,
|
||||
"moodLabel": mood_label(arousal, guardedness, curiosity),
|
||||
"intensity": round3(intensity),
|
||||
"bridgeDecision": bridge_decision,
|
||||
"surface": if role_id == "face" { "aquarium" } else { "internal" },
|
||||
"recommendedUse": reaction_recommended_use(role_id, mode),
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
serde_json::json!({
|
||||
"schema_version": "epiphany.agent_reactions.v0",
|
||||
"updatedAt": now_iso(),
|
||||
"reactions": reactions,
|
||||
"contract": "Reaction is appraisal output. It may pace, color, draft, or display behavior; it does not mutate state without review.",
|
||||
})
|
||||
}
|
||||
|
||||
fn cognition_tokens(thought_lanes: &Value, incubation: &Value, bridge: &Value) -> BTreeSet<String> {
|
||||
let mut tokens = BTreeSet::new();
|
||||
collect_json_tokens(thought_lanes, &mut tokens);
|
||||
collect_json_tokens(incubation, &mut tokens);
|
||||
collect_json_tokens(bridge, &mut tokens);
|
||||
tokens
|
||||
}
|
||||
|
||||
fn collect_json_tokens(value: &Value, tokens: &mut BTreeSet<String>) {
|
||||
match value {
|
||||
Value::String(text) => tokens.extend(summary_tokens(text)),
|
||||
Value::Array(items) => {
|
||||
for item in items {
|
||||
collect_json_tokens(item, tokens);
|
||||
}
|
||||
}
|
||||
Value::Object(object) => {
|
||||
for (key, value) in object {
|
||||
tokens.extend(summary_tokens(key));
|
||||
collect_json_tokens(value, tokens);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn thought_pressure(thought_lanes: &Value, incubation: &Value) -> f64 {
|
||||
let analytic = max_number_at(thought_lanes, "/analytic/activeThreads", "desireToAct");
|
||||
let associative = max_number_at(thought_lanes, "/associative/activeThreads", "desireToSpeak");
|
||||
let theme = max_number_at(incubation, "/themes", "strength");
|
||||
(analytic * 0.35 + associative * 0.25 + theme * 0.4).clamp(0.0, 1.0)
|
||||
}
|
||||
|
||||
fn max_number_at(value: &Value, pointer: &str, key: &str) -> f64 {
|
||||
value
|
||||
.pointer(pointer)
|
||||
.and_then(Value::as_array)
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(|item| item.get(key).and_then(Value::as_f64))
|
||||
.max_by(f64::total_cmp)
|
||||
.unwrap_or(0.0)
|
||||
}
|
||||
|
||||
fn personality_projection(
|
||||
profile: &RoleAppraisalProfile,
|
||||
thought_tokens: &BTreeSet<String>,
|
||||
) -> Vec<Value> {
|
||||
let mut scored = profile
|
||||
.traits
|
||||
.iter()
|
||||
.map(|item| {
|
||||
let trait_tokens = summary_tokens(&format!("{} {}", item.group, item.name));
|
||||
let overlap = token_overlap(&trait_tokens, thought_tokens);
|
||||
let projection = round3((item.weight * (0.55 + overlap * 1.8)).clamp(0.0, 1.0));
|
||||
serde_json::json!({
|
||||
"group": item.group,
|
||||
"name": item.name,
|
||||
"activation": round3(item.activation),
|
||||
"plasticity": round3(item.plasticity),
|
||||
"tokenOverlap": round3(overlap),
|
||||
"projection": projection,
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
scored.sort_by(|left, right| {
|
||||
right["projection"]
|
||||
.as_f64()
|
||||
.unwrap_or_default()
|
||||
.total_cmp(&left["projection"].as_f64().unwrap_or_default())
|
||||
});
|
||||
scored.truncate(6);
|
||||
scored
|
||||
}
|
||||
|
||||
fn strongest_thought_summary(thought_lanes: &Value, incubation: &Value) -> String {
|
||||
incubation
|
||||
.get("themes")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|themes| themes.first())
|
||||
.and_then(|theme| theme.get("summary"))
|
||||
.and_then(Value::as_str)
|
||||
.or_else(|| {
|
||||
thought_lanes
|
||||
.pointer("/analytic/activeThreads")
|
||||
.and_then(Value::as_array)
|
||||
.and_then(|threads| threads.first())
|
||||
.and_then(|thread| thread.get("claim"))
|
||||
.and_then(Value::as_str)
|
||||
})
|
||||
.unwrap_or("No salient thought cluster is active.")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
fn interpretation_label(
|
||||
bridge_decision: &str,
|
||||
arousal: f64,
|
||||
guardedness: f64,
|
||||
curiosity: f64,
|
||||
) -> String {
|
||||
if guardedness > 0.72 && arousal > 0.35 {
|
||||
"protective_appraisal".to_string()
|
||||
} else if curiosity > 0.68 {
|
||||
"investigative_appraisal".to_string()
|
||||
} else if bridge_decision == "draft" {
|
||||
"expressive_appraisal".to_string()
|
||||
} else if arousal < 0.12 {
|
||||
"low_pressure_appraisal".to_string()
|
||||
} else {
|
||||
"incubating_appraisal".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
fn reaction_mode(label: &str, bridge_decision: &str) -> &'static str {
|
||||
match (label, bridge_decision) {
|
||||
("protective_appraisal", _) => "hold_and_verify",
|
||||
("investigative_appraisal", _) => "inspect",
|
||||
("expressive_appraisal", "draft") => "draft",
|
||||
("low_pressure_appraisal", _) => "sleep_ruminate",
|
||||
_ => "incubate",
|
||||
}
|
||||
}
|
||||
|
||||
fn mood_label(arousal: f64, guardedness: f64, curiosity: f64) -> &'static str {
|
||||
if guardedness > 0.72 && arousal > 0.35 {
|
||||
"wary"
|
||||
} else if curiosity > 0.68 && arousal > 0.25 {
|
||||
"keen"
|
||||
} else if arousal < 0.12 {
|
||||
"drowsy"
|
||||
} else if guardedness > curiosity {
|
||||
"watchful"
|
||||
} else {
|
||||
"interested"
|
||||
}
|
||||
}
|
||||
|
||||
fn reaction_recommended_use(role_id: &str, mode: &str) -> &'static str {
|
||||
match (role_id, mode) {
|
||||
("face", "draft") => "Prepare a reviewed Aquarium-facing draft; do not post automatically.",
|
||||
(_, "hold_and_verify") => "Bias toward verifier/modeler review before expression.",
|
||||
(_, "inspect") => {
|
||||
"Bias the next heartbeat toward a bounded retrieval or modeling inspection."
|
||||
}
|
||||
(_, "sleep_ruminate") => "Let this organ sleep-ruminate unless real work arrives.",
|
||||
_ => "Keep the thought incubating and visible in Aquarium.",
|
||||
}
|
||||
}
|
||||
|
||||
fn topic_saturation_from_syntheses(syntheses: &[Value]) -> Vec<Value> {
|
||||
let mut counts: BTreeMap<String, usize> = BTreeMap::new();
|
||||
for synthesis in syntheses {
|
||||
|
|
@ -1933,6 +2384,18 @@ fn round3(value: f64) -> f64 {
|
|||
(value * 1_000.0).round() / 1_000.0
|
||||
}
|
||||
|
||||
fn average(values: impl Iterator<Item = f64>) -> Option<f64> {
|
||||
let mut total = 0.0;
|
||||
let mut count = 0_usize;
|
||||
for value in values {
|
||||
if value.is_finite() {
|
||||
total += value;
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
(count > 0).then_some(total / count as f64)
|
||||
}
|
||||
|
||||
const STOP_WORDS: &[&str] = &[
|
||||
"about", "after", "agent", "before", "being", "between", "could", "from", "have", "into",
|
||||
"lane", "memory", "more", "must", "should", "state", "than", "that", "their", "there", "this",
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ remembers doctrine; the branch remembers the blade.
|
|||
- The role self-memory persistence pass is native now. Each lane has a Ghostlight-shaped typed dossier in `state/agents.msgpack`, and specialists may return optional `selfPatch` requests beside their normal role result. `roleResult`/`roleAccept` project coordinator review as `selfPersistence`: accepted requests are role-matched, bounded lane memory/goal/value/private-note mutations; refused requests explain wrong role, project-truth smuggling, authority grabs, bloat, missing reason, or malformed records. GUI/coordinator accept paths apply accepted `selfPatch` requests through the native `epiphany-agent-memory-store` binary; project truth still belongs only in `EpiphanyThreadState`.
|
||||
- The heartbeat initiative pass is landed as a bounded tool seam. `state/agent-heartbeats.msgpack` tracks Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life as Ghostlight-style initiative participants with arena, participant kind, speed, next-ready time, reaction bias, interrupt threshold, load, status, constraints, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Tick/status/complete and idle rumination selfPatch application now run through Rust/CultCache directly. JSON heartbeat state and Python wrapper state are gone; general CultCache schema sync, polyglot domain loading, and debug display tools belong in CultLib. This is a callable scheduler seam, not yet an always-on daemon; a heart valve, not a whole circulatory god.
|
||||
- The first Ghostlight-derived timing slice is landed in Epiphany, but Ghostlight is reference lineage rather than a sibling runtime to preserve. `epiphany-heartbeat-store init --profile ghostlight-scene --scene-id <id> --scene-participant <id|name|speed|reaction|threshold|constraints>` creates a typed CultCache MessagePack scene heartbeat store whose participants are `arena=scene`, `participantKind=character`; `tick` emits `ghostlight.initiative_schedule.v0` receipts with `scene_turn` actions and local-affordance basis. The generic Epiphany maintenance lanes are not auto-patched into scene stores.
|
||||
- The first Void-derived routine slice is landed in Epiphany, but VoidBot is reference lineage rather than a runtime dependency. `epiphany-heartbeat-store routine --store .\state\agent-heartbeats.msgpack --artifact-dir .\.epiphany-heartbeats --agent-store .\state\agents.msgpack` reads typed role dossiers, computes bounded memory resonance, maintains incubation themes, runs analytic and associative cognition lanes, writes bridge syntheses/saturation/tension, advances the sleep/dream cycle, updates the typed heartbeat store, and emits an auditable `epiphany.void_routine.v0` receipt. This mutates only heartbeat physiology fields: project truth and role memory mutation remain on their reviewed surfaces.
|
||||
- The first Void-derived routine slice is landed in Epiphany, but VoidBot is reference lineage rather than a runtime dependency. `epiphany-heartbeat-store routine --store .\state\agent-heartbeats.msgpack --artifact-dir .\.epiphany-heartbeats --agent-store .\state\agents.msgpack` reads typed role dossiers, computes bounded memory resonance, maintains incubation themes, runs analytic and associative cognition lanes, writes bridge syntheses/saturation/tension, projects the active thought cluster through each role's Ghostlight-shaped personality vectors, derives participant-local reactions, advances the sleep/dream cycle, updates the typed heartbeat store, and emits an auditable `epiphany.void_routine.v0` receipt. This mutates only heartbeat physiology fields: project truth and role memory mutation remain on their reviewed surfaces.
|
||||
- The Face public-surface pass is landed as a bounded lane. Face's role dossier lives in `state/agents.msgpack`; `epiphany_specialists.toml` gives it a VoidBot-heartbeat-derived prompt stripped of moderation authority; `state/face-discord.toml` and the native `epiphany-face-discord` binary enforce that Face may interact only through #aquarium. Missing channel id or token writes candidate chat artifacts instead of posting elsewhere.
|
||||
- The first Epiphany-native character-loop pass is landed. `epiphany-character-loop turn --role face --stimulus <text>` loads Face's typed dossier from `state/agents.msgpack` and emits an auditable `epiphany.character_turn_packet.v0` packet with projected local context, visible stimulus, allowed outputs, and guardrails. The same packet builder works for other role ids, because every organ already has a Ghostlight-shaped dossier.
|
||||
- The heartbeat/Face operator API pass is landed. Native `epiphany-heartbeat-store status` returns machine-readable initiative state plus CultCache store presence, native `epiphany-face-discord bubble` writes Discord-independent `epiphany.face_bubble.v0` artifacts, and native `epiphany-mvp-status` includes `heartbeat` and `face` blocks. Aquarium should call native/backend surfaces rather than resurrecting deleted Python action shims.
|
||||
- The heartbeat/Face operator API pass is landed. Native `epiphany-heartbeat-store status` returns machine-readable initiative state plus CultCache store presence, thought appraisals, and derived reactions; native `epiphany-face-discord bubble` writes Discord-independent `epiphany.face_bubble.v0` artifacts, and native `epiphany-mvp-status` includes `heartbeat` and `face` blocks. Aquarium should call native/backend surfaces rather than resurrecting deleted Python action shims.
|
||||
- The native runtime-spine pass is landed as a first vertebra, not a full daemon. `state/runtime-spine.msgpack` is the default store, `.epiphany-dogfood/runtime-spine-job/runtime.msgpack` and `hello.cultnet` are the latest job/result smoke artifacts, and specialist launch/result flows now route through typed heartbeat/runtime-spine documents.
|
||||
- The Aetheria dogfood run has a contamination scar. The supervising Codex session directly edited and committed target-repo work on `E:\Projects\Aetheria-Economy` instead of only driving Epiphany lanes. Treat those Aetheria commits as supervisor-seeded implementation, not clean evidence that Epiphany coordinated the work. Future dogfood must run through the GUI/coordinator/fixed role lanes with auditable artifacts unless the user explicitly authorizes an operator intervention. Remember the sunburn: do not stare into the worker's objective until you become it.
|
||||
- The dogfood quarantine now has a direct-thought boundary. The supervisor may read coordinator actions, role/reorient statuses, structured finding summaries, reviewed state patches, rendered status snapshots, and artifact manifests. It must not read raw worker transcripts, direct worker messages, full turn logs, or `rawResult` payloads during normal dogfood. Those artifacts are sealed black reliquaries for explicit forensic debugging only.
|
||||
|
|
@ -64,7 +64,7 @@ remembers doctrine; the branch remembers the blade.
|
|||
- The planning loop is now runtime-backed and operator-visible. Typed captures, backlog items, roadmap streams, Objective Drafts, and GitHub issue source refs live in `EpiphanyThreadState`, validate through revision-gated `thread/epiphany/update`, render into prompts when present, project read-only through `thread/epiphany/planning`, render in the GUI Planning panel, can be synthesized by the fixed Imagination/planning lane, and can be explicitly adopted through the artifacted `adoptObjectiveDraft` GUI action. Chat is deliberation, not an objective pipe; ideas and GitHub Issues remain planning state until explicit human adoption.
|
||||
- The bridge/dashboard slice is now landed far enough to test locally. Native `epiphany-rider-bridge` inspects Rider installation, solution, VCS, changed files, and captures file/selection/symbol context into `.epiphany-gui/rider` artifacts; Aquarium has Inspect Rider and renders Rider audit artifacts in Environment; Aquarium also embeds the adjacent EpiphanyGraph viewer over typed `graphs.architecture`, `graphs.dataflow`, and `graphs.links`.
|
||||
- A first Rider plugin scaffold lives under `integrations/rider`: tool window, Refresh status, and Send Context to Epiphany action. It shells through native `epiphany-rider-bridge` and does not own state. `gradle` is not installed on this machine, so the scaffold is not build-verified yet.
|
||||
- Next real product move: continue Aquarium UI work in `E:\Projects\EpiphanyAquarium`; surface native heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, and `candidateInterventions`; keep EpiphanyAgent focused on backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, Face guardrails, and the ongoing purification from Python/JSON scaffolding into Rust/CultCache/CultNet organs. Then build-verify/package the Rider plugin scaffold when Gradle/wrapper support is available, install the Aetheria-pinned Unity `6000.1.10f1` editor, and run the next Aetheria dogfood pass through Aquarium/Rider/Unity bridge artifacts. GitHub Issues import is deferred until the backlog source is fresh enough to deserve Imagination's attention.
|
||||
- Next real product move: continue Aquarium UI work in `E:\Projects\EpiphanyAquarium`; surface native heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, `candidateInterventions`, `appraisals`, and `reactions`; keep EpiphanyAgent focused on backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, Face guardrails, and the ongoing purification from Python/JSON scaffolding into Rust/CultCache/CultNet organs. Then build-verify/package the Rider plugin scaffold when Gradle/wrapper support is available, install the Aetheria-pinned Unity `6000.1.10f1` editor, and run the next Aetheria dogfood pass through Aquarium/Rider/Unity bridge artifacts. GitHub Issues import is deferred until the backlog source is fresh enough to deserve Imagination's attention.
|
||||
- The repo is an Epiphany fork of Codex, not a Codex preset.
|
||||
- `vendor/codex` is tracked directly, not a submodule.
|
||||
- `epiphany-core` owns the heavy Epiphany organs where practical.
|
||||
|
|
@ -139,7 +139,7 @@ The current spine, blessed but not yet finished:
|
|||
- distilled shared and config-backed prompt doctrine through the base prompt, rendered Epiphany state prompt files, modeling/Body, implementation/Hands, verification/Soul, reorientation/Life, coordinator/Self, and CRRC intervention surfaces
|
||||
- shared Ghostlight-derived persistent memory projection across Imagination, Body, Soul, Life, Self, CRRC checkpoint steering, and the GUI-launched Hands implementation lane
|
||||
- Ghostlight-derived heartbeat initiative scheduling through the native `epiphany-heartbeat-store` binary, with Self and Face included as first-class Epiphany maintenance participants, Ghostlight scene characters supported through the same timing law, idle rumination routed through normal `selfPatch` review/application, and heartbeat state persisted through typed CultCache MessagePack stores
|
||||
- Void-derived native routine physiology through `epiphany-heartbeat-store routine`, with sleep cycle, memory resonance, incubation, analytic/associative cognition lanes, bridge judgment, candidate interventions, and dream maintenance stored in the typed heartbeat store
|
||||
- Void-derived native routine physiology through `epiphany-heartbeat-store routine`, with sleep cycle, memory resonance, incubation, analytic/associative cognition lanes, bridge judgment, candidate interventions, Ghostlight-style personality appraisals, derived reactions, and dream maintenance stored in the typed heartbeat store
|
||||
- Epiphany-native character-loop packet projection through `epiphany-character-loop`, with Face as the first public-surface actor over its typed role dossier
|
||||
- Face as the public #aquarium-only surface for translating agent thought-weather into short chats or candidate drafts, without moderator authority
|
||||
- Ghostlight-shaped role dossiers in `state/agents.msgpack`, plus `selfPatch` review projection through `roleResult`/`roleAccept` and accepted memory application through the native `epiphany-agent-memory-store` binary
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -196,7 +196,7 @@ landed_baseline:
|
|||
- Phase 6 Face public-surface slice: Face's typed role dossier, Face prompt text, `state/face-discord.toml`, and the native `epiphany-face-discord` binary establish Face as the public #aquarium-only translator of Epiphany agent thought-weather, without VoidBot's moderation authority.
|
||||
- Phase 6 character-loop slice: native `epiphany-character-loop` loads any role's Ghostlight-shaped typed dossier from `state/agents.msgpack`, combines it with a visible stimulus, and emits an auditable `epiphany.character_turn_packet.v0` local projection for response, bubble, finding, silence, or bounded `selfPatch`. Face is the first intended public-surface consumer; Ghostlight is reference material, not a runtime dependency.
|
||||
- Phase 6 heartbeat initiative slice: `state/agent-heartbeats.msgpack`, `epiphany-core::EpiphanyHeartbeatStateEntry`, the native `epiphany-heartbeat-store` binary, and heartbeat smoke coverage borrow Ghostlight initiative scheduling so Self, Face, Imagination, Eyes, Body, Hands, Soul, and Life compete for heartbeat slots; idle slots become bounded memory rumination instead of fake project work, and the live state surface now ticks/completes/applies rumination through typed CultCache MessagePack instead of JSON or Python wrapper state. The same store can now initialize a `ghostlight-scene` profile for character scene turns.
|
||||
- Phase 6 cognition-lanes/Void routine slice: native `epiphany-heartbeat-store routine` rebuilds VoidBot-style sleep, resonance, incubation, parallel analytic/associative thought lanes, bridge judgment, candidate interventions, and dream maintenance inside Epiphany's heartbeat store. It reads typed role dossiers from `state/agents.msgpack`, updates `state/agent-heartbeats.msgpack`, and emits an auditable `epiphany.void_routine.v0` receipt without importing VoidBot or granting speech/project authority. `epiphany-character-loop` also carries the same cognition lane/bridge contract for role-local actor turns.
|
||||
- Phase 6 cognition-lanes/Void routine slice: native `epiphany-heartbeat-store routine` rebuilds VoidBot-style sleep, resonance, incubation, parallel analytic/associative thought lanes, bridge judgment, candidate interventions, Ghostlight-style participant-local thought appraisal, derived reactions, and dream maintenance inside Epiphany's heartbeat store. It reads typed role dossiers from `state/agents.msgpack`, projects clustered thought state through each role's personality vectors, updates `state/agent-heartbeats.msgpack`, and emits an auditable `epiphany.void_routine.v0` receipt without importing VoidBot or granting speech/project authority. `epiphany-character-loop` also carries the same cognition lane/bridge/appraisal contract for role-local actor turns; reactions may pace, color, draft, or display behavior, but state mutation remains on reviewed `selfPatch` or project-state surfaces.
|
||||
- Native runtime spine slice: `epiphany-core::EpiphanyRuntimeIdentity`, `EpiphanyRuntimeSession`, `EpiphanyRuntimeJob`, `EpiphanyRuntimeJobResult`, and `EpiphanyRuntimeEvent` plus the native `epiphany-runtime-spine` binary establish a CultCache-backed spine, native job/result lifecycle, status projection, and framed CultNet hello output so the old Codex app-server runtime can be starved down to a temporary evacuation bridge instead of remaining the throne.
|
||||
guardrails:
|
||||
- Use focused Rust app-server mapper/handler tests plus matching native `epiphany-core` smoke binaries before modifying update, distill, propose, promote, read-projection, or notification behavior. The old Python smoke shims have been cut.
|
||||
|
|
@ -242,4 +242,4 @@ rejected_paths:
|
|||
|
||||
current_status:
|
||||
summary: Phase 1 durable state through Phase 6 coordinator/specialist/CRRC/backend organs are landed. The Aquarium operator shrine has been split into sibling repo `E:\Projects\EpiphanyAquarium` with its own distilled interface doctrine and persistent memory. EpiphanyAgent now also has a Ghostlight-derived heartbeat initiative seam, Epiphany-native character-loop packets over its own role dossiers, VoidBot-derived native routine physiology and cognition lanes in the heartbeat store, a Face lane for public agent thought-weather, and a Discord-independent Face bubble API for Aquarium. Runtime Unity execution remains blocked until the exact project-pinned editor exists.
|
||||
next_action: Continue Aquarium UI work in `E:\Projects\EpiphanyAquarium`; configure the #aquarium channel id before allowing Face to post; wire Aquarium Face interactions to `epiphany-character-loop` packets before choosing bubble/draft/silence; surface heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, and `candidateInterventions` from native status in Aquarium; keep EpiphanyAgent changes to backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, and Face guardrails. Keep purging Python/JSON impurity only when the replacement is a typed Rust, CultCache, or CultNet surface with receipts.
|
||||
next_action: Continue Aquarium UI work in `E:\Projects\EpiphanyAquarium`; configure the #aquarium channel id before allowing Face to post; wire Aquarium Face interactions to `epiphany-character-loop` packets before choosing bubble/draft/silence; surface heartbeat `sleepCycle`, `memoryResonance`, `incubation`, `thoughtLanes`, `bridge`, `candidateInterventions`, `appraisals`, and `reactions` from native status in Aquarium; keep EpiphanyAgent changes to backend contracts, typed state, coordinator policy, bridge tools, heartbeat scheduling, and Face guardrails. Keep purging Python/JSON impurity only when the replacement is a typed Rust, CultCache, or CultNet surface with receipts.
|
||||
|
|
|
|||
Reference in a new issue