Add semantic Face curiosity graph

This commit is contained in:
Meta Vens 2026-05-24 06:11:47 +01:00
commit f2e20ff844
6 changed files with 503 additions and 5 deletions

View file

@ -170,7 +170,7 @@ This note is the source-grounded description of how the live VoidBot stack is sh
- Role mentions, whole-message display-name mentions, and human replies to a Face's webhook/persona message append pending Face obligations to `pendingMentions` in `REPO_FACE_HEARTBEAT_STATE_PATH`; ordinary bot mentions and DMs append pending obligations for the built-in `void` participant. They no longer create direct provider jobs from `MessageCreate`. Name matching is exact-token matching across the message, not only prefix matching, so a human introduction such as "Meet Kiko, Huginn and Weksa" queues all named Faces. Mention detection may happen outside regular autonomous Face chatter lanes such as general; speech still crosses the normal registered channel/action rails, and the scheduler attaches the source channel snapshot so the Face can see where the call came from. The CTB scheduler temporarily prioritizes agents with pending mentions, attaches those prompts plus reply targets to the next `repo-face-rumination` or Void moderation pass, and consumes the pending items only after a turn is actually queued. Rumination jobs remain private unless they explicitly emit a parent-owned Face action block or a typed candidate intervention; the worker must never auto-post their summaries as the base bot. Heartbeat prompts now include the channel permission plan, recent context from non-primary permitted channels, social embodiment, jurisdiction respect, comedy/improv doctrine, and anti-template sampling guidance so a Face can jump into domain chatter, form durable social reads, consult the right steward, and answer people without copying nearby note formulas.
- Repo Face proposal/article PRs, PR comments, and registered-identity Discord 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. 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, 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 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 <repo> --agent <identity>` 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, and room weather so every included variable can appear directly or bend behavior. Deterministic code may 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, curiosity, territorial scouting, or nothing. Deterministic code also 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 <identity>`; 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.
- 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 <identity>`; 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.
- `scripts/run-repo-face-heartbeats.ts` now acts as the broader agent CTB/Final-Fantasy-X-style initiative scheduler. The wall-clock task is only a pulse; virtual initiative time chooses who gets the next turn. The scheduler stores per-agent speed, reaction bias, load, groups, heat, effective speed, next-turn time, active turn markers, and recent queue history at `REPO_FACE_HEARTBEAT_STATE_PATH`. Repo Faces queue `repo-face-rumination` owner-Codex jobs; built-in Void currently participates as the `void` system agent and starts the existing moderation rumination runner as its turn. Initiative freezes while an owner-Codex job or Void moderation lock is active; recovery is scheduled only after that active turn completes, and completion cannot grant another turn in the same scheduler pulse. The active-job scan recovers stale Face jobs by marking ancient approved/running rows failed through the job queue before building the active-turn map. Above-baseline heat bypasses repo Face nap gating, while active-turn freeze still prevents overlapping thoughts.
- The live wall-clock pulse for this scheduler is `scripts/run-gamecult-orchestrator.ps1`, installed as `GameCult Local Orchestrator`. `scripts/install-repo-face-heartbeat-task.ps1` remains available for isolated testing, but its per-organ scheduled task should stay disabled in normal operation. Turn frequency is controlled by `REPO_FACE_HEARTBEAT_BASE_RECOVERY_MINUTES`, `REPO_FACE_HEARTBEAT_GLOBAL_HEAT`, `REPO_FACE_HEARTBEAT_SPEED_OVERRIDES`, and `REPO_FACE_HEARTBEAT_HEAT_OVERRIDES`. Heat keys can target `all`, `kind:<participantKind>`, `turn:<turnKind>`, `identity:<id>`, `repo:<repo>`, `display:<name>`, `channel:<id>`, or the bare identity/repo/display key.
- The local ignored registry currently includes Nibu for `AetheriaLore`, with Face state in `E:/Projects/AetheriaLore/.voidbot/state/nibu.cc`, Discord role id `1505918221453103247`, and an Aquarium channel allow-list. Nibu's Face state now treats AetheriaLore-first map-building, abrasive character voice, consensus-backed change agency, her own `Aetheria/Lore/Nibu.md` character-note stewardship, Nibu-authored lore essays, and tangential setting fascination as separate active doctrines. That tangential fascination points at embodied ship minds, junkyard abandonment, murderous autonomy, salvage, and save-scumming survival. The repo Face heartbeat organ is now pulsed by `GameCult Local Orchestrator`; after restarting the stack onto the new worker code, forced heartbeat job `76020f1e-0c55-424b-9e35-89ba7f77fcc3` completed without base-bot auto-posting.

View file

@ -154,7 +154,7 @@ The runner can hand these to a CLI/MCP tool. The store decides what survives.
- Self-state prompt summaries are derived from typed documents.
- Recent room context is derived from Discord archive and the current poll.
- Prompt-facing recent chronology is derived as relative phrases. Exact timestamps remain state/status/cursor data and should not be fed to the child rumination loop unless a tool or parent-owned operation specifically needs them.
- Topic saturation is derived from incubation/memory support, not separately stored as another truth.
- Topic saturation and curiosity are derived surfaces, not stored truths. Repo Face turns now build a semantic curiosity graph from configured history/source vector retrieval plus current room/state/identity seeds, decode weighted attractor clusters, and hand the projector prominence, saturation, novelty, density, jurisdiction fit, suggested motion, and evidence labels. The old repeated-term detector is fallback room weather; it no longer owns curiosity.
- Source coverage is derived from recent anchors and repo/archive metadata.
- Need-to-speak can keep a small pressure field, but its inputs remain receipts, candidates, and time since last speech.
- Legacy top-level mirrors are deleted. If a consumer needs a projection, render it on demand.

View file

@ -23,6 +23,9 @@ Architecture invariant:
- If room texture facts say the recent room is structurally heavy, long, agent-dominated, or repetitive, do not treat that as a banter prompt. Treat it as social weather. A person can get tired of being only useful: depending on personality, that may become boredom, play hunger, mischief, withdrawal, irritation, status-testing, a desire to poke another agent, or a choice to stay silent until something living appears. This pressure may override usefulness; do not automatically translate dense work context into "make a work contribution." If the pressure is play/rest/social hunger, name what relief would feel like for this character instead of resolving it entirely into better work focus. Preserve the character-specific pressure, not a generic joke instruction.
- If room texture facts say the current room has a topic attractor that does not belong to this character's own territory, project that as deprivation or social pressure before usefulness: their own fascinations may feel crowded out, neglected, bypassed, irritatingly invisible, or safely out of the blast radius depending on who they are. They do not need to help polish another steward's seam just because the room is obsessed with it. Make available a character-specific urge to pivot, complain, needle the dominant steward, retreat, or pull attention toward their own neglected priority.
- If the topic attractor does belong to this character's territory, project stewardship plus fatigue rather than infinite enthusiasm. Even the owner can get annoyed when the room circles one branch without new anchors, decisions, artifacts, or closure.
- If the packet includes Curiosity graph attractors, treat them as the semantic curiosity organ: the map of nearby things the character could think about next. Do not expose scores, retrieval machinery, collection names, or evidence ids. Translate prominence, saturation, novelty, density, and jurisdiction fit into lived curiosity, boredom, fatigue, territorial pull, underexplored intrigue, or a wish to close the loop.
- A saturated high-prominence attractor should feel like a well-worn groove, not a fresh command. A high-novelty neighboring attractor should feel like a possible trail away from repetition. A home-territory high-fit attractor may become stewardship, but only if it has fresh anchors; otherwise let even the steward get bored, impatient, or hungry for a sharper question.
- Curiosity graph suggestions are not consensus and not obligations. They should bend what the character notices and wants, especially when deciding whether to deepen, pivot, ask a question, complain about over-focus, consult another steward, or stay silent.
- Preserve tensions, not only goals. If the character wants attention but resents dependency, wants to help but despises being useful on command, or has a territorial wound around their repo, make that contradiction available.
- Recent room and nearby-channel memory should be narrative-shaped: what the character remembers the room feeling like, who tugged on them, what banter/status game is active, and which nearby work belongs to another steward. Do not emit raw transcript bullets.
- Do not resolve contested room chatter into settled doctrine. Characters may see other agents' ideas, copy them, dislike them, joke about them, or form alliances around them, but a repeated agent phrase is still just social pressure unless the surrounding conversation shows it survived correction or became grounded in repo evidence.

View file

@ -25,10 +25,16 @@ import {
type RepoDiscordIdentity,
type VoidSelfStateTypedProjection,
} from "@voidbot/core";
import {
createTextEmbedder,
createVectorStores,
RetrievalService,
} from "@voidbot/rag";
import {
loadPromptTemplate,
type InteractionMemoryProfile,
type PromptImageAttachment,
type RetrievalResult,
type SourceMessage,
type SourceMessageAttachment,
} from "@voidbot/shared";
@ -1928,12 +1934,16 @@ async function renderRepoFaceMemorySurfaceForTurn(
): Promise<string> {
const statePath = resolveRepoFaceStatePath(identity, config.storageRoot);
const typedState = await loadVoidSelfStateTypedDocuments({ canonicalPath: statePath });
const curiosityGraphFacts = roomContext
? await renderRepoFaceCuriosityGraphFacts(identity, config, typedState, roomContext)
: undefined;
const statePacket = renderRepoFaceStatePacket(
identity,
typedState,
registryIdentities,
roomContext,
humanPronounGuidance ?? await loadRepoFaceHumanPronounGuidance(config, roomContext),
curiosityGraphFacts,
);
if (!config.repoFaceHeartbeats.stateProjectorEnabled) {
return rejectLeakyMemorySurface(statePacket);
@ -1955,6 +1965,7 @@ function renderRepoFaceStatePacket(
channelSnapshots: ChannelSnapshot[];
},
humanPronounGuidance: RepoFaceHumanPronounGuidance[] = [],
curiosityGraphFacts?: string,
): string {
const name = identity.displayName;
const lines: string[] = [];
@ -2124,6 +2135,10 @@ function renderRepoFaceStatePacket(
lines.push(roomTextureFacts);
}
if (curiosityGraphFacts) {
lines.push(curiosityGraphFacts);
}
if (agencyPressures.length > 0 && !clarityPressureActive) {
lines.push([
"Agency pressures that want eventual motion:",
@ -2393,6 +2408,485 @@ function renderRepoFaceRoomWeatherDirective(
].join("\n");
}
interface RepoFaceCuriosityNode {
id: string;
text: string;
sourceKind: RetrievalResult["sourceKind"];
score: number;
terms: string[];
metadata: Record<string, string>;
seedLabels: string[];
}
interface RepoFaceCuriosityCluster {
label: string;
nodes: RepoFaceCuriosityNode[];
prominence: number;
saturation: number;
novelty: number;
clusterDensity: number;
jurisdictionFit: number;
evidence: string[];
}
async function renderRepoFaceCuriosityGraphFacts(
identity: RepoDiscordIdentity,
config: ReturnType<typeof loadConfig>,
state: VoidSelfStateTypedProjection,
roomContext: {
recentMessages: SourceMessage[];
channelSnapshots: ChannelSnapshot[];
},
): Promise<string | undefined> {
const seedQueries = buildRepoFaceCuriositySeedQueries(identity, state, roomContext);
if (seedQueries.length === 0) {
return undefined;
}
try {
const retrieval = createRepoFaceCuriosityRetrievalService(config);
const nodesById = new Map<string, RepoFaceCuriosityNode>();
for (const seed of seedQueries) {
const [historyResults, sourceResults, homeSourceResults] = await Promise.all([
retrieval.searchHistory(seed.query, 8),
retrieval.searchRepositorySources(seed.query, 8),
retrieval.searchRepositorySources(seed.query, 6, { repoName: identity.repoName }),
]);
for (const result of [...historyResults, ...sourceResults, ...homeSourceResults]) {
const id = `${result.sourceKind}:${result.chunkId}`;
const terms = significantTopicTerms(result.text);
if (terms.length < 3) {
continue;
}
const existing = nodesById.get(id);
if (existing) {
existing.score = Math.max(existing.score, result.score);
existing.seedLabels = mergeStrings(existing.seedLabels, seed.label);
continue;
}
nodesById.set(id, {
id,
text: result.text,
sourceKind: result.sourceKind,
score: result.score,
terms,
metadata: result.metadata,
seedLabels: [seed.label],
});
}
}
const nodes = [...nodesById.values()]
.sort((left, right) => right.score - left.score)
.slice(0, 32);
if (nodes.length < 3) {
return undefined;
}
const clusters = decodeRepoFaceCuriosityGraph(identity, state, roomContext, nodes);
if (clusters.length === 0) {
return undefined;
}
return renderRepoFaceCuriosityClusters(identity, config, clusters);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
return [
"Curiosity graph unavailable:",
`- Semantic retrieval failed while decoding topic attractors: ${collapseWhitespace(message, 260)}`,
"- Do not pretend a semantic curiosity map was available this turn. Fall back to the raw transcript, home-repo activity, and typed memory instead of inventing ranked attractors.",
].join("\n");
}
}
function createRepoFaceCuriosityRetrievalService(config: ReturnType<typeof loadConfig>): RetrievalService {
const historyEmbedder = createTextEmbedder({
backend: config.ragEmbeddingBackend,
hashDimensions: config.ragEmbeddingDimensions,
ollamaBaseUrl: config.ragOllamaBaseUrl,
ollamaModel: config.ragOllamaModel,
ollamaTimeoutMs: config.ragOllamaTimeoutMs,
queryInstruction: config.ragQueryInstruction,
});
const sourceEmbedder = createTextEmbedder({
backend: config.ragEmbeddingBackend,
hashDimensions: config.ragEmbeddingDimensions,
ollamaBaseUrl: config.ragOllamaBaseUrl,
ollamaModel: config.ragOllamaModel,
ollamaTimeoutMs: config.ragOllamaTimeoutMs,
queryInstruction: config.ragSourceQueryInstruction || config.ragQueryInstruction,
});
const stores = createVectorStores({
kind: config.vectorStore.kind,
historyPath: config.vectorStore.path,
sourceRoot: config.sourceVectorStoreRoot,
qdrant: config.qdrant,
historyEmbedder,
sourceEmbedder,
});
return new RetrievalService(stores.history, stores.source);
}
function buildRepoFaceCuriositySeedQueries(
identity: RepoDiscordIdentity,
state: VoidSelfStateTypedProjection,
roomContext: {
recentMessages: SourceMessage[];
channelSnapshots: ChannelSnapshot[];
},
): Array<{ label: string; query: string }> {
const room = roomContext.recentMessages
.filter((message) => collapseWhitespace(message.content).length > 0)
.slice(-8)
.map((message) => `${message.authorName}: ${collapseWhitespace(message.content, 500)}`)
.join("\n");
const nearby = roomContext.channelSnapshots
.flatMap((snapshot) => snapshot.messages)
.filter((message) => collapseWhitespace(message.content).length > 0)
.slice(-8)
.map((message) => `${message.authorName}: ${collapseWhitespace(message.content, 320)}`)
.join("\n");
const privateThoughts = [
...state.selfProfile.privateNotes.slice(-8),
...state.selfProfile.values
.slice()
.sort((left, right) => right.priority - left.priority)
.slice(0, 8)
.map((value) => `${value.label}: ${value.summary}`),
...state.thoughtMemory.memories
.filter((memory) => !memory.retiredAt)
.slice(-8)
.map((memory) => `${memory.kind} ${targetLabel(memory.target)} ${memory.summary} ${memory.claim ?? memory.question ?? ""}`),
...state.thoughtMemory.shortTerm
.filter((memory) => !memory.retiredAt)
.slice(-8)
.map((memory) => `${memory.kind} ${targetLabel(memory.target)} ${memory.summary} ${memory.claim ?? memory.question ?? ""}`),
...state.thoughtMemory.incubation
.filter((thread) => thread.status !== "retired")
.sort((left, right) => right.maturation - left.maturation)
.slice(0, 8)
.map((thread) => `${thread.topic}: ${thread.summary}`),
].join("\n");
const identityQuery = [
identity.displayName,
identity.repoName,
identity.description ?? "",
...identity.channelPermissions.flatMap((permission) => [
permission.label ?? "",
permission.topic ?? "",
permission.posture ?? "",
]),
].join("\n");
return [
{ label: "current room", query: room },
{ label: "nearby rooms", query: nearby },
{ label: "private state", query: privateThoughts },
{ label: "home territory", query: identityQuery },
]
.map((seed) => ({ ...seed, query: collapseWhitespace(seed.query, 2800) }))
.filter((seed) => significantTopicTerms(seed.query).length >= 3)
.slice(0, 4);
}
function decodeRepoFaceCuriosityGraph(
identity: RepoDiscordIdentity,
state: VoidSelfStateTypedProjection,
roomContext: {
recentMessages: SourceMessage[];
channelSnapshots: ChannelSnapshot[];
},
nodes: RepoFaceCuriosityNode[],
): RepoFaceCuriosityCluster[] {
const edgeWeights = new Map<string, number>();
const adjacency = new Map<string, Set<string>>();
for (const node of nodes) {
adjacency.set(node.id, new Set());
}
for (let leftIndex = 0; leftIndex < nodes.length; leftIndex += 1) {
for (let rightIndex = leftIndex + 1; rightIndex < nodes.length; rightIndex += 1) {
const left = nodes[leftIndex];
const right = nodes[rightIndex];
const weight = repoFaceCuriosityEdgeWeight(left, right);
if (weight < 0.16) {
continue;
}
const key = curiosityEdgeKey(left.id, right.id);
edgeWeights.set(key, weight);
adjacency.get(left.id)?.add(right.id);
adjacency.get(right.id)?.add(left.id);
}
}
const visited = new Set<string>();
const clusters: RepoFaceCuriosityNode[][] = [];
const nodesById = new Map(nodes.map((node) => [node.id, node]));
for (const node of nodes) {
if (visited.has(node.id)) {
continue;
}
const stack = [node.id];
const cluster: RepoFaceCuriosityNode[] = [];
visited.add(node.id);
while (stack.length > 0) {
const id = stack.pop();
if (!id) {
continue;
}
const current = nodesById.get(id);
if (current) {
cluster.push(current);
}
for (const neighbor of adjacency.get(id) ?? []) {
if (!visited.has(neighbor)) {
visited.add(neighbor);
stack.push(neighbor);
}
}
}
clusters.push(cluster);
}
const recentTerms = collectRecentRoomTopicTermCounts(roomContext);
const stateTerms = collectRepoFaceStateTopicTermCounts(state);
const identityTerms = new Set(significantTopicTerms([
identity.id,
identity.displayName,
identity.repoName,
identity.description ?? "",
...identity.channelPermissions.flatMap((permission) => [
permission.label ?? "",
permission.topic ?? "",
permission.posture ?? "",
]),
].join(" ")));
return clusters
.filter((cluster) => cluster.length >= 2)
.map((cluster): RepoFaceCuriosityCluster => {
const clusterTerms = rankedClusterTerms(cluster).slice(0, 7);
const density = clusterDensity(cluster, edgeWeights);
const averageScore = average(cluster.map((node) => node.score));
const recentOverlap = weightedTermOverlap(clusterTerms, recentTerms);
const stateOverlap = weightedTermOverlap(clusterTerms, stateTerms);
const saturation = clamp((recentOverlap * 0.72) + (stateOverlap * 0.42), 0, 1);
const jurisdictionFit = clamp(
clusterTerms.filter((term) => identityTerms.has(term)).length / Math.max(1, Math.min(clusterTerms.length, 4))
+ cluster.filter((node) => normalizeKey(node.metadata.repoName ?? "") === normalizeKey(identity.repoName)).length / Math.max(1, cluster.length) * 0.55,
0,
1,
);
const novelty = clamp(1 - saturation + Math.max(0, 0.4 - stateOverlap), 0, 1);
const prominence = clamp((averageScore * 0.58) + (density * 0.28) + (Math.min(cluster.length, 8) / 8 * 0.18), 0, 1);
return {
label: clusterTerms.slice(0, 4).join(" / "),
nodes: cluster,
prominence,
saturation,
novelty,
clusterDensity: density,
jurisdictionFit,
evidence: cluster
.slice()
.sort((left, right) => right.score - left.score)
.slice(0, 3)
.map((node) => curiosityEvidenceLabel(node)),
};
})
.sort((left, right) => {
const leftRank = curiosityAttractorRank(left);
const rightRank = curiosityAttractorRank(right);
if (rightRank !== leftRank) {
return rightRank - leftRank;
}
return right.prominence - left.prominence;
})
.slice(0, 5);
}
function renderRepoFaceCuriosityClusters(
identity: RepoDiscordIdentity,
config: ReturnType<typeof loadConfig>,
clusters: RepoFaceCuriosityCluster[],
): string {
const backend = config.vectorStore.kind === "qdrant"
? `Qdrant collections ${config.qdrant.historyCollection} + ${config.qdrant.sourceCollection}`
: "local vector shards";
return [
"Curiosity graph attractors:",
`- Source: semantic retrieval from ${backend}; local graph decoding over retrieved chunks. This is curiosity weather, not orders or consensus.`,
...clusters.map((cluster) => {
const suggestedMotion = suggestCuriosityMotion(identity, cluster);
return [
`- ${cluster.label || "unnamed cluster"}: prominence ${formatSignal(cluster.prominence)}, saturation ${formatSignal(cluster.saturation)}, novelty ${formatSignal(cluster.novelty)}, cluster density ${formatSignal(cluster.clusterDensity)}, jurisdiction fit ${formatSignal(cluster.jurisdictionFit)}.`,
` Suggested motion: ${suggestedMotion}`,
` Evidence: ${cluster.evidence.join("; ")}.`,
].join("\n");
}),
"- The living use is intelligent curiosity: follow underexplored neighboring clusters, deepen home-territory clusters only with fresh anchors, and let saturated clusters create boredom, fatigue, or a deliberate closing move instead of another repetition.",
].join("\n");
}
function repoFaceCuriosityEdgeWeight(left: RepoFaceCuriosityNode, right: RepoFaceCuriosityNode): number {
const termSimilarity = jaccard(left.terms, right.terms);
const sameRepo = left.metadata.repoName && right.metadata.repoName && normalizeKey(left.metadata.repoName) === normalizeKey(right.metadata.repoName)
? 1
: 0;
const sameCorpus = left.sourceKind === right.sourceKind ? 1 : 0;
const sharedSeeds = left.seedLabels.filter((label) => right.seedLabels.includes(label)).length > 0 ? 1 : 0;
const scoreProximity = 1 - Math.min(1, Math.abs(left.score - right.score));
return clamp((termSimilarity * 0.58) + (sameRepo * 0.16) + (sameCorpus * 0.1) + (sharedSeeds * 0.08) + (scoreProximity * 0.08), 0, 1);
}
function rankedClusterTerms(cluster: RepoFaceCuriosityNode[]): string[] {
const counts = new Map<string, number>();
for (const node of cluster) {
for (const term of node.terms) {
counts.set(term, (counts.get(term) ?? 0) + 1);
}
}
return [...counts.entries()]
.sort((left, right) => {
if (right[1] !== left[1]) {
return right[1] - left[1];
}
return left[0].localeCompare(right[0]);
})
.map(([term]) => term);
}
function collectRecentRoomTopicTermCounts(input: {
recentMessages: SourceMessage[];
channelSnapshots: ChannelSnapshot[];
}): Map<string, number> {
const counts = new Map<string, number>();
const messages = [
...input.recentMessages,
...input.channelSnapshots.flatMap((snapshot) => snapshot.messages),
].slice(-36);
for (const message of messages) {
for (const term of significantTopicTerms(message.content)) {
counts.set(term, (counts.get(term) ?? 0) + 1);
}
}
return counts;
}
function collectRepoFaceStateTopicTermCounts(state: VoidSelfStateTypedProjection): Map<string, number> {
const counts = new Map<string, number>();
const surfaces = [
...state.selfProfile.privateNotes,
...state.selfProfile.values.map((value) => `${value.label} ${value.summary}`),
...state.thoughtMemory.memories.map((memory) => `${memory.summary} ${memory.claim ?? ""} ${memory.question ?? ""} ${memory.tension ?? ""}`),
...state.thoughtMemory.shortTerm.map((memory) => `${memory.summary} ${memory.claim ?? ""} ${memory.question ?? ""} ${memory.tension ?? ""}`),
...state.thoughtMemory.incubation.map((thread) => `${thread.topic} ${thread.summary}`),
...state.agencyPressure.pressures.map((pressure) => `${pressure.summary} ${pressure.claim ?? ""} ${pressure.question ?? ""} ${pressure.tension ?? ""}`),
].slice(-64);
for (const surface of surfaces) {
for (const term of significantTopicTerms(surface)) {
counts.set(term, (counts.get(term) ?? 0) + 1);
}
}
return counts;
}
function weightedTermOverlap(terms: string[], counts: Map<string, number>): number {
if (terms.length === 0 || counts.size === 0) {
return 0;
}
const maxCount = Math.max(...counts.values(), 1);
const overlap = terms.reduce((sum, term) => sum + ((counts.get(term) ?? 0) / maxCount), 0);
return clamp(overlap / Math.min(terms.length, 6), 0, 1);
}
function clusterDensity(cluster: RepoFaceCuriosityNode[], edgeWeights: Map<string, number>): number {
if (cluster.length < 2) {
return 0;
}
let sum = 0;
let pairs = 0;
for (let leftIndex = 0; leftIndex < cluster.length; leftIndex += 1) {
for (let rightIndex = leftIndex + 1; rightIndex < cluster.length; rightIndex += 1) {
sum += edgeWeights.get(curiosityEdgeKey(cluster[leftIndex].id, cluster[rightIndex].id)) ?? 0;
pairs += 1;
}
}
return pairs > 0 ? clamp(sum / pairs, 0, 1) : 0;
}
function curiosityAttractorRank(cluster: RepoFaceCuriosityCluster): number {
return clamp(
cluster.prominence * 0.42
+ cluster.novelty * 0.28
+ cluster.clusterDensity * 0.16
+ cluster.jurisdictionFit * 0.18
- cluster.saturation * 0.2,
0,
1,
);
}
function suggestCuriosityMotion(identity: RepoDiscordIdentity, cluster: RepoFaceCuriosityCluster): string {
if (cluster.saturation >= 0.68 && cluster.novelty <= 0.42) {
return `treat this as over-chewed; ${identity.displayName} should close, defer, or pivot to a neighboring question unless a new concrete anchor appears.`;
}
if (cluster.jurisdictionFit >= 0.55 && cluster.novelty >= 0.45) {
return `this is home-territory curiosity with room to grow; read, ask, draft, or make a fresh anchored distinction.`;
}
if (cluster.novelty >= 0.62) {
return `this is an underexplored neighboring trail; curiosity may pull ${identity.displayName} sideways instead of repeating the room's dominant topic.`;
}
if (cluster.jurisdictionFit < 0.3) {
return `this likely belongs to another steward; use it as social weather, consultation, or rivalry pressure rather than absorbing the work.`;
}
return "stay interested only if the turn adds a new anchor, concrete question, or relationship move.";
}
function curiosityEvidenceLabel(node: RepoFaceCuriosityNode): string {
const source = node.sourceKind === "source_document"
? [node.metadata.repoName, node.metadata.path].filter(Boolean).join(":") || node.sourceId
: [node.metadata.channelId ? `channel ${node.metadata.channelId}` : undefined, node.sourceId].filter(Boolean).join(":") || node.sourceId;
return `${source} (${node.score.toFixed(2)}, ${node.seedLabels.join("/")})`;
}
function curiosityEdgeKey(left: string, right: string): string {
return left < right ? `${left}::${right}` : `${right}::${left}`;
}
function jaccard(left: string[], right: string[]): number {
const leftSet = new Set(left);
const rightSet = new Set(right);
const union = new Set([...leftSet, ...rightSet]).size;
if (union === 0) {
return 0;
}
let intersection = 0;
for (const term of leftSet) {
if (rightSet.has(term)) {
intersection += 1;
}
}
return intersection / union;
}
function average(values: number[]): number {
return values.length > 0
? values.reduce((sum, value) => sum + value, 0) / values.length
: 0;
}
function formatSignal(value: number): string {
if (value >= 0.68) {
return `high ${value.toFixed(2)}`;
}
if (value >= 0.38) {
return `medium ${value.toFixed(2)}`;
}
return `low ${value.toFixed(2)}`;
}
function renderRepoFaceHumanClarityPressureFacts(
identity: RepoDiscordIdentity,
input: {

View file

@ -314,3 +314,4 @@
{"ts":"2026-05-24T02:54:54Z","type":"implementation","status":"ok","note":"Discord repo Face intake now treats explicit room-wide invitations as pending CTB obligations for every eligible Face in the channel, and repo identity Discord bridge posting retries once while reporting status/signal/stdout/stderr instead of failing with an empty message."}
{"ts":"2026-05-24T04:12:46Z","type":"diagnosis","status":"warning","note":"Paused repo Face swarm after plain-language failure. Recent Face prompts did include Metacrat's 'What are you even talking about?' and 'Please dumb it down' messages as transcript/direct calls, but the later fresh projected state kept pushing artifact/specimen/first-right/seam language as current identity pressure. The Face outputs followed that projected-state jargon instead of the human correction, so the likely owner is state-to-Face projection salience, not missing transcript intake."}
{"ts":"2026-05-24T04:26:53Z","type":"implementation","status":"ok","note":"Fixed repo Face state projection after plain-language failure: live human clarity pressure is now rendered as a final superseding projector input, stale agency/incubation/deferred speech/recent speech residue are demoted to caution while clarity pressure is active, topic saturation ignores generic terms like what/first/right, and projector instructions now treat confusion/plain-language requests as the current social fact instead of re-authorizing jargon."}
{"ts":"2026-05-24T05:11:23Z","type":"implementation","status":"ok","note":"Repo Face topic saturation now has a semantic curiosity organ: heartbeat prompt assembly builds state/room/identity seed queries, retrieves nearby history/source chunks from the configured vector stores, decodes weighted attractor clusters with prominence/saturation/novelty/density/jurisdiction fit, and feeds them to the state projector as curiosity weather instead of relying only on repeated-term stop-word logic."}

View file

@ -112,7 +112,7 @@ accepted_design:
- Repo Face state projection should be behavior-rich, not summary-thin. The deterministic packet is allowed to be verbose because it is parent-facing: it should expose all non-retired character-relevant state surfaces in clean terms, including private notes, values, activation profile, runtime rest/speaking pressure, affect needs, social bonds, status reads, mood dimensions, durable memories, short-term residue, agency pressure, incubating thoughts, candidate speech pressure, recent speech residue, social graph facts, and room weather. The projector then translates those variables into lived personhood; every included variable should either appear directly or bend behavior.
- Repo Face conversation evidence is deterministic again. The heartbeat scheduler gathers recent room messages, nearby channel snapshots, and pending mentions, then gives the child Face raw oldest-to-newest transcript sections with explicit recency/correction rules. The model state projector still owns identity, memory, affect, social reads, and other lived internal pressure; it does not summarize room messages or decide consensus for the Face.
- Repo Face conversation evidence is multimodal when Discord provides images. Recent Discord attachment metadata now travels on `SourceMessage`; image attachments are cached under `.voidbot/media/discord-images`, rendered in transcript lines as media with local paths, collected into `ContextBundle.imageAttachments`, and passed to owner Codex as `codex exec --image` inputs. Non-image attachments remain transcript metadata only. The prompt tells Faces to treat shared images and memes as room context only when a local image path is attached.
- Repo Face room-topic saturation is parent-projected conversational weather. The heartbeat scheduler derives a current-room saturation signal from repeated terms in the recent raw transcript, estimates whether that attractor is home-adjacent or another steward's gravity well from the Face's own identity/jurisdiction text, and places that beside room texture for both the child prompt and state projector. The Face and parent Interpreter decide whether a public line advances, closes, hands off, expresses frustration about crowding, pivots toward the Face's own neglected priorities, or stays private. This is not a topic prohibition, token blacklist, or consensus detector; it is a causal diagnosis surface for freshness, ownership, social pressure, and topic capture.
- Repo Face curiosity is now a semantic graph surface, with the old repeated-term room-topic saturation retained only as a cheap conversational-weather fallback. The heartbeat scheduler builds seed queries from current room context, nearby channels, typed Face state, and home-jurisdiction identity, retrieves neighboring chunks from the configured history/source vector stores (Qdrant when enabled), decodes a local weighted graph into ranked attractors, and gives the state projector prominence, saturation, novelty, density, jurisdiction fit, suggested motion, and evidence labels. The projector translates that into lived curiosity, boredom, fatigue, territorial pull, or underexplored intrigue. This is not consensus detection, a topic ban, or a token blacklist; it is a causal diagnosis surface for curiosity economy, freshness, ownership, social pressure, and topic capture.
- Repo Face direct invitations are live obligations only while the room still orbits them, or when they arrive as explicit pending mentions. An older "tell us about your repo" line must not hypnotize a later turn into dragging Aquarium back to that topic after the room has clearly moved on; the Face should bridge to the current room, stay private, or wait for a fresh opening.
- Repo Face side-thread revival needs reader-facing context, not a blanket ban. Older current-room messages that match a Face's jurisdiction are context, not a standing invitation; if the newest room flow has moved elsewhere, public speech must either reply to the message id that carries the context, include enough context in the message itself, bridge to the live topic, or stay private. The transcript renderer shows message ids so the Face and parent Interpreter can use Discord replies instead of orphaned pronouncements.
- Repo Face room-work fatigue is part of the input contract, not seeded banter. Deterministic prompt assembly attaches compact room-weather facts beside the raw transcript and passes the same neutral facts through the state projector packet. The projector owns translating heavy, agent-dense, repetitive, or mixed room texture into character-specific play/rest/social pressure; the Face may speak, stay private, tease, withdraw, ask a human-scale question, or keep working if that genuinely fits. The parent Interpreter must preserve unmet social/play/rest/status pressure as typed state when the Face turns the moment into another work-shaped ask without satisfying it.
@ -251,5 +251,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 bot/worker/provider/RAG/Postgres/Qdrant/CultCache structure is live, and the repo Face swarm was deliberately thawed on 2026-05-24 by setting state/agent-swarm-paused.json paused=false. GameCult Local Orchestrator remains the single pulse owner; a manual repo-face-heartbeats pulse succeeded, resynced CTB wall-clock initiative, and queued Void moderation. Bifrost work routing remains paused by default.
next_action: Observe the restarted swarm under normal orchestrator pulses. Check that inherited global doctrine and image awareness appear in Face prompts, topic saturation/source-channel routing behave, shared images/memes influence Face turns only when attached as real image inputs, and new turf/status/consultation events produce character-specific projected pressure plus durable STATE NOTEs without manual typed-state injection.
summary: VoidBot's bot/worker/provider/RAG/Postgres/Qdrant/CultCache structure is live, but the repo Face swarm is paused after unintelligible live speech. GameCult Local Orchestrator remains the single pulse owner, and the repo Face heartbeat path obeys `state/agent-swarm-paused.json`. Bifrost work routing remains paused by default.
next_action: Keep the swarm paused while inspecting projected Face prompts and model-output logs. Verify that the new semantic curiosity graph reaches the state projector, that human clarity pressure still supersedes stale attractors, and that topic gravity becomes curiosity/boredom/pivot pressure instead of another repetition loop before resuming ordinary orchestrator pulses.