Narrow lifecycle brake sight and refresh audit map

This commit is contained in:
Meta Vens 2026-08-10 23:11:42 +01:00
commit 5fbb869099
3 changed files with 144 additions and 253 deletions

View file

@ -411,8 +411,8 @@ fn absolutize_from(cwd: &Path, path: &Path) -> PathBuf {
fn managed_service_task_install(args: Args, execute: bool) -> Result<()> {
require_supervisor_bootstrap(&args)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle(&context)?;
let brake = load_epiphany_cultmesh_swarm_brake(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle_entry(brake.as_ref())?;
let started_at = Utc::now();
let task_name = managed_service_task_name(&args);
let (command, cwd, action_args) = managed_service_task_action(&args)?;
@ -513,8 +513,8 @@ fn managed_service_task_control(args: Args, operation: &str) -> Result<()> {
fn managed_service_task_operation(args: Args, operation: &str) -> Result<()> {
require_supervisor_bootstrap(&args)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle(&context)?;
let brake = load_epiphany_cultmesh_swarm_brake(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle_entry(brake.as_ref())?;
let started_at = Utc::now();
let task_name = managed_service_task_name(&args);
let quoted = quote_powershell(&task_name);
@ -3112,8 +3112,8 @@ fn finish_workspace_coverage_recovery(
fn service_runbook(args: Args) -> Result<()> {
require_supervisor_bootstrap(&args)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle(&context)?;
let brake = load_epiphany_cultmesh_swarm_brake(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle_entry(brake.as_ref())?;
let started_at = Utc::now();
let command_path = service_command_path(&args)?;
let service_args = service_serve_args(&args);
@ -3165,8 +3165,8 @@ fn service_runbook(args: Args) -> Result<()> {
fn repo_work_service_audit(args: Args) -> Result<()> {
require_supervisor_bootstrap(&args)?;
let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle(&context)?;
let brake = load_epiphany_cultmesh_swarm_brake(&args.store, args.runtime_id.clone())?;
assert_swarm_brake_allows_service_lifecycle_entry(brake.as_ref())?;
let started_at = Utc::now();
let receipts =
load_epiphany_cultmesh_daemon_service_lifecycle_receipts(&args.store, &args.runtime_id)?;
@ -4605,6 +4605,26 @@ mod semantic_projector_authority_tests {
assert!(body.contains("let _ = child.wait()"));
}
#[test]
fn narrow_lifecycle_commands_read_only_the_swarm_brake_family() {
let source = include_str!("epiphany-daemon-supervisor.rs");
for function in [
"managed_service_task_install",
"managed_service_task_operation",
"service_runbook",
"repo_work_service_audit",
] {
let marker = format!("fn {function}(");
let start = source.find(&marker).unwrap();
let tail = &source[start..];
let end = tail.find("\nfn ").unwrap();
let body = &tail[..end];
assert!(body.contains("load_epiphany_cultmesh_swarm_brake"));
assert!(body.contains("assert_swarm_brake_allows_service_lifecycle_entry"));
assert!(!body.contains("query_epiphany_local_verse_context"));
}
}
#[test]
fn workspace_coverage_launch_uses_only_specialized_process_authority() {
let source = include_str!("epiphany-daemon-supervisor.rs");

View file

@ -1176,6 +1176,18 @@ the same release under brake and projects `active` with no reasons. Receipts are
under `.epiphany-run/readiness-16407f7e` and
`.epiphany-run/c006-readiness-16407f7e`.
### Narrow Idunn lifecycle brake sight
Managed-task install/control, service-runbook construction, and repo-work
service audit own lifecycle effects or lifecycle evidence. Their only local
Verse gate is the canonical swarm brake. They load that one typed family and
delegate to the shared lifecycle-brake predicate; they do not materialize
daemon topology, provider state, tools, Eve surfaces, or unrelated receipts.
Cluster reconciliation and cluster runbook paths retain the broader context
only where their outputs actually enumerate daemon rows. The cut line removes
full-context reads from the four narrow lifecycle commands without changing the
brake decision or granting a new writer.
Yggdrasil separates provenance from Body. `/srv/epiphany/source/current` is
immutable release source. `/var/lib/gamecult/epiphany/workspace` is the writable
domain Body carrying repository binding, persistent Modeling map, Mind state,

View file

@ -1,249 +1,108 @@
# Perfect Machine Audit Roadmap
# Perfect Machine audit roadmap
Updated: 2026-07-12
Updated: 2026-08-10
## 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.
Prove every Epiphany faculty both at its own authority boundary and in live
coordination before treating the organism as deployment-ready. Tests prove only
the seam they observe. Packaged Linux bodies, copied-state falsification, and
actual c006 behavior are the live gates.
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.
## Current body
## Authority Map
- Source branch: `codex/epiphany-shakedown-live`.
- Accepted runtime implementation: exact `16407f7e`.
- Linux release:
`sha256-66cf1c2f4d88e7885a36870277cf4b143204de9c9b0dad0ed8f809983b3c55af`.
- Witness:
`sha256-5f41248bb11c01f19125f16bf39f3dfcc2a802de211f3eae7e2caf292d59e4b3`.
- Actual c006: Heartbeat and resident Self alive in distinct containers,
cognitive brake engaged, resident revision 26, readiness `active` with no
reasons.
- Build body: Starfire. Yggdrasil is the small public crossing and never builds
this graph.
| 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 |
## Live authority matrix
## Structural Invariants
| Faculty | Owner | Accepted proof | Remaining live gate |
|---|---|---|---|
| Self | resident Self state machine | single-consumption Heartbeat grants, typed fulfillment, exact recovery/requeue, cooldown and brake behavior; actual c006 completed its retained proposal-Modeling grant once | broader autonomous frontier turnover across several consecutive causal grants |
| Substrate Gate | `substrate_gate` | scoped read/mutation grants on Eyes and Hands paths | audit remaining utility and compatibility actuators for bypasses |
| Eyes | Eyes gateway and authenticated source tools | challenged-claim Windows circuit and governed Linux tool circuit accepted into Mind | one broader foreign/public Verse evidence adoption path |
| Modeling | runtime-owned typed Modeling contracts | causal Eyes-to-Modeling acceptance, direct proposal Modeling, archived fulfillment | broader Body-map coverage across a changing live repository |
| Imagination | typed proposal/consideration producers | proposal-only candidates, exact fulfillment, no Hands adoption leak | native multi-option autonomous turnover beyond bounded fixtures |
| Hands | Hands gateway | bounded patch, command, commit, push, and changed-path receipts | audit non-repo-work actuators for direct consequence paths |
| Soul | Soul gateway | consequence-bound verdict, causal Modeling route, retention and replay | collapse remaining verifier-specific broad projections into narrow receipt reads |
| Mind | canonical transactions and specialized admission | atomic RepoModel admission, launch-owned adjudication, semantic/runtime retention | audit remaining state families for legacy writers and run longer memory behavior |
| Persona | Persona turn, speech audit, public mouth | cross-host request/permit/receipt, signed failure and unknown no-repost behavior, conversation retention | one completed public consequence; currently blocked by absent Yggdrasil Discord credential |
| Continuity | runtime/resident recovery and retention | graceful shutdown, exact process-death recovery, session closure/archive, lifecycle retention, non-resurrection | latest-body long-duration plateau and later deployed restart supervision |
| Nervous system | Heartbeat, runtime spine, Idunn, CultMesh | detached scheduling, typed jobs, provider readiness, active/warming transitions across PID namespaces | latest-body 900-pulse plateau; continue narrowing whole-Verse reads |
| Body | Rust binaries, named-volume CultCache stores, model transport | deterministic 24-binary packaging, fast warm replay, named-volume interruption proof | deployment-sized endurance and remaining inspection surfaces |
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.
## Accepted coordinated circuits
## Evidence Ledger
1. Substrate Gate -> Eyes -> Mind evidence admission.
2. Heartbeat -> Self -> coordinator -> runtime worker -> typed fulfillment ->
exact resident settlement.
3. Eyes acceptance -> causal Modeling launch -> Modeling acceptance -> route
consumption.
4. Imagination proposal -> Modeling -> Mind admission -> new direction pressure,
without accidental Hands authority.
5. Hands consequence -> Soul verdict -> Modeling update -> Mind transaction.
6. Process death -> Continuity recovery -> canonical requeue or fulfilled
settlement -> archive/retention without resurrection.
7. Persona feedback crossing -> bounded consideration -> speech audit -> signed
permit/refusal/no-repost boundary.
### Proven executable chains
## Active rites
- 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.
### Latest-body braked endurance
### Proven negative boundaries
Actual c006 is running a detached 900-pulse plateau from iteration 572 to 1472.
The monitor samples both container CPU/RSS/block I/O, state/workspace size,
Heartbeat status, resident revision, grant identity, and active turn every 30
seconds. Acceptance requires:
- 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.
- both role owners remain alive;
- readiness remains `active`;
- every Heartbeat pulse remains braked with no grant;
- resident revision remains 26 with no active turn;
- state/workspace growth is bounded and explained by retained artifacts;
- RSS reaches a plateau rather than monotonic growth.
## Current Highest-Priority Gap: Native Heartbeat Daemon
Receipts: `.epiphany-run/c006-endurance-16407f7e`.
### Current mechanism
### Narrow local Verse consumers
`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.
Lifecycle commands may read only the state family that owns their decision.
Managed-task install/control, service-runbook construction, and repo-work
service audit now load only the canonical swarm brake instead of the whole
local Verse. Cluster reconciliation retains broader context only where it
actually enumerates daemon rows. Continue classifying remaining
`query_epiphany_local_verse_context` production callers by output ownership;
do not replace a legitimate aggregate projection with a pile of ad hoc reads.
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. The old attached PowerShell rumination vigil has been deleted; it no
longer owns timing, loop survival, or cycle status.
## Next selection after endurance
### Intended change
Choose one broad faculty circuit, not another indefinite hardening loop:
The bounded Idunn launch boundary is proven: the native loop survives brake
refusals, resumes from the same persisted store, and can be launched again by
Idunn without duplicate pending turns. The heartbeat binary owns pulse timing
and typed heartbeat receipts. Idunn owns child launch, stdout/stderr artifacts,
and lifecycle receipts. Self remains only the routing organ consuming heartbeat
pressure. Existing `epiphany.cultmesh.daemon_restart_policy` is not the right
owner for the remaining step: it is keyed to standing topology daemons and
their liveness status. The heartbeat loop is an Idunn-managed child service.
The missing owner is a typed managed-service desired-state policy keyed by
service id, plus compact operator readback; do not forge an eighth standing
daemon to reuse the daemon policy table.
That desired-state document is now landed as
`epiphany.cultmesh.managed_service_policy.v0`. Idunn can write it from the same
service command/args/cwd and sealed log refs used by lifecycle launch, and can
read it beside the latest lifecycle receipt. Readback explicitly reports
process observation as unknown until reconciliation probes reality; a past
`launched` receipt is not allowed to impersonate a living process.
Managed-service reconciliation is now implemented with a native platform PID
probe (`OpenProcess`/`GetExitCodeProcess` on Windows and `kill(pid, 0)` on
Unix). It honors enabled/restart mode/cooldown, observes alive services without
duplicating them, and delegates dead/missing restarts to `service-launch`.
Launch receipts now include an attempt timestamp so restart history is
immutable instead of overwriting one service/action key. Live heartbeat proof
launched, observed alive, simulated a crash, relaunched with a distinct PID and
receipt, then observed the replacement alive on the same heartbeat store.
1. autonomous frontier turnover across Self, Eyes, Modeling, Imagination, and
Mind on the live Body;
2. non-repo-work actuator audit across Substrate Gate, Hands, and Soul;
3. Persona projector/interpreter and public-mouth audit while the external
credential remains absent;
4. Eve/Aquarium lowering of the organ graph and receipt chains without renderer
ownership;
5. remaining legacy Mind writers and whole-Verse consumer cuts.
### Owner
The exact next rite is selected from fresh source and live state after the
endurance receipts close. `state/map.yaml` remains the canonical current-state
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.
## Completion standard
### 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.
### Durable service policy requirement
Add one typed Idunn managed-service policy with owner `Idunn` and key
`service_id`. It may read the desired command/args/cwd, enabled state, restart
mode, cooldown/backoff, expected heartbeat store, stdout/stderr artifact refs,
and latest lifecycle receipt. It emits desired-state readback and delegates
every actual start/restart to the existing service lifecycle launch primitive.
It does not own heartbeat scheduling state, daemon topology, or routine output.
The persistence/publication half is complete. Next add reconciliation that
probes the policy's last PID or an equivalent platform process witness, applies
enabled/restart-mode/cooldown intent, and delegates any restart to the existing
service lifecycle launch primitive.
Reconciliation is complete as an explicit Idunn command. The remaining
unattended boundary is to include managed-service reconciliation in Idunn's
native `serve` scheduler and replace `service-launch`'s full local-Verse context
load with the narrow swarm-brake query it actually needs.
That boundary is now complete. Service plan/launch use the narrow typed brake
loader and no longer reseed the full local Verse. A dedicated
`managed-service-serve` loop enumerates only managed-service policies and runs
their reconcile reflex independently of standing-daemon topology. Live proof
observed a heartbeat alive without duplicate launch, killed it, and the next
Idunn pulse restarted it from the same store with a distinct PID and immutable
lifecycle receipt. The next gap is inspectability: publish compact managed
service desired/observed rows through provider-owned Eve without opening command
payloads or routine artifacts.
The first sight organ is landed as `epiphany-verse-query
managed-services`. Native process observation now lives in a shared
core module used by both Idunn reconciliation and provider sight projection. Rows show
desired enabled/restart mode, observed alive/dead/missing, PID, latest immutable
lifecycle receipt, compact last heartbeat pulse status/iteration/artifact, and
the private-state seal. Live proof transitioned the same row from READY/alive
to ATTN/dead after a forced process death without exposing command args or
routine payloads. Next lower this typed row family into the main provider-owned Eve
composition graph.
### 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
The attached PowerShell rumination vigil is deleted. 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
```text
Self routes.
Substrate Gate grants substrate access.
Eyes certifies inspected evidence.
Imagination projects possible futures and lived context.
Persona speaks as a person.
Hands changes the world.
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.
Idunn keeps the body alive.
CultMesh/CultNet carry typed signal.
CultCache preserves typed memory.
Eve/Aquarium make the organism inspectable without becoming its truth.
```
The shakedown is complete only when every matrix row has current authoritative
evidence, every explicit remaining gate is either proven or recorded as an
operator-owned external dependency, the live coordinated circuit survives
endurance and restart, and no stale roadmap claim is being mistaken for state.