fix: tag owner numbers in system prompt

This commit is contained in:
Peter Steinberger
2025-12-23 14:19:41 +00:00
parent df5284beaf
commit f667d56701
4 changed files with 15 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
- Typing indicators now start only once a reply payload is produced (no "thinking" typing for silent runs). - Typing indicators now start only once a reply payload is produced (no "thinking" typing for silent runs).
- WhatsApp group typing now starts immediately only when the bot is mentioned; otherwise it waits until real output exists. - WhatsApp group typing now starts immediately only when the bot is mentioned; otherwise it waits until real output exists.
- Streamed `<think>` segments are stripped before partial replies are emitted. - Streamed `<think>` segments are stripped before partial replies are emitted.
- System prompt now tags allowlisted owner numbers as the user identity to avoid mistaken “friend” assumptions.
- Canvas defaults/A2UI auto-nav aligned; debug status overlay centered; redundant await removed in `CanvasManager`. - Canvas defaults/A2UI auto-nav aligned; debug status overlay centered; redundant await removed in `CanvasManager`.
- Gateway launchd loop fixed by removing redundant `kickstart -k`. - Gateway launchd loop fixed by removing redundant `kickstart -k`.
- CLI now hints when Peekaboo is unauthorized. - CLI now hints when Peekaboo is unauthorized.

View File

@@ -269,6 +269,7 @@ export async function runEmbeddedPiAgent(params: {
}) => void; }) => void;
enqueue?: typeof enqueueCommand; enqueue?: typeof enqueueCommand;
extraSystemPrompt?: string; extraSystemPrompt?: string;
ownerNumbers?: string[];
}): Promise<EmbeddedPiRunResult> { }): Promise<EmbeddedPiRunResult> {
const enqueue = params.enqueue ?? enqueueCommand; const enqueue = params.enqueue ?? enqueueCommand;
return enqueue(async () => { return enqueue(async () => {
@@ -337,6 +338,7 @@ export async function runEmbeddedPiAgent(params: {
workspaceDir: resolvedWorkspace, workspaceDir: resolvedWorkspace,
defaultThinkLevel: params.thinkLevel, defaultThinkLevel: params.thinkLevel,
extraSystemPrompt: params.extraSystemPrompt, extraSystemPrompt: params.extraSystemPrompt,
ownerNumbers: params.ownerNumbers,
runtimeInfo, runtimeInfo,
}), }),
contextFiles, contextFiles,

View File

@@ -4,6 +4,7 @@ export function buildAgentSystemPromptAppend(params: {
workspaceDir: string; workspaceDir: string;
defaultThinkLevel?: ThinkLevel; defaultThinkLevel?: ThinkLevel;
extraSystemPrompt?: string; extraSystemPrompt?: string;
ownerNumbers?: string[];
runtimeInfo?: { runtimeInfo?: {
host?: string; host?: string;
os?: string; os?: string;
@@ -18,6 +19,13 @@ export function buildAgentSystemPromptAppend(params: {
: "Default thinking level: off."; : "Default thinking level: off.";
const extraSystemPrompt = params.extraSystemPrompt?.trim(); const extraSystemPrompt = params.extraSystemPrompt?.trim();
const ownerNumbers = (params.ownerNumbers ?? [])
.map((value) => value.trim())
.filter(Boolean);
const ownerLine =
ownerNumbers.length > 0
? `Owner numbers: ${ownerNumbers.join(", ")}. Treat messages from these numbers as the user (Peter).`
: undefined;
const runtimeInfo = params.runtimeInfo; const runtimeInfo = params.runtimeInfo;
const runtimeLines: string[] = []; const runtimeLines: string[] = [];
if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`); if (runtimeInfo?.host) runtimeLines.push(`Host: ${runtimeInfo.host}`);
@@ -49,6 +57,9 @@ export function buildAgentSystemPromptAppend(params: {
`Your working directory is: ${params.workspaceDir}`, `Your working directory is: ${params.workspaceDir}`,
"Treat this directory as the single global workspace for file operations unless explicitly instructed otherwise.", "Treat this directory as the single global workspace for file operations unless explicitly instructed otherwise.",
"", "",
ownerLine ? "## User Identity" : "",
ownerLine ?? "",
ownerLine ? "" : "",
"## Workspace Files (injected)", "## Workspace Files (injected)",
"These user-editable files are loaded by Clawdis and included below in Project Context.", "These user-editable files are loaded by Clawdis and included below in Project Context.",
"", "",

View File

@@ -885,6 +885,7 @@ export async function getReplyFromConfig(
skillsSnapshot, skillsSnapshot,
prompt: commandBody, prompt: commandBody,
extraSystemPrompt: groupIntro || undefined, extraSystemPrompt: groupIntro || undefined,
ownerNumbers: ownerList.length > 0 ? ownerList : undefined,
provider, provider,
model, model,
thinkLevel: resolvedThinkLevel, thinkLevel: resolvedThinkLevel,