From bbd3f735b07315659a8f608486627d669ea4f916 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 12 Jul 2026 12:44:41 +0100 Subject: [PATCH] Refresh Perfect Machine audit and heartbeat service --- .../src/bin/epiphany-heartbeat-store.rs | 85 +++ notes/epiphany-current-algorithmic-map.md | 12 + notes/fresh-workspace-handoff.md | 14 + notes/perfect-machine-audit-roadmap.md | 598 ++++++------------ state/ledgers.msgpack | Bin 423755 -> 424152 bytes state/map.yaml | 2 +- 6 files changed, 295 insertions(+), 416 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-heartbeat-store.rs b/epiphany-core/src/bin/epiphany-heartbeat-store.rs index 37b15cd1..b05d6602 100644 --- a/epiphany-core/src/bin/epiphany-heartbeat-store.rs +++ b/epiphany-core/src/bin/epiphany-heartbeat-store.rs @@ -27,6 +27,8 @@ use std::env; use std::fs; use std::path::Path; use std::path::PathBuf; +use std::thread; +use std::time::Duration; use uuid::Uuid; fn main() -> Result<()> { @@ -79,6 +81,8 @@ fn main() -> Result<()> { let mut mention_id: Option = None; let mut max_age_seconds = 1800_i64; let mut now_utc: Option = None; + let mut interval_seconds = 120_u64; + let mut max_iterations = 0_u64; while let Some(arg) = args.next() { match arg.as_str() { @@ -151,6 +155,12 @@ fn main() -> Result<()> { max_age_seconds = next_value(&mut args, "--max-age-seconds")?.parse()? } "--now-utc" => now_utc = Some(next_value(&mut args, "--now-utc")?), + "--interval-seconds" => { + interval_seconds = next_value(&mut args, "--interval-seconds")?.parse()? + } + "--max-iterations" => { + max_iterations = next_value(&mut args, "--max-iterations")?.parse()? + } _ => return Err(anyhow!("unknown argument {arg:?}")), } } @@ -378,6 +388,81 @@ fn main() -> Result<()> { )?; println!("{}", result); } + "serve" => { + if interval_seconds == 0 { + return Err(anyhow!("serve requires --interval-seconds greater than zero")); + } + let store_path = store_path.ok_or_else(|| anyhow!("serve requires --store"))?; + let artifact_dir = + artifact_dir.ok_or_else(|| anyhow!("serve requires --artifact-dir"))?; + if let Some(agent_store) = &agent_store { + let errors = validate_agent_memory_store(agent_store)?; + if !errors.is_empty() { + return Err(anyhow!( + "agent memory validation failed: {}", + errors.join("; ") + )); + } + } + fs::create_dir_all(&artifact_dir).with_context(|| { + format!( + "failed to create heartbeat serve artifact directory {}", + artifact_dir.display() + ) + })?; + let mut completed_iterations = 0_u64; + loop { + if max_iterations > 0 && completed_iterations >= max_iterations { + break; + } + assert_swarm_brake_allows_heartbeat(&local_verse_store, "serve")?; + let iteration = completed_iterations + 1; + let iteration_dir = artifact_dir.join(format!("pulse-{iteration:06}")); + let result = run_void_routine_store( + &store_path, + &iteration_dir, + VoidRoutineOptions { + agent_store: agent_store.clone(), + source: source.clone(), + allow_dream: !no_dream, + }, + )?; + completed_iterations = iteration; + println!( + "{}", + serde_json::json!({ + "schemaVersion": "epiphany.heartbeat.serve_pulse.v0", + "status": "completed", + "owner": "heartbeat", + "lifecycleOwner": "Idunn", + "iteration": iteration, + "artifactDir": iteration_dir, + "routineOk": result["ok"], + "routineArtifact": result["artifactPath"], + "privateStateExposed": false + }) + ); + if max_iterations > 0 && completed_iterations >= max_iterations { + break; + } + thread::sleep(Duration::from_secs(interval_seconds)); + } + println!( + "{}", + serde_json::json!({ + "schemaVersion": "epiphany.heartbeat.serve_receipt.v0", + "status": "stopped-cleanly", + "owner": "heartbeat", + "lifecycleOwner": "Idunn", + "store": store_path, + "artifactDir": artifact_dir, + "intervalSeconds": interval_seconds, + "completedIterations": completed_iterations, + "bounded": max_iterations > 0, + "privateStateExposed": false + }) + ); + } "smoke" => { let agent_store = agent_store.unwrap_or_else(|| PathBuf::from("state/agents.msgpack")); let result = run_smoke(&agent_store)?; diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 6f54106b..6e3cda7b 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -344,5 +344,17 @@ Cut or correct next: - any remaining full-context serializer or summary that duplicates typed owner state instead of projecting it narrowly. +## Native Heartbeat Service Boundary + +The refreshed Perfect Machine audit selects runtime physiology as the next +organ boundary. `epiphany-heartbeat-store serve` now owns a native interval +loop around the existing `run_void_routine_store` primitive. It writes one +iteration directory per pulse, emits only a compact pulse receipt containing +artifact identity and success, supports bounded clean shutdown through +`--max-iterations`, and contains no child-process spawn or second state writer. +Heartbeat owns pulse timing; the next cut is to launch this binary through +Idunn and prove restart/resume, swarm-brake observability, and lifecycle +readback before demoting the PowerShell rumination vigil. + This map must change when ownership changes. Historical scars belong in git, evidence, or an explicitly archived note—not in the machine's proprioception. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 4aa5a440..04bc7842 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -2176,6 +2176,20 @@ typed finding and empty stderr; the next scheduler dry-run returned `action=admit-modeling`. The generation-one campaign is complete. Next refresh the Perfect Machine audit against live source and cut stale roadmap claims before selecting the next organ boundary. +That audit is now refreshed in `notes/perfect-machine-audit-roadmap.md`. It cuts +obsolete claims that Hands/Soul/Continuity lack contracts or that the typed +chain is merely descriptive, records the current authority/evidence matrix, +and selects native heartbeat service physiology as the highest-priority gap. +The first slice is implemented: `epiphany-heartbeat-store serve` loops over the +existing typed routine owner, supports an unbounded service mode or bounded +`--max-iterations`, refuses a zero interval, writes per-pulse artifact +directories, emits compact sealed pulse/closure receipts, and never spawns a +child. Bounded smoke root +`C:\Users\Meta\AppData\Local\Temp\epiphany-heartbeat-serve-dc20936d26a84e68be92ca33bb5ee2f3` +completed two one-second pulses and stopped cleanly. Next launch the native +serve loop through Idunn, prove persisted-state restart without duplicate +pending turns, and make an engaged swarm brake observable without killing the +service. ## Immediate Re-entry Instruction diff --git a/notes/perfect-machine-audit-roadmap.md b/notes/perfect-machine-audit-roadmap.md index 284942e4..2bf13903 100644 --- a/notes/perfect-machine-audit-roadmap.md +++ b/notes/perfect-machine-audit-roadmap.md @@ -1,427 +1,195 @@ # Perfect Machine Audit Roadmap -Date: 2026-05-27 - -Updated: 2026-05-30 - -Objective: audit Epiphany's current organ shape and map the path from named -contracts to the Perfect Machine: a coherent organism where repository access, -evidence, projection, public speech, action, verification, continuity, and -persistent state are separately owned but mutually aware. - -## Current Shape - -Epiphany has the first typed skeleton for the organ boundaries: - -- `Mind`: persistent state guardian. `epiphany-core::mind_gateway` names - thought, state-effect proposal, gateway-review, commit/rejection, and Verse - adoption contracts. -- `Substrate Gate`: repository/substrate access protocol. `epiphany-core::substrate_gate` - names repo access requests, reviews, grant/refusal receipts, snapshots, and - mutation receipts. -- `Eyes`: evidence ingress guardian. `epiphany-core::eyes_gateway` names - evidence requests, reviews, source lookup receipts, evidence packets, and - refusals. -- `Imagination`: projection/future-shape organ. For Persona, it now owns the - Projector prompt boundary in `epiphany-core::persona_turn`. -- `Persona`: public person-shaped surface. It receives projected context and writes - natural prose only. -- `Hands`: action organ by doctrine, but not yet backed by a dedicated CultNet - contract family parallel to Substrate Gate/Eyes/Mind. -- `Soul`: verification organ by doctrine, but not yet backed by a dedicated - CultNet contract family parallel to Eyes. -- `Continuity`: continuity organ by doctrine, heartbeat, reorientation, and handoff - surfaces, but not yet a single typed contract family for sleep/compaction and - recovery. -- `Self`: coordinator/routing organ exists through coordinator policy, role - board, CRRC, and view surfaces, but it is still partly embedded in bridge and - Codex-compatible routes. - -The dependency matrix is explicit in `epiphany-core::organ_dependencies`: every -standing sub-agent depends on every other standing sub-agent. This is correct, but it -is currently descriptive. It does not yet force every launch packet, prompt, or -runtime receipt to carry dependency context. - -## Void Persona Lessons - -Void's current Persona work is the best reference implementation for the Persona -organ. The important lesson is not "make the prompt longer." The lesson is -parent-organ ownership: - -- Parent `Imagination` projects typed state into lived character-facing prose - before the Persona sees it. -- The Persona reads raw room/context evidence directly and writes natural prose as - a person. -- Parent `Mind` interprets the Persona output into memory, affect, social reads, - mood, agency pressure, speech, retry, or drop. -- The deterministic assembler creates compact packets, raw transcripts, repo - activity, pronoun guidance, channel policy, and media awareness. It must not - turn those into character prose itself. - -Relevant Void references: - -- `VoidBot:prompts/repo-Persona-state-projector.prompt.md`: names the projector as - the Persona's parent Imagination organ and forbids schema slurry. -- `VoidBot:prompts/repo-Persona-turn.prompt.md`: keeps the Persona turn as the - speaking surface, with recent repo activity before conversation transcript and - deterministic policy sections outside projected state. -- `VoidBot:prompts/repo-Persona-turn-interpreter.prompt.md`: names the - Interpreter as parent Mind and requires route/retry/drop plus structured - side effects. -- `VoidBot:scripts/run-repo-Persona-heartbeats.ts`: runs projection as - `organ: "imagination"` in read-only mode, rejects leaky memory surfaces, keeps - raw transcript evidence oldest-to-newest, includes visible chronology, exports - recent repo activity read-only, and keeps pronoun guidance deterministic so - Imagination cannot accidentally omit it. - -Audit implication for Epiphany: `persona_turn.rs` has the right first boundary but -is still too thin. It lacks deterministic human pronoun guidance, channel label -resolution, visible chronology, media attachment awareness, retry/drop -semantics, projection model receipts, and explicit leakage rejection as strong -as Void's `rejectLeakyMemorySurface`. - -## Audit Findings - -### 1. Contract Names Exist Before Contract Execution - -Mind, Substrate Gate, and Eyes have type constants, CultMesh policy documents, and -runtime-spine advertisement. They are not yet the mandatory runtime path. -Workers can still be launched and accepted through older bridge/service flows -without every substrate touch, evidence claim, or state mutation passing through -a real receipt chain. - -Required correction: turn contract families into executable gates. - -### 2. Substrate Gate/Eyes/Mind Are Correctly Split But Not Yet Chained - -The desired chain is: - -```text -Need fact or action - -> Self routes - -> Substrate Gate grants scoped substrate access - -> Eyes packages inspected evidence when truth is needed - -> Imagination projects options or scenes when future/personhood is needed - -> Hands executes bounded action when mutation is needed - -> Soul verifies result/invariant - -> Mind admits durable state - -> Continuity preserves continuity -``` - -Today the chain is documented, not structurally unavoidable. - -### 3. Hands, Soul, and Continuity Have First-Class Contract Catalogs - -The contract set now names the gates around action, verification, and -continuity: - -- Hands has action intent/review plus command, patch, commit, PR, rollback, and - refusal receipts. -- Soul has verification request plus invariant check, verdict, regression, - review, and refusal receipts. -- Continuity has continuity packet plus compaction checkpoint, sleep distillation, - recovery, stale-turn repair, and continuity refusal receipts. - -Runtime-spine advertises those contracts and CultMesh persists Verse-scoped -policy documents for each. The first executable pressure slice is landed: -worker launch packets now carry an `EpiphanyLaunchOrganContract` derived from -authority scope, launch document kind, and output contract id. That contract -carries the full standing sub-agent dependency matrix, a receipt document -catalogue, and effect-specific proof profiles for state admission, evidence -promotion, repo action, verification, and continuity recovery. Role/reorient -acceptance now refuses completed runtime-spine findings if the original launch -request is missing, document-kind mismatched, or lacks a state-admission proof -profile requiring Mind review. Acceptance now evaluates claimed effects through -those profiles, rereads the persisted Mind gateway review from runtime-spine, -and enforces that available proof. Mind's first executable proof chain is now -persisted: acceptance writes `epiphany.mind.gateway_review` before state -admission and `epiphany.mind.state_commit_receipt` after admission with the -resulting state revision. Research acceptance also emits a typed -`epiphany.eyes.evidence_packet` from its accepted Eyes-shaped statePatch, -persists it in runtime-spine, rereads it, and enforces Eyes packet proof for the -evidence-promotion profile. Research launches now also persist a typed -Substrate Gate read/snapshot access grant, and Research acceptance enforces that -grant before admitting evidence-shaped state. Verification acceptance emits a -typed `epiphany.soul.verdict_receipt`, persists/rereads it through -runtime-spine, and enforces Soul verdict proof before Mind admits -verification-shaped state. Reorient acceptance emits a typed -`epiphany.continuity.recovery_receipt`, persists/rereads it through -runtime-spine, and enforces Continuity recovery proof before Mind admits -recovery-shaped state. Hands now has a first executable runtime-spine proof -chain for action documents: `HandsActionIntent` -> `HandsActionReview` -> -`HandsPatchReceipt` plus typed command and commit receipts can be persisted and -reread from the runtime store, and `epiphany-hands-action-smoke` proves the -chain without executing a patch, command, or commit. The repo-action proof -profile now requires the full Hands intent/review/patch chain before promotion, -not only a patch receipt. -Remaining weakness: live implementation edits, commands, commits, and PRs still -do not have to pass through that Hands chain before action promotion, and the -current Mind state mutation plus post-commit receipt is not a single transaction -yet. - -### 4. Self Still Shares A Throne With Compatibility Plumbing - -Coordinator policy is much cleaner, but Codex-compatible route edges still -shape parts of the living workflow. The Perfect Machine needs Self as a typed -router over CultNet/CultMesh contracts, not a half-native coordinator behind a -JSON-RPC organ. - -### 5. CultMesh/CultLib Local Dependency Was Broken - -`epiphany-core` previously pointed at: - -```toml -cultcache-rs = { path = "../../CultLib/crates/cultcache-rs" } -cultmesh-rs = { path = "../../CultLib/crates/cultmesh-rs" } -cultnet-rs = { path = "../../CultLib/crates/cultnet-rs" } -``` - -This checkout has `E:\Projects\CultLib` but no `crates` directory, so cargo -checks failed before reaching the new code. This was a Body-level substrate -wound: the Rust dependency body described by the map did not exist at the path -the machine used. - -Correction landed: Epiphany now compiles against repo-contained vendored crates: - -```toml -cultcache-rs = { path = "../vendor/cultcache-rs" } -cultmesh-rs = { path = "../vendor/cultmesh-rs" } -cultnet-rs = { path = "../vendor/cultnet-rs" } -``` - -`vendor/cultmesh-rs` is a small Rust facade over vendored CultCache and CultNet. -It owns document-set registration plus local typed node operations -(`put`/`get`/`get_required`/`delete`/`flush`) for now. Vendored CultCache also -reads and writes the `cultcache.store.v1` snapshot format used by the current -state ledgers. This keeps Epiphany's body self-contained while preserving -CultMesh as the ergonomic local store surface. - -### 6. Persona Prompting Is Directionally Correct But Behind Void - -Epiphany's Persona loop now says `Imagination Projector -> Persona -> Mind -Interpreter`, but Void has the stronger living practice: - -- state projector is model-owned, not deterministic prose assembly -- projection runs read-only with model/output receipts -- leaked schema/prompt construction language is rejected -- raw transcript and chronology stay raw and oldest-to-newest -- deterministic pronoun guidance sits outside projection -- channel labels are resolved through Persona permissions before posting -- interpreter can retry one Persona pass when correction uptake or doctrine fails - -Epiphany should port that shape, not the exact TypeScript machinery. - -## Path To The Perfect Machine - -### Phase 0: Repair The Rust Body - -Goal: make the existing contracts buildable again. Status: landed for the local -repo-contained dependency body. - -- Audited the CultLib/CultCache/CultNet/CultMesh repo layout. -- Chose the repo-contained vendored Rust dependency source. -- Updated dependency paths away from the dead `CultLib/crates` layout. -- Added `vendor/cultmesh-rs` as the local CultMesh facade. -- Ran the previously blocked focused surface through: - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib persona_turn` - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib mind_gateway` - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib substrate_gate` - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib eyes_gateway` - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib cultmesh_integration` - - `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib runtime_spine::tests::runtime_spine_emits_cultnet_hello_frame` - -Definition of done: contract code compiles against the intended Rust substrate -without local path superstition. Verification: `cargo test --manifest-path -.\vendor\cultmesh-rs\Cargo.toml` and `cargo test --manifest-path -.\epiphany-core\Cargo.toml --lib` pass. - -### Phase 1: Make The Gates Executable - -Goal: no worker output, repo touch, or evidence claim bypasses the appropriate -organ. - -- Implement Substrate Gate access request/review/grant/refusal documents in CultCache. -- Route retrieval, indexing, file edit, shell command, Rider, and Unity bridge - operations through Substrate Gate access receipts. -- Implement Eyes evidence request/review/packet/refusal documents in CultCache. -- Require Eyes packets for claims promoted into Mind state proposals when the - claim depends on inspected source. -- Landed first slice: role/reorient acceptance persists Mind gateway reviews - before state mutation and Mind state-commit receipts after state mutation. - This is proof, not yet a single transactional admission primitive. -- Convert existing role/reorient acceptance to one Mind-owned state-admission - primitive when the storage layer can atomically pair mutation and commit - receipt. - -Definition of done: the old direct paths cannot produce repo mutation, -evidence promotion, or durable state mutation without the corresponding typed -receipt. - -### Phase 2: Give Hands, Soul, And Continuity Their Own Contracts - -Goal: action, verification, and continuity stop hiding behind neighbors. -Status: first contract catalog slice landed. - -- Hands contracts landed: - - `epiphany.hands.action_intent` - - `epiphany.hands.command_receipt` - - `epiphany.hands.patch_receipt` - - `epiphany.hands.commit_receipt` - - `epiphany.hands.pr_receipt` - - `epiphany.hands.rollback_receipt` -- Soul contracts landed: - - `epiphany.soul.verification_request` - - `epiphany.soul.invariant_check` - - `epiphany.soul.verdict_receipt` - - `epiphany.soul.regression_receipt` - - `epiphany.soul.review_receipt` -- Continuity contracts landed: - - `epiphany.continuity.packet` - - `epiphany.continuity.compaction_checkpoint` - - `epiphany.continuity.sleep_distillation` - - `epiphany.continuity.recovery_receipt` - - `epiphany.continuity.stale_turn_repair` - -Definition of done: action, verification, and continuity have the same typed -contract dignity as Mind/Substrate Gate/Eyes, and every worker launch carries the -organ-dependency/receipt contract that later gates can enforce. Verification: -`cargo test --manifest-path .\epiphany-core\Cargo.toml --lib` and `cargo run ---manifest-path .\epiphany-core\Cargo.toml --bin epiphany-cultmesh-smoke` pass -for the catalog slice; the launch-contract slice is verified by `cargo test ---manifest-path .\epiphany-core\Cargo.toml --lib`. The attempted bridge crate -verification is currently blocked before local code by an upstream -`starlark_map`/`hashbrown` `Allocative` dependency conflict. - -Next step: make the launch-carried receipt expectations executable in the live -worker/action/verification and compaction paths. - -### Phase 3: Port Void's Persona Prompting Shape Properly - -Goal: Persona becomes a living public organ without stealing authority. - -- Replace `PersonaProjectorInput` with an Imagination projector packet that carries - typed state, affect, memory, social topology, repo activity, semantic - attractors, curiosity hints, and dependency pressure. -- Add deterministic sections outside projected state: - - raw transcript, oldest-to-newest - - visible chronology across rooms/surfaces - - human pronoun guidance - - channel label/permission policy - - media attachment awareness - - recent home-repo activity from Substrate-Gate-scoped reads -- Make projection model-owned and read-only, with model output receipts. -- Strengthen projection leakage rejection: no schema words, repo paths, prompt - construction language, grants/jurisdictions slurry, or direct action syntax. -- Upgrade Mind Interpreter output from simple effect blocks to: - - correction check - - doctrine/coherence check - - decision: route/retry/drop - - structured memory/affect/social/speech effects - - retry limit -- Ensure public speech resolves Persona-local channel labels through permissions - before delivery. - -Definition of done: Persona can be prompted by Aquarium/Discord/CultNet and the -public result is natural, contextual, permission-aware, retryable, and unable to -mutate state or post without parent routing. - -### Phase 4: Move Self Fully Onto CultNet/CultMesh - -Goal: Self routes organ work through typed contracts, not legacy JSON-RPC -comfort tunnels. - -- Add Self routing contracts for choosing next organ, required dependencies, - and allowed authority. -- Landed: role, generic, and reorient worker launch packets declare authority - scope, launch document kind, output contract id, owner organ, full organ - dependency matrix, and required Substrate Gate/Eyes/Hands/Soul/Continuity/Mind receipts. -- Landed: role/reorient acceptance refuses completed runtime-spine findings - when the original worker launch request is missing, mismatched by document - kind, or lacks a state-admission proof profile requiring Mind review. -- Landed: role/reorient acceptance persists Mind review/commit receipts around - durable state admission. -- Landed: launch contracts split the broad receipt catalogue from effect-specific - proof profiles, so the machine does not demand every organ receipt for every - result. -- Landed: acceptance evaluates claimed effect types against runtime-spine - receipt availability, enforces the currently live Mind gateway-review proof, - and defers unavailable non-Mind producer gaps instead of using them as false - blockers. -- Landed: accepted Research findings produce and enforce typed Eyes evidence - packets for the evidence-promotion proof profile. -- Landed: Research launches produce and enforce typed Substrate Gate - read/snapshot grants, closing the Research evidence-promotion chain through - Substrate Gate -> Eyes -> Mind. -- Landed: Verification acceptance produces and enforces typed Soul verdict - receipts before Mind admission. -- Landed: Reorient acceptance produces and enforces typed Continuity recovery - receipts before Mind admission. -- Landed: first Hands action receipt spine. `HandsActionIntent`, - `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and - `HandsCommitReceipt` are typed runtime-spine documents with put/get helpers - and `epiphany-hands-action-smoke` coverage; the repo-action proof profile - requires intent, review, and patch receipt before promotion. -- Next: connect live implementation edits/commands/commits to the Hands action - chain, or collapse Mind review/state mutation/commit into one storage-owner - admission primitive. -- Make Aquarium read the contract catalog and available receipts instead of - hard-coding the route zoo. -- Starve `codex_message_processor` down to Codex auth/model transport and - compatibility emission only. - -Definition of done: a local run can be inspected as a chain of CultNet/CultMesh -documents from operator request to final response. - -### Phase 5: Runtime Physiology - -Goal: the machine runs as an organism. - -- Heartbeat scheduler wakes organs by initiative, pending pressure, and - completion-gated cooldown. -- Active turns freeze initiative until receipt completion. -- Sleep distills rumination through Continuity and Mind. -- Stale active turns get Continuity recovery receipts. -- Public/global Verse material enters as thought weather, then Eyes/Mind review - before adoption. - -Definition of done: unattended operation can pause, recover, explain current -pressure, and preserve memory without transcript worship or hidden loops. - -### Phase 6: Aquarium As Inspectable Nervous System - -Goal: make the organism visible without making the UI a second truth. - -- Display organ dependency graph. -- Display contract catalog by organ. -- Display receipt chains per turn. -- Display Persona prompt packet boundaries: deterministic evidence, Imagination - projection, Persona natural turn, Mind interpretation. -- Display Substrate Gate grants, Eyes packets, Hands actions, Soul verdicts, - Continuity receipts, and Mind state commits. - -Definition of done: a human can ask "why did you touch that file / say that / -remember that?" and see the typed path. +Updated: 2026-07-12 + +## Objective + +Prepare Epiphany as a coherent organism whose repository access, evidence, +projection, public speech, action, verification, continuity, durable state, +runtime physiology, and inspection surfaces have one visible owner each. + +This is a live authority audit. Historical implementation scars belong in git, +distilled evidence, or archived notes. A green local test proves only the seam +it actually observes. + +## Authority Map + +| Faculty | Owner | Inputs | Outputs | Current proof | Live gap | +|---|---|---|---|---|---| +| Self | native coordinator and repo-work scheduler | typed state, job/result receipts, current route pressure | bounded launch/routing decisions | coordinator acceptance tests; repo-work scheduler authority tests | heartbeat is not yet an always-on Idunn-owned process | +| Substrate Gate | `substrate_gate` | scoped read/mutation request | access grant, refusal, snapshot, mutation receipt | Research launch/acceptance and Hands gate proofs | audit remaining utility/bridge substrate touches for bypasses | +| Eyes | `eyes_gateway` | inspected source under a Substrate Gate grant | evidence packet or refusal | Research acceptance proof profile | public/foreign Verse adoption still needs a full live Eyes-to-Mind proof | +| Imagination | planning and Persona projector boundaries | typed project/person state and candidate futures | plans, projections, consensus candidates | planning/consensus smokes and Persona projector tests | Persona projector/interpreter parity with the current Void reference needs a fresh audit | +| Persona | Persona turn and public mouth edges | projected context plus visible conversation | natural speech candidate and speech audit | Persona Discord/Reddit/Bifrost smokes | Aquarium-native conversational inspection remains incomplete | +| Hands | `hands_gateway` and repo-work execution | approved intent, path scope, Substrate Gate grant | patch, command, commit, PR, rollback receipts | real repo-work execution/closure and Hands receipt-chain smokes | search for non-repo-work actuators that still bypass the chain | +| Soul | `soul_gateway` and verification phase | Hands consequence receipts and changed body | verdict/invariant/regression receipts | live repo-work Soul phase and acceptance tests | unify remaining verifier-specific projections under narrow receipt queries | +| Modeling | typed repo-work Modeling route and model runtime | immutable Soul-verified request selected by current generation | immutable finding | generation-zero/generation-one runtime, Mind revision, Idunn launch, and admission proofs | no known authority split in the repo-work path | +| Mind | canonical state transaction and gateway reviews | bounded effect proposal plus required organ proofs | durable state and commit receipt | one canonical writer/store; atomic coordinator and repo-map admission proofs | audit other state families for pre-transaction legacy writers | +| Continuity | continuity contracts plus CRRC/stale-turn repair | pressure, checkpoint, sleep, and stale active state | checkpoint, recovery, sleep-distillation, stale-turn receipts | reorient acceptance and heartbeat stale-repair tests | sleep consolidation is callable, not continuously supervised physiology | +| Nervous system | heartbeat state, runtime spine, Idunn, CultMesh/CultNet | pressure, pending turns, daemon/runtime state | scheduling, lifecycle, telemetry, interrupts | typed heartbeat pump/routine, runtime-spine jobs, Idunn service receipts | the heartbeat loop is still an attached PowerShell vigil rather than a native supervised daemon | +| Body | repository, Rust binaries, CultCache/CultMesh stores, model transport | typed commands and granted external authority | real effects and inspectable artifacts | focused smokes and live repo work | continue cutting whole-context queries and compatibility-shaped native artifacts | + +## Structural Invariants + +1. Self routes; it does not author specialist findings or admit durable state. +2. Substrate Gate owns substrate permission. Eyes owns evidence promotion. +3. Hands alone changes the repository; Soul alone calls the consequence + verified; Modeling updates the machine model after Soul. +4. Mind is the only durable-state admission owner. Reviews, state mutation, and + commit witnesses share the canonical transaction boundary where atomicity is + required. +5. Immutable Modeling findings never change. Mind may advance one stable typed + route to a new generation; stale generations cannot close or regain current + authority. +6. Idunn owns process and daemon lifecycle. Self may request a launch but may + not spawn, repair, or silently replace the child. +7. CultCache documents are state, CultMesh is the local state/discovery + substrate, CultNet is the wire, and Eve/CultUI is the interface projection. + JSON is display or xenos-boundary cargo, not internal authority. +8. Aquarium and other renderers inspect typed owners. They do not rebuild a + second route graph or dashboard-shaped truth. +9. Pending turns freeze repeat scheduling. Cooldown begins after completion. + Stale turns require Continuity evidence, not timer-shaped amnesia. +10. Public connection preserves consent, identity, permission, provenance, and + private-state seals at the actual mouth edge. + +## Evidence Ledger + +### Proven executable chains + +- Research: Substrate Gate grant -> Eyes packet -> Mind admission. +- Implementation: scoped Hands intent/review -> patch/command/commit receipts. +- Verification: Hands consequence -> Soul verdict -> Modeling request. +- Repo map: immutable Modeling finding -> current typed route -> Mind/map + transaction -> Bifrost publication gate. +- Retry: runtime-authored non-passing generation zero -> explicit Mind review -> + generation-one route -> consumer schema preflight -> Idunn lifecycle receipt + -> runtime-authored passing finding -> current-generation admission. +- Recovery: reorient launch -> Continuity recovery receipt -> Mind admission. +- Public crossing: Persona speech audit -> Bifrost/Heimdall authority checks -> + governed receipt or sealed refusal. + +### Proven negative boundaries + +- Scheduler cannot author Modeling findings or impersonate Mind admission. +- CLI cannot counterfeit a runtime-authored Modeling finding. +- Non-passing and stale-generation findings cannot enter the repo map. +- Passing findings cannot be revised into retries. +- `epiphany-work` cannot spawn the model child; Idunn owns process launch. +- Consumer schema preflight happens before the runtime job is opened. +- Extinct Codex Epiphany DTO/route/bridge paths cannot write native state. + +## Current Highest-Priority Gap: Native Heartbeat Daemon + +### Current mechanism + +`epiphany-heartbeat-store` owns typed `tick`, `pump`, `complete`, +`repair-stale`, `routine`, and `status` operations. It already enforces pending +turn freeze, completion-gated cooldown, adaptive pacing, swarm brakes, stale +turn repair, rumination, sleep, memory resonance, and dream maintenance. + +The first native loop is landed as `epiphany-heartbeat-store serve`. It reuses +the existing routine state owner, writes per-pulse artifact directories, emits +compact sealed pulse/closure receipts, refuses a zero interval, and supports +bounded clean shutdown for verification. It does not spawn or own child +lifecycle. `tools/epiphany_ruminate_until.ps1` still owns the old attached +operator vigil and must be demoted after Idunn proves the native service path. + +### Intended change + +Launch the native `serve` loop through the existing Idunn service lifecycle +path. The heartbeat binary owns +pulse timing and typed heartbeat receipts. Idunn owns child survival, restart, +stdout/stderr artifacts, and lifecycle receipts. Self remains only the routing +organ consuming heartbeat pressure. + +### Owner + +- Heartbeat scheduler: when a pulse is due and which bounded routine/pump action + runs. +- Idunn: whether the heartbeat process is running and how it restarts. +- Continuity: repair of stale active turns and sleep/compaction evidence. +- Mind: admission of durable self/memory changes proposed by heartbeat work. + +### Inputs + +- heartbeat CultCache store; +- agent-memory store; +- local Verse store and swarm brake; +- bounded interval, maximum iterations, and shutdown signal; +- current pressure and pending-turn state. + +### Outputs + +- typed heartbeat selection/completion/routine receipts; +- compact status/telemetry projection; +- Idunn service lifecycle receipt and sealed stdout/stderr artifacts; +- explicit clean shutdown or failure status. + +### Forbidden writers + +- PowerShell wall-clock loops deciding heartbeat truth; +- Self spawning or restarting the heartbeat process; +- a renderer owning scheduling state; +- sleep directly mutating durable identity without Continuity/Mind review; +- overlapping pulses while a previous pulse remains active. + +### Shared paths + +Manual `tick`/`pump`/`routine`, daemon pulses, recovery after restart, swarm +brake refusal, and shutdown must call the same existing store primitives. The +daemon is orchestration around those owners, not a second scheduler. + +### Cut line + +Demote `tools/epiphany_ruminate_until.ps1` to a historical/operator probe after +the native loop and Idunn launch proof exist. Do not preserve its timing, +status, or cycle-directory conventions as runtime authority. + +### Verification + +- unit test: `serve` refuses zero/unsafe interval and overlapping active work; +- bounded smoke: two iterations use the same typed routine/pump primitives and + stop cleanly; +- restart smoke: Idunn lifecycle receipt proves child ownership and a second + process resumes from persisted heartbeat state without duplicate pending + turns; +- brake smoke: an engaged swarm brake prevents mutation while the daemon stays + observable; +- negative source check: the native heartbeat binary contains no child spawn or + second state writer; +- operator readback: status names heartbeat owner, Idunn lifecycle owner, last + completed pulse, next due pulse, active turn, and private-state seal. + +## Subsequent Audits + +1. Narrow the remaining `query_epiphany_local_verse_context` consumers. Daemon + and operator commands should load only the typed families they own or + project. +2. Re-audit Persona Projector -> Persona -> Mind Interpreter against current + Void behavior and public permission boundaries. +3. Make Aquarium lower the organ graph, contract catalog, and per-turn receipt + chains from CultMesh/Eve instead of hard-coded routes. +4. Audit non-repo-work actuators and legacy state families for bypasses around + Substrate Gate, Hands, Soul, or the canonical Mind transaction. +5. Finish Codex starvation: retain only authenticated model transport and + explicitly quarantined compatibility edges. ## Perfect Machine Target -The Perfect Machine is not more prompts and not more bureaucracy. It is a -coherent authority graph: - ```text Self routes. Substrate Gate grants substrate access. -Eyes certifies looked-at evidence. -Imagination projects possible scenes and futures. +Eyes certifies inspected evidence. +Imagination projects possible futures and lived context. Persona speaks as a person. Hands changes the world. -Soul verifies promises and invariants. -Continuity preserves continuity across rupture. +Soul verifies consequence and invariant. +Modeling updates the machine model from verified consequence. +Continuity preserves coherence across sleep, interruption, and rupture. Mind admits durable state. -CultMesh carries the local typed Verse surfaces. -CultNet carries wire contracts. -CultCache preserves the typed documents. -Codex remains only model/auth transport until it can be replaced or minimized. +Idunn keeps the body alive. +CultMesh/CultNet carry typed signal. +CultCache preserves typed memory. +Eve/Aquarium make the organism inspectable without becoming its truth. ``` - -When this is real, no organ can steal the throne. The machine can act, speak, -remember, doubt, recover, and be inspected without turning connection into mush. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 6b810d1a256d7b6cffa54e2853210513beab2967..193bb031cc6ffc51b3c16fe1fc3343287f9f2421 100644 GIT binary patch delta 422 zcmXv~F-`+P4CD@yhK3>q=`7LaAQuIY@&_b@sA$M$qLw0|^15 zqNCvhv~*M;et<7PF<#Hgp0WM<*?jwM-fl+g-EJ@4J$YHFPw(%xqO&Oax?IHbMH~sL zcU7<^s68&?`U5wvpE~W%UeexA(#~<3_NxAy_g=kmwK1<Fhrj`w8`t=E@ X@~Q$g+JeK<(vj>*8iUaPBW?cx(B_%F delta 57 zcmccdQS$UV$qf>W+{WfsCKgf07}&}*HY+n0GBUnvp32ldm5C9EK{PWEvj8#c_Nh#4 G+e!dG#S+p0 diff --git a/state/map.yaml b/state/map.yaml index 6152e9b0..bdd62d20 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -659,4 +659,4 @@ current_status: - Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass. - `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure. last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync. - next_action: Refresh the Perfect Machine audit against current source and live proofs. The generation-one Modeling authority campaign is complete through real consumer preflight, Idunn launch, runtime-authored finding, and current-generation admission. Remove stale roadmap gaps that describe already-landed Hands, Mind, runtime, or closure work, then select the next missing organ boundary from authoritative evidence rather than extending this campaign by inertia. + next_action: Complete the native heartbeat service boundary selected by the refreshed Perfect Machine audit. Launch `epiphany-heartbeat-store serve` through Idunn, prove its lifecycle receipt and persisted-state restart without duplicate pending turns, keep an engaged swarm brake observable instead of terminating the service, then demote the attached PowerShell rumination vigil from runtime authority.