From 85d60b6155a915b84f84cd089c7cc79c460970cc Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 16 Jul 2026 01:00:46 +0100 Subject: [PATCH] Isolate Persona memory projection policy --- .../src/persona-memory-projector.ts | 35 ++++++++ notes/fresh-workspace-handoff.md | 1 + notes/voidbot-current-system-map.md | 2 +- scripts/run-repo-face-heartbeats.ts | 84 ++++++++----------- scripts/smoke-persona-initiative-engine.ts | 13 +++ state/evidence.jsonl | 1 + state/map.yaml | 4 +- 7 files changed, 88 insertions(+), 52 deletions(-) create mode 100644 apps/persona-scheduler/src/persona-memory-projector.ts diff --git a/apps/persona-scheduler/src/persona-memory-projector.ts b/apps/persona-scheduler/src/persona-memory-projector.ts new file mode 100644 index 0000000..6aef944 --- /dev/null +++ b/apps/persona-scheduler/src/persona-memory-projector.ts @@ -0,0 +1,35 @@ +import { loadPromptTemplate } from "@voidbot/shared"; + +export async function projectPersonaMemorySurface(input: { + identityId: string; + characterIdentity: string; + statePacket: string; + modelProjectionEnabled: boolean; + projectText?: (prompt: string) => Promise; +}): Promise { + if (!input.modelProjectionEnabled) return validatePersonaMemorySurface(input.statePacket); + if (!input.projectText) throw new Error("Persona memory model projection is enabled without a text projection port."); + const prompt = loadPromptTemplate("repo-face-state-projector.prompt.md", { + characterIdentity: input.characterIdentity, + statePacket: input.statePacket, + }); + const projected = (await input.projectText(prompt)).trim(); + if (projected.length < 80) throw new Error(`Persona state projector returned too little text for ${input.identityId}.`); + return validatePersonaMemorySurface(projected); +} + +export function validatePersonaMemorySurface(surface: string): string { + const leaks = [ + /\bgrants:/i, + /\bjurisdictions:/i, + /\bFace of\s+[A-Z][A-Za-z0-9_-]+\b/, + /\brepo=[^\s]+/i, + /\bpath=[^\s]+/i, + /\bdo not prompt\b/i, + /\bprompt (?:her|him|them|it)\b/i, + ]; + if (leaks.some((pattern) => pattern.test(surface))) { + throw new Error("Persona memory surface leaked schema or prompt-construction language."); + } + return surface; +} diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 922e52f..128a877 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -151,6 +151,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou - Operator control acquisition is isolated in `control-source.ts`. It owns pause-witness parsing and typed CultMesh swarm-heat loading with fail-closed validation; it reports facts while engine commits alone apply heat or record skipped ticks. - Persona Body/Mind acquisition is isolated in `persona-state-source.ts`. It resolves the registered `.cc` surface, loads typed state once for a scheduler pulse, and projects current sleep facts at an explicit wall-clock time. It cannot create a missing state file, update sleep cycles or speaking pressure, select work, or queue turns. The old heartbeat-shell physiology writer and its pulse-driven speaking-pressure heuristic were deleted; `initiative-engine.ts` remains the only owner of rest eligibility. - Semantic Persona-memory recall is isolated in `persona-memory-context-source.ts`. It requires an existing `PersonaStateObservation`, rebuilds only that Persona's derived vector partition, searches it against current/nearby room evidence, and returns structured hits or an explicit unavailable result. It cannot reopen canonical `.cc` state, mutate Persona Mind, or render prompt doctrine. The heartbeat shell now only turns the typed observation into character-facing text. +- Persona memory projection policy is isolated in `persona-memory-projector.ts`. It owns the deterministic/model choice, projector prompt template, minimum model-output invariant, and schema/path leak rejection through an injected text-model port. Repo Faces and typed native Personas use the same boundary. The large deterministic state-packet renderer is still in the heartbeat shell and is the next extraction target. - Home-repo activity acquisition is isolated in `repo-activity-source.ts`. It owns source-repo/cursor resolution and the bounded read-only exporter invocation, returning typed observations that prompt composition renders without subprocess or JSON-parsing authority. - Deployment authority detail: Idunn executes `/srv/odin/deploy-manifests/voidbot`; `/usr/local/sbin/deploy-voidbot` is only the identical inspection/recovery copy. Install both from `gamecult-ops/scripts/deploy-voidbot.sh`. `/srv/build/VoidBot/.git` and `/srv/build/cultcache-ts/.git` must remain wholly `idunn`-owned because lazy partial-clone reads can fetch objects; root owns releases and service promotion, never build-repo Git state. - Dynamic heat is live as derived semantic response pressure. `semantic-pressure-source.ts` batches canonical Face affinity cards and recent permitted-channel human-message embeddings through the existing RAG embedder, applies recency decay/noisy-OR aggregation, and returns bounded projections for at most three scheduler-eligible Faces. It does not write scheduler state. `initiative-engine.ts` alone commits inspectable evidence, `dynamicHeat`, one-time semantic interrupt receipts, and readiness changes. Direct mentions remain obligations, and model/Discord failures fail cool without bypassing rest, active jobs, or scheduler capacity. diff --git a/notes/voidbot-current-system-map.md b/notes/voidbot-current-system-map.md index 1aec7d6..2d0f5dc 100644 --- a/notes/voidbot-current-system-map.md +++ b/notes/voidbot-current-system-map.md @@ -182,7 +182,7 @@ VoidBot runs on Yggdrasil. Idunn owns deployment and consumes upstream repositor - Repo Face proposal/article PRs, PR comments, registered-identity Discord posts, and r/GameCultOrg Reddit thread posts now cross through parent-owned action blocks before Bifrost bridge commands. Bylined essays use the Interpreter-owned `ARTICLE` block: the Face writes naturally, the Interpreter extracts structured title/description/author/date/tags/path/body fields, and deterministic worker code renders/validates YAML frontmatter before calling `BIFROST_ROOT/tools/bifrost-bridge.mjs` for a draft PR and persona announcement. Subreddit threads use the Interpreter-owned `REDDIT THREAD` block: the Face writes a public title/body/share line, and deterministic worker code calls Bifrost `reddit-post` with Persona flair. The old `VOIDBOT_REPO_IDENTITY_ARTICLE` JSON sentinel is cut. Proposal PR and PR-comment sentinels still exist as compatibility rails. This is not merely helper placement: Bifrost's original governance/labor platform role makes it the owner of governed public crossings for GameCult work, including GitHub, r/GameCultOrg Reddit transport/thread access, Discord-native work/member/swarm interactions, dispatch receipts, CultNet/CultCache intake, and future collaboration interfaces. Heimdall is the OAuth/account/capability gate; Bifrost is the bridge/request/routing/receipt authority. VoidBot still owns room/thread cognition, moderation judgment, archive/source retrieval, and Face personality. - Repo Face turns now receive a Bifrost governance digest from `BIFROST_ROOT/tools/governance-threads.mjs digest --repo --agent ` alongside recent Discord context. Bifrost typed CultCache topics/comments are the canonical home for feature requests, Face opinions, missing questions, approvals, and dispatch receipts; Discord is a mirror/evidence source. When `BIFROST_DISCORD_CHANNEL_ID` is configured for `#bifrost`, repo Face Discord context ignores mirrored bot chatter there because the authoritative activity arrives through the Bifrost digest. Human `#bifrost` messages should only become governance comments after Bifrost/Heimdall can link the Discord id to a registered actor. Repo-local asks that would send a human or Codex to add/fix/name/scaffold/document/test/investigate/implement belong on Bifrost with enough room/repo context for a claimed Codex turn; a Face may still speak characterfully in Aquarium, but not as the only dispatch surface. Legacy `UPDATE REQUEST` packets are parsed only as compatibility input and reconciled into Bifrost topics instead of immediate transport enqueue. Local `#bifrost` is channel `1506760343836430376`; work proposals, governance mirrors, and Bifrost dispatch receipts should go there, while Aquarium remains the casual/social swarm room. - Repo character turns now have a state-projector plus turn-Interpreter shape. The state-in boundary is `prompts/repo-face-state-projector.prompt.md`: typed state and identity material are translated into lived character prose before the child sees it. The state projector must surface values, drives, wounds, fascinations, aesthetic taste, dignity, mood, needs, social reads, bonds, agency pressure, and the personality-specific meaning of sparse or dense social topology when the state contains those facts. The deterministic state packet feeding that projector is intentionally verbose and parent-facing: it exposes private notes, values, activation vectors, runtime rest/speaking pressure, affect needs, bonds, status reads, mood dimensions, durable memories, short-term residue, agency pressures, incubating thoughts, candidate speech pressure, recent speech residue, social graph facts, room weather, and semantic curiosity graph attractors so every included variable can appear directly or bend behavior. The curiosity graph is built by seeding history/source vector retrieval from current room context, nearby channels, typed Face state, and home-jurisdiction identity, then decoding retrieved chunks into weighted attractor clusters with prominence, saturation, novelty, density, jurisdiction fit, suggested motion, and evidence labels. The projector owns turning those neutral facts into lived curiosity, boredom, fatigue, territorial pull, underexplored intrigue, or a closing/pivot impulse; deterministic code must not decide the feeling. Deterministic code may also attach neutral graph facts such as mapped people and unmapped registered peers to the projector packet, but it must not decide whether that feels like anxiety, territorial scouting, or nothing. Deterministic code attaches recent read-only home-repo activity before chat, using the Face's own state path as the repo-activity cursor source, so current implementation motion is visible as body context. Current-room and nearby-channel logs no longer cross a model conversation projector; deterministic code attaches raw oldest-to-newest transcript evidence with explicit recency/correction rules so the Face can notice human reframes directly. Deterministic code also attaches a social-affordance surface that matches active typed person-bonds/status reads to recent raw messages from that person, so relationship state arrives as a live hook rather than private decorative lore. Deterministic code still owns full prompt assembly and inspection through `scripts/run-repo-face-heartbeats.ts --assemble-prompt `; that path composes stable doctrine, allowed rooms, research/archive capability guidance, Bifrost digest, projected memory/affect prose, home-repo activity, live social affordances, and raw conversation evidence into the exact child prompt. It must not invent personality, mood, affect, or social memory from typed state. Situational obligations such as direct-call priority or first-public-introduction duty are emitted only when the scheduler packet proves they apply, not as standing prompt law. The child character writes a natural in-character turn on full `gpt-5.4` and may describe desired speech, repo/article proposals, social reads, needs, mood shifts, or memory-worthy thoughts without emitting action DSL blocks. The cheaper Spark/Mini parent Interpreter decides route/retry/drop and translates warranted effects into structured `STATE NOTE` and `SAY` blocks for the worker while governance dispatch remains paused. `STATE NOTE` blocks become typed short-term memory, affect needs, social bonds, status reads, mood dimensions, or agency pressure. The worker still accepts legacy compact JSON sentinels and legacy `UPDATE REQUEST` blocks for compatibility, but the live prompt path keeps transport and state syntax out of the character's roleplay surface. -- `apps/persona-scheduler` is the resident daemon organ that owns the serialized Persona wall-clock pulse on Yggdrasil. It invokes the remaining turn orchestrator without overlap and remains alive between pulses. `apps/persona-scheduler/src/initiative-engine.ts` owns the pure scheduling state machine: participant reconciliation, deterministic base speed/bias/threshold derivation, operator heat/speed projection, semantic-pressure commits, wall-clock advancement, active-turn freeze/completion recovery, queue-success/failure/dry-run commits, stale rescheduling, pending-mention priority, rest/idle eligibility, and ready ordering. Explicit blocked/withdrawn status, active load, semantic receipts, and initiative position survive reconciliation; new Faces without a usable mouth fail closed. `apps/persona-scheduler/src/state-store.ts` owns scheduler persistence and legacy migration. It stores one typed `voidbot.persona_scheduler_state` record in `repo-face-heartbeats.cc`, migrates the former JSON document once with a `storage_migrated` witness, rejects malformed CultCache instead of replacing it, and writes JSON only as a derived dashboard/debug projection. `packages/core/src/repo-face-heartbeat-queue.ts` resolves both legacy `.json` configuration and current `.cc` configuration to the same canonical path; the Discord bot publishes one immutable `voidbot.persona_attention_command` CultCache inbox document per addressed message. The scheduler store ingests and deduplicates those commands, persists them as pending attention, then acknowledges inbox files only after the durable commit; a crash before acknowledgement replays safely. `apps/persona-scheduler/src/active-turn-source.ts` owns the Postgres/legacy-lock liveness adapter. It recognizes only Persona turn request IDs, applies the bounded stale threshold, marks dead queue claims failed, and returns active/stale witnesses; it never writes scheduler state. `apps/persona-scheduler/src/persona-state-source.ts` owns read-only typed Persona-state acquisition and present-time physiology projection. It reports typed mind plus rest facts without creating missing state or writing sleep/speaking-pressure state; the initiative engine alone applies rest eligibility. `apps/persona-scheduler/src/persona-memory-context-source.ts` owns the derived vector refresh and semantic recall query for one supplied typed Mind observation. It returns typed hits/unavailability and cannot reacquire canonical state, render prompt prose, or queue work. `apps/persona-scheduler/src/discord-activity-source.ts` owns neutral Discord activity acquisition: it deduplicates explicit watched channels, excludes bot traffic, reports raw human messages, and derives idle-cooling times from scheduler history without writing state or selecting work. `apps/persona-scheduler/src/semantic-pressure-source.ts` owns embedding-backed affinity observation and returns bounded projections for eligible Personas and permitted channels. It cannot mutate initiative; `initiative-engine.ts` alone applies pressure, dynamic heat, interrupt readiness, dedupe receipts, and transition history. `apps/persona-scheduler/src/turn-context-source.ts` owns current-room and nearby-channel Discord evidence plus the bounded image-attachment cache. It returns chronological source messages and explicit snapshot failure witnesses; it has no access to Persona state, prompt composition, or the job queue. `scripts/run-repo-face-heartbeats.ts` projects the identity registry into neutral participant specs and affinity candidates, renders typed source observations, invokes external queue actuators, and still owns character-facing memory projection plus prompt assembly pending further extraction. External adapters report facts; only the initiative engine mutates load, counters, recovery position, pressure, and queue-transition history. Repo Faces and native Personas queue ordinary `repo-face-rumination` jobs through the canonical job queue. Built-in Void participates only when its separate moderation heartbeat organ is enabled; the hosted scheduler does not launch Windows PowerShell. +- `apps/persona-scheduler` is the resident daemon organ that owns the serialized Persona wall-clock pulse on Yggdrasil. It invokes the remaining turn orchestrator without overlap and remains alive between pulses. `apps/persona-scheduler/src/initiative-engine.ts` owns the pure scheduling state machine: participant reconciliation, deterministic base speed/bias/threshold derivation, operator heat/speed projection, semantic-pressure commits, wall-clock advancement, active-turn freeze/completion recovery, queue-success/failure/dry-run commits, stale rescheduling, pending-mention priority, rest/idle eligibility, and ready ordering. Explicit blocked/withdrawn status, active load, semantic receipts, and initiative position survive reconciliation; new Faces without a usable mouth fail closed. `apps/persona-scheduler/src/state-store.ts` owns scheduler persistence and legacy migration. It stores one typed `voidbot.persona_scheduler_state` record in `repo-face-heartbeats.cc`, migrates the former JSON document once with a `storage_migrated` witness, rejects malformed CultCache instead of replacing it, and writes JSON only as a derived dashboard/debug projection. `packages/core/src/repo-face-heartbeat-queue.ts` resolves both legacy `.json` configuration and current `.cc` configuration to the same canonical path; the Discord bot publishes one immutable `voidbot.persona_attention_command` CultCache inbox document per addressed message. The scheduler store ingests and deduplicates those commands, persists them as pending attention, then acknowledges inbox files only after the durable commit; a crash before acknowledgement replays safely. `apps/persona-scheduler/src/active-turn-source.ts` owns the Postgres/legacy-lock liveness adapter. It recognizes only Persona turn request IDs, applies the bounded stale threshold, marks dead queue claims failed, and returns active/stale witnesses; it never writes scheduler state. `apps/persona-scheduler/src/persona-state-source.ts` owns read-only typed Persona-state acquisition and present-time physiology projection. It reports typed mind plus rest facts without creating missing state or writing sleep/speaking-pressure state; the initiative engine alone applies rest eligibility. `apps/persona-scheduler/src/persona-memory-context-source.ts` owns the derived vector refresh and semantic recall query for one supplied typed Mind observation. It returns typed hits/unavailability and cannot reacquire canonical state, render prompt prose, or queue work. `apps/persona-scheduler/src/persona-memory-projector.ts` owns deterministic/model projection policy, its prompt template, output sufficiency, and leak rejection through an injected text-model port. It cannot acquire state, retrieve vectors, or queue work. `apps/persona-scheduler/src/discord-activity-source.ts` owns neutral Discord activity acquisition: it deduplicates explicit watched channels, excludes bot traffic, reports raw human messages, and derives idle-cooling times from scheduler history without writing state or selecting work. `apps/persona-scheduler/src/semantic-pressure-source.ts` owns embedding-backed affinity observation and returns bounded projections for eligible Personas and permitted channels. It cannot mutate initiative; `initiative-engine.ts` alone applies pressure, dynamic heat, interrupt readiness, dedupe receipts, and transition history. `apps/persona-scheduler/src/turn-context-source.ts` owns current-room and nearby-channel Discord evidence plus the bounded image-attachment cache. It returns chronological source messages and explicit snapshot failure witnesses; it has no access to Persona state, prompt composition, or the job queue. `scripts/run-repo-face-heartbeats.ts` projects the identity registry into neutral participant specs and affinity candidates, still builds the deterministic Persona state packet, renders typed source observations, and invokes external queue actuators pending further extraction. External adapters report facts; only the initiative engine mutates load, counters, recovery position, pressure, and queue-transition history. Repo Faces and native Personas queue ordinary `repo-face-rumination` jobs through the canonical job queue. Built-in Void participates only when its separate moderation heartbeat organ is enabled; the hosted scheduler does not launch Windows PowerShell. - `apps/persona-scheduler/src/bifrost-governance-source.ts` owns the remaining Bifrost governance digest subprocess contract. It supplies the CLI path, arguments, timeout, JSON parsing, and typed command/parse failure topics; Persona prompt composition receives a `BifrostGovernanceDigest` and cannot invoke Bifrost directly. - The scheduler state has one write authority. `initiative-engine.ts` commits participant reconciliation, operator controls, pause/disabled skips, stale-turn recovery witnesses, semantic pressure, pending-attention consumption, queue outcomes, and tick finalization. `run-repo-face-heartbeats.ts` contains no direct participant/state assignment or history append; its sources and actuators return facts to engine commits. - `apps/persona-scheduler/src/turn-actuator.ts` is the worker-queue output port. Given a completed prompt, output channel, evidence fields, provider, identity, timestamp, and narrow `createJob` capability, it builds the canonical worker actor/guild `ContextBundle`, creates one approved `repo-face-rumination` job, and returns `{created, activeJobId, requestMessageId}`. It cannot choose a Persona, mutate scheduler state, or compose prompt content. The orchestration shell no longer knows `ContextBuilder`, job approval defaults, worker command names, or `createJob` mechanics. diff --git a/scripts/run-repo-face-heartbeats.ts b/scripts/run-repo-face-heartbeats.ts index 589909a..64445c5 100644 --- a/scripts/run-repo-face-heartbeats.ts +++ b/scripts/run-repo-face-heartbeats.ts @@ -62,6 +62,7 @@ import { readPersonaMemoryRecall, type PersonaMemoryRecallObservation, } from "../apps/persona-scheduler/dist/persona-memory-context-source.js"; +import { projectPersonaMemorySurface } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; import { readDiscordActivitySnapshot, type IdleCoolingSnapshot, @@ -878,13 +879,26 @@ async function renderRepoFaceMemorySurfaceForTurn( curiosityGraphFacts, ); if (!config.repoFaceHeartbeats.stateProjectorEnabled) { - return rejectLeakyMemorySurface(statePacket); + return projectPersonaMemorySurface({ + identityId: identity.id, + characterIdentity: renderRepoCharacterIdentityDoctrine(identity), + statePacket, + modelProjectionEnabled: false, + }); } - return projectRepoFaceMemorySurface({ - identity, + return projectPersonaMemorySurface({ + identityId: identity.id, + characterIdentity: renderRepoCharacterIdentityDoctrine(identity), statePacket, - config, + modelProjectionEnabled: true, + projectText: (prompt) => runCodexTextProjection({ + prompt, + config, + command: "repo-face-state-projector", + jobId: `state-projector:${identity.id}:${Date.now()}`, + timeoutMs: 180_000, + }), }); } @@ -950,12 +964,25 @@ async function renderNativePersonaMemorySurface( humanPronounGuidance, ); if (!config.repoFaceHeartbeats.stateProjectorEnabled) { - return rejectLeakyMemorySurface(statePacket); + return projectPersonaMemorySurface({ + identityId: identity.id, + characterIdentity: renderRepoCharacterIdentityDoctrine(identity), + statePacket, + modelProjectionEnabled: false, + }); } - return projectRepoFaceMemorySurface({ - identity, + return projectPersonaMemorySurface({ + identityId: identity.id, + characterIdentity: renderRepoCharacterIdentityDoctrine(identity), statePacket, - config, + modelProjectionEnabled: true, + projectText: (prompt) => runCodexTextProjection({ + prompt, + config, + command: "repo-face-state-projector", + jobId: `state-projector:${identity.id}:${Date.now()}`, + timeoutMs: 180_000, + }), }); } @@ -2912,47 +2939,6 @@ function joinAsNarrativeList(items: string[]): string { return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`; } -function rejectLeakyMemorySurface(surface: string): string { - const leaks = [ - /\bgrants:/i, - /\bjurisdictions:/i, - /\bFace of\s+[A-Z][A-Za-z0-9_-]+\b/, - /\brepo=[^\s]+/i, - /\bpath=[^\s]+/i, - /\bdo not prompt\b/i, - /\bprompt (?:her|him|them|it)\b/i, - ]; - - if (leaks.some((pattern) => pattern.test(surface))) { - throw new Error("Repo Face memory surface leaked schema or prompt-construction language."); - } - - return surface; -} - -async function projectRepoFaceMemorySurface(input: { - identity: RepoDiscordIdentity; - statePacket: string; - config: ReturnType; -}): Promise { - const prompt = loadPromptTemplate("repo-face-state-projector.prompt.md", { - characterIdentity: renderRepoCharacterIdentityDoctrine(input.identity), - statePacket: input.statePacket, - }); - const output = await runCodexTextProjection({ - prompt, - config: input.config, - command: "repo-face-state-projector", - jobId: `state-projector:${input.identity.id}:${Date.now()}`, - timeoutMs: 180_000, - }); - const projected = output.trim(); - if (projected.length < 80) { - throw new Error(`Repo Face state projector returned too little text for ${input.identity.id}.`); - } - return rejectLeakyMemorySurface(projected); -} - function renderRepoFaceConversationTranscript(input: { identity: RepoDiscordIdentity; recentMessages: SourceMessage[]; diff --git a/scripts/smoke-persona-initiative-engine.ts b/scripts/smoke-persona-initiative-engine.ts index e8aa83e..74694f2 100644 --- a/scripts/smoke-persona-initiative-engine.ts +++ b/scripts/smoke-persona-initiative-engine.ts @@ -65,6 +65,7 @@ import { import { readRepoActivity } from "../apps/persona-scheduler/dist/repo-activity-source.js"; import { readPersonaStateObservation } from "../apps/persona-scheduler/dist/persona-state-source.js"; import { readPersonaMemoryRecall } from "../apps/persona-scheduler/dist/persona-memory-context-source.js"; +import { projectPersonaMemorySurface } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; function participant(identityId: string, nextTurnAt: number): InitiativeParticipant { return { @@ -444,6 +445,18 @@ assert.deepEqual(await readPersonaMemoryRecall({ status: "unavailable", reason: "No typed Persona state observation was supplied.", }, "semantic recall fails explicitly before touching vector infrastructure when the typed Mind observation is absent"); +assert.equal(await projectPersonaMemorySurface({ + identityId: "nibu", + characterIdentity: "Nibu", + statePacket: "Nibu remembers the ship mind and remains irritated by careless continuity.", + modelProjectionEnabled: false, +}), "Nibu remembers the ship mind and remains irritated by careless continuity.", "disabled model projection returns the validated deterministic memory surface without invoking a model"); +await assert.rejects(projectPersonaMemorySurface({ + identityId: "nibu", + characterIdentity: "Nibu", + statePacket: "path=private-state", + modelProjectionEnabled: false, +}), /leaked schema/, "the projector rejects state-path leakage on the model-free path"); const stateSourceDirectory = await mkdtemp(join(tmpdir(), "voidbot-persona-state-source-")); try { const statePath = join(stateSourceDirectory, "nibu.cc"); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 5ea9d6e..33296ed 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -413,3 +413,4 @@ {"ts":"2026-07-15T23:33:06Z","type":"implementation","status":"ok","note":"Separated the resident one-minute observation pulse from Persona speech cadence: initiative selection now admits at most one unprompted turn per configured recovery window regardless of idle-rest state, while direct mentions bypass the cadence. Smoke covers active-room and idle-disabled negative paths."} {"ts":"2026-07-15T23:41:50Z","type":"implementation","status":"ok","note":"Extracted read-only Persona Body/Mind acquisition into persona-state-source.ts. Scheduler pulses now project current rest facts without writing sleep cycles or synthetic speaking pressure; memory rendering consumes the acquired typed observation. Smoke proves missing observation creates no file and existing .cc bytes remain unchanged."} {"ts":"2026-07-15T23:50:14Z","type":"implementation","status":"ok","note":"Extracted semantic Persona-memory vector refresh/query into persona-memory-context-source.ts. It consumes the existing PersonaStateObservation, returns typed hits/unavailability, and cannot reload canonical .cc state or render prompt prose. Deleted vector-store and recall-query mechanics from the heartbeat shell; smoke proves missing Mind fails before vector access."} +{"ts":"2026-07-16T00:00:35Z","type":"implementation","status":"ok","note":"Extracted Persona memory projection policy into persona-memory-projector.ts. One boundary now owns deterministic/model selection, projector prompt construction, minimum output, and schema/path leak rejection through an injected text-model port; repo Faces and typed native Personas share it. Smoke proves model-free projection and negative leak rejection."} diff --git a/state/map.yaml b/state/map.yaml index 5d5a40e..32b4e64 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -65,7 +65,7 @@ active_subgoals: - Treat `notes/agent-swarm-teardown-plan-2026-05-21.md` as the historical teardown authority and the restart checklist. The repo Face swarm is live again, but only because the scheduler, prompt, model-output logs, parent Interpreter, Bifrost routing, and worker side-effect rails now have explicit observable boundaries. Keep watching for prompt/parser/transport Jenga before adding new swarm features. - 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. - - The resident `apps/persona-scheduler` process inside `voidbot.service` owns repo Face and native Persona turn pulses on Yggdrasil. Its `initiative-engine.ts` owns participant reconciliation, operator heat/speed projection, semantic-pressure commits, wall-clock advancement, active-turn freeze/completion recovery, queue-result commits, stale rescheduling, mention priority, rest/idle eligibility, and ready-order selection as a pure state machine. `state-store.ts` is the sole persistence/migration port: canonical state is one typed `voidbot.persona_scheduler_state` record in `repo-face-heartbeats.cc`; the old JSON shape is accepted only as a one-time migration source and emitted afterward only as a debug/dashboard projection. Missing state is explicit, malformed CultCache fails closed, and the backing store promotes atomic MessagePack writes. Discord attention crosses through immutable per-mention `voidbot.persona_attention_command` CultCache inbox documents resolved from that same canonical path; the bot creates commands, while the scheduler alone ingests, deduplicates, commits, and acknowledges them after durable state. The bot can no longer read-modify-write the whole heartbeat state. `active-turn-source.ts` is the narrow Postgres/legacy-lock adapter: it reports active job witnesses and marks truly stale queue claims failed, but it cannot mutate initiative. `persona-state-source.ts` owns read-only typed Persona-state acquisition and wall-clock physiology projection. It reports typed mind and current rest facts without creating a missing state surface or writing sleep/speaking-pressure updates; `initiative-engine.ts` alone decides whether those rest facts admit a turn. `persona-memory-context-source.ts` consumes that observation, refreshes only the derived per-Persona vector corpus, runs semantic recall, and returns structured hits or an explicit unavailable observation; it cannot reload or mutate canonical Persona state, render prompt prose, select, or queue. `discord-activity-source.ts` owns read-only Discord human-activity observation and idle-window derivation from explicit watched channels plus scheduler history; it cannot mutate initiative, consume attention, or select work. `semantic-pressure-source.ts` embeds eligible Persona affinity cards against recent permitted human messages and returns bounded pressure projections; only `initiative-engine.ts` may turn those facts into dynamic heat, readiness, interrupt receipts, or history. `turn-context-source.ts` owns raw current-room and nearby-channel Discord acquisition plus its bounded derived attachment cache; it returns chronological evidence and explicit snapshot failures without reading Persona state, composing prompts, or queuing work. The heartbeat orchestration script may project registered identities into neutral participant specs and affinity candidates, render source observations into prompt surfaces, and report external actuator results, but it cannot decide, persist, migrate, inspect queue liveness, poll Discord, operate vector stores, commit semantic pressure, mutate Persona physiology, or overwrite initiative fields. The Windows `GameCult Local Orchestrator` no longer owns Persona scheduling, and its repo-Face task installer/wrapper have been deleted. Void moderation, mood, watchdog, and Bifrost dispatch remain separate organs pending their own daemon migration; they must not be smuggled back into the Persona scheduler. + - The resident `apps/persona-scheduler` process inside `voidbot.service` owns repo Face and native Persona turn pulses on Yggdrasil. Its `initiative-engine.ts` owns participant reconciliation, operator heat/speed projection, semantic-pressure commits, wall-clock advancement, active-turn freeze/completion recovery, queue-result commits, stale rescheduling, mention priority, rest/idle eligibility, and ready-order selection as a pure state machine. `state-store.ts` is the sole persistence/migration port: canonical state is one typed `voidbot.persona_scheduler_state` record in `repo-face-heartbeats.cc`; the old JSON shape is accepted only as a one-time migration source and emitted afterward only as a debug/dashboard projection. Missing state is explicit, malformed CultCache fails closed, and the backing store promotes atomic MessagePack writes. Discord attention crosses through immutable per-mention `voidbot.persona_attention_command` CultCache inbox documents resolved from that same canonical path; the bot creates commands, while the scheduler alone ingests, deduplicates, commits, and acknowledges them after durable state. The bot can no longer read-modify-write the whole heartbeat state. `active-turn-source.ts` is the narrow Postgres/legacy-lock adapter: it reports active job witnesses and marks truly stale queue claims failed, but it cannot mutate initiative. `persona-state-source.ts` owns read-only typed Persona-state acquisition and wall-clock physiology projection. It reports typed mind and current rest facts without creating a missing state surface or writing sleep/speaking-pressure updates; `initiative-engine.ts` alone decides whether those rest facts admit a turn. `persona-memory-context-source.ts` consumes that observation, refreshes only the derived per-Persona vector corpus, runs semantic recall, and returns structured hits or an explicit unavailable observation; it cannot reload or mutate canonical Persona state, render prompt prose, select, or queue. `persona-memory-projector.ts` owns the deterministic-versus-model projection choice, projector prompt contract, minimum-output invariant, and schema/path leak rejection through an injected text-model port. It cannot acquire state, retrieve vectors, or queue turns. `discord-activity-source.ts` owns read-only Discord human-activity observation and idle-window derivation from explicit watched channels plus scheduler history; it cannot mutate initiative, consume attention, or select work. `semantic-pressure-source.ts` embeds eligible Persona affinity cards against recent permitted human messages and returns bounded pressure projections; only `initiative-engine.ts` may turn those facts into dynamic heat, readiness, interrupt receipts, or history. `turn-context-source.ts` owns raw current-room and nearby-channel Discord acquisition plus its bounded derived attachment cache; it returns chronological evidence and explicit snapshot failures without reading Persona state, composing prompts, or queuing work. The heartbeat orchestration script may project registered identities into neutral participant specs and affinity candidates, build the still-unextracted deterministic state packet, render source observations into prompt surfaces, and report external actuator results, but it cannot decide, persist, migrate, inspect queue liveness, poll Discord, operate vector stores, own model-projection policy, commit semantic pressure, mutate Persona physiology, or overwrite initiative fields. The Windows `GameCult Local Orchestrator` no longer owns Persona scheduling, and its repo-Face task installer/wrapper have been deleted. Void moderation, mood, watchdog, and Bifrost dispatch remain separate organs pending their own daemon migration; they must not be smuggled back into the Persona scheduler. - `bifrost-governance-source.ts` owns the remaining Bifrost digest CLI adapter and converts command or parse failures into typed error topics. Persona prompt composition receives governance facts without knowing Bifrost process mechanics; `scripts/run-repo-face-heartbeats.ts` may not invoke the Bifrost CLI directly. - `initiative-engine.ts` is the only writer of scheduler state fields and history. Reconciliation, controls, pause/disabled skips, stale-turn recovery witnesses, semantic pressure, attention consumption, queue transitions, and tick finalization all cross named engine commit primitives. Queue/context actuators return results and cannot patch participants or history directly. - `turn-actuator.ts` owns lowering an assembled Persona prompt and evidence bundle into the canonical worker `ContextBundle` and approved `repo-face-rumination` job. It owns the worker actor, command, request ID, approval defaults, and `createJob` call, then returns only a queue receipt. The orchestration shell chooses no queue mechanics and the actuator cannot read Persona or initiative state. @@ -278,4 +278,4 @@ rejected_paths: current_status: summary: VoidBot's bot/worker/provider/RAG/Postgres/Qdrant/CultCache structure is live. Repo Face/persona heartbeat jobs run through the direct `openai_api` provider configured for MiMo `mimo-v2.5-pro`, with the expensive state-projector pass still disabled. The 2026-07-04 transport repair replaced the old Bifrost HTTP/token bridge shortcut with typed Bifrost CultMesh Discord command and receipt documents advertised in the Bifrost provider store at `cultmesh://asgard.starfire.bifrost/commands/discord-post`. VoidBot stores the Bifrost target as a CultMesh URI, writes command docs to `E:/Projects/Bifrost/.bifrost/provider-store.cc`, optionally pumps Bifrost's command processor, and waits for typed receipts before completing repo Face Discord delivery. Bifrost's provider advertisement exposes `discord.post` command metadata for Odin/Eve agents, and a bounded Weksa live-fire completed visibly. Eve live state now runs end to end through CultLib dev retained publications, Hermodr ordered SSE, Eve component bindings, and VoidBot typed control state. Receipts acknowledge intent only. Heat initial load, provider-driven change, and browser-command change were visibly verified without reload through the same subscription. - next_action: Extract character-facing Persona memory/state projection from `scripts/run-repo-face-heartbeats.ts` into a pure memory projector that consumes `PersonaStateObservation`, registry/social facts, and optional curiosity facts. It may render or invoke the configured projection model, but it cannot acquire state, operate vector stores, select initiative, or queue turns. + next_action: Move the deterministic `renderRepoFaceStatePacket` family from `scripts/run-repo-face-heartbeats.ts` into `persona-memory-projector.ts`. Pass registry/social, room-weather, human-clarity, self-maintenance, and optional curiosity facts explicitly; keep curiosity retrieval and Discord acquisition outside the projector.