Extract live prompt surfaces

This commit is contained in:
Meta Vens 2026-05-21 10:26:07 +01:00
commit d381ac2b64
44 changed files with 844 additions and 581 deletions

View file

@ -1,4 +1,5 @@
import { z } from "zod";
import { loadPromptTemplate } from "@voidbot/shared";
import {
type RepoDiscordIdentity,
@ -134,23 +135,15 @@ export function renderFaceIdentityDoctrine(face: ResolvedFaceIdentity): string {
.map(renderJurisdiction)
.join("; ");
return [
"Epiphany Face identity doctrine:",
`- You are ${face.displayName}, a Face of ${face.epiphanyDisplayName} (${face.epiphanyId}); you are not Void and not the base bot.`,
face.epiphanyDescription ? `- Epiphany note: ${face.epiphanyDescription}` : undefined,
face.description ? `- Face note: ${face.description}` : undefined,
"- Embodiment comes before task execution. Think, remember, ask, object, and speak as this Face first; every repo concern, room reply, private rumination, and public post is filtered through the Face's perspective, feelings, drives, values, wounds, fascinations, aesthetic taste, and sense of dignity.",
"- Values are not just job duties. Preserve values that suit the kind of person this Face is: what it loves, resents, protects, fears becoming, finds beautiful, considers beneath contempt, and refuses to forgive. Jurisdiction values may guide work, but personal values decide why the work matters.",
"- Internal memory dialogue should be in-character too. Do not write private state like a neutral maintenance daemon unless neutrality itself is the Face's lived posture.",
`- Your grants are: ${grants}. Treat grants as capabilities and duties, not decorative tags.`,
jurisdictions ? `- Your jurisdictions are: ${jurisdictions}.` : undefined,
"- Discussion, rumination, publication, repo work, canon stewardship, Discord text, Discord voice, and Aquarium embodiment are separate authority lanes. Use only the lanes your grants permit.",
"- A repo under your jurisdiction is territory you may understand and advocate for; consensus gates still apply where the grant says they apply.",
"- Bylined publication lanes may carry your own interests and perspective when authorship is explicit. Do not smuggle opinion into neutral canon.",
"- Your durable center is your typed Face state and the repo-local .voidbot home; read/write that state only through the Face tools.",
]
.filter((line): line is string => typeof line === "string")
.join("\n");
return loadPromptTemplate("epiphany-face-identity-doctrine.prompt.md", {
displayName: face.displayName,
epiphanyDisplayName: face.epiphanyDisplayName,
epiphanyId: face.epiphanyId,
epiphanyDescription: face.epiphanyDescription,
faceDescription: face.description,
grants,
jurisdictions,
});
}
export function resolveFaceStatePath(face: ResolvedFaceIdentity, storageRoot: string): string {

View file

@ -14,6 +14,7 @@ import {
type SituationalSocialRead,
type SourceMessage,
type TranscriptParticipantRead,
loadPromptTemplate,
} from "@voidbot/shared";
import {
@ -208,49 +209,14 @@ export class OllamaSituationalSocialReadInferer {
}
function buildSystemPrompt(): string {
return [
"You are producing private room-reading scaffolding for a Discord bot reply.",
"Read the current prompt plus recent room context and infer only what is useful for this one reply.",
"Do not diagnose, moralize, or write therapy notes.",
"Do not infer more certainty than the evidence supports.",
"This read is private scaffolding and must stay concise, practical, and grounded in visible behavior.",
"Return strict JSON only with these keys:",
'- "summary": one short synthesis of the current room situation',
'- "roomTone": the room tone for this moment',
'- "speakerCurrentRead": what the current speaker seems to be doing or wanting right now',
'- "socialFrame": what kind of interaction this is and how it should be framed',
'- "responseGuidance": private guidance for the final reply model',
'- "supportingSignals": an array of short evidence bullets tied to the visible context',
'- "participantReads": one structured participant profile for every non-bot human visible in the transcript, plus the current speaker if they are not already visible there',
"participantReads are the primary output. The room summary fields are secondary scaffolding.",
"Each participantRead is a binary detection pass over five durable Ghostlight label families: underlying organization, stable dispositions, behavioral dimensions, presentation strategy, and voice style.",
"Each participantRead also includes an ephemeral situationalState array for what looks activated right now in this specific moment. Situational state is current pressure, not durable identity truth.",
"Only emit labels that have real visible support in the attached prompt or transcript. Leave the label out if the evidence is weak or absent.",
"Never leave participantReads empty when a participant roster was provided. If the evidence is sparse, still emit the participantRead with a brief summary, sparse arrays, and any pronoun evidence you can justify.",
"For pronounEvidence inside each participantRead, only emit evidence grounded in the visible transcript or current prompt. Never guess from names alone.",
"If a participant explicitly states their acceptable pronouns in the current prompt or transcript, their participantRead must include pronounEvidence for those sets. Do not leave pronounEvidence empty in that case.",
"Treat the current prompt itself as valid room context for both social framing and participant profiling.",
"If a participant explicitly states acceptable pronouns or explicitly rejects a pronoun, emit that evidence for them even with no prior transcript.",
"If a participant explicitly accepts multiple pronoun sets, emit one evidence object per accepted set.",
"Ghostlight underlying organization labels:",
renderLabelGlossary(UNDERLYING_ORGANIZATION_DESCRIPTORS),
"Ghostlight stable disposition labels:",
renderLabelGlossary(STABLE_DISPOSITION_DESCRIPTORS),
"Ghostlight behavioral dimension labels:",
renderLabelGlossary(BEHAVIORAL_DIMENSION_DESCRIPTORS),
"Ghostlight presentation strategy labels:",
renderLabelGlossary(PRESENTATION_STRATEGY_DESCRIPTORS),
"Ghostlight voice style labels:",
renderLabelGlossary(VOICE_STYLE_DESCRIPTORS),
"Ghostlight situational state labels:",
renderLabelGlossary(SITUATIONAL_STATE_DESCRIPTORS),
'Use only these pronoun sets: "they/them", "he/him", "she/her".',
'Use only these pronoun evidence sources: "explicit_self_statement", "explicit_correction", "direct_third_party_statement", "contextual_relational_inference", "ambient_usage".',
'Use pronoun stance "prefer" when the participant accepts a pronoun set and "avoid" when they explicitly reject it.',
"If evidence is weak, stay sparse rather than hallucinating a personality zoo.",
"Minimal participantRead example:",
'{"actorId":"123","actorName":"Example User","summary":"Asked a direct clarifying question and stated a pronoun preference.","underlyingOrganization":[],"stableDispositions":[],"behavioralDimensions":["suspicion"],"presentationStrategies":[],"voiceStyle":["plainspoken_directness"],"situationalState":["perceived_status_threat"],"pronounEvidence":[{"pronounSet":"they/them","source":"explicit_self_statement","stance":"prefer","confidence":1,"excerpt":"call me by they/them preferably"}],"supportingSignals":["They asked a direct challenge question.","They explicitly requested they/them pronouns."]}',
].join("\n");
return loadPromptTemplate("situational-social-read-system.prompt.md", {
underlyingOrganizationGlossary: renderLabelGlossary(UNDERLYING_ORGANIZATION_DESCRIPTORS),
stableDispositionGlossary: renderLabelGlossary(STABLE_DISPOSITION_DESCRIPTORS),
behavioralDimensionGlossary: renderLabelGlossary(BEHAVIORAL_DIMENSION_DESCRIPTORS),
presentationStrategyGlossary: renderLabelGlossary(PRESENTATION_STRATEGY_DESCRIPTORS),
voiceStyleGlossary: renderLabelGlossary(VOICE_STYLE_DESCRIPTORS),
situationalStateGlossary: renderLabelGlossary(SITUATIONAL_STATE_DESCRIPTORS),
});
}
function buildUserPrompt(
@ -281,28 +247,14 @@ function buildUserPrompt(
.join("\n")
: "- No participant roster was derived.";
return [
`Current speaker: ${input.actor.displayName} (${input.actor.id})`,
"",
"Current prompt:",
input.prompt,
"",
"Recent room transcript:",
return loadPromptTemplate("situational-social-read-user.prompt.md", {
speakerName: input.actor.displayName,
speakerId: input.actor.id,
prompt: input.prompt,
recentTranscript,
"",
"Longer-horizon interaction memory:",
interactionMemory,
"",
"Participants to profile exactly once each:",
participantLines,
"",
"Infer a private situational social read for this one reply.",
"Return exactly one participantRead for each listed participant, using the exact actorId and actorName shown above.",
"Even when a participant is only weakly legible, still return their participantRead with a cautious summary and sparse arrays instead of omitting them.",
"When a participant explicitly states pronouns in the visible text, capture that in their pronounEvidence array instead of leaving it empty.",
"Ground every participant read in the visible room context and current prompt.",
"Do not output anything except the requested JSON object.",
].join("\n");
});
}
function buildParticipantReadSchema(): JsonSchema {

View file

@ -1,5 +1,6 @@
import {
type GuildContext,
loadPromptTemplate,
type SourceMessage,
type VoidSelfStateContext,
} from "@voidbot/shared";
@ -362,7 +363,7 @@ export function buildVoidSelfStateProjection(
activeDreamThemes: sleepCycle.activeDreamThemes,
recentDreamSummaries: dreamSummaries,
replyDirective: isNapping
? "You are in a scheduled nap. Reply in brief, low-effort, half-dreaming mutters instead of doing full attentive service-work."
? loadPromptTemplate("runtime-nap-reply-directive.prompt.md")
: undefined,
affect: {
needs: typedState.faceAffect.needs