diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 1252144..f433d4f 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -36,6 +36,8 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou - The local scheduled task `Void Mood Drift` has been reinstalled/enabled against the typed runner and manually started once with Last Result `0`. `Void Moderator Rumination` is re-enabled after parent-owned speech closure and one observed live scheduled pass with Last Result `0`. - `npm run moderation:rumination:fixture` proves the non-skip typed rumination branch without spending a live model call: it seeds a temporary `.cc`, routes the runner through a fake Codex child, and verifies short-term memory, incubation, agency pressure, and candidate intervention proposals are parent-applied typed operations with no exact timestamp leakage in the prompt-facing context. - `npm run moderation:rumination:speech-fixture` proves queued speech has a parent-owned action loop: fake Codex queues one candidate with a delivery target, fake Discord send writes a receipt, and the parent runner marks the candidate spoken through typed state. The child prompt now forbids direct send-script calls. +- The first live sleep-maintenance gate passed on real state. A manual typed nap ran `scripts/run-void-memory-maintenance.ps1`, consumed the scheduled rumination short-term memory with one `apply_memory_distillation` operation, and left `thoughtMemory.shortTerm` empty while preserving the durable identity seam with target, claim, tension, action implication, and anchors. +- `npm run moderation:rumination:nap-skip-fixture` proves awake rumination does not keep making fresh short-term residue during sleep: when the typed sleep cycle is napping and there are no new room messages or open cases, the runner writes `[]` and exits before invoking Codex. - The old memory-organ script family, legacy moderation-state template, and legacy moderation context exporter have been deleted. Do not revive their cleanup, agency, dream, vector-incubation, or mirror-repair behavior as compatibility scaffolding. - `scripts/run-void-memory-maintenance.ps1` is the first replacement memory-maintenance organ. It builds a bounded context from typed memories/incubation/candidates/runtime, loads `prompts/void-memory-maintenance.md`, and applies only allowed memory/incubation/candidate typed operation proposals through `scripts/void-self-state.mjs`. In sleep mode, memory pressure sets `sleepDirective.forceDistillation`; a real model pass returning no operations under pressure fails visibly. - Rumination does not write durable memory. It can only emit `record_short_term_memory`; sleep maintenance must promote short-term records with `apply_memory_distillation`, merge them into incubation and prune them, or prune them outright. A real sleep pass that leaves short-term records behind fails. @@ -99,7 +101,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou ## Likely Next Bounded Move - Stop feature work on moderation, mood, agency, and public-lane behavior until the private-state boundary is rebuilt. -- First bounded move after the current commit: observe the next sleep maintenance pass and verify the scheduled rumination short-term memory is promoted, merged, or pruned instead of lingering as stale residue. +- First bounded move after the current commit: let the enabled loop run under ordinary scheduling, then inspect the next unattended awake rumination and sleep cycle for duplicate speech, stale short-term residue, or ungrounded memory writes before calling the system broadly stable. - Next cuts should delete unstable foundations early: do not revive `legacyJsonPath`, working projections, top-level mirror fields, or cleanup code that only compensated for those broken boundaries. - Rebuild sleep/distillation before trusting it again. Fixture check: a memory like `AquariumSynthCSharp: Workflow cannot own the body` must survive sleep with its concrete subject, claim, anchor, tension, and implication intact. - Do not build adapters around the JSON projection. That is how the heap learned to stand upright and ask for snacks. diff --git a/notes/voidbot-current-system-map.md b/notes/voidbot-current-system-map.md index 47f6809..ef27be1 100644 --- a/notes/voidbot-current-system-map.md +++ b/notes/voidbot-current-system-map.md @@ -132,12 +132,18 @@ This note is the source-grounded description of how the live VoidBot stack is sh - rumination fixture. It seeds an isolated CultCache `.cc` state, routes the non-skip rumination runner through a fake Codex child, and verifies short-term memory, incubation, agency pressure, and candidate intervention proposals are applied by the parent runner while the prompt-facing context keeps exact timestamps out. - `scripts/smoke-void-rumination-speech-fixture.ps1` - parent-owned speech fixture. It queues one deliverable candidate through fake Codex, routes delivery through a fake Discord sender, then verifies the parent runner writes a delivery receipt and marks the candidate spoken through typed state. +- `scripts/smoke-void-rumination-nap-skip-fixture.ps1` + - nap-skip fixture. It seeds a napping typed state with no room debt, points `CODEX_EXECUTABLE` at a bogus command, then verifies the runner exits with `napping_without_room_debt` and writes no operation proposals before invoking the model. - `scripts/install-moderation-rumination-task.ps1` - installs the local 15-minute scheduled task that runs the moderation/participation loop through the hidden PowerShell launcher shim. - Scheduled task `Void Mood Drift` - enabled typed mood/sleep runner. It invokes `scripts/run-void-mood-drift.ps1`, which calls `scripts/simulate-void-mood.mjs`; when the typed sleep cycle is napping, that path invokes memory maintenance once per nap. - Scheduled task `Void Moderator Rumination` - - enabled after parent-owned speech closure and one observed live scheduled pass with Last Result `0`. Its script is typed-only and has model-branch plus parent-owned speech fixtures; the next stability gate is sleep consuming the short-term memory it produced. + - enabled after parent-owned speech closure and one observed live scheduled pass with Last Result `0`. Its script is typed-only and has model-branch plus parent-owned speech fixtures. +- Live sleep maintenance + - passed once on real state after a manual typed nap. The maintenance runner consumed the scheduled rumination short-term memory with one `apply_memory_distillation` operation, leaving short-term memory empty and preserving one durable identity seam with target, claim, tension, action implication, and anchors. +- Sleep brake + - scheduled rumination skips during naps when there are no new room messages and no open cases, so sleep can distill the short-term surface without awake rumination immediately adding fresh residue. - `scripts/simulate-void-mood.mjs` - typed mood maintenance script that updates scheduled-runtime sleep cycle and speaking pressure in `.voidbot/private/void-self-state.cc`. It owns the sleep transition and invokes typed memory maintenance once per nap unless that nap already completed a maintenance pass. Speaking pressure now derives from queued candidates, incubation, and active typed agency pressure. The old personality-vector drift, memory organ, incubation, dream residue, cleanup, and legacy mirror behavior are offline pending typed replacements. - `scripts/run-void-mood-drift.ps1` diff --git a/notes/voidbot-implementation-plan.md b/notes/voidbot-implementation-plan.md index 8ef0d23..a00b562 100644 --- a/notes/voidbot-implementation-plan.md +++ b/notes/voidbot-implementation-plan.md @@ -286,7 +286,9 @@ Verdict: stop feature work and rebuild this foundation. The rest of the machine - Landed controlled live rumination review: the first real-model `-NoPost` pass produced valid but self-orbiting readiness-test residue, which was pruned/retired and folded into a prompt guard; the second real-model `-NoPost` pass sampled non-VoidBot repo pressure, used retrieval, and correctly wrote `[]` when nothing earned persistence. - Landed parent-owned speech closure: candidate interventions can include `deliveryTarget`, the prompt forbids child-side send scripts, the parent runner delivers at most one newly queued deliverable candidate per pass, records the receipt, and marks the candidate spoken with `mark_candidate_intervention_spoken`. `npm run moderation:rumination:speech-fixture` proves the loop with fake Codex and fake Discord send helpers. - Landed scheduled rumination re-enable: one observed live scheduled pass completed with Last Result `0`, proposed one anchored short-term memory, delivered no speech, and kept exact timestamps out of the prompt-facing context. -- Remaining work: observe the next sleep maintenance pass and verify that scheduled rumination residue is promoted, merged, or pruned instead of lingering. +- Landed live sleep-maintenance verification: a manual typed nap ran real memory maintenance on live state, promoted the scheduled rumination short-term memory into one durable `identity_seam`, and left `thoughtMemory.shortTerm` empty. +- Landed sleep brake: scheduled rumination now skips before model invocation during naps when there are no new room messages or open cases. `npm run moderation:rumination:nap-skip-fixture` proves the model path is not touched and no operation proposals are written. +- Remaining work: let ordinary scheduling run and inspect the next unattended awake rumination and sleep cycle for duplicate speech, stale short-term residue, or ungrounded memory writes before calling the system broadly stable. ### Commit 10: Resume Product Hardening diff --git a/package.json b/package.json index 7818045..eeb2329 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "moderation:agency-pressure:fixture": "powershell -ExecutionPolicy Bypass -File scripts/smoke-void-agency-pressure-fixture.ps1", "moderation:rumination:fixture": "powershell -ExecutionPolicy Bypass -File scripts/smoke-void-rumination-fixture.ps1", "moderation:rumination:speech-fixture": "powershell -ExecutionPolicy Bypass -File scripts/smoke-void-rumination-speech-fixture.ps1", + "moderation:rumination:nap-skip-fixture": "powershell -ExecutionPolicy Bypass -File scripts/smoke-void-rumination-nap-skip-fixture.ps1", "moderation:mood-drift": "node scripts/simulate-void-mood.mjs", "rag:scrub-bot-prompts": "tsx scripts/scrub-bot-prompts-from-history.ts", "rag:index-sources": "tsx scripts/index-source-repos.ts", diff --git a/scripts/run-void-moderator-rumination.ps1 b/scripts/run-void-moderator-rumination.ps1 index 337daec..8398950 100644 --- a/scripts/run-void-moderator-rumination.ps1 +++ b/scripts/run-void-moderator-rumination.ps1 @@ -295,6 +295,13 @@ function Convert-ToOperationArray { return @($Value) } +function Test-OpenCaseRequiresRumination { + param($Case) + + $status = Get-ObjectPropertyString -Value $Case -Name "status" + return $null -ne $status -and -not @("answered", "resolved", "closed", "retired", "dropped").Contains($status) +} + function Assert-AllowedRuminationOperation { param($Operation) @@ -602,6 +609,35 @@ Write-JsonFile -Path $contextPath -Data @{ repoActivity = Select-RuminationRepoActivity -RepoActivity $repoActivity -Now $startedAtUtc } +$isNapping = [bool](Get-ObjectPropertyValue -Value $typedState.scheduledRuntime.sleepCycle -Name "isNapping") +$openCaseCount = @( + @(Convert-ToValueArray -Value $typedState.moderationCursor.openCases) | + Where-Object { Test-OpenCaseRequiresRumination -Case $_ } +).Count +if ($isNapping -and $messageCount -eq 0 -and $openCaseCount -eq 0) { + Append-RunLog "napping: no new room messages or open cases; skipping awake rumination." + Write-JsonFile -Path $operationOutputPath -Data @() + $finishedAtUtc = [DateTime]::UtcNow + Write-JsonFile -Path $statusPath -Data @{ + status = "skipped" + reason = "napping_without_room_debt" + startedAt = $startedAtUtc.ToString("o") + finishedAt = $finishedAtUtc.ToString("o") + durationSeconds = [Math]::Round(($finishedAtUtc - $startedAtUtc).TotalSeconds, 2) + noPost = [bool]$NoPost + skipModel = [bool]$SkipModel + stateFile = [string]$stateFilePath + contextPath = [string]$contextPath + operationOutputPath = [string]$operationOutputPath + observedMessageCount = [int]$messageCount + openCaseCount = [int]$openCaseCount + tracePath = [string]$tracePath + lastMessagePath = [string]$lastMessagePath + } + Remove-Item -Path $lockPath -Force -ErrorAction SilentlyContinue + return +} + $stateWriteBefore = if (Test-Path $stateFilePath) { (Get-Item $stateFilePath).LastWriteTimeUtc } else { [DateTime]::MinValue } $prompt = Read-TextFile -Path $promptTemplatePath diff --git a/scripts/smoke-void-rumination-nap-skip-fixture.ps1 b/scripts/smoke-void-rumination-nap-skip-fixture.ps1 new file mode 100644 index 0000000..0aa733b --- /dev/null +++ b/scripts/smoke-void-rumination-nap-skip-fixture.ps1 @@ -0,0 +1,75 @@ +Set-StrictMode -Version Latest +$ErrorActionPreference = "Stop" +$ProgressPreference = "SilentlyContinue" + +$repoRoot = Split-Path -Parent $PSScriptRoot +Set-Location -LiteralPath $repoRoot + +$tempRoot = Join-Path $env:TEMP ("void-rumination-nap-skip-fixture-" + [guid]::NewGuid().ToString("n")) +$stateFilePath = Join-Path $tempRoot "void-self-state.cc" +$cursorOperationPath = Join-Path $tempRoot "cursor.json" +$sleepOperationPath = Join-Path $tempRoot "sleep-cycle.json" +$fixtureStatusDir = Join-Path $tempRoot "status" +$fixtureLogDir = Join-Path $tempRoot "logs" +$statusPath = Join-Path $fixtureStatusDir "moderation-rumination.json" +$operationOutputPath = Join-Path $fixtureStatusDir "moderation-rumination-operations.json" + +New-Item -ItemType Directory -Force -Path $tempRoot | Out-Null + +try { + $cursorOperation = @{ + operation = "record_reviewed_messages" + lastReviewedMessageId = "fixture-future-cursor" + lastReviewedTimestamp = "2099-05-17T00:00:00.000Z" + } + $sleepOperation = @{ + operation = "update_sleep_cycle" + sleepCycle = @{ + isNapping = $true + currentNapStartedAt = "2026-05-17T03:00:00.000Z" + currentNapEndsAt = "2099-05-17T04:00:00.000Z" + nextNapStartsAt = "2099-05-17T07:00:00.000Z" + activeDreamThemes = @("fixture-nap-skip") + } + } + + $cursorOperation | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $cursorOperationPath -Encoding UTF8 + $sleepOperation | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $sleepOperationPath -Encoding UTF8 + node .\scripts\void-self-state.mjs apply-operation --canonical $stateFilePath --operation-file $cursorOperationPath | Out-Null + node .\scripts\void-self-state.mjs apply-operation --canonical $stateFilePath --operation-file $sleepOperationPath | Out-Null + + $previousCodexExecutable = $env:CODEX_EXECUTABLE + $previousStatusDir = $env:VOID_RUMINATION_STATUS_DIR + $previousLogDir = $env:VOID_RUMINATION_LOG_DIR + + try { + $env:CODEX_EXECUTABLE = "this-command-should-not-run-during-nap-skip" + $env:VOID_RUMINATION_STATUS_DIR = $fixtureStatusDir + $env:VOID_RUMINATION_LOG_DIR = $fixtureLogDir + + powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\run-void-moderator-rumination.ps1 -StateFilePath $stateFilePath | Out-Null + } finally { + $env:CODEX_EXECUTABLE = $previousCodexExecutable + $env:VOID_RUMINATION_STATUS_DIR = $previousStatusDir + $env:VOID_RUMINATION_LOG_DIR = $previousLogDir + } + + $status = Get-Content -LiteralPath $statusPath -Raw -Encoding UTF8 | ConvertFrom-Json + if ($status.status -ne "skipped" -or $status.reason -ne "napping_without_room_debt") { + throw "Nap skip fixture expected skipped/napping_without_room_debt." + } + + $operations = Get-Content -LiteralPath $operationOutputPath -Raw -Encoding UTF8 | ConvertFrom-Json + if (@($operations).Count -ne 0) { + throw "Nap skip fixture expected no operation proposals." + } + + @{ + status = "ok" + runnerStatus = $status.status + reason = $status.reason + proposedOperationCount = @($operations).Count + } | ConvertTo-Json -Compress +} finally { + Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue +} diff --git a/state/evidence.jsonl b/state/evidence.jsonl index b55cb48..10ed4c5 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -119,3 +119,5 @@ {"ts":"2026-05-17T12:42:40Z","type":"verification","status":"ok","note":"Typed rumination now has a model-branch fixture. The fixture seeds an isolated CultCache .cc state, runs scripts/run-void-moderator-rumination.ps1 through the non-SkipModel path with a fake Codex child, and verifies parent-applied short-term memory, incubation, agency-pressure, and candidate-intervention operations while rejecting exact timestamp leakage in the prompt-facing context. The scheduled rumination task remains disabled until a controlled real-model -NoPost pass proves operation quality."} {"ts":"2026-05-17T12:55:54Z","type":"implementation","status":"ok","note":"Controlled typed rumination hardening passed the real judgment gate and closed the speech authority gap. The first real-model -NoPost pass produced valid but self-orbiting readiness-test residue, which was pruned/retired and converted into a prompt guard; the second real-model -NoPost pass sampled non-VoidBot repo pressure, used retrieval, and wrote [] when nothing earned persistence. Candidate interventions can now carry deliveryTarget, the child prompt forbids send-script calls, and the parent runner owns delivery, receipt recording, and mark_candidate_intervention_spoken. moderation:rumination:speech-fixture verifies that action loop with fake Codex and fake Discord send helpers."} {"ts":"2026-05-17T13:01:18Z","type":"verification","status":"ok","note":"Re-enabled the typed Void Moderator Rumination scheduled task and observed one live scheduled pass. Task Scheduler returned LastTaskResult 0; the run completed with noPost=false, proposed/applied one record_short_term_memory operation, delivered no candidate speech, and leaked no exact timestamps into the prompt-facing context. The memory was anchored to Discord room context and gamecult-site source context, not runner plumbing. Next gate is sleep maintenance consuming that short-term residue."} +{"ts":"2026-05-17T13:24:32Z","type":"verification","status":"ok","note":"Live sleep maintenance consumed the first scheduled-rumination short-term memory on real state. After a manual typed nap, scripts/run-void-memory-maintenance.ps1 ran the real model path, returned one apply_memory_distillation operation, promoted the public-identity machine-anchor thought into a durable identity_seam, and left thoughtMemory.shortTerm empty while preserving target, claim, tension, action implication, and three anchors. Moderation and mood scheduled tasks were re-enabled afterward."} +{"ts":"2026-05-17T13:32:25Z","type":"implementation","status":"ok","note":"Closed the nap contamination loop. An unattended rumination pass during the manual nap created a fresh short-term memory immediately after sleep maintenance had cleaned the surface, so run-void-moderator-rumination.ps1 now skips before model invocation when typed sleepCycle.isNapping is true and there are no new room messages or open cases. The pre-brake residue was consumed by a second real sleep-maintenance pass into a durable project_seam, leaving shortTerm empty. moderation:rumination:nap-skip-fixture verifies the napping/no-room-debt path writes [] without touching Codex."} diff --git a/state/map.yaml b/state/map.yaml index 66a3fae..c654344 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -57,7 +57,7 @@ data_flow: active_subgoals: - Make the new project-state surfaces the default continuity path for nontrivial VoidBot work. - Rebuild the moderation/self-state foundation so canonical CultCache `.cc` documents are mutated only through typed operations, never through an editable JSON working projection. - - Keep the typed moderation scheduled task enabled after the first observed live scheduled pass completed cleanly; inspect the next sleep maintenance pass to confirm the new short-term memory is promoted, merged, or pruned instead of lingering. + - Keep the typed moderation and mood scheduled tasks enabled after the first observed live rumination pass and a manual live sleep-maintenance pass both completed cleanly; the next work is ordinary hardening, not keeping legacy scaffolding alive. - Keep legacy moderation mirrors, whole-state projection commits, and deleted memory-organ compensators from re-entering the active path before adding more moderation, mood, agency, or public-lane behavior. - Keep public-lane limits, moderation, and provider behavior constrained enough that one 4060 Ti box does not get flayed for sport. - Preserve boring observability and startup discipline around Postgres, Qdrant, Ollama, Docker, backups, scheduled tasks, watchdogs, and any private local fire-signal extensions. @@ -142,6 +142,8 @@ landed_baseline: - The local `Void Mood Drift` scheduled task is reinstalled/enabled against the typed runner and has completed one manual scheduled-task start with Last Result 0. `Void Moderator Rumination` is re-enabled after parent-owned speech closure and one observed live scheduled pass with Last Result 0. - The typed rumination path now has a model-branch fixture: `npm run moderation:rumination:fixture` seeds a temporary `.cc`, routes the non-skip Codex branch through a fake child, and verifies short-term memory, incubation, agency-pressure, and candidate-intervention proposals cross only through parent-applied typed operations without leaking exact timestamps into the prompt-facing context. - The typed rumination speech path is parent-owned now. Candidate interventions can carry an optional delivery target; the child may queue candidates but must not call Discord send scripts. The parent runner delivers at most one newly queued deliverable candidate per pass, records a delivery receipt, and marks the candidate spoken through `mark_candidate_intervention_spoken`. `npm run moderation:rumination:speech-fixture` verifies this loop with fake Codex and fake Discord send helpers. + - The live sleep-maintenance gate has passed once on real state. A manual typed nap triggered `scripts/run-void-memory-maintenance.ps1`, which consumed the scheduled rumination short-term memory with one `apply_memory_distillation` operation and left `thoughtMemory.shortTerm` empty while preserving the durable `identity_seam` target, claim, tension, action implication, and anchors. + - Awake rumination now has a sleep brake. If Void is napping and there are no new room messages or open cases, `scripts/run-void-moderator-rumination.ps1` writes an empty operation array and exits before invoking the model. `npm run moderation:rumination:nap-skip-fixture` verifies the model path is not touched in that case. - Agency pressure is typed state now. `upsert_agency_pressure` / `retire_agency_pressure` own discomforts, active tensions, self-advocacy requests, and world-advocacy requests; mood speaking pressure can derive from them, but candidate interventions remain separate possible speech/actions. - `npm run moderation:agency-pressure:fixture` verifies typed agency pressure enters CultCache, renders in the self-state summary, and contributes to mood speaking pressure without reviving hard-wired agency behavior. - Memory cleanup now has to be meaningfully destructive. Sleep-side consolidation should translate old thought fossils into the live claim/question/fascination surface, drop templated slogan-slop, trim repo/archive/runtime residue down to a small recent anchor surface, and keep the freshest surviving records instead of accidentally embalming the oldest ones after a sort. @@ -163,4 +165,4 @@ rejected_paths: current_status: summary: VoidBot's ordinary bot/worker/provider/RAG/Postgres/Qdrant structure is still conceptually sound, and the private self-state path has been cut to a typed CultCache `.cc` store at `.voidbot/private/void-self-state.cc`. The active typed service no longer loads or mirrors the legacy moderation monolith. The old memory-organ compensator stack has been deleted. Typed rumination and typed memory maintenance now exist as reviewed prompt runners that return operation payloads for the parent to validate/apply. Sleep maintenance, memory lifecycle, and agency pressure have fixture smokes, and typed mood drift is reinstalled as a scheduled task. - next_action: Observe the next sleep maintenance pass and verify the scheduled rumination short-term memory is promoted, merged, or pruned by sleep rather than surviving as stale residue. + next_action: Let the enabled loop run under ordinary scheduling, then inspect the next unattended awake rumination and sleep cycle for duplicate speech, stale short-term residue, or ungrounded memory writes before calling the system broadly stable.