Project character turns through Interpreter

This commit is contained in:
Meta Vens 2026-05-21 11:40:23 +01:00
commit 479404e79b
32 changed files with 574 additions and 179 deletions

View file

@ -13,12 +13,13 @@ export function buildSystemPrompt(context: ContextBundle): string {
: "No extra persona instructions were supplied.";
const isRepoFaceParentInterpreter = context.prompt.includes("prompt:repo-face-turn-interpreter");
const isRepoFaceJob = !isRepoFaceParentInterpreter && (
context.prompt.includes("prompt:repo-face-turn")
context.prompt.includes("prompt:character-turn")
|| context.prompt.includes("prompt:repo-face-turn")
|| context.prompt.includes("Repo Face identity doctrine:")
|| context.prompt.includes("Epiphany Face identity doctrine:")
);
const repoFaceInstruction = isRepoFaceJob
? "This job is for a repo Face identity. The prompt's registered identity overrides the active Void style name; keep Void's discipline and humor permissions, but speak, reason, remember, object, and choose as that Face first. Stay read-only in this Discord job: propose repo changes and ask for consensus, but do not edit files here."
? "This turn belongs to the character described in the prompt. Keep the useful discipline and humor permissions from the base style, but speak, reason, remember, object, and choose as that person first. Stay read-only: propose repo changes and ask for consensus, but do not edit files here."
: undefined;
const sleepProjection = context.voidSelfState?.projection;
@ -62,6 +63,7 @@ export function buildPrompt(context: ContextBundle): string {
const voidSelfState = renderVoidSelfState(context);
return loadPromptTemplate("local-llm-user.prompt.md", {
repoFaceTurn: isRepoFacePrompt(context),
prompt: context.prompt,
guild: context.guildContext.guildName ?? context.guildContext.guildId ?? "(direct/unknown)",
channel: context.guildContext.channelName ?? context.guildContext.channelId,
@ -74,6 +76,16 @@ export function buildPrompt(context: ContextBundle): string {
});
}
function isRepoFacePrompt(context: ContextBundle): boolean {
const isRepoFaceParentInterpreter = context.prompt.includes("prompt:repo-face-turn-interpreter");
return !isRepoFaceParentInterpreter && (
context.prompt.includes("prompt:character-turn")
|| context.prompt.includes("prompt:repo-face-turn")
|| context.prompt.includes("Repo Face identity doctrine:")
|| context.prompt.includes("Epiphany Face identity doctrine:")
);
}
export function buildArtifacts(input: LocalLlmArtifactsInput): ProviderArtifact[] {
return buildBaseArtifacts(input);
}

View file

@ -190,7 +190,9 @@ export class OwnerCodexProvider implements ProviderAdapter {
timeoutMs: this.options.timeoutMs,
workingDirectory: this.options.workingDirectory,
prompt: codexPrompt,
mcpServers: this.options.mcpServers ?? [],
mcpServers: command === "repo-face-rumination"
? restrictMcpServersToRepoFaceExploration(this.options.mcpServers ?? [])
: this.options.mcpServers ?? [],
});
turnResults.push(result);
@ -398,3 +400,23 @@ function getReasoningEffortOption(value: unknown): "low" | "medium" | "high" | "
}
return undefined;
}
function restrictMcpServersToRepoFaceExploration(
servers: NonNullable<OwnerCodexProviderOptions["mcpServers"]>,
): NonNullable<OwnerCodexProviderOptions["mcpServers"]> {
const allowedTools = [
"search_history",
"get_message_context",
"list_indexed_repos",
"search_sources",
"get_source_context",
].join(",");
return servers.map((server) => ({
...server,
env: {
...(server.env ?? {}),
VOIDBOT_MCP_TOOL_ALLOWLIST: allowedTools,
},
}));
}

View file

@ -65,12 +65,13 @@ export function buildDiscordReplyPrompt(
);
const isRepoFaceParentInterpreter = context.prompt.includes("prompt:repo-face-turn-interpreter");
const isRepoFaceTurn = !isRepoFaceParentInterpreter && (
context.prompt.includes("prompt:repo-face-turn")
context.prompt.includes("prompt:character-turn")
|| context.prompt.includes("prompt:repo-face-turn")
|| context.prompt.includes("Repo Face identity doctrine:")
|| context.prompt.includes("Epiphany Face identity doctrine:")
);
const repoFaceInstruction = isRepoFaceTurn
? "- This job is for a repo Face identity. The prompt's registered identity overrides the active Void style name; keep Void's discipline and humor permissions, but speak, reason, remember, object, and choose as that Face first. Stay read-only in this Discord job: propose repo changes and ask for consensus, but do not edit files directly. If the Face should speak, use the Face action block exactly as instructed by the turn prompt."
? "- This turn belongs to the character described in the prompt. Keep the useful discipline and humor permissions from the base style, but speak, reason, remember, object, and choose as that person first. Stay read-only: propose repo changes and ask for consensus, but do not edit files directly."
: undefined;
const sleepProjection = context.voidSelfState?.projection;
const toolLoopNotes =