From bb1a1c550f1d76eb97b1b9eb0faf5bd0d41dcc89 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 6 May 2026 19:02:08 +0100 Subject: [PATCH] Add Perfect Machine rumination runner --- .gitignore | 1 + state/agent-heartbeats.msgpack | Bin 38197 -> 40188 bytes tools/epiphany_ruminate_until.ps1 | 81 ++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 tools/epiphany_ruminate_until.ps1 diff --git a/.gitignore b/.gitignore index f9bd5f15..eb8fa2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ apps/epiphany-gui/src-tauri/target/ .epiphany-dogfood/ .epiphany-heartbeats/ .epiphany-face/ +.epiphany-rumination/ state/agent-heartbeats.json state/*.msgpack.lock state/*.projection.json diff --git a/state/agent-heartbeats.msgpack b/state/agent-heartbeats.msgpack index 471de65d9f9977f95ab0a46ac9a6d07cf15bbcef..25a206b56444304f6762b855f5b066d79faecc5b 100644 GIT binary patch delta 1895 zcmcgtOK1~87&fsqRjeSGYD^D{krqi(*EE~7E3plVXb-KV;-d;O-AY(`;T5tX8O?~uNrh`=)+o0}CefrpI9w5*W~>$kU;Z*qY`K-90Cz&$@-{}HQWWw#Mj;^bc^qSL=AYnm^ZZ0!ROWz}HQkmX z2n#OgsC7@Bb9hkuz=WxAxq14phTF|kO_#12FDM-zE$MJuZ;@mSD-9{E#gY2DW-pLO zyAJ+>H%(61xIO~qO?KO)>E{?cUY{u4|2-Ym`v2qPIp~CO;-LFB>?(q9%?pdN;Vcmu z0(JK3hRo83k+==q8|=23iJj2iR0YeAu@Ifzk5jMiRkMo7%$R8@Kw&{0;^5XQvd(} delta 1084 zcmZWoTSyd97-rU`RSF`^)W&E^QK(hNaaU_)wXjUfTrWN7+J)2ZxI4K!GtSJKOG-p2 zJ*a8Fmr4_Z>LKkRj!{8mP=sL@ii(1)q=yV5=pmFSYP_6Xvtb^-?>parzW<*&=htn+ zjjM)^BtzHF>&dI)b4NIq%SvUfschE146BW0_1B4A0Y%|Otpv#x8d5agyDSjdMJWB&66SAkTy*))NmVdFZ+maT*D<9NKJ?3MM(E% zO%V)vHamtbR|v;>HXs<@S8t^JK^qK#H4p zi~8vs&-?hG@A9XL8JKLa!kA|bHV0oBK$)GDblTp=VMpVBDir;`mIk?+##2px)7(r8 zLAb8@PuMkC{S@y!bta1Zvx!azWwc~+9A+VQ0qyC^nn%Eb173DNpEKyB1g3kQg-P7m zcVSX+ZX!$q=NFMneTW>E<^5&??fseaey!h;y@8hn*^9(rx~SjOdOlV2N&$~oOGUD* PAVEdGCAWR{R&mb1<;8~C diff --git a/tools/epiphany_ruminate_until.ps1 b/tools/epiphany_ruminate_until.ps1 new file mode 100644 index 00000000..c0290e1a --- /dev/null +++ b/tools/epiphany_ruminate_until.ps1 @@ -0,0 +1,81 @@ +param( + [string]$Until = "19:00", + [string]$Root = (Resolve-Path ".").Path, + [int]$IntervalSeconds = 120 +) + +$ErrorActionPreference = "Continue" +Set-Location -LiteralPath $Root + +$now = Get-Date +$target = [datetime]::ParseExact($Until, "HH:mm", $null) +$target = Get-Date -Year $now.Year -Month $now.Month -Day $now.Day -Hour $target.Hour -Minute $target.Minute -Second 0 +if ($target -le $now) { + $target = $target.AddDays(1) +} + +$runId = "perfect-machine-" + $now.ToString("yyyyMMdd-HHmmss") +$artifactDir = Join-Path $Root ".epiphany-rumination\$runId" +New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null + +$logPath = Join-Path $artifactDir "rumination.log" +$statusPath = Join-Path $artifactDir "status.json" +$summaryPath = Join-Path $artifactDir "summary.md" + +$env:CARGO_TARGET_DIR = "C:\Users\Meta\.cargo-target-codex" + +function Write-Log([string]$Message) { + $line = "$(Get-Date -Format o) $Message" + Add-Content -LiteralPath $logPath -Value $line +} + +Write-Log "Starting Perfect Machine rumination until $($target.ToString("o"))." + +$cycles = 0 +$failures = 0 + +while ((Get-Date) -lt $target) { + $cycles += 1 + Write-Log "Cycle ${cycles}: heartbeat routine." + $cycleArtifactDir = Join-Path $artifactDir ("cycle-{0:D3}" -f $cycles) + New-Item -ItemType Directory -Force -Path $cycleArtifactDir | Out-Null + + & cargo run --manifest-path ".\epiphany-core\Cargo.toml" --bin epiphany-heartbeat-store -- routine --store ".\state\agent-heartbeats.msgpack" --artifact-dir $cycleArtifactDir --agent-store ".\state\agents.msgpack" --source "epiphany/perfect-machine-rumination" *> (Join-Path $cycleArtifactDir "routine.out") + if ($LASTEXITCODE -ne 0) { + $failures += 1 + Write-Log "Cycle ${cycles}: routine failed with exit code $LASTEXITCODE." + } else { + Write-Log "Cycle ${cycles}: routine completed." + } + + & cargo run --manifest-path ".\epiphany-core\Cargo.toml" --bin epiphany-heartbeat-store -- status --store ".\state\agent-heartbeats.msgpack" *> $statusPath + if ($LASTEXITCODE -ne 0) { + $failures += 1 + Write-Log "Cycle ${cycles}: status failed with exit code $LASTEXITCODE." + } + + $remaining = ($target - (Get-Date)).TotalSeconds + if ($remaining -le 0) { + break + } + Start-Sleep -Seconds ([Math]::Min($IntervalSeconds, [Math]::Max(1, [int]$remaining))) +} + +@" +# Perfect Machine Rumination + +- started: $($now.ToString("o")) +- finished: $((Get-Date).ToString("o")) +- target: $($target.ToString("o")) +- cycles: $cycles +- failures: $failures +- artifactDir: $artifactDir +- log: $logPath +- latestStatus: $statusPath + +This pass repeatedly ran the native heartbeat routine over `state/agent-heartbeats.msgpack`, +projecting memory resonance, thought lanes, appraisals, reactions, sleep, and dream +maintenance through the typed Rust/CultCache surface. +"@ | Set-Content -LiteralPath $summaryPath -Encoding UTF8 + +Write-Log "Completed Perfect Machine rumination with $cycles cycles and $failures failures."