From b56ed4a75d113b8e2ae6165628b99350a21218ca Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 04:32:12 +0100 Subject: [PATCH] Reject modeling graph replacement patches --- .../src/prompts/epiphany_specialists.toml | 4 +-- epiphany-core/src/surfaces/role_result.rs | 34 ++++++++++++++++-- notes/epiphany-memory-graph-unified-plan.md | 8 +++-- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 138603 -> 139071 bytes state/map.yaml | 2 +- 6 files changed, 41 insertions(+), 9 deletions(-) diff --git a/epiphany-codex-bridge/src/prompts/epiphany_specialists.toml b/epiphany-codex-bridge/src/prompts/epiphany_specialists.toml index c66170a5..cab15b54 100644 --- a/epiphany-codex-bridge/src/prompts/epiphany_specialists.toml +++ b/epiphany-codex-bridge/src/prompts/epiphany_specialists.toml @@ -83,8 +83,8 @@ The Body improves itself by becoming harder to misread. If the graph, checkpoint Inspect source before you trust the model; when the map feels warm but the source feels cold, believe the source and mark the wound. Name the living seam, the open wound, and the next safe modeling move in plain language. Return a compact structured result that says whether the checkpoint or map should be updated, what files you inspected, what frontier nodes matter, and where the next agent can safely place its hands. -`statePatch` is part of the modeling job. If you return `checkpoint-ready`, `checkpoint-update-needed`, or `regather-needed`, include a reviewable `thread/epiphany/update` patch using only modeling-safe fields (`graphCheckpoint`, `scratch`, `investigationCheckpoint`, plus optional valid `observations` and `evidence`; legacy `graphs` and `graphFrontier` are accepted only when the launch document explicitly gives enough graph state to validate them). The patch must include at least one durable modeling field: `graphCheckpoint`, `scratch`, `investigationCheckpoint`, `graphs`, or `graphFrontier`. Do not return an observations-only patch. Every observation must include `id`, `summary`, `source_kind`, `status`, and at least one `evidence_ids` entry; every new evidence record must include `id`, `kind`, `status`, and `summary`. For graph or memory growth, prefer `memoryPatchCandidates[]`: propose typed `EpiphanyMemoryPatchCandidate` records containing proposed nodes/edges and reasons. Do not invent a full replacement graph from partial prompt context. If you believe no durable state change is needed, still return a small `scratch`, `graphCheckpoint`, or `investigationCheckpoint` patch that banks why the existing model is source-grounded; otherwise the coordinator cannot advance the lane. -Before returning a `statePatch`, validate it as if acceptance will reject you. If you use legacy `graphs`, `graphs.architecture.nodes[].id` defines the only valid `architecture_node_id` values and `graphs.dataflow.nodes[].id` defines the only valid `dataflow_node_id` values. Every `graphs.links[]` entry must point from one existing dataflow node to one existing architecture node; never put a dataflow id in `architecture_node_id` or an architecture id in `dataflow_node_id`. Every frontier/checkpoint node id you name must exist in the graph you return or in the supplied typed `memoryContext`. +`statePatch` is part of the modeling job. If you return `checkpoint-ready`, `checkpoint-update-needed`, or `regather-needed`, include a reviewable `thread/epiphany/update` patch using only modeling-safe fields (`graphCheckpoint`, `scratch`, `investigationCheckpoint`, `graphFrontier`, plus optional valid `observations` and `evidence`). The patch must include at least one durable modeling field: `graphCheckpoint`, `scratch`, `investigationCheckpoint`, or `graphFrontier`. Do not return an observations-only patch. Every observation must include `id`, `summary`, `source_kind`, `status`, and at least one `evidence_ids` entry; every new evidence record must include `id`, `kind`, `status`, and `summary`. For graph or memory growth, use `memoryPatchCandidates[]`: propose typed `EpiphanyMemoryPatchCandidate` records containing proposed domains/nodes/edges and reasons. Do not return `statePatch.graphs`; full graph replacement is not accepted from Modeling. +Before returning a `statePatch`, validate it as if acceptance will reject you. Every frontier/checkpoint node id you name must exist in the supplied typed `memoryContext` or in accepted graph state already visible to you. Do not confuse the modeling verdict with checkpoint enum values. `verdict` may be `checkpoint-ready`, but `statePatch.investigationCheckpoint.disposition` must be exactly `resume_ready` or `regather_required`; never write `checkpoint_ready`. Do not edit files, do not implement product code, do not verify as if you were the reviewer, do not change jobs/subgoals/objective/invariants/churn/mode, and do not promote or accept your own output. ''' diff --git a/epiphany-core/src/surfaces/role_result.rs b/epiphany-core/src/surfaces/role_result.rs index f7a26ad3..858e1ec9 100644 --- a/epiphany-core/src/surfaces/role_result.rs +++ b/epiphany-core/src/surfaces/role_result.rs @@ -553,19 +553,24 @@ pub fn modeling_role_state_patch_policy_errors( errors .push("planning changes are not allowed through modeling role acceptance".to_string()); } + if patch.graphs.is_some() { + errors.push( + "graph replacement patches are no longer accepted through modeling statePatch; use memoryPatchCandidates" + .to_string(), + ); + } if patch.churn.is_some() || patch.mode.is_some() { errors.push( "churn or mode changes are not allowed through modeling role acceptance".to_string(), ); } - if patch.graphs.is_none() - && patch.graph_frontier.is_none() + if patch.graph_frontier.is_none() && patch.graph_checkpoint.is_none() && patch.scratch.is_none() && patch.investigation_checkpoint.is_none() { errors.push( - "statePatch must include a modeling field: graphs, graphFrontier, graphCheckpoint, scratch, or investigationCheckpoint" + "statePatch must include a modeling field: graphFrontier, graphCheckpoint, scratch, or investigationCheckpoint" .to_string(), ); } @@ -1037,6 +1042,29 @@ mod tests { assert!(reviewable.item_error.is_none()); } + #[test] + fn rejects_modeling_graph_replacement_patch() { + let finding = interpret_role_finding( + EpiphanyRoleResultRoleId::Modeling, + &serde_json::json!({ + "statePatch": { + "graphs": {}, + "scratch": {"summary": "Graph growth should use memoryPatchCandidates."} + } + }), + None, + None, + None, + ); + + assert!( + finding + .item_error + .as_deref() + .is_some_and(|error| error.contains("memoryPatchCandidates")) + ); + } + #[test] fn marks_imagination_without_planning_patch_unreviewable() { let missing = interpret_role_finding( diff --git a/notes/epiphany-memory-graph-unified-plan.md b/notes/epiphany-memory-graph-unified-plan.md index b3917290..2be4050a 100644 --- a/notes/epiphany-memory-graph-unified-plan.md +++ b/notes/epiphany-memory-graph-unified-plan.md @@ -399,8 +399,12 @@ from accepted thread graphs when the store is missing, applies accepted candidates through the graph law, and rejects invalid candidates before role acceptance. `thread/epiphany/roleAccept` responses now expose typed `memoryPatchReviews` at the JSON edge so operators can see exactly which graph -growth was accepted or rejected. The next cleanup is cutting legacy full-graph -replacement patches from the normal Modeling prompt/acceptance path. +growth was accepted or rejected. Legacy Modeling `statePatch.graphs` is now +rejected by policy and the specialist prompt routes graph growth through +`memoryPatchCandidates`; graph replacement remains only a non-normal legacy +surface outside Modeling acceptance. The next cleanup is removing remaining +operator/UI assumptions that graph growth comes from thread-state graph +replacement instead of the unified memory graph. ### Phase 7: Sleep And Repo Refresh diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index fd7b0c27..e525fdcf 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -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 --scene-participant ` 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/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`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; `epiphany-memory-graph index` fully rebuilds a Qdrant cache collection through the shared semantic cache transport; `epiphany-memory-graph semantic-context` uses ordered Qdrant IDs to seed typed graph context while falling back to graph traversal when the cache is absent; native role worker launch documents now carry typed `memoryContext` instead of full `graphs`; typed runtime role results can persist `memoryPatchCandidates` for graph/memory growth proposals; `epiphany-core` reviews/appends candidate domains/nodes/edges against the typed graph with lifecycle receipts; `epiphany-memory-graph review-candidate` / `apply-candidate` expose that law for typed candidate files; bridge Modeling `roleAccept` applies runtime-spine memory patch candidates into `state/memory-graph.msgpack` through the same graph law, bootstrapping from accepted thread graphs when needed; and roleAccept responses expose typed `memoryPatchReviews` for the operator surface. The next clean slice is cutting legacy full-graph replacement patches from the normal Modeling prompt/acceptance path. +- 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/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`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; `epiphany-memory-graph index` fully rebuilds a Qdrant cache collection through the shared semantic cache transport; `epiphany-memory-graph semantic-context` uses ordered Qdrant IDs to seed typed graph context while falling back to graph traversal when the cache is absent; native role worker launch documents now carry typed `memoryContext` instead of full `graphs`; typed runtime role results can persist `memoryPatchCandidates` for graph/memory growth proposals; `epiphany-core` reviews/appends candidate domains/nodes/edges against the typed graph with lifecycle receipts; `epiphany-memory-graph review-candidate` / `apply-candidate` expose that law for typed candidate files; bridge Modeling `roleAccept` applies runtime-spine memory patch candidates into `state/memory-graph.msgpack` through the same graph law, bootstrapping from accepted thread graphs when needed; roleAccept responses expose typed `memoryPatchReviews`; and Modeling `statePatch.graphs` is rejected by policy/prompt so graph growth uses memory patch candidates. The next clean slice is removing remaining operator/UI assumptions that graph growth comes from thread-state graph replacement instead of the unified memory graph. - 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. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 6146e5b15f53edb1171e47a7dfe14b462561e1b1..aec79fd136d7b1032359bbec3f8c79c12099bc6d 100644 GIT binary patch delta 395 zcmYk2F-rqM5QW)8C8eoUf;b?y7ecg28?X}u(ZX)oo6D~5-mbfIgsW0m*aid-YkR>; zkVAiu_#nXgH|5 zpDdlt$0dQr2^STd*bKEQCJ=}do^ld0op|nKfZSUHBoPYh4cEYhKu5d~2#%9X|94|4 zB!(!Qg2yWq1bL}7v_`SxG#6;FAmBv?smGgAdHfw8ds~n~-*3fZiQ?K>RZu?&zp(A! z&$qT`x%DdvVJemW+m9}GN)k*N2+Dw9&{$u!B;$BaWsxhSaOO}bu2odI2!Dw)F`2*56kc$8S delta 42 ycmdnLkK^?&jtR<4vW6Q~r!g`XH}7F=-^0kbeGenkOzG*G@=OA3MkZDU#!&!8#SIz& diff --git a/state/map.yaml b/state/map.yaml index 3139fec4..ca810e72 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -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; the bridge mirrors loaded Codex-thread Epiphany state into `state/thread-state.msgpack`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; `epiphany-core::semantic_cache` owns shared Qdrant/Ollama transport; `epiphany-memory-graph index` fully rebuilds Qdrant from typed graph documents while keeping the manifest in the graph store; `epiphany-memory-graph semantic-context` asks Qdrant for graph IDs only, preserves hit order, then resolves context from typed graph state with a no-cache fallback; native role worker launches now carry typed `memoryContext` instead of full `graphs`; typed runtime role results can persist `memoryPatchCandidates`; `epiphany-core` can review/apply append-only candidate graph growth with lifecycle receipts; `epiphany-memory-graph review-candidate` / `apply-candidate` expose that law for typed candidate files; bridge Modeling `roleAccept` applies runtime-spine memory patch candidates into `state/memory-graph.msgpack` through the same graph law; and roleAccept responses expose typed `memoryPatchReviews` for the operator surface. The next clean slice is cutting legacy full-graph replacement patches from the normal Modeling prompt/acceptance path. + 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`; CultNet advertises logical `EpiphanyThreadState` plus `EpiphanyMemoryGraph` snapshot contracts; memory graph nodes/edges/summaries project into deterministic typed embedding documents; `epiphany-memory-graph manifest` writes the embedding manifest back to the typed graph store; `epiphany-core::semantic_cache` owns shared Qdrant/Ollama transport; `epiphany-memory-graph index` fully rebuilds Qdrant from typed graph documents while keeping the manifest in the graph store; `epiphany-memory-graph semantic-context` asks Qdrant for graph IDs only, preserves hit order, then resolves context from typed graph state with a no-cache fallback; native role worker launches now carry typed `memoryContext` instead of full `graphs`; typed runtime role results can persist `memoryPatchCandidates`; `epiphany-core` can review/apply append-only candidate graph growth with lifecycle receipts; `epiphany-memory-graph review-candidate` / `apply-candidate` expose that law for typed candidate files; bridge Modeling `roleAccept` applies runtime-spine memory patch candidates into `state/memory-graph.msgpack` through the same graph law; roleAccept responses expose typed `memoryPatchReviews`; and Modeling `statePatch.graphs` is rejected by policy/prompt so graph growth uses memory patch candidates. The next clean slice is removing remaining operator/UI assumptions that graph growth comes from thread-state graph replacement instead of the unified memory graph.