Advertise memory graph CultNet contracts

This commit is contained in:
Meta Vens 2026-05-18 02:21:51 +01:00
commit 7424bdf395
7 changed files with 210 additions and 2 deletions

View file

@ -2,8 +2,12 @@ use crate::EpiphanyWorkerLaunchDocument;
use crate::agent_memory::AGENT_MEMORY_TYPE;
use crate::heartbeat_state::HEARTBEAT_STATE_SCHEMA_VERSION;
use crate::heartbeat_state::HEARTBEAT_STATE_TYPE;
use crate::memory_graph::MEMORY_GRAPH_SCHEMA_VERSION;
use crate::memory_graph::MEMORY_GRAPH_TYPE;
use crate::state_ledger::STATE_LEDGER_SCHEMA_VERSION;
use crate::state_ledger::STATE_LEDGER_STORE_TYPE;
use crate::thread_state_store::THREAD_STATE_SCHEMA_VERSION;
use crate::thread_state_store::THREAD_STATE_TYPE;
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
@ -1515,6 +1519,28 @@ fn epiphany_mutation_contracts() -> Vec<CultNetDocumentMutationContract> {
"The ledger is inspected as durable memory; writes are mediated by role-specific state flows.",
],
),
mutation_contract(
THREAD_STATE_TYPE,
THREAD_STATE_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"The mirrored thread state is the typed repo/control-plane state source; Codex rollout is a compatibility source, not the network contract.",
],
),
mutation_contract(
MEMORY_GRAPH_TYPE,
MEMORY_GRAPH_SCHEMA_VERSION,
vec![CultNetDocumentOperation::Snapshot],
CultNetMutationAuthority::ReadOnly,
vec![],
vec![],
vec![
"The unified memory graph is typed durable state; Qdrant embeddings are rebuildable cache, not canonical memory.",
],
),
read_only_surface_contract(
SURFACE_SCENE_TYPE,
SCENE_SURFACE_SCHEMA_VERSION,
@ -2192,6 +2218,22 @@ mod tests {
.iter()
.any(|item| item == OPENAI_MODEL_RECEIPT_TYPE))
);
let memory_graph_contract = contracts
.iter()
.find(|contract| contract.document_type == MEMORY_GRAPH_TYPE)
.expect("memory graph should advertise a read-only contract");
assert_eq!(
memory_graph_contract.authority,
CultNetMutationAuthority::ReadOnly
);
let thread_state_contract = contracts
.iter()
.find(|contract| contract.document_type == THREAD_STATE_TYPE)
.expect("thread state should advertise a read-only contract");
assert_eq!(
thread_state_contract.authority,
CultNetMutationAuthority::ReadOnly
);
}
other => panic!("expected hello, got {other:?}"),
}
@ -2230,6 +2272,14 @@ mod tests {
schema.document_type.as_deref() == Some(OPENAI_MODEL_RECEIPT_TYPE)
&& schema.schema_version.as_deref() == Some(OPENAI_MODEL_RECEIPT_SCHEMA_VERSION)
}));
assert!(schemas.iter().any(|schema| {
schema.document_type.as_deref() == Some(MEMORY_GRAPH_TYPE)
&& schema.schema_version.as_deref() == Some(MEMORY_GRAPH_SCHEMA_VERSION)
}));
assert!(schemas.iter().any(|schema| {
schema.document_type.as_deref() == Some(THREAD_STATE_TYPE)
&& schema.schema_version.as_deref() == Some(THREAD_STATE_SCHEMA_VERSION)
}));
Ok(())
}
}

View file

@ -96,7 +96,7 @@ remembers doctrine; the branch remembers the blade.
- 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, personality cooldown, mood cooldown, effective cooldown, adaptive pacing, history, and pending turns through `epiphany-core::EpiphanyHeartbeatStateEntry` and the native `epiphany-heartbeat-store` binary. Role dossiers set baseline timing; appraisal mood/anxiety bends it through urgency, arousal, thought pressure, guardedness, and reaction intensity, so Hands-like work pressure and high-need anxious lanes recover sooner without being heartbeaten while a prior turn is running. `epiphany-heartbeat-store pump` computes pressure from external urgency, mood/anxiety, reaction intensity, thought pressure, and current pending load, then chooses tempo plus target concurrency: calm can launch zero and sleep slow; alarm can fill most active lanes. Idle turns are for rumination: light thought shuffling, role-quality attention, and candidate selfPatch pressure. Sleep/dream cycle passes are the intended distillation window for durable self-memory and doctrine. 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, projects the active thought cluster through each role's Ghostlight-shaped personality vectors, derives participant-local reactions, applies personality/mood timing, advances the sleep/dream cycle, updates the typed heartbeat store, and emits an auditable `epiphany.void_routine.v0` receipt. The routine now also carries anti-loop physiology imported from Void's calmer brain: `noveltyToSelf`, `noveltyToRoom`, source coverage, saturation pressure, refractory cooling, and explicit permission to let a live unsaturated thought deepen without forcing novelty theater every pass. This mutates only heartbeat physiology fields: project truth and role memory mutation remain on their reviewed surfaces.
- The next memory foundation must not build separate engines for repo graph and agent mind. Heartbeat cognition, role self-memory, repo architecture/dataflow, evidence scars, incubation, agency pressure, and context packets should converge through `EpiphanyMemoryGraph` profiles so one typed graph owns anchors, lifecycle, summaries, freshness, context cuts, and Qdrant embedding manifests. Repo, agent, and heartbeat profile producers now map accepted graph truth, reviewed role dossier memories/goals/values, and provisional heartbeat short-term/incubation/agency/candidate pressure into memory graph documents without scanner/Qdrant/model work. Heartbeat import deliberately does not mark durable promotion. Compose now merges profile snapshots into one validated graph and rejects duplicate authority; `epiphany-memory-graph compose` writes a composed typed CultCache graph from typed source graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory plus heartbeat-cognition producers from their typed stores into one graph store; `epiphany-core` has a native typed `EpiphanyThreadState` CultCache store seam; and the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack` under the workspace. The next clean slice is using that mirrored thread-state store in local refresh/dogfood and then deciding the CultNet/API advertisement boundary, still before Qdrant, prompt integration, or sleep promotion.
- The next memory foundation must not build separate engines for repo graph and agent mind. Heartbeat cognition, role self-memory, repo architecture/dataflow, evidence scars, incubation, agency pressure, and context packets should converge through `EpiphanyMemoryGraph` profiles so one typed graph owns anchors, lifecycle, summaries, freshness, context cuts, and Qdrant embedding manifests. Repo, agent, and heartbeat profile producers now map accepted graph truth, reviewed role dossier memories/goals/values, and provisional heartbeat short-term/incubation/agency/candidate pressure into memory graph documents without scanner/Qdrant/model work. Heartbeat import deliberately does not mark durable promotion. Compose now merges profile snapshots into one validated graph and rejects duplicate authority; `epiphany-memory-graph compose` writes a composed typed CultCache graph from typed source graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory plus heartbeat-cognition producers from their typed stores into one graph store; `epiphany-core` has a native typed `EpiphanyThreadState` CultCache store seam; the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack`; and CultNet now advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts. The next clean slice is local refresh/dogfood once a mirrored thread-state store exists, then a Qdrant embedding cache writer that treats embeddings as rebuildable manifests, not canonical memory.
- Manual Codex-run rumination still has an explicit aftercare rule until Epiphany owns the full sleep consolidator. In the intended Epiphany cycle, sub-agents ruminate when idle and distill when they sleep; in this supervising Codex thread, a heartbeat/routine vigil is only physiology until a separate closing pass reviews the receipts and decides whether map, handoff, evidence, or role self-memory should change.
- 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. If a Face has a persona name/avatar, `post` uses the shared Discord webhook pipe so each Epiphany can speak with its own nickname and avatar without a separate bot identity.
- The Void memory bridge is now native enough to keep the useful organs attached. `state/void-memory.toml` and `epiphany-void-memory` can check Void's Docker Postgres state spine, query Qdrant Discord-history and source/lore collections with the configured Ollama embedding model, and fetch raw archive context windows from Void's file-backed Discord archive. Native `epiphany-mvp-status` includes a `voidMemory` block so Aquarium/backend clients can inspect whether the mouth and memory are actually wired.

View file

@ -0,0 +1,71 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.memory-graph.schema.json",
"title": "Epiphany Memory Graph",
"description": "Unified typed memory graph for repo architecture/dataflow, role memory, heartbeat pressure, incubation, agency, candidate interventions, and evidence. Embeddings are cache metadata, not canonical truth.",
"type": "object",
"additionalProperties": true,
"properties": {
"schemaVersion": {
"type": [
"string",
"null"
]
},
"graphId": {
"type": "string"
},
"domains": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"nodes": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"edges": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"summaries": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"embeddingManifest": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"freshness": {
"type": [
"object",
"null"
],
"additionalProperties": true
},
"lifecycleReceipts": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"required": [
"graphId"
]
}

View file

@ -0,0 +1,65 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.thread-state.schema.json",
"title": "Epiphany Thread State",
"description": "Typed Epiphany control-plane state mirrored from a loaded Codex-compatible thread. This is the logical state contract, not the Codex rollout storage format.",
"type": "object",
"additionalProperties": true,
"properties": {
"revision": {
"type": "integer",
"minimum": 0
},
"objective": {
"type": [
"string",
"null"
]
},
"activeSubgoalId": {
"type": [
"string",
"null"
]
},
"subgoals": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"invariants": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"graphs": {
"type": "object",
"additionalProperties": true
},
"observations": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"recentEvidence": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"planning": {
"type": "object",
"additionalProperties": true
}
},
"required": [
"revision"
]
}

View file

@ -144,6 +144,28 @@
"title": "Epiphany State Ledger",
"path": "epiphany.state-ledger.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.thread-state.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.thread_state.v0",
"documentType": "epiphany.thread_state",
"title": "Epiphany Thread State",
"path": "epiphany.thread-state.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.memory-graph.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.memory_graph.v0",
"documentType": "epiphany.memory_graph",
"title": "Epiphany Memory Graph",
"path": "epiphany.memory-graph.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.surface.scene.schema.json",
"kind": "document_payload",

Binary file not shown.

View file

@ -297,4 +297,4 @@ current_status:
freshness propagation, summary-versus-child context cuts, and a validated
CultCache store entry; the native `epiphany-memory-graph` binary can
status/validate/query/smoke the store without Qdrant.
next_action: Continue the memory graph build unless a more urgent Codex starvation regression appears. Repo, agent, and heartbeat profile producers now map accepted architecture/dataflow graph truth, reviewed role dossier memory/goals/values, and heartbeat cognition pressure into `EpiphanyMemoryGraph` documents; compose merges profile snapshots into one validated graph; `epiphany-memory-graph compose` writes from typed graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory and heartbeat-cognition producers from their typed stores; `epiphany-core` has a native typed `EpiphanyThreadState` CultCache store seam; and the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack` under the workspace. The next clean slice is using that mirrored thread-state store in local refresh/dogfood and then deciding the CultNet/API advertisement boundary, still without Qdrant, prompt integration, or sleep promotion.
next_action: Continue the memory graph build unless a more urgent Codex starvation regression appears. Repo, agent, and heartbeat profile producers now map accepted architecture/dataflow graph truth, reviewed role dossier memory/goals/values, and heartbeat cognition pressure into `EpiphanyMemoryGraph` documents; compose merges profile snapshots into one validated graph; `epiphany-memory-graph compose` writes from typed graph stores; `epiphany-memory-graph refresh` can invoke live agent-memory and heartbeat-cognition producers from their typed stores; `epiphany-core` has a native typed `EpiphanyThreadState` CultCache store seam; the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack`; and CultNet now advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts. The next clean slice is local refresh/dogfood once a mirrored thread-state store exists, then a Qdrant embedding cache writer that treats embeddings as rebuildable manifests, not canonical memory.