Add repo work scheduler physiology

This commit is contained in:
Meta Vens 2026-06-20 00:04:40 +01:00
commit af9f0bd6a3
5 changed files with 313 additions and 23 deletions

View file

@ -456,6 +456,24 @@ swarm brake is engaged, `tick` writes the same scheduler receipt family with
new run/adopt/execute receipt. A brake is a machine stop, not a suggestion
written in nice ink.
The pulse now also owns its first scheduler physiology markers:
- `.epiphany/work/work-tick-active-<item>.json` is written before the pulse
attempts a branch-local action and cleared only after the final tick receipt
is written. If a later pulse sees a live marker, it writes
`status=refused-active-turn`, action `none`, and creates no new
run/adopt/execute receipt.
- `.epiphany/work/work-tick-last-<item>.json` stores the last completed tick
receipt. When `--cooldown-seconds <n>` is supplied, a later pulse refuses as
`status=refused-by-cooldown` until that completion-anchored interval elapses.
Cooldown begins after completion, not at launch.
- `--active-timeout-seconds <n>` lets a stale active marker recover. A stale
marker is removed, the next safe branch-local step may proceed, and the final
tick receipt records `physiology.recoveredActiveTurn.recovered=true`.
These markers are scheduler receipts, not hidden daemon memory. They carry the
same authority seal 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.
@ -483,6 +501,17 @@ Verse before the first pulse. `epiphany-work tick` returned
the brake allowed the next pulse to advance `run-from-plan`, and the refusal
receipt reported `privateStateExposed=false`.
A third smoke proved scheduler physiology on a disposable fresh repo Body. A
synthetic active marker made `epiphany-work tick --cooldown-seconds 60` return
`refused-active-turn:none`. After clearing the marker, the next pulse advanced
`advanced:run-from-plan`, wrote `work-run-<item>.json`, cleared the active
marker, and wrote `work-tick-last-<item>.json`. An immediate third pulse with
the same cooldown returned `refused-by-cooldown:none` and did not create an
adoption receipt. A final stale-marker proof with
`--active-timeout-seconds 1` recovered the marker, advanced
`advanced:adopt-from-plan`, and recorded `recoveredActiveTurn=true`. All
summaries reported `privateStateExposed=false`.
## Migration Implication
The next migration plan must treat autonomous branch-local work as a required
@ -499,9 +528,11 @@ 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`, `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
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
conversation into autonomous action without the operator feeding plan details by
hand.
@ -554,8 +585,10 @@ The chain is typed and sealed enough to be useful:
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.
safe branch-local step across plan-backed `run`, `adopt`, or `execute`,
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.
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
@ -569,10 +602,10 @@ physiology while preserving the same authority receipts.
Required organs before MVP:
- 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.
- 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.
- 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.

View file

@ -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/cooldown/active-turn 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. 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.
- `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`.
- `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.