Make semantic projection causality explicit

This commit is contained in:
Meta Vens 2026-07-15 04:15:45 +01:00
commit 3be5e5b52b
11 changed files with 740 additions and 21 deletions

View file

@ -5,6 +5,7 @@ use epiphany_core::AgentSelfPatch;
use epiphany_core::agent_memory_status;
use epiphany_core::apply_agent_memory_lifecycle_operation;
use epiphany_core::apply_agent_self_patch_document;
use epiphany_core::ensure_agent_memory_swarm_identity;
use epiphany_core::migrate_agent_memory_json_dir_to_cultcache;
use epiphany_core::project_agent_memory_to_json_dir;
use epiphany_core::project_persona_state_for_role;
@ -47,6 +48,11 @@ fn main() -> Result<()> {
let store = require_path_arg(&mut args, "--store")?;
print_json(&agent_memory_status(store)?)?;
}
"set-swarm-identity" => {
let store = require_path_arg(&mut args, "--store")?;
let swarm_id = require_string_arg(&mut args, "--swarm-id")?;
print_json(&ensure_agent_memory_swarm_identity(store, &swarm_id)?)?;
}
"refresh-soa" => {
let store = require_path_arg(&mut args, "--store")?;
print_json(&refresh_agent_state_soa(store)?)?;
@ -192,7 +198,7 @@ fn print_json<T: serde::Serialize>(value: &T) -> Result<()> {
fn print_usage() {
eprintln!(
"usage: epiphany-agent-memory-store <migrate-json-dir|project-json-dir|project-persona|status|refresh-soa|repair|validate|review-patch|apply-patch|review-lifecycle|apply-lifecycle|smoke> ..."
"usage: epiphany-agent-memory-store <migrate-json-dir|project-json-dir|project-persona|set-swarm-identity|status|refresh-soa|repair|validate|review-patch|apply-patch|review-lifecycle|apply-lifecycle|smoke> ..."
);
}

View file

@ -167,16 +167,17 @@ impl Options {
if entries.is_empty() {
return Err(anyhow!("agent store has no admitted organ memory"));
}
let derived_swarm_id = epiphany_core::swarm_identity_from_agent_memories(&entries);
if self.swarm_id != derived_swarm_id {
let identity = epiphany_core::load_agent_memory_swarm_identity(path)?
.ok_or_else(|| anyhow!("agent store has no immutable swarm identity; run epiphany-agent-memory-store set-swarm-identity"))?;
if self.swarm_id != identity.swarm_id {
return Err(anyhow!(
"--swarm-id {:?} does not match the canonical agent-store swarm identity {:?}",
self.swarm_id,
derived_swarm_id
identity.swarm_id
));
}
return Ok(memory_graph_from_agent_memories(
format!("{derived_swarm_id}-mind"),
format!("{}-mind", identity.swarm_id),
&entries,
));
}