From 2b840821011814aef825c3c0f011f67dd8d6ad15 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 21 May 2026 08:57:52 +0100 Subject: [PATCH] Document swarm teardown and add pause gate --- notes/agent-swarm-teardown-plan-2026-05-21.md | 291 ++++++++++++++++++ notes/fresh-workspace-handoff.md | 7 +- notes/voidbot-implementation-plan.md | 30 +- scripts/run-gamecult-orchestrator.ps1 | 40 +++ scripts/run-repo-face-heartbeats.ts | 50 +++ state/agent-swarm-paused.json | 5 + state/evidence.jsonl | 1 + state/map.yaml | 5 +- 8 files changed, 424 insertions(+), 5 deletions(-) create mode 100644 notes/agent-swarm-teardown-plan-2026-05-21.md create mode 100644 state/agent-swarm-paused.json diff --git a/notes/agent-swarm-teardown-plan-2026-05-21.md b/notes/agent-swarm-teardown-plan-2026-05-21.md new file mode 100644 index 0000000..0b52060 --- /dev/null +++ b/notes/agent-swarm-teardown-plan-2026-05-21.md @@ -0,0 +1,291 @@ +# Agent Swarm Teardown Plan - 2026-05-21 + +This is the current restart gate for repo Faces, CTB heartbeats, Bifrost work routing, and public agent speech. + +The ordinary VoidBot spine is not the rotten part. Discord ingestion, worker jobs, provider lanes, RAG, Postgres, Qdrant, and typed CultCache self-state remain conceptually sound. The unstable subsystem is the repo Face swarm loop: scheduling, prompt policy, identity, public speech, governance, Discord mirroring, Bifrost dispatch, GitHub proposal behavior, and repetition control were packed into one prompt-and-parser machine. + +Stop feature work on the swarm until this plan has been reduced into a simpler live architecture. + +## Plain-Language Live Map + +### Core Inputs + +- Discord messages, replies, role mentions, and display-name addressing enter through `apps/bot/src/discord-bot.ts`. +- Scheduled ticks enter through `scripts/run-gamecult-orchestrator.ps1`. +- Repo Face registry/config enters through `.voidbot/private/repo-discord-identities.json`, `packages/core/src/repo-discord-identities.ts`, `packages/core/src/epiphany-identities.ts`, and environment config. +- Bifrost governance and dispatch state is currently read through spawned Bifrost scripts. +- Face/Void self-state enters through typed CultCache `.cc` stores. +- RAG/source/history context enters through VoidBot MCP/retrieval surfaces and recent Discord fetches. + +### Core Durable State Stores + +- Postgres or file state owns jobs, audit events, rate limits, and interaction memory. +- Qdrant owns semantic vectors for Discord history and source/lore retrieval. +- `.voidbot/` owns raw archives, source archive shards, artifacts, logs, backups, and status files. +- `.voidbot/private/void-self-state.cc` owns Void typed self-state. +- Repo-local or storage-root Face `.cc` files own each Face typed self-state. +- `.voidbot/status/repo-face-heartbeats.json` currently owns CTB participant state, pending mentions, heat, history, and active-job guesses. +- `.voidbot/private/repo-discord-identities.json` currently owns role-backed repo identity records. +- Bifrost owns governance/update request state, but VoidBot currently reaches it by spawning Bifrost CLI scripts. + +### Core Transformations + +- Bot ingestion indexes Discord where configured, detects Void/Face addressing, initializes newborn Faces, and queues pending mentions. +- The orchestrator ticks organs: Bifrost dispatch, repo Face heartbeat, Void mood drift, Void moderation rumination, and watchdog. +- The repo Face heartbeat script reconciles identities, advances initiative, scans active jobs, fetches context, builds a giant child prompt, and queues `repo-face-rumination` jobs. +- The worker executes Codex jobs, parses Face action blocks or legacy sentinels, chooses side effects, posts Discord, calls Bifrost/GitHub bridge scripts, records receipts, and completes jobs. +- The typed state service validates and applies explicit state operations to CultCache `.cc` documents. + +### Core Outputs + +- Discord messages through bot or webhook transport. +- Bifrost topics, comments, approvals, dispatch requests, and mirror messages. +- GitHub draft PRs, PR comments, and article/proposal branches when enabled. +- Typed memory, affect, agency, receipt, runtime, and candidate-intervention state operations. +- Logs, artifacts, audit events, and status reports. + +### Stage Ownership + +- Bot owns Discord ingestion and mention detection. +- Job queue owns job lifecycle. +- Worker should own provider execution, but currently also owns repo Face side effects. +- Heartbeat scheduler should own turn selection only, but currently owns prompt policy, context assembly, stale recovery, and pending direct obligations. +- CultCache state service owns typed private state mutation. +- Bifrost should own governance/public transport, but VoidBot currently calls its internals. +- Identity ownership is split between repo Discord identities and Epiphany/Face identities. + +### Coherence Invariants + +- Public speech must never be raw model text with cleanup applied after the fact. +- Bifrost governance, Discord social speech, Codex dispatch, and GitHub review surfaces must have separate canonical homes. +- Each durable fact must have one owner. +- Scheduler state must not pretend to own job lifecycle truth. +- Face identity and jurisdiction must have one canonical model. +- Prompt prose must not be the architecture. +- Sanitizers must not be responsible for making bad public output acceptable. +- Aquarium social chatter must not become the only home for actionable work. +- Bifrost mirror traffic must be inspectable but not re-ingested as fresh consensus. + +### Essential Machinery + +- Discord bot, worker, provider, and RAG seams. +- Postgres/file job queue and audit log. +- Qdrant/source/history retrieval. +- Typed CultCache `.cc` state and parent-applied operation boundaries. +- A single dumb orchestrator pulse, provided it only supervises organ lifecycle. +- Bifrost as the governance/public-process bridge, once called through a clean boundary. + +### Scaffolding And Compensators + +- `sanitizeRepoIdentityPostContent`. +- Face action DSL and legacy JSON sentinels as executable side-effect API. +- Direct `UPDATE REQUEST` bypass. +- Worker-side Bifrost/GitHub bridge script calls. +- Duplicate repo identity and Epiphany identity models. +- Heartbeat state storing scheduler, pending mention queue, heat, history, active load, and stale job repair. +- Inspection/consensus scripts that emit proposals now meant to belong to Bifrost. +- Prompt doctrines that encode runtime policy instead of deriving it from typed state and parent gates. + +## Architectural Smells + +### 1. Repo Face Heartbeat Is A Rotten Subsystem + +Current mechanism: `scripts/run-repo-face-heartbeats.ts` builds the child prompt, selects participants, loads Face state, reads Bifrost digest, fetches Discord snapshots, manages pending mentions, and queues approved owner-Codex jobs. + +Real need: autonomous Face turns with social presence, memory, jurisdiction, and work proposal capability. + +What breaks if deleted: Face chatter, Face direct-mention responses, and automatic Face work proposals stop. + +Verdict: that breakage proves the need exists, not that this implementation owns it coherently. + +Simpler architecture: a `FaceTurn` domain engine should emit typed candidate intents. Scheduler selects who gets a turn. Context assembler gathers evidence. Model proposes typed candidates. Parent gates and routes them. Bifrost owns governance. + +Files to change: `scripts/run-repo-face-heartbeats.ts`, `apps/worker/src/index.ts`, `packages/core/src/repo-face-heartbeat-queue.ts`, `packages/core/src/repo-face-rest.ts`, repo Face prompt/render helpers, Face heartbeat smokes. + +### 2. Sanitizer Is Scar Tissue + +Current mechanism: `apps/worker/src/index.ts` strips public prefixes such as `heartbeat from ...` after the model has already produced bad speech. + +Real need: stop scheduler/provenance labels from reaching Discord. + +What breaks if deleted: bad public labels leak again. + +Verdict: that proves public speech is being accepted too late and at the wrong level. + +Simpler architecture: model output becomes `speech_candidate`. Parent-side speech eligibility rejects provenance-shaped, stale, repeated, or work-request-shaped content before transport. No string mop. + +Files to change: `apps/worker/src/index.ts`, Face action parser/router, heartbeat prompt, model smoke fixtures. + +### 3. Worker Owns Too Many Side Effects + +Current mechanism: worker sees `repo-face-rumination`, parses action blocks, decides priority among SAY/Bifrost/update/GitHub, writes payload files, calls Bifrost/GitHub scripts, posts Discord, records receipts, and completes the job. + +Real need: execute provider jobs and record results. + +What breaks if deleted: repo Face side effects stop. + +Verdict: side effects need a domain router. The worker is currently a junction box with opinions. + +Simpler architecture: worker stores typed job result. A `FaceActionRouter` validates and routes candidates to Bifrost/Discord/GitHub adapters. Bifrost-owned work/governance transport should not live in the worker branch. + +Files to change: `apps/worker/src/index.ts`, Bifrost client wrappers, MCP posting tools, tests. + +### 4. Bifrost Authority Is Duplicated + +Current mechanism: VoidBot directly spawns `agent-transport.mjs`, `governance-threads.mjs`, and `bifrost-bridge.mjs`. + +Real need: governance threads, consensus, dispatch, mirroring, and public protocol transport. + +What breaks if deleted: work dispatch and topic updates break. + +Verdict: Bifrost lacks a clean API boundary from VoidBot's perspective. + +Simpler architecture: one Bifrost client boundary, ideally CultNet/API-backed: open/comment/approve/dispatch/mirror. VoidBot supplies identity, context, and candidate intent; Bifrost owns persistence, mirror, dispatch receipts, and future GitHub/Discord crossings. + +Files to change: `apps/worker/src/index.ts`, `scripts/run-repo-face-heartbeats.ts`, `scripts/feed-codex-chat-consensus.mjs`, Bifrost integration docs/tests. + +### 5. Identity Authority Is Split + +Current mechanism: repo Discord identities define id/repo/display/role/channel/avatar; Epiphany identities wrap or derive Faces/grants/jurisdictions from those records. + +Real need: one identity model that knows who can speak, where, as whom, and with what authority. + +What breaks if one layer is deleted: either Discord addressing or jurisdiction/grants vanish. + +Verdict: two models are sharing one authority. + +Simpler architecture: canonical `FaceIdentity` owns id, display, avatar, role projection, grants, jurisdictions, state path, channel grants, and repo relationship. Discord role identities become a projection, not a parallel source. + +Files to change: `packages/core/src/repo-discord-identities.ts`, `packages/core/src/epiphany-identities.ts`, bot addressing, MCP identity tools, registry migration. + +### 6. Scheduler State Owns Lifecycle It Cannot Know + +Current mechanism: heartbeat JSON stores active job ids and then scans the job queue to reconcile stale jobs. + +Real need: prevent overlapping turns and freeze initiative while a Face thinks. + +What breaks if deleted: duplicate turns can be queued. + +Verdict: job lifecycle belongs to the job queue. Scheduler may derive active state, not store it as truth. + +Simpler architecture: scheduler stores initiative inputs and next-turn estimates only. Job queue is authoritative for active/running/completed. Completion events advance recovery. + +Files to change: `scripts/run-repo-face-heartbeats.ts`, `packages/core/src/repo-face-heartbeat-queue.ts`, job queue state APIs. + +### 7. Direct UPDATE REQUEST Bypasses Governance + +Current mechanism: a Face can emit `UPDATE REQUEST`; worker enqueues Bifrost transport directly if cross-jurisdiction guard passes. + +Real need: urgent repo-local dispatch. + +What breaks if deleted: immediate dispatch waits for Bifrost topic/approval. + +Verdict: that is a desirable break if Bifrost is the governance platform. + +Simpler architecture: every work proposal is a Bifrost topic/comment. Dispatch only happens after Bifrost consensus/approval, with the owning Face's approval where applicable. + +Files to change: worker parsers, heartbeat prompt, smoke tests, Bifrost topic/dispatch bridge. + +### 8. Prompt Text Has Become Executable Policy + +Current mechanism: huge prompt doctrine controls speech thresholds, comedy, jurisdiction, work routing, publication, repetition, social embodiment, and Bifrost etiquette. + +Real need: rich agent behavior. + +What breaks if deleted: Faces lose behavior. + +Verdict: behavior exists only because prompt law is carrying architecture. That is fragile. + +Simpler architecture: compact prompts over typed state, explicit policy structs, parent gates, and evaluators. Prompts should express voice and intent, not compensate for missing ownership. + +Files to change: heartbeat prompt renderers, provider renderers, Face identity doctrine, smoke fixtures. + +### 9. Rest/Fatigue Reaches Sideways Into Scheduler State + +Current mechanism: post-fatigue updates Face `.cc` state and directly edits heartbeat JSON next-turn timing. + +Real need: speech changes future cadence. + +What breaks if deleted: fatigue no longer delays turns. + +Verdict: rest state belongs in Face state; scheduler should read it next tick. + +Simpler architecture: Face state records rest/fatigue. Scheduler projects readiness from Face state and job queue. + +Files to change: `packages/core/src/repo-face-rest.ts`, heartbeat scheduler. + +### 10. Inspector And Consensus Scripts Are Bifrost Compensators + +Current mechanism: inspector emits proposal seeds from agent state; feed-consensus builds Discord packets and can enqueue Bifrost requests. + +Real need: observe asks and route work. + +What breaks if deleted: manual rescue lanes disappear. + +Verdict: Bifrost should own proposal/consensus/dispatch. Inspector should report failures and state health, not mint governance artifacts. + +Simpler architecture: inspector is health/audit only. Bifrost owns work proposal state and consensus. + +Files to change: `scripts/inspect-agent-state-requests.ts`, `scripts/feed-codex-chat-consensus.mjs`, package scripts, inspector automation. + +## Ranked Teardown Plan + +### Keep + +- Bot/worker/provider/RAG structural seam. +- Postgres/file job queue and audit events. +- Qdrant/source/history retrieval. +- Typed CultCache `.cc` private state and parent-applied operations. +- A single local orchestrator pulse, made dumb and observable. +- Bifrost as governance/public-process bridge. + +### Cut + +1. Public speech sanitizer. +2. Direct `UPDATE REQUEST` bypass as a Face-to-Codex dispatch rail. +3. Legacy repo Face JSON sentinels after typed candidate output exists. +4. Inspector-generated proposal/consensus artifacts. +5. Direct Discord prompt lanes for Faces. +6. Worker-owned Bifrost/GitHub bridge logic after Bifrost has one callable boundary. + +### Collapse + +1. Repo Discord identity and Epiphany Face identity into one canonical Face identity. +2. Discord post paths into one public transport adapter. +3. Bifrost topic/comment/approval/dispatch calls into one Bifrost client boundary. +4. Action DSL and legacy sentinels into one typed candidate output contract. + +### Split + +1. Heartbeat script into scheduler, context assembler, prompt renderer, and turn submitter. +2. Scheduler state from job lifecycle. +3. Agent psychology/state from public speech gating. +4. Casual Aquarium speech from Bifrost governance/work routing. +5. Canonical Bifrost comments from in-character Discord mirror speech. + +### Rebuild + +1. Repo Face turn system. +2. Bifrost transport boundary. +3. Face public-output pipeline: model proposes, parent validates, policy routes, transport posts. +4. Tests around invariants rather than current implementation shape. + +## First Bounded Moves + +1. Keep the swarm offline while teardown work proceeds. +2. Point canonical state and handoff docs at this teardown plan. +3. Add a repo-controlled pause flag that all swarm/organs obey before any scheduled work can resume. +4. Replace child-facing `heartbeat` framing with neutral `turn` language. +5. Introduce parent-side public speech eligibility and make sanitizer deletion possible. +6. Route all work proposals through Bifrost topics; remove direct `UPDATE REQUEST` dispatch. +7. Collapse identity authority. +8. Split scheduler from context/prompt/router. + +Restart is not allowed until these invariants can be stated in code and tested: + +- no public model speech posts without parent eligibility; +- no work request exists only in Aquarium; +- no Bifrost mirror post is treated as fresh consensus input; +- no scheduler JSON owns active job truth; +- no sanitizer is needed to hide internal runtime labels; +- no Face identity exists in two competing canonical forms. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 5cabe74..1e03d3f 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -18,6 +18,8 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou - Discord bot and worker are live. - The unattended repo Face / CTB swarm is intentionally offline as of 2026-05-21. `GameCult Local Orchestrator` is disabled after the Aquarium failure where Faces leaked heartbeat labels, repeated saturated work seams, failed to banter, and kept turning Aquarium into work pressure. Read `notes/agent-swarm-shutdown-audit-2026-05-21.md` before any restart. +- The active teardown authority is now `notes/agent-swarm-teardown-plan-2026-05-21.md`. Treat it as the current map for repo Faces, CTB turns, Bifrost transport, public speech, and identity ownership. The conclusion is not "tune the heartbeat"; it is "rebuild the Face/Bifrost turn foundation before restart." +- The repo-controlled pause flag is `state/agent-swarm-paused.json`. While it is missing or has `"paused": false`, swarm runners may operate. While it has `"paused": true` or is malformed, the Face heartbeat runner skips and the orchestrator skips agent-swarm organs. This is the brake. Do not route around it. - Postgres owns jobs, audit events, interaction memory, and rate-limit state. - Qdrant owns history and source vectors. - `.voidbot/` owns archives, artifacts, logs, status files, and backups. @@ -141,7 +143,9 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou ## Likely Next Bounded Move -- Do not restart the swarm by momentum. First bounded move is a restart-safety pass from `notes/agent-swarm-shutdown-audit-2026-05-21.md`: add a repo-controlled pause flag, remove "heartbeat" from child-facing task framing, add parent-side speech eligibility for stale/status-shaped/repeated outputs, separate Aquarium social speech from Bifrost work routing, reconcile stale active-turn scheduler state against the job queue, and create a recent Face-output audit report. +- Do not restart the swarm by momentum. First bounded move is the teardown pass from `notes/agent-swarm-teardown-plan-2026-05-21.md`: add a repo-controlled pause gate for swarm organs, remove "heartbeat" from child-facing task framing, add parent-side speech eligibility for stale/status-shaped/repeated outputs, separate Aquarium social speech from Bifrost work routing, reconcile stale active-turn scheduler state against the job queue, and create a recent Face-output audit report. +- Treat `sanitizeRepoIdentityPostContent` as a deletion target, not a feature surface. If deleting it would leak bad speech, that is evidence the parent-side speech gate is missing. +- Treat direct Face `UPDATE REQUEST` dispatch as a governance bypass. The intended rebuild routes work proposals through Bifrost topics and dispatches only after Bifrost consensus/approval. - After those gates exist, run dry/mock Face turns before re-enabling `GameCult Local Orchestrator`. - The direct-ask receipt check remains important, but it is no longer the next move while the swarm is offline. - 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. @@ -152,6 +156,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou - Project root: `E:\Projects\VoidBot` - Canonical map: `E:\Projects\VoidBot\state\map.yaml` +- Agent swarm pause flag: `E:\Projects\VoidBot\state\agent-swarm-paused.json` - Scratch surface: `E:\Projects\VoidBot\state\scratch.md` - Distilled evidence ledger: `E:\Projects\VoidBot\state\evidence.jsonl` - Branch/hypothesis ledger: `E:\Projects\VoidBot\state\branches.json` diff --git a/notes/voidbot-implementation-plan.md b/notes/voidbot-implementation-plan.md index a671916..8ba5d3a 100644 --- a/notes/voidbot-implementation-plan.md +++ b/notes/voidbot-implementation-plan.md @@ -4,7 +4,9 @@ This is the current forward plan for the next larger organs. It is not a changel ## Current Aim -The typed moderation, mood, sleep, agency, and private self-state boundary is live. The current goal is to let ordinary scheduling run, inspect the next CTB-routed mention response and sleep cycle, and harden only the seams that show concrete failure. Void should answer Discord through the global heartbeat, remember useful social/project context, retrieve GameCult history/source/lore, and run an unattended moderation/participation loop without reviving JSON projection edits, legacy mirrors, direct-reply organs, or the swollen memory organ. +The typed moderation, mood, sleep, agency, and private self-state boundary is live, but the repo Face / CTB / Bifrost swarm loop is under teardown. Do not let ordinary swarm scheduling run. The active plan is `notes/agent-swarm-teardown-plan-2026-05-21.md`: the current Face loop mixed scheduling, prompt law, public speech, identity, governance, Discord mirroring, Bifrost dispatch, and GitHub proposal behavior into one prompt-and-parser machine. That foundation is no longer eligible for feature work. + +The current goal is to rebuild the Face/Bifrost turn foundation around clear ownership. VoidBot should keep the ordinary bot/worker/provider/RAG/Postgres/Qdrant/CultCache spine, but repo Face work must be reduced into a scheduler, context assembler, typed candidate output contract, parent-side speech/work gate, and Bifrost-owned governance transport. Sanitizers, direct `UPDATE REQUEST` dispatch, dual identity authority, and worker-owned bridge calls are teardown targets, not surfaces to polish. The next priority is observational hardening of the enabled typed loop. Agents and scheduled workers mutate typed CultCache-backed state through explicit operations, not by editing a whole-state JSON working copy. Sleep and memory distillation now preserve meaning-bearing claims/anchors/tensions in fixture and live-state passes, and short-term rumination has a clustering guard so repeated same-target/topic thoughts update one provisional memory instead of stacking duplicates. Keep checking ordinary cycles for abstraction sludge, duplicate speech, stale residue, or self-orbiting memories. @@ -204,7 +206,31 @@ The runner can hand these to a CLI/MCP tool. The store decides what survives. - hard-wired agency policy is mostly current scaffolding, not the final authority; identity, advocacy, and speech candidates should emerge from typed memory/state operations plus model-owned judgment under validation - sleep/distillation has a typed maintenance runner, reviewed prompt boundary, fixture coverage, and one live-state pass proving short-term residue can become durable memory without losing meaning -Verdict: the foundation is coherent enough for cautious live operation. Do not add behavior by widening prompts or reviving compensators; harden only failures observed in ordinary scheduled cycles. +Verdict: the ordinary VoidBot foundation is coherent enough for cautious operation, but the repo Face swarm foundation is not. Stop swarm feature work and rebuild that organ before restart. Do not add behavior by widening prompts or reviving compensators; the teardown plan is the active authority. + +## Agent Swarm Teardown Sequence + +The canonical teardown map is `notes/agent-swarm-teardown-plan-2026-05-21.md`. + +First cuts: + +- Keep `GameCult Local Orchestrator` disabled while swarm teardown proceeds. +- Add a repo-controlled pause gate that swarm organs obey even when the Windows scheduled task or manual runner is invoked. +- Rename child-facing `heartbeat` framing to neutral turn/pass language so runtime provenance stops poisoning public speech. +- Add parent-side public speech eligibility before transport: reject scheduler labels, stale/repeated lines, and work requests trying to live only in Aquarium. +- Delete `sanitizeRepoIdentityPostContent` after the speech gate owns the invariant. +- Route Face work proposals through Bifrost topics; remove direct `UPDATE REQUEST` dispatch as a bypass. +- Collapse repo Discord identity and Epiphany Face identity into one canonical Face identity model. +- Split the Face turn loop into scheduler, context assembler, prompt renderer, candidate parser, policy gate, and transport router. + +Restart gates: + +- no public model speech posts without parent eligibility; +- no work request exists only in Aquarium; +- no Bifrost mirror post is treated as fresh consensus input; +- no scheduler JSON owns active job truth; +- no sanitizer is needed to hide internal runtime labels; +- no Face identity exists in two competing canonical forms. ## Migration Plan diff --git a/scripts/run-gamecult-orchestrator.ps1 b/scripts/run-gamecult-orchestrator.ps1 index 0699344..1b5dbe5 100644 --- a/scripts/run-gamecult-orchestrator.ps1 +++ b/scripts/run-gamecult-orchestrator.ps1 @@ -12,6 +12,7 @@ $statusDir = Join-Path $repoRoot ".voidbot\status" $logDir = Join-Path $repoRoot ".voidbot\logs\orchestrator" $statePath = Join-Path $statusDir "gamecult-orchestrator.json" $lockPath = Join-Path $statusDir "gamecult-orchestrator.lock" +$agentSwarmPausePath = Join-Path $repoRoot "state\agent-swarm-paused.json" $hiddenLauncher = Join-Path $PSScriptRoot "run-hidden-powershell.vbs" $bifrostRoot = "E:\Projects\Bifrost" @@ -211,6 +212,24 @@ function Test-OrchestratorLock { return $true } +function Test-AgentSwarmPaused { + if (-not (Test-Path -LiteralPath $agentSwarmPausePath)) { + return $false + } + try { + $pause = Read-JsonFile -Path $agentSwarmPausePath + if ($null -eq $pause) { + return $true + } + if ($pause.PSObject.Properties["paused"] -and $pause.paused -eq $false) { + return $false + } + return $true + } catch { + return $true + } +} + New-Item -ItemType Directory -Force -Path $statusDir, $logDir | Out-Null if (Test-OrchestratorLock) { exit 0 @@ -232,6 +251,13 @@ try { $node = (Get-Command node.exe -ErrorAction Stop).Source $powershell = Join-Path $env:SystemRoot "System32\WindowsPowerShell\v1.0\powershell.exe" $now = [DateTime]::UtcNow + $agentSwarmPaused = Test-AgentSwarmPaused + $agentSwarmOrganIds = @{ + "bifrost-dispatch" = $true + "repo-face-heartbeats" = $true + "void-mood-drift" = $true + "void-moderation-rumination" = $true + } $onlySet = @{} $onlyValues = @() if ($null -ne $Only) { @@ -298,6 +324,20 @@ try { continue } + if ($agentSwarmPaused -and $agentSwarmOrganIds.ContainsKey($organ.Id)) { + Set-OrganState -State $state -Id $organ.Id -Value ([pscustomobject]@{ + label = $organ.Label + intervalMinutes = $organ.IntervalMinutes + lastStartedAt = $now.ToString("o") + lastFinishedAt = $now.ToString("o") + lastExitCode = 0 + lastStatus = "skipped_agent_swarm_paused" + lastLogPath = $agentSwarmPausePath + }) + Write-JsonFile -Path $statePath -Data $state + continue + } + $result = Invoke-Organ -Organ $organ -Now $now $runs += $result Set-OrganState -State $state -Id $organ.Id -Value ([pscustomobject]@{ diff --git a/scripts/run-repo-face-heartbeats.ts b/scripts/run-repo-face-heartbeats.ts index 12555b3..a382817 100644 --- a/scripts/run-repo-face-heartbeats.ts +++ b/scripts/run-repo-face-heartbeats.ts @@ -132,6 +132,35 @@ async function main(): Promise { const config = loadConfig(); const dryRun = process.argv.includes("--dry-run"); + const pause = await readAgentSwarmPause(); + if (pause.paused) { + const state = await readHeartbeatState(config.repoFaceHeartbeats.statePath); + state.lastTickAt = new Date().toISOString(); + state.history.push({ + type: "skipped", + reason: "agent_swarm_paused", + skippedAt: state.lastTickAt, + pausePath: pause.path, + pauseReason: pause.reason, + }); + state.history = state.history.slice(-80); + if (!dryRun) { + await writeHeartbeatState(config.repoFaceHeartbeats.statePath, state); + } + process.stdout.write( + `${JSON.stringify({ + ok: true, + queuedCount: 0, + dryRun, + skipped: true, + reason: "agent_swarm_paused", + pausePath: pause.path, + statePath: config.repoFaceHeartbeats.statePath, + })}\n`, + ); + return; + } + if (!config.repoFaceHeartbeats.enabled && !process.argv.includes("--force")) { const state = await readHeartbeatState(config.repoFaceHeartbeats.statePath); state.lastTickAt = new Date().toISOString(); @@ -309,6 +338,27 @@ async function main(): Promise { ); } +async function readAgentSwarmPause(): Promise<{ paused: boolean; path: string; reason?: string }> { + const path = resolve(process.cwd(), "state", "agent-swarm-paused.json"); + try { + const parsed = JSON.parse(stripLeadingBom(await readFile(path, "utf8"))) as Record; + return { + paused: parsed.paused !== false, + path, + reason: typeof parsed.reason === "string" ? parsed.reason : undefined, + }; + } catch (error) { + if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { + return { paused: false, path }; + } + return { + paused: true, + path, + reason: "Pause file exists but could not be parsed; failing closed.", + }; + } +} + interface ParticipantSpec { id: string; participantKind: FaceHeartbeatParticipant["participantKind"]; diff --git a/state/agent-swarm-paused.json b/state/agent-swarm-paused.json new file mode 100644 index 0000000..18d22f7 --- /dev/null +++ b/state/agent-swarm-paused.json @@ -0,0 +1,5 @@ +{ + "paused": true, + "reason": "Repo Face / CTB / Bifrost swarm teardown is active. See notes/agent-swarm-teardown-plan-2026-05-21.md.", + "updatedAt": "2026-05-21T00:00:00.000Z" +} diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 9d581fc..5b6789a 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -217,3 +217,4 @@ {"ts":"2026-05-21T00:17:31Z","type":"verification","status":"ok","note":"Repo Face silence was caused by a stale worker process that predated the rebuilt DSL parser; watchdog now fails runtime.*.freshness when bot/worker started before its dist entrypoint, and fresh worker logged/posted a Mimir SAY receipt after restart."} {"ts":"2026-05-21T00:25:47Z","type":"repair","status":"ok","note":"Blocked cross-jurisdiction repo Face UPDATE REQUEST packets at the worker rail: Aqua's bad AquaSynth request naming LocalCastBridge was stopped/cancelled, and immediate update requests now fail before Bifrost enqueue when they mention another registered repo."} {"ts":"2026-05-21T00:38:02Z","type":"audit","status":"ok","note":"Disabled GameCult Local Orchestrator and documented the 2026-05-21 agent swarm failure: heartbeat label leakage, stale Nibu continuity-residue pressure, missing inter-agent banter/social bonds, Aquarium work-request leakage, and restart gates in notes/agent-swarm-shutdown-audit-2026-05-21.md."} +{"ts":"2026-05-21T07:56:25Z","type":"implementation","status":"ok","note":"Documented the 2026-05-21 agent swarm teardown plan, pointed canonical state and handoff surfaces at it, and added a tracked state/agent-swarm-paused.json gate. The repo Face heartbeat runner now skips when paused, and the orchestrator skips Bifrost dispatch, repo Face heartbeats, Void mood drift, and Void moderation rumination while the pause is active."} diff --git a/state/map.yaml b/state/map.yaml index 98f0663..aee77e5 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -55,6 +55,7 @@ data_flow: - keep persistent state lean enough that re-entry sharpens the next turn instead of drowning it active_subgoals: + - Treat `notes/agent-swarm-teardown-plan-2026-05-21.md` as the current repo Face/Bifrost/CTB rebuild authority. The repo Face swarm loop is architectural Jenga: scheduling, prompt policy, speech, governance, identity, Bifrost transport, and work dispatch must be torn down into clearer ownership before any swarm feature work or restart. - Make the new project-state surfaces the default continuity path for nontrivial VoidBot work. - Keep the rebuilt moderation/self-state foundation on canonical CultCache `.cc` typed operations, never an editable JSON working projection. - Keep the typed moderation, mood, repo Face, Bifrost dispatch, and watchdog organs behind the single `GameCult Local Orchestrator` scheduled pulse; the per-organ scheduled tasks are legacy installer surfaces and should stay disabled unless a deliberate isolation test needs one. As of the 2026-05-21 swarm shutdown, the orchestrator task itself is intentionally disabled until the agent-swarm failure audit restart conditions are met. @@ -227,5 +228,5 @@ rejected_paths: reason: sleep/distillation that collapses concrete claims into generic abstraction creates memory nonsense and then forces later cleanup compensators current_status: - summary: VoidBot's ordinary bot/worker/provider/RAG/Postgres/Qdrant structure is still conceptually sound, but the unattended agent swarm is offline after the 2026-05-21 Aquarium failure: Faces leaked heartbeat/status labels into public speech, repeated saturated work seams, failed to form visible banter, and continued treating Aquarium as a work-pressure surface. The `GameCult Local Orchestrator` scheduled task is disabled as the containment boundary; ordinary bot/worker inspection remains available. - next_action: Use `notes/agent-swarm-shutdown-audit-2026-05-21.md` as the restart gate. Do not re-enable `GameCult Local Orchestrator` until the swarm has a repo-controlled pause flag, child prompt framing no longer says heartbeat, parent-side public speech gating rejects stale/repeated/status-shaped outputs, Aquarium/Bifrost work routing is separated, stale active-turn state is reconciled against the job queue, and recent Face public outputs are inspectable in one report. + summary: VoidBot's ordinary bot/worker/provider/RAG/Postgres/Qdrant/CultCache structure is still conceptually sound, but the repo Face swarm loop is now officially under teardown. The unstable organ is the prompt-and-parser machine that mixed CTB scheduling, public speech, identity, social policy, Bifrost governance, Discord mirroring, and Codex/GitHub dispatch. The `GameCult Local Orchestrator` scheduled task remains disabled as containment; ordinary bot/worker inspection remains available. + next_action: Use `notes/agent-swarm-teardown-plan-2026-05-21.md` as the active rebuild map and `notes/agent-swarm-shutdown-audit-2026-05-21.md` as incident evidence. First cut is to add a repo-controlled pause gate for swarm organs, then remove child-facing "heartbeat" framing and introduce parent-side public speech eligibility so `sanitizeRepoIdentityPostContent` can be deleted instead of expanded. Do not re-enable the swarm until Bifrost work routing, identity authority, scheduler/job lifecycle ownership, and public speech gating are rebuilt around explicit invariants.