From 562cc5dd322be42f5e54c8da625d312dce3ba1e3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 16 Jul 2026 01:22:02 +0100 Subject: [PATCH] Complete Persona memory packet ownership --- .../src/persona-memory-projector.ts | 62 ++++++++ notes/fresh-workspace-handoff.md | 1 + notes/voidbot-current-system-map.md | 2 +- scripts/run-repo-face-heartbeats.ts | 138 ++---------------- scripts/smoke-persona-initiative-engine.ts | 13 +- state/evidence.jsonl | 1 + state/map.yaml | 2 +- 7 files changed, 94 insertions(+), 125 deletions(-) diff --git a/apps/persona-scheduler/src/persona-memory-projector.ts b/apps/persona-scheduler/src/persona-memory-projector.ts index d8d6d1d..cb4e002 100644 --- a/apps/persona-scheduler/src/persona-memory-projector.ts +++ b/apps/persona-scheduler/src/persona-memory-projector.ts @@ -8,6 +8,68 @@ export interface PersonaTypedStateSections { statusMoodMemory: string[]; } +export function renderPersonaPressureSections(input: { + identityName: string; + state: VoidSelfStateTypedProjection; + clarityPressureActive: boolean; +}): string[] { + const { identityName: name, clarityPressureActive } = input; + const agency = [...input.state.agencyPressure.pressures].filter((entry) => entry.status !== "retired").sort(sortAffect); + const incubation = [...input.state.thoughtMemory.incubation].filter((entry) => entry.status !== "retired").sort((left, right) => right.maturation - left.maturation); + const candidates = [...input.state.candidateInterventions.interventions].filter((entry) => entry.status !== "retired").slice(-8).reverse(); + const receipts = [...input.state.speechReceipts.recentReceipts].slice(-6).reverse(); + const sections: string[] = []; + if (agency.length > 0) sections.push(clarityPressureActive + ? ["Agency pressures are currently demoted by live clarity pressure:", `- ${name} still has stored urges toward eventual motion, but the room has asked for plain understanding first. Do not expose the old detailed asks this turn; translate only the underlying value into simpler speech, repair, restraint, or silence.`].join("\n") + : ["Agency pressures that want eventual motion:", ...agency.map((pressure) => [`- ${pressure.kind} toward ${targetLabel(pressure.target)} [${pressure.status}, intensity ${pressure.intensity.toFixed(2)}]: ${sentence(pressure.summary)}`, pressure.claim ? `Claim: ${sentence(pressure.claim)}` : "", pressure.question ? `Question: ${sentence(pressure.question)}` : "", pressure.tension ? `Tension: ${sentence(pressure.tension)}` : "", `Behavioral pull: ${sentence(pressure.actionImplication)}`].filter(Boolean).join(" "))].join("\n")); + if (incubation.length > 0) sections.push(clarityPressureActive + ? ["Incubating thoughts are currently background only:", `- ${name} has unfinished thoughts, but live room confusion means they should not surface as new doctrine or terminology this turn.`].join("\n") + : ["Thoughts still moving under the floorboards:", ...incubation.map((thread) => [`- ${cleanSentence(thread.topic)} [${thread.status}, maturation ${thread.maturation.toFixed(2)}]: ${cleanSentence(thread.summary)}`, typeof thread.desireToSpeak === "number" ? `desire to speak ${thread.desireToSpeak.toFixed(2)}` : "", typeof thread.noveltyToRoom === "number" ? `room novelty ${thread.noveltyToRoom.toFixed(2)}` : "", typeof thread.saturationScore === "number" ? `saturation ${thread.saturationScore.toFixed(2)}` : ""].filter(Boolean).join("; "))].join("\n")); + if (candidates.length > 0) sections.push(clarityPressureActive + ? ["Deferred speech pressure is not authorized for public reuse right now:", `- ${name} has unsaid lines waiting, but the live room problem is intelligibility. Treat those lines as temptation to avoid, not as drafts to polish.`].join("\n") + : ["Unsaid or recently deferred speech pressure:", ...candidates.map((entry) => [`- ${entry.kind} [${entry.status}, priority ${entry.priority.toFixed(2)}${entry.mustEventuallyShare ? ", must eventually share" : ""}]: ${sentence(entry.summary)}`, `Draft residue: ${cleanSentence(entry.draft)}`].join(" ")), "Do not repeat a waiting line unless the room gives it a sharper angle."].join("\n")); + if (receipts.length > 0) sections.push(clarityPressureActive + ? ["Recent speech residue should create caution only:", `- ${name} has recent public wording in the room, but a human clarity request means the exact phrasing should not be echoed or treated as successful style.`].join("\n") + : ["Recent speech residue:", ...receipts.map((receipt) => `- Said recently${receipt.preview ? `: ${cleanSentence(receipt.preview)}` : "."} Let this create repetition caution, confidence, embarrassment, or follow-through as appropriate.`)].join("\n")); + return sections; +} + +export function composePersonaMemoryPacket(input: { + identityName: string; + typed: PersonaTypedStateSections; + relationshipFreshness?: string; + socialGraph?: string; + peerOpening?: string; + socialPressure?: string; + pronouns?: string; + roomTexture?: string; + curiosity?: string; + selfMaintenance?: string; + pressureSections: string[]; + humanClarity?: string; + transformSurface?: (surface: string) => string; +}): string { + const sections = [ + ...input.typed.opening, + ...input.typed.needs, + ...input.typed.bonds, + input.relationshipFreshness, + ...input.typed.statusMoodMemory, + input.socialGraph, + input.peerOpening, + input.socialPressure, + input.pronouns, + input.roomTexture, + input.curiosity, + input.selfMaintenance, + ...input.pressureSections, + input.humanClarity, + ].filter((section): section is string => Boolean(section)); + if (sections.length === 0) return `You are ${input.identityName}, but your durable state is thin. Use the room, repo, and your jurisdiction to form a real opinion before speaking.`; + const surface = sections.join("\n\n"); + return validatePersonaMemorySurface(input.transformSurface ? input.transformSurface(surface) : surface); +} + export function renderPersonaTypedStateSections(input: { identityName: string; state: VoidSelfStateTypedProjection; diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index bc6f82f..3f3081c 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -153,6 +153,7 @@ Git history and smoke artifacts carry routine proof. `state/evidence.jsonl` shou - 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. - The pure typed-state core of that packet now also lives in `persona-memory-projector.ts`: private identity texture, activation vectors, runtime/rest/speaking pressure, needs, bonds, status reads, mood dimensions, and durable/short-term memories. The shell still owns agency/incubation/candidate/receipt rendering and the ordering of externally acquired social, room, clarity, maintenance, and curiosity facts; those are the remaining packet-builder debris. +- `persona-memory-projector.ts` now owns the full typed-state packet contract, including clarity-conditioned agency pressure, incubation, deferred speech, recent receipts, final ordering of named external fact sections, final vocabulary transformation, and leak validation. Prompt assembly parity is covered by `--assemble-prompt nibu` producing the same 153,917-character prompt before and after the cut. The shell still computes social/relationship/room/clarity/maintenance fact strings; moving those pure renderers behind a social-context projection boundary is next. - 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 67d0c2d..4669655 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/persona-memory-projector.ts` owns deterministic/model projection policy, its prompt template, output sufficiency, leak rejection, and the pure typed-state core sections: identity texture, activation/runtime pressure, needs, bonds, status, mood, and durable/short-term memory. 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 composes externally acquired facts with the remaining agency/incubation/candidate/receipt sections, 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` 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, leak rejection, all typed-state sections including clarity-conditioned agency/incubation/candidate/receipt pressure, and final ordering of named external fact sections. 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, computes the still-unextracted social/relationship/room/clarity/maintenance fact strings, passes them by name to the projector, 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 d849d12..160e235 100644 --- a/scripts/run-repo-face-heartbeats.ts +++ b/scripts/run-repo-face-heartbeats.ts @@ -62,7 +62,7 @@ import { readPersonaMemoryRecall, type PersonaMemoryRecallObservation, } from "../apps/persona-scheduler/dist/persona-memory-context-source.js"; -import { projectPersonaMemorySurface, renderPersonaTypedStateSections, validatePersonaMemorySurface } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; +import { composePersonaMemoryPacket, projectPersonaMemorySurface, renderPersonaPressureSections, renderPersonaTypedStateSections } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; import { readDiscordActivitySnapshot, type IdleCoolingSnapshot, @@ -1120,160 +1120,54 @@ function renderRepoFaceStatePacket( curiosityGraphFacts?: string, ): string { const name = identity.displayName; - const lines: string[] = []; const needs = [...state.faceAffect.needs] .filter((need) => need.status !== "retired") .sort(sortAffectByStatusAndIntensity); const agencyPressures = [...state.agencyPressure.pressures] .filter((pressure) => pressure.status !== "retired") .sort(sortAffectByStatusAndIntensity); - const incubation = [...state.thoughtMemory.incubation] - .filter((thread) => thread.status !== "retired") - .sort((left, right) => right.maturation - left.maturation); const candidateInterventions = [...state.candidateInterventions.interventions] .filter((intervention) => intervention.status !== "retired") .slice(-8) .reverse(); - const recentReceipts = [...state.speechReceipts.recentReceipts] - .slice(-6) - .reverse(); const typedSections = renderPersonaTypedStateSections({ identityName: name, state }); const humanClarityFacts = roomContext ? renderRepoFaceHumanClarityPressureFacts(identity, roomContext) : undefined; const clarityPressureActive = Boolean(humanClarityFacts); - lines.push(...typedSections.opening, ...typedSections.needs, ...typedSections.bonds); - const relationshipFreshnessFacts = renderRepoFaceRelationshipFreshnessFacts(name, state, registryIdentities); - if (relationshipFreshnessFacts) { - lines.push(relationshipFreshnessFacts); - } - - lines.push(...typedSections.statusMoodMemory); - const socialGraphFacts = renderRepoFaceSocialGraphFacts(identity, registryIdentities, state); - if (socialGraphFacts) { - lines.push(socialGraphFacts); - } - const peerOpeningFacts = roomContext ? renderRepoFacePeerOpeningFacts(identity, registryIdentities, roomContext) : undefined; - if (peerOpeningFacts) { - lines.push(peerOpeningFacts); - } - const socialPressureFacts = roomContext ? renderRepoFaceRelationshipPressureFacts(identity, registryIdentities, state, roomContext) : undefined; - if (socialPressureFacts) { - lines.push(socialPressureFacts); - } - const pronounFacts = renderRepoFaceHumanPronounFacts(humanPronounGuidance); - if (pronounFacts) { - lines.push(pronounFacts); - } - const roomTextureFacts = roomContext ? renderRepoFaceRoomTextureFacts(identity, roomContext) : undefined; - if (roomTextureFacts) { - lines.push(roomTextureFacts); - } - - if (curiosityGraphFacts) { - lines.push(curiosityGraphFacts); - } const selfMaintenancePressureFacts = !clarityPressureActive ? renderRepoFaceSelfMaintenancePressureFacts(name, agencyPressures, needs, candidateInterventions) : undefined; - if (selfMaintenancePressureFacts) { - lines.push(selfMaintenancePressureFacts); - } - if (agencyPressures.length > 0 && !clarityPressureActive) { - lines.push([ - "Agency pressures that want eventual motion:", - ...agencyPressures.map((pressure) => - [ - `- ${pressure.kind} toward ${targetLabel(pressure.target)} [${pressure.status}, intensity ${pressure.intensity.toFixed(2)}]: ${asSentence(pressure.summary)}`, - pressure.claim ? `Claim: ${asSentence(pressure.claim)}` : "", - pressure.question ? `Question: ${asSentence(pressure.question)}` : "", - pressure.tension ? `Tension: ${asSentence(pressure.tension)}` : "", - `Behavioral pull: ${asSentence(pressure.actionImplication)}`, - ].filter(Boolean).join(" "), - ), - ].join("\n")); - } else if (agencyPressures.length > 0 && clarityPressureActive) { - lines.push([ - "Agency pressures are currently demoted by live clarity pressure:", - `- ${name} still has stored urges toward eventual motion, but the room has asked for plain understanding first. Do not expose the old detailed asks this turn; translate only the underlying value into simpler speech, repair, restraint, or silence.`, - ].join("\n")); - } - - if (incubation.length > 0 && !clarityPressureActive) { - lines.push([ - "Thoughts still moving under the floorboards:", - ...incubation.map((thread) => - [ - `- ${cleanCharacterFacingSentence(thread.topic)} [${thread.status}, maturation ${thread.maturation.toFixed(2)}]: ${cleanCharacterFacingSentence(thread.summary)}`, - typeof thread.desireToSpeak === "number" ? `desire to speak ${thread.desireToSpeak.toFixed(2)}` : "", - typeof thread.noveltyToRoom === "number" ? `room novelty ${thread.noveltyToRoom.toFixed(2)}` : "", - typeof thread.saturationScore === "number" ? `saturation ${thread.saturationScore.toFixed(2)}` : "", - ].filter(Boolean).join("; "), - ), - ].join("\n")); - } else if (incubation.length > 0 && clarityPressureActive) { - lines.push([ - "Incubating thoughts are currently background only:", - `- ${name} has unfinished thoughts, but live room confusion means they should not surface as new doctrine or terminology this turn.`, - ].join("\n")); - } - - if (candidateInterventions.length > 0 && !clarityPressureActive) { - lines.push([ - "Unsaid or recently deferred speech pressure:", - ...candidateInterventions.map((intervention) => - [ - `- ${intervention.kind} [${intervention.status}, priority ${intervention.priority.toFixed(2)}${intervention.mustEventuallyShare ? ", must eventually share" : ""}]: ${asSentence(intervention.summary)}`, - `Draft residue: ${cleanCharacterFacingSentence(intervention.draft)}`, - ].join(" "), - ), - "Do not repeat a waiting line unless the room gives it a sharper angle.", - ].join("\n")); - } else if (candidateInterventions.length > 0 && clarityPressureActive) { - lines.push([ - "Deferred speech pressure is not authorized for public reuse right now:", - `- ${name} has unsaid lines waiting, but the live room problem is intelligibility. Treat those lines as temptation to avoid, not as drafts to polish.`, - ].join("\n")); - } - - if (recentReceipts.length > 0 && !clarityPressureActive) { - lines.push([ - "Recent speech residue:", - ...recentReceipts.map((receipt) => - `- Said recently${receipt.preview ? `: ${cleanCharacterFacingSentence(receipt.preview)}` : "."} Let this create repetition caution, confidence, embarrassment, or follow-through as appropriate.`, - ), - ].join("\n")); - } else if (recentReceipts.length > 0 && clarityPressureActive) { - lines.push([ - "Recent speech residue should create caution only:", - `- ${name} has recent public wording in the room, but a human clarity request means the exact phrasing should not be echoed or treated as successful style.`, - ].join("\n")); - } - - if (humanClarityFacts) { - lines.push(humanClarityFacts); - } - - if (lines.length === 0) { - return `You are ${name}, but your durable state is thin. Use the room, repo, and your jurisdiction to form a real opinion before speaking.`; - } - - return validatePersonaMemorySurface(cleanRepoFaceProjectorLoopVocabulary(identity, lines.join("\n\n"))); + return composePersonaMemoryPacket({ + identityName: name, + typed: typedSections, + relationshipFreshness: relationshipFreshnessFacts, + socialGraph: socialGraphFacts, + peerOpening: peerOpeningFacts, + socialPressure: socialPressureFacts, + pronouns: pronounFacts, + roomTexture: roomTextureFacts, + curiosity: curiosityGraphFacts, + selfMaintenance: selfMaintenancePressureFacts, + pressureSections: renderPersonaPressureSections({ identityName: name, state, clarityPressureActive }), + humanClarity: humanClarityFacts, + transformSurface: (surface) => cleanRepoFaceProjectorLoopVocabulary(identity, surface), + }); } function renderRepoFaceSelfMaintenancePressureFacts( diff --git a/scripts/smoke-persona-initiative-engine.ts b/scripts/smoke-persona-initiative-engine.ts index b4dcab5..68efeb7 100644 --- a/scripts/smoke-persona-initiative-engine.ts +++ b/scripts/smoke-persona-initiative-engine.ts @@ -65,7 +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, renderPersonaTypedStateSections } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; +import { composePersonaMemoryPacket, projectPersonaMemorySurface, renderPersonaPressureSections, renderPersonaTypedStateSections } from "../apps/persona-scheduler/dist/persona-memory-projector.js"; function participant(identityId: string, nextTurnAt: number): InitiativeParticipant { return { @@ -483,6 +483,17 @@ try { ? renderPersonaTypedStateSections({ identityName: "Nibu", state: populatedObservation.typedState }) : undefined; assert.match(typedSections?.opening.join("\n") ?? "", /Speaking pressure:/, "the projector owns typed runtime-pressure presentation without acquiring Persona state"); + const pressureSections = populatedObservation.status === "ok" + ? renderPersonaPressureSections({ identityName: "Nibu", state: populatedObservation.typedState, clarityPressureActive: true }) + : []; + const composedMemory = typedSections && composePersonaMemoryPacket({ + identityName: "Nibu", + typed: typedSections, + socialGraph: "Explicit social graph fact.", + roomTexture: "Explicit room texture fact.", + pressureSections, + }); + assert.match(composedMemory ?? "", /Explicit social graph fact\.[\s\S]*Explicit room texture fact\./, "the projector owns final ordering of explicitly supplied external facts"); assert.deepEqual(await readFile(statePath), beforeObservation, "Persona state observation cannot rewrite sleep, speaking pressure, or any other Mind field"); } finally { await rm(stateSourceDirectory, { recursive: true, force: true }); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 209e4d0..b7d2368 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -415,3 +415,4 @@ {"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."} {"ts":"2026-07-16T00:11:13Z","type":"implementation","status":"ok","note":"Moved the pure typed Persona-state core into persona-memory-projector.ts: identity texture, activation/runtime pressure, needs, bonds, status, mood, and durable/short-term memory. Deleted duplicate shell renderers and repaired the stale leak-validator reference. Execution-level --assemble-prompt nibu succeeded under file storage, covering the script path that tsc -b omits."} +{"ts":"2026-07-16T00:21:54Z","type":"implementation","status":"ok","note":"Moved clarity-conditioned agency/incubation/candidate/receipt rendering and final named external-fact ordering into persona-memory-projector.ts. The shell now senses social/room/clarity/maintenance facts and passes them explicitly. Prompt assembly remained byte-length equivalent at 153917 characters; smoke covers explicit external-fact ordering."} diff --git a/state/map.yaml b/state/map.yaml index 67d1915..c071988 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -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: Move agency-pressure, incubation, candidate-intervention, and recent-speech sections into `persona-memory-projector.ts`, parameterized by the externally observed `clarityPressureActive` fact. Then make the shell pass social/room/clarity/maintenance/curiosity sections explicitly into a final projector-owned composition primitive. + next_action: Extract social/room fact projection from `scripts/run-repo-face-heartbeats.ts` into a pure Persona social-context projector consuming typed state, registry identities, raw `turn-context-source` observations, and human-pronoun guidance. Keep Discord acquisition in `turn-context-source.ts`, curiosity retrieval in its source, and final packet ordering in `persona-memory-projector.ts`.