diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 66b39046..2a65b1ba 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -134,7 +134,8 @@ struct DerivePlanArgs { item: Option, accept_receipt: Option, artifact_dir: Option, - target_path: String, + target_path: Option, + action_family: String, model_ref: Option, } @@ -467,7 +468,8 @@ fn parse_derive_plan_args(args: impl Iterator) -> Result) -> Result accept_receipt = Some(take_path(&mut args, "--accept-receipt")?), "--artifact-dir" => artifact_dir = Some(take_path(&mut args, "--artifact-dir")?), "--target-path" | "--changed-path" | "--path" => { - target_path = take_string(&mut args, "--target-path")?; + target_path = Some(take_string(&mut args, "--target-path")?); + } + "--action-family" | "--family" | "--mode" => { + action_family = take_string(&mut args, "--action-family")?; } "--model-ref" | "--imagination-ref" => { model_ref = Some(take_string(&mut args, "--model-ref")?); @@ -492,6 +497,7 @@ fn parse_derive_plan_args(args: impl Iterator) -> Result Result { .get("source") .and_then(Value::as_str) .unwrap_or("persona"); - let target_path = validate_plan_target_path(&args.target_path)?; let objective = format!( "Respond to {source} work item {item}: {}", compact_line(summary) ); - let plan_summary = format!( - "Imagination derived a safe append-only worklog update from accepted {} pressure.", - source - ); - let worklog_line = format!( - "- {} [{}]: {}", - Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true), - item, - compact_line(summary) - ); - let command = format!( - "Add-Content -LiteralPath {} -Value {}", - powershell_single_quoted(&target_path), - powershell_single_quoted(&worklog_line) - ); let mut evidence_refs = vec![format!("accept-receipt:{}", accept_receipt_path.display())]; if let Some(consensus_id) = string_from_json(&accept_receipt, &["feedback", "consensusReceiptId"]) { evidence_refs.push(format!("imagination-consensus:{consensus_id}")); } - if let Some(model_ref) = args.model_ref { + let model_ref = args.model_ref; + if let Some(model_ref) = model_ref.as_ref() { evidence_refs.push(format!("imagination-model:{model_ref}")); } else { - evidence_refs.push("imagination-derivation:deterministic-append-worklog.v0".to_string()); + evidence_refs.push(format!( + "imagination-derivation:deterministic-{}.v0", + normalize_action_family(&args.action_family)? + )); } + let derived_plan = derive_safe_plan_family(DeriveSafePlanInput { + action_family: &args.action_family, + target_path: args.target_path.as_deref(), + item: &item, + summary, + source, + accept_receipt: &accept_receipt, + model_ref: model_ref.as_deref(), + })?; write_plan_receipt( workspace, @@ -1441,40 +1444,163 @@ fn run_derive_plan(args: DerivePlanArgs) -> Result { artifact_dir, PlanReceiptInputs { objective, - plan_summary, - command, - changed_paths: vec![target_path], - commit_message: format!("Record repo work item {}", item), + plan_summary: derived_plan.plan_summary, + command: derived_plan.command, + changed_paths: vec![derived_plan.target_path.clone()], + commit_message: derived_plan.commit_message, adoption_evidence_refs: evidence_refs, - verification_asks: vec![ - "Soul verifies the worklog path changed and the appended line matches the accepted pressure.".to_string(), - ], + verification_asks: derived_plan.verification_asks, stop_conditions: vec![ - "Stop if the command exits nonzero or changes paths outside the derived plan.".to_string(), + "Stop if the command exits nonzero or changes paths outside the derived plan." + .to_string(), ], - rollback_hints: vec![ - "Remove the appended worklog line if the pressure was misinterpreted.".to_string(), - ], - derivation: Some(json!({ - "schemaVersion": "epiphany.repo_work_plan_derivation.v0", - "mode": "append-worklog", - "owner": "Imagination", - "router": "Self", - "inputPressure": { - "source": source, - "summary": summary, - "candidateActionRefs": accept_receipt["feedback"]["candidateActionRefs"], - "publicDiscussionRefs": accept_receipt["feedback"]["publicDiscussionRefs"], - }, - "operatorAuthoredShellDetails": false, - "modelAuthored": false, - "deterministicQuarantine": true, - "nextUpgrade": "replace this deterministic derivation with model-authored Imagination planning over the same receipt contract" - })), + rollback_hints: derived_plan.rollback_hints, + derivation: Some(derived_plan.derivation), }, ) } +struct DeriveSafePlanInput<'a> { + action_family: &'a str, + target_path: Option<&'a str>, + item: &'a str, + summary: &'a str, + source: &'a str, + accept_receipt: &'a Value, + model_ref: Option<&'a str>, +} + +struct DerivedSafePlan { + target_path: String, + plan_summary: String, + command: String, + commit_message: String, + verification_asks: Vec, + rollback_hints: Vec, + derivation: Value, +} + +fn derive_safe_plan_family(input: DeriveSafePlanInput<'_>) -> Result { + let action_family = normalize_action_family(input.action_family)?; + match action_family.as_str() { + "append-worklog" => derive_append_worklog_plan(input, &action_family), + "planning-note" => derive_planning_note_plan(input, &action_family), + other => Err(anyhow!( + "unsupported derive-plan action family {other:?}; supported families are append-worklog and planning-note" + )), + } +} + +fn derive_append_worklog_plan( + input: DeriveSafePlanInput<'_>, + action_family: &str, +) -> Result { + let target_path = + validate_plan_target_path(input.target_path.unwrap_or("EPIPHANY_WORKLOG.md"))?; + let worklog_line = format!( + "- {} [{}]: {}", + Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true), + input.item, + compact_line(input.summary) + ); + let command = format!( + "Add-Content -LiteralPath {} -Value {}", + powershell_single_quoted(&target_path), + powershell_single_quoted(&worklog_line) + ); + Ok(DerivedSafePlan { + target_path, + plan_summary: format!( + "Imagination derived a safe append-only worklog update from accepted {} pressure.", + input.source + ), + command, + commit_message: format!("Record repo work item {}", input.item), + verification_asks: vec![ + "Soul verifies the worklog path changed and the appended line matches the accepted pressure.".to_string(), + ], + rollback_hints: vec![ + "Remove the appended worklog line if the pressure was misinterpreted.".to_string(), + ], + derivation: plan_derivation_receipt(input, action_family, "repo.append_worklog"), + }) +} + +fn derive_planning_note_plan( + input: DeriveSafePlanInput<'_>, + action_family: &str, +) -> Result { + let default_target = format!("notes/epiphany-work/{}.md", sanitize(input.item)); + let target_path = validate_plan_target_path(input.target_path.unwrap_or(&default_target))?; + let candidate_refs = + string_array_from_json(input.accept_receipt, &["feedback", "candidateActionRefs"]); + let public_refs = + string_array_from_json(input.accept_receipt, &["feedback", "publicDiscussionRefs"]); + let lines = vec![ + format!("# Epiphany Work Note: {}", compact_line(input.item)), + String::new(), + format!("- Created: {}", Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true)), + format!("- Source: {}", compact_line(input.source)), + format!("- Summary: {}", compact_line(input.summary)), + format!("- Candidate action refs: {}", compact_join(&candidate_refs)), + format!("- Public discussion refs: {}", compact_join(&public_refs)), + String::new(), + "## Imagination Plan".to_string(), + String::new(), + "- Safe action family: planning-note".to_string(), + "- Intended consequence: preserve a concrete planning note for Self adoption and later Hands work.".to_string(), + "- Authority seal: this note is branch-local planning cargo, not publication, merge, or durable Mind admission.".to_string(), + String::new(), + ]; + let command = powershell_append_lines_command(&target_path, &lines); + Ok(DerivedSafePlan { + target_path, + plan_summary: format!( + "Imagination derived a contained markdown planning note from accepted {} pressure.", + input.source + ), + command, + commit_message: format!("Add planning note for repo work item {}", input.item), + verification_asks: vec![ + "Soul verifies the planning note path changed and contains the accepted pressure summary.".to_string(), + "Soul verifies no paths outside the declared planning note changed.".to_string(), + ], + rollback_hints: vec![ + "Remove the generated planning note if the accepted pressure was misinterpreted.".to_string(), + ], + derivation: plan_derivation_receipt(input, action_family, "repo.markdown_planning_note"), + }) +} + +fn plan_derivation_receipt(input: DeriveSafePlanInput<'_>, mode: &str, safe_family: &str) -> Value { + json!({ + "schemaVersion": "epiphany.repo_work_plan_derivation.v0", + "mode": mode, + "safeActionFamily": safe_family, + "owner": "Imagination", + "router": "Self", + "inputPressure": { + "source": input.source, + "summary": input.summary, + "candidateActionRefs": input.accept_receipt["feedback"]["candidateActionRefs"], + "publicDiscussionRefs": input.accept_receipt["feedback"]["publicDiscussionRefs"], + }, + "operatorAuthoredShellDetails": false, + "modelAuthored": false, + "modelRef": input.model_ref, + "deterministicQuarantine": true, + "authoritySeal": { + "branchLocalOnly": true, + "publicationAuthorized": false, + "mergeAuthorized": false, + "serviceLifecycleAuthority": false, + "crossRepoMutation": false, + "privateStateExposed": false + }, + "nextUpgrade": "replace deterministic safe families with model-authored Imagination planning over the same receipt contract" + }) +} + fn write_plan_receipt( workspace: PathBuf, accept_receipt_path: PathBuf, @@ -4094,6 +4220,14 @@ fn validate_plan_target_path(path: &str) -> Result { Ok(normalized) } +fn normalize_action_family(value: &str) -> Result { + let normalized = value.trim().to_ascii_lowercase().replace('_', "-"); + if normalized.is_empty() { + return Err(anyhow!("derive-plan action family cannot be empty")); + } + Ok(normalized) +} + fn compact_line(text: &str) -> String { let compact = text .split_whitespace() @@ -4110,10 +4244,37 @@ fn compact_line(text: &str) -> String { } } +fn compact_join(values: &[String]) -> String { + if values.is_empty() { + "none".to_string() + } else { + values + .iter() + .map(|value| compact_line(value)) + .collect::>() + .join(", ") + } +} + fn powershell_single_quoted(value: &str) -> String { format!("'{}'", value.replace('\'', "''")) } +fn powershell_append_lines_command(target_path: &str, lines: &[String]) -> String { + let mut commands = vec![ + format!("$p = {}", powershell_single_quoted(target_path)), + "$d = Split-Path -Parent $p".to_string(), + "if ($d) { New-Item -ItemType Directory -Force -Path $d | Out-Null }".to_string(), + ]; + commands.extend(lines.iter().map(|line| { + format!( + "Add-Content -LiteralPath $p -Value {}", + powershell_single_quoted(line) + ) + })); + commands.join("; ") +} + fn normalize_path_for_receipt(path: &Path) -> String { path.display().to_string().replace('\\', "/") } @@ -4373,7 +4534,7 @@ fn print_usage() { eprintln!( "usage: epiphany-work ...\n\ accept --workspace --from --item [--summary ] [--topic ] [--store ] [--runtime-id ] [--online-receipt ] [--public-discussion-ref ] [--candidate-action-ref ]\n\ - derive-plan --workspace [--item ] [--accept-receipt ] [--target-path EPIPHANY_WORKLOG.md] [--model-ref ]\n\ + derive-plan --workspace [--item ] [--accept-receipt ] [--action-family append-worklog|planning-note] [--target-path ] [--model-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\ diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 880e76cd..dab57070 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -246,11 +246,17 @@ commit message, verification asks, stop conditions, and rollback hints. objective, summary, shell command, paths, and commit message. `epiphany-work derive-plan` is the first Persona/Bifrost-to-plan automation: it consumes the accepted pressure summary, candidate action refs, and consensus receipt, then -derives a safe append-only `EPIPHANY_WORKLOG.md` plan with -`operatorAuthoredShellDetails=false`. Its receipt includes -`epiphany.repo_work_plan_derivation.v0`, mode `append-worklog`, and explicitly -marks the path as deterministic quarantine rather than final model-authored -Imagination. +derives safe allowlisted branch-local command plans with +`operatorAuthoredShellDetails=false`. The default family is `append-worklog`, +which appends to `EPIPHANY_WORKLOG.md`; `--action-family planning-note` creates +or appends a contained markdown planning note, defaulting to +`notes/epiphany-work/.md`. Its receipt includes +`epiphany.repo_work_plan_derivation.v0`, mode `append-worklog` or +`planning-note`, a `safeActionFamily`, and an authority seal forbidding +publication, merge, service lifecycle mutation, cross-repo mutation, and private +state exposure. These deterministic families are quarantine scaffolding on the +road to model-authored Imagination, but they are no longer operator-authored +shell details. This is still not Hands authority. It is the first non-operator-shell bridge between Imagination/Self planning and Hands execution: `adopt --from-plan @@ -289,6 +295,14 @@ executed into `branch-local-commit-recorded`, closed as `closed:passed`, and reported `privateStateExposed=false` across accept, plan, run, adopt, execute, and close. +The next derived-plan smoke proved the richer safe family: +`.epiphany-smoke\planning-note-20260620-015921` ran accept -> +`derive-plan --action-family planning-note` -> run -> adopt -> execute on a +fresh repo. The plan receipt carried mode `planning-note`, safe family +`repo.markdown_planning_note`, `operatorAuthoredShellDetails=false`, and +`privateStateExposed=false`; Hands created a branch-local commit containing +`notes/epiphany-work/planning-note.md` with the accepted pressure summary. + ### Landed Work Run Gate The sixth front door exists as native Rust: @@ -813,7 +827,7 @@ temptation wearing clean robes. | Repo Body birth | `epiphany-repo init` exists and writes repo-local stores plus branch workbench intent. | Keep birth startup-only, review-gated, and branch-oriented. | | Local Verse online | `epiphany-swarm online` seeds repo-local CultMesh, standing-faculty SoA, topology, liveness, Eve, and tool sight. | Keep private Verse sealed while exposing operator-safe repo status. | | Persona/Bifrost intake | `epiphany-work accept` records pressure and candidate action refs without Hands authority. | Add a repo Persona intake mouth so humans can talk to the project instead of hand-authoring CLI work items. | -| Imagination planning | `derive-plan` deterministically creates append-only worklog plans; `plan` remains manual quarantine scaffolding. | Replace operator-authored shell details with model-authored, typed Imagination action items for richer safe command families. | +| Imagination planning | `derive-plan` deterministically creates allowlisted `append-worklog` and `planning-note` plans; `plan` remains manual quarantine scaffolding. | Replace deterministic templates with model-authored, typed Imagination action items for richer safe command families. | | Self scheduling | `tick` and `serve` prove one-step branch-local advancement, brake refusal, active-turn refusal, cooldown, and stale-turn recovery; `queue-run` selects tick-actionable rows from the typed repo-work queue and delegates to `tick`. | Add optional Idunn-hosted lifecycle for the same queue-run surface without taking Idunn's authority. | | Branch-local Hands work | `adopt` and `execute` create approved Hands gates, run planned commands, stage declared paths, commit on `epiphany/*`, and write receipts. | Keep mutation branch-contained and receipt-backed; broaden only through typed plan families, not ad hoc shell freedom. | | Soul/Modeling/Mind closure | `close` verifies the Hands commit and writes deterministic Soul, Modeling, and Mind receipts. | Add richer model-authored closure where useful, while preserving deterministic local closure for simple mechanical work. | @@ -912,8 +926,9 @@ The chain is typed and sealed enough to be useful: - `epiphany-work accept` records Persona/Bifrost pressure without granting Hands, durable-state, publication, or merge authority. - `epiphany-work derive-plan` records the first deterministic - Persona/Bifrost-to-plan bridge: accepted pressure becomes a safe append-only - action plan with `operatorAuthoredShellDetails=false`. + Persona/Bifrost-to-plan bridge: accepted pressure becomes a safe allowlisted + action plan with `operatorAuthoredShellDetails=false`. Current families are + `append-worklog` and `planning-note`. - `epiphany-work plan` records a manual typed Imagination/Self action plan: objective, command, changed paths, commit message, verification asks, stop conditions, and rollback hints. It remains a compatibility reliquary until @@ -977,10 +992,10 @@ Required organs before MVP: Remaining work is optional handoff from branch-local execution into the close gate and any later Idunn service lifecycle integration under explicit operator authority. -- Persona-to-plan depth: deterministic append-worklog derivation exists for - accepted Persona/Bifrost pressure; remaining work is model-authored - Imagination planning for richer action classes without operator shell - details. +- Persona-to-plan depth: deterministic `append-worklog` and `planning-note` + derivations exist for accepted Persona/Bifrost pressure; remaining work is + model-authored Imagination planning for richer action classes without + operator shell details. - Closure depth: deterministic Soul/Modeling/Mind closure exists for Hands commits; richer model-authored Soul/Modeling review remains to replace the current local verification rite where appropriate. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 2522525b..8595b3fb 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -103,7 +103,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 fourteen-front-door chain from `epiphany-repo init` through `epiphany-work derive-plan`, `close`, `overview`, `tick`, `queue-run`, `publish`, and `sync`, documents the operator-safe proof receipts already proved with `privateStateExposed=false`, and names the remaining MVP organs: model-authored Persona-to-plan depth, optional Idunn-hosted queue-run lifecycle, optional execute-to-close handoff, richer published proof bundles, and richer model-authored closure. 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 closure or publication gates. `epiphany-work derive-plan` now consumes accepted Persona/Bifrost pressure and writes an Imagination/Self action plan in deterministic `append-worklog` quarantine mode with `operatorAuthoredShellDetails=false`; disposable smoke proved accept -> derive-plan -> run -> adopt -> execute -> close, changed only `EPIPHANY_WORKLOG.md`, ended `closed:passed`, and reported no private-state exposure. `epiphany-work overview` now reads the repo work receipt chain and writes an Eyes/Gjallar-owned sight/proof bundle with current gate, blocker, next safe action, branch, changed paths, commit SHA, Soul verdict, compact rows, and private-state seal; it also mirrors a typed `epiphany.cultmesh.repo_work_overview.v0` document into the repo-local Verse when a local Verse store is known. Disposable smokes proved pre-plan `awaiting-plan`/`plan-receipt-missing`, post-close `awaiting-publication`/`bifrost-publication-missing`, and latest-key CultMesh readback through `epiphany-verse-query smoke` as `latestRepoWorkOverview=repo-work-overview-verse-overview-request`, `latestRepoWorkGate=awaiting-publication`, `latestRepoWorkBlocker=bifrost-publication-missing`, with no private-state exposure. The tick pulse 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 queue-run` reads the repo-local typed overview queue, selects only tick-actionable rows for the current repo Body, delegates to `tick`, refreshes overview after real advancement, and is wrapped by `tools/epiphany_local_run.ps1 -Mode repo-work-queue-run`. `epiphany-work serve` wraps the item-scoped 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. `epiphany-work close` consumes branch-local execute receipts, verifies the Hands commit, writes Soul verdict plus Modeling summary plus Mind gateway/state-commit receipts, and seals `work-close-.json` without granting publication, merge, service lifecycle, cross-repo mutation, or private-state exposure. `epiphany-work publish --closure-receipt` can consume the closure's Soul/Mind ids, while tick no-ops once closure exists before Bifrost publication authority. +- `notes/epiphany-repo-swarm-mvp-contract.md` is the repo-swarm MVP authority map and migration plan. It states the live fourteen-front-door chain from `epiphany-repo init` through `epiphany-work derive-plan`, `close`, `overview`, `tick`, `queue-run`, `publish`, and `sync`, documents the operator-safe proof receipts already proved with `privateStateExposed=false`, and names the remaining MVP organs: model-authored Persona-to-plan depth, optional Idunn-hosted queue-run lifecycle, optional execute-to-close handoff, richer published proof bundles, and richer model-authored closure. 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 closure or publication gates. `epiphany-work derive-plan` now consumes accepted Persona/Bifrost pressure and writes Imagination/Self action plans through deterministic safe families: `append-worklog` appends to `EPIPHANY_WORKLOG.md`, and `planning-note` creates a contained markdown note under `notes/epiphany-work/.md`; both carry `operatorAuthoredShellDetails=false`, an authority seal, and no private-state exposure. Disposable smokes proved the append-worklog route through accept -> derive-plan -> run -> adopt -> execute -> close, changed only `EPIPHANY_WORKLOG.md`, ended `closed:passed`, and reported no private-state exposure; `.epiphany-smoke\planning-note-20260620-015921` proved the planning-note route through accept -> derive-plan -> run -> adopt -> execute, with mode `planning-note`, safe family `repo.markdown_planning_note`, a branch-local commit, and no private-state exposure. `epiphany-work overview` now reads the repo work receipt chain and writes an Eyes/Gjallar-owned sight/proof bundle with current gate, blocker, next safe action, branch, changed paths, commit SHA, Soul verdict, compact rows, and private-state seal; it also mirrors a typed `epiphany.cultmesh.repo_work_overview.v0` document into the repo-local Verse when a local Verse store is known. Disposable smokes proved pre-plan `awaiting-plan`/`plan-receipt-missing`, post-close `awaiting-publication`/`bifrost-publication-missing`, and latest-key CultMesh readback through `epiphany-verse-query smoke` as `latestRepoWorkOverview=repo-work-overview-verse-overview-request`, `latestRepoWorkGate=awaiting-publication`, `latestRepoWorkBlocker=bifrost-publication-missing`, with no private-state exposure. The tick pulse 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 queue-run` reads the repo-local typed overview queue, selects only tick-actionable rows for the current repo Body, delegates to `tick`, refreshes overview after real advancement, and is wrapped by `tools/epiphany_local_run.ps1 -Mode repo-work-queue-run`. `epiphany-work serve` wraps the item-scoped 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. `epiphany-work close` consumes branch-local execute receipts, verifies the Hands commit, writes Soul verdict plus Modeling summary plus Mind gateway/state-commit receipts, and seals `work-close-.json` without granting publication, merge, service lifecycle, cross-repo mutation, or private-state exposure. `epiphany-work publish --closure-receipt` can consume the closure's Soul/Mind ids, while tick no-ops once closure exists before Bifrost publication authority. - 2026-06-20: The same repo-swarm note now carries the explicit migration thesis, MVP status board, authority matrix, local CultMesh tool availability doctrine, and upstream-main sync doctrine. Use that note when answering "are we headed toward a functional swarm?" The answer is yes, but only if the remaining cuts preserve the typed organ ownership: Persona is the mouth, Imagination plans, Self schedules, Hands acts, Soul verifies, Modeling maps, Mind admits, Gjallar sees, Odin discovers, Idunn keeps daemon physiology alive, Bifrost publishes and credits, and Eve/CultUI renders without becoming truth. - 2026-06-20: Gjallar/swarm-overview now exposes repo-work overview history as first-class compact sight, Persona's public Eve surface lowers the same queue for peer-readable collaboration, and Self has a first runnable queue surface over it. `SwarmOverviewOutput` and `SwarmTriageOutput` include `repoWorkOverviewCount`, `repoWorkOverviewRows`, `repoWorkOverviewTuiRows`, `latestRepoWorkOverview`, `latestRepoWorkGate`, `latestRepoWorkBlocker`, and `latestRepoWorkNextSafeMove`; the shared `swarmActionRows` queue gets priority 35 `repo-work-overview` rows owned by Gjallar, hosted body `repo-work`, authority gate `repo.work.overview`, effect class `repo-work-readback`, no mutation, no elevation, proof-bundle ref, and private-state seal. `eve-surfaces`, direct `connect-eve`, and the globally invokable Persona `eve-connect` daemon tool readback expose public `REPO-WORK-PEER` rows with item, gate, blocker, next safe move, branch, publication, sync, and `private=false`. `epiphany-work queue-run` reads the same typed queue, selects current-repo rows at `ready-to-run`, `ready-to-adopt`, or `ready-to-execute`, delegates to `tick`, refreshes overview after real advancement, and wrapper `repo-work-queue-run` exposes the operator surface. Disposable proofs `.epiphany-smoke\gjallar-repo-work-queue-20260620-012027`, `.epiphany-smoke\eve-repo-work-queue-20260620-013322`, `.epiphany-smoke\queue-run-20260620-014314`, and wrapper artifact `local-20260620-014627-174-aada0241` prove two-item queue sight, Eve lowering, direct queue-run advancement, and wrapper dry-run without publication, merge, service lifecycle mutation, elevation, cross-repo mutation, or private-state exposure. The next cut is richer Persona-to-Imagination plan derivation, not another queue display surface. - `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. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index e3c58e8e..2cd4c13a 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 9d394032..c10ec849 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. Fourteen native repo-swarm front doors are live and documented there: `epiphany-repo init`, `epiphany-swarm online`, `epiphany-work accept`, `epiphany-work derive-plan`, `epiphany-work plan`, `epiphany-work run`, `epiphany-work adopt --from-plan`, `epiphany-work execute --from-plan`, `epiphany-work close`, `epiphany-work overview`, `epiphany-work tick`, `epiphany-work queue-run`, `epiphany-work publish`, and `epiphany-work sync`. Fresh-repo smokes proved the chain with `privateStateExposed=false`, including deterministic Persona/Bifrost pressure-to-plan derivation (`append-worklog`, `operatorAuthoredShellDetails=false`) into `EPIPHANY_WORKLOG.md`, 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 closure/publication 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, deterministic `epiphany-work close` proof that consumes execute receipts, verifies the Hands commit, writes Soul verdict plus Modeling summary plus Mind gateway/state-commit receipts, local `epiphany-work overview` proof bundle that reports pre-plan `awaiting-plan`/`plan-receipt-missing` and post-close `awaiting-publication`/`bifrost-publication-missing` with branch, commit, changed paths, Soul verdict, compact rows, and private seal, typed local Verse projection as `epiphany.cultmesh.repo_work_overview.v0` with latest-key/event-history readback through Gjallar plus peer-readable Persona Eve lowering, `epiphany-work queue-run` selection over tick-actionable queue rows with wrapper `repo-work-queue-run`, `publish --closure-receipt` consumption of the close receipt's Soul/Mind refs, post-publication tick `noop:none`, and upstream-main ancestry proof after explicit merge receipt. Remaining MVP organs are model-authored Persona-to-plan depth for richer actions, optional Idunn-hosted queue-run lifecycle, optional execute-to-close scheduler handoff, richer published proof bundles, and richer model-authored closure; 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. Fourteen native repo-swarm front doors are live and documented there: `epiphany-repo init`, `epiphany-swarm online`, `epiphany-work accept`, `epiphany-work derive-plan`, `epiphany-work plan`, `epiphany-work run`, `epiphany-work adopt --from-plan`, `epiphany-work execute --from-plan`, `epiphany-work close`, `epiphany-work overview`, `epiphany-work tick`, `epiphany-work queue-run`, `epiphany-work publish`, and `epiphany-work sync`. Fresh-repo smokes proved the chain with `privateStateExposed=false`, including deterministic Persona/Bifrost pressure-to-plan derivation (`append-worklog` and `planning-note`, `operatorAuthoredShellDetails=false`) into `EPIPHANY_WORKLOG.md` or contained markdown planning notes, 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 closure/publication 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, deterministic `epiphany-work close` proof that consumes execute receipts, verifies the Hands commit, writes Soul verdict plus Modeling summary plus Mind gateway/state-commit receipts, local `epiphany-work overview` proof bundle that reports pre-plan `awaiting-plan`/`plan-receipt-missing` and post-close `awaiting-publication`/`bifrost-publication-missing` with branch, commit, changed paths, Soul verdict, compact rows, and private seal, typed local Verse projection as `epiphany.cultmesh.repo_work_overview.v0` with latest-key/event-history readback through Gjallar plus peer-readable Persona Eve lowering, `epiphany-work queue-run` selection over tick-actionable queue rows with wrapper `repo-work-queue-run`, `publish --closure-receipt` consumption of the close receipt's Soul/Mind refs, post-publication tick `noop:none`, and upstream-main ancestry proof after explicit merge receipt. Remaining MVP organs are model-authored Persona-to-plan depth beyond deterministic safe templates, optional Idunn-hosted queue-run lifecycle, optional execute-to-close scheduler handoff, richer published proof bundles, and richer model-authored closure; 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. - Gjallar/swarm-overview now projects typed repo-work overview history into the compact global sight report, Persona's public Eve surface lowers the same queue for peers, and Self has a first runnable queue surface over it. `epiphany-verse-query gjallar` reads all `epiphany.cultmesh.repo_work_overview.v0` event documents from local Verse, excludes the `latest` mirror, preserves latest scalar fields, emits multi-item `repoWorkOverviewRows`/TUI rows, and publishes bounded priority 35-39 non-mutating `repo-work-overview` action rows with `owner=Gjallar`, `hostedBody=repo-work`, `authorityGate=repo.work.overview`, `mutatesState=false`, `requiresElevatedAuthority=false`, proof-bundle refs, current gate/blocker/next-safe-move, and `privateStateExposed=false`. `epiphany-verse-query eve-surfaces`, `connect-eve`, and globally invokable Persona `eve-connect` tool readbacks expose compact `REPO-WORK-PEER` rows with item, gate, blocker, next safe move, branch, publication/sync state, and private seal for the public Persona surface only. `epiphany-work queue-run` selects current-repo rows at `ready-to-run`, `ready-to-adopt`, or `ready-to-execute`, delegates action to `tick`, refreshes overview after real advancement, and writes `epiphany.repo_work_queue_run_receipt.v0`; wrapper mode `tools/epiphany_local_run.ps1 -Mode repo-work-queue-run` exposes the same surface. Disposable proofs `.epiphany-smoke\gjallar-repo-work-queue-20260620-012027`, `.epiphany-smoke\eve-repo-work-queue-20260620-013322`, `.epiphany-smoke\queue-run-20260620-014314`, and wrapper artifact `local-20260620-014627-174-aada0241` showed two-item queues through sight, public Eve, direct queue-run, and wrapper dry-run without publication, merge, service lifecycle mutation, elevation, cross-repo mutation, or private-state exposure. - 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. @@ -634,4 +634,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 fourteen-front-door chain. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, and Self-owned `epiphany-work queue-run` over tick-actionable rows are live over `epiphany.cultmesh.repo_work_overview.v0`; next deepen Persona-to-Imagination plan derivation for richer safe action classes without opening raw worker thought, then decide whether queue-run needs Idunn-hosted lifecycle. 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 fourteen-front-door chain. Typed Gjallar repo-work history/queue sight, peer-readable Persona Eve lowering, Self-owned `epiphany-work queue-run`, and deterministic `derive-plan` families `append-worklog` plus `planning-note` are live with `privateStateExposed=false`; next cut should move Persona-to-Imagination planning toward model-authored typed action items over allowlisted safe families, or decide whether queue-run needs Idunn-hosted lifecycle. Preserve Idunn service lifecycle surfaces and existing CultMesh/Odin/Eve tool directories; service install/start execution still requires explicit elevated operator authority.