From 83b1608da73b40b506da92275aa0a1f72cf784b3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 19 Jun 2026 23:43:00 +0100 Subject: [PATCH] Add repo work scheduler pulse --- epiphany-core/src/bin/epiphany-work.rs | 308 +++++++++++++++++++++- notes/epiphany-repo-swarm-mvp-contract.md | 74 +++++- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 303515 -> 303859 bytes state/map.yaml | 4 +- 5 files changed, 373 insertions(+), 15 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 1ad8c7a3..8461c2f3 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -50,6 +50,7 @@ fn main() -> Result<()> { "execute" | "exec" => run_execute(parse_execute_args(args)?), "publish" => run_publish(parse_publish_args(args)?), "sync" | "sync-main" => run_sync(parse_sync_args(args)?), + "tick" | "pulse" | "schedule" => run_tick(parse_tick_args(args)?), other => Err(anyhow!("unknown epiphany-work command {other:?}")), }?; println!("{}", serde_json::to_string_pretty(&result)?); @@ -165,6 +166,16 @@ struct SyncArgs { merge_receipts: Vec, } +#[derive(Clone, Debug)] +struct TickArgs { + workspace: PathBuf, + epiphany_root: PathBuf, + item: Option, + artifact_dir: Option, + runtime_store: Option, + dry_run: bool, +} + fn parse_accept_args(args: impl Iterator) -> Result { let mut workspace = None; let mut epiphany_root = None; @@ -624,6 +635,37 @@ fn parse_sync_args(args: impl Iterator) -> Result { }) } +fn parse_tick_args(args: impl Iterator) -> Result { + let mut workspace = None; + let mut epiphany_root = None; + let mut item = None; + let mut artifact_dir = None; + let mut runtime_store = None; + let mut dry_run = false; + + let mut args = args.peekable(); + while let Some(arg) = args.next() { + match arg.as_str() { + "--workspace" => workspace = Some(take_path(&mut args, "--workspace")?), + "--epiphany-root" => epiphany_root = Some(take_path(&mut args, "--epiphany-root")?), + "--item" => item = Some(take_string(&mut args, "--item")?), + "--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?), + "--runtime-store" => runtime_store = Some(take_path(&mut args, "--runtime-store")?), + "--dry-run" | "--no-execute" => dry_run = true, + other => return Err(anyhow!("unexpected tick argument {other:?}")), + } + } + Ok(TickArgs { + workspace: workspace.context("missing --workspace")?, + epiphany_root: epiphany_root + .unwrap_or(env::current_dir().context("failed to resolve current directory")?), + item, + artifact_dir, + runtime_store, + dry_run, + }) +} + fn run_accept(args: AcceptArgs) -> Result { let workspace = args .workspace @@ -1415,6 +1457,7 @@ fn run_execute(args: ExecuteArgs) -> Result { "durableStateAdmitted": false, "privateStateExposed": false }, + "privateStateExposed": false, "nextSafeMove": "Route Soul verification and Mind review before publication; use epiphany-work publish only after review receipts exist." }); let receipt_path = artifact_dir.join(format!("work-execute-{item_slug}.json")); @@ -1844,6 +1887,232 @@ fn run_sync(args: SyncArgs) -> Result { })) } +fn run_tick(args: TickArgs) -> Result { + let workspace = args + .workspace + .canonicalize() + .with_context(|| format!("failed to resolve {}", args.workspace.display()))?; + ensure_git_repo(&workspace)?; + let epiphany_root = args + .epiphany_root + .canonicalize() + .with_context(|| format!("failed to resolve {}", args.epiphany_root.display()))?; + let artifact_dir = args + .artifact_dir + .clone() + .unwrap_or_else(|| workspace.join(".epiphany").join("work")); + fs::create_dir_all(&artifact_dir) + .with_context(|| format!("failed to create {}", artifact_dir.display()))?; + + let accept_receipt_path = resolve_accept_receipt(&workspace, args.item.as_deref(), None)?; + let accept_receipt = read_json(&accept_receipt_path)?; + let item = accept_receipt + .get("item") + .and_then(Value::as_str) + .unwrap_or("work-item") + .to_string(); + let item_slug = sanitize(&item); + + let plan_receipt_path = work_receipt_path(&workspace, "plan", &item); + let run_receipt_path = work_receipt_path(&workspace, "run", &item); + let adopt_receipt_path = work_receipt_path(&workspace, "adopt", &item); + let execute_receipt_path = work_receipt_path(&workspace, "execute", &item); + let publish_receipt_path = work_receipt_path(&workspace, "publish", &item); + let sync_receipt_path = work_receipt_path(&workspace, "sync", &item); + + let before_receipts = repo_work_receipt_state( + &accept_receipt_path, + &plan_receipt_path, + &run_receipt_path, + &adopt_receipt_path, + &execute_receipt_path, + &publish_receipt_path, + &sync_receipt_path, + ); + + let mut action = "none".to_string(); + let status; + let reason; + let next_safe_move; + let mut advanced_result = Value::Null; + + if sync_receipt_path.exists() { + action = "none".to_string(); + status = "noop".to_string(); + reason = "work item already has an upstream sync receipt".to_string(); + next_safe_move = "No branch-local scheduler action remains for this item.".to_string(); + } else if publish_receipt_path.exists() { + action = "none".to_string(); + status = "noop".to_string(); + reason = "publication receipt exists; scheduler stops before merge/sync authority".to_string(); + next_safe_move = + "Wait for maintainer/Bifrost merge receipt, then run epiphany-work sync.".to_string(); + } else if execute_receipt_path.exists() { + action = "none".to_string(); + status = "noop".to_string(); + reason = + "branch-local execution is recorded; scheduler stops before Soul/Mind/Bifrost gates" + .to_string(); + next_safe_move = + "Route Soul verification and Mind review before epiphany-work publish.".to_string(); + } else if adopt_receipt_path.exists() { + if !plan_receipt_path.exists() { + status = "blocked".to_string(); + reason = "adoption receipt exists but no matching plan receipt exists".to_string(); + next_safe_move = "Restore or pass a plan receipt before execution.".to_string(); + } else if args.dry_run { + action = "execute-from-plan".to_string(); + status = "would-advance".to_string(); + reason = "approved adoption and plan receipt exist".to_string(); + next_safe_move = + "Rerun without --dry-run to execute the adopted branch-local plan.".to_string(); + } else { + action = "execute-from-plan".to_string(); + advanced_result = run_execute(ExecuteArgs { + workspace: workspace.clone(), + epiphany_root: epiphany_root.clone(), + item: Some(item.clone()), + adopt_receipt: Some(adopt_receipt_path.clone()), + plan_receipt: Some(plan_receipt_path.clone()), + runtime_store: args.runtime_store.clone(), + artifact_dir: Some(artifact_dir.clone()), + command: None, + changed_paths: Vec::new(), + commit_message: None, + summary: Some(format!( + "Scheduler pulse executed adopted repo work item {item}." + )), + })?; + status = "advanced".to_string(); + reason = "executed approved branch-local plan through Hands".to_string(); + next_safe_move = + "Route Soul verification and Mind review before publication.".to_string(); + } + } else if run_receipt_path.exists() { + if !plan_receipt_path.exists() { + status = "blocked".to_string(); + reason = "run receipt exists but no matching plan receipt exists".to_string(); + next_safe_move = + "Write an Imagination/Self action plan before adopting Hands authority.".to_string(); + } else if args.dry_run { + action = "adopt-from-plan".to_string(); + status = "would-advance".to_string(); + reason = "queued run packet and plan receipt exist".to_string(); + next_safe_move = + "Rerun without --dry-run to adopt the plan into branch-local Hands authority." + .to_string(); + } else { + action = "adopt-from-plan".to_string(); + advanced_result = run_adopt(AdoptArgs { + workspace: workspace.clone(), + epiphany_root: epiphany_root.clone(), + item: Some(item.clone()), + run_receipt: Some(run_receipt_path.clone()), + plan_receipt: Some(plan_receipt_path.clone()), + runtime_store: args.runtime_store.clone(), + artifact_dir: Some(artifact_dir.clone()), + plan_summary: None, + adoption_evidence_refs: vec![format!("self.scheduler:repo-work-tick-{item_slug}")], + })?; + status = "advanced".to_string(); + reason = "adopted queued Hands run packet from typed action plan".to_string(); + next_safe_move = + "Run another scheduler pulse to execute the approved branch-local plan.".to_string(); + } + } else if plan_receipt_path.exists() { + let plan_receipt = read_json(&plan_receipt_path)?; + let requested_paths = first_plan_action(&plan_receipt) + .map(|action| string_array_field(action, "changedPaths")) + .unwrap_or_default(); + if requested_paths.is_empty() { + status = "blocked".to_string(); + reason = "plan receipt has no changedPaths for the Substrate Gate".to_string(); + next_safe_move = "Repair the plan receipt or write a new plan with changed paths." + .to_string(); + } else if args.dry_run { + action = "run-from-plan".to_string(); + status = "would-advance".to_string(); + reason = "accepted item and plan receipt exist".to_string(); + next_safe_move = + "Rerun without --dry-run to open the queued Substrate Gate and Hands run packet." + .to_string(); + } else { + action = "run-from-plan".to_string(); + advanced_result = run_work(RunArgs { + workspace: workspace.clone(), + epiphany_root: epiphany_root.clone(), + item: Some(item.clone()), + accept_receipt: Some(accept_receipt_path.clone()), + runtime_store: args.runtime_store.clone(), + artifact_dir: Some(artifact_dir.clone()), + requested_paths, + })?; + status = "advanced".to_string(); + reason = "opened queued Substrate Gate and Hands run packet from plan paths" + .to_string(); + next_safe_move = + "Run another scheduler pulse to adopt the plan into Hands authority.".to_string(); + } + } else { + status = "blocked".to_string(); + reason = "accepted work item has no matching action plan receipt".to_string(); + next_safe_move = + "Create an Imagination/Self plan receipt before scheduler can advance work.".to_string(); + } + + let after_receipts = repo_work_receipt_state( + &accept_receipt_path, + &plan_receipt_path, + &run_receipt_path, + &adopt_receipt_path, + &execute_receipt_path, + &publish_receipt_path, + &sync_receipt_path, + ); + let now = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true); + let receipt = json!({ + "schemaVersion": "epiphany.repo_work_scheduler_tick_receipt.v0", + "createdAt": now, + "workspace": workspace, + "item": item, + "scheduler": { + "owner": "Self", + "pulseKind": "repo-work-local", + "oneStepOnly": true, + "dryRun": args.dry_run + }, + "status": status, + "action": action, + "reason": reason, + "beforeReceipts": before_receipts, + "afterReceipts": after_receipts, + "advancedResult": advanced_result, + "authority": { + "branchLocalOnly": true, + "publicationAuthorized": false, + "mergeAuthorized": false, + "serviceLifecycleAuthorized": false, + "crossRepoMutationAuthorized": false, + "privateStateExposed": false + }, + "nextSafeMove": next_safe_move + }); + let receipt_path = artifact_dir.join(format!("work-tick-{item_slug}.json")); + write_json(&receipt_path, &receipt)?; + Ok(json!({ + "schemaVersion": "epiphany.repo_work_scheduler_tick.v0", + "status": receipt["status"], + "action": receipt["action"], + "workspace": receipt["workspace"], + "item": receipt["item"], + "receiptPath": receipt_path, + "reason": receipt["reason"], + "authority": receipt["authority"], + "privateStateExposed": false, + "nextSafeMove": receipt["nextSafeMove"], + })) +} + fn resolve_accept_receipt( workspace: &Path, item: Option<&str>, @@ -1932,6 +2201,40 @@ fn resolve_publish_receipt( }) } +fn work_receipt_path(workspace: &Path, kind: &str, item: &str) -> PathBuf { + workspace + .join(".epiphany") + .join("work") + .join(format!("work-{kind}-{}.json", sanitize(item))) +} + +fn repo_work_receipt_state( + accept: &Path, + plan: &Path, + run: &Path, + adopt: &Path, + execute: &Path, + publish: &Path, + sync: &Path, +) -> Value { + json!({ + "accept": receipt_path_state(accept), + "plan": receipt_path_state(plan), + "run": receipt_path_state(run), + "adopt": receipt_path_state(adopt), + "execute": receipt_path_state(execute), + "publish": receipt_path_state(publish), + "sync": receipt_path_state(sync), + }) +} + +fn receipt_path_state(path: &Path) -> Value { + json!({ + "path": path, + "exists": path.exists(), + }) +} + fn latest_receipt_in(work_dir: &Path, prefix: &str) -> Option { let mut candidates = Vec::new(); if work_dir.exists() { @@ -2243,13 +2546,14 @@ fn sanitize(value: &str) -> String { fn print_usage() { eprintln!( - "usage: epiphany-work ...\n\ + "usage: epiphany-work ...\n\ accept --workspace --from --item [--summary ] [--topic ] [--store ] [--runtime-id ] [--online-receipt ] [--public-discussion-ref ] [--candidate-action-ref ]\n\ plan --workspace [--item ] --objective --plan-summary --command --changed-path --commit-message [--adoption-evidence-ref ]\n\ run --workspace [--item ] [--accept-receipt ] [--runtime-store ] [--requested-path ]\n\ adopt --workspace [--item ] [--run-receipt ] [--from-plan ] [--plan-summary ] [--adoption-evidence-ref ]\n\ execute --workspace [--item ] [--from-plan ] [--command ] [--changed-path ] [--commit-message ]\n\ publish --workspace [--item ] --change-summary --justification --verification-receipt --review-receipt --ledger-entry-id --pull-request-url --pull-request-title \n\ - sync --workspace [--item ] [--publish-receipt ] [--upstream-ref origin/main] --merge-receipt " + sync --workspace [--item ] [--publish-receipt ] [--upstream-ref origin/main] --merge-receipt \n\ + tick --workspace [--item ] [--runtime-store ] [--dry-run]" ); } diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 40b6865e..01963bff 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -134,6 +134,7 @@ epiphany-work plan --workspace --item --objective --plan-summ epiphany-work run --workspace epiphany-work adopt --workspace --item --from-plan epiphany-work execute --workspace --item --from-plan +epiphany-work tick --workspace --item epiphany-work publish --workspace epiphany-work sync --workspace --item --upstream-ref origin/main --merge-receipt ``` @@ -426,6 +427,49 @@ The synced receipt produced `publicationAuthorized=true`, `upstreamMainSynced=true`, `mergeAuthorized=true`, `mergeAuthorityReceipts=[...]`, and `privateStateExposed=false`. +### Landed Work Scheduler Pulse + +The tenth front door exists as native Rust: + +```powershell +cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-work -- tick --workspace --item +``` + +It reads the repo-local work receipt chain and advances exactly one safe +branch-local step when the necessary upstream receipts already exist: + +- accepted item plus plan receipt -> `run-from-plan` +- queued run packet plus plan receipt -> `adopt-from-plan` +- approved adoption plus plan receipt -> `execute-from-plan` + +The scheduler writes `.epiphany/work/work-tick-.json` as +`epiphany.repo_work_scheduler_tick_receipt.v0`, owned by Self. The receipt +records before/after receipt state, action, status, reason, next safe move, and +the strict authority seal: branch-local only, no publication, no merge, no +service lifecycle authority, no cross-repo mutation, and +`privateStateExposed=false`. + +The pulse stops once branch-local execution has been recorded. It does not +publish, merge, synthesize Soul/Mind receipts, install services, or impersonate +Idunn. Those gates remain owned by their organs. + +The first smoke proved: + +```powershell +epiphany-work tick --workspace --item first-request +# advanced: run-from-plan +epiphany-work tick --workspace --item first-request +# advanced: adopt-from-plan +epiphany-work tick --workspace --item first-request +# advanced: execute-from-plan +epiphany-work tick --workspace --item first-request +# noop: none +``` + +The execute receipt produced a real branch-local commit from the typed plan +packet, the fourth pulse stopped at the Soul/Mind/Bifrost boundary, and the +proof returned `privateStateExposed=false`. + ## Migration Implication The next migration plan must treat autonomous branch-local work as a required @@ -438,11 +482,13 @@ That is the machine we are building. ## Full Migration Plan To Repo Swarm MVP -This plan starts from the current state: nine native front doors exist, but the +This plan starts from the current state: ten native front doors exist, but the work loop is not yet a full physiology. `init`, `online`, `accept`, `plan`, -`run`, `adopt`, `execute`, `publish`, and `sync` prove the typed path from repo -birth to Bifrost/GitHub publication receipts and upstream-main sync proof. They -do not yet prove continuous scheduling or a repo Persona that can turn +`run`, `adopt`, `execute`, `tick`, `publish`, and `sync` prove the typed path +from repo birth to branch-local scheduler pulse, Bifrost/GitHub publication +receipts, and upstream-main sync proof. They do not yet prove daemonized +scheduling, cooldown physiology, Soul/Modeling/Mind closure after execution, or +a repo Persona that can turn conversation into autonomous action without the operator feeding plan details by hand. @@ -494,9 +540,13 @@ The chain is typed and sealed enough to be useful: - `epiphany-work sync` requires an explicit maintainer/Bifrost merge receipt and writes `upstreamMainSynced=true` only after git proves the published commit is contained by upstream main. +- `epiphany-work tick` is the first Self-owned scheduler pulse: it advances one + safe branch-local step across plan-backed `run`, `adopt`, or `execute`, then + stops before Soul/Mind/Bifrost gates. -The scar is equally important: this is still a manually pulsed chain. The -operator can prove each organ, but the swarm does not yet breathe on its own. +The scar is equally important: this is still an operator-triggered pulse, not a +daemonized physiology. The operator can prove each organ, but the swarm does +not yet breathe on its own cadence. ### Remaining MVP Organs @@ -506,9 +556,10 @@ physiology while preserving the same authority receipts. Required organs before MVP: -- Scheduler physiology: Self or heartbeat can advance one safe branch-local - step when typed receipts make that step legal, and can refuse or sleep when - they do not. +- Scheduler physiology: the first `epiphany-work tick` pulse exists; remaining + work is daemonized cadence, cooldown after completion, active-turn/brake + integration, stale-turn recovery, and handoff from branch-local execution to + Soul/Modeling/Mind closure. - Persona-to-plan automation: repo Persona input becomes candidate action pressure, Mind/Interpreter extracts work-shaped intent, and Imagination writes the plan packet without the operator hand-authoring shell details. @@ -521,7 +572,7 @@ Required organs before MVP: chains, commit refs, verification verdicts, map admission, Bifrost/GitHub refs, credit refs, and sync state. -Scheduler authority is intentionally narrow for the first cut. It may advance +Scheduler authority is intentionally narrow. It may advance `accept -> plan -> run -> adopt -> execute` only when each upstream receipt exists, the repo is on an owned `epiphany/*` branch for mutation, the planned paths stay inside the Hands gate, and no brake or active turn blocks the lane. @@ -685,6 +736,9 @@ Required cuts: - Add a repo-local scheduler pulse that reads accepted/adopted work, active Hands/Soul/Modeling/Mind receipts, cooldowns, brakes, and branch status. +- Keep `epiphany-work tick` as the first native pulse: one safe branch-local + advancement per invocation, with a scheduler receipt for advanced, blocked, + dry-run, or no-op outcomes. - Ensure no lane wakes again while its previous heartbeat turn is active. - Let cooldown begin after completion, not launch. - Honor local Verse swarm brake and repo-specific pause receipts. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 9102ebee..bb1bf970 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -102,7 +102,7 @@ remembers doctrine; the branch remembers the blade. - Edge JSON is allowed for schema description, hostile ingress before immediate typed parsing, sealed forensic artifacts, or named quarantine experiments. When both subsystems are ours, runtime data must remain typed CultCache documents and move over CultNet typed contracts. Generic `serde_json::Value` in worker launch/result/selfPatch/runtime flow is contamination until classified and replaced. - Hands now has a first executable action receipt spine. `epiphany-core::hands_gateway` owns `HandsActionIntent`, `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and `HandsCommitReceipt`; runtime-spine can persist/reread them; `runtime_spine_persists_mind_gateway_review_receipts` includes the Hands chain beside Mind/Eyes/Substrate/Soul/Continuity proofs and proves the post-timestamp Hands receipt-chain detector; `epiphany-hands-action-smoke` emits intent/review/patch/command/commit receipt ids from `.epiphany-smoke\runtime-spine\hands-action-smoke.msgpack`; and the repo-action launch proof profile now requires action intent, action review, and patch receipt together. `epiphany-mvp-coordinator` now turns `continueImplementation` into a persisted Substrate Gate grant plus Hands intent/review gate and includes the receipt ids in the operator step. `epiphany-hands-action` is the native consequence recorder for that gate: `record-patch`, `record-command`, `record-commit`, and turn-level `record-pass` load the stored intent/review or `finalAction.handsActionGate` from `coordinator-summary.json`, require an approved matching review, enforce allowed operations, and keep patch/commit changed paths inside the requested scope. `epiphany-mvp-coordinator-smoke` includes the deterministic Hands pass proof. The coordinator now treats a complete Hands receipt chain after an accepted Soul result as new implementation evidence, launches Soul again, and routes a passing accepted Soul result to Modeling/modeling before another Hands turn. Work-loop telemetry is now typed internal CultMesh state: Verification role launches write `epiphany.cultmesh.work_loop_telemetry.v0` beside runtime-spine, render that packet for Soul with resolved receipt bodies, commit diff preview, source proof notes, verification assertions, and stdout/stderr previews, and Modeling launches read/enrich the latest packet with Soul acceptance receipt ids before Modeling updates the map. Local Verse prompt context now exposes only a sealed `latest_work_loop_summary` digest with telemetry id, Hands receipt ids, path/source/assertion counts, and Soul receipt ids; receipt payload previews, artifact previews, and commit diff previews remain internal telemetry and are leak-guarded by tests plus `epiphany-verse-query -- smoke`. - `notes/epiphany-swarm-readiness-plan.md` is the current live-fire direction gate. The local runner proves startup/status/coordinator wiring; it does not authorize unattended swarm operation. Carry VoidBot's lessons forward: one CTB-style initiative scheduler, typed pause/brake, active-turn freeze, cooldown after completion, stale active-turn recovery receipts, parent-side speech eligibility, memory lifecycle phases, and typed operation proposals instead of prompt-owned governance. `epiphany-verse-query swarm-brake --brake-status engaged|released` can now write the local Verse brake document, and `tools/epiphany_local_run.ps1` refuses live `plan`/`run`/`mvp` modes when that brake is engaged while keeping `status` readable. `epiphany-mvp-coordinator` also checks `--local-verse-store` before app-server startup, and `epiphany-heartbeat-store` guards tick/pump/heat/queue-mention/routine when passed `--local-verse-store`. Daemon tool invocation, daemon lifecycle poke, and `epiphany-daemon-supervisor` restart/tick/serve/service-plan/service-launch/service-runbook/windows-service-install/windows-service-status/windows-service-reconcile/windows-service-execution-readiness/start/stop attempts now fail closed under a matching engaged brake; supervisor restart now has durable per-daemon policy with cooldown/backoff, explicit scheduled tick pulses, latest scheduler receipts, typed service lifecycle plan/launch/runbook/install/status/reconcile/readiness/start/stop receipts, and local operator wrapper modes that write runbook/install/status/reconcile/readiness/control-plan/execution artifacts plus operator run receipts. The installed-service read path, read-only service-policy reconciliation path, execution-readiness path, non-mutating start/stop control-plan path, and non-elevated execution refusal path have been proved against real Windows `EventLog` service-manager state or safe missing-service targets through local Verse receipts, including explicit wrapper install/start/stop execution modes. The next cut is actual elevated install/start/stop execution proof under operator authority. -- `notes/epiphany-repo-swarm-mvp-contract.md` is the repo-swarm MVP authority map and migration plan. It states the live nine-front-door chain from `epiphany-repo init` through `epiphany-work sync`, documents the operator-safe proof receipts already proved with `privateStateExposed=false`, and names the remaining MVP organs: scheduler physiology, Persona-to-plan automation, Soul/Modeling/Mind closure, repo work overview, and proof bundles. Autonomous branch-local work inside the owned repo Body is in scope and desired; Bifrost gates publication/merge/escalation, Idunn owns daemon lifecycle, and the scheduler may only advance safe receipt-backed branch-local steps. +- `notes/epiphany-repo-swarm-mvp-contract.md` is the repo-swarm MVP authority map and migration plan. It states the live ten-front-door chain from `epiphany-repo init` through `epiphany-work tick`, `publish`, and `sync`, documents the operator-safe proof receipts already proved with `privateStateExposed=false`, and names the remaining MVP organs: daemonized scheduler cadence/cooldown/brake integration, Persona-to-plan automation, Soul/Modeling/Mind closure, repo work overview, and proof bundles. Autonomous branch-local work inside the owned repo Body is in scope and desired; Bifrost gates publication/merge/escalation, Idunn owns daemon lifecycle, and `epiphany-work tick` may only advance one safe receipt-backed branch-local step per pulse before stopping at Soul/Mind/Bifrost gates. - `service-execution-runbook` makes that next cut repeatable: it generates the exact elevated wrapper command sequence without mutating the service manager, continues after per-step failure to preserve more receipts, runs `service-execution-audit` in `finally`, exits nonzero if any step failed, and seals a typed runbook lifecycle receipt. Run the generated artifact only with explicit operator authority. - `service-execution-audit` is the non-mutating acceptance proof after the elevated rite: it reports `complete` only when typed lifecycle receipts prove the runbook witness plus expected elevated chain, and otherwise reports the missing/failed sealed checks. - `service-tick` is the non-elevated scheduler pulse proof: it writes the latest daemon scheduler receipt through durable policy ownership and local wrapper receipts. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 48528e404f40bf6ee6e0c19cd1fb29d55fee8f4d..f8ad322ddf7abf9f30a92ab26ca6e17e6b6f61be 100644 GIT binary patch delta 348 zcmYk1y-ve06oqkHv2?2#kXWu@VZgLap(15tV1fx)*j)Rjv69%vcKDe(bl?T3IxryK z0K|Zp5zM>`FMvZB7_57B?m0)F@83J$ADyRF(%y+i{rLQIsrC5vvOz8gA+veocHSW2 zRkQgzZ?u*lR_@-SUNoe=A??SfQ8cP@i|2K+Hr+g8N}vEV(xgn?&?{{-@RDc19QYI= zk=A*zXmovZJVjCFXu*`Z!)-XU=+a*UxI$+LOk6U>L#fG`qGQIhu-Cn*)#W6ZOGOi_ z3p%YVTOpy1ua#QBYviTJ|59L4ptLrjY>bJv2q(JCyT?+A?tu(-0dvAUx_$VI2Plrx iRPYHO5$WoeX&T` adopt-from-plan -> execute-from-plan` then no-ops before Soul/Mind/Bifrost gates, and upstream-main ancestry proof after explicit merge receipt. Remaining MVP organs are daemonized scheduler cadence/cooldown/brake integration, Persona-to-plan automation, Soul/Modeling/Mind closure after Hands commits, compact repo work overview, and operator-safe proof bundles; the scheduler may advance only one safe receipt-backed branch-local step per pulse and must not publish, merge, mutate services, cross repo boundaries, expose private state, or impersonate Idunn. - Agent memory lifecycle now has a first typed v0 operation surface in `epiphany-core::agent_memory`: `AgentMemoryLifecycleOperation` can revise, retire, crystallize, prune, and merge bounded memory records after role/agent review, and `epiphany-agent-memory-store review-lifecycle|apply-lifecycle` exposes the path at the operator edge. This closes the first explicit lifecycle-operation slice from the swarm-readiness gate; it does not yet make sleep silently mutate identity or project truth. - Persona public speech now has a parent-side eligibility receipt at the Discord/Aquarium mouth edge. `epiphany.persona_speech_audit.v0` records action kind, content fingerprint, opening/topic keys, recent-window counts, repeated opening/topic counts, channel saturation, and allow/block reasons. `epiphany-persona-discord post` blocks repeated public openings before token/webhook work; draft and bubble still emit audit receipts for operator inspection. The compatibility JSON artifact remains for display, but the durable witness is now `epiphany.cultmesh.persona_speech_audit.v0` in CultMesh with latest-key projection through local Verse context. Local MVP Persona bubbles now write that durable witness to `.epiphany-run/cultmesh/local-verse.ccmp`, not a separate mouth-side store. This is posting-edge policy, not a Persona prompt wish. - Grow the VoidBot repo-Persona pattern into Epiphany's product direction: each Epiphany owns one or more repos, has one or more Personas, and exposes project-native conversation through Aquarium, Discord, voice/WebRTC, stream surfaces, CLI, and CultNet clients so humans can talk to projects instead of pre-authoring complete implementation briefs. Persona is special because Imagination acts as Projector, turning typed state into narrative context before the Persona thinks, and Mind acts as Interpreter, turning natural Persona output into reviewed state/side-effect intents after the Persona thinks. @@ -633,4 +633,4 @@ current_status: - `tools/epiphany_local_run.ps1 -Mode swarm-online-runbook` now emits an explicit Idunn preflight summary before the operator elevation boundary. Its JSON and one-line summary report `preflightStatus`, child artifact present/hash-verified/mismatch/missing counts, aggregate service execution failed/missing check counts, child preflight rows with expected/actual SHA-256s, and private-state exposure. Live proof `local-20260619-025627-410-9724e2f6` generated the non-mutating parent artifact with `preflightStatus=ready-for-elevated-operator`, two child runbooks present, two hashes verified, zero mismatches, zero missing artifacts, eleven failed sealed service checks, zero missing checks, explicit aftercare audits, and `privateStateExposed=false`. The remaining scar is still explicit elevated operator execution followed by complete Idunn audits, not missing parent/child artifact readiness. - 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. - next_action: Continue repo-swarm MVP work from the documented nine-front-door chain. Build scheduler physiology for advancing safe receipt-backed branch-local work without manual CLI stepping; then build deeper Persona-to-plan automation so plan packets are model/Imagination-authored rather than operator-authored. Preserve Idunn service lifecycle surfaces and existing CultMesh/Odin/Eve tool directories; service install/start execution still requires explicit elevated operator authority. + next_action: Continue repo-swarm MVP work from the documented ten-front-door chain. Next deepen scheduler physiology from operator-triggered `epiphany-work tick` into daemonized cadence/cooldown/brake-aware pulses and Soul/Modeling/Mind closure, then build Persona-to-plan automation so plan packets are model/Imagination-authored rather than operator-authored. Preserve Idunn service lifecycle surfaces and existing CultMesh/Odin/Eve tool directories; service install/start execution still requires explicit elevated operator authority.