Stop diagnostics from manufacturing swarm state

This commit is contained in:
Meta Vens 2026-07-12 19:38:51 +01:00
commit 9d393df34e
6 changed files with 119 additions and 190 deletions

View file

@ -293,11 +293,6 @@ fn run_cli() -> Result<()> {
println!("{}", serde_json::to_string_pretty(&context)?);
}
"receipt-directory" | "receipts" | "evidence-directory" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
let lifecycle_receipts = load_epiphany_cultmesh_daemon_service_lifecycle_receipts(
&args.store,
@ -351,11 +346,6 @@ fn run_cli() -> Result<()> {
);
}
"restart-policy-directory" | "service-policy-directory" | "scheduler-coverage" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let policy_directory = load_epiphany_cultmesh_daemon_restart_policy_directory(
&args.store,
args.runtime_id.clone(),
@ -404,16 +394,8 @@ fn run_cli() -> Result<()> {
);
}
"tools" | "tool-directory" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let directory =
load_epiphany_cultmesh_daemon_tool_directory(&args.store, args.runtime_id.clone())?;
if directory.is_empty() {
anyhow::bail!("daemon tool directory is empty");
}
if !directory.iter().all(|(_, _, capability)| {
capability.available_to_all_agents
&& capability.requires_receipt
@ -428,7 +410,7 @@ fn run_cli() -> Result<()> {
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.cultmesh.daemon_tool_directory.v0",
"status": "ok",
"status": if report.rows.is_empty() { "empty" } else { "ok" },
"runtimeId": args.runtime_id,
"store": args.store,
"toolCount": report.rows.len(),
@ -437,6 +419,7 @@ fn run_cli() -> Result<()> {
"invocationCommand": DIRECT_INVOKE_TOOL_COMMAND,
"wrapperInvocationCommand": WRAPPER_INVOKE_TOOL_COMMAND,
"wrapperMode": "tools/epiphany_local_run.ps1 -Mode tool-directory",
"privateStateExposed": false,
"invariants": {
"availableToAllAgents": true,
"requiresReceipt": true,
@ -761,11 +744,6 @@ fn run_cli() -> Result<()> {
);
}
"swarm-status" | "daemon-report" | "daemon-status-report" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let liveness =
load_epiphany_cultmesh_daemon_liveness(&args.store, args.runtime_id.clone())?;
let report = daemon_liveness_report(&liveness);
@ -773,7 +751,7 @@ fn run_cli() -> Result<()> {
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.cultmesh.swarm_status_report.v0",
"status": if report.non_ready_count == 0 { "ready" } else { "attention" },
"status": if report.rows.is_empty() { "unknown" } else if report.non_ready_count == 0 { "ready" } else { "attention" },
"store": args.store,
"runtimeId": args.runtime_id,
"daemonCount": report.rows.len(),
@ -787,23 +765,9 @@ fn run_cli() -> Result<()> {
);
}
"cluster-topology" | "clusters" | "cluster-report" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let topology =
load_epiphany_cultmesh_cluster_topology(&args.store, args.runtime_id.clone())?;
let report = cluster_topology_report(&topology);
if report.rows.len() != 7
|| report.private_verse_count != 7
|| report.daemon_count != 7
|| report.public_discussion_count != 1
{
anyhow::bail!(
"cluster topology report expected seven clusters, private verses, daemons, and one public Persona surface"
);
}
if !report.rows.iter().all(|row| {
!row.private_state_exposed
&& !row.private_verse_id.is_empty()
@ -820,7 +784,7 @@ fn run_cli() -> Result<()> {
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.cultmesh.cluster_topology_report.v0",
"status": "ok",
"status": if report.rows.is_empty() { "empty" } else { "ok" },
"store": args.store,
"runtimeId": args.runtime_id,
"clusterCount": report.rows.len(),
@ -834,11 +798,6 @@ fn run_cli() -> Result<()> {
);
}
"eve-surfaces" | "eve-directory" | "odin-eve-surfaces" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let directory =
load_epiphany_cultmesh_eve_surface_directory(&args.store, args.runtime_id.clone())?;
let (_latest_repo_work_overview, repo_work_overviews) =
@ -848,7 +807,7 @@ fn run_cli() -> Result<()> {
"{}",
serde_json::to_string_pretty(&json!({
"schemaVersion": "epiphany.cultmesh.eve_surface_directory_report.v0",
"status": "ok",
"status": if report.rows.is_empty() { "empty" } else { "ok" },
"store": args.store,
"runtimeId": args.runtime_id,
"surfaceCount": report.rows.len(),
@ -864,11 +823,6 @@ fn run_cli() -> Result<()> {
);
}
"swarm-overview" | "agent-overview" | "global-agents" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let overview = load_swarm_overview_report(&args)?;
let commands = json!({
"topology": "epiphany-verse-query cluster-topology",
@ -905,11 +859,6 @@ fn run_cli() -> Result<()> {
);
}
"swarm-triage" | "triage-swarm" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let overview = load_swarm_overview_report(&args)?;
let pokes = if overview.liveness_status == "ready" {
Vec::new()
@ -1507,11 +1456,6 @@ fn run_cli() -> Result<()> {
);
}
"bifrost-ledger" | "publication-ledger" => {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let report = load_bifrost_ledger_report(&args)?;
println!(
"{}",
@ -7317,7 +7261,9 @@ fn daemon_restart_policy_directory_report_from_rows(
});
}
let status = if private_state_exposed || missing_count > 0 || disabled_count > 0 {
let status = if rows.is_empty() {
"empty"
} else if private_state_exposed || missing_count > 0 || disabled_count > 0 {
"attention"
} else {
"ok"
@ -7615,13 +7561,16 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
let service_online_runbook_available = service_execution_runbook_actions
.iter()
.any(|action| operator_artifact_status(&action.artifact_ref) == "present");
let liveness_status =
if daemon_report.non_ready_count == 0 && tool_report.host_attention_count == 0 {
"ready".to_string()
} else {
"attention".to_string()
};
let recovery_status = if policy_report.status == "ok"
let liveness_status = if daemon_report.rows.is_empty() {
"unknown".to_string()
} else if daemon_report.non_ready_count == 0 && tool_report.host_attention_count == 0 {
"ready".to_string()
} else {
"attention".to_string()
};
let recovery_status = if topology_report.rows.is_empty() {
"unknown".to_string()
} else if policy_report.status == "ok"
&& cluster_service_lifecycle_attention.is_none()
&& service_lifecycle_attention.is_none()
{
@ -7629,13 +7578,21 @@ fn load_swarm_overview_report(args: &Args) -> Result<SwarmOverviewReport> {
} else {
"attention".to_string()
};
let status = if liveness_status == "ready" && recovery_status == "ready" {
let status = if liveness_status == "unknown" || recovery_status == "unknown" {
"unknown".to_string()
} else if liveness_status == "ready" && recovery_status == "ready" {
"ready".to_string()
} else {
"attention".to_string()
};
let (recommended_action, recommended_wrapper_mode, recommended_wrapper_command) =
if liveness_status != "ready" {
if liveness_status == "unknown" {
(
"none-observation-missing".to_string(),
"none".to_string(),
"none".to_string(),
)
} else if liveness_status != "ready" {
(
"epiphany-verse-query poke-down-daemons".to_string(),
"swarm-poke-down".to_string(),
@ -10611,11 +10568,6 @@ fn swarm_online_runbook_readback_from_idunn(args: &Args) -> Result<(serde_json::
}
fn service_policy_directory_readback_from_idunn(args: &Args) -> Result<(serde_json::Value, bool)> {
seed_epiphany_local_verse_context(
&args.store,
args.runtime_id.clone(),
Utc::now().to_rfc3339(),
)?;
let policy_directory = load_epiphany_cultmesh_daemon_restart_policy_directory(
&args.store,
args.runtime_id.clone(),

View file

@ -5,6 +5,7 @@ use crate::default_hands_cultnet_contracts;
use crate::default_mind_cultnet_contracts;
use crate::default_soul_cultnet_contracts;
use crate::default_substrate_gate_cultnet_contracts;
#[cfg(test)]
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
@ -5801,14 +5802,6 @@ pub fn seed_epiphany_local_verse_context(
write_epiphany_cultmesh_eve_surface_states(store_path, runtime_id.clone())?;
{
let node = open_epiphany_cultmesh_node(store_path, runtime_id.clone())?;
for status in epiphany_cultmesh_daemon_statuses(generated_at_utc.clone()) {
if node
.get::<EpiphanyCultMeshDaemonStatusEntry>(status.daemon_id.as_str())?
.is_none()
{
write_epiphany_cultmesh_daemon_status(store_path, runtime_id.clone(), status)?;
}
}
if node
.get::<EpiphanyCultMeshSwarmBrakeEntry>(EPIPHANY_CULTMESH_SWARM_BRAKE_KEY)?
.is_none()
@ -6025,32 +6018,10 @@ pub fn load_epiphany_cultmesh_daemon_liveness(
> {
let store_path = store_path.as_ref();
let runtime_id = runtime_id.into();
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
let node = open_epiphany_cultmesh_node(store_path, runtime_id.clone())?;
let mut rows = Vec::new();
for cluster in epiphany_cultmesh_cluster_topology() {
let cluster = node
.get::<EpiphanyCultMeshClusterTopologyEntry>(&cluster.cluster_id)?
.unwrap_or(cluster);
let default_status = EpiphanyCultMeshDaemonStatusEntry {
schema_version: EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION.to_string(),
daemon_id: cluster.daemon_id.clone(),
cluster_id: cluster.cluster_id.clone(),
body_domain: cluster.body_domain.clone(),
daemon_surface_id: cluster.daemon_surface_id.clone(),
eve_surface_id: cluster.eve_surface_id.clone(),
status: "unknown".to_string(),
last_heartbeat_utc: "unknown".to_string(),
supported_actions: vec![
"inspectStatus".to_string(),
"pokeDaemon".to_string(),
"watchHeartbeat".to_string(),
],
operator_action: "pokeDaemon".to_string(),
private_state_exposed: false,
notes: vec![
"No daemon status document was found; operator should inspect or poke through typed lifecycle receipts.".to_string(),
],
};
for cluster in load_epiphany_cultmesh_cluster_topology(store_path, runtime_id.clone())? {
let default_status = unknown_daemon_status(&cluster);
let status = node
.get::<EpiphanyCultMeshDaemonStatusEntry>(&cluster.daemon_id)?
.unwrap_or(default_status);
@ -6071,32 +6042,10 @@ pub fn load_epiphany_cultmesh_daemon_restart_policy_directory(
> {
let store_path = store_path.as_ref();
let runtime_id = runtime_id.into();
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
let node = open_epiphany_cultmesh_node(store_path, runtime_id.clone())?;
let mut rows = Vec::new();
for cluster in epiphany_cultmesh_cluster_topology() {
let cluster = node
.get::<EpiphanyCultMeshClusterTopologyEntry>(&cluster.cluster_id)?
.unwrap_or(cluster);
let default_status = EpiphanyCultMeshDaemonStatusEntry {
schema_version: EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION.to_string(),
daemon_id: cluster.daemon_id.clone(),
cluster_id: cluster.cluster_id.clone(),
body_domain: cluster.body_domain.clone(),
daemon_surface_id: cluster.daemon_surface_id.clone(),
eve_surface_id: cluster.eve_surface_id.clone(),
status: "unknown".to_string(),
last_heartbeat_utc: "unknown".to_string(),
supported_actions: vec![
"inspectStatus".to_string(),
"pokeDaemon".to_string(),
"watchHeartbeat".to_string(),
],
operator_action: "pokeDaemon".to_string(),
private_state_exposed: false,
notes: vec![
"No daemon status document was found; operator should inspect or poke through typed lifecycle receipts.".to_string(),
],
};
for cluster in load_epiphany_cultmesh_cluster_topology(store_path, runtime_id.clone())? {
let default_status = unknown_daemon_status(&cluster);
let status = node
.get::<EpiphanyCultMeshDaemonStatusEntry>(&cluster.daemon_id)?
.unwrap_or(default_status);
@ -6120,41 +6069,50 @@ pub fn load_epiphany_cultmesh_eve_surface_directory(
> {
let store_path = store_path.as_ref();
let runtime_id = runtime_id.into();
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
let node = open_epiphany_cultmesh_node(store_path, runtime_id.clone())?;
let mut rows = Vec::new();
for cluster in epiphany_cultmesh_cluster_topology() {
let cluster = node
.get::<EpiphanyCultMeshClusterTopologyEntry>(&cluster.cluster_id)?
.unwrap_or(cluster);
let default_advertisement = epiphany_cultmesh_odin_advertisements()
for cluster in load_epiphany_cultmesh_cluster_topology(store_path, runtime_id.clone())? {
let Some(advertisement) = epiphany_cultmesh_odin_advertisements()
.into_iter()
.find(|advertisement| advertisement.cluster_id == cluster.cluster_id)
.with_context(|| {
format!(
"missing default Odin advertisement for cluster {}",
cluster.cluster_id
)
})?;
let advertisement = node
.get::<EpiphanyCultMeshOdinAdvertisementEntry>(&default_advertisement.advertisement_id)?
.unwrap_or(default_advertisement);
let default_surface = epiphany_cultmesh_eve_surface_states()
.into_iter()
.find(|surface| surface.surface_id == cluster.eve_surface_id)
.with_context(|| {
format!(
"missing default Eve surface state for cluster {}",
cluster.cluster_id
)
})?;
let surface = node
.get::<EpiphanyCultMeshEveSurfaceStateEntry>(&default_surface.surface_id)?
.unwrap_or(default_surface);
rows.push((cluster, advertisement, surface));
else {
continue;
};
let advertisement =
node.get::<EpiphanyCultMeshOdinAdvertisementEntry>(&advertisement.advertisement_id)?;
let surface = node.get::<EpiphanyCultMeshEveSurfaceStateEntry>(&cluster.eve_surface_id)?;
if let (Some(advertisement), Some(surface)) = (advertisement, surface) {
rows.push((cluster, advertisement, surface));
}
}
Ok(rows)
}
fn unknown_daemon_status(
cluster: &EpiphanyCultMeshClusterTopologyEntry,
) -> EpiphanyCultMeshDaemonStatusEntry {
EpiphanyCultMeshDaemonStatusEntry {
schema_version: EPIPHANY_CULTMESH_DAEMON_STATUS_SCHEMA_VERSION.to_string(),
daemon_id: cluster.daemon_id.clone(),
cluster_id: cluster.cluster_id.clone(),
body_domain: cluster.body_domain.clone(),
daemon_surface_id: cluster.daemon_surface_id.clone(),
eve_surface_id: cluster.eve_surface_id.clone(),
status: "unknown".to_string(),
last_heartbeat_utc: "unknown".to_string(),
supported_actions: vec![
"inspectStatus".to_string(),
"pokeDaemon".to_string(),
"watchHeartbeat".to_string(),
],
operator_action: "pokeDaemon".to_string(),
private_state_exposed: false,
notes: vec![
"No daemon-authored status document was found; liveness remains unknown.".to_string(),
],
}
}
pub fn load_epiphany_cultmesh_daemon_tool_directory(
store_path: impl AsRef<Path>,
runtime_id: impl Into<String>,
@ -6169,34 +6127,20 @@ pub fn load_epiphany_cultmesh_daemon_tool_directory(
let runtime_id = runtime_id.into();
let node = open_epiphany_cultmesh_node(store_path, runtime_id)?;
let mut rows = Vec::new();
for capability in epiphany_cultmesh_daemon_tool_capabilities() {
let capability = node
.get::<EpiphanyCultMeshDaemonToolCapabilityEntry>(&capability.capability_id)?
.unwrap_or(capability);
let default_cluster = epiphany_cultmesh_cluster_topology()
.into_iter()
.find(|cluster| cluster.cluster_id == capability.host_cluster_id)
.with_context(|| {
format!(
"missing default cluster topology for daemon tool {}",
capability.capability_id
)
})?;
let cluster = node
.get::<EpiphanyCultMeshClusterTopologyEntry>(&default_cluster.cluster_id)?
.unwrap_or(default_cluster);
let default_status = epiphany_cultmesh_daemon_statuses("")
.into_iter()
.find(|status| status.daemon_id == capability.host_daemon_id)
.with_context(|| {
format!(
"missing default daemon status for daemon tool {}",
capability.capability_id
)
})?;
let capabilities = node
.get_all_with_keys::<EpiphanyCultMeshDaemonToolCapabilityEntry>()?
.into_iter()
.map(|(_, capability)| capability)
.collect::<Vec<_>>();
for capability in capabilities {
let Some(cluster) =
node.get::<EpiphanyCultMeshClusterTopologyEntry>(&capability.host_cluster_id)?
else {
continue;
};
let status = node
.get::<EpiphanyCultMeshDaemonStatusEntry>(&default_status.daemon_id)?
.unwrap_or(default_status);
.get::<EpiphanyCultMeshDaemonStatusEntry>(&capability.host_daemon_id)?
.unwrap_or_else(|| unknown_daemon_status(&cluster));
rows.push((cluster, status, capability));
}
Ok(rows)
@ -8283,6 +8227,26 @@ mod tests {
Ok(())
}
#[test]
fn diagnostic_loaders_do_not_materialize_missing_body_state() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("missing-local-verse.ccmp");
assert!(load_epiphany_cultmesh_cluster_topology(&store, "epiphany-test")?.is_empty());
assert!(load_epiphany_cultmesh_daemon_liveness(&store, "epiphany-test")?.is_empty());
assert!(
load_epiphany_cultmesh_daemon_restart_policy_directory(&store, "epiphany-test")?
.is_empty()
);
assert!(load_epiphany_cultmesh_eve_surface_directory(&store, "epiphany-test")?.is_empty());
assert!(load_epiphany_cultmesh_daemon_tool_directory(&store, "epiphany-test")?.is_empty());
assert!(
!store.exists(),
"read-only diagnostic loaders must not create a CultCache store"
);
Ok(())
}
#[test]
fn daemon_status_refuses_private_state_exposure() -> Result<()> {
let mut status = epiphany_cultmesh_daemon_statuses("2026-06-17T00:00:00Z")

View file

@ -1,5 +1,14 @@
# Epiphany Current Algorithmic Map
## Observation and bootstrap authority correction (2026-07-12)
- Owner: diagnostics only project persisted CultMesh state; they never initialize it.
- Bootstrap owns static policy, topology, schema, advertisement, surface, and capability declarations. It does not own daemon liveness.
- Daemons own heartbeat/status documents. Missing status is represented as `unknown`, never promoted to `ready` by a reader or seeder.
- Provider directories contain only persisted provider advertisements, Eve surfaces, and tool capabilities. Missing provider state produces no synthetic row.
- Forbidden writers removed in this pass: read-command calls to `seed_epiphany_local_verse_context`, loader fallback constructors, and bootstrap's default-ready daemon-status loop.
- Next authority cut: requester commands may author intents, but Bifrost, GitHub, tool providers, Eve providers, and daemon lifecycle owners must author their own response receipts.
This is the source-grounded map of the live machine. Historical route and
bridge anatomy belongs in git history and evidence ledgers, not here.

View file

@ -1,5 +1,9 @@
# Fresh Workspace Handoff
## 2026-07-12 diagnostic authority cut
The conceptual-substitution audit found observation manufacturing the body it claimed to inspect. The current local pass removes seeding from read-only Verse commands; persisted topology now bounds liveness, restart-policy, Eve-surface, and tool-directory loaders; absent documents remain empty or unknown; and explicit local bootstrap no longer counterfeits daemon-ready heartbeats. Negative proof covers a nonexistent CultCache path and all 249 library tests pass. Next cut the local CLI's requester/provider collapse: Bifrost/GitHub publication, tool invocation, Eve connection, and daemon poke commands must stop authoring both intent and accepted response receipt.
This is the re-entry rite for `E:\Projects\EpiphanyAgent`: the waking chant for
the local machine-spirit before it touches the forge.

Binary file not shown.

View file

@ -70,7 +70,7 @@ data_flow:
- move historical proof to git, commits, smoke artifacts, or distilled evidence rather than plan prose
active_subgoals:
- Use `notes/conceptual-substitution-audit-2026-07-12.md` as the current authority-corrosion audit. The June 18 typed swarm-surface pass collapsed bootstrap, observation, request routing, and provider receipt authorship into one local CLI. Highest-priority correction: read commands must not seed state, missing daemon/provider truth must remain missing, and only the named provider/lifecycle body may author response receipts.
- Use `notes/conceptual-substitution-audit-2026-07-12.md` as the current authority-corrosion audit. The June 18 typed swarm-surface pass collapsed bootstrap, observation, request routing, and provider receipt authorship into one local CLI. The first cut is landed locally: diagnostic commands no longer seed state, loaders no longer manufacture topology/provider/capability rows, missing daemon truth remains unknown, and explicit bootstrap no longer writes synthetic ready heartbeats. Next cut: separate requester-authored intents from provider-authored response receipts, beginning with the Bifrost/GitHub publication CLI.
- `swarm-overview` is an Epiphany-local, renderer-neutral diagnostic projection over provider-owned typed state. It owns no lifecycle, discovery, composition, or mutation authority. Epiphany publishes clean provider-owned Eve surfaces; Odin may discover them; downstream lowerers and compositors remain outside Epiphany's concern.
- Idunn owns daemon survival and service lifecycle physiology. Codex/operator sessions may inspect, generate runbooks, and route explicit operator authority, but keeping daemons alive belongs to Idunn-owned service lifecycle receipts, scheduler policy, audits, and aftercare. Do not let Self, diagnostic projections, or ad hoc wrapper summaries become a second daemon-keeper. Global tool readbacks for Self `service-health`, `service-policy-directory`, and `swarm-online-runbook` state `lifecycleOwner=Idunn` and `hostedBody=Epiphany` without service mutation or private-state exposure.
- Use `notes/epiphany-cultmesh-dreaming-roadmap.md` as the design authority for distributed Epiphany dreaming. Public dreams are separately authored typed documents distributed through CultMesh/CultNet; private state remains local and cannot be shared by flipping a visibility flag. Foreign dreams are external thought weather until a reviewed local adoption receipt digests them into memory, planning, doctrine, or governance.