From d0723872494a5036953aa94e184b17111a42dff4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 20 Jun 2026 00:16:54 +0100 Subject: [PATCH] Add repo work serve cadence --- epiphany-core/src/bin/epiphany-work.rs | 221 ++++++++++++++++++++++ notes/epiphany-repo-swarm-mvp-contract.md | 53 +++++- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 304683 -> 305613 bytes state/map.yaml | 4 +- 5 files changed, 268 insertions(+), 12 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 587d914f..398b78ca 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -53,6 +53,7 @@ fn main() -> Result<()> { "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)?), + "serve" | "loop" | "daemon" => run_serve(parse_serve_args(args)?), other => Err(anyhow!("unknown epiphany-work command {other:?}")), }?; println!("{}", serde_json::to_string_pretty(&result)?); @@ -181,6 +182,14 @@ struct TickArgs { dry_run: bool, } +#[derive(Clone, Debug)] +struct ServeArgs { + tick: TickArgs, + scheduler_id: String, + loop_interval_seconds: u64, + max_iterations: u64, +} + fn parse_accept_args(args: impl Iterator) -> Result { let mut workspace = None; let mut epiphany_root = None; @@ -686,6 +695,67 @@ fn parse_tick_args(args: impl Iterator) -> Result { }) } +fn parse_serve_args(args: impl Iterator) -> Result { + let mut workspace = None; + let mut epiphany_root = None; + let mut item = None; + let mut local_verse_store = None; + let mut artifact_dir = None; + let mut runtime_store = None; + let mut cooldown_seconds = 30_u64; + let mut active_timeout_seconds = 900_u64; + let mut dry_run = false; + let mut scheduler_id = "epiphany-repo-work-scheduler".to_string(); + let mut loop_interval_seconds = 30_u64; + let mut max_iterations = 0_u64; + + 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")?), + "--local-verse-store" | "--store" => { + local_verse_store = Some(take_path(&mut args, "--local-verse-store")?); + } + "--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?), + "--runtime-store" => runtime_store = Some(take_path(&mut args, "--runtime-store")?), + "--cooldown-seconds" => { + cooldown_seconds = take_u64(&mut args, "--cooldown-seconds")?; + } + "--active-timeout-seconds" => { + active_timeout_seconds = take_u64(&mut args, "--active-timeout-seconds")?; + } + "--scheduler-id" => scheduler_id = take_string(&mut args, "--scheduler-id")?, + "--loop-interval-seconds" | "--serve-interval-seconds" => { + loop_interval_seconds = take_u64(&mut args, "--loop-interval-seconds")?; + } + "--max-iterations" => { + max_iterations = take_u64(&mut args, "--max-iterations")?; + } + "--dry-run" | "--no-execute" => dry_run = true, + other => return Err(anyhow!("unexpected serve argument {other:?}")), + } + } + Ok(ServeArgs { + tick: TickArgs { + workspace: workspace.context("missing --workspace")?, + epiphany_root: epiphany_root + .unwrap_or(env::current_dir().context("failed to resolve current directory")?), + item, + local_verse_store, + artifact_dir, + runtime_store, + cooldown_seconds, + active_timeout_seconds, + dry_run, + }, + scheduler_id, + loop_interval_seconds, + max_iterations, + }) +} + fn run_accept(args: AcceptArgs) -> Result { let workspace = args .workspace @@ -1907,6 +1977,153 @@ fn run_sync(args: SyncArgs) -> Result { })) } +fn run_serve(args: ServeArgs) -> Result { + if args.max_iterations == 0 && args.loop_interval_seconds == 0 { + return Err(anyhow!( + "unbounded repo-work serve mode requires --loop-interval-seconds greater than 0" + )); + } + + let workspace = args + .tick + .workspace + .canonicalize() + .with_context(|| format!("failed to resolve {}", args.tick.workspace.display()))?; + ensure_git_repo(&workspace)?; + let artifact_dir = args + .tick + .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.tick.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 started_at = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true); + let serve_mode = if args.max_iterations == 0 { + "unbounded-service" + } else { + "bounded-proof" + }; + let receipt_path = scheduler_serve_receipt_path(&artifact_dir, &item_slug); + let start_receipt = json!({ + "schemaVersion": "epiphany.repo_work_scheduler_serve_receipt.v0", + "createdAt": started_at, + "startedAt": started_at, + "completedAt": Value::Null, + "status": "serve-running", + "workspace": workspace, + "item": item, + "scheduler": { + "owner": "Self", + "schedulerId": args.scheduler_id, + "serveMode": serve_mode, + "pulseKind": "repo-work-local", + "oneStepPerPulse": true, + "loopIntervalSeconds": args.loop_interval_seconds, + "maxIterations": args.max_iterations, + "cooldownSeconds": args.tick.cooldown_seconds, + "activeTimeoutSeconds": args.tick.active_timeout_seconds, + "dryRun": args.tick.dry_run + }, + "iterations": 0, + "outputs": [], + "lastOutput": Value::Null, + "authority": { + "branchLocalOnly": true, + "publicationAuthorized": false, + "mergeAuthorized": false, + "serviceLifecycleAuthorized": false, + "crossRepoMutationAuthorized": false, + "privateStateExposed": false + }, + "nextSafeMove": "Repo-work scheduler cadence is running; inspect per-pulse tick receipts for the durable trail." + }); + write_json(&receipt_path, &start_receipt)?; + + let mut outputs = Vec::new(); + let mut iteration = 0_u64; + let last_output = loop { + iteration = iteration.saturating_add(1); + let next_wake_utc = if args.max_iterations == 0 || iteration < args.max_iterations { + Some( + (Utc::now() + chrono::Duration::seconds(args.loop_interval_seconds as i64)) + .to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + ) + } else { + None + }; + let tick_output = run_tick(args.tick.clone())?; + let iteration_output = json!({ + "iteration": iteration, + "nextWakeUtc": next_wake_utc, + "tick": tick_output + }); + if args.max_iterations != 0 { + outputs.push(iteration_output.clone()); + } + if args.max_iterations != 0 && iteration >= args.max_iterations { + break iteration_output; + } + std::thread::sleep(std::time::Duration::from_secs(args.loop_interval_seconds)); + }; + + let completed_at = Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true); + let receipt = json!({ + "schemaVersion": "epiphany.repo_work_scheduler_serve_receipt.v0", + "createdAt": completed_at, + "startedAt": started_at, + "completedAt": completed_at, + "status": "serve-complete", + "workspace": workspace, + "item": item, + "scheduler": { + "owner": "Self", + "schedulerId": args.scheduler_id, + "serveMode": serve_mode, + "pulseKind": "repo-work-local", + "oneStepPerPulse": true, + "loopIntervalSeconds": args.loop_interval_seconds, + "maxIterations": args.max_iterations, + "cooldownSeconds": args.tick.cooldown_seconds, + "activeTimeoutSeconds": args.tick.active_timeout_seconds, + "dryRun": args.tick.dry_run + }, + "iterations": iteration, + "outputs": outputs, + "lastOutput": last_output, + "authority": { + "branchLocalOnly": true, + "publicationAuthorized": false, + "mergeAuthorized": false, + "serviceLifecycleAuthorized": false, + "crossRepoMutationAuthorized": false, + "privateStateExposed": false + }, + "nextSafeMove": "Continue cadence only while repo-work receipts still identify a safe branch-local step; route Soul/Modeling/Mind closure after execution." + }); + write_json(&receipt_path, &receipt)?; + Ok(json!({ + "schemaVersion": "epiphany.repo_work_scheduler_serve.v0", + "status": "serve-complete", + "workspace": receipt["workspace"], + "item": receipt["item"], + "scheduler": receipt["scheduler"], + "iterations": receipt["iterations"], + "receiptPath": receipt_path, + "lastOutput": receipt["lastOutput"], + "authority": receipt["authority"], + "privateStateExposed": false, + "nextSafeMove": receipt["nextSafeMove"], + })) +} + fn run_tick(args: TickArgs) -> Result { let workspace = args .workspace @@ -2829,6 +3046,10 @@ fn tick_last_completed_receipt_path(artifact_dir: &Path, item_slug: &str) -> Pat artifact_dir.join(format!("work-tick-last-{item_slug}.json")) } +fn scheduler_serve_receipt_path(artifact_dir: &Path, item_slug: &str) -> PathBuf { + artifact_dir.join(format!("work-scheduler-serve-{item_slug}.json")) +} + fn parse_utc_rfc3339(value: &Value, field: &str) -> Option> { DateTime::parse_from_rfc3339(value.get(field)?.as_str()?) .ok() diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 21a64777..7bf1d96b 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -135,6 +135,7 @@ 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 serve --workspace --item --max-iterations epiphany-work publish --workspace epiphany-work sync --workspace --item --upstream-ref origin/main --merge-receipt ``` @@ -474,6 +475,25 @@ The pulse now also owns its first scheduler physiology markers: These markers are scheduler receipts, not hidden daemon memory. They carry the same authority seal and `privateStateExposed=false`. +`epiphany-work serve` is Self's cadence wrapper around the same tick artery: + +```powershell +cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-work -- serve --workspace --item --max-iterations 2 --loop-interval-seconds 30 --cooldown-seconds 30 +``` + +It writes `.epiphany/work/work-scheduler-serve-.json` as +`epiphany.repo_work_scheduler_serve_receipt.v0` with `status=serve-running` +before the first pulse, then repeatedly invokes the same receipt-gated `tick` +path. `--max-iterations ` is bounded proof mode; omitting it is unbounded +service mode. Unbounded mode refuses a zero-second loop interval so Self cannot +become a hot polling idol. Bounded proof mode overwrites the same serve receipt +with `status=serve-complete` and finite iteration outputs, while the tick +receipts remain the durable per-pulse trail for long-running mode. + +This is scheduler cadence, not service lifecycle. It does not install itself, +spawn Windows services, restart daemons, or take Idunn's daemon survival +authority. + 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. @@ -512,6 +532,14 @@ adoption receipt. A final stale-marker proof with `advanced:adopt-from-plan`, and recorded `recoveredActiveTurn=true`. All summaries reported `privateStateExposed=false`. +A fourth smoke proved cadence mode. On a disposable fresh repo Body, +`epiphany-work serve --max-iterations 2 --loop-interval-seconds 0 --cooldown-seconds 60` +wrote `epiphany.repo_work_scheduler_serve_receipt.v0`; iteration one advanced +`advanced:run-from-plan`, iteration two refused `refused-by-cooldown:none`, +`work-run-.json` existed, `work-adopt-.json` did not, and the +serve receipt reported `privateStateExposed=false`. A separate negative check +proved unbounded `serve --loop-interval-seconds 0` refuses with exit code 1. + ## Migration Implication The next migration plan must treat autonomous branch-local work as a required @@ -530,9 +558,9 @@ work loop is not yet a full physiology. `init`, `online`, `accept`, `plan`, from repo birth to branch-local scheduler pulse, Bifrost/GitHub publication receipts, and upstream-main sync proof. `tick` now also proves brake refusal, active-turn refusal, completion-anchored cooldown refusal, and stale active-turn -recovery through typed scheduler receipts. The chain does not yet prove -daemonized cadence, Soul/Modeling/Mind closure after execution, or a repo -Persona that can turn +recovery through typed scheduler receipts; `serve` now proves bounded cadence +around that same tick artery. The chain does not yet prove 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. @@ -589,10 +617,15 @@ The chain is typed and sealed enough to be useful: refuses under local Verse brake, refuses while an active turn is live, refuses during explicit completion-anchored cooldown, recovers stale active markers, then stops before Soul/Mind/Bifrost gates. +- `epiphany-work serve` is the first Self-owned cadence loop around that pulse: + bounded proof mode records finite iteration outputs, unbounded service mode + relies on per-pulse tick receipts, and zero-interval unbounded polling is + refused. -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. +The scar is equally important: this is still an operator-started cadence loop, +not installed service lifecycle. The operator can prove the scheduler breathes, +but Idunn-owned service installation/startup remains an explicit elevated +authority boundary. ### Remaining MVP Organs @@ -603,9 +636,11 @@ physiology while preserving the same authority receipts. Required organs before MVP: - Scheduler physiology: the first `epiphany-work tick` pulse now has brake, - active-turn, cooldown, and stale-turn recovery receipts. Remaining work is - daemonized cadence/policy around that pulse and handoff from branch-local - execution to Soul/Modeling/Mind closure. + active-turn, cooldown, and stale-turn recovery receipts, and + `epiphany-work serve` adds bounded/unbounded cadence around that pulse. + Remaining work is handoff from branch-local execution to Soul/Modeling/Mind + closure and any later Idunn service lifecycle integration under explicit + operator authority. - 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. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 6fe88c84..12dd7801 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 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, 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. The tick pulse now reads the repo-local CultMesh swarm brake and writes `refused-by-swarm-brake` without creating run/adopt/execute receipts when the brake is engaged. It also writes active-turn and last-completed scheduler receipts, refuses live duplicate pulses as `refused-active-turn`, refuses explicit completion-anchored cooldown as `refused-by-cooldown`, clears stale active markers after `--active-timeout-seconds`, and records `physiology.recoveredActiveTurn.recovered=true` when recovery proceeds. Disposable fresh-repo smoke proved active refusal, `advanced:run-from-plan`, cooldown refusal without adoption, stale recovery into `advanced:adopt-from-plan`, active marker cleanup, last-completed anchor creation, and `privateStateExposed=false`. +- `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: 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. The tick pulse now reads the repo-local CultMesh swarm brake and writes `refused-by-swarm-brake` without creating run/adopt/execute receipts when the brake is engaged. It also writes active-turn and last-completed scheduler receipts, refuses live duplicate pulses as `refused-active-turn`, refuses explicit completion-anchored cooldown as `refused-by-cooldown`, clears stale active markers after `--active-timeout-seconds`, and records `physiology.recoveredActiveTurn.recovered=true` when recovery proceeds. `epiphany-work serve` now wraps that tick artery in Self-owned cadence: bounded `--max-iterations` proof mode writes `work-scheduler-serve-.json`, unbounded service mode relies on per-pulse tick receipts, and unbounded zero-second polling is refused. Disposable fresh-repo smokes proved active refusal, `advanced:run-from-plan`, cooldown refusal without adoption, stale recovery into `advanced:adopt-from-plan`, active marker cleanup, last-completed anchor creation, serve cadence iteration one `advanced:run-from-plan`, iteration two `refused-by-cooldown:none`, no adoption during cooldown, unbounded zero-interval refusal, and `privateStateExposed=false`. - `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 dd046cfcb14a50c3aade80255a8c3c84bfd61ae5..653ad8c88ed67db80aec9387985b958869683a0a 100644 GIT binary patch delta 777 zcmZ{izityj5XL$Cpg{tZCg!gOA*j5L?MOxh#0yXXDG-fWcIUVy=iOs>&zI0dh=Ki2|dvzZXK($wgSla)u^Zq-in7Si zf;J_j+`(PU5@t$`5**qog5VOhK;YICT7pjzyb>Gq@6lFY-^W+BF;{uY_13&*{fw~* z-(-q%xK~Cy7y@INF*#G3f>WL`hr(#-piei#m`qaJCOGOtX^lr%6z^G5Jr1hJjp}hN z@yytwK$ZL6wBLoMB^Zs>soi+_U$d5Jn;ldN02Z`@<3IkJ#Ya`jGqx_U*h~ z?ri%*mi$BAVi3p^LI(3GS*8*cTOvb>tm`T2#A(2)Z79&zclfWd%-tS#n<&}O^+rPgTb2X52pAxw+E3rMm?*jWy zO#7m1;OD!<6Kc4$4MeY)qCf46D+i39qBYH?kZ>Z(GZL<{3{WS=3Y5LSiuV{Q delta 49 zcmX?mS!necp$!s@+y+Kgrbbc67+98aY*uD0WMpJ+p32ldm5C9EK{WIBsZ1=>76Sl^ C*$*}V diff --git a/state/map.yaml b/state/map.yaml index fa5a3762..2baa168a 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -88,7 +88,7 @@ active_subgoals: - Keep the landed Phase 6 coordinator, limited safe-boundary CRRC automation, and pre-compaction checkpoint intervention ready for the next bridge-equipped dogfood run. - Preserve the Ghostlight-derived heartbeat initiative seam: every lane, including coordinator/Self and Persona, has a organ-state record and competes for heartbeat slots through readiness/reaction timing; initiative heat can raise or cool global, group, arena, role, and agent tempo through typed heartbeat policy; active thinking freezes initiative until completion, so heat never queues a lane already mid-turn; idle winners ruminate instead of inventing project work, and sleep windows distill the accumulated thought pressure into reviewed self-memory or doctrine. - Use `notes/epiphany-swarm-readiness-plan.md` as the live-fire direction gate. The local run path is a compass, not launch clearance: before unattended swarm operation, Epiphany needs typed pause/brake enforcement, one initiative scheduler, completion-gated cooldown, stale active-turn recovery receipts, parent-side Persona speech eligibility, memory lifecycle operations, and CultNet-first operator snapshots/intents/receipts. The local Verse brake document exists, `epiphany-verse-query swarm-brake` can engage/release it, `tools/epiphany_local_run.ps1` refuses live `plan`/`run`/`mvp` modes when the brake is engaged while leaving `status` readable, `epiphany-mvp-coordinator` checks the local Verse brake before app-server startup, and `epiphany-heartbeat-store` guards tick/pump/heat/queue-mention/routine when given `--local-verse-store`. Daemon liveness is now a typed local Verse authority: `epiphany-verse-query daemon-status` writes one daemon status without repainting the table, local Verse seeding preserves existing daemon statuses and swarm brakes, `invoke-tool` refuses when the host daemon is not ready or lacks `submitTypedToolIntent`, and both daemon tool invocation and lifecycle poke fail closed under an engaged matching brake. `epiphany-daemon-supervisor policy` writes durable per-daemon restart policy with command/args/cwd/cooldown/backoff/attempt state plus reconcile cadence and stale-heartbeat threshold; `epiphany-daemon-supervisor reconcile` loads that policy when no override command is supplied, refuses under a matching lifecycle brake, refuses during cooldown/backoff, writes daemon poke intent/receipt, updates daemon status, and updates policy attempt state; `epiphany-daemon-supervisor tick` is an explicit scheduler pulse that scans durable policies, records ready/noop pulses, skips before the configured reconcile interval, marks stale heartbeat status degraded, routes restarts through the same brake/cooldown/poke receipt path, and writes a latest `epiphany.cultmesh.daemon_scheduler_receipt.v0`; `epiphany-daemon-supervisor serve` runs that same pulse on a configurable cadence with bounded `--max-iterations` proof mode or unbounded service mode. `epiphany-daemon-supervisor service-plan`/`install-service` now writes a planned `epiphany.cultmesh.daemon_service_lifecycle_receipt.v0` for the `serve` command, while `service-launch`/`start-service` spawns that `serve` loop through the current executable or `--service-command`, can `--wait-child` for bounded proof, and records command/args/cwd, scheduler id, daemon selector, pid/exit/status, artifact ref, and private-state guard. `service-runbook`, `windows-service-install`/`service-install-plan`, `windows-service-status`, `windows-service-reconcile`, `windows-service-execution-readiness`, and `windows-service-start`/`stop` now record service lifecycle receipts through the same local Verse; the read-only status path has been proved against the real Windows `EventLog` service with receipt `daemon-service-lifecycle-receipt-windows-eventlog-proof-windows-service-status`, status `running`, exit code `0`, and `privateStateExposed=false`; the read-only service-policy reconciliation path has been proved for missing service, real-service drift against `EventLog`, lifecycle-brake refusal, and wrapper/local-Verse receipt `daemon-service-lifecycle-receipt-windows-eventlog-reconcile-proof-windows-service-reconcile`; execution readiness has been proved as a non-mutating `not-elevated` receipt through direct and wrapper paths; start/stop now produce non-mutating `start-planned`/`stop-planned` receipts unless `--execute-control`/`--execute-service-control` is passed, and wrapper `service-start-plan`/`service-stop-plan` proves those receipts against `EventLog`; explicit install/control execution now refuses as `execution-refused-not-elevated` with `executed=false` when the shell lacks Windows administrator authority, and wrapper `service-install-execute`, `service-start-execute`, and `service-stop-execute` prove those refusal receipts without mutation. Service lifecycle actions check the local Verse swarm brake before process launch, artifact writes, service-manager queries, service-policy reconciliation, execution-readiness checks, control planning, elevation-gated execution, or start/stop execution. The local wrapper builds/checks this binary. - - Use `notes/epiphany-repo-swarm-mvp-contract.md` as the authority correction and migration plan for repo-swarm autonomy. Autonomous branch-local work inside an Epiphany-owned repo Body is in scope and desired; the safety boundary is typed authority, branch containment, interruptibility, receipts, private-state sealing, and Bifrost-gated publication/merge/escalation, not asking a human before every local edit. Ten native repo-swarm front doors are live and documented there: `epiphany-repo init`, `epiphany-swarm online`, `epiphany-work accept`, `epiphany-work plan`, `epiphany-work run`, `epiphany-work adopt --from-plan`, `epiphany-work execute --from-plan`, `epiphany-work tick`, `epiphany-work publish`, and `epiphany-work sync`. Fresh-repo smokes proved the chain with `privateStateExposed=false`, including plan-backed branch-local commit creation, a Self-owned tick pulse that advances `run-from-plan -> adopt-from-plan -> execute-from-plan` then no-ops before Soul/Mind/Bifrost gates, local CultMesh swarm-brake refusal that writes `refused-by-swarm-brake` without creating a run/adopt/execute receipt, active-turn refusal through `work-tick-active-.json`, explicit completion-anchored cooldown refusal through `work-tick-last-.json`, stale active-turn recovery that records `physiology.recoveredActiveTurn.recovered=true`, and upstream-main ancestry proof after explicit merge receipt. Remaining MVP organs are daemonized scheduler cadence, 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. + - Use `notes/epiphany-repo-swarm-mvp-contract.md` as the authority correction and migration plan for repo-swarm autonomy. Autonomous branch-local work inside an Epiphany-owned repo Body is in scope and desired; the safety boundary is typed authority, branch containment, interruptibility, receipts, private-state sealing, and Bifrost-gated publication/merge/escalation, not asking a human before every local edit. Ten native repo-swarm front doors are live and documented there: `epiphany-repo init`, `epiphany-swarm online`, `epiphany-work accept`, `epiphany-work plan`, `epiphany-work run`, `epiphany-work adopt --from-plan`, `epiphany-work execute --from-plan`, `epiphany-work tick`, `epiphany-work publish`, and `epiphany-work sync`. Fresh-repo smokes proved the chain with `privateStateExposed=false`, including plan-backed branch-local commit creation, a Self-owned tick pulse that advances `run-from-plan -> adopt-from-plan -> execute-from-plan` then no-ops before Soul/Mind/Bifrost gates, local CultMesh swarm-brake refusal that writes `refused-by-swarm-brake` without creating a run/adopt/execute receipt, active-turn refusal through `work-tick-active-.json`, explicit completion-anchored cooldown refusal through `work-tick-last-.json`, stale active-turn recovery that records `physiology.recoveredActiveTurn.recovered=true`, Self-owned `epiphany-work serve` cadence that writes `work-scheduler-serve-.json`, bounded serve proof `advanced:run-from-plan -> refused-by-cooldown:none` without adoption, unbounded zero-interval refusal, and upstream-main ancestry proof after explicit merge receipt. Remaining MVP organs are 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 ten-front-door chain. Next wrap the brake/cooldown/active-turn-aware `epiphany-work tick` in daemonized cadence policy, then connect branch-local execution to Soul/Modeling/Mind closure and 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. + next_action: Continue repo-swarm MVP work from the documented ten-front-door chain. Next connect branch-local `epiphany-work execute` receipts to 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.